neo.mjs 6.18.3 → 6.19.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/README.md +28 -214
- package/apps/ServiceWorker.mjs +2 -2
- package/apps/colors/view/ViewportController.mjs +7 -3
- package/apps/portal/data/blog.json +13 -0
- package/apps/portal/view/HeaderToolbar.mjs +2 -2
- package/apps/portal/view/Viewport.mjs +4 -2
- package/apps/portal/view/ViewportController.mjs +88 -7
- package/apps/portal/view/blog/Container.mjs +8 -8
- package/apps/portal/view/blog/List.mjs +6 -6
- package/apps/portal/view/home/FooterContainer.mjs +123 -0
- package/apps/portal/view/home/MainContainer.mjs +3 -2
- package/apps/portal/view/home/parts/AfterMath.mjs +17 -24
- package/apps/portal/view/home/parts/Colors.mjs +2 -2
- package/apps/portal/view/home/parts/How.mjs +3 -3
- package/apps/portal/view/home/parts/MainNeo.mjs +6 -7
- package/apps/portal/view/home/parts/References.mjs +88 -0
- package/apps/portal/view/learn/MainContainer.mjs +3 -2
- package/apps/portal/view/learn/MainContainerController.mjs +11 -0
- package/apps/portal/view/learn/PageContainer.mjs +5 -3
- package/apps/portal/view/services/Component.mjs +73 -0
- package/apps/website/data/blog.json +13 -0
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/component/carousel/MainContainer.mjs +42 -33
- package/examples/layout/cube/MainContainer.mjs +217 -0
- package/examples/layout/cube/app.mjs +6 -0
- package/examples/layout/cube/index.html +11 -0
- package/examples/layout/cube/neo-config.json +6 -0
- package/examples/model/twoWay/MainContainer.mjs +76 -0
- package/examples/model/twoWay/app.mjs +6 -0
- package/examples/model/twoWay/index.html +11 -0
- package/examples/model/twoWay/neo-config.json +6 -0
- package/package.json +7 -7
- package/resources/data/deck/learnneo/pages/Earthquakes-01-goals.md +32 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-01-generate-a-workspace.md +47 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-02-generate-the-starter-app.md +150 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-03-debugging.md +136 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-04-fetch-data.md +146 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-05-refactor-the-table.md +146 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-06-use-a-view-model.md +301 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-07-use-the-google-maps-addon.md +175 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-08-events.md +38 -0
- package/resources/data/deck/learnneo/pages/Earthquakes.md +8 -8
- package/resources/data/deck/learnneo/pages/Glossary.md +0 -0
- package/resources/data/deck/learnneo/pages/GuideEvents.md +80 -1
- package/resources/data/deck/learnneo/tree.json +2 -1
- package/resources/images/apps/portal/neo-references.png +0 -0
- package/resources/scss/src/apps/portal/Viewport.scss +18 -0
- package/resources/scss/src/apps/portal/blog/Container.scss +7 -7
- package/resources/scss/src/apps/portal/blog/List.scss +20 -16
- package/resources/scss/src/apps/portal/home/FooterContainer.scss +31 -0
- package/resources/scss/src/apps/portal/home/parts/AfterMath.scss +5 -0
- package/resources/scss/src/apps/portal/home/parts/MainNeo.scss +4 -5
- package/resources/scss/src/apps/portal/home/parts/References.scss +46 -0
- package/resources/scss/src/apps/portal/learn/ContentTreeList.scss +20 -0
- package/resources/scss/src/apps/portal/learn/ContentView.scss +4 -0
- package/resources/scss/src/apps/portal/learn/MainContainer.scss +1 -1
- package/resources/scss/src/apps/portal/learn/PageContainer.scss +22 -16
- package/resources/scss/src/apps/portal/services/Component.scss +20 -0
- package/resources/scss/src/component/Carousel.scss +21 -0
- package/resources/scss/src/examples/layout/cube/MainContainer.scss +7 -0
- package/resources/scss/src/layout/Cube.scss +80 -0
- package/resources/scss/src/tab/Container.scss +10 -10
- package/resources/scss/theme-neo-light/apps/portal/blog/Container.scss +3 -0
- package/resources/scss/theme-neo-light/form/field/Search.scss +1 -1
- package/resources/scss/theme-neo-light/tooltip/Base.scss +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/Main.mjs +15 -1
- package/src/Neo.mjs +14 -3
- package/src/calendar/view/MainContainer.mjs +8 -7
- package/src/component/Base.mjs +28 -8
- package/src/component/DateSelector.mjs +2 -2
- package/src/container/Base.mjs +3 -1
- package/src/dialog/Base.mjs +1 -2
- package/src/form/field/Time.mjs +18 -16
- package/src/layout/Base.mjs +43 -6
- package/src/layout/Card.mjs +21 -59
- package/src/layout/Cube.mjs +432 -0
- package/src/layout/Fit.mjs +9 -38
- package/src/layout/Flexbox.mjs +16 -17
- package/src/layout/Form.mjs +13 -70
- package/src/layout/Grid.mjs +6 -18
- package/src/list/Base.mjs +3 -3
- package/src/main/mixin/DeltaUpdates.mjs +16 -3
- package/src/model/Component.mjs +25 -6
- package/src/util/Array.mjs +36 -0
- package/src/vdom/Helper.mjs +338 -442
- package/src/vdom/VNode.mjs +12 -1
- package/test/siesta/siesta.js +16 -1
- package/test/siesta/tests/VdomCalendar.mjs +2193 -37
- package/test/siesta/tests/VdomHelper.mjs +287 -48
- package/test/siesta/tests/vdom/Advanced.mjs +368 -0
- package/test/siesta/tests/vdom/layout/Cube.mjs +189 -0
- package/test/siesta/tests/vdom/table/Container.mjs +133 -0
- package/resources/scss/theme-neo-light/apps/portal/learn/ContentTreeList.scss +0 -23
@@ -0,0 +1,432 @@
|
|
1
|
+
import Card from './Card.mjs';
|
2
|
+
import NeoArray from '../util/Array.mjs';
|
3
|
+
|
4
|
+
const configSymbol = Symbol.for('configSymbol');
|
5
|
+
|
6
|
+
/**
|
7
|
+
* See: examples/layout.Cube for a demo.
|
8
|
+
* Strongly inspired by https://www.mobzystems.com/code/3d-css-and-custom-properties/
|
9
|
+
* @class Neo.layout.Cube
|
10
|
+
* @extends Neo.layout.Card
|
11
|
+
*/
|
12
|
+
class Cube extends Card {
|
13
|
+
/**
|
14
|
+
* @member {Object} faces
|
15
|
+
* @static
|
16
|
+
*/
|
17
|
+
static faces = {
|
18
|
+
front : [ 0, 0, 0],
|
19
|
+
back : [ 0, 180, 0],
|
20
|
+
left : [ 0, 90, 0],
|
21
|
+
right : [ 0, 270, 0],
|
22
|
+
top : [270, 0, 0],
|
23
|
+
bottom: [ 90, 0, 0]
|
24
|
+
}
|
25
|
+
|
26
|
+
static config = {
|
27
|
+
/**
|
28
|
+
* @member {String} className='Neo.layout.Cube'
|
29
|
+
* @protected
|
30
|
+
*/
|
31
|
+
className: 'Neo.layout.Cube',
|
32
|
+
/**
|
33
|
+
* @member {String} ntype='layout-cube'
|
34
|
+
* @protected
|
35
|
+
*/
|
36
|
+
ntype: 'layout-cube',
|
37
|
+
/**
|
38
|
+
* @member {String|null} activeFace_=null
|
39
|
+
*/
|
40
|
+
activeFace_: null,
|
41
|
+
/**
|
42
|
+
* @member {Number|null} activeIndex=null
|
43
|
+
*/
|
44
|
+
activeIndex: null,
|
45
|
+
/**
|
46
|
+
* @member {String|null} containerCls='neo-layout-fit'
|
47
|
+
* @protected
|
48
|
+
*/
|
49
|
+
containerCls: 'neo-layout-cube',
|
50
|
+
/**
|
51
|
+
* Updates the cube size to fit the owner container dimensions
|
52
|
+
* @member {Boolean} fitContainer_=false
|
53
|
+
*/
|
54
|
+
fitContainer_: false,
|
55
|
+
/**
|
56
|
+
* Important for dynamically switching from a cube to a card layout
|
57
|
+
* @member {Boolean} hideInactiveCardsOnDestroy=false
|
58
|
+
*/
|
59
|
+
hideInactiveCardsOnDestroy: false,
|
60
|
+
/**
|
61
|
+
* @member {Number} perspective_=600
|
62
|
+
*/
|
63
|
+
perspective_: 600,
|
64
|
+
/**
|
65
|
+
* @member {Number} rotateX_=0
|
66
|
+
*/
|
67
|
+
rotateX_: 0,
|
68
|
+
/**
|
69
|
+
* @member {Number} rotateY_=0
|
70
|
+
*/
|
71
|
+
rotateY_: 0,
|
72
|
+
/**
|
73
|
+
* @member {Number} rotateZ_=0
|
74
|
+
*/
|
75
|
+
rotateZ_: 0,
|
76
|
+
/**
|
77
|
+
* @member {Number} sideX_=300
|
78
|
+
*/
|
79
|
+
sideX_: 300,
|
80
|
+
/**
|
81
|
+
* @member {Number} sideY_=300
|
82
|
+
*/
|
83
|
+
sideY_: 300,
|
84
|
+
/**
|
85
|
+
* @member {Number} sideZ_=300
|
86
|
+
*/
|
87
|
+
sideZ_: 300
|
88
|
+
}
|
89
|
+
|
90
|
+
/**
|
91
|
+
* @member {Function|null} #cachedVdomItemsRoot=null
|
92
|
+
* @private
|
93
|
+
*/
|
94
|
+
#cachedVdomItemsRoot = null
|
95
|
+
|
96
|
+
/**
|
97
|
+
* @param {Object} config
|
98
|
+
*/
|
99
|
+
construct(config) {
|
100
|
+
super.construct(config);
|
101
|
+
|
102
|
+
let me = this,
|
103
|
+
{container} = me;
|
104
|
+
|
105
|
+
me.nestVdom();
|
106
|
+
|
107
|
+
container.mounted && container.update();
|
108
|
+
|
109
|
+
me.timeout(100).then(() => {
|
110
|
+
container.addCls('neo-animate')
|
111
|
+
})
|
112
|
+
}
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Triggered after the activeFace config got changed
|
116
|
+
* @param {String|null} value
|
117
|
+
* @param {String|null} oldValue
|
118
|
+
* @protected
|
119
|
+
*/
|
120
|
+
afterSetActiveFace(value, oldValue) {
|
121
|
+
if (value) {
|
122
|
+
this.activeIndex = Object.keys(Cube.faces).indexOf(value)
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Triggered after the activeIndex config got changed
|
128
|
+
* @param {Number|null} value
|
129
|
+
* @param {Number|null} oldValue
|
130
|
+
* @protected
|
131
|
+
*/
|
132
|
+
async afterSetActiveIndex(value, oldValue) {
|
133
|
+
if (Neo.isNumber(value)) {
|
134
|
+
let me = this,
|
135
|
+
{container} = me,
|
136
|
+
item = container.items[value];
|
137
|
+
|
138
|
+
// Since activeFace & activeIndex are optional, we need to clear out default values
|
139
|
+
if (!Neo.isNumber(oldValue)) {
|
140
|
+
delete me[configSymbol].rotateX;
|
141
|
+
delete me[configSymbol].rotateY;
|
142
|
+
delete me[configSymbol].rotateZ;
|
143
|
+
}
|
144
|
+
|
145
|
+
if (Neo.typeOf(item.module) === 'Function') {
|
146
|
+
await me.loadModule(item, value);
|
147
|
+
container.update();
|
148
|
+
|
149
|
+
await me.timeout(100) // wait for the view to get painted first
|
150
|
+
}
|
151
|
+
|
152
|
+
this.rotateTo(...Object.values(Cube.faces)[value])
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
/**
|
157
|
+
* Triggered after the fitContainer config got changed
|
158
|
+
* @param {Boolean} value
|
159
|
+
* @param {Boolean} oldValue
|
160
|
+
* @protected
|
161
|
+
*/
|
162
|
+
afterSetFitContainer(value, oldValue) {
|
163
|
+
if (value) {
|
164
|
+
let me = this,
|
165
|
+
{container} = me;
|
166
|
+
|
167
|
+
if (container.mounted) {
|
168
|
+
me.updateContainerSize()
|
169
|
+
} else {
|
170
|
+
container.on('mounted', () => {
|
171
|
+
me.timeout(50).then(() => {
|
172
|
+
me.updateContainerSize()
|
173
|
+
})
|
174
|
+
})
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Triggered after the perspective config got changed
|
181
|
+
* @param {Number} value
|
182
|
+
* @param {Number} oldValue
|
183
|
+
* @protected
|
184
|
+
*/
|
185
|
+
afterSetPerspective(value, oldValue) {
|
186
|
+
this.updateContainerCssVar('--perspective', value + 'px')
|
187
|
+
}
|
188
|
+
|
189
|
+
/**
|
190
|
+
* Triggered after the rotateX config got changed
|
191
|
+
* @param {Number} value
|
192
|
+
* @param {Number} oldValue
|
193
|
+
* @protected
|
194
|
+
*/
|
195
|
+
afterSetRotateX(value, oldValue) {
|
196
|
+
this.rotateTo(value)
|
197
|
+
}
|
198
|
+
|
199
|
+
/**
|
200
|
+
* Triggered after the rotateY config got changed
|
201
|
+
* @param {Number} value
|
202
|
+
* @param {Number} oldValue
|
203
|
+
* @protected
|
204
|
+
*/
|
205
|
+
afterSetRotateY(value, oldValue) {
|
206
|
+
this.rotateTo(null, value)
|
207
|
+
}
|
208
|
+
|
209
|
+
/**
|
210
|
+
* Triggered after the rotateZ config got changed
|
211
|
+
* @param {Number} value
|
212
|
+
* @param {Number} oldValue
|
213
|
+
* @protected
|
214
|
+
*/
|
215
|
+
afterSetRotateZ(value, oldValue) {
|
216
|
+
this.rotateTo(null, null, value)
|
217
|
+
}
|
218
|
+
|
219
|
+
/**
|
220
|
+
* Triggered after the sideX config got changed
|
221
|
+
* @param {Number} value
|
222
|
+
* @param {Number} oldValue
|
223
|
+
* @protected
|
224
|
+
*/
|
225
|
+
afterSetSideX(value, oldValue) {
|
226
|
+
this.updateContainerCssVar('--side-x', value + 'px')
|
227
|
+
}
|
228
|
+
|
229
|
+
/**
|
230
|
+
* Triggered after the sideX config got changed
|
231
|
+
* @param {Number} value
|
232
|
+
* @param {Number} oldValue
|
233
|
+
* @protected
|
234
|
+
*/
|
235
|
+
afterSetSideY(value, oldValue) {
|
236
|
+
this.updateContainerCssVar('--side-y', value + 'px')
|
237
|
+
}
|
238
|
+
|
239
|
+
/**
|
240
|
+
* Triggered after the sideX config got changed
|
241
|
+
* @param {Number} value
|
242
|
+
* @param {Number} oldValue
|
243
|
+
* @protected
|
244
|
+
*/
|
245
|
+
afterSetSideZ(value, oldValue) {
|
246
|
+
this.updateContainerCssVar('--side-z', value + 'px')
|
247
|
+
}
|
248
|
+
|
249
|
+
/**
|
250
|
+
* Initially sets the CSS classes of the container items this layout is bound to.
|
251
|
+
* @param {Neo.component.Base} item
|
252
|
+
* @param {Number} index
|
253
|
+
*/
|
254
|
+
applyChildAttributes(item, index) {
|
255
|
+
let {wrapperCls} = item;
|
256
|
+
|
257
|
+
wrapperCls = NeoArray.union(wrapperCls, 'neo-face', Object.keys(Cube.faces)[index]);
|
258
|
+
|
259
|
+
switch(index) {
|
260
|
+
case 0:
|
261
|
+
case 1:
|
262
|
+
wrapperCls = NeoArray.union(wrapperCls, 'neo-face-z');
|
263
|
+
break;
|
264
|
+
case 2:
|
265
|
+
case 3:
|
266
|
+
wrapperCls = NeoArray.union(wrapperCls, 'neo-face-x');
|
267
|
+
break;
|
268
|
+
case 4:
|
269
|
+
case 5:
|
270
|
+
wrapperCls = NeoArray.union(wrapperCls, 'neo-face-y');
|
271
|
+
break;
|
272
|
+
}
|
273
|
+
|
274
|
+
item.wrapperCls = wrapperCls
|
275
|
+
}
|
276
|
+
|
277
|
+
/**
|
278
|
+
*
|
279
|
+
*/
|
280
|
+
destroy(...args) {
|
281
|
+
let me = this,
|
282
|
+
{container} = me,
|
283
|
+
{style, vdom} = container;
|
284
|
+
|
285
|
+
Object.assign(style, {
|
286
|
+
'--perspective': null,
|
287
|
+
'--rot-x' : null,
|
288
|
+
'--rot-y' : null,
|
289
|
+
'--rot-z' : null,
|
290
|
+
'--side-x' : null,
|
291
|
+
'--side-y' : null,
|
292
|
+
'--side-z' : null
|
293
|
+
});
|
294
|
+
|
295
|
+
container.style = style;
|
296
|
+
|
297
|
+
vdom.cn = container.getVdomItemsRoot().cn;
|
298
|
+
|
299
|
+
if (me.hideInactiveCardsOnDestroy) {
|
300
|
+
vdom.cn.forEach((item, index) => {
|
301
|
+
if (index !== me.activeIndex) {
|
302
|
+
item.removeDom = true
|
303
|
+
}
|
304
|
+
})
|
305
|
+
}
|
306
|
+
|
307
|
+
// override
|
308
|
+
container.getVdomItemsRoot = me.#cachedVdomItemsRoot;
|
309
|
+
|
310
|
+
container.update();
|
311
|
+
|
312
|
+
super.destroy(...args)
|
313
|
+
}
|
314
|
+
|
315
|
+
nestVdom() {
|
316
|
+
let me = this,
|
317
|
+
{container} = me,
|
318
|
+
{vdom} = container,
|
319
|
+
{cn} = vdom;
|
320
|
+
|
321
|
+
vdom.cn = [
|
322
|
+
{cls: ['neo-plane'], cn: [
|
323
|
+
{cls: ['neo-box'], cn}
|
324
|
+
]}
|
325
|
+
];
|
326
|
+
|
327
|
+
// Cache the original method for run-time container layout changes
|
328
|
+
me.#cachedVdomItemsRoot = container.getVdomItemsRoot;
|
329
|
+
|
330
|
+
// Override
|
331
|
+
container.getVdomItemsRoot = function() {
|
332
|
+
return this.vdom.cn[0].cn[0]
|
333
|
+
}
|
334
|
+
|
335
|
+
me.timeout(50).then(() => {
|
336
|
+
// Important when switching from a card layout to this one
|
337
|
+
container.vdom.cn[0].cn[0].cn.forEach(node => {
|
338
|
+
delete node.removeDom
|
339
|
+
});
|
340
|
+
|
341
|
+
container.update()
|
342
|
+
})
|
343
|
+
}
|
344
|
+
|
345
|
+
/**
|
346
|
+
* Removes all CSS rules from a container item this layout is bound to.
|
347
|
+
* Gets called when switching to a different layout.
|
348
|
+
* @param {Neo.component.Base} item
|
349
|
+
* @param {Number} index
|
350
|
+
* @protected
|
351
|
+
*/
|
352
|
+
removeChildAttributes(item, index) {
|
353
|
+
let {wrapperCls} = item;
|
354
|
+
|
355
|
+
NeoArray.remove(wrapperCls, ['neo-face', Object.keys(Cube.faces)[index]]);
|
356
|
+
|
357
|
+
switch(index) {
|
358
|
+
case 0:
|
359
|
+
case 1:
|
360
|
+
NeoArray.remove(wrapperCls, 'neo-face-z');
|
361
|
+
break;
|
362
|
+
case 2:
|
363
|
+
case 3:
|
364
|
+
NeoArray.remove(wrapperCls, 'neo-face-x');
|
365
|
+
break;
|
366
|
+
case 4:
|
367
|
+
case 5:
|
368
|
+
NeoArray.remove(wrapperCls, 'neo-face-y');
|
369
|
+
break;
|
370
|
+
}
|
371
|
+
|
372
|
+
item.wrapperCls = wrapperCls
|
373
|
+
}
|
374
|
+
|
375
|
+
/**
|
376
|
+
* @protected
|
377
|
+
*/
|
378
|
+
removeRenderAttributes() {
|
379
|
+
super.removeRenderAttributes();
|
380
|
+
this.container.removeCls('neo-animate')
|
381
|
+
}
|
382
|
+
|
383
|
+
/**
|
384
|
+
* @param {Number|null} [x]
|
385
|
+
* @param {Number|null} [y]
|
386
|
+
* @param {Number|null} [z]
|
387
|
+
*/
|
388
|
+
rotateTo(x, y, z) {
|
389
|
+
let me = this,
|
390
|
+
{container} = me,
|
391
|
+
{style} = container;
|
392
|
+
|
393
|
+
if (Neo.isNumber(x)) {me._rotateX = x; style['--rot-x'] = x + 'deg'}
|
394
|
+
if (Neo.isNumber(y)) {me._rotateY = y; style['--rot-y'] = y + 'deg'}
|
395
|
+
if (Neo.isNumber(z)) {me._rotateZ = z; style['--rot-z'] = z + 'deg'}
|
396
|
+
|
397
|
+
container.style = style
|
398
|
+
}
|
399
|
+
|
400
|
+
/**
|
401
|
+
* @param {String} name
|
402
|
+
* @param {String} value
|
403
|
+
*/
|
404
|
+
updateContainerCssVar(name, value) {
|
405
|
+
let {container} = this,
|
406
|
+
{style} = container;
|
407
|
+
|
408
|
+
style[name] = value;
|
409
|
+
|
410
|
+
container.style = style
|
411
|
+
}
|
412
|
+
|
413
|
+
/**
|
414
|
+
*
|
415
|
+
*/
|
416
|
+
async updateContainerSize() {
|
417
|
+
let {container} = this,
|
418
|
+
{height, width} = await container.getDomRect(container.id);
|
419
|
+
|
420
|
+
console.log({height, width});
|
421
|
+
|
422
|
+
this.set({
|
423
|
+
sideX: width,
|
424
|
+
sideY: height,
|
425
|
+
sideZ: Math.min(height, width)
|
426
|
+
})
|
427
|
+
}
|
428
|
+
}
|
429
|
+
|
430
|
+
Neo.setupClass(Cube);
|
431
|
+
|
432
|
+
export default Cube;
|
package/src/layout/Fit.mjs
CHANGED
@@ -16,7 +16,12 @@ class Fit extends Base {
|
|
16
16
|
* @member {String} ntype='layout-fit'
|
17
17
|
* @protected
|
18
18
|
*/
|
19
|
-
ntype: 'layout-fit'
|
19
|
+
ntype: 'layout-fit',
|
20
|
+
/**
|
21
|
+
* @member {String|null} containerCls='neo-layout-fit'
|
22
|
+
* @protected
|
23
|
+
*/
|
24
|
+
containerCls: 'neo-layout-fit'
|
20
25
|
}
|
21
26
|
|
22
27
|
/**
|
@@ -30,54 +35,20 @@ class Fit extends Base {
|
|
30
35
|
}
|
31
36
|
}
|
32
37
|
|
33
|
-
/**
|
34
|
-
* Applies CSS classes to the container this layout is bound to
|
35
|
-
*/
|
36
|
-
applyRenderAttributes() {
|
37
|
-
let me = this,
|
38
|
-
container = Neo.getComponent(me.containerId),
|
39
|
-
wrapperCls = container?.wrapperCls || [];
|
40
|
-
|
41
|
-
if (!container) {
|
42
|
-
Neo.logError('layout.Fit: applyRenderAttributes -> container not yet created', me.containerId)
|
43
|
-
}
|
44
|
-
|
45
|
-
NeoArray.add(wrapperCls, 'neo-layout-fit');
|
46
|
-
|
47
|
-
container.wrapperCls = wrapperCls
|
48
|
-
}
|
49
|
-
|
50
38
|
/**
|
51
39
|
* Removes all CSS rules from a container item this layout is bound to.
|
52
40
|
* Gets called when switching to a different layout.
|
53
41
|
* @param {Neo.component.Base} item
|
42
|
+
* @param {Number} index
|
54
43
|
*/
|
55
|
-
removeChildAttributes(item) {
|
44
|
+
removeChildAttributes(item, index) {
|
56
45
|
if (!item.ignoreLayout) {
|
57
|
-
let wrapperCls = item
|
46
|
+
let {wrapperCls} = item;
|
58
47
|
|
59
48
|
NeoArray.remove(wrapperCls, 'neo-layout-fit-item');
|
60
49
|
item.wrapperCls = wrapperCls
|
61
50
|
}
|
62
51
|
}
|
63
|
-
|
64
|
-
/**
|
65
|
-
* Removes all CSS rules from the container this layout is bound to.
|
66
|
-
* Gets called when switching to a different layout.
|
67
|
-
*/
|
68
|
-
removeRenderAttributes() {
|
69
|
-
let me = this,
|
70
|
-
container = Neo.getComponent(me.containerId),
|
71
|
-
wrapperCls = container?.wrapperCls || [];
|
72
|
-
|
73
|
-
if (!container) {
|
74
|
-
Neo.logError('layout.Fit: removeRenderAttributes -> container not yet created', me.containerId)
|
75
|
-
}
|
76
|
-
|
77
|
-
NeoArray.remove(wrapperCls, 'neo-layout-fit');
|
78
|
-
|
79
|
-
container.wrapperCls = wrapperCls
|
80
|
-
}
|
81
52
|
}
|
82
53
|
|
83
54
|
Neo.setupClass(Fit);
|
package/src/layout/Flexbox.mjs
CHANGED
@@ -107,11 +107,12 @@ class Flexbox extends Base {
|
|
107
107
|
afterSetGap(value, oldValue) {
|
108
108
|
if (!value && !oldValue) return;
|
109
109
|
|
110
|
-
let
|
111
|
-
|
110
|
+
let {container} = this,
|
111
|
+
{wrapperStyle} = container;
|
112
112
|
|
113
|
-
|
114
|
-
|
113
|
+
wrapperStyle.gap = value;
|
114
|
+
|
115
|
+
container.wrapperStyle = wrapperStyle
|
115
116
|
}
|
116
117
|
|
117
118
|
/**
|
@@ -155,10 +156,9 @@ class Flexbox extends Base {
|
|
155
156
|
* Applies CSS classes to the container this layout is bound to
|
156
157
|
*/
|
157
158
|
applyRenderAttributes() {
|
158
|
-
let me
|
159
|
-
container
|
160
|
-
{
|
161
|
-
wrapperCls = container?.wrapperCls || [];
|
159
|
+
let me = this,
|
160
|
+
{container, prefix} = me,
|
161
|
+
{wrapperCls} = container;
|
162
162
|
|
163
163
|
if (!container) {
|
164
164
|
Neo.logError('layout.Flexbox: applyRenderAttributes -> container not yet created', me.containerId)
|
@@ -222,9 +222,10 @@ class Flexbox extends Base {
|
|
222
222
|
* Removes all CSS rules from a container item this layout is bound to.
|
223
223
|
* Gets called when switching to a different layout.
|
224
224
|
* @param {Neo.component.Base} item
|
225
|
+
* @param {Number} index
|
225
226
|
* @protected
|
226
227
|
*/
|
227
|
-
removeChildAttributes(item) {
|
228
|
+
removeChildAttributes(item, index) {
|
228
229
|
let style = item.wrapperStyle || {};
|
229
230
|
|
230
231
|
style.flex = item.flex || null;
|
@@ -237,10 +238,9 @@ class Flexbox extends Base {
|
|
237
238
|
* @protected
|
238
239
|
*/
|
239
240
|
removeRenderAttributes() {
|
240
|
-
let me
|
241
|
-
container
|
242
|
-
{
|
243
|
-
wrapperCls = container?.wrapperCls || [];
|
241
|
+
let me = this,
|
242
|
+
{container, prefix} = me,
|
243
|
+
{wrapperCls} = container;
|
244
244
|
|
245
245
|
if (!container) {
|
246
246
|
Neo.logError('layout.Flexbox: removeRenderAttributes -> container not yet created', me.containerId)
|
@@ -292,10 +292,9 @@ class Flexbox extends Base {
|
|
292
292
|
* @protected
|
293
293
|
*/
|
294
294
|
updateInputValue(value, oldValue, propertyName) {
|
295
|
-
let me
|
296
|
-
container
|
297
|
-
{
|
298
|
-
wrapperCls = container?.wrapperCls;
|
295
|
+
let me = this,
|
296
|
+
{container, prefix} = me,
|
297
|
+
{wrapperCls} = container;
|
299
298
|
|
300
299
|
if (container?.rendered) {
|
301
300
|
NeoArray.remove(wrapperCls, prefix + propertyName + '-' + oldValue);
|
package/src/layout/Form.mjs
CHANGED
@@ -18,15 +18,15 @@ class Form extends Base {
|
|
18
18
|
*/
|
19
19
|
ntype: 'layout-form',
|
20
20
|
/**
|
21
|
-
*
|
22
|
-
* @
|
21
|
+
* @member {String|null} containerCls='neo-layout-fit'
|
22
|
+
* @protected
|
23
23
|
*/
|
24
|
-
|
24
|
+
containerCls: 'neo-layout-form',
|
25
25
|
/**
|
26
|
-
*
|
27
|
-
* @member {String}
|
26
|
+
* flex css allows gap. This adds it to the component style
|
27
|
+
* @member {String} gap_=null
|
28
28
|
*/
|
29
|
-
|
29
|
+
gap_: null
|
30
30
|
}
|
31
31
|
|
32
32
|
/**
|
@@ -38,11 +38,12 @@ class Form extends Base {
|
|
38
38
|
afterSetGap(value, oldValue) {
|
39
39
|
if (!value && !oldValue) return;
|
40
40
|
|
41
|
-
let
|
42
|
-
|
41
|
+
let {container} = this,
|
42
|
+
{wrapperStyle} = container;
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
wrapperStyle.gap = value;
|
45
|
+
|
46
|
+
container.wrapperStyle = wrapperStyle
|
46
47
|
}
|
47
48
|
|
48
49
|
/**
|
@@ -62,77 +63,19 @@ class Form extends Base {
|
|
62
63
|
}
|
63
64
|
}
|
64
65
|
|
65
|
-
/**
|
66
|
-
* Applies CSS classes to the container this layout is bound to
|
67
|
-
*/
|
68
|
-
applyRenderAttributes() {
|
69
|
-
let me = this,
|
70
|
-
container = Neo.getComponent(me.containerId),
|
71
|
-
wrapperCls = container?.wrapperCls || [];
|
72
|
-
|
73
|
-
if (!container) {
|
74
|
-
Neo.logError('layout.Form: applyRenderAttributes -> container not yet created', me.containerId)
|
75
|
-
}
|
76
|
-
|
77
|
-
NeoArray.add(wrapperCls, 'neo-layout-form');
|
78
|
-
|
79
|
-
container.wrapperCls = wrapperCls
|
80
|
-
}
|
81
|
-
|
82
66
|
/**
|
83
67
|
* Removes all CSS rules from an container item this layout is bound to.
|
84
68
|
* Gets called when switching to a different layout.
|
85
69
|
* @param {Neo.component.Base} item
|
70
|
+
* @param {Number} index
|
86
71
|
* @protected
|
87
72
|
*/
|
88
|
-
removeChildAttributes(item) {
|
73
|
+
removeChildAttributes(item, index) {
|
89
74
|
let style = item.wrapperStyle || {};
|
90
75
|
|
91
76
|
style.flex = item.flex || null;
|
92
77
|
item.wrapperStyle = style
|
93
78
|
}
|
94
|
-
|
95
|
-
/**
|
96
|
-
* Removes all CSS rules from the container this layout is bound to.
|
97
|
-
* Gets called when switching to a different layout.
|
98
|
-
*/
|
99
|
-
removeRenderAttributes() {
|
100
|
-
let me = this,
|
101
|
-
container = Neo.getComponent(me.containerId),
|
102
|
-
wrapperCls = container?.wrapperCls || [];
|
103
|
-
|
104
|
-
if (!container) {
|
105
|
-
Neo.logError('layout.Form: removeRenderAttributes -> container not yet created', me.containerId)
|
106
|
-
}
|
107
|
-
|
108
|
-
NeoArray.remove(wrapperCls, 'neo-layout-form');
|
109
|
-
|
110
|
-
container.wrapperCls = wrapperCls
|
111
|
-
}
|
112
|
-
|
113
|
-
/**
|
114
|
-
* Updates the Container CSS wrapperCls
|
115
|
-
* @param {String|null} value
|
116
|
-
* @param {String|null} oldValue
|
117
|
-
* @param {String} propertyName
|
118
|
-
* @protected
|
119
|
-
*/
|
120
|
-
updateInputValue(value, oldValue, propertyName) {
|
121
|
-
let me = this,
|
122
|
-
container = Neo.getComponent(me.containerId),
|
123
|
-
{prefix} = me,
|
124
|
-
wrapperCls = container?.wrapperCls;
|
125
|
-
|
126
|
-
if (container?.rendered) {
|
127
|
-
NeoArray.remove(wrapperCls, prefix + propertyName + '-' + oldValue);
|
128
|
-
|
129
|
-
if (value !== null) {
|
130
|
-
NeoArray.add(wrapperCls, prefix + propertyName + '-' + value)
|
131
|
-
}
|
132
|
-
|
133
|
-
container.wrapperCls = wrapperCls
|
134
|
-
}
|
135
|
-
}
|
136
79
|
}
|
137
80
|
|
138
81
|
Neo.setupClass(Form);
|