neo.mjs 5.4.6 → 5.4.8
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/ViewportModel.mjs +2 -2
- package/apps/form/view/pages/Page8.mjs +6 -0
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +1 -1
- package/resources/examples/data/formSideNav.json +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/form/Container.mjs +13 -9
- package/src/form/field/CheckBox.mjs +1 -4
- package/src/form/field/Number.mjs +3 -3
package/apps/ServiceWorker.mjs
CHANGED
@@ -80,11 +80,11 @@ class ViewportModel extends Component {
|
|
80
80
|
let page = me.getController().getReference('pages-container').items[value];
|
81
81
|
|
82
82
|
if (page instanceof Neo.core.Base) {
|
83
|
-
page.setValues(me.formData);
|
83
|
+
page.setValues(me.formData, true);
|
84
84
|
} else {
|
85
85
|
setTimeout(() => {
|
86
86
|
me.onDataPropertyChange(key, value, oldValue)
|
87
|
-
},
|
87
|
+
}, 30)
|
88
88
|
}
|
89
89
|
}
|
90
90
|
}
|
@@ -24,8 +24,14 @@ class Page8 extends FormPageContainer {
|
|
24
24
|
module : NumberField,
|
25
25
|
labelText: 'Page 8 Field 2',
|
26
26
|
name : 'page8field2',
|
27
|
+
required : true,
|
27
28
|
stepSize : 0.01,
|
28
29
|
value : 0.02
|
30
|
+
}, {
|
31
|
+
module : NumberField,
|
32
|
+
labelText: 'Page 8 Field 3',
|
33
|
+
name : 'page8field3',
|
34
|
+
stepSize : 0.01
|
29
35
|
}]
|
30
36
|
}
|
31
37
|
}
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
{"id": 11, "cardIndex": 7, "isHeader": false, "isValid": null, "name": "NumberFields"},
|
16
16
|
{"id": 12, "cardIndex": 8, "isHeader": false, "isValid": null, "name": "HiddenFields"},
|
17
17
|
{"id": 13, "cardIndex": 9, "isHeader": false, "isValid": null, "name": "SelectFields"},
|
18
|
-
{"id": 14, "cardIndex": null, "isHeader": true, "isValid": null, "name": "
|
18
|
+
{"id": 14, "cardIndex": null, "isHeader": true, "isValid": null, "name": "4. Optional data"},
|
19
19
|
{"id": 15, "cardIndex": 10, "isHeader": false, "isValid": null, "name": "Page 11"},
|
20
20
|
{"id": 16, "cardIndex": 11, "isHeader": false, "isValid": null, "name": "Page 12"},
|
21
21
|
{"id": 17, "cardIndex": 12, "isHeader": false, "isValid": null, "name": "Page 13"},
|
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.4.
|
240
|
+
* @default '5.4.8'
|
241
241
|
* @memberOf! module:Neo
|
242
242
|
* @name config.version
|
243
243
|
* @type String
|
244
244
|
*/
|
245
|
-
version: '5.4.
|
245
|
+
version: '5.4.8'
|
246
246
|
};
|
247
247
|
|
248
248
|
Object.assign(DefaultConfig, {
|
package/src/form/Container.mjs
CHANGED
@@ -205,28 +205,32 @@ class Container extends BaseContainer {
|
|
205
205
|
async setValues(values={}, suspendEvents=false) {
|
206
206
|
let me = this,
|
207
207
|
fields = await me.getFields(),
|
208
|
-
isRadio, path, value;
|
208
|
+
isCheckBox, isRadio, path, value;
|
209
209
|
|
210
210
|
fields.forEach(item => {
|
211
211
|
if (suspendEvents) {
|
212
212
|
item.suspendEvents = true;
|
213
213
|
}
|
214
214
|
|
215
|
-
|
216
|
-
|
215
|
+
isCheckBox = Neo.form.field?.CheckBox && item instanceof Neo.form.field.CheckBox;
|
216
|
+
path = me.getFieldPath(item);
|
217
|
+
value = Neo.nsWithArrays(path, false, values);
|
217
218
|
|
218
|
-
if (
|
219
|
-
|
220
|
-
|
221
|
-
|
219
|
+
if (isCheckBox) {
|
220
|
+
if (Neo.typeOf(value) === 'Array') {
|
221
|
+
if (value.includes(item.value)) {
|
222
|
+
item.checked = true
|
223
|
+
}
|
224
|
+
} else {
|
225
|
+
item.checked = item.value === value
|
222
226
|
}
|
223
227
|
} else if (value !== undefined) {
|
224
228
|
isRadio = Neo.form.field?.Radio && item instanceof Neo.form.field.Radio;
|
225
229
|
|
226
230
|
if (isRadio) {
|
227
|
-
item.checked = item.value === value
|
231
|
+
item.checked = item.value === value
|
228
232
|
} else {
|
229
|
-
item.value = value
|
233
|
+
item.value = value
|
230
234
|
}
|
231
235
|
}
|
232
236
|
|
@@ -123,8 +123,7 @@ class CheckBox extends Base {
|
|
123
123
|
|
124
124
|
me.vdom.cn[1].checked = value;
|
125
125
|
|
126
|
-
NeoArray.
|
127
|
-
NeoArray.add(iconCls, newCls);
|
126
|
+
NeoArray.removeAdd(iconCls, oldCls, newCls);
|
128
127
|
|
129
128
|
me.update();
|
130
129
|
|
@@ -253,8 +252,6 @@ class CheckBox extends Base {
|
|
253
252
|
this.vdom.cn[1].value = value;
|
254
253
|
this.update();
|
255
254
|
}
|
256
|
-
|
257
|
-
super.afterSetValue(value, oldValue);
|
258
255
|
}
|
259
256
|
|
260
257
|
/**
|
@@ -143,11 +143,11 @@ class Number extends Text {
|
|
143
143
|
|
144
144
|
me.changeInputElKey('step', value);
|
145
145
|
|
146
|
-
|
147
|
-
stepSizeString = String(this.stepSize);
|
146
|
+
stepSizeString = String(this.stepSize);
|
148
147
|
|
149
|
-
|
148
|
+
me.stepSizeDigits = stepSizeString.includes('.') ? stepSizeString.split('.')[1].length : 0;
|
150
149
|
|
150
|
+
if (val !== null) {
|
151
151
|
modulo = (val - me.minValue) % value;
|
152
152
|
|
153
153
|
if (modulo !== 0) { // find the closest valid value
|