@schukai/monster 3.65.20 → 3.66.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 +17 -33
- package/package.json +1 -1
- package/source/components/datatable/change-button.mjs +5 -6
- package/source/components/datatable/dataset.mjs +3 -3
- package/source/components/datatable/datasource/dom.mjs +1 -1
- package/source/components/datatable/datatable.mjs +10 -9
- package/source/components/datatable/filter.mjs +4 -8
- package/source/components/datatable/pagination.mjs +3 -3
- package/source/components/datatable/save-button.mjs +3 -3
- package/source/components/datatable/status.mjs +3 -3
- package/source/components/datatable/stylesheet/embedded-pagination.mjs +2 -4
- package/source/components/form/select.mjs +132 -82
- package/source/components/form/style/select.pcss +1 -1
- package/source/components/form/stylesheet/select.mjs +2 -4
- package/source/components/host/call-button.mjs +5 -4
- package/source/components/layout/stylesheet/collapse.mjs +2 -4
- package/source/components/notify/message.mjs +6 -3
- package/source/components/style/mixin/property.pcss +8 -8
- package/source/components/stylesheet/link.mjs +1 -3
- package/source/components/stylesheet/mixin/property.mjs +1 -3
- package/source/data/datasource/dom.mjs +6 -5
- package/source/dom/resource/data.mjs +3 -0
- package/source/dom/resource.mjs +0 -1
- package/source/dom/template.mjs +113 -113
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright © schukai GmbH and all contributing authors,
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, 2024. All rights reserved.
|
|
3
3
|
* Node module: @schukai/monster
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
9
|
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
10
|
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
11
|
-
*
|
|
12
|
-
* SPDX-License-Identifier: AGPL-3.0
|
|
13
11
|
*/
|
|
14
12
|
|
|
15
13
|
import { addAttributeToken } from "../../dom/attributes.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright © schukai GmbH and all contributing authors,
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, 2024. All rights reserved.
|
|
3
3
|
* Node module: @schukai/monster
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
9
|
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
10
|
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
11
|
-
*
|
|
12
|
-
* SPDX-License-Identifier: AGPL-3.0
|
|
13
11
|
*/
|
|
14
12
|
|
|
15
13
|
import { addAttributeToken } from "../../../dom/attributes.mjs";
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { instanceSymbol } from "../../constants.mjs";
|
|
16
|
+
import { findElementWithSelectorUpwards } from "../../dom/util.mjs";
|
|
16
17
|
import { isObject } from "../../types/is.mjs";
|
|
17
18
|
import { Datasource } from "../datasource.mjs";
|
|
18
19
|
|
|
@@ -74,9 +75,9 @@ class DomStorage extends Datasource {
|
|
|
74
75
|
throw new Error("The read selector is not defined");
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
const storage =
|
|
78
|
+
const storage = findElementWithSelectorUpwards(this, selector);
|
|
78
79
|
if (!storage) {
|
|
79
|
-
throw new Error("There
|
|
80
|
+
throw new Error("There is no storage element");
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
return new Promise((resolve, reject) => {
|
|
@@ -98,12 +99,12 @@ class DomStorage extends Datasource {
|
|
|
98
99
|
write() {
|
|
99
100
|
const selector = this.getOption("write.selector");
|
|
100
101
|
if (!selector) {
|
|
101
|
-
throw new Error("The write
|
|
102
|
+
throw new Error("The option write.selector is not defined");
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
const storage =
|
|
105
|
+
const storage = findElementWithSelectorUpwards(this, selector);
|
|
105
106
|
if (!storage) {
|
|
106
|
-
throw new Error("There
|
|
107
|
+
throw new Error("There is no storage element");
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
return new Promise((resolve, reject) => {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import { internalStateSymbol } from "../../constants.mjs";
|
|
16
16
|
import { extend } from "../../data/extend.mjs";
|
|
17
17
|
import { getGlobalFunction } from "../../types/global.mjs";
|
|
18
|
+
import { addAttributeToken } from "../attributes.mjs";
|
|
18
19
|
import {
|
|
19
20
|
ATTRIBUTE_CLASS,
|
|
20
21
|
ATTRIBUTE_ERRORMESSAGE,
|
|
@@ -31,6 +32,7 @@ import {
|
|
|
31
32
|
Resource,
|
|
32
33
|
} from "../resource.mjs";
|
|
33
34
|
import { instanceSymbol } from "../../constants.mjs";
|
|
35
|
+
|
|
34
36
|
export { Data };
|
|
35
37
|
|
|
36
38
|
/**
|
|
@@ -72,6 +74,7 @@ class Data extends Resource {
|
|
|
72
74
|
* @return {Monster.DOM.Resource}
|
|
73
75
|
*/
|
|
74
76
|
connect() {
|
|
77
|
+
const self = this;
|
|
75
78
|
if (!(this[referenceSymbol] instanceof HTMLElement)) {
|
|
76
79
|
this.create();
|
|
77
80
|
}
|
package/source/dom/resource.mjs
CHANGED
|
@@ -242,7 +242,6 @@ function addEvents() {
|
|
|
242
242
|
this[referenceSymbol].removeEventListener("error", onError);
|
|
243
243
|
this[referenceSymbol].removeEventListener("load", onLoad);
|
|
244
244
|
this[internalStateSymbol].getSubject()["loaded"] = true;
|
|
245
|
-
return;
|
|
246
245
|
};
|
|
247
246
|
|
|
248
247
|
this[referenceSymbol].addEventListener("load", onLoad, false);
|
package/source/dom/template.mjs
CHANGED
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {Base} from "../types/base.mjs";
|
|
16
|
-
import {getGlobalFunction, getGlobalObject} from "../types/global.mjs";
|
|
17
|
-
import {validateInstance, validateString} from "../types/validate.mjs";
|
|
18
|
-
import {ATTRIBUTE_TEMPLATE_PREFIX} from "./constants.mjs";
|
|
19
|
-
import {getDocumentTheme} from "./theme.mjs";
|
|
20
|
-
import {instanceSymbol} from "../constants.mjs";
|
|
21
|
-
import {findElementWithIdUpwards} from "./util.mjs";
|
|
15
|
+
import { Base } from "../types/base.mjs";
|
|
16
|
+
import { getGlobalFunction, getGlobalObject } from "../types/global.mjs";
|
|
17
|
+
import { validateInstance, validateString } from "../types/validate.mjs";
|
|
18
|
+
import { ATTRIBUTE_TEMPLATE_PREFIX } from "./constants.mjs";
|
|
19
|
+
import { getDocumentTheme } from "./theme.mjs";
|
|
20
|
+
import { instanceSymbol } from "../constants.mjs";
|
|
21
|
+
import { findElementWithIdUpwards } from "./util.mjs";
|
|
22
22
|
|
|
23
|
-
export {Template};
|
|
23
|
+
export { Template };
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* The template class provides methods for creating templates.
|
|
@@ -32,45 +32,45 @@ export {Template};
|
|
|
32
32
|
* @summary A template class
|
|
33
33
|
*/
|
|
34
34
|
class Template extends Base {
|
|
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
|
-
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param {HTMLTemplateElement} template
|
|
38
|
+
* @throws {TypeError} value is not an instance of
|
|
39
|
+
* @throws {TypeError} value is not a function
|
|
40
|
+
* @throws {Error} the function is not defined
|
|
41
|
+
*/
|
|
42
|
+
constructor(template) {
|
|
43
|
+
super();
|
|
44
|
+
const HTMLTemplateElement = getGlobalFunction("HTMLTemplateElement");
|
|
45
|
+
validateInstance(template, HTMLTemplateElement);
|
|
46
|
+
this.template = template;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* This method is called by the `instanceof` operator.
|
|
51
|
+
* @returns {symbol}
|
|
52
|
+
* @since 2.1.0
|
|
53
|
+
*/
|
|
54
|
+
static get [instanceSymbol]() {
|
|
55
|
+
return Symbol.for("@schukai/monster/dom/resource/template");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @returns {HTMLTemplateElement}
|
|
61
|
+
*/
|
|
62
|
+
getTemplateElement() {
|
|
63
|
+
return this.template;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @return {DocumentFragment}
|
|
69
|
+
* @throws {TypeError} value is not an instance of
|
|
70
|
+
*/
|
|
71
|
+
createDocumentFragment() {
|
|
72
|
+
return this.template.content.cloneNode(true);
|
|
73
|
+
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -137,70 +137,70 @@ class Template extends Base {
|
|
|
137
137
|
* @throws {TypeError} value is not a string
|
|
138
138
|
*/
|
|
139
139
|
export function findDocumentTemplate(id, currentNode) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
140
|
+
validateString(id);
|
|
141
|
+
|
|
142
|
+
const document = getGlobalObject("document");
|
|
143
|
+
const HTMLTemplateElement = getGlobalFunction("HTMLTemplateElement");
|
|
144
|
+
const DocumentFragment = getGlobalFunction("DocumentFragment");
|
|
145
|
+
const Document = getGlobalFunction("Document");
|
|
146
|
+
|
|
147
|
+
let prefixID;
|
|
148
|
+
|
|
149
|
+
if (
|
|
150
|
+
!(
|
|
151
|
+
currentNode instanceof Document || currentNode instanceof DocumentFragment
|
|
152
|
+
)
|
|
153
|
+
) {
|
|
154
|
+
if (currentNode instanceof Node) {
|
|
155
|
+
if (currentNode.hasAttribute(ATTRIBUTE_TEMPLATE_PREFIX)) {
|
|
156
|
+
prefixID = currentNode.getAttribute(ATTRIBUTE_TEMPLATE_PREFIX);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
currentNode = currentNode.getRootNode();
|
|
160
|
+
|
|
161
|
+
if (
|
|
162
|
+
!(
|
|
163
|
+
currentNode instanceof Document ||
|
|
164
|
+
currentNode instanceof DocumentFragment
|
|
165
|
+
)
|
|
166
|
+
) {
|
|
167
|
+
currentNode = currentNode.ownerDocument;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (
|
|
172
|
+
!(
|
|
173
|
+
currentNode instanceof Document ||
|
|
174
|
+
currentNode instanceof DocumentFragment
|
|
175
|
+
)
|
|
176
|
+
) {
|
|
177
|
+
currentNode = document;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
let template;
|
|
182
|
+
const theme = getDocumentTheme();
|
|
183
|
+
|
|
184
|
+
if (prefixID) {
|
|
185
|
+
const themedPrefixID = `${prefixID}-${id}-${theme.getName()}`;
|
|
186
|
+
|
|
187
|
+
template = findElementWithIdUpwards(currentNode, themedPrefixID);
|
|
188
|
+
if (template instanceof HTMLTemplateElement) {
|
|
189
|
+
return new Template(template);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const themedID = `${id}-${theme.getName()}`;
|
|
194
|
+
|
|
195
|
+
template = findElementWithIdUpwards(currentNode, themedID);
|
|
196
|
+
if (template instanceof HTMLTemplateElement) {
|
|
197
|
+
return new Template(template);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
template = findElementWithIdUpwards(currentNode, id);
|
|
201
|
+
if (template instanceof HTMLTemplateElement) {
|
|
202
|
+
return new Template(template);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
throw new Error(`template ${id} not found.`);
|
|
206
206
|
}
|