@schukai/monster 4.81.0 → 4.83.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 CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.83.0] - 2026-01-07
6
+
7
+ ### Add Features
8
+
9
+ - Improve spinner handling for data fetching
10
+
11
+
12
+
13
+ ## [4.82.0] - 2026-01-07
14
+
15
+ ### Add Features
16
+
17
+ - Update Select component to handle null values gracefully
18
+
19
+
20
+
5
21
  ## [4.81.0] - 2026-01-07
6
22
 
7
23
  ### Add Features
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.81.0"}
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.83.0"}
@@ -184,14 +184,23 @@ function initEventHandler() {
184
184
  }
185
185
 
186
186
  let fadeOutTimer = null;
187
+ const hideSpinner = () => {
188
+ self.setOption("state.spinner", "hide");
189
+ };
187
190
 
188
191
  this[datasourceLinkedElementSymbol] = element;
192
+ hideSpinner();
189
193
  element.addEventListener("monster-datasource-fetched", function () {
190
194
  if (typeof self[errorElementSymbol]?.resetErrorMessage === "function") {
191
195
  self[errorElementSymbol].resetErrorMessage();
192
196
  }
197
+ if (fadeOutTimer) {
198
+ clearTimeout(fadeOutTimer);
199
+ fadeOutTimer = null;
200
+ }
193
201
  fadeOutTimer = setTimeout(() => {
194
- self.setOption("state.spinner", "hide");
202
+ fadeOutTimer = null;
203
+ hideSpinner();
195
204
  }, 800);
196
205
  });
197
206
 
@@ -214,7 +223,7 @@ function initEventHandler() {
214
223
  fadeOutTimer = null;
215
224
  }
216
225
 
217
- self.setOption("state.spinner", "hide");
226
+ hideSpinner();
218
227
 
219
228
  const timeout = self.getOption("timeouts.message", 4000);
220
229
  let msg = "Cannot load data";
@@ -408,7 +408,7 @@ class Select extends CustomControl {
408
408
  * e.value=1
409
409
  * ```
410
410
  *
411
- * @property {string|array} value
411
+ * @property {string|array|null} value
412
412
  * @throws {Error} unsupported type
413
413
  * @fires monster-selected this event is fired when the selection is set
414
414
  */
@@ -3140,6 +3140,8 @@ function checkOptionState() {
3140
3140
  function convertValueToSelection(value) {
3141
3141
  const selection = [];
3142
3142
 
3143
+ value = isValueIsEmptyThenGetNormalize.call(this, value);
3144
+
3143
3145
  if (isString(value)) {
3144
3146
  value = value
3145
3147
  .split(",")
@@ -281,6 +281,34 @@ describe('Select', function () {
281
281
  }, 350);
282
282
  });
283
283
 
284
+ it('should treat null value as empty selection', function (done) {
285
+ this.timeout(2000);
286
+
287
+ let mocks = document.getElementById('mocks');
288
+ const select = document.createElement('monster-select');
289
+ select.setOption('options', [{label: 'One', value: '1'}]);
290
+ mocks.appendChild(select);
291
+
292
+ setTimeout(() => {
293
+ select.value = null;
294
+
295
+ setTimeout(() => {
296
+ try {
297
+ const selection = select.getOption('selection');
298
+ const error = select.getAttribute('data-monster-error') ?? '';
299
+ expect(Array.isArray(selection)).to.equal(true);
300
+ expect(selection.length).to.equal(0);
301
+ expect(select.value).to.equal('');
302
+ expect(error).to.not.contain('unsupported type');
303
+ } catch (e) {
304
+ return done(e);
305
+ }
306
+
307
+ done();
308
+ }, 50);
309
+ }, 50);
310
+ });
311
+
284
312
  });
285
313
 
286
314