@schukai/monster 3.55.0 → 3.55.2
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 +23 -0
- package/package.json +1 -1
- package/source/components/datatable/datasource/rest.mjs +77 -46
- 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 +905 -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/datasource/server/restapi.mjs +1 -0
- package/source/data/transformer.mjs +6 -8
- package/source/dom/attributes.mjs +5 -5
- package/source/dom/customelement.mjs +2 -2
- 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
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.55.2] - 2024-01-22
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
- double fetch [#134](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/134)
|
|
7
|
+
|
|
8
|
+
## [3.55.1] - 2024-01-22
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
- catch errors [#133](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/133)
|
|
13
|
+
- catch errors [#133](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/133)
|
|
14
|
+
- check parameter [#132](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/132)
|
|
15
|
+
### Changes
|
|
16
|
+
|
|
17
|
+
- release and publish to npm new version 3.55.1
|
|
18
|
+
- doc
|
|
19
|
+
- lint + formatt
|
|
20
|
+
- update nixos to 23-11
|
|
21
|
+
|
|
2
22
|
## [3.55.0] - 2023-11-29
|
|
3
23
|
|
|
4
24
|
### Add Features
|
|
5
25
|
|
|
6
26
|
- various changes [#131](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/131)
|
|
27
|
+
### Changes
|
|
28
|
+
|
|
29
|
+
- release and publish to npm new version 3.55.0
|
|
7
30
|
|
|
8
31
|
## [3.54.0] - 2023-11-23
|
|
9
32
|
|
package/package.json
CHANGED
|
@@ -29,6 +29,15 @@ export {Rest};
|
|
|
29
29
|
*/
|
|
30
30
|
const intersectionObserverHandlerSymbol = Symbol("intersectionObserverHandler");
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @private
|
|
34
|
+
* Original at source/components/datatable/datasource/rest.mjs
|
|
35
|
+
* @type {symbol}
|
|
36
|
+
*/
|
|
37
|
+
const rawDataSymbol = Symbol.for(
|
|
38
|
+
"@schukai/monster/data/datasource/server/restapi/rawdata",
|
|
39
|
+
);
|
|
40
|
+
|
|
32
41
|
/**
|
|
33
42
|
* @private
|
|
34
43
|
* @type {symbol}
|
|
@@ -98,7 +107,8 @@ class Rest extends Datasource {
|
|
|
98
107
|
* @property {Object} datatable Datatable definitions
|
|
99
108
|
* @property {string} datatable.id The id of the datatable control
|
|
100
109
|
* @property {Object} response Response definitions
|
|
101
|
-
* @property {
|
|
110
|
+
* @property {Object} response.path Path definitions (changed in 3.56.0)
|
|
111
|
+
* @property {string} response.path.message Path to the message (changed in 3.56.0)
|
|
102
112
|
* @property {Object} read Read configuration
|
|
103
113
|
* @property {string} read.url The url of the rest api
|
|
104
114
|
* @property {string} read.method The method of the rest api
|
|
@@ -124,7 +134,7 @@ class Rest extends Datasource {
|
|
|
124
134
|
},
|
|
125
135
|
|
|
126
136
|
features: {
|
|
127
|
-
autoInit:
|
|
137
|
+
autoInit: false,
|
|
128
138
|
filter: false,
|
|
129
139
|
},
|
|
130
140
|
|
|
@@ -136,13 +146,16 @@ class Rest extends Datasource {
|
|
|
136
146
|
filter: {
|
|
137
147
|
id: undefined,
|
|
138
148
|
},
|
|
139
|
-
|
|
149
|
+
|
|
140
150
|
datatable: {
|
|
141
151
|
id: undefined,
|
|
142
152
|
},
|
|
143
153
|
|
|
144
154
|
response: {
|
|
145
|
-
|
|
155
|
+
path: {
|
|
156
|
+
message: "sys.message",
|
|
157
|
+
code: "sys.code",
|
|
158
|
+
}
|
|
146
159
|
},
|
|
147
160
|
});
|
|
148
161
|
}
|
|
@@ -192,7 +205,6 @@ class Rest extends Datasource {
|
|
|
192
205
|
* @returns {Promise<never>|*}
|
|
193
206
|
*/
|
|
194
207
|
fetch() {
|
|
195
|
-
const self = this;
|
|
196
208
|
const opt = clone(this.getOption("read"));
|
|
197
209
|
this[dataSourceSymbol].setOption("read", opt);
|
|
198
210
|
|
|
@@ -206,36 +218,32 @@ class Rest extends Datasource {
|
|
|
206
218
|
url = formatter.format(url);
|
|
207
219
|
|
|
208
220
|
this[dataSourceSymbol].setOption("read.url", url);
|
|
209
|
-
|
|
210
|
-
return new Promise((resolve, reject) => {
|
|
211
221
|
|
|
212
|
-
|
|
213
|
-
|
|
222
|
+
return new Promise((resolve, reject) => {
|
|
223
|
+
fireCustomEvent(this, "monster-datasource-fetch", {
|
|
224
|
+
datasource: this,
|
|
214
225
|
});
|
|
215
226
|
|
|
216
227
|
setTimeout(() => {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
228
|
+
this[dataSourceSymbol]
|
|
229
|
+
.read()
|
|
230
|
+
.then((response) => {
|
|
231
|
+
fireCustomEvent(this, "monster-datasource-fetched", {
|
|
232
|
+
datasource: this,
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
resolve(response);
|
|
236
|
+
})
|
|
237
|
+
.catch((error) => {
|
|
238
|
+
fireCustomEvent(this, "monster-datasource-error", {
|
|
239
|
+
error: error,
|
|
240
|
+
});
|
|
221
241
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
})
|
|
225
|
-
.catch((error) => {
|
|
226
|
-
fireCustomEvent(self, "monster-datasource-error", {
|
|
227
|
-
error: error,
|
|
242
|
+
addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, error.toString());
|
|
243
|
+
reject(error);
|
|
228
244
|
});
|
|
229
|
-
|
|
230
|
-
addAttributeToken(self, ATTRIBUTE_ERRORMESSAGE, error.toString());
|
|
231
|
-
reject(error);
|
|
232
|
-
|
|
233
|
-
});
|
|
234
|
-
},0);
|
|
235
|
-
|
|
245
|
+
}, 0);
|
|
236
246
|
});
|
|
237
|
-
|
|
238
|
-
|
|
239
247
|
}
|
|
240
248
|
|
|
241
249
|
/**
|
|
@@ -301,7 +309,6 @@ function removeFilter() {
|
|
|
301
309
|
}
|
|
302
310
|
}
|
|
303
311
|
|
|
304
|
-
|
|
305
312
|
/**
|
|
306
313
|
* @private
|
|
307
314
|
*/
|
|
@@ -320,13 +327,11 @@ function initFilter() {
|
|
|
320
327
|
);
|
|
321
328
|
|
|
322
329
|
this[filterObserverSymbol] = new Observer(() => {
|
|
323
|
-
|
|
324
330
|
const query = filterControl.getOption("query", undefined);
|
|
325
331
|
this.setParameters({query: query});
|
|
326
332
|
this.fetch()
|
|
327
333
|
.then((response) => {
|
|
328
|
-
|
|
329
|
-
if(!(response instanceof Response) ){
|
|
334
|
+
if (!(response instanceof Response)) {
|
|
330
335
|
throw new Error("Response is not an instance of Response");
|
|
331
336
|
}
|
|
332
337
|
|
|
@@ -335,25 +340,29 @@ function initFilter() {
|
|
|
335
340
|
filterControl?.showSuccess();
|
|
336
341
|
}
|
|
337
342
|
|
|
343
|
+
if (response.bodyUsed === true) {
|
|
344
|
+
return handleIntersectionObserver.call(this, response[rawDataSymbol], response, filterControl);
|
|
345
|
+
}
|
|
346
|
+
|
|
338
347
|
response
|
|
339
|
-
.
|
|
340
|
-
.then((
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
)
|
|
345
|
-
|
|
346
|
-
filterControl?.showFailureMessage(
|
|
347
|
-
return;
|
|
348
|
+
.text()
|
|
349
|
+
.then((jsonAsText) => {
|
|
350
|
+
let json;
|
|
351
|
+
try {
|
|
352
|
+
json = JSON.parse(jsonAsText);
|
|
353
|
+
} catch (e) {
|
|
354
|
+
let message = e instanceof Error ? e.message : `${e}`;
|
|
355
|
+
filterControl?.showFailureMessage(message);
|
|
356
|
+
return Promise.reject(e);
|
|
348
357
|
}
|
|
349
358
|
|
|
350
|
-
filterControl
|
|
359
|
+
return handleIntersectionObserver.call(this,json, response, filterControl);
|
|
360
|
+
|
|
361
|
+
|
|
351
362
|
})
|
|
352
363
|
.catch((e) => {
|
|
353
364
|
filterControl?.showFailureMessage(e.message);
|
|
354
365
|
});
|
|
355
|
-
|
|
356
|
-
|
|
357
366
|
})
|
|
358
367
|
.catch((e) => {
|
|
359
368
|
this.dispatchEvent(
|
|
@@ -366,13 +375,36 @@ function initFilter() {
|
|
|
366
375
|
|
|
367
376
|
filterControl?.showFailureMessage(e.message);
|
|
368
377
|
return Promise.reject(e);
|
|
369
|
-
|
|
370
378
|
});
|
|
371
379
|
});
|
|
372
380
|
|
|
373
381
|
filterControl.attachObserver(this[filterObserverSymbol]);
|
|
374
382
|
}
|
|
375
383
|
|
|
384
|
+
function handleIntersectionObserver(json, response, filterControl) {
|
|
385
|
+
|
|
386
|
+
const path = new Pathfinder(json);
|
|
387
|
+
|
|
388
|
+
const codePath = this.getOption("response.path.code");
|
|
389
|
+
|
|
390
|
+
if (path.exists(codePath)) {
|
|
391
|
+
const code = `${path.getVia(codePath)}`;
|
|
392
|
+
if (code && code === "200") {
|
|
393
|
+
filterControl?.showSuccess();
|
|
394
|
+
return Promise.resolve(response);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const messagePath = this.getOption("response.path.message");
|
|
398
|
+
if (path.exists(messagePath)) {
|
|
399
|
+
const message = path.getVia(messagePath);
|
|
400
|
+
filterControl?.showFailureMessage(message);
|
|
401
|
+
return Promise.reject(new Error(message));
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
return Promise.reject(new Error("Response code is not 200"));
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
376
408
|
/**
|
|
377
409
|
* @private
|
|
378
410
|
*/
|
|
@@ -389,7 +421,6 @@ function initAutoInit() {
|
|
|
389
421
|
|
|
390
422
|
setTimeout(() => {
|
|
391
423
|
this.fetch().catch(() => {
|
|
392
|
-
|
|
393
424
|
});
|
|
394
425
|
}, 0);
|
|
395
426
|
}
|