neo.mjs 5.2.10 → 5.2.12
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/apps/form/view/pages/Page5.mjs +25 -9
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +4 -4
- package/resources/examples/data/formSideNav.json +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/container/Base.mjs +1 -1
- package/src/form/Container.mjs +3 -3
- package/src/form/field/Radio.mjs +7 -0
- package/src/tab/Container.mjs +36 -26
package/apps/ServiceWorker.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import FormPageContainer from '../FormPageContainer.mjs';
|
2
|
-
import
|
2
|
+
import Radio from '../../../../src/form/field/Radio.mjs';
|
3
3
|
|
4
4
|
/**
|
5
5
|
* @class Form.view.pages.Page5
|
@@ -12,6 +12,15 @@ class Page5 extends FormPageContainer {
|
|
12
12
|
* @protected
|
13
13
|
*/
|
14
14
|
className: 'Form.view.pages.Page5',
|
15
|
+
/**
|
16
|
+
* @member {Object} itemDefaults
|
17
|
+
*/
|
18
|
+
itemDefaults: {
|
19
|
+
module : Radio,
|
20
|
+
labelText : null,
|
21
|
+
labelWidth: 70,
|
22
|
+
name : 'fruits'
|
23
|
+
},
|
15
24
|
/**
|
16
25
|
* @member {String} formGroup='page5'
|
17
26
|
*/
|
@@ -20,15 +29,22 @@ class Page5 extends FormPageContainer {
|
|
20
29
|
* @member {Object[]} items
|
21
30
|
*/
|
22
31
|
items: [{
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
value
|
32
|
+
labelText : 'Fruits',
|
33
|
+
value : 'apple',
|
34
|
+
valueLabelText: 'Apple'
|
35
|
+
}, {
|
36
|
+
value : 'banana',
|
37
|
+
valueLabelText: 'Banana'
|
38
|
+
}, {
|
39
|
+
checked : true,
|
40
|
+
value : 'lemon',
|
41
|
+
valueLabelText: 'Lemon'
|
42
|
+
}, {
|
43
|
+
value : 'orange',
|
44
|
+
valueLabelText: 'Orange'
|
28
45
|
}, {
|
29
|
-
|
30
|
-
|
31
|
-
name : 'field2'
|
46
|
+
value : 'strawberry',
|
47
|
+
valueLabelText: 'Strawberry'
|
32
48
|
}]
|
33
49
|
}
|
34
50
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "neo.mjs",
|
3
|
-
"version": "5.2.
|
3
|
+
"version": "5.2.12",
|
4
4
|
"description": "The webworkers driven UI framework",
|
5
5
|
"type": "module",
|
6
6
|
"repository": {
|
@@ -44,7 +44,7 @@
|
|
44
44
|
"@fortawesome/fontawesome-free": "^6.3.0",
|
45
45
|
"@material/mwc-button": "^0.27.0",
|
46
46
|
"@material/mwc-textfield": "^0.27.0",
|
47
|
-
"autoprefixer": "^10.4.
|
47
|
+
"autoprefixer": "^10.4.14",
|
48
48
|
"chalk": "^5.2.0",
|
49
49
|
"clean-webpack-plugin": "^4.0.0",
|
50
50
|
"commander": "^10.0.0",
|
@@ -56,8 +56,8 @@
|
|
56
56
|
"neo-jsdoc": "^1.0.1",
|
57
57
|
"neo-jsdoc-x": "^1.0.5",
|
58
58
|
"postcss": "^8.4.21",
|
59
|
-
"sass": "^1.
|
60
|
-
"webpack": "^5.
|
59
|
+
"sass": "^1.59.2",
|
60
|
+
"webpack": "^5.76.1",
|
61
61
|
"webpack-cli": "^5.0.1",
|
62
62
|
"webpack-dev-server": "4.11.1",
|
63
63
|
"webpack-hook-plugin": "^1.0.7",
|
@@ -8,7 +8,7 @@
|
|
8
8
|
{"id": 4, "cardIndex": 2, "isHeader": false, "isValid": null, "name": "Page 3"},
|
9
9
|
{"id": 5, "cardIndex": null, "isHeader": true, "isValid": null, "name": "2. Personal data"},
|
10
10
|
{"id": 6, "cardIndex": 3, "isHeader": false, "isValid": null, "name": "CheckBoxes"},
|
11
|
-
{"id": 7, "cardIndex": 4, "isHeader": false, "isValid": null, "name": "
|
11
|
+
{"id": 7, "cardIndex": 4, "isHeader": false, "isValid": null, "name": "Radios"},
|
12
12
|
{"id": 8, "cardIndex": 5, "isHeader": false, "isValid": null, "name": "Page 6"},
|
13
13
|
{"id": 9, "cardIndex": 6, "isHeader": false, "isValid": null, "name": "Fieldsets"},
|
14
14
|
{"id": 10, "cardIndex": null, "isHeader": true, "isValid": null, "name": "3. More data"},
|
package/src/DefaultConfig.mjs
CHANGED
@@ -237,12 +237,12 @@ const DefaultConfig = {
|
|
237
237
|
useVdomWorker: true,
|
238
238
|
/**
|
239
239
|
* buildScripts/injectPackageVersion.mjs will update this value
|
240
|
-
* @default '5.2.
|
240
|
+
* @default '5.2.12'
|
241
241
|
* @memberOf! module:Neo
|
242
242
|
* @name config.version
|
243
243
|
* @type String
|
244
244
|
*/
|
245
|
-
version: '5.2.
|
245
|
+
version: '5.2.12'
|
246
246
|
};
|
247
247
|
|
248
248
|
Object.assign(DefaultConfig, {
|
package/src/container/Base.mjs
CHANGED
package/src/form/Container.mjs
CHANGED
@@ -110,7 +110,7 @@ class Container extends BaseContainer {
|
|
110
110
|
ns = values;
|
111
111
|
}
|
112
112
|
|
113
|
-
if (Object.hasOwn(ns, key)) {
|
113
|
+
if (Object.hasOwn(ns, key) && value !== undefined) {
|
114
114
|
if (ns[key] === null) {
|
115
115
|
ns[key] = []
|
116
116
|
} else if (!Array.isArray(ns[key])) {
|
@@ -118,8 +118,8 @@ class Container extends BaseContainer {
|
|
118
118
|
}
|
119
119
|
|
120
120
|
value !== null && ns[key].unshift(value)
|
121
|
-
} else {
|
122
|
-
ns[key] = value
|
121
|
+
} else if (value !== undefined) {
|
122
|
+
ns[key] = value
|
123
123
|
}
|
124
124
|
});
|
125
125
|
|
package/src/form/field/Radio.mjs
CHANGED
@@ -44,6 +44,13 @@ class Radio extends CheckBox {
|
|
44
44
|
value && this.uncheckGroupItems()
|
45
45
|
}
|
46
46
|
|
47
|
+
/**
|
48
|
+
* @returns {String|null}
|
49
|
+
*/
|
50
|
+
getValue() {
|
51
|
+
return this.checked ? this.value : undefined
|
52
|
+
}
|
53
|
+
|
47
54
|
/**
|
48
55
|
* Radios do not fire a change event for "uncheck", so we need to iterate over other radios with the same name.
|
49
56
|
*/
|
package/src/tab/Container.mjs
CHANGED
@@ -408,25 +408,27 @@ class Container extends BaseContainer {
|
|
408
408
|
* Inserts an item or array of items at a specific index
|
409
409
|
* @param {Number} index
|
410
410
|
* @param {Object|Object[]} item
|
411
|
+
* @param {Boolean} silent=false
|
411
412
|
* @returns {Neo.component.Base|Neo.component.Base[]}
|
412
413
|
*/
|
413
|
-
insert(index, item) {
|
414
|
+
insert(index, item, silent=false) {
|
414
415
|
let me = this,
|
415
416
|
cardContainer = me.getCardContainer(),
|
416
417
|
tabBar = me.getTabBar(),
|
417
418
|
hasItem = false,
|
418
|
-
i, len, superItem, tab, tabButtonConfig;
|
419
|
+
i, len, returnArray, superItem, tab, tabButtonConfig;
|
419
420
|
|
420
421
|
if (Array.isArray(item)) {
|
421
|
-
i
|
422
|
-
len
|
422
|
+
i = 0;
|
423
|
+
len = item.length;
|
424
|
+
returnArray = [];
|
423
425
|
|
424
426
|
for (; i < len; i++) {
|
425
|
-
// todo: render is async, ensure the order of items is correct
|
426
|
-
|
427
427
|
// insert the array backwards
|
428
|
-
|
428
|
+
returnArray.unshift(me.insert(index, item[len - 1 - i], true));
|
429
429
|
}
|
430
|
+
|
431
|
+
superItem = returnArray;
|
430
432
|
} else if (typeof item === 'object') {
|
431
433
|
i = 0;
|
432
434
|
len = cardContainer.items.length;
|
@@ -435,38 +437,46 @@ class Container extends BaseContainer {
|
|
435
437
|
if (cardContainer.items[i].id === item.id) {
|
436
438
|
hasItem = true;
|
437
439
|
superItem = cardContainer.items[i];
|
438
|
-
|
440
|
+
|
441
|
+
if (me.activateInsertedTabs) {
|
442
|
+
me.activeIndex = i;
|
443
|
+
}
|
444
|
+
|
439
445
|
break;
|
440
446
|
}
|
441
447
|
}
|
442
|
-
}
|
443
|
-
|
444
|
-
if (!hasItem) {
|
445
|
-
tabButtonConfig = item.tabButtonConfig;
|
446
448
|
|
447
|
-
|
449
|
+
if (!hasItem) {
|
450
|
+
tabButtonConfig = item.tabButtonConfig;
|
448
451
|
|
449
|
-
|
450
|
-
i = 0;
|
451
|
-
len = tabBar.items.length;
|
452
|
+
tab = tabBar.insert(index, me.getTabButtonConfig(tabButtonConfig, index));
|
452
453
|
|
453
|
-
|
454
|
-
|
454
|
+
// todo: non index based matching of tab buttons and cards
|
455
|
+
i = 0;
|
456
|
+
len = tabBar.items.length;
|
455
457
|
|
456
|
-
|
458
|
+
for (; i < len; i++) {
|
459
|
+
tabBar.items[i].index = i;
|
460
|
+
}
|
457
461
|
|
458
|
-
|
459
|
-
|
462
|
+
item.flex = 1;
|
463
|
+
superItem = cardContainer.insert(index, item, silent);
|
460
464
|
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
465
|
+
if (me.activateInsertedTabs) {
|
466
|
+
if (!me.vnode) {
|
467
|
+
me.activeIndex = index;
|
468
|
+
} else {
|
469
|
+
tab.on('mounted', me.onTabButtonMounted, me);
|
470
|
+
}
|
466
471
|
}
|
467
472
|
}
|
468
473
|
}
|
469
474
|
|
475
|
+
if (!silent) {
|
476
|
+
me.updateTabButtons()
|
477
|
+
me.update();
|
478
|
+
}
|
479
|
+
|
470
480
|
return superItem
|
471
481
|
}
|
472
482
|
|