@schukai/monster 3.73.8 → 3.74.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +30 -0
- package/package.json +1 -1
- package/source/components/datatable/change-button.mjs +4 -4
- package/source/components/datatable/columnbar.mjs +2 -2
- package/source/components/datatable/dataset.mjs +2 -2
- package/source/components/datatable/datasource/rest.mjs +9 -8
- package/source/components/datatable/datatable.mjs +6 -6
- package/source/components/datatable/filter/date-range.mjs +6 -6
- package/source/components/datatable/filter/input.mjs +2 -2
- package/source/components/datatable/filter/range.mjs +4 -4
- package/source/components/datatable/filter/select.mjs +6 -2
- package/source/components/datatable/filter.mjs +4 -4
- package/source/components/datatable/save-button.mjs +4 -4
- package/source/components/datatable/stylesheet/change-button.mjs +1 -1
- package/source/components/datatable/stylesheet/column-bar.mjs +1 -1
- package/source/components/datatable/stylesheet/dataset.mjs +1 -1
- package/source/components/datatable/stylesheet/datatable.mjs +13 -6
- package/source/components/datatable/stylesheet/embedded-pagination.mjs +1 -1
- package/source/components/datatable/stylesheet/filter-select.mjs +13 -6
- package/source/components/datatable/stylesheet/filter.mjs +13 -6
- package/source/components/datatable/stylesheet/pagination.mjs +1 -1
- package/source/components/datatable/stylesheet/save-button.mjs +1 -1
- package/source/components/datatable/stylesheet/status.mjs +1 -1
- package/source/components/datatable/util.mjs +2 -2
- package/source/components/form/action-button.mjs +12 -1
- package/source/components/form/api-button.mjs +16 -5
- package/source/components/form/button-bar.mjs +13 -1
- package/source/components/form/confirm-button.mjs +12 -1
- package/source/components/form/context-error.mjs +12 -1
- package/source/components/form/context-help.mjs +12 -1
- package/source/components/form/field-set.mjs +12 -1
- package/source/components/form/form.mjs +15 -0
- package/source/components/form/message-state-button.mjs +16 -1
- package/source/components/form/popper-button.mjs +16 -1
- package/source/components/form/reload.mjs +14 -2
- package/source/components/form/shadow-reload.mjs +5 -62
- package/source/components/form/state-button.mjs +4 -30
- package/source/components/form/stylesheet/action-button.mjs +1 -1
- package/source/components/form/stylesheet/field-set.mjs +1 -1
- package/source/components/form/stylesheet/state-button.mjs +1 -1
- package/source/components/form/stylesheet/toggle-switch.mjs +1 -1
- package/source/components/form/tabs.mjs +1 -37
- package/source/components/form/template.mjs +4 -29
- package/source/components/form/toggle-switch.mjs +16 -1
- package/source/components/form/tree-select.mjs +8 -36
- package/source/components/host/stylesheet/call-button.mjs +1 -1
- package/source/components/host/stylesheet/host.mjs +1 -1
- package/source/components/host/stylesheet/overlay.mjs +1 -1
- package/source/components/host/stylesheet/toggle-button.mjs +1 -1
- package/source/components/host/stylesheet/viewer.mjs +1 -1
- package/source/components/layout/popper.mjs +317 -317
- package/source/components/layout/slider.mjs +668 -0
- package/source/components/layout/style/slider.pcss +114 -0
- package/source/components/layout/stylesheet/collapse.mjs +1 -1
- package/source/components/layout/stylesheet/details.mjs +1 -1
- package/source/components/layout/stylesheet/panel.mjs +1 -1
- package/source/components/layout/stylesheet/slider.mjs +31 -0
- package/source/components/layout/stylesheet/tabs.mjs +1 -1
- package/source/components/navigation/stylesheet/table-of-content.mjs +14 -7
- package/source/components/navigation/table-of-content.mjs +22 -17
- package/source/components/notify/stylesheet/message.mjs +1 -1
- package/source/components/stylesheet/color.mjs +13 -6
- package/source/components/stylesheet/mixin/property.mjs +13 -6
- package/source/components/stylesheet/property.mjs +1 -1
- package/source/components/tree-menu/stylesheet/tree-menu.mjs +1 -1
- package/source/components/tree-menu/tree-menu.mjs +23 -5
- package/source/data/buildtree.mjs +63 -63
- package/source/data/datasource/server/restapi.mjs +1 -2
- package/source/data/pathfinder.mjs +22 -19
- package/source/dom/events.mjs +1 -1
- package/source/dom/updater.mjs +771 -759
- package/source/text/generate-range-comparison-expression.mjs +1 -1
- package/source/types/base.mjs +1 -1
- package/source/types/id.mjs +1 -1
- package/source/types/node.mjs +141 -142
- package/source/types/observer.mjs +7 -8
- package/source/types/version.mjs +1 -1
- package/test/cases/data/buildmap.mjs +0 -1
- package/test/cases/data/pathfinder.mjs +2 -1
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +240 -190
@@ -12,14 +12,14 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
import {isArray, isObject} from "../types/is.mjs";
|
16
|
-
import {Node} from "../types/node.mjs";
|
17
|
-
import {NodeList} from "../types/nodelist.mjs";
|
18
|
-
import {clone} from "../util/clone.mjs";
|
19
|
-
import {assembleParts} from "./buildmap.mjs";
|
20
|
-
import {extend} from "./extend.mjs";
|
15
|
+
import { isArray, isObject } from "../types/is.mjs";
|
16
|
+
import { Node } from "../types/node.mjs";
|
17
|
+
import { NodeList } from "../types/nodelist.mjs";
|
18
|
+
import { clone } from "../util/clone.mjs";
|
19
|
+
import { assembleParts } from "./buildmap.mjs";
|
20
|
+
import { extend } from "./extend.mjs";
|
21
21
|
|
22
|
-
export {buildTree};
|
22
|
+
export { buildTree };
|
23
23
|
|
24
24
|
/**
|
25
25
|
* @private
|
@@ -140,69 +140,69 @@ const rootSymbol = Symbol("root");
|
|
140
140
|
* @since 1.26.0
|
141
141
|
*/
|
142
142
|
function buildTree(subject, selector, idKey, parentIDKey, options) {
|
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
|
-
|
143
|
+
const nodes = new Map();
|
144
|
+
|
145
|
+
const maxDepth = 100;
|
146
|
+
|
147
|
+
if (!isObject(options)) {
|
148
|
+
options = {};
|
149
|
+
}
|
150
|
+
|
151
|
+
options = extend(
|
152
|
+
{},
|
153
|
+
{
|
154
|
+
rootReferences: [null, undefined],
|
155
|
+
filter: undefined,
|
156
|
+
},
|
157
|
+
options,
|
158
|
+
);
|
159
|
+
|
160
|
+
const filter = options?.filter;
|
161
|
+
let rootReferences = options.rootReferences;
|
162
|
+
if (!isArray(rootReferences)) {
|
163
|
+
rootReferences = [rootReferences];
|
164
|
+
}
|
165
|
+
|
166
|
+
const childMap = assembleParts(subject, selector, filter, function (o, k, m) {
|
167
|
+
const key = o?.[idKey];
|
168
|
+
let ref = o?.[parentIDKey];
|
169
|
+
if (rootReferences.indexOf(ref) !== -1) ref = rootSymbol;
|
170
|
+
|
171
|
+
if (key === undefined) {
|
172
|
+
throw new Error("the object has no value for the specified id");
|
173
|
+
}
|
174
|
+
|
175
|
+
o[parentSymbol] = ref;
|
176
|
+
|
177
|
+
const node = new Node(o);
|
178
|
+
this.has(ref)
|
179
|
+
? this.get(ref).add(node)
|
180
|
+
: this.set(ref, new NodeList().add(node));
|
181
|
+
nodes.set(key, node);
|
182
|
+
});
|
183
|
+
|
184
|
+
nodes.forEach((node) => {
|
185
185
|
const id = node?.["value"]?.[idKey];
|
186
186
|
|
187
|
-
|
188
|
-
|
189
|
-
|
187
|
+
if (id === undefined) {
|
188
|
+
throw new Error("the object has no value for the specified id");
|
189
|
+
}
|
190
190
|
|
191
191
|
if (childMap.has(id)) {
|
192
|
-
|
193
|
-
|
192
|
+
node.childNodes = childMap.get(id);
|
193
|
+
childMap.delete(id);
|
194
194
|
}
|
195
195
|
});
|
196
196
|
|
197
|
-
|
197
|
+
const list = new NodeList();
|
198
198
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
199
|
+
childMap.forEach((s) => {
|
200
|
+
if (s instanceof Set) {
|
201
|
+
s.forEach((n) => {
|
202
|
+
list.add(n);
|
203
|
+
});
|
204
|
+
}
|
205
|
+
});
|
206
206
|
|
207
|
-
|
207
|
+
return list;
|
208
208
|
}
|
@@ -193,7 +193,7 @@ class RestAPI extends Server {
|
|
193
193
|
*/
|
194
194
|
function fetchData(init, key, callback) {
|
195
195
|
let response;
|
196
|
-
|
196
|
+
|
197
197
|
return fetch(this.getOption(`${key}.url`), init)
|
198
198
|
.then((resp) => {
|
199
199
|
response = resp;
|
@@ -232,7 +232,6 @@ function fetchData(init, key, callback) {
|
|
232
232
|
if (callback && isFunction(callback)) {
|
233
233
|
callback(obj);
|
234
234
|
}
|
235
|
-
|
236
235
|
return response;
|
237
236
|
})
|
238
237
|
.catch((e) => {
|
@@ -223,14 +223,13 @@ function iterate(subject, path, check) {
|
|
223
223
|
|
224
224
|
/**
|
225
225
|
*
|
226
|
-
* @param
|
227
|
-
* @param
|
228
|
-
* @param
|
229
|
-
* @returns {
|
226
|
+
* @param subject
|
227
|
+
* @param path
|
228
|
+
* @param check
|
229
|
+
* @returns {V|*|Map}
|
230
230
|
* @throws {TypeError} unsupported type
|
231
231
|
* @throws {Error} the journey is not at its end
|
232
232
|
* @throws {Error} unsupported action for this data type
|
233
|
-
* @private
|
234
233
|
*/
|
235
234
|
function getValueViaPath(subject, path, check) {
|
236
235
|
if (check === undefined) {
|
@@ -239,7 +238,9 @@ function getValueViaPath(subject, path, check) {
|
|
239
238
|
validateBoolean(check);
|
240
239
|
|
241
240
|
if (!(isArray(path) || isString(path))) {
|
242
|
-
throw new Error(
|
241
|
+
throw new Error(
|
242
|
+
"type error: a path must be a string or an array in getValueViaPath",
|
243
|
+
);
|
243
244
|
}
|
244
245
|
|
245
246
|
let parts;
|
@@ -266,7 +267,7 @@ function getValueViaPath(subject, path, check) {
|
|
266
267
|
validateInteger(current);
|
267
268
|
anchor = [...subject]?.[current];
|
268
269
|
} else if (typeof WeakRef === "function" && subject instanceof WeakRef) {
|
269
|
-
throw Error("unsupported action for this data type");
|
270
|
+
throw Error("unsupported action for this data type (WeakRef)");
|
270
271
|
} else if (isArray(subject)) {
|
271
272
|
current = parseInt(current);
|
272
273
|
validateInteger(current);
|
@@ -290,14 +291,14 @@ function getValueViaPath(subject, path, check) {
|
|
290
291
|
);
|
291
292
|
|
292
293
|
if (!subject.hasOwnProperty(current) && descriptor === undefined) {
|
293
|
-
throw Error("unknown value");
|
294
|
+
throw Error("unknown value " + current);
|
294
295
|
}
|
295
296
|
}
|
296
297
|
|
297
298
|
return anchor;
|
298
299
|
}
|
299
300
|
|
300
|
-
throw TypeError(`unsupported type ${typeof subject}`);
|
301
|
+
throw TypeError(`unsupported type ${typeof subject} for path ${path}`);
|
301
302
|
}
|
302
303
|
|
303
304
|
/**
|
@@ -314,13 +315,13 @@ function getValueViaPath(subject, path, check) {
|
|
314
315
|
*/
|
315
316
|
function setValueViaPath(subject, path, value) {
|
316
317
|
if (!(isArray(path) || isString(path))) {
|
317
|
-
throw new Error("type error: path must be a string or an array");
|
318
|
+
throw new Error("type error: a path must be a string or an array");
|
318
319
|
}
|
319
320
|
|
320
321
|
let parts;
|
321
322
|
if (isArray(path)) {
|
322
323
|
if (path.length === 0) {
|
323
|
-
return
|
324
|
+
return;
|
324
325
|
}
|
325
326
|
|
326
327
|
parts = path;
|
@@ -363,7 +364,7 @@ function setValueViaPath(subject, path, value) {
|
|
363
364
|
const anchor = getValueViaPath.call(this, subject, subpath);
|
364
365
|
|
365
366
|
if (!(isObject(subject) || isArray(subject))) {
|
366
|
-
throw TypeError(`unsupported type: ${typeof subject}`);
|
367
|
+
throw TypeError(`unsupported type: ${typeof subject} in setValueViaPath`);
|
367
368
|
}
|
368
369
|
|
369
370
|
if (anchor instanceof Map || anchor instanceof WeakMap) {
|
@@ -371,11 +372,11 @@ function setValueViaPath(subject, path, value) {
|
|
371
372
|
} else if (anchor instanceof Set || anchor instanceof WeakSet) {
|
372
373
|
anchor.append(value);
|
373
374
|
} else if (typeof WeakRef === "function" && anchor instanceof WeakRef) {
|
374
|
-
throw Error("unsupported action for this data type");
|
375
|
+
throw Error("unsupported action for this data type in setValueViaPath");
|
375
376
|
} else if (isArray(anchor)) {
|
376
377
|
last = parseInt(last);
|
377
378
|
validateInteger(last);
|
378
|
-
assignProperty(anchor, last, value);
|
379
|
+
assignProperty(anchor, "" + last, value);
|
379
380
|
} else {
|
380
381
|
assignProperty(anchor, last, value);
|
381
382
|
}
|
@@ -415,13 +416,15 @@ function assignProperty(object, key, value) {
|
|
415
416
|
*/
|
416
417
|
function deleteValueViaPath(subject, path) {
|
417
418
|
if (!(isArray(path) || isString(path))) {
|
418
|
-
throw new Error(
|
419
|
+
throw new Error(
|
420
|
+
"type error: a path must be a string or an array in deleteValueViaPath",
|
421
|
+
);
|
419
422
|
}
|
420
423
|
|
421
424
|
let parts;
|
422
425
|
if (isArray(path)) {
|
423
426
|
if (path.length === 0) {
|
424
|
-
return
|
427
|
+
return;
|
425
428
|
}
|
426
429
|
|
427
430
|
parts = path;
|
@@ -430,9 +433,9 @@ function deleteValueViaPath(subject, path) {
|
|
430
433
|
}
|
431
434
|
|
432
435
|
let last = parts.pop();
|
433
|
-
const
|
436
|
+
const subPath = parts.join(DELIMITER);
|
434
437
|
|
435
|
-
const anchor = getValueViaPath.call(this, subject,
|
438
|
+
const anchor = getValueViaPath.call(this, subject, subPath);
|
436
439
|
|
437
440
|
if (anchor instanceof Map) {
|
438
441
|
anchor.delete(last);
|
@@ -442,7 +445,7 @@ function deleteValueViaPath(subject, path) {
|
|
442
445
|
anchor instanceof WeakSet ||
|
443
446
|
(typeof WeakRef === "function" && anchor instanceof WeakRef)
|
444
447
|
) {
|
445
|
-
throw Error("unsupported action for this data type");
|
448
|
+
throw Error("unsupported action for this data type in deleteValueViaPath");
|
446
449
|
} else if (isArray(anchor)) {
|
447
450
|
last = parseInt(last);
|
448
451
|
validateInteger(last);
|
package/source/dom/events.mjs
CHANGED