@schukai/monster 4.57.0 → 4.58.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 +12 -0
- package/package.json +1 -1
- package/source/components/data/stylesheet/metric-graph.mjs +1 -1
- package/source/components/data/stylesheet/metric.mjs +1 -1
- package/source/components/datatable/datasource/rest.mjs +141 -14
- package/source/components/datatable/datatable.mjs +3 -7
- package/source/components/datatable/save-button.mjs +348 -334
- package/source/components/datatable/status.mjs +7 -0
- package/source/components/datatable/util.mjs +7 -0
- package/source/components/form/button-bar.mjs +193 -95
- package/source/components/form/field-set.mjs +283 -283
- package/source/components/form/form.mjs +407 -169
- package/source/components/form/login.mjs +1571 -1571
- package/source/components/form/quantity.mjs +233 -233
- package/source/components/form/select.mjs +3106 -3101
- package/source/components/form/style/field-set.pcss +6 -2
- package/source/components/form/style/form.pcss +8 -0
- package/source/components/form/stylesheet/field-set.mjs +1 -1
- package/source/components/form/stylesheet/form.mjs +1 -1
- package/source/components/form/stylesheet/select.mjs +13 -6
- package/source/components/style/typography.css +2 -2
- package/source/components/tree-menu/stylesheet/tree-menu.mjs +1 -1
- package/source/constraints/abstract.mjs +17 -17
- package/source/dom/customelement.mjs +962 -963
- package/source/dom/updater.mjs +874 -863
- package/source/dom/util/init-options-from-attributes.mjs +56 -56
- package/source/monster.mjs +0 -1
- package/source/net/webconnect.mjs +325 -325
- package/source/types/is.mjs +66 -66
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
|
|
15
15
|
import { Pathfinder } from "../../data/pathfinder.mjs";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
isBoolean,
|
|
18
|
+
isString,
|
|
19
|
+
isObject,
|
|
20
|
+
isNumber,
|
|
21
|
+
isArray,
|
|
22
|
+
isFunction,
|
|
23
|
+
isInteger,
|
|
24
24
|
} from "../../types/is.mjs";
|
|
25
25
|
import { extractKeys } from "./extract-keys.mjs";
|
|
26
26
|
|
|
@@ -59,62 +59,62 @@ export { initOptionsFromAttributes };
|
|
|
59
59
|
* @this HTMLElement - The context of the DOM element.
|
|
60
60
|
*/
|
|
61
61
|
function initOptionsFromAttributes(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
element,
|
|
63
|
+
options,
|
|
64
|
+
mapping = {},
|
|
65
|
+
prefix = "data-monster-option-",
|
|
66
66
|
) {
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
if (!(element instanceof HTMLElement)) return options;
|
|
68
|
+
if (!element.hasAttributes()) return options;
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const keyMap = extractKeys(options);
|
|
71
|
+
const finder = new Pathfinder(options);
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
element.getAttributeNames().forEach((name) => {
|
|
74
|
+
if (!name.startsWith(prefix)) return;
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
// check if the attribute name is a valid option.
|
|
77
|
+
// the mapping between the attribute is simple. The dash is replaced by a dot.
|
|
78
|
+
// e.g. data-monster-url => url
|
|
79
|
+
const optionName = keyMap.get(name.substring(prefix.length).toLowerCase());
|
|
80
|
+
if (!finder.exists(optionName)) return;
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
if (element.hasAttribute(name)) {
|
|
83
|
+
let value = element.getAttribute(name);
|
|
84
|
+
if (
|
|
85
|
+
mapping.hasOwnProperty(optionName) &&
|
|
86
|
+
isFunction(mapping[optionName])
|
|
87
|
+
) {
|
|
88
|
+
value = mapping[optionName](value);
|
|
89
|
+
}
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
let optionValue = finder.getVia(optionName);
|
|
92
|
+
if (optionValue === null || optionValue === undefined) {
|
|
93
|
+
optionValue = value;
|
|
94
|
+
}
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
96
|
+
//const typeOfOptionValue = typeof optionValue;
|
|
97
|
+
if (optionValue === null || optionValue === undefined) {
|
|
98
|
+
value = null;
|
|
99
|
+
} else if (isBoolean(optionValue)) {
|
|
100
|
+
value = value === "true";
|
|
101
|
+
} else if (isInteger(optionValue)) {
|
|
102
|
+
value = Number(value);
|
|
103
|
+
} else if (isNumber(optionValue)) {
|
|
104
|
+
value = Number(value);
|
|
105
|
+
} else if (isString(optionValue)) {
|
|
106
|
+
value = String(value);
|
|
107
|
+
} else if (isObject(optionValue)) {
|
|
108
|
+
value = JSON.parse(value);
|
|
109
|
+
} else if (isArray(optionValue)) {
|
|
110
|
+
value = value.split("::");
|
|
111
|
+
} else {
|
|
112
|
+
value = optionValue;
|
|
113
|
+
}
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
finder.setVia(optionName, value);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
return options;
|
|
120
120
|
}
|
package/source/monster.mjs
CHANGED
|
@@ -112,7 +112,6 @@ export * from "./components/accessibility/locale-picker.mjs";
|
|
|
112
112
|
export * from "./components/state/log/entry.mjs";
|
|
113
113
|
export * from "./components/state/state.mjs";
|
|
114
114
|
export * from "./components/state/log.mjs";
|
|
115
|
-
export * from "./components/navigation/wizard-navigation.mjs";
|
|
116
115
|
export * from "./components/navigation/table-of-content.mjs";
|
|
117
116
|
export * from "./components/navigation/site-navigation.mjs";
|
|
118
117
|
export * from "./components/data/metric-graph.mjs";
|