src/cm/media/js/lib/yui/yui3-3.15.0/build/panel/panel.js
changeset 602 e16a97fb364a
equal deleted inserted replaced
601:d334a616c023 602:e16a97fb364a
       
     1 YUI.add('panel', function (Y, NAME) {
       
     2 
       
     3 // TODO: Change this description!
       
     4 /**
       
     5 Provides a Panel widget, a widget that mimics the functionality of a regular OS
       
     6 window. Comes with Standard Module support, XY Positioning, Alignment Support,
       
     7 Stack (z-index) support, modality, auto-focus and auto-hide functionality, and
       
     8 header/footer button support.
       
     9 
       
    10 @module panel
       
    11 **/
       
    12 
       
    13 var getClassName = Y.ClassNameManager.getClassName;
       
    14 
       
    15 // TODO: Change this description!
       
    16 /**
       
    17 A basic Panel Widget, which can be positioned based on Page XY co-ordinates and
       
    18 is stackable (z-index support). It also provides alignment and centering support
       
    19 and uses a standard module format for it's content, with header, body and footer
       
    20 section support. It can be made modal, and has functionality to hide and focus
       
    21 on different events. The header and footer sections can be modified to allow for
       
    22 button support.
       
    23 
       
    24 @class Panel
       
    25 @constructor
       
    26 @extends Widget
       
    27 @uses WidgetAutohide
       
    28 @uses WidgetButtons
       
    29 @uses WidgetModality
       
    30 @uses WidgetPosition
       
    31 @uses WidgetPositionAlign
       
    32 @uses WidgetPositionConstrain
       
    33 @uses WidgetStack
       
    34 @uses WidgetStdMod
       
    35 @since 3.4.0
       
    36  */
       
    37 Y.Panel = Y.Base.create('panel', Y.Widget, [
       
    38     // Other Widget extensions depend on these two.
       
    39     Y.WidgetPosition,
       
    40     Y.WidgetStdMod,
       
    41 
       
    42     Y.WidgetAutohide,
       
    43     Y.WidgetButtons,
       
    44     Y.WidgetModality,
       
    45     Y.WidgetPositionAlign,
       
    46     Y.WidgetPositionConstrain,
       
    47     Y.WidgetStack
       
    48 ], {
       
    49     // -- Public Properties ----------------------------------------------------
       
    50 
       
    51     /**
       
    52     Collection of predefined buttons mapped from name => config.
       
    53 
       
    54     Panel includes a "close" button which can be use by name. When the close
       
    55     button is in the header (which is the default), it will look like: [x].
       
    56 
       
    57     See `addButton()` for a list of possible configuration values.
       
    58 
       
    59     @example
       
    60         // Panel with close button in header.
       
    61         var panel = new Y.Panel({
       
    62             buttons: ['close']
       
    63         });
       
    64 
       
    65         // Panel with close button in footer.
       
    66         var otherPanel = new Y.Panel({
       
    67             buttons: {
       
    68                 footer: ['close']
       
    69             }
       
    70         });
       
    71 
       
    72     @property BUTTONS
       
    73     @type Object
       
    74     @default {close: {}}
       
    75     @since 3.5.0
       
    76     **/
       
    77     BUTTONS: {
       
    78         close: {
       
    79             label  : 'Close',
       
    80             action : 'hide',
       
    81             section: 'header',
       
    82 
       
    83             // Uses `type="button"` so the button's default action can still
       
    84             // occur but it won't cause things like a form to submit.
       
    85             template  : '<button type="button" />',
       
    86             classNames: getClassName('button', 'close')
       
    87         }
       
    88     }
       
    89 }, {
       
    90     ATTRS: {
       
    91         // TODO: API Docs.
       
    92         buttons: {
       
    93             value: ['close']
       
    94         }
       
    95     }
       
    96 });
       
    97 
       
    98 
       
    99 }, '@VERSION@', {
       
   100     "requires": [
       
   101         "widget",
       
   102         "widget-autohide",
       
   103         "widget-buttons",
       
   104         "widget-modality",
       
   105         "widget-position",
       
   106         "widget-position-align",
       
   107         "widget-position-constrain",
       
   108         "widget-stack",
       
   109         "widget-stdmod"
       
   110     ],
       
   111     "skinnable": true
       
   112 });