@schukai/monster 3.105.0 → 3.105.2
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
CHANGED
@@ -2,6 +2,22 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
## [3.105.2] - 2025-02-06
|
6
|
+
|
7
|
+
### Bug Fixes
|
8
|
+
|
9
|
+
- **select:** prevent lookup race condition
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
## [3.105.1] - 2025-02-06
|
14
|
+
|
15
|
+
### Bug Fixes
|
16
|
+
|
17
|
+
- **select:** lookup after setSelection
|
18
|
+
|
19
|
+
|
20
|
+
|
5
21
|
## [3.105.0] - 2025-02-05
|
6
22
|
|
7
23
|
### Add Features
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.13","@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":"3.105.
|
1
|
+
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.13","@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":"3.105.2"}
|
@@ -314,7 +314,7 @@ function getTemplate() {
|
|
314
314
|
<button data-monster-attributes="disabled path:disabled | if:true,
|
315
315
|
class path:classes.button,
|
316
316
|
aria-role path:aria.role,
|
317
|
-
|
317
|
+
path:aria.label | if:true,
|
318
318
|
type path:type"
|
319
319
|
data-monster-role="button"
|
320
320
|
part="button"
|
@@ -221,6 +221,12 @@ const areOptionsAvailableAndInitSymbol = Symbol("@@areOptionsAvailableAndInit");
|
|
221
221
|
*/
|
222
222
|
const disabledRequestMarker = Symbol("@@disabledRequestMarker");
|
223
223
|
|
224
|
+
/**
|
225
|
+
* @private
|
226
|
+
* @type {symbol}
|
227
|
+
*/
|
228
|
+
const runLookupOnceSymbol = Symbol("runLookupOnce");
|
229
|
+
|
224
230
|
/**
|
225
231
|
* @private
|
226
232
|
* @type {number}
|
@@ -560,7 +566,7 @@ class Select extends CustomControl {
|
|
560
566
|
);
|
561
567
|
|
562
568
|
areOptionsAvailableAndInit.call(self);
|
563
|
-
},0);
|
569
|
+
}, 0);
|
564
570
|
|
565
571
|
return this;
|
566
572
|
}
|
@@ -1120,14 +1126,14 @@ function attachResizeObserver() {
|
|
1120
1126
|
});
|
1121
1127
|
|
1122
1128
|
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1129
|
+
let parent = this.parentNode;
|
1130
|
+
while (!(parent instanceof HTMLElement) && parent !== null) {
|
1131
|
+
parent = parent.parentNode;
|
1132
|
+
}
|
1127
1133
|
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1134
|
+
if (parent instanceof HTMLElement) {
|
1135
|
+
this[resizeObserverSymbol].observe(parent);
|
1136
|
+
}
|
1131
1137
|
|
1132
1138
|
}
|
1133
1139
|
|
@@ -1352,13 +1358,13 @@ function initOptionObserver() {
|
|
1352
1358
|
self.updateI18n();
|
1353
1359
|
} catch (e) {
|
1354
1360
|
addErrorAttribute(self, e);
|
1355
|
-
|
1361
|
+
setStatusOrRemoveBadges.call(self, "error");
|
1356
1362
|
}
|
1357
1363
|
try {
|
1358
1364
|
areOptionsAvailableAndInit.call(self);
|
1359
1365
|
} catch (e) {
|
1360
1366
|
addErrorAttribute(self, e);
|
1361
|
-
|
1367
|
+
setStatusOrRemoveBadges.call(self, "error");
|
1362
1368
|
}
|
1363
1369
|
|
1364
1370
|
setSummaryAndControlText.call(self);
|
@@ -2246,8 +2252,8 @@ function isValueIsEmpty(value) {
|
|
2246
2252
|
let equivalents = this.getOption("empty.equivalents");
|
2247
2253
|
if (!isArray(equivalents)) {
|
2248
2254
|
if (equivalents === undefined) {
|
2249
|
-
|
2250
|
-
|
2255
|
+
return false;
|
2256
|
+
}
|
2251
2257
|
equivalents = [equivalents];
|
2252
2258
|
}
|
2253
2259
|
|
@@ -2262,13 +2268,13 @@ function isValueIsEmpty(value) {
|
|
2262
2268
|
*/
|
2263
2269
|
function isValueIsEmptyThenGetNormalize(value) {
|
2264
2270
|
let emptyDefault = null
|
2265
|
-
if (this.getOption("type")==="checkbox") {
|
2271
|
+
if (this.getOption("type") === "checkbox") {
|
2266
2272
|
emptyDefault = this.getOption("empty.defaultValueCheckbox");
|
2267
2273
|
} else {
|
2268
2274
|
emptyDefault = this.getOption("empty.defaultValueRadio");
|
2269
2275
|
}
|
2270
2276
|
|
2271
|
-
if (isValueIsEmpty.call(this,value)) {
|
2277
|
+
if (isValueIsEmpty.call(this, value)) {
|
2272
2278
|
return emptyDefault;
|
2273
2279
|
}
|
2274
2280
|
|
@@ -2282,19 +2288,20 @@ function isValueIsEmptyThenGetNormalize(value) {
|
|
2282
2288
|
* @returns {Promise<unknown | void>}
|
2283
2289
|
*/
|
2284
2290
|
function setSelection(selection) {
|
2291
|
+
const self = this;
|
2285
2292
|
|
2286
2293
|
if (isString(selection) || isInteger(selection)) {
|
2287
2294
|
const result = convertValueToSelection.call(this, selection);
|
2288
2295
|
selection = result?.selection;
|
2289
2296
|
}
|
2290
2297
|
|
2291
|
-
selection = isValueIsEmptyThenGetNormalize.call(this,selection);
|
2298
|
+
selection = isValueIsEmptyThenGetNormalize.call(this, selection);
|
2292
2299
|
validateArray(selection);
|
2293
2300
|
|
2294
2301
|
let resultSelection = [];
|
2295
2302
|
for (let i = 0; i < selection.length; i++) {
|
2296
2303
|
|
2297
|
-
if(isValueIsEmpty.call(this,selection[i].value)) {
|
2304
|
+
if (isValueIsEmpty.call(this, selection[i].value)) {
|
2298
2305
|
continue
|
2299
2306
|
}
|
2300
2307
|
|
@@ -2328,6 +2335,18 @@ function setSelection(selection) {
|
|
2328
2335
|
|
2329
2336
|
fireEvent(this, "change"); // https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/291
|
2330
2337
|
|
2338
|
+
if(this[runLookupOnceSymbol] !== true && selection.length > 0) {
|
2339
|
+
|
2340
|
+
this[runLookupOnceSymbol] = true
|
2341
|
+
|
2342
|
+
const lazyLoadFlag =
|
2343
|
+
this.getOption("features.lazyLoad") && this[lazyLoadDoneSymbol] !== true;
|
2344
|
+
let remoteFilterFlag = getFilterMode.call(this) === FILTER_MODE_REMOTE;
|
2345
|
+
if (lazyLoadFlag || remoteFilterFlag) {
|
2346
|
+
lookupSelection.call(self);
|
2347
|
+
}
|
2348
|
+
}
|
2349
|
+
|
2331
2350
|
return new Processing(() => {
|
2332
2351
|
const CLASSNAME = "selected";
|
2333
2352
|
|
@@ -2854,12 +2873,12 @@ function getTemplate() {
|
|
2854
2873
|
data-monster-attributes="
|
2855
2874
|
type path:type,
|
2856
2875
|
role path:role,
|
2857
|
-
value path:options
|
2876
|
+
value path:options.value,
|
2858
2877
|
name path:name,
|
2859
2878
|
part path:type | prefix:option- | suffix: form,
|
2860
2879
|
class path:options.class
|
2861
2880
|
" tabindex="-1">
|
2862
|
-
<div data-monster-replace="path:options
|
2881
|
+
<div data-monster-replace="path:options.label"
|
2863
2882
|
part="option-label"></div>
|
2864
2883
|
</label>
|
2865
2884
|
</div>
|