@schukai/monster 4.85.2 → 4.86.0
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/CHANGELOG.md +11 -0
- package/package.json +1 -1
- package/source/components/form/form.mjs +6 -0
- package/source/components/form/select.mjs +51 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
## [4.86.0] - 2026-01-10
|
|
6
|
+
|
|
7
|
+
### Add Features
|
|
8
|
+
|
|
9
|
+
- Add investigation for form writeback and control ([#370](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/370))
|
|
10
|
+
### Changes
|
|
11
|
+
|
|
12
|
+
- close issue
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
5
16
|
## [4.85.2] - 2026-01-08
|
|
6
17
|
|
|
7
18
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.4","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.
|
|
1
|
+
{"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.4","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.86.0"}
|
|
@@ -189,6 +189,12 @@ function initEventHandler() {
|
|
|
189
189
|
const events = this.getOption("writeBack.events");
|
|
190
190
|
for (const event of events) {
|
|
191
191
|
this.addEventListener(event, (e) => {
|
|
192
|
+
const target = e?.target;
|
|
193
|
+
const targetTag = target?.tagName?.toLowerCase?.();
|
|
194
|
+
if (targetTag === "monster-select" && e.type !== "change") {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
|
|
192
198
|
if (e?.target && typeof e.target.setCustomValidity === "function") {
|
|
193
199
|
e.target.setCustomValidity("");
|
|
194
200
|
e.target.removeAttribute("data-monster-validation-error");
|
|
@@ -3241,6 +3241,40 @@ function isValueIsEmptyThenGetNormalize(value) {
|
|
|
3241
3241
|
return value;
|
|
3242
3242
|
}
|
|
3243
3243
|
|
|
3244
|
+
/**
|
|
3245
|
+
* @private
|
|
3246
|
+
* @param {Array} current
|
|
3247
|
+
* @param {Array} next
|
|
3248
|
+
* @returns {boolean}
|
|
3249
|
+
*/
|
|
3250
|
+
function areSelectionValuesEqual(current, next) {
|
|
3251
|
+
if (!isArray(current) || !isArray(next)) {
|
|
3252
|
+
return false;
|
|
3253
|
+
}
|
|
3254
|
+
|
|
3255
|
+
if (current.length !== next.length) {
|
|
3256
|
+
return false;
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3259
|
+
const toValue = (item) => {
|
|
3260
|
+
if (isObject(item) && Object.prototype.hasOwnProperty.call(item, "value")) {
|
|
3261
|
+
return `${item.value}`;
|
|
3262
|
+
}
|
|
3263
|
+
return `${item}`;
|
|
3264
|
+
};
|
|
3265
|
+
|
|
3266
|
+
const currentValues = current.map(toValue).sort();
|
|
3267
|
+
const nextValues = next.map(toValue).sort();
|
|
3268
|
+
|
|
3269
|
+
for (let i = 0; i < currentValues.length; i++) {
|
|
3270
|
+
if (currentValues[i] !== nextValues[i]) {
|
|
3271
|
+
return false;
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
|
|
3275
|
+
return true;
|
|
3276
|
+
}
|
|
3277
|
+
|
|
3244
3278
|
/**
|
|
3245
3279
|
* @private
|
|
3246
3280
|
* @param selection
|
|
@@ -3280,27 +3314,34 @@ function setSelection(selection) {
|
|
|
3280
3314
|
|
|
3281
3315
|
selection = resultSelection;
|
|
3282
3316
|
|
|
3317
|
+
const previousSelection = this.getOption("selection", []);
|
|
3318
|
+
const valuesChanged = !areSelectionValuesEqual(previousSelection, selection);
|
|
3319
|
+
|
|
3283
3320
|
if (!isInteger(this[selectionVersionSymbol])) {
|
|
3284
3321
|
this[selectionVersionSymbol] = 0;
|
|
3285
3322
|
}
|
|
3286
|
-
|
|
3323
|
+
if (valuesChanged) {
|
|
3324
|
+
this[selectionVersionSymbol] += 1;
|
|
3325
|
+
}
|
|
3287
3326
|
|
|
3288
3327
|
this.setOption("selection", selection);
|
|
3289
3328
|
|
|
3290
3329
|
checkOptionState.call(this);
|
|
3291
3330
|
setSummaryAndControlText.call(this);
|
|
3292
3331
|
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3332
|
+
if (valuesChanged) {
|
|
3333
|
+
try {
|
|
3334
|
+
this?.setFormValue(this.value);
|
|
3335
|
+
} catch (e) {
|
|
3336
|
+
addErrorAttribute(this, e);
|
|
3337
|
+
}
|
|
3298
3338
|
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3339
|
+
fireCustomEvent(this, "monster-selected", {
|
|
3340
|
+
selection,
|
|
3341
|
+
});
|
|
3302
3342
|
|
|
3303
|
-
|
|
3343
|
+
fireEvent(this, "change"); // https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/291
|
|
3344
|
+
}
|
|
3304
3345
|
|
|
3305
3346
|
if (this[runLookupOnceSymbol] !== true && selection.length > 0) {
|
|
3306
3347
|
this[runLookupOnceSymbol] = true;
|