@schukai/monster 3.55.0 → 3.55.1
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/datasource/rest.mjs +313 -326
- package/source/components/datatable/datatable/header.mjs +1 -1
- package/source/components/datatable/datatable.mjs +586 -591
- package/source/components/datatable/embedded-pagination.mjs +42 -49
- package/source/components/datatable/filter/util.mjs +115 -99
- package/source/components/datatable/filter.mjs +901 -842
- package/source/components/datatable/pagination.mjs +333 -334
- package/source/components/datatable/status.mjs +134 -156
- package/source/components/datatable/stylesheet/column-bar.mjs +14 -8
- package/source/components/datatable/stylesheet/dataset.mjs +14 -8
- package/source/components/datatable/stylesheet/datasource.mjs +14 -8
- package/source/components/datatable/stylesheet/datatable.mjs +14 -8
- package/source/components/datatable/stylesheet/embedded-pagination.mjs +14 -8
- package/source/components/datatable/stylesheet/filter-button.mjs +14 -8
- package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +14 -8
- package/source/components/datatable/stylesheet/filter-date-range.mjs +14 -8
- package/source/components/datatable/stylesheet/filter-range.mjs +14 -8
- package/source/components/datatable/stylesheet/filter.mjs +14 -8
- package/source/components/datatable/stylesheet/pagination.mjs +14 -8
- package/source/components/datatable/stylesheet/select-filter.mjs +14 -8
- package/source/components/datatable/stylesheet/status.mjs +14 -8
- package/source/components/form/action-button.mjs +3 -1
- package/source/components/form/confirm-button.mjs +3 -1
- package/source/components/form/context-error.mjs +161 -164
- package/source/components/form/context-help.mjs +3 -1
- package/source/components/form/form.mjs +3 -1
- package/source/components/form/message-state-button.mjs +3 -1
- package/source/components/form/popper-button.mjs +6 -4
- package/source/components/form/popper.mjs +310 -310
- package/source/components/form/select.mjs +2 -2
- package/source/components/form/state-button.mjs +3 -1
- package/source/components/form/stylesheet/action-button.mjs +14 -8
- package/source/components/form/stylesheet/api-button.mjs +14 -8
- package/source/components/form/stylesheet/button-bar.mjs +14 -8
- package/source/components/form/stylesheet/button.mjs +14 -8
- package/source/components/form/stylesheet/confirm-button.mjs +14 -8
- package/source/components/form/stylesheet/context-error.mjs +14 -8
- package/source/components/form/stylesheet/context-help.mjs +14 -8
- package/source/components/form/stylesheet/form.mjs +14 -8
- package/source/components/form/stylesheet/message-state-button.mjs +14 -8
- package/source/components/form/stylesheet/popper-button.mjs +14 -8
- package/source/components/form/stylesheet/popper.mjs +14 -8
- package/source/components/form/stylesheet/select.mjs +14 -8
- package/source/components/form/stylesheet/state-button.mjs +14 -8
- package/source/components/form/stylesheet/tabs.mjs +14 -8
- package/source/components/form/stylesheet/tree-select.mjs +14 -8
- package/source/components/form/tabs.mjs +754 -758
- package/source/components/host/collapse.mjs +2 -4
- package/source/components/host/config-manager.mjs +11 -9
- package/source/components/host/stylesheet/call-button.mjs +14 -8
- package/source/components/host/stylesheet/collapse.mjs +14 -8
- package/source/components/host/stylesheet/config-manager.mjs +14 -8
- package/source/components/host/stylesheet/details.mjs +14 -8
- package/source/components/host/stylesheet/host.mjs +14 -8
- package/source/components/host/stylesheet/overlay.mjs +14 -8
- package/source/components/host/stylesheet/toggle-button.mjs +14 -8
- package/source/components/host/stylesheet/viewer.mjs +14 -8
- package/source/components/host/util.mjs +2 -2
- package/source/components/notify/stylesheet/message.mjs +14 -8
- package/source/components/notify/stylesheet/notify.mjs +14 -8
- package/source/components/state/stylesheet/log.mjs +14 -8
- package/source/components/state/stylesheet/state.mjs +14 -8
- package/source/components/stylesheet/badge.mjs +14 -8
- package/source/components/stylesheet/border.mjs +14 -8
- package/source/components/stylesheet/button.mjs +14 -8
- package/source/components/stylesheet/card.mjs +14 -8
- package/source/components/stylesheet/color.mjs +14 -8
- package/source/components/stylesheet/common.mjs +14 -8
- package/source/components/stylesheet/control.mjs +14 -8
- package/source/components/stylesheet/data-grid.mjs +14 -8
- package/source/components/stylesheet/display.mjs +14 -8
- package/source/components/stylesheet/floating-ui.mjs +14 -8
- package/source/components/stylesheet/form.mjs +14 -8
- package/source/components/stylesheet/host.mjs +14 -8
- package/source/components/stylesheet/icons.mjs +14 -8
- package/source/components/stylesheet/link.mjs +14 -8
- package/source/components/stylesheet/normalize.mjs +14 -8
- package/source/components/stylesheet/popper.mjs +14 -8
- package/source/components/stylesheet/property.mjs +14 -8
- package/source/components/stylesheet/ripple.mjs +14 -8
- package/source/components/stylesheet/skeleton.mjs +14 -8
- package/source/components/stylesheet/space.mjs +14 -8
- package/source/components/stylesheet/spinner.mjs +14 -8
- package/source/components/stylesheet/table.mjs +14 -8
- package/source/components/stylesheet/theme.mjs +14 -8
- package/source/components/stylesheet/typography.mjs +14 -8
- package/source/components/tree-menu/stylesheet/tree-menu.mjs +14 -8
- package/source/data/transformer.mjs +6 -8
- package/source/dom/attributes.mjs +5 -5
- package/source/dom/customelement.mjs +1 -1
- package/source/dom/updater.mjs +697 -700
- package/source/dom/util.mjs +2 -2
- package/source/monster.mjs +0 -1
- package/source/types/noderecursiveiterator.mjs +9 -7
- package/source/types/version.mjs +1 -1
- package/source/util/sleep.mjs +3 -4
- package/test/cases/monster.mjs +1 -1
@@ -3,63 +3,63 @@
|
|
3
3
|
* SPDX-License-Identifier: AGPL-3.0
|
4
4
|
*/
|
5
5
|
|
6
|
-
import {Datasource} from "./datasource.mjs";
|
6
|
+
import { Datasource } from "./datasource.mjs";
|
7
7
|
import {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
assembleMethodSymbol,
|
9
|
+
CustomElement,
|
10
|
+
registerCustomElement,
|
11
|
+
getSlottedElements,
|
12
12
|
} from "../../dom/customelement.mjs";
|
13
|
-
import {findTargetElementFromEvent} from "../../dom/events.mjs";
|
13
|
+
import { findTargetElementFromEvent } from "../../dom/events.mjs";
|
14
14
|
import {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
isString,
|
16
|
+
isFunction,
|
17
|
+
isInstance,
|
18
|
+
isObject,
|
19
|
+
isArray,
|
20
20
|
} from "../../types/is.mjs";
|
21
|
-
import {Observer} from "../../types/observer.mjs";
|
21
|
+
import { Observer } from "../../types/observer.mjs";
|
22
22
|
import {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
23
|
+
ATTRIBUTE_DATATABLE_HEAD,
|
24
|
+
ATTRIBUTE_DATATABLE_GRID_TEMPLATE,
|
25
|
+
ATTRIBUTE_DATASOURCE_SELECTOR,
|
26
|
+
ATTRIBUTE_DATATABLE_ALIGN,
|
27
|
+
ATTRIBUTE_DATATABLE_SORTABLE,
|
28
|
+
ATTRIBUTE_DATATABLE_MODE,
|
29
|
+
ATTRIBUTE_DATATABLE_INDEX,
|
30
|
+
ATTRIBUTE_DATATABLE_MODE_HIDDEN,
|
31
|
+
ATTRIBUTE_DATATABLE_MODE_VISIBLE,
|
32
|
+
ATTRIBUTE_DATATABLE_RESPONSIVE_BREAKPOINT,
|
33
|
+
ATTRIBUTE_DATATABLE_MODE_FIXED,
|
34
34
|
} from "./constants.mjs";
|
35
|
-
import {instanceSymbol} from "../../constants.mjs";
|
35
|
+
import { instanceSymbol } from "../../constants.mjs";
|
36
36
|
import {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
Header,
|
38
|
+
createOrderStatement,
|
39
|
+
DIRECTION_ASC,
|
40
|
+
DIRECTION_DESC,
|
41
|
+
DIRECTION_NONE,
|
42
42
|
} from "./datatable/header.mjs";
|
43
|
-
import {getStoredFilterConfigKey} from "./filter/util.mjs";
|
44
|
-
import {DatatableStyleSheet} from "./stylesheet/datatable.mjs";
|
43
|
+
import { getStoredFilterConfigKey } from "./filter/util.mjs";
|
44
|
+
import { DatatableStyleSheet } from "./stylesheet/datatable.mjs";
|
45
45
|
import {
|
46
|
-
|
47
|
-
|
46
|
+
handleDataSourceChanges,
|
47
|
+
datasourceLinkedElementSymbol,
|
48
48
|
} from "./util.mjs";
|
49
49
|
import "./columnbar.mjs";
|
50
50
|
import "./filter-button.mjs";
|
51
|
-
import {getDocument, getWindow} from "../../dom/util.mjs";
|
52
|
-
import {addAttributeToken} from "../../dom/attributes.mjs";
|
53
|
-
import {ATTRIBUTE_ERRORMESSAGE} from "../../dom/constants.mjs";
|
54
|
-
import {getDocumentTranslations} from "../../i18n/translations.mjs";
|
51
|
+
import { getDocument, getWindow } from "../../dom/util.mjs";
|
52
|
+
import { addAttributeToken } from "../../dom/attributes.mjs";
|
53
|
+
import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";
|
54
|
+
import { getDocumentTranslations } from "../../i18n/translations.mjs";
|
55
55
|
import "../state/state.mjs";
|
56
56
|
import "../host/collapse.mjs";
|
57
|
-
import {generateUniqueConfigKey} from "../host/util.mjs";
|
57
|
+
import { generateUniqueConfigKey } from "../host/util.mjs";
|
58
58
|
|
59
59
|
import "./datasource/dom.mjs";
|
60
60
|
import "./datasource/rest.mjs";
|
61
61
|
|
62
|
-
export {DataTable};
|
62
|
+
export { DataTable };
|
63
63
|
|
64
64
|
/**
|
65
65
|
* @private
|
@@ -120,210 +120,209 @@ const columnBarElementSymbol = Symbol("columnBarElement");
|
|
120
120
|
* @summary A data table
|
121
121
|
*/
|
122
122
|
class DataTable extends CustomElement {
|
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
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
}
|
123
|
+
/**
|
124
|
+
* This method is called by the `instanceof` operator.
|
125
|
+
* @returns {symbol}
|
126
|
+
*/
|
127
|
+
static get [instanceSymbol]() {
|
128
|
+
return Symbol.for("@schukai/monster/components/datatable@@instance");
|
129
|
+
}
|
130
|
+
|
131
|
+
/**
|
132
|
+
* To set the options via the html tag the attribute `data-monster-options` must be used.
|
133
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
134
|
+
*
|
135
|
+
* The individual configuration values can be found in the table.
|
136
|
+
*
|
137
|
+
* @property {Object} templates Template definitions
|
138
|
+
* @property {string} templates.main Main template
|
139
|
+
* @property {Object} datasource Datasource configuration
|
140
|
+
* @property {string} datasource.selector Selector for the datasource
|
141
|
+
* @property {Object} mapping Mapping configuration
|
142
|
+
* @property {string} mapping.data Data mapping
|
143
|
+
* @property {Array} data Data
|
144
|
+
* @property {Array} headers Headers
|
145
|
+
* @property {Object} responsive Responsive configuration
|
146
|
+
* @property {number} responsive.breakpoint Breakpoint for responsive mode
|
147
|
+
* @property {Object} labels Labels
|
148
|
+
* @property {string} labels.theListContainsNoEntries Label for empty state
|
149
|
+
* @property {Object} features Features
|
150
|
+
* @property {boolean} features.settings Settings feature
|
151
|
+
* @property {boolean} features.footer Footer feature
|
152
|
+
* @property {boolean} features.autoInit Auto init feature (init datasource automatically)
|
153
|
+
* @property {Object} templateMapping Template mapping
|
154
|
+
* @property {string} templateMapping.row-key Row key
|
155
|
+
* @property {string} templateMapping.filter-id Filter id
|
156
|
+
**/
|
157
|
+
get defaults() {
|
158
|
+
return Object.assign(
|
159
|
+
{},
|
160
|
+
super.defaults,
|
161
|
+
{
|
162
|
+
templates: {
|
163
|
+
main: getTemplate(),
|
164
|
+
emptyState: getEmptyTemplate(),
|
165
|
+
},
|
166
|
+
|
167
|
+
datasource: {
|
168
|
+
selector: null,
|
169
|
+
},
|
170
|
+
|
171
|
+
mapping: {
|
172
|
+
data: "dataset",
|
173
|
+
},
|
174
|
+
|
175
|
+
data: [],
|
176
|
+
headers: [],
|
177
|
+
|
178
|
+
responsive: {
|
179
|
+
breakpoint: 800,
|
180
|
+
},
|
181
|
+
|
182
|
+
labels: {
|
183
|
+
theListContainsNoEntries: "The list contains no entries",
|
184
|
+
},
|
185
|
+
|
186
|
+
features: {
|
187
|
+
settings: true,
|
188
|
+
footer: true,
|
189
|
+
autoInit: true,
|
190
|
+
},
|
191
|
+
|
192
|
+
templateMapping: {
|
193
|
+
"row-key": null,
|
194
|
+
"filter-id": null,
|
195
|
+
},
|
196
|
+
},
|
197
|
+
initOptionsFromArguments.call(this),
|
198
|
+
);
|
199
|
+
}
|
200
|
+
|
201
|
+
/**
|
202
|
+
*
|
203
|
+
* @param {string} selector
|
204
|
+
* @returns {NodeListOf<*>}
|
205
|
+
*/
|
206
|
+
getGridElements(selector) {
|
207
|
+
return this[gridElementSymbol].querySelectorAll(selector);
|
208
|
+
}
|
209
|
+
|
210
|
+
/**
|
211
|
+
*
|
212
|
+
* @return {string}
|
213
|
+
*/
|
214
|
+
static getTag() {
|
215
|
+
return "monster-datatable";
|
216
|
+
}
|
217
|
+
|
218
|
+
/**
|
219
|
+
*
|
220
|
+
* @return {Monster.Components.Form.Form}
|
221
|
+
*/
|
222
|
+
[assembleMethodSymbol]() {
|
223
|
+
const rawKey = this.getOption("templateMapping.row-key");
|
224
|
+
|
225
|
+
if (rawKey === null) {
|
226
|
+
if (this.id !== null && this.id !== "") {
|
227
|
+
const rawKey = this.getOption("templateMapping.row-key");
|
228
|
+
if (rawKey === null) {
|
229
|
+
this.setOption("templateMapping.row-key", this.id + "-row");
|
230
|
+
}
|
231
|
+
} else {
|
232
|
+
this.setOption("templateMapping.row-key", "row");
|
233
|
+
}
|
234
|
+
}
|
235
|
+
|
236
|
+
if (this.id !== null && this.id !== "") {
|
237
|
+
this.setOption("templateMapping.filter-id", "" + this.id + "-filter");
|
238
|
+
} else {
|
239
|
+
this.setOption("templateMapping.filter-id", "filter");
|
240
|
+
}
|
241
|
+
|
242
|
+
super[assembleMethodSymbol]();
|
243
|
+
|
244
|
+
initControlReferences.call(this);
|
245
|
+
initEventHandler.call(this);
|
246
|
+
|
247
|
+
const selector = this.getOption("datasource.selector");
|
248
|
+
|
249
|
+
if (isString(selector)) {
|
250
|
+
const elements = document.querySelectorAll(selector);
|
251
|
+
if (elements.length !== 1) {
|
252
|
+
throw new Error("the selector must match exactly one element");
|
253
|
+
}
|
254
|
+
|
255
|
+
const element = elements[0];
|
256
|
+
|
257
|
+
if (!isInstance(element, Datasource)) {
|
258
|
+
throw new TypeError("the element must be a datasource");
|
259
|
+
}
|
260
|
+
|
261
|
+
this[datasourceLinkedElementSymbol] = element;
|
262
|
+
|
263
|
+
setTimeout(() => {
|
264
|
+
handleDataSourceChanges.call(this);
|
265
|
+
element.datasource.attachObserver(
|
266
|
+
new Observer(handleDataSourceChanges.bind(this)),
|
267
|
+
);
|
268
|
+
}, 0);
|
269
|
+
}
|
270
|
+
|
271
|
+
getHostConfig
|
272
|
+
.call(this, getColumnVisibilityConfigKey)
|
273
|
+
.then((config) => {
|
274
|
+
const headerOrderMap = new Map();
|
275
|
+
|
276
|
+
getHostConfig
|
277
|
+
.call(this, getStoredOrderConfigKey)
|
278
|
+
.then((orderConfig) => {
|
279
|
+
if (isArray(orderConfig) || orderConfig.length > 0) {
|
280
|
+
for (let i = 0; i < orderConfig.length; i++) {
|
281
|
+
const item = orderConfig[i];
|
282
|
+
const parts = item.split(" ");
|
283
|
+
const field = parts[0];
|
284
|
+
const direction = parts[1] || DIRECTION_ASC;
|
285
|
+
headerOrderMap.set(field, direction);
|
286
|
+
}
|
287
|
+
}
|
288
|
+
})
|
289
|
+
.then(() => {
|
290
|
+
try {
|
291
|
+
initGridAndStructs.call(this, config, headerOrderMap);
|
292
|
+
} catch (error) {
|
293
|
+
addAttributeToken(
|
294
|
+
this,
|
295
|
+
ATTRIBUTE_ERRORMESSAGE,
|
296
|
+
error?.message || error.toString(),
|
297
|
+
);
|
298
|
+
}
|
299
|
+
|
300
|
+
updateColumnBar.call(this);
|
301
|
+
})
|
302
|
+
.catch((error) => {
|
303
|
+
addAttributeToken(
|
304
|
+
this,
|
305
|
+
ATTRIBUTE_ERRORMESSAGE,
|
306
|
+
error?.message || error.toString(),
|
307
|
+
);
|
308
|
+
});
|
309
|
+
})
|
310
|
+
.catch((error) => {
|
311
|
+
addAttributeToken(
|
312
|
+
this,
|
313
|
+
ATTRIBUTE_ERRORMESSAGE,
|
314
|
+
error?.message || error.toString(),
|
315
|
+
);
|
316
|
+
});
|
317
|
+
}
|
318
|
+
|
319
|
+
/**
|
320
|
+
*
|
321
|
+
* @return {CSSStyleSheet[]}
|
322
|
+
*/
|
323
|
+
static getCSSStyleSheet() {
|
324
|
+
return [DatatableStyleSheet];
|
325
|
+
}
|
327
326
|
}
|
328
327
|
|
329
328
|
/**
|
@@ -331,7 +330,7 @@ class DataTable extends CustomElement {
|
|
331
330
|
* @returns {string}
|
332
331
|
*/
|
333
332
|
function getColumnVisibilityConfigKey() {
|
334
|
-
|
333
|
+
return generateUniqueConfigKey("datatable", this?.id, "columns-visibility");
|
335
334
|
}
|
336
335
|
|
337
336
|
/**
|
@@ -339,7 +338,7 @@ function getColumnVisibilityConfigKey() {
|
|
339
338
|
* @returns {string}
|
340
339
|
*/
|
341
340
|
function getFilterConfigKey() {
|
342
|
-
|
341
|
+
return generateUniqueConfigKey("datatable", this?.id, "filter");
|
343
342
|
}
|
344
343
|
|
345
344
|
/**
|
@@ -347,281 +346,279 @@ function getFilterConfigKey() {
|
|
347
346
|
* @returns {Promise}
|
348
347
|
*/
|
349
348
|
function getHostConfig(callback) {
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
349
|
+
const document = getDocument();
|
350
|
+
const host = document.querySelector("monster-host");
|
351
|
+
|
352
|
+
if (!(host && this.id)) {
|
353
|
+
return Promise.resolve({});
|
354
|
+
}
|
355
|
+
|
356
|
+
if (!host || !isFunction(host?.getConfig)) {
|
357
|
+
throw new TypeError("the host must be a monster-host");
|
358
|
+
}
|
359
|
+
|
360
|
+
const configKey = callback.call(this);
|
361
|
+
return host.hasConfig(configKey).then((hasConfig) => {
|
362
|
+
if (hasConfig) {
|
363
|
+
return host.getConfig(configKey);
|
364
|
+
} else {
|
365
|
+
return {};
|
366
|
+
}
|
367
|
+
});
|
370
368
|
}
|
371
369
|
|
372
370
|
/**
|
373
371
|
* @private
|
374
372
|
*/
|
375
373
|
function updateColumnBar() {
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
374
|
+
if (!this[columnBarElementSymbol]) {
|
375
|
+
return;
|
376
|
+
}
|
377
|
+
|
378
|
+
const columns = [];
|
379
|
+
for (const header of this.getOption("headers")) {
|
380
|
+
const mode = header.getInternal("mode");
|
381
|
+
|
382
|
+
if (mode === ATTRIBUTE_DATATABLE_MODE_FIXED) {
|
383
|
+
continue;
|
384
|
+
}
|
385
|
+
|
386
|
+
columns.push({
|
387
|
+
visible: mode !== ATTRIBUTE_DATATABLE_MODE_HIDDEN,
|
388
|
+
name: header.label,
|
389
|
+
index: header.index,
|
390
|
+
});
|
391
|
+
}
|
392
|
+
|
393
|
+
this[columnBarElementSymbol].setOption("columns", columns);
|
396
394
|
}
|
397
395
|
|
398
396
|
/**
|
399
397
|
* @private
|
400
398
|
*/
|
401
399
|
function updateHeaderFromColumnBar() {
|
402
|
-
|
403
|
-
|
404
|
-
|
400
|
+
if (!this[columnBarElementSymbol]) {
|
401
|
+
return;
|
402
|
+
}
|
405
403
|
|
406
|
-
|
407
|
-
|
404
|
+
const options = this[columnBarElementSymbol].getOption("columns");
|
405
|
+
if (!isArray(options)) return;
|
408
406
|
|
409
|
-
|
407
|
+
const invisibleMap = {};
|
410
408
|
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
409
|
+
for (let i = 0; i < options.length; i++) {
|
410
|
+
const option = options[i];
|
411
|
+
invisibleMap[option.index] = option.visible;
|
412
|
+
}
|
415
413
|
|
416
|
-
|
417
|
-
|
414
|
+
for (const header of this.getOption("headers")) {
|
415
|
+
const mode = header.getInternal("mode");
|
418
416
|
|
419
|
-
|
420
|
-
|
421
|
-
|
417
|
+
if (mode === ATTRIBUTE_DATATABLE_MODE_FIXED) {
|
418
|
+
continue;
|
419
|
+
}
|
422
420
|
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
421
|
+
if (invisibleMap[header.index] === false) {
|
422
|
+
header.setInternal("mode", ATTRIBUTE_DATATABLE_MODE_HIDDEN);
|
423
|
+
} else {
|
424
|
+
header.setInternal("mode", ATTRIBUTE_DATATABLE_MODE_VISIBLE);
|
425
|
+
}
|
426
|
+
}
|
429
427
|
}
|
430
428
|
|
431
429
|
/**
|
432
430
|
* @private
|
433
431
|
*/
|
434
432
|
function updateConfigColumnBar() {
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
433
|
+
if (!this[columnBarElementSymbol]) {
|
434
|
+
return;
|
435
|
+
}
|
436
|
+
|
437
|
+
const options = this[columnBarElementSymbol].getOption("columns");
|
438
|
+
if (!isArray(options)) return;
|
439
|
+
|
440
|
+
const map = {};
|
441
|
+
for (let i = 0; i < options.length; i++) {
|
442
|
+
const option = options[i];
|
443
|
+
map[option.name] = option.visible;
|
444
|
+
}
|
445
|
+
|
446
|
+
const document = getDocument();
|
447
|
+
const host = document.querySelector("monster-host");
|
448
|
+
if (!(host && this.id)) {
|
449
|
+
return;
|
450
|
+
}
|
451
|
+
const configKey = getColumnVisibilityConfigKey.call(this);
|
452
|
+
|
453
|
+
try {
|
454
|
+
host.setConfig(configKey, map);
|
455
|
+
} catch (error) {
|
456
|
+
addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, String(error));
|
457
|
+
}
|
460
458
|
}
|
461
459
|
|
462
460
|
/**
|
463
461
|
* @private
|
464
462
|
*/
|
465
463
|
function initEventHandler() {
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
});
|
464
|
+
const self = this;
|
465
|
+
|
466
|
+
getWindow().addEventListener("resize", (event) => {
|
467
|
+
updateGrid.call(self);
|
468
|
+
});
|
469
|
+
|
470
|
+
self[columnBarElementSymbol].attachObserver(
|
471
|
+
new Observer((e) => {
|
472
|
+
updateHeaderFromColumnBar.call(self);
|
473
|
+
updateGrid.call(self);
|
474
|
+
updateConfigColumnBar.call(self);
|
475
|
+
}),
|
476
|
+
);
|
477
|
+
|
478
|
+
self[gridHeadersElementSymbol].addEventListener("click", function (event) {
|
479
|
+
let element = null;
|
480
|
+
const datasource = self[datasourceLinkedElementSymbol];
|
481
|
+
if (!datasource) {
|
482
|
+
return;
|
483
|
+
}
|
484
|
+
|
485
|
+
element = findTargetElementFromEvent(event, ATTRIBUTE_DATATABLE_SORTABLE);
|
486
|
+
if (element) {
|
487
|
+
const index = element.parentNode.getAttribute(ATTRIBUTE_DATATABLE_INDEX);
|
488
|
+
const headers = self.getOption("headers");
|
489
|
+
|
490
|
+
event.preventDefault();
|
491
|
+
|
492
|
+
headers[index].changeDirection();
|
493
|
+
|
494
|
+
setTimeout(function () {
|
495
|
+
/** hotfix, normally this should be done via the updater, no idea why this is not possible. */
|
496
|
+
element.setAttribute(
|
497
|
+
ATTRIBUTE_DATATABLE_SORTABLE,
|
498
|
+
`${headers[index].field} ${headers[index].direction}`,
|
499
|
+
);
|
500
|
+
|
501
|
+
storeOrderStatement.call(self, true);
|
502
|
+
}, 0);
|
503
|
+
}
|
504
|
+
});
|
508
505
|
}
|
509
506
|
|
510
507
|
/**
|
511
508
|
* @private
|
512
509
|
*/
|
513
510
|
function initGridAndStructs(hostConfig, headerOrderMap) {
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
511
|
+
const rowID = this.getOption("templateMapping.row-key");
|
512
|
+
|
513
|
+
if (!this[gridElementSymbol]) {
|
514
|
+
throw new Error("no grid element is defined");
|
515
|
+
}
|
516
|
+
|
517
|
+
let template;
|
518
|
+
getSlottedElements.call(this).forEach((e) => {
|
519
|
+
if (e instanceof HTMLTemplateElement && e.id === rowID) {
|
520
|
+
template = e;
|
521
|
+
}
|
522
|
+
});
|
523
|
+
|
524
|
+
if (!template) {
|
525
|
+
throw new Error("no template is defined");
|
526
|
+
}
|
527
|
+
|
528
|
+
const rowCount = template.content.children.length;
|
529
|
+
|
530
|
+
const headers = [];
|
531
|
+
|
532
|
+
for (let i = 0; i < rowCount; i++) {
|
533
|
+
let hClass = "";
|
534
|
+
const row = template.content.children[i];
|
535
|
+
|
536
|
+
let mode = "";
|
537
|
+
if (row.hasAttribute(ATTRIBUTE_DATATABLE_MODE)) {
|
538
|
+
mode = row.getAttribute(ATTRIBUTE_DATATABLE_MODE);
|
539
|
+
}
|
540
|
+
|
541
|
+
let grid = row.getAttribute(ATTRIBUTE_DATATABLE_GRID_TEMPLATE);
|
542
|
+
if (!grid || grid === "" || grid === "auto") {
|
543
|
+
grid = "minmax(0, 1fr)";
|
544
|
+
}
|
545
|
+
|
546
|
+
let label = "";
|
547
|
+
let labelKey = "";
|
548
|
+
|
549
|
+
if (row.hasAttribute(ATTRIBUTE_DATATABLE_HEAD)) {
|
550
|
+
label = row.getAttribute(ATTRIBUTE_DATATABLE_HEAD);
|
551
|
+
labelKey = label;
|
552
|
+
|
553
|
+
try {
|
554
|
+
if (label.startsWith("i18n:")) {
|
555
|
+
label = label.substring(5, label.length);
|
556
|
+
label = getDocumentTranslations().getText(label, label);
|
557
|
+
}
|
558
|
+
} catch (e) {
|
559
|
+
label = "i18n error " + label;
|
560
|
+
}
|
561
|
+
}
|
562
|
+
|
563
|
+
if (!label) {
|
564
|
+
label = i + 1 + "";
|
565
|
+
mode = ATTRIBUTE_DATATABLE_MODE_FIXED;
|
566
|
+
labelKey = label;
|
567
|
+
}
|
568
|
+
|
569
|
+
if (isObject(hostConfig) && hostConfig.hasOwnProperty(label)) {
|
570
|
+
if (hostConfig[label] === false) {
|
571
|
+
mode = ATTRIBUTE_DATATABLE_MODE_HIDDEN;
|
572
|
+
} else {
|
573
|
+
mode = ATTRIBUTE_DATATABLE_MODE_VISIBLE;
|
574
|
+
}
|
575
|
+
}
|
576
|
+
|
577
|
+
let align = "";
|
578
|
+
if (row.hasAttribute(ATTRIBUTE_DATATABLE_ALIGN)) {
|
579
|
+
align = row.getAttribute(ATTRIBUTE_DATATABLE_ALIGN);
|
580
|
+
}
|
581
|
+
|
582
|
+
switch (align) {
|
583
|
+
case "center":
|
584
|
+
hClass = "flex-center";
|
585
|
+
break;
|
586
|
+
case "end":
|
587
|
+
hClass = "flex-end";
|
588
|
+
break;
|
589
|
+
case "start":
|
590
|
+
hClass = "flex-start";
|
591
|
+
break;
|
592
|
+
default:
|
593
|
+
hClass = "flex-start";
|
594
|
+
}
|
595
|
+
|
596
|
+
let field = "";
|
597
|
+
if (row.hasAttribute(ATTRIBUTE_DATATABLE_SORTABLE)) {
|
598
|
+
field = row.getAttribute(ATTRIBUTE_DATATABLE_SORTABLE);
|
599
|
+
}
|
600
|
+
|
601
|
+
if (mode === ATTRIBUTE_DATATABLE_MODE_HIDDEN) {
|
602
|
+
hClass += " hidden";
|
603
|
+
}
|
604
|
+
|
605
|
+
const header = new Header();
|
606
|
+
header.setInternals({
|
607
|
+
field: field,
|
608
|
+
label: label,
|
609
|
+
classes: hClass,
|
610
|
+
index: i,
|
611
|
+
mode: mode,
|
612
|
+
grid: grid,
|
613
|
+
labelKey: labelKey,
|
614
|
+
direction: headerOrderMap.get(field) || DIRECTION_NONE,
|
615
|
+
});
|
616
|
+
|
617
|
+
headers.push(header);
|
618
|
+
}
|
619
|
+
|
620
|
+
this.setOption("headers", headers);
|
621
|
+
storeOrderStatement.call(this, this.getOption("features.autoInit"));
|
625
622
|
}
|
626
623
|
|
627
624
|
/**
|
@@ -629,81 +626,79 @@ function initGridAndStructs(hostConfig, headerOrderMap) {
|
|
629
626
|
* @returns {string}
|
630
627
|
*/
|
631
628
|
export function getStoredOrderConfigKey() {
|
632
|
-
|
629
|
+
return generateUniqueConfigKey("datatable", this?.id, "stored-order");
|
633
630
|
}
|
634
631
|
|
635
|
-
|
636
632
|
/**
|
637
633
|
* @private
|
638
634
|
*/
|
639
635
|
function storeOrderStatement(doFetch) {
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
636
|
+
const headers = this.getOption("headers");
|
637
|
+
const statement = createOrderStatement(headers);
|
638
|
+
setDataSource.call(this, { orderBy: statement }, doFetch);
|
639
|
+
|
640
|
+
const document = getDocument();
|
641
|
+
const host = document.querySelector("monster-host");
|
642
|
+
if (!(host && this.id)) {
|
643
|
+
return;
|
644
|
+
}
|
645
|
+
|
646
|
+
const configKey = getStoredOrderConfigKey.call(this);
|
647
|
+
|
648
|
+
// statement explode with , and remove all empty
|
649
|
+
const list = statement.split(",").filter((item) => item.trim() !== "");
|
650
|
+
if (list.length === 0) {
|
651
|
+
// host.deleteConfig(configKey);
|
652
|
+
return;
|
653
|
+
}
|
654
|
+
|
655
|
+
host.setConfig(configKey, list);
|
661
656
|
}
|
662
657
|
|
663
658
|
/**
|
664
659
|
* @private
|
665
660
|
*/
|
666
661
|
function updateGrid() {
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
662
|
+
if (!this[gridElementSymbol]) {
|
663
|
+
throw new Error("no grid element is defined");
|
664
|
+
}
|
665
|
+
|
666
|
+
let gridTemplateColumns = "";
|
667
|
+
|
668
|
+
const headers = this.getOption("headers");
|
669
|
+
|
670
|
+
let styles = "";
|
671
|
+
|
672
|
+
for (let i = 0; i < headers.length; i++) {
|
673
|
+
const header = headers[i];
|
674
|
+
|
675
|
+
if (header.mode === ATTRIBUTE_DATATABLE_MODE_HIDDEN) {
|
676
|
+
styles += `[data-monster-role=datatable]>[data-monster-head="${header.labelKey}"] { display: none; }\n`;
|
677
|
+
styles += `[data-monster-role=datatable-headers]>[data-monster-index="${header.index}"] { display: none; }\n`;
|
678
|
+
} else {
|
679
|
+
gridTemplateColumns += `${header.grid} `;
|
680
|
+
}
|
681
|
+
}
|
682
|
+
|
683
|
+
const sheet = new CSSStyleSheet();
|
684
|
+
if (styles !== "") sheet.replaceSync(styles);
|
685
|
+
this.shadowRoot.adoptedStyleSheets = [...DataTable.getCSSStyleSheet(), sheet];
|
686
|
+
|
687
|
+
const bodyWidth = getDocument().body.getBoundingClientRect().width;
|
688
|
+
|
689
|
+
const breakpoint = this.getOption("responsive.breakpoint");
|
690
|
+
|
691
|
+
if (bodyWidth > breakpoint) {
|
692
|
+
this[
|
693
|
+
gridElementSymbol
|
694
|
+
].style.gridTemplateColumns = `${gridTemplateColumns}`;
|
695
|
+
this[
|
696
|
+
gridHeadersElementSymbol
|
697
|
+
].style.gridTemplateColumns = `${gridTemplateColumns}`;
|
698
|
+
} else {
|
699
|
+
this[gridElementSymbol].style.gridTemplateColumns = "auto";
|
700
|
+
this[gridHeadersElementSymbol].style.gridTemplateColumns = "auto";
|
701
|
+
}
|
707
702
|
}
|
708
703
|
|
709
704
|
/**
|
@@ -711,20 +706,20 @@ function updateGrid() {
|
|
711
706
|
* @param {Monster.Components.Datatable.Header[]} headers
|
712
707
|
* @param {bool} doFetch
|
713
708
|
*/
|
714
|
-
function setDataSource({orderBy}, doFetch) {
|
715
|
-
|
709
|
+
function setDataSource({ orderBy }, doFetch) {
|
710
|
+
const datasource = this[datasourceLinkedElementSymbol];
|
716
711
|
|
717
|
-
|
718
|
-
|
719
|
-
|
712
|
+
if (!datasource) {
|
713
|
+
return;
|
714
|
+
}
|
720
715
|
|
721
|
-
|
722
|
-
|
723
|
-
|
716
|
+
if (isFunction(datasource?.setParameters)) {
|
717
|
+
datasource.setParameters({ orderBy });
|
718
|
+
}
|
724
719
|
|
725
|
-
|
726
|
-
|
727
|
-
|
720
|
+
if (doFetch !== false && isFunction(datasource?.fetch)) {
|
721
|
+
datasource.fetch();
|
722
|
+
}
|
728
723
|
}
|
729
724
|
|
730
725
|
/**
|
@@ -732,20 +727,20 @@ function setDataSource({orderBy}, doFetch) {
|
|
732
727
|
* @return {Monster.Components.Datatable.Form}
|
733
728
|
*/
|
734
729
|
function initControlReferences() {
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
730
|
+
if (!this.shadowRoot) {
|
731
|
+
throw new Error("no shadow-root is defined");
|
732
|
+
}
|
733
|
+
|
734
|
+
this[gridElementSymbol] = this.shadowRoot.querySelector(
|
735
|
+
"[data-monster-role=datatable]",
|
736
|
+
);
|
737
|
+
this[gridHeadersElementSymbol] = this.shadowRoot.querySelector(
|
738
|
+
"[data-monster-role=datatable-headers]",
|
739
|
+
);
|
740
|
+
this[columnBarElementSymbol] =
|
741
|
+
this.shadowRoot.querySelector("monster-column-bar");
|
742
|
+
|
743
|
+
return this;
|
749
744
|
}
|
750
745
|
|
751
746
|
/**
|
@@ -755,22 +750,22 @@ function initControlReferences() {
|
|
755
750
|
* @throws {Error} the datasource could not be initialized
|
756
751
|
*/
|
757
752
|
function initOptionsFromArguments() {
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
753
|
+
const options = {};
|
754
|
+
const selector = this.getAttribute(ATTRIBUTE_DATASOURCE_SELECTOR);
|
755
|
+
|
756
|
+
if (selector) {
|
757
|
+
options.datasource = { selector: selector };
|
758
|
+
}
|
759
|
+
|
760
|
+
const breakpoint = this.getAttribute(
|
761
|
+
ATTRIBUTE_DATATABLE_RESPONSIVE_BREAKPOINT,
|
762
|
+
);
|
763
|
+
if (breakpoint) {
|
764
|
+
options.responsive = {};
|
765
|
+
options.responsive.breakpoint = parseInt(breakpoint);
|
766
|
+
}
|
767
|
+
|
768
|
+
return options;
|
774
769
|
}
|
775
770
|
|
776
771
|
/**
|
@@ -778,7 +773,7 @@ function initOptionsFromArguments() {
|
|
778
773
|
* @return {string}
|
779
774
|
*/
|
780
775
|
function getEmptyTemplate() {
|
781
|
-
|
776
|
+
return `<monster-state data-monster-role="empty-without-action">
|
782
777
|
<div part="visual">
|
783
778
|
<svg width="4rem" height="4rem" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
784
779
|
<path d="m21.5 22h-19c-1.378 0-2.5-1.121-2.5-2.5v-7c0-.07.015-.141.044-.205l3.969-8.82c.404-.896 1.299-1.475 2.28-1.475h11.414c.981 0 1.876.579 2.28 1.475l3.969 8.82c.029.064.044.135.044.205v7c0 1.379-1.122 2.5-2.5 2.5zm-20.5-9.393v6.893c0 .827.673 1.5 1.5 1.5h19c.827 0 1.5-.673 1.5-1.5v-6.893l-3.925-8.723c-.242-.536-.779-.884-1.368-.884h-11.414c-.589 0-1.126.348-1.368.885z"/>
|
@@ -796,8 +791,8 @@ function getEmptyTemplate() {
|
|
796
791
|
* @return {string}
|
797
792
|
*/
|
798
793
|
function getTemplate() {
|
799
|
-
|
800
|
-
|
794
|
+
// language=HTML
|
795
|
+
return `
|
801
796
|
<div data-monster-role="control" part="control">
|
802
797
|
<template id="headers-row">
|
803
798
|
<div data-monster-attributes="class path:headers-row.classname,
|