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