@schukai/monster 3.65.21 → 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 +22 -4
- package/package.json +1 -1
- package/source/components/datatable/change-button.mjs +5 -6
- package/source/components/datatable/dataset.mjs +202 -202
- package/source/components/datatable/datasource/dom.mjs +1 -1
- package/source/components/datatable/datatable.mjs +10 -6
- package/source/components/datatable/filter.mjs +4 -4
- package/source/components/datatable/pagination.mjs +4 -4
- package/source/components/datatable/save-button.mjs +4 -5
- package/source/components/datatable/status.mjs +4 -5
- 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 +85 -85
- package/source/dom/resource/data.mjs +122 -122
- package/source/dom/template.mjs +113 -113
package/CHANGELOG.md
CHANGED
|
@@ -2,20 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
## [3.66.0] - 2024-06-21
|
|
6
|
+
|
|
7
|
+
### Add Features
|
|
8
|
+
|
|
9
|
+
- new flag feature.useStrictValueComparison [#206](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/206)
|
|
10
|
+
- new flag features.storeFetchedData and function Select::getLastFetchedData [#204](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/204)
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
- [#200](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/200)
|
|
14
|
+
- [#200](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/200) changes
|
|
15
|
+
- [#201](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/201)
|
|
16
|
+
- slight color adjustments
|
|
17
|
+
### Changes
|
|
18
|
+
|
|
19
|
+
- tidy project files
|
|
20
|
+
- [#200](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/200) move to close
|
|
21
|
+
- [#200](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/200) move to close
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
5
25
|
## [3.65.21] - 2024-06-20
|
|
6
26
|
|
|
7
27
|
### Bug Fixes
|
|
8
28
|
|
|
9
|
-
- exchange of document.selector with function findElementWithSelectorUpwards [#199](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/199)
|
|
29
|
+
- exchange of `document.selector` with function findElementWithSelectorUpwards [#199](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/199)
|
|
10
30
|
|
|
11
31
|
## [3.65.20] - 2024-06-20
|
|
12
32
|
|
|
13
|
-
- Changeover to new release process
|
|
33
|
+
- Changeover to a new release process
|
|
14
34
|
|
|
15
35
|
## [3.65.3] - 2024-06-19
|
|
16
36
|
|
|
17
|
-
### Bug Fixes
|
|
18
|
-
|
|
19
37
|
- switch nodejs_22 to nodejs_20 (segmentation fault)
|
|
20
38
|
|
|
21
39
|
## [3.65.1] - 2024-06-17
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.5","@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":"3.
|
|
1
|
+
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.5","@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":"3.66.0"}
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
CustomElement,
|
|
21
21
|
registerCustomElement,
|
|
22
22
|
} from "../../dom/customelement.mjs";
|
|
23
|
-
import {findElementWithSelectorUpwards} from "../../dom/util.mjs";
|
|
23
|
+
import { findElementWithSelectorUpwards } from "../../dom/util.mjs";
|
|
24
24
|
import { isString } from "../../types/is.mjs";
|
|
25
25
|
import { State } from "../form/types/state.mjs";
|
|
26
26
|
import "../form/state-button.mjs";
|
|
@@ -190,9 +190,8 @@ function initControlReferences() {
|
|
|
190
190
|
const selector = this.getOption("dataset.selector");
|
|
191
191
|
|
|
192
192
|
if (isString(selector)) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (element===null) {
|
|
193
|
+
const element = findElementWithSelectorUpwards(this, selector);
|
|
194
|
+
if (element === null) {
|
|
196
195
|
throw new Error("the selector must match exactly one element");
|
|
197
196
|
}
|
|
198
197
|
|
|
@@ -206,8 +205,8 @@ function initControlReferences() {
|
|
|
206
205
|
const selector2 = this.getOption("overlay.selector");
|
|
207
206
|
|
|
208
207
|
if (isString(selector2)) {
|
|
209
|
-
const element = findElementWithSelectorUpwards(
|
|
210
|
-
if (element===null) {
|
|
208
|
+
const element = findElementWithSelectorUpwards(this, selector);
|
|
209
|
+
if (element === null) {
|
|
211
210
|
throw new Error("the selector must match exactly one element");
|
|
212
211
|
}
|
|
213
212
|
|
|
@@ -12,33 +12,33 @@
|
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {instanceSymbol, internalSymbol} from "../../constants.mjs";
|
|
16
|
-
import {Pathfinder} from "../../data/pathfinder.mjs";
|
|
17
|
-
import {getLinkedObjects, hasObjectLink} from "../../dom/attributes.mjs";
|
|
18
|
-
import {customElementUpdaterLinkSymbol} from "../../dom/constants.mjs";
|
|
15
|
+
import { instanceSymbol, internalSymbol } from "../../constants.mjs";
|
|
16
|
+
import { Pathfinder } from "../../data/pathfinder.mjs";
|
|
17
|
+
import { getLinkedObjects, hasObjectLink } from "../../dom/attributes.mjs";
|
|
18
|
+
import { customElementUpdaterLinkSymbol } from "../../dom/constants.mjs";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
assembleMethodSymbol,
|
|
21
|
+
CustomElement,
|
|
22
|
+
attributeObserverSymbol,
|
|
23
|
+
registerCustomElement,
|
|
24
24
|
} from "../../dom/customelement.mjs";
|
|
25
|
-
import {findElementWithSelectorUpwards} from "../../dom/util.mjs";
|
|
26
|
-
import {isString} from "../../types/is.mjs";
|
|
27
|
-
import {Observer} from "../../types/observer.mjs";
|
|
28
|
-
import {clone} from "../../util/clone.mjs";
|
|
25
|
+
import { findElementWithSelectorUpwards } from "../../dom/util.mjs";
|
|
26
|
+
import { isString } from "../../types/is.mjs";
|
|
27
|
+
import { Observer } from "../../types/observer.mjs";
|
|
28
|
+
import { clone } from "../../util/clone.mjs";
|
|
29
29
|
import {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
ATTRIBUTE_DATASOURCE_SELECTOR,
|
|
31
|
+
ATTRIBUTE_DATATABLE_INDEX,
|
|
32
32
|
} from "./constants.mjs";
|
|
33
|
-
import {Datasource} from "./datasource.mjs";
|
|
34
|
-
import {DatasetStyleSheet} from "./stylesheet/dataset.mjs";
|
|
33
|
+
import { Datasource } from "./datasource.mjs";
|
|
34
|
+
import { DatasetStyleSheet } from "./stylesheet/dataset.mjs";
|
|
35
35
|
import {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
handleDataSourceChanges,
|
|
37
|
+
datasourceLinkedElementSymbol,
|
|
38
38
|
} from "./util.mjs";
|
|
39
|
-
import {FormStyleSheet} from "../stylesheet/form.mjs";
|
|
39
|
+
import { FormStyleSheet } from "../stylesheet/form.mjs";
|
|
40
40
|
|
|
41
|
-
export {DataSet};
|
|
41
|
+
export { DataSet };
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* The data set component is used to show the data of a data source.
|
|
@@ -79,184 +79,184 @@ export {DataSet};
|
|
|
79
79
|
* @summary A data set
|
|
80
80
|
*/
|
|
81
81
|
class DataSet extends CustomElement {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
82
|
+
/**
|
|
83
|
+
* This method is called by the `instanceof` operator.
|
|
84
|
+
* @returns {symbol}
|
|
85
|
+
*/
|
|
86
|
+
static get [instanceSymbol]() {
|
|
87
|
+
return Symbol.for("@schukai/monster/components/dataset@@instance");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* This method determines which attributes are to be monitored by `attributeChangedCallback()`.
|
|
92
|
+
*
|
|
93
|
+
* @return {string[]}
|
|
94
|
+
* @since 1.15.0
|
|
95
|
+
*/
|
|
96
|
+
static get observedAttributes() {
|
|
97
|
+
const attributes = super.observedAttributes;
|
|
98
|
+
attributes.push(ATTRIBUTE_DATATABLE_INDEX);
|
|
99
|
+
return attributes;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* To set the options via the html tag the attribute `data-monster-options` must be used.
|
|
104
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
|
105
|
+
*
|
|
106
|
+
* The individual configuration values can be found in the table.
|
|
107
|
+
*
|
|
108
|
+
* @property {Object} templates Template definitions
|
|
109
|
+
* @property {string} templates.main Main template
|
|
110
|
+
* @property {object} datasource The datasource
|
|
111
|
+
* @property {string} datasource.selector The selector of the datasource
|
|
112
|
+
* @property {object} mapping The mapping
|
|
113
|
+
* @property {string} mapping.data The data
|
|
114
|
+
* @property {number} mapping.index The index
|
|
115
|
+
* @property {Array} data The data
|
|
116
|
+
*/
|
|
117
|
+
get defaults() {
|
|
118
|
+
const obj = Object.assign({}, super.defaults, {
|
|
119
|
+
templates: {
|
|
120
|
+
main: getTemplate(),
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
datasource: {
|
|
124
|
+
selector: null,
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
mapping: {
|
|
128
|
+
data: "dataset",
|
|
129
|
+
index: 0,
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
data: {},
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
updateOptionsFromArguments.call(this, obj);
|
|
136
|
+
return obj;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @return {string}
|
|
142
|
+
*/
|
|
143
|
+
static getTag() {
|
|
144
|
+
return "monster-dataset";
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
write() {
|
|
148
|
+
return new Promise((resolve, reject) => {
|
|
149
|
+
if (!this[datasourceLinkedElementSymbol]) {
|
|
150
|
+
reject(new Error("No datasource"));
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const internalUpdateCloneData = this.getInternalUpdateCloneData();
|
|
155
|
+
if (!internalUpdateCloneData) {
|
|
156
|
+
reject(new Error("No update data"));
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const internalData = internalUpdateCloneData?.["data"];
|
|
161
|
+
if (
|
|
162
|
+
internalData === undefined ||
|
|
163
|
+
internalData === null ||
|
|
164
|
+
internalData === ""
|
|
165
|
+
) {
|
|
166
|
+
reject(new Error("No data"));
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
setTimeout(() => {
|
|
171
|
+
const path = this.getOption("mapping.data");
|
|
172
|
+
const index = this.getOption("mapping.index");
|
|
173
|
+
|
|
174
|
+
let pathWithIndex;
|
|
175
|
+
|
|
176
|
+
if (isString(path) && path !== "") {
|
|
177
|
+
pathWithIndex = path + "." + index;
|
|
178
|
+
} else {
|
|
179
|
+
pathWithIndex = index;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const data = this[datasourceLinkedElementSymbol].data;
|
|
183
|
+
const unref = JSON.stringify(data);
|
|
184
|
+
const ref = JSON.parse(unref);
|
|
185
|
+
|
|
186
|
+
new Pathfinder(ref).setVia(pathWithIndex, internalData);
|
|
187
|
+
|
|
188
|
+
this[datasourceLinkedElementSymbol].data = ref;
|
|
189
|
+
|
|
190
|
+
resolve();
|
|
191
|
+
}, 0);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* This method is responsible for assembling the component.
|
|
197
|
+
*
|
|
198
|
+
* It calls the parent's assemble method first, then initializes control references and event handlers.
|
|
199
|
+
* If the `datasource.selector` option is provided and is a string, it searches for the corresponding
|
|
200
|
+
* element in the DOM using that selector.
|
|
201
|
+
*
|
|
202
|
+
* If the selector matches exactly one element, it checks if the element is an instance of the `Datasource` class.
|
|
203
|
+
*
|
|
204
|
+
* If it is, the component's `datasourceLinkedElementSymbol` property is set to the element, and the component
|
|
205
|
+
* attaches an observer to the datasource's changes.
|
|
206
|
+
*
|
|
207
|
+
* The observer is a function that calls the `handleDataSourceChanges` method in the context of the component.
|
|
208
|
+
* Additionally, the component attaches an observer to itself, which also calls the `handleDataSourceChanges`
|
|
209
|
+
* method in the component's context.
|
|
210
|
+
*/
|
|
211
|
+
[assembleMethodSymbol]() {
|
|
212
|
+
super[assembleMethodSymbol]();
|
|
213
|
+
|
|
214
|
+
// initControlReferences.call(self);
|
|
215
|
+
initEventHandler.call(this);
|
|
216
|
+
|
|
217
|
+
const selector = this.getOption("datasource.selector");
|
|
218
|
+
|
|
219
|
+
if (isString(selector)) {
|
|
220
|
+
const element = findElementWithSelectorUpwards(this, selector);
|
|
221
|
+
if (element === null) {
|
|
222
|
+
throw new Error("the selector must match exactly one element");
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (!(element instanceof Datasource)) {
|
|
226
|
+
throw new TypeError("the element must be a datasource");
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
this[datasourceLinkedElementSymbol] = element;
|
|
230
|
+
element.datasource.attachObserver(
|
|
231
|
+
new Observer(handleDataSourceChanges.bind(this)),
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
this.attachObserver(
|
|
236
|
+
new Observer(() => {
|
|
237
|
+
handleDataSourceChanges.call(this);
|
|
238
|
+
}),
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @return [CSSStyleSheet]
|
|
244
|
+
*/
|
|
245
|
+
static getCSSStyleSheet() {
|
|
246
|
+
return [FormStyleSheet, DatasetStyleSheet];
|
|
247
|
+
}
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
/**
|
|
251
251
|
* @private
|
|
252
252
|
*/
|
|
253
253
|
function initEventHandler() {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
254
|
+
this[attributeObserverSymbol][ATTRIBUTE_DATATABLE_INDEX] = () => {
|
|
255
|
+
const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX);
|
|
256
|
+
if (index) {
|
|
257
|
+
this.setOption("mapping.index", parseInt(index, 10));
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
/**
|
|
@@ -264,17 +264,17 @@ function initEventHandler() {
|
|
|
264
264
|
* @param {Object} options
|
|
265
265
|
*/
|
|
266
266
|
function updateOptionsFromArguments(options) {
|
|
267
|
-
|
|
267
|
+
const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX);
|
|
268
268
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
if (index !== null && index !== undefined) {
|
|
270
|
+
options.mapping.index = parseInt(index, 10);
|
|
271
|
+
}
|
|
272
272
|
|
|
273
|
-
|
|
273
|
+
const selector = this.getAttribute(ATTRIBUTE_DATASOURCE_SELECTOR);
|
|
274
274
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
if (selector) {
|
|
276
|
+
options.datasource.selector = selector;
|
|
277
|
+
}
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
/**
|
|
@@ -282,8 +282,8 @@ function updateOptionsFromArguments(options) {
|
|
|
282
282
|
* @return {string}
|
|
283
283
|
*/
|
|
284
284
|
function getTemplate() {
|
|
285
|
-
|
|
286
|
-
|
|
285
|
+
// language=HTML
|
|
286
|
+
return `
|
|
287
287
|
<div data-monster-role="control" part="control">
|
|
288
288
|
<slot></slot>
|
|
289
289
|
</div>
|
|
@@ -65,7 +65,11 @@ import {
|
|
|
65
65
|
} from "./util.mjs";
|
|
66
66
|
import "./columnbar.mjs";
|
|
67
67
|
import "./filter-button.mjs";
|
|
68
|
-
import {
|
|
68
|
+
import {
|
|
69
|
+
findElementWithSelectorUpwards,
|
|
70
|
+
getDocument,
|
|
71
|
+
getWindow,
|
|
72
|
+
} from "../../dom/util.mjs";
|
|
69
73
|
import { addAttributeToken } from "../../dom/attributes.mjs";
|
|
70
74
|
import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";
|
|
71
75
|
import { getDocumentTranslations } from "../../i18n/translations.mjs";
|
|
@@ -275,8 +279,8 @@ class DataTable extends CustomElement {
|
|
|
275
279
|
const selector = this.getOption("datasource.selector");
|
|
276
280
|
|
|
277
281
|
if (isString(selector)) {
|
|
278
|
-
const element = findElementWithSelectorUpwards(
|
|
279
|
-
if (element===null) {
|
|
282
|
+
const element = findElementWithSelectorUpwards(this, selector);
|
|
283
|
+
if (element === null) {
|
|
280
284
|
throw new Error("the selector must match exactly one element");
|
|
281
285
|
}
|
|
282
286
|
|
|
@@ -511,7 +515,7 @@ function getFilterConfigKey() {
|
|
|
511
515
|
* @returns {Promise}
|
|
512
516
|
*/
|
|
513
517
|
function getHostConfig(callback) {
|
|
514
|
-
const host = findElementWithSelectorUpwards(
|
|
518
|
+
const host = findElementWithSelectorUpwards(this, "monster-host");
|
|
515
519
|
|
|
516
520
|
if (!(host && this.id)) {
|
|
517
521
|
return Promise.resolve({});
|
|
@@ -607,7 +611,7 @@ function updateConfigColumnBar() {
|
|
|
607
611
|
map[option.name] = option.visible;
|
|
608
612
|
}
|
|
609
613
|
|
|
610
|
-
const host = findElementWithSelectorUpwards(
|
|
614
|
+
const host = findElementWithSelectorUpwards(this, "monster-host");
|
|
611
615
|
if (!(host && this.id)) {
|
|
612
616
|
return;
|
|
613
617
|
}
|
|
@@ -814,7 +818,7 @@ function storeOrderStatement(doFetch) {
|
|
|
814
818
|
const statement = createOrderStatement(headers);
|
|
815
819
|
setDataSource.call(this, { orderBy: statement }, doFetch);
|
|
816
820
|
|
|
817
|
-
const host = findElementWithSelectorUpwards(
|
|
821
|
+
const host = findElementWithSelectorUpwards(this, "monster-host");
|
|
818
822
|
if (!(host && this.id)) {
|
|
819
823
|
return;
|
|
820
824
|
}
|
|
@@ -726,7 +726,7 @@ function initTabEvents() {
|
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
728
|
|
|
729
|
-
const host = findElementWithSelectorUpwards(
|
|
729
|
+
const host = findElementWithSelectorUpwards(this, "monster-host");
|
|
730
730
|
if (!(host && this.id)) {
|
|
731
731
|
return;
|
|
732
732
|
}
|
|
@@ -767,7 +767,7 @@ function updateFilterTabs() {
|
|
|
767
767
|
return;
|
|
768
768
|
}
|
|
769
769
|
|
|
770
|
-
const host = findElementWithSelectorUpwards(
|
|
770
|
+
const host = findElementWithSelectorUpwards(this, "monster-host");
|
|
771
771
|
if (!(host && this.id)) {
|
|
772
772
|
return;
|
|
773
773
|
}
|
|
@@ -1065,7 +1065,7 @@ function getControlValuesFromLabel(label) {
|
|
|
1065
1065
|
* @returns {Promise<unknown>}
|
|
1066
1066
|
*/
|
|
1067
1067
|
function initFromConfig() {
|
|
1068
|
-
const host = findElementWithSelectorUpwards(
|
|
1068
|
+
const host = findElementWithSelectorUpwards(this, "monster-host");
|
|
1069
1069
|
|
|
1070
1070
|
if (!(isInstance(host, Host) && this.id)) {
|
|
1071
1071
|
return Promise.resolve();
|
|
@@ -1108,7 +1108,7 @@ function initFromConfig() {
|
|
|
1108
1108
|
* @private
|
|
1109
1109
|
*/
|
|
1110
1110
|
function updateConfig() {
|
|
1111
|
-
const host = findElementWithSelectorUpwards(
|
|
1111
|
+
const host = findElementWithSelectorUpwards(this, "monster-host");
|
|
1112
1112
|
if (!(host && this.id)) {
|
|
1113
1113
|
return;
|
|
1114
1114
|
}
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
CustomElement,
|
|
18
18
|
registerCustomElement,
|
|
19
19
|
} from "../../dom/customelement.mjs";
|
|
20
|
-
import {findElementWithSelectorUpwards} from "../../dom/util.mjs";
|
|
20
|
+
import { findElementWithSelectorUpwards } from "../../dom/util.mjs";
|
|
21
21
|
import { ThemeStyleSheet } from "../stylesheet/theme.mjs";
|
|
22
22
|
import { ATTRIBUTE_DATASOURCE_SELECTOR } from "./constants.mjs";
|
|
23
23
|
import { Datasource } from "./datasource.mjs";
|
|
@@ -189,11 +189,11 @@ class Pagination extends CustomElement {
|
|
|
189
189
|
const selector = this.getOption("datasource.selector", "");
|
|
190
190
|
|
|
191
191
|
if (isString(selector)) {
|
|
192
|
-
const element = findElementWithSelectorUpwards(
|
|
193
|
-
if (element===null) {
|
|
192
|
+
const element = findElementWithSelectorUpwards(this, selector);
|
|
193
|
+
if (element === null) {
|
|
194
194
|
throw new Error("the selector must match exactly one element");
|
|
195
195
|
}
|
|
196
|
-
|
|
196
|
+
|
|
197
197
|
if (!(element instanceof Datasource)) {
|
|
198
198
|
throw new TypeError("the element must be a datasource");
|
|
199
199
|
}
|