@schukai/monster 4.6.0 → 4.7.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.7.0] - 2025-05-15
6
+
7
+ ### Add Features
8
+
9
+ - Add forgot password callback support in login component
10
+
11
+
12
+
13
+ ## [4.6.1] - 2025-05-15
14
+
15
+ ### Bug Fixes
16
+
17
+ - Improve lazy loading and error handling in select component
18
+
19
+
20
+
5
21
  ## [4.6.0] - 2025-05-15
6
22
 
7
23
  ### Add Features
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.0","@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.6.0"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.0","@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.7.0"}
@@ -205,6 +205,7 @@ class Login extends CustomElement {
205
205
  * @property {Function} actions.click Callback function for generic click actions within the login component
206
206
  * @property {Object} callbacks Optional callback hooks for modifying internal behavior
207
207
  * @property {Function} callbacks.username A function that receives and can transform the entered username before submission
208
+ * @property {Function} callbacks.forgotPassword A function that receives and can transform the entered email before submission
208
209
  * @property {number} digits Number of digits required for second factor or password reset code input
209
210
  * @property {Object[]} successUrls List of URLs shown after successful login (e.g., home or logout)
210
211
  * @property {string} successUrls.label Label for the success URL (displayed)
@@ -274,6 +275,7 @@ class Login extends CustomElement {
274
275
 
275
276
  callbacks : {
276
277
  username : null,
278
+ forgotPassword : null,
277
279
  },
278
280
 
279
281
  digits: 6,
@@ -1310,8 +1312,17 @@ function initEventHandler() {
1310
1312
  const emailElement = this.shadowRoot.querySelector("input[name='email']");
1311
1313
 
1312
1314
  // get username and password
1313
- const mail = emailElement.value;
1314
- const valid = emailElement.checkValidity();
1315
+ let mail = emailElement.value;
1316
+ let valid = emailElement.checkValidity();
1317
+
1318
+ const mailCallback = this.getOption("callbacks.forgotPassword");
1319
+ if (isFunction(mailCallback)) {
1320
+ const mailCallbackResult = mailCallback.call(this, mail);
1321
+ if (mailCallbackResult !== undefined) {
1322
+ mail = mailCallbackResult;
1323
+ valid = true;
1324
+ }
1325
+ }
1315
1326
 
1316
1327
  let msg = null;
1317
1328
  if (mail === "" || mail === null) {
@@ -561,6 +561,8 @@ class Select extends CustomControl {
561
561
  let lazyLoadFlag = self.getOption("features.lazyLoad", false);
562
562
  const remoteFilterFlag = getFilterMode.call(this) === FILTER_MODE_REMOTE;
563
563
 
564
+ initTotal.call(self);
565
+
564
566
  if (getFilterMode.call(this) === FILTER_MODE_REMOTE) {
565
567
  self.setOption("features.lazyLoad", false);
566
568
  lazyLoadFlag = false;
@@ -585,16 +587,13 @@ class Select extends CustomControl {
585
587
  lookupSelection.call(self);
586
588
  } else {
587
589
  self.fetch().then(() => {
588
- setTotalText.call(self);
590
+
589
591
  }).catch((e) => {
590
592
  addErrorAttribute(self, e);
591
593
  });
592
594
  }
593
595
  }
594
596
 
595
- initTotal.call(self);
596
-
597
-
598
597
  setTimeout(() => {
599
598
  let lastValue = self.value;
600
599
  self[internalSymbol].attachObserver(
@@ -1408,9 +1407,9 @@ function fetchIt(url, controlOptions) {
1408
1407
 
1409
1408
  queueMicrotask(() => {
1410
1409
  checkOptionState.call(this);
1411
- setStatusOrRemoveBadges.call(this, "closed");
1412
- updatePopper.call(this);
1413
1410
  setTotalText.call(this);
1411
+ updatePopper.call(this);
1412
+ setStatusOrRemoveBadges.call(this, "closed");
1414
1413
 
1415
1414
  resolve(result);
1416
1415
  });
@@ -1714,6 +1713,9 @@ function getDefaultTranslation() {
1714
1713
  return translation;
1715
1714
  }
1716
1715
 
1716
+ /**
1717
+ * @private
1718
+ */
1717
1719
  function setTotalText() {
1718
1720
 
1719
1721
  if (getFilterMode.call(this) !== FILTER_MODE_REMOTE) {
@@ -2869,6 +2871,8 @@ function show() {
2869
2871
  return;
2870
2872
  }
2871
2873
 
2874
+ setTotalText.call(this);
2875
+
2872
2876
  focusFilter.call(this);
2873
2877
 
2874
2878
  const lazyLoadFlag =
@@ -2943,7 +2947,7 @@ function initDefaultOptionsFromUrl() {
2943
2947
  this[cleanupOptionsListSymbol] = false;
2944
2948
  importOptionsIntern.call(this, data);
2945
2949
  setStatusOrRemoveBadges.call(this, "open");
2946
- setTotal.call(this, data)
2950
+ initTotal.call(this, data)
2947
2951
  })
2948
2952
  .catch((e) => {
2949
2953
  addErrorAttribute(this, e);
@@ -2969,7 +2973,7 @@ function initTotal() {
2969
2973
 
2970
2974
  getGlobal().fetch(url).then((response) => {
2971
2975
  if (!response.ok) { // Improved status checking using `response.ok`
2972
- addErrorAttribute(this, `HTTP error! status: ${response.status} - ${response.statusText}`);
2976
+ addErrorAttribute(this, `HTTP error status: ${response.status} - ${response.statusText}`);
2973
2977
  return;
2974
2978
  }
2975
2979
 
@@ -3292,7 +3296,6 @@ function setStatusOrRemoveBadges(suggestion) {
3292
3296
  if (current !== suggestion) {
3293
3297
  this.setOption("classes.statusOrRemoveBadge", suggestion);
3294
3298
  }
3295
- return;
3296
3299
  }
3297
3300
  });
3298
3301
  }