@schukai/monster 3.99.1 → 3.99.3
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 +16 -0
- package/package.json +1 -1
- package/source/components/datatable/dataset.mjs +7 -2
- package/source/components/datatable/datasource/rest.mjs +7 -7
- package/source/components/datatable/datatable/header.mjs +13 -4
- package/source/components/datatable/datatable.mjs +1141 -1152
- package/source/components/datatable/filter.mjs +1101 -1088
- package/source/components/form/action-button.mjs +1 -1
- package/source/components/form/api-button.mjs +1 -1
- package/source/components/form/button-bar.mjs +1 -1
- package/source/components/form/button.mjs +1 -1
- package/source/components/form/context-error.mjs +1 -1
- package/source/components/form/field-set.mjs +1 -1
- package/source/components/form/popper-button.mjs +274 -274
- package/source/components/form/reload.mjs +1 -1
- package/source/components/form/toggle-switch.mjs +1 -1
- package/source/components/style/form.css +8 -0
- package/source/dom/customelement.mjs +936 -946
- package/source/dom/error.mjs +59 -66
- package/source/monster.mjs +1 -0
package/source/dom/error.mjs
CHANGED
@@ -12,11 +12,10 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
import {validateInstance, validateString} from "../types/validate.mjs";
|
16
|
-
import {ATTRIBUTE_ERRORMESSAGE} from "./constants.mjs";
|
15
|
+
import { validateInstance, validateString } from "../types/validate.mjs";
|
16
|
+
import { ATTRIBUTE_ERRORMESSAGE } from "./constants.mjs";
|
17
17
|
|
18
|
-
|
19
|
-
export {addErrorAttribute, removeErrorAttribute};
|
18
|
+
export { addErrorAttribute, removeErrorAttribute };
|
20
19
|
|
21
20
|
/**
|
22
21
|
* This method can be used to add an error message to an element.
|
@@ -29,48 +28,45 @@ export {addErrorAttribute, removeErrorAttribute};
|
|
29
28
|
* @return {HTMLElement}
|
30
29
|
*/
|
31
30
|
function addErrorAttribute(element, message) {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
);
|
72
|
-
|
73
|
-
return element;
|
31
|
+
validateInstance(element, HTMLElement);
|
32
|
+
|
33
|
+
if (message instanceof Error) {
|
34
|
+
message = message.message;
|
35
|
+
}
|
36
|
+
|
37
|
+
if (typeof message !== "string") {
|
38
|
+
if (typeof message === "object" && message !== null) {
|
39
|
+
if (typeof message.toString === "function") {
|
40
|
+
message = message.toString();
|
41
|
+
} else {
|
42
|
+
message = JSON.stringify(message);
|
43
|
+
}
|
44
|
+
} else {
|
45
|
+
message = String(message);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
validateString(message);
|
50
|
+
|
51
|
+
if (!element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
|
52
|
+
element.setAttribute(ATTRIBUTE_ERRORMESSAGE, message);
|
53
|
+
return element;
|
54
|
+
}
|
55
|
+
|
56
|
+
const current = element.getAttribute(ATTRIBUTE_ERRORMESSAGE);
|
57
|
+
const list = current.split("::");
|
58
|
+
|
59
|
+
for (let i = 0; i < list.length; i++) {
|
60
|
+
if (list[i] === message) {
|
61
|
+
return element;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
list.push(message);
|
66
|
+
|
67
|
+
element.setAttribute(ATTRIBUTE_ERRORMESSAGE, list.join("::"));
|
68
|
+
|
69
|
+
return element;
|
74
70
|
}
|
75
71
|
|
76
72
|
/**
|
@@ -84,23 +80,20 @@ function addErrorAttribute(element, message) {
|
|
84
80
|
* @return {HTMLElement}
|
85
81
|
*/
|
86
82
|
function removeErrorAttribute(element, message) {
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
return element;
|
106
|
-
}
|
83
|
+
validateInstance(element, HTMLElement);
|
84
|
+
validateString(message);
|
85
|
+
|
86
|
+
if (!element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
|
87
|
+
return element;
|
88
|
+
}
|
89
|
+
|
90
|
+
const current = element.getAttribute(ATTRIBUTE_ERRORMESSAGE);
|
91
|
+
const list = current.split("::");
|
92
|
+
const newList = list.filter(function (token) {
|
93
|
+
return token !== message;
|
94
|
+
});
|
95
|
+
|
96
|
+
element.setAttribute(ATTRIBUTE_ERRORMESSAGE, newList.join("::"));
|
97
|
+
|
98
|
+
return element;
|
99
|
+
}
|
package/source/monster.mjs
CHANGED
@@ -127,6 +127,7 @@ export * from "./constraints/isarray.mjs";
|
|
127
127
|
export * from "./constraints/abstract.mjs";
|
128
128
|
export * from "./constraints/valid.mjs";
|
129
129
|
export * from "./dom/dimension.mjs";
|
130
|
+
export * from "./dom/error.mjs";
|
130
131
|
export * from "./dom/resource/link/stylesheet.mjs";
|
131
132
|
export * from "./dom/resource/link.mjs";
|
132
133
|
export * from "./dom/resource/script.mjs";
|