-
Notifications
You must be signed in to change notification settings - Fork 36
/
LinearLayout.js
44 lines (42 loc) · 1.28 KB
/
LinearLayout.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/** @module deliteful/LinearLayout */
define([
"delite/register",
"delite/DisplayContainer",
"requirejs-dplugins/css!./LinearLayout/LinearLayout.css"
], function (register, DisplayContainer) {
/**
* A layout container based on CSS3 Flexible Box.
*
* Child elements in a LinearLayout container can be laid out horizontally or vertically.
* A child can have a flexible width or height depending on orientation.
* To enable flexibility of a child, add the CSS class "fill" on it.
* @example
* <d-linear-layout>
* <div>...</div>
* <div class="fill">...</div>
* <div>...</div>
* </d-linear-layout>
* @class module:deliteful/LinearLayout
* @augments module:delite/DisplayContainer
*/
return register("d-linear-layout", [ HTMLElement, DisplayContainer ], /** @lends module:deliteful/LinearLayout# */{
/**
* The name of the CSS class of this widget.
* @member {string}
* @default "d-linear-layout"
*/
baseClass: "d-linear-layout",
/**
* True if the container is vertical.
* @member {boolean}
* @default true
*/
vertical: true,
refreshRendering: function (oldValues) {
if ("vertical" in oldValues) {
this.toggleClass("-d-linear-layout-v", this.vertical);
this.toggleClass("-d-linear-layout-h", !this.vertical);
}
}
});
});