@schukai/monster 4.43.2 → 4.43.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 +8 -0
- package/package.json +1 -1
- package/source/components/accessibility/locale-picker.mjs +538 -538
- package/source/components/accessibility/locale-select.mjs +172 -172
- package/source/components/content/viewer.mjs +823 -823
- package/source/components/datatable/constants.mjs +15 -15
- package/source/components/datatable/datatable/header.mjs +253 -253
- package/source/components/datatable/datatable.mjs +1284 -1284
- package/source/components/datatable/filter.mjs +1339 -1342
- package/source/components/datatable/pagination.mjs +502 -502
- package/source/components/datatable/stylesheet/datatable.mjs +13 -6
- package/source/components/form/quantity.mjs +229 -229
- package/source/components/form/select.mjs +2963 -2963
- package/source/components/form/stylesheet/quantity.mjs +13 -6
- package/source/components/form/stylesheet/select.mjs +13 -6
- package/source/components/navigation/site-navigation.mjs +330 -330
- package/source/components/navigation/stylesheet/site-navigation.mjs +13 -6
- package/source/components/style/typography.css +4 -2
- package/source/dom/customelement.mjs +959 -963
- package/source/dom/slotted.mjs +87 -87
- package/source/i18n/util.mjs +149 -149
- package/source/monster.mjs +3 -0
- package/source/types/is.mjs +64 -64
- package/source/types/typeof.mjs +16 -16
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +2724 -1287
@@ -105,19 +105,19 @@ const ATTRIBUTE_DATATABLE_MODE_HIDDEN = "hidden";
|
|
105
105
|
const ATTRIBUTE_DATATABLE_MODE_VISIBLE = "visible";
|
106
106
|
|
107
107
|
export {
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
108
|
+
ATTRIBUTE_DATASOURCE,
|
109
|
+
ATTRIBUTE_DATASOURCE_SELECTOR,
|
110
|
+
ATTRIBUTE_DATASOURCE_ARGUMENTS,
|
111
|
+
ATTRIBUTE_DATATABLE_GRID_TEMPLATE,
|
112
|
+
ATTRIBUTE_DATATABLE_HEAD,
|
113
|
+
ATTRIBUTE_DATATABLE_SORTABLE,
|
114
|
+
ATTRIBUTE_DATATABLE_MODE,
|
115
|
+
ATTRIBUTE_DATATABLE_INDEX,
|
116
|
+
ATTRIBUTE_DATATABLE_ALIGN,
|
117
|
+
ATTRIBUTE_DATATABLE_MODE_FIXED,
|
118
|
+
ATTRIBUTE_DATATABLE_RESPONSIVE_BREAKPOINT,
|
119
|
+
ATTRIBUTE_DATATABLE_MODE_VISIBLE,
|
120
|
+
ATTRIBUTE_DATATABLE_MODE_HIDDEN,
|
121
|
+
STYLE_DISPLAY_MODE_BLOCK,
|
122
|
+
ATTRIBUTE_DATATABLE_FEATURES,
|
123
123
|
};
|
@@ -18,17 +18,17 @@ import { instanceSymbol } from "../../../constants.mjs";
|
|
18
18
|
import { Observer } from "../../../types/observer.mjs";
|
19
19
|
import { ATTRIBUTE_DATATABLE_SORTABLE } from "../../constants.mjs";
|
20
20
|
import {
|
21
|
-
|
22
|
-
|
21
|
+
validateIterable,
|
22
|
+
validateInstance,
|
23
23
|
} from "../../../types/validate.mjs";
|
24
24
|
import { Formatter } from "../../../text/formatter.mjs";
|
25
25
|
|
26
26
|
export {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
Header,
|
28
|
+
DIRECTION_ASC,
|
29
|
+
DIRECTION_DESC,
|
30
|
+
DIRECTION_NONE,
|
31
|
+
createOrderStatement,
|
32
32
|
};
|
33
33
|
|
34
34
|
/**
|
@@ -60,211 +60,211 @@ const DIRECTION_NONE = "";
|
|
60
60
|
* @summary The Header component is a basic class for the datatable component.
|
61
61
|
*/
|
62
62
|
class Header extends Base {
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
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
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
63
|
+
constructor() {
|
64
|
+
super();
|
65
|
+
|
66
|
+
/**
|
67
|
+
* - attachInternalObserver
|
68
|
+
* - detachInternalObserver
|
69
|
+
* - containsInternalObserver
|
70
|
+
* - setInternal
|
71
|
+
* - setInternals
|
72
|
+
* - getInternal
|
73
|
+
*/
|
74
|
+
equipWithInternal.call(this);
|
75
|
+
|
76
|
+
this.attachInternalObserver(
|
77
|
+
new Observer(() => {
|
78
|
+
updateStruct.call(this);
|
79
|
+
}),
|
80
|
+
);
|
81
|
+
}
|
82
|
+
|
83
|
+
/**
|
84
|
+
* This method is called by the `instanceof` operator.
|
85
|
+
* @return {symbol}
|
86
|
+
*/
|
87
|
+
static get [instanceSymbol]() {
|
88
|
+
return Symbol.for("@schukai/monster/components/datatable/header@@instance");
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
*
|
93
|
+
* @return {object}
|
94
|
+
*/
|
95
|
+
get internalDefaults() {
|
96
|
+
return {
|
97
|
+
field: undefined,
|
98
|
+
html: undefined,
|
99
|
+
order: undefined,
|
100
|
+
direction: undefined,
|
101
|
+
label: undefined,
|
102
|
+
labelKey: undefined,
|
103
|
+
classes: undefined,
|
104
|
+
index: undefined,
|
105
|
+
mode: undefined,
|
106
|
+
grid: undefined,
|
107
|
+
features: undefined,
|
108
|
+
orderTemplate: undefined,
|
109
|
+
resizable: false,
|
110
|
+
initialWidth: undefined,
|
111
|
+
};
|
112
|
+
}
|
113
|
+
|
114
|
+
/**
|
115
|
+
*/
|
116
|
+
changeDirection() {
|
117
|
+
let direction = this.getInternal("direction");
|
118
|
+
if (direction === DIRECTION_ASC) {
|
119
|
+
direction = DIRECTION_DESC;
|
120
|
+
} else if (direction === DIRECTION_DESC) {
|
121
|
+
direction = DIRECTION_NONE;
|
122
|
+
} else {
|
123
|
+
direction = DIRECTION_ASC;
|
124
|
+
}
|
125
|
+
this.setInternal("direction", direction);
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
*
|
130
|
+
* @param {string} direction
|
131
|
+
*/
|
132
|
+
setDirection(direction) {
|
133
|
+
this.setInternal("direction", direction);
|
134
|
+
}
|
135
|
+
|
136
|
+
/**
|
137
|
+
* @param {string} field
|
138
|
+
*/
|
139
|
+
set field(field) {
|
140
|
+
this.setInternal("field", String(field));
|
141
|
+
}
|
142
|
+
|
143
|
+
/**
|
144
|
+
* @param {string} direction
|
145
|
+
*/
|
146
|
+
set direction(direction) {
|
147
|
+
this.setInternal("direction", String(direction));
|
148
|
+
}
|
149
|
+
|
150
|
+
set labelKey(labelKey) {
|
151
|
+
this.setInternal("labelKey", String(labelKey));
|
152
|
+
}
|
153
|
+
|
154
|
+
/**
|
155
|
+
* @param {string} label
|
156
|
+
*/
|
157
|
+
set label(label) {
|
158
|
+
this.setInternal("label", String(label));
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
* @param {string} classes
|
163
|
+
*/
|
164
|
+
set classes(classes) {
|
165
|
+
this.setInternal("classes", String(classes));
|
166
|
+
}
|
167
|
+
|
168
|
+
/**
|
169
|
+
* @param {number} index
|
170
|
+
*/
|
171
|
+
set index(index) {
|
172
|
+
this.setInternal("index", String(index));
|
173
|
+
}
|
174
|
+
|
175
|
+
set resizable(resizable) {
|
176
|
+
this.setInternal("resizable", Boolean(resizable));
|
177
|
+
}
|
178
|
+
|
179
|
+
set initialWidth(initialWidth) {
|
180
|
+
this.setInternal("initialWidth", String(initialWidth));
|
181
|
+
}
|
182
|
+
|
183
|
+
set orderTemplate(orderTemplate) {
|
184
|
+
this.setInternal("orderTemplate", String(orderTemplate));
|
185
|
+
}
|
186
|
+
|
187
|
+
/**
|
188
|
+
* @return {string}
|
189
|
+
*/
|
190
|
+
get grid() {
|
191
|
+
return this.getInternal("grid");
|
192
|
+
}
|
193
|
+
|
194
|
+
/**
|
195
|
+
* @return {string}
|
196
|
+
*/
|
197
|
+
get labelKey() {
|
198
|
+
return this.getInternal("labelKey");
|
199
|
+
}
|
200
|
+
|
201
|
+
/**
|
202
|
+
* @return {string}
|
203
|
+
*/
|
204
|
+
get html() {
|
205
|
+
return this.getInternal("html");
|
206
|
+
}
|
207
|
+
|
208
|
+
/**
|
209
|
+
* @return {string}
|
210
|
+
*/
|
211
|
+
get order() {
|
212
|
+
return this.getInternal("order");
|
213
|
+
}
|
214
|
+
|
215
|
+
/**
|
216
|
+
* @return {string}
|
217
|
+
*/
|
218
|
+
get field() {
|
219
|
+
return this.getInternal("field");
|
220
|
+
}
|
221
|
+
|
222
|
+
/**
|
223
|
+
* @return {string}
|
224
|
+
*/
|
225
|
+
get index() {
|
226
|
+
return this.getInternal("index");
|
227
|
+
}
|
228
|
+
|
229
|
+
/**
|
230
|
+
* @return {string}
|
231
|
+
*/
|
232
|
+
get classes() {
|
233
|
+
return this.getInternal("classes");
|
234
|
+
}
|
235
|
+
|
236
|
+
/**
|
237
|
+
* @return {string}
|
238
|
+
*/
|
239
|
+
get label() {
|
240
|
+
return this.getInternal("label");
|
241
|
+
}
|
242
|
+
|
243
|
+
/**
|
244
|
+
* @return {string}
|
245
|
+
*/
|
246
|
+
get direction() {
|
247
|
+
return this.getInternal("direction");
|
248
|
+
}
|
249
|
+
|
250
|
+
/**
|
251
|
+
* @return {string}
|
252
|
+
*/
|
253
|
+
get mode() {
|
254
|
+
return this.getInternal("mode");
|
255
|
+
}
|
256
|
+
|
257
|
+
get resizable() {
|
258
|
+
return this.getInternal("resizable");
|
259
|
+
}
|
260
|
+
|
261
|
+
get initialWidth() {
|
262
|
+
return this.getInternal("initialWidth");
|
263
|
+
}
|
264
|
+
|
265
|
+
get orderTemplate() {
|
266
|
+
return this.getInternal("orderTemplate");
|
267
|
+
}
|
268
268
|
}
|
269
269
|
|
270
270
|
/**
|
@@ -274,51 +274,51 @@ class Header extends Base {
|
|
274
274
|
* @return {string}
|
275
275
|
*/
|
276
276
|
function createOrderStatement(headers, delimiter = ",") {
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
277
|
+
validateIterable(headers);
|
278
|
+
|
279
|
+
const oderStatement = [];
|
280
|
+
for (const header of headers) {
|
281
|
+
validateInstance(header, Header);
|
282
|
+
const order = header.getInternal("order");
|
283
|
+
|
284
|
+
if (!order) {
|
285
|
+
continue;
|
286
|
+
}
|
287
|
+
oderStatement.push(order);
|
288
|
+
}
|
289
|
+
return oderStatement.join(delimiter);
|
290
290
|
}
|
291
291
|
|
292
292
|
/**
|
293
293
|
* @private
|
294
294
|
*/
|
295
295
|
function updateStruct() {
|
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
|
-
|
296
|
+
const label = this.getInternal("label");
|
297
|
+
const direction = this.getInternal("direction");
|
298
|
+
const field = this.getInternal("field");
|
299
|
+
const isResizable = this.getInternal("resizable");
|
300
|
+
|
301
|
+
let order = "";
|
302
|
+
let htmlContent = label;
|
303
|
+
|
304
|
+
if (field) {
|
305
|
+
if (direction) {
|
306
|
+
const tmpl = this.getInternal("orderTemplate");
|
307
|
+
const formatter = new Formatter({
|
308
|
+
direction: direction,
|
309
|
+
label: label,
|
310
|
+
field: field,
|
311
|
+
});
|
312
|
+
order = formatter.format(tmpl);
|
313
|
+
}
|
314
|
+
htmlContent = `<a href="#" ${ATTRIBUTE_DATATABLE_SORTABLE}="${order}">${label}</a>`;
|
315
|
+
}
|
316
|
+
|
317
|
+
if (isResizable) {
|
318
|
+
const resizeHandleSVG = `<svg width="12" height="16" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><circle cx="9" cy="8" r="1.5"></circle><circle cx="9" cy="12" r="1.5"></circle><circle cx="9" cy="16" r="1.5"></circle><circle cx="15" cy="8" r="1.5"></circle><circle cx="15" cy="12" r="1.5"></circle><circle cx="15" cy="16" r="1.5"></circle></svg>`;
|
319
|
+
htmlContent += `<div class="resize-handle" data-monster-role="resize-handle">${resizeHandleSVG}</div>`;
|
320
|
+
}
|
321
|
+
|
322
|
+
this.setInternal("order", order);
|
323
|
+
this.setInternal("html", htmlContent);
|
324
324
|
}
|