neo.mjs 5.10.13 → 5.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/ServiceWorker.mjs +2 -2
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/component/dateSelector/MainContainer.mjs +36 -22
- package/examples/component/timer/MainContainer.mjs +71 -0
- package/examples/component/timer/MainContainerController.mjs +95 -0
- package/examples/component/timer/app.mjs +7 -0
- package/examples/component/timer/index.html +12 -0
- package/examples/component/timer/neo-config.json +7 -0
- package/examples/component/video/MainContainer.mjs +46 -0
- package/examples/component/video/MainContainerController.mjs +37 -0
- package/examples/component/video/app.mjs +7 -0
- package/examples/component/video/index.html +12 -0
- package/examples/component/video/neo-config.json +7 -0
- package/examples/layout/form/MainContainer.mjs +131 -0
- package/examples/layout/form/app.mjs +6 -0
- package/examples/layout/form/index.html +11 -0
- package/examples/layout/form/neo-config.json +6 -0
- package/examples/list/base/MainModel.mjs +3 -0
- package/examples/list/base/MainStore.mjs +6 -0
- package/examples/table/container/MainContainer.mjs +6 -0
- package/package.json +4 -4
- package/resources/scss/src/component/Timer.scss +115 -0
- package/resources/scss/src/component/Video.scss +31 -0
- package/resources/scss/src/layout/Form.scss +27 -0
- package/resources/scss/theme-dark/component/Timer.scss +14 -0
- package/resources/scss/theme-dark/component/Video.scss +11 -0
- package/resources/scss/theme-light/component/Timer.scss +15 -0
- package/resources/scss/theme-light/component/Video.scss +11 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/component/DateSelector.mjs +44 -10
- package/src/component/Timer.mjs +328 -0
- package/src/component/Video.mjs +165 -0
- package/src/form/field/Date.mjs +42 -0
- package/src/layout/Flexbox.mjs +21 -0
- package/src/layout/Form.mjs +140 -0
- package/src/list/Base.mjs +11 -1
- package/src/selection/ListModel.mjs +3 -1
- package/src/table/Container.mjs +17 -0
- package/src/table/header/Button.mjs +36 -9
- package/src/table/header/Toolbar.mjs +26 -1
package/apps/ServiceWorker.mjs
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import CheckBox from '../../../src/form/field/CheckBox.mjs';
|
2
2
|
import ConfigurationViewport from '../../ConfigurationViewport.mjs';
|
3
|
+
import DateField from '../../../src/form/field/Date.mjs';
|
3
4
|
import DateSelector from '../../../src/component/DateSelector.mjs';
|
4
5
|
import Radio from '../../../src/form/field/Radio.mjs';
|
5
6
|
import NumberField from '../../../src/form/field/Number.mjs';
|
@@ -14,11 +15,12 @@ class MainContainer extends ConfigurationViewport {
|
|
14
15
|
}
|
15
16
|
|
16
17
|
createConfigurationComponents() {
|
17
|
-
let me
|
18
|
+
let me = this,
|
19
|
+
exampleComponent = me.exampleComponent;
|
18
20
|
|
19
21
|
return [{
|
20
22
|
module : Radio,
|
21
|
-
checked :
|
23
|
+
checked : exampleComponent.currentDate.getMonth() === 0,
|
22
24
|
hideValueLabel: false,
|
23
25
|
labelText : 'currentDate (month)',
|
24
26
|
listeners : {change: me.onMonthRadioChange.bind(me, 0)},
|
@@ -26,7 +28,7 @@ class MainContainer extends ConfigurationViewport {
|
|
26
28
|
valueLabelText: 'Jan'
|
27
29
|
}, {
|
28
30
|
module : Radio,
|
29
|
-
checked :
|
31
|
+
checked : exampleComponent.currentDate.getMonth() === 1,
|
30
32
|
hideValueLabel: false,
|
31
33
|
labelText : '',
|
32
34
|
listeners : {change: me.onMonthRadioChange.bind(me, 1)},
|
@@ -34,7 +36,7 @@ class MainContainer extends ConfigurationViewport {
|
|
34
36
|
valueLabelText: 'Feb'
|
35
37
|
}, {
|
36
38
|
module : Radio,
|
37
|
-
checked :
|
39
|
+
checked : exampleComponent.currentDate.getMonth() === 2,
|
38
40
|
hideValueLabel: false,
|
39
41
|
labelText : '',
|
40
42
|
listeners : {change: me.onMonthRadioChange.bind(me, 2)},
|
@@ -42,7 +44,7 @@ class MainContainer extends ConfigurationViewport {
|
|
42
44
|
valueLabelText: 'Mar'
|
43
45
|
}, {
|
44
46
|
module : Radio,
|
45
|
-
checked :
|
47
|
+
checked : exampleComponent.currentDate.getMonth() === 3,
|
46
48
|
hideValueLabel: false,
|
47
49
|
labelText : '',
|
48
50
|
listeners : {change: me.onMonthRadioChange.bind(me, 3)},
|
@@ -50,7 +52,7 @@ class MainContainer extends ConfigurationViewport {
|
|
50
52
|
valueLabelText: 'Apr'
|
51
53
|
}, {
|
52
54
|
module : Radio,
|
53
|
-
checked :
|
55
|
+
checked : exampleComponent.currentDate.getFullYear() === 2021,
|
54
56
|
hideValueLabel: false,
|
55
57
|
labelText : 'currentDate (year)',
|
56
58
|
listeners : {change: me.onYearRadioChange.bind(me, 2021)},
|
@@ -59,7 +61,7 @@ class MainContainer extends ConfigurationViewport {
|
|
59
61
|
valueLabelText: '2021'
|
60
62
|
}, {
|
61
63
|
module : Radio,
|
62
|
-
checked :
|
64
|
+
checked : exampleComponent.currentDate.getFullYear() === 2020,
|
63
65
|
hideValueLabel: false,
|
64
66
|
labelText : '',
|
65
67
|
listeners : {change: me.onYearRadioChange.bind(me, 2020)},
|
@@ -67,7 +69,7 @@ class MainContainer extends ConfigurationViewport {
|
|
67
69
|
valueLabelText: '2020'
|
68
70
|
}, {
|
69
71
|
module : Radio,
|
70
|
-
checked :
|
72
|
+
checked : exampleComponent.currentDate.getFullYear() === 2019,
|
71
73
|
hideValueLabel: false,
|
72
74
|
labelText : '',
|
73
75
|
listeners : {change: me.onYearRadioChange.bind(me, 2019)},
|
@@ -75,7 +77,7 @@ class MainContainer extends ConfigurationViewport {
|
|
75
77
|
valueLabelText: '2019'
|
76
78
|
}, {
|
77
79
|
module : Radio,
|
78
|
-
checked :
|
80
|
+
checked : exampleComponent.currentDate.getFullYear() === 2018,
|
79
81
|
hideValueLabel: false,
|
80
82
|
labelText : '',
|
81
83
|
listeners : {change: me.onYearRadioChange.bind(me, 2018)},
|
@@ -83,7 +85,7 @@ class MainContainer extends ConfigurationViewport {
|
|
83
85
|
valueLabelText: '2018'
|
84
86
|
}, {
|
85
87
|
module : Radio,
|
86
|
-
checked :
|
88
|
+
checked : exampleComponent.dayNameFormat === 'narrow',
|
87
89
|
hideValueLabel: false,
|
88
90
|
labelText : 'dayNameFormat',
|
89
91
|
listeners : {change: me.onRadioChange.bind(me, 'dayNameFormat', 'narrow')},
|
@@ -92,7 +94,7 @@ class MainContainer extends ConfigurationViewport {
|
|
92
94
|
valueLabelText: 'narrow'
|
93
95
|
}, {
|
94
96
|
module : Radio,
|
95
|
-
checked :
|
97
|
+
checked : exampleComponent.dayNameFormat === 'short',
|
96
98
|
hideValueLabel: false,
|
97
99
|
labelText : '',
|
98
100
|
listeners : {change: me.onRadioChange.bind(me, 'dayNameFormat', 'short')},
|
@@ -100,14 +102,14 @@ class MainContainer extends ConfigurationViewport {
|
|
100
102
|
valueLabelText: 'short'
|
101
103
|
}, {
|
102
104
|
module : Radio,
|
103
|
-
checked :
|
105
|
+
checked : exampleComponent.dayNameFormat === 'long',
|
104
106
|
hideValueLabel: false,
|
105
107
|
labelText : '',
|
106
108
|
listeners : {change: me.onRadioChange.bind(me, 'dayNameFormat', 'long')},
|
107
109
|
name : 'dayNameFormat',
|
108
110
|
valueLabelText: 'long'
|
109
111
|
}, {
|
110
|
-
module :
|
112
|
+
module : NumberField,
|
111
113
|
clearable : true,
|
112
114
|
labelText : 'height',
|
113
115
|
listeners : {change: me.onConfigChange.bind(me, 'height')},
|
@@ -115,28 +117,40 @@ class MainContainer extends ConfigurationViewport {
|
|
115
117
|
minValue : 230,
|
116
118
|
stepSize : 10,
|
117
119
|
style : {marginTop: '10px'},
|
118
|
-
value :
|
120
|
+
value : exampleComponent.height
|
121
|
+
}, {
|
122
|
+
module : DateField,
|
123
|
+
labelText : 'maxValue',
|
124
|
+
listeners : {change: me.onConfigChange.bind(me, 'maxValue')},
|
125
|
+
matchPickerWidth: false,
|
126
|
+
value : exampleComponent.maxValue
|
127
|
+
}, {
|
128
|
+
module : DateField,
|
129
|
+
labelText : 'minValue',
|
130
|
+
listeners : {change: me.onConfigChange.bind(me, 'minValue')},
|
131
|
+
matchPickerWidth: false,
|
132
|
+
value : exampleComponent.minValue
|
119
133
|
}, {
|
120
134
|
module : CheckBox,
|
121
|
-
checked :
|
135
|
+
checked : exampleComponent.showCellBorders,
|
122
136
|
labelText: 'showCellBorders',
|
123
137
|
listeners: {change: me.onConfigChange.bind(me, 'showCellBorders')},
|
124
138
|
style : {marginTop: '10px'}
|
125
139
|
}, {
|
126
140
|
module : CheckBox,
|
127
|
-
checked :
|
141
|
+
checked : exampleComponent.showDisabledDays,
|
128
142
|
labelText: 'showDisabledDays',
|
129
143
|
listeners: {change: me.onConfigChange.bind(me, 'showDisabledDays')},
|
130
144
|
style : {marginTop: '10px'}
|
131
145
|
}, {
|
132
146
|
module : CheckBox,
|
133
|
-
checked :
|
147
|
+
checked : exampleComponent.useAnimations,
|
134
148
|
labelText: 'useAnimations',
|
135
149
|
listeners: {change: me.onConfigChange.bind(me, 'useAnimations')},
|
136
150
|
style : {marginTop: '10px'}
|
137
151
|
}, {
|
138
152
|
module : Radio,
|
139
|
-
checked :
|
153
|
+
checked : exampleComponent.weekStartDay === 6,
|
140
154
|
hideValueLabel: false,
|
141
155
|
labelText : 'weekStartDay',
|
142
156
|
listeners : {change: me.onRadioChange.bind(me, 'weekStartDay', 6)},
|
@@ -145,7 +159,7 @@ class MainContainer extends ConfigurationViewport {
|
|
145
159
|
valueLabelText: '6 (Saturday)'
|
146
160
|
}, {
|
147
161
|
module : Radio,
|
148
|
-
checked :
|
162
|
+
checked : exampleComponent.weekStartDay === 0,
|
149
163
|
hideValueLabel: false,
|
150
164
|
labelText : '',
|
151
165
|
listeners : {change: me.onRadioChange.bind(me, 'weekStartDay', 0)},
|
@@ -153,7 +167,7 @@ class MainContainer extends ConfigurationViewport {
|
|
153
167
|
valueLabelText: '0 (Sunday)'
|
154
168
|
}, {
|
155
169
|
module : Radio,
|
156
|
-
checked :
|
170
|
+
checked : exampleComponent.weekStartDay === 1,
|
157
171
|
hideValueLabel: false,
|
158
172
|
labelText : '',
|
159
173
|
listeners : {change: me.onRadioChange.bind(me, 'weekStartDay', 1)},
|
@@ -168,7 +182,7 @@ class MainContainer extends ConfigurationViewport {
|
|
168
182
|
minValue : 240,
|
169
183
|
stepSize : 10,
|
170
184
|
style : {marginTop: '10px'},
|
171
|
-
value :
|
185
|
+
value : exampleComponent.width
|
172
186
|
}];
|
173
187
|
}
|
174
188
|
|
@@ -176,7 +190,7 @@ class MainContainer extends ConfigurationViewport {
|
|
176
190
|
return Neo.create(DateSelector, {
|
177
191
|
height: 300,
|
178
192
|
width : 300
|
179
|
-
})
|
193
|
+
})
|
180
194
|
}
|
181
195
|
|
182
196
|
onMonthRadioChange(value, opts) {
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import ConfigurationViewport from '../../ConfigurationViewport.mjs';
|
2
|
+
import Timer from '../../../src/component/Timer.mjs';
|
3
|
+
import Container from '../../../src/container/Base.mjs';
|
4
|
+
import TextField from "../../../src/form/field/Text.mjs";
|
5
|
+
import ColorField from "../../../src/form/field/Color.mjs"
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @class Neo.examples.component.timer.MainContainer
|
9
|
+
* @extends Neo.examples.ConfigurationViewport
|
10
|
+
*/
|
11
|
+
class MainContainer extends ConfigurationViewport {
|
12
|
+
static config = {
|
13
|
+
className : 'Neo.examples.component.timer.MainContainer',
|
14
|
+
}
|
15
|
+
|
16
|
+
createConfigurationComponents() {
|
17
|
+
let me = this;
|
18
|
+
|
19
|
+
return [{
|
20
|
+
module : TextField,
|
21
|
+
labelText: 'dimensions',
|
22
|
+
value : '8rem',
|
23
|
+
listeners: {change: me.onConfigChange.bind(me, 'dimensions')}
|
24
|
+
}, {
|
25
|
+
module : ColorField,
|
26
|
+
clearable : false,
|
27
|
+
labelText: 'colorStart',
|
28
|
+
value: '#8a9b0f',
|
29
|
+
listeners: {change: me.onConfigChange.bind(me, 'colorStart')}
|
30
|
+
}, {
|
31
|
+
module : ColorField,
|
32
|
+
clearable : false,
|
33
|
+
labelText: 'colorEnd',
|
34
|
+
value: '#940a3d',
|
35
|
+
listeners: {change: me.onConfigChange.bind(me, 'colorEnd')}
|
36
|
+
}];
|
37
|
+
}
|
38
|
+
|
39
|
+
createExampleComponent() {
|
40
|
+
return Neo.create({
|
41
|
+
module: Container,
|
42
|
+
style: {
|
43
|
+
overflow: 'auto',
|
44
|
+
maxHeight: '100%'
|
45
|
+
},
|
46
|
+
items : [{
|
47
|
+
html: '<h1>Configurable</h1>',
|
48
|
+
style: {textAlign: 'center'}
|
49
|
+
}, {
|
50
|
+
module : Timer,
|
51
|
+
duration : '20s',
|
52
|
+
flag : 'timer-component',
|
53
|
+
dimensions: '8rem',
|
54
|
+
}]
|
55
|
+
});
|
56
|
+
}
|
57
|
+
|
58
|
+
/**
|
59
|
+
* @param {String} config
|
60
|
+
* @param {Object} opts
|
61
|
+
*/
|
62
|
+
onConfigChange(config, opts) {
|
63
|
+
const timer = this.down({flag: 'timer-component'});
|
64
|
+
|
65
|
+
timer[config] = opts.value;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
Neo.applyClassConfig(MainContainer);
|
70
|
+
|
71
|
+
export default MainContainer;
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import ComponentController from '../../../src/controller/Component.mjs';
|
2
|
+
import Toast from '../../../src/component/Toast.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Neo.examples.component.toast.MainContainerController
|
6
|
+
* @extends Neo.controller.Component
|
7
|
+
*/
|
8
|
+
class MainContainerController extends ComponentController {
|
9
|
+
static config = {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Neo.examples.component.toast.MainContainerController'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Neo.examples.component.toast.MainContainerController'
|
15
|
+
}
|
16
|
+
|
17
|
+
/**
|
18
|
+
* @param {Object} config
|
19
|
+
*/
|
20
|
+
construct(config) {
|
21
|
+
super.construct(config);
|
22
|
+
Neo.main.addon.HighlightJS.switchTheme('dark');
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Whenever any field changes we update the output
|
27
|
+
* @param {Object} data
|
28
|
+
* @returns {Promise<void>}
|
29
|
+
*/
|
30
|
+
async onChange(data) {
|
31
|
+
let me = this,
|
32
|
+
form = me.getReference('form'),
|
33
|
+
output = me.getReference('output'),
|
34
|
+
button = me.getReference('creation-button'),
|
35
|
+
oVdom = output.vdom.cn[0].cn[0],
|
36
|
+
isValid = await form.isValid(),
|
37
|
+
values;
|
38
|
+
|
39
|
+
if (Neo.isBoolean(data.value)) {
|
40
|
+
me.getReference('closable').value = data.value;
|
41
|
+
}
|
42
|
+
|
43
|
+
values = await form.getValues();
|
44
|
+
|
45
|
+
values.appName = me.component.appName;
|
46
|
+
button.disabled = !isValid;
|
47
|
+
|
48
|
+
if (isValid) {
|
49
|
+
oVdom.cn = output.itemTpl(values);
|
50
|
+
|
51
|
+
output.update();
|
52
|
+
|
53
|
+
await Neo.timeout(20)
|
54
|
+
me.syntaxHighlight();
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Cleanup the values and show the toast
|
60
|
+
*/
|
61
|
+
async createToast() {
|
62
|
+
let me = this,
|
63
|
+
form = me.getReference('form'),
|
64
|
+
values = await form.getValues(),
|
65
|
+
clear = ['position', 'slideDirection', 'ui', 'minHeight', 'maxWidth', 'closable', 'timeout'];
|
66
|
+
|
67
|
+
// use the defaults from toast if not set
|
68
|
+
clear.forEach(item => {
|
69
|
+
if (values[item] === null) {
|
70
|
+
delete values[item];
|
71
|
+
}
|
72
|
+
})
|
73
|
+
|
74
|
+
values.appName = me.component.appName;
|
75
|
+
Neo.toast(values);
|
76
|
+
}
|
77
|
+
|
78
|
+
/**
|
79
|
+
* 3rd party tool to highlight the code
|
80
|
+
*/
|
81
|
+
syntaxHighlight() {
|
82
|
+
let me = this,
|
83
|
+
output = me.getReference('output'),
|
84
|
+
oVdom = output.vdom;
|
85
|
+
|
86
|
+
Neo.main.addon.HighlightJS.syntaxHighlight({
|
87
|
+
appName: me.component.appName,
|
88
|
+
vnodeId: oVdom.cn[0].id
|
89
|
+
});
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
Neo.applyClassConfig(MainContainerController);
|
94
|
+
|
95
|
+
export default MainContainerController;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<!DOCTYPE HTML>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
<title>Neo Timer</title>
|
7
|
+
</head>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<script src="../../../src/MicroLoader.mjs" type="module"></script>
|
11
|
+
</body>
|
12
|
+
</html>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import Viewport from '../../../src/container/Viewport.mjs';
|
2
|
+
import Video from '../../../src/component/Video.mjs';
|
3
|
+
import Panel from '../../../src/container/Panel.mjs';
|
4
|
+
import MainContainerController from "./MainContainerController.mjs";
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @class Neo.examples.component.timer.MainContainer
|
8
|
+
* @extends Neo.examples.Viewport
|
9
|
+
*/
|
10
|
+
class MainContainer extends Viewport {
|
11
|
+
static config = {
|
12
|
+
className: 'Neo.examples.component.timer.MainContainer',
|
13
|
+
|
14
|
+
controller: MainContainerController,
|
15
|
+
|
16
|
+
items : [{
|
17
|
+
ntype: 'panel',
|
18
|
+
headers: [{
|
19
|
+
dock: 'top',
|
20
|
+
items: [{
|
21
|
+
ntype: 'component',
|
22
|
+
html : '<h1>Video Demo</h1>',
|
23
|
+
flex : 'none',
|
24
|
+
style: {textAlign: 'center'}
|
25
|
+
}, {
|
26
|
+
ntype: 'component', flex: 1
|
27
|
+
}, {
|
28
|
+
reference: 'theme-button',
|
29
|
+
iconCls : 'fa fa-sun',
|
30
|
+
handler : 'onToggleTheme',
|
31
|
+
style : {height: '100%',padding: '0 40px',borderWidth: 0,borderLeftWidth: '1px',borderRadius: 0}
|
32
|
+
}]
|
33
|
+
}],
|
34
|
+
items: [{
|
35
|
+
module : Video,
|
36
|
+
url : 'https://video-ssl.itunes.apple.com/itunes-assets/Video125/v4/a0/57/54/a0575426-dd8e-2d25-bdf3-139702870b50/mzvf_786190431362224858.640x464.h264lc.U.p.m4v',
|
37
|
+
flag : 'video-component',
|
38
|
+
minHeight: 400,
|
39
|
+
}]
|
40
|
+
}]
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
Neo.applyClassConfig(MainContainer);
|
45
|
+
|
46
|
+
export default MainContainer;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import ComponentController from '../../../src/controller/Component.mjs';
|
2
|
+
import Toast from '../../../src/component/Toast.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Neo.examples.component.toast.MainContainerController
|
6
|
+
* @extends Neo.controller.Component
|
7
|
+
*/
|
8
|
+
class MainContainerController extends ComponentController {
|
9
|
+
static config = {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Neo.examples.component.toast.MainContainerController'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Neo.examples.component.toast.MainContainerController'
|
15
|
+
}
|
16
|
+
|
17
|
+
theme = 'light';
|
18
|
+
|
19
|
+
/**
|
20
|
+
* @param {Object} config
|
21
|
+
*/
|
22
|
+
onToggleTheme(config) {
|
23
|
+
const add = (this.theme === 'light') ? 'dark' : 'light',
|
24
|
+
remove = add === 'light' ? 'dark' : 'light',
|
25
|
+
themeButton = this.getReference('theme-button'),
|
26
|
+
buttonIcon = add === 'light' ? 'sun' : 'moon';
|
27
|
+
|
28
|
+
this.theme = add;
|
29
|
+
|
30
|
+
Neo.main.DomAccess.setBodyCls({remove: ['neo-theme-' + remove] , add: ['neo-theme-' + add]});
|
31
|
+
themeButton.iconCls = 'fa fa-' + buttonIcon;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
Neo.applyClassConfig(MainContainerController);
|
36
|
+
|
37
|
+
export default MainContainerController;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<!DOCTYPE HTML>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
<title>Neo Video</title>
|
7
|
+
</head>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<script src="../../../src/MicroLoader.mjs" type="module"></script>
|
11
|
+
</body>
|
12
|
+
</html>
|
@@ -0,0 +1,131 @@
|
|
1
|
+
import ConfigurationViewport from '../../ConfigurationViewport.mjs';
|
2
|
+
import Form from '../../../src/form/Container.mjs';
|
3
|
+
import Fieldset from '../../../src/form/Fieldset.mjs';
|
4
|
+
import TextField from '../../../src/form/field/Text.mjs';
|
5
|
+
import FormLayout from '../../../src/layout/Form.mjs';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @class Neo.examples.layout.form.MainContainer
|
9
|
+
* @extends Neo.examples.ConfigurationViewport
|
10
|
+
*/
|
11
|
+
class MainContainer extends ConfigurationViewport {
|
12
|
+
static config = {
|
13
|
+
className : 'Neo.examples.layout.form.MainContainer',
|
14
|
+
autoMount : true,
|
15
|
+
configItemLabelWidth: 160,
|
16
|
+
layout : {ntype: 'hbox', align: 'stretch'}
|
17
|
+
}
|
18
|
+
|
19
|
+
createConfigurationComponents() {
|
20
|
+
let me = this;
|
21
|
+
|
22
|
+
return [{
|
23
|
+
ntype: 'component',
|
24
|
+
html : 'On the left you see' +
|
25
|
+
'<ul>Form > layout-form' +
|
26
|
+
'<li>textfield' +
|
27
|
+
'<li>textfield' +
|
28
|
+
'<li>Fieldset inside the form with another > layout-form' +
|
29
|
+
'<ul>' +
|
30
|
+
'<li>textfield' +
|
31
|
+
'<li>textfield' +
|
32
|
+
'</ul></ul>'
|
33
|
+
}, {
|
34
|
+
module : TextField,
|
35
|
+
clearable: true,
|
36
|
+
labelText: 'gap (row column)',
|
37
|
+
listeners: {
|
38
|
+
change: {
|
39
|
+
fn : function (data) {
|
40
|
+
const comp = this.exampleComponent;
|
41
|
+
|
42
|
+
comp.layout.gap = data.value;
|
43
|
+
comp.down('fieldset').layout.gap = data.value;
|
44
|
+
},
|
45
|
+
scope: this
|
46
|
+
}
|
47
|
+
},
|
48
|
+
value : '0 .5rem'
|
49
|
+
}, {
|
50
|
+
module : TextField,
|
51
|
+
clearable: true,
|
52
|
+
labelText: 'Textfield 01 Label',
|
53
|
+
listeners: {change: me.updateLabelFromTextField.bind(me, 1)},
|
54
|
+
value : 'This is a wide label inside Form'
|
55
|
+
}, {
|
56
|
+
module : TextField,
|
57
|
+
clearable: true,
|
58
|
+
labelText: 'Textfield 02 Label',
|
59
|
+
listeners: {change: me.updateLabelFromTextField.bind(me, 2)},
|
60
|
+
value : 'Small label'
|
61
|
+
}, {
|
62
|
+
module : TextField,
|
63
|
+
clearable: true,
|
64
|
+
labelText: 'Textfield 03 Label',
|
65
|
+
listeners: {change: me.updateLabelFromTextField.bind(me, 3)},
|
66
|
+
value : 'I am inside a fieldset'
|
67
|
+
}, {
|
68
|
+
module : TextField,
|
69
|
+
clearable: true,
|
70
|
+
labelText: 'Textfield 04 Label',
|
71
|
+
listeners: {change: me.updateLabelFromTextField.bind(me, 4)},
|
72
|
+
value : 'Fieldset with layout-form'
|
73
|
+
}]
|
74
|
+
}
|
75
|
+
|
76
|
+
createExampleComponent() {
|
77
|
+
return Neo.create(Form, {
|
78
|
+
layout : {
|
79
|
+
ntype: 'layout-form',
|
80
|
+
gap : '0 .5rem'
|
81
|
+
},
|
82
|
+
itemDefaults: {
|
83
|
+
ntype : 'textfield',
|
84
|
+
clearable: true,
|
85
|
+
value : 'Layout Demo'
|
86
|
+
},
|
87
|
+
items : [{
|
88
|
+
labelText: 'This is a wide Label inside Form',
|
89
|
+
name : 1
|
90
|
+
}, {
|
91
|
+
labelText: 'Small Label',
|
92
|
+
name : 2
|
93
|
+
}, {
|
94
|
+
module : Fieldset,
|
95
|
+
title : 'Fieldset with Layout',
|
96
|
+
layout : {
|
97
|
+
ntype: 'layout-form',
|
98
|
+
gap : '0 .5rem'
|
99
|
+
},
|
100
|
+
itemDefaults: {
|
101
|
+
ntype : 'textfield',
|
102
|
+
clearable: true,
|
103
|
+
value : 'Layout Demo'
|
104
|
+
},
|
105
|
+
items : [{
|
106
|
+
labelText: 'I am inside a fieldset',
|
107
|
+
name : 3
|
108
|
+
}, {
|
109
|
+
labelText: 'Fieldset with layout-form',
|
110
|
+
name : 4
|
111
|
+
}]
|
112
|
+
}]
|
113
|
+
})
|
114
|
+
}
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Update the textfield labelText, based on index
|
118
|
+
* @param {Number} index
|
119
|
+
* @param {Object} data
|
120
|
+
*/
|
121
|
+
updateLabelFromTextField(index, data) {
|
122
|
+
const comp = this.exampleComponent,
|
123
|
+
textfield = comp.down({ntype: 'textfield', name: index});
|
124
|
+
|
125
|
+
textfield.labelText = data.value;
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
Neo.applyClassConfig(MainContainer);
|
130
|
+
|
131
|
+
export default MainContainer;
|