@schukai/monster 4.36.0 → 4.37.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 +8 -0
- package/package.json +1 -1
- package/source/components/form/select.mjs +1 -1
- package/source/dom/error.mjs +51 -43
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +117 -5
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.2","@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":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.2","@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.37.0"}
|
@@ -579,7 +579,7 @@ class Select extends CustomControl {
|
|
579
579
|
this.setOption("messages.total", "");
|
580
580
|
this.setOption("messages.summary", "");
|
581
581
|
|
582
|
-
|
582
|
+
resetErrorAttribute.call(this);
|
583
583
|
|
584
584
|
this[lazyLoadDoneSymbol] = false;
|
585
585
|
this[runLookupOnceSymbol] = false;
|
package/source/dom/error.mjs
CHANGED
@@ -15,7 +15,15 @@
|
|
15
15
|
import { validateInstance, validateString } from "../types/validate.mjs";
|
16
16
|
import { ATTRIBUTE_ERRORMESSAGE } from "./constants.mjs";
|
17
17
|
|
18
|
-
export { addErrorAttribute, removeErrorAttribute };
|
18
|
+
export { resetErrorAttribute, addErrorAttribute, removeErrorAttribute };
|
19
|
+
|
20
|
+
function resetErrorAttribute(element) {
|
21
|
+
validateInstance(element, HTMLElement);
|
22
|
+
if (element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
|
23
|
+
element.removeAttribute(ATTRIBUTE_ERRORMESSAGE);
|
24
|
+
}
|
25
|
+
return element;
|
26
|
+
}
|
19
27
|
|
20
28
|
/**
|
21
29
|
* This method can be used to add an error message to an element.
|
@@ -28,45 +36,45 @@ export { addErrorAttribute, removeErrorAttribute };
|
|
28
36
|
* @return {HTMLElement}
|
29
37
|
*/
|
30
38
|
function addErrorAttribute(element, message) {
|
31
|
-
|
39
|
+
validateInstance(element, HTMLElement);
|
32
40
|
|
33
|
-
|
34
|
-
|
35
|
-
|
41
|
+
if (message instanceof Error) {
|
42
|
+
message = message.message;
|
43
|
+
}
|
36
44
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
if (typeof message !== "string") {
|
46
|
+
if (typeof message === "object" && message !== null) {
|
47
|
+
if (typeof message.toString === "function") {
|
48
|
+
message = message.toString();
|
49
|
+
} else {
|
50
|
+
message = JSON.stringify(message);
|
51
|
+
}
|
52
|
+
} else {
|
53
|
+
message = String(message);
|
54
|
+
}
|
55
|
+
}
|
48
56
|
|
49
|
-
|
57
|
+
validateString(message);
|
50
58
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
59
|
+
if (!element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
|
60
|
+
element.setAttribute(ATTRIBUTE_ERRORMESSAGE, message);
|
61
|
+
return element;
|
62
|
+
}
|
55
63
|
|
56
|
-
|
57
|
-
|
64
|
+
const current = element.getAttribute(ATTRIBUTE_ERRORMESSAGE);
|
65
|
+
const list = current.split("::");
|
58
66
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
67
|
+
for (let i = 0; i < list.length; i++) {
|
68
|
+
if (list[i] === message) {
|
69
|
+
return element;
|
70
|
+
}
|
71
|
+
}
|
64
72
|
|
65
|
-
|
73
|
+
list.push(message);
|
66
74
|
|
67
|
-
|
75
|
+
element.setAttribute(ATTRIBUTE_ERRORMESSAGE, list.join("::"));
|
68
76
|
|
69
|
-
|
77
|
+
return element;
|
70
78
|
}
|
71
79
|
|
72
80
|
/**
|
@@ -80,20 +88,20 @@ function addErrorAttribute(element, message) {
|
|
80
88
|
* @return {HTMLElement}
|
81
89
|
*/
|
82
90
|
function removeErrorAttribute(element, message) {
|
83
|
-
|
84
|
-
|
91
|
+
validateInstance(element, HTMLElement);
|
92
|
+
validateString(message);
|
85
93
|
|
86
|
-
|
87
|
-
|
88
|
-
|
94
|
+
if (!element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
|
95
|
+
return element;
|
96
|
+
}
|
89
97
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
98
|
+
const current = element.getAttribute(ATTRIBUTE_ERRORMESSAGE);
|
99
|
+
const list = current.split("::");
|
100
|
+
const newList = list.filter(function (token) {
|
101
|
+
return token !== message;
|
102
|
+
});
|
95
103
|
|
96
|
-
|
104
|
+
element.setAttribute(ATTRIBUTE_ERRORMESSAGE, newList.join("::"));
|
97
105
|
|
98
|
-
|
106
|
+
return element;
|
99
107
|
}
|
package/source/types/version.mjs
CHANGED
package/test/cases/monster.mjs
CHANGED
package/test/web/test.html
CHANGED
@@ -9,8 +9,8 @@
|
|
9
9
|
</head>
|
10
10
|
<body>
|
11
11
|
<div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
|
12
|
-
<h1 style='margin-bottom: 0.1em;'>Monster 4.
|
13
|
-
<div id="lastupdate" style='font-size:0.7em'>last update Sa
|
12
|
+
<h1 style='margin-bottom: 0.1em;'>Monster 4.36.0</h1>
|
13
|
+
<div id="lastupdate" style='font-size:0.7em'>last update Sa 19. Jul 18:39:06 CEST 2025</div>
|
14
14
|
</div>
|
15
15
|
<div id="mocha-errors"
|
16
16
|
style="color: red;font-weight: bold;display: flex;align-items: center;justify-content: center;flex-direction: column;margin:20px;"></div>
|