@zeyos/zx 2.1.0 → 2.2.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 +51 -0
- package/README.md +15 -0
- package/dist/types/compat/base.d.ts +156 -0
- package/dist/types/compat/globals.d.ts +20 -0
- package/dist/types/compat/index.d.ts +128 -0
- package/dist/types/compat/map/basic.d.ts +175 -0
- package/dist/types/compat/map/data.d.ts +102 -0
- package/dist/types/compat/map/date-time.d.ts +80 -0
- package/dist/types/compat/map/factory.d.ts +9 -0
- package/dist/types/compat/map/form.d.ts +98 -0
- package/dist/types/compat/map/helpers.d.ts +12 -0
- package/dist/types/compat/map/http.d.ts +36 -0
- package/dist/types/compat/map/layout.d.ts +106 -0
- package/dist/types/compat/map/options.d.ts +80 -0
- package/dist/types/compat/map/select.d.ts +95 -0
- package/dist/types/compat/map/stubs.d.ts +32 -0
- package/dist/types/compat/map/utilities.d.ts +37 -0
- package/dist/types/compat-entry.d.ts +5 -0
- package/dist/types/components/badge/badge.d.ts +46 -0
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +200 -0
- package/dist/types/components/button/button.d.ts +42 -0
- package/dist/types/components/check-button/check-button.d.ts +98 -0
- package/dist/types/components/checklist/checklist.d.ts +143 -0
- package/dist/types/components/checklist/field-adapter.d.ts +5 -0
- package/dist/types/components/context-menu/context-menu.d.ts +130 -0
- package/dist/types/components/copy/copy-button.d.ts +48 -0
- package/dist/types/components/copy/copy-input.d.ts +91 -0
- package/dist/types/components/data-filter/data-filter.d.ts +250 -0
- package/dist/types/components/data-filter/filter-core.d.ts +52 -0
- package/dist/types/components/date-picker/date-picker.d.ts +137 -0
- package/dist/types/components/date-picker/date-range-picker.d.ts +350 -0
- package/dist/types/components/date-picker/field-adapter.d.ts +6 -0
- package/dist/types/components/date-picker/month-picker.d.ts +75 -0
- package/dist/types/components/date-picker/range-field-adapter.d.ts +7 -0
- package/dist/types/components/date-picker/time-picker.d.ts +127 -0
- package/dist/types/components/datebox/date-range-box.d.ts +218 -0
- package/dist/types/components/datebox/datebox.d.ts +160 -0
- package/dist/types/components/datebox/field-adapter.d.ts +5 -0
- package/dist/types/components/dialog/dialog.d.ts +284 -0
- package/dist/types/components/dropdown/dropdown.d.ts +118 -0
- package/dist/types/components/empty-state/empty-state.d.ts +38 -0
- package/dist/types/components/field/field.d.ts +231 -0
- package/dist/types/components/field-upload/field-adapter.d.ts +5 -0
- package/dist/types/components/field-upload/field-upload.d.ts +213 -0
- package/dist/types/components/fieldset/fieldset.d.ts +125 -0
- package/dist/types/components/finder/finder.d.ts +252 -0
- package/dist/types/components/form/form.d.ts +194 -0
- package/dist/types/components/groupbox/groupbox.d.ts +89 -0
- package/dist/types/components/layout/layout.d.ts +132 -0
- package/dist/types/components/loading/inline-loading.d.ts +86 -0
- package/dist/types/components/loading/progress-bar.d.ts +168 -0
- package/dist/types/components/loading/spinner.d.ts +34 -0
- package/dist/types/components/master-panel/master-panel.d.ts +112 -0
- package/dist/types/components/menu-button/menu-button.d.ts +142 -0
- package/dist/types/components/message/message.d.ts +212 -0
- package/dist/types/components/modal/modal.d.ts +105 -0
- package/dist/types/components/multi-value-editor/field-adapter.d.ts +5 -0
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +66 -0
- package/dist/types/components/navigation-bar/navigation-bar.d.ts +229 -0
- package/dist/types/components/number-field/field-adapter.d.ts +5 -0
- package/dist/types/components/number-field/number-field.d.ts +292 -0
- package/dist/types/components/pagination/pagination.d.ts +267 -0
- package/dist/types/components/panel/panel.d.ts +194 -0
- package/dist/types/components/permission/permission.d.ts +93 -0
- package/dist/types/components/rating/field-adapter.d.ts +5 -0
- package/dist/types/components/rating/rating.d.ts +213 -0
- package/dist/types/components/search/search.d.ts +98 -0
- package/dist/types/components/select/field-adapter.d.ts +5 -0
- package/dist/types/components/select/filter.d.ts +11 -0
- package/dist/types/components/select/select.d.ts +235 -0
- package/dist/types/components/skeleton/skeleton.d.ts +97 -0
- package/dist/types/components/slider/field-adapter.d.ts +5 -0
- package/dist/types/components/slider/slider.d.ts +216 -0
- package/dist/types/components/split-view/split-view.d.ts +335 -0
- package/dist/types/components/stepper/stepper.d.ts +314 -0
- package/dist/types/components/stepper/steps.d.ts +131 -0
- package/dist/types/components/tabbox/tabbox.d.ts +230 -0
- package/dist/types/components/table/sort.d.ts +49 -0
- package/dist/types/components/table/table.d.ts +872 -0
- package/dist/types/components/tag-picker/field-adapter.d.ts +5 -0
- package/dist/types/components/tag-picker/tag-picker.d.ts +375 -0
- package/dist/types/components/timebox/field-adapter.d.ts +5 -0
- package/dist/types/components/timebox/timebox.d.ts +121 -0
- package/dist/types/components/toggle/field-adapter.d.ts +5 -0
- package/dist/types/components/toggle/toggle.d.ts +94 -0
- package/dist/types/components/toolbar/toolbar.d.ts +230 -0
- package/dist/types/components/tooltip/tooltip.d.ts +183 -0
- package/dist/types/components/tree/hierarchy.d.ts +113 -0
- package/dist/types/components/tree/tree.d.ts +383 -0
- package/dist/types/components/truncate/truncate.d.ts +61 -0
- package/dist/types/components/value-list/field-adapter.d.ts +5 -0
- package/dist/types/components/value-list/value-list.d.ts +143 -0
- package/dist/types/core/breakpoint.d.ts +68 -0
- package/dist/types/core/component.d.ts +115 -0
- package/dist/types/core/date.d.ts +50 -0
- package/dist/types/core/dom.d.ts +86 -0
- package/dist/types/core/export.d.ts +70 -0
- package/dist/types/core/fontawesome.d.ts +107 -0
- package/dist/types/core/format.d.ts +107 -0
- package/dist/types/core/http.d.ts +122 -0
- package/dist/types/core/i18n.d.ts +35 -0
- package/dist/types/core/icons.d.ts +137 -0
- package/dist/types/core/keyboard.d.ts +72 -0
- package/dist/types/core/position.d.ts +45 -0
- package/dist/types/core/storage.d.ts +46 -0
- package/dist/types/core/util.d.ts +117 -0
- package/dist/types/elements/define.d.ts +73 -0
- package/dist/types/elements/reflect.d.ts +27 -0
- package/dist/types/index.d.ts +79 -0
- package/dist/types/zeyos/connect.d.ts +65 -0
- package/dist/types/zeyos/form.d.ts +140 -0
- package/dist/types/zeyos/icons.d.ts +104 -0
- package/dist/types/zeyos/index.d.ts +12 -0
- package/dist/types/zeyos/modules.d.ts +110 -0
- package/dist/types/zeyos/query.d.ts +157 -0
- package/dist/types/zeyos/schema.d.ts +79 -0
- package/dist/types/zeyos/select.d.ts +167 -0
- package/dist/types/zeyos/table.d.ts +205 -0
- package/dist/zx-compat.esm.js +375 -39
- package/dist/zx-compat.esm.min.js +1 -1
- package/dist/zx-compat.global.js +372 -73
- package/dist/zx-compat.global.min.js +3 -3
- package/dist/zx-zeyos.esm.js +355 -49
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +68 -6
- package/dist/zx.esm.js +359 -73
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +359 -73
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +48 -2
- package/docs/llms.md +31 -0
- package/package.json +37 -9
- package/src/compat/base.js +291 -0
- package/src/compat/globals.js +165 -0
- package/src/compat/index.js +84 -0
- package/src/compat/map/basic.js +464 -0
- package/src/compat/map/data.js +232 -0
- package/src/compat/map/date-time.js +177 -0
- package/src/compat/map/factory.js +45 -0
- package/src/compat/map/form.js +330 -0
- package/src/compat/map/helpers.js +46 -0
- package/src/compat/map/http.js +117 -0
- package/src/compat/map/layout.js +256 -0
- package/src/compat/map/options.js +267 -0
- package/src/compat/map/select.js +198 -0
- package/src/compat/map/stubs.js +26 -0
- package/src/compat/map/utilities.js +113 -0
- package/src/compat-entry.js +11 -0
- package/src/components/badge/badge.css +147 -0
- package/src/components/badge/badge.js +92 -0
- package/src/components/breadcrumb/breadcrumb.css +105 -0
- package/src/components/breadcrumb/breadcrumb.js +331 -0
- package/src/components/button/button.css +104 -0
- package/src/components/button/button.js +76 -0
- package/src/components/check-button/check-button.css +66 -0
- package/src/components/check-button/check-button.js +167 -0
- package/src/components/checklist/checklist.css +65 -0
- package/src/components/checklist/checklist.js +282 -0
- package/src/components/checklist/field-adapter.js +46 -0
- package/src/components/context-menu/context-menu.css +54 -0
- package/src/components/context-menu/context-menu.js +334 -0
- package/src/components/copy/copy-button.css +27 -0
- package/src/components/copy/copy-button.js +78 -0
- package/src/components/copy/copy-input.css +59 -0
- package/src/components/copy/copy-input.js +123 -0
- package/src/components/data-filter/data-filter.css +53 -0
- package/src/components/data-filter/data-filter.js +400 -0
- package/src/components/data-filter/filter-core.js +128 -0
- package/src/components/date-picker/date-picker.css +181 -0
- package/src/components/date-picker/date-picker.js +500 -0
- package/src/components/date-picker/date-range-picker.css +264 -0
- package/src/components/date-picker/date-range-picker.js +990 -0
- package/src/components/date-picker/field-adapter.js +36 -0
- package/src/components/date-picker/month-picker.js +223 -0
- package/src/components/date-picker/range-field-adapter.js +31 -0
- package/src/components/date-picker/time-picker.css +191 -0
- package/src/components/date-picker/time-picker.js +406 -0
- package/src/components/datebox/date-range-box.css +128 -0
- package/src/components/datebox/date-range-box.js +492 -0
- package/src/components/datebox/datebox.css +108 -0
- package/src/components/datebox/datebox.js +358 -0
- package/src/components/datebox/field-adapter.js +34 -0
- package/src/components/dialog/dialog.css +74 -0
- package/src/components/dialog/dialog.js +450 -0
- package/src/components/dropdown/dropdown.css +24 -0
- package/src/components/dropdown/dropdown.js +288 -0
- package/src/components/empty-state/empty-state.css +80 -0
- package/src/components/empty-state/empty-state.js +92 -0
- package/src/components/field/field.css +127 -0
- package/src/components/field/field.js +605 -0
- package/src/components/field-upload/field-adapter.js +21 -0
- package/src/components/field-upload/field-upload.css +108 -0
- package/src/components/field-upload/field-upload.js +475 -0
- package/src/components/fieldset/fieldset.css +37 -0
- package/src/components/fieldset/fieldset.js +307 -0
- package/src/components/finder/finder.css +98 -0
- package/src/components/finder/finder.js +509 -0
- package/src/components/form/form.css +32 -0
- package/src/components/form/form.js +302 -0
- package/src/components/groupbox/groupbox.css +51 -0
- package/src/components/groupbox/groupbox.js +199 -0
- package/src/components/layout/layout.css +117 -0
- package/src/components/layout/layout.js +136 -0
- package/src/components/loading/inline-loading.css +34 -0
- package/src/components/loading/inline-loading.js +140 -0
- package/src/components/loading/progress-bar.css +115 -0
- package/src/components/loading/progress-bar.js +259 -0
- package/src/components/loading/spinner.css +58 -0
- package/src/components/loading/spinner.js +57 -0
- package/src/components/master-panel/master-panel.css +51 -0
- package/src/components/master-panel/master-panel.js +203 -0
- package/src/components/menu-button/menu-button.css +49 -0
- package/src/components/menu-button/menu-button.js +294 -0
- package/src/components/message/message.css +122 -0
- package/src/components/message/message.js +499 -0
- package/src/components/modal/modal.css +47 -0
- package/src/components/modal/modal.js +203 -0
- package/src/components/multi-value-editor/field-adapter.js +44 -0
- package/src/components/multi-value-editor/multi-value-editor.css +56 -0
- package/src/components/multi-value-editor/multi-value-editor.js +170 -0
- package/src/components/navigation-bar/navigation-bar.css +130 -0
- package/src/components/navigation-bar/navigation-bar.js +450 -0
- package/src/components/number-field/field-adapter.js +40 -0
- package/src/components/number-field/number-field.css +77 -0
- package/src/components/number-field/number-field.js +545 -0
- package/src/components/pagination/pagination.css +95 -0
- package/src/components/pagination/pagination.js +481 -0
- package/src/components/panel/panel.css +123 -0
- package/src/components/panel/panel.js +336 -0
- package/src/components/permission/permission.css +47 -0
- package/src/components/permission/permission.js +198 -0
- package/src/components/rating/field-adapter.js +34 -0
- package/src/components/rating/rating.css +97 -0
- package/src/components/rating/rating.js +395 -0
- package/src/components/search/search.css +70 -0
- package/src/components/search/search.js +193 -0
- package/src/components/select/field-adapter.js +24 -0
- package/src/components/select/filter.js +39 -0
- package/src/components/select/select.css +180 -0
- package/src/components/select/select.js +663 -0
- package/src/components/skeleton/skeleton.css +76 -0
- package/src/components/skeleton/skeleton.js +139 -0
- package/src/components/slider/field-adapter.js +36 -0
- package/src/components/slider/slider.css +181 -0
- package/src/components/slider/slider.js +399 -0
- package/src/components/split-view/split-view.css +139 -0
- package/src/components/split-view/split-view.js +806 -0
- package/src/components/stepper/stepper.css +234 -0
- package/src/components/stepper/stepper.js +459 -0
- package/src/components/stepper/steps.js +131 -0
- package/src/components/tabbox/tabbox.css +281 -0
- package/src/components/tabbox/tabbox.js +484 -0
- package/src/components/table/sort.js +85 -0
- package/src/components/table/table.css +364 -0
- package/src/components/table/table.js +1711 -0
- package/src/components/tag-picker/field-adapter.js +35 -0
- package/src/components/tag-picker/tag-picker.css +169 -0
- package/src/components/tag-picker/tag-picker.js +837 -0
- package/src/components/timebox/field-adapter.js +24 -0
- package/src/components/timebox/timebox.css +51 -0
- package/src/components/timebox/timebox.js +276 -0
- package/src/components/toggle/field-adapter.js +24 -0
- package/src/components/toggle/toggle.css +66 -0
- package/src/components/toggle/toggle.js +150 -0
- package/src/components/toolbar/toolbar.css +81 -0
- package/src/components/toolbar/toolbar.js +511 -0
- package/src/components/tooltip/tooltip.css +36 -0
- package/src/components/tooltip/tooltip.js +420 -0
- package/src/components/tree/hierarchy.js +151 -0
- package/src/components/tree/tree.css +99 -0
- package/src/components/tree/tree.js +784 -0
- package/src/components/truncate/truncate.css +20 -0
- package/src/components/truncate/truncate.js +92 -0
- package/src/components/value-list/field-adapter.js +24 -0
- package/src/components/value-list/value-list.css +108 -0
- package/src/components/value-list/value-list.js +336 -0
- package/src/core/breakpoint.js +150 -0
- package/src/core/component.js +292 -0
- package/src/core/date.js +216 -0
- package/src/core/dom.js +260 -0
- package/src/core/export.js +204 -0
- package/src/core/fontawesome.js +177 -0
- package/src/core/format.js +283 -0
- package/src/core/http.js +246 -0
- package/src/core/i18n.js +83 -0
- package/src/core/icons.js +283 -0
- package/src/core/keyboard.js +240 -0
- package/src/core/position.js +177 -0
- package/src/core/storage.js +175 -0
- package/src/core/util.js +336 -0
- package/src/elements/define.js +715 -0
- package/src/elements/reflect.js +79 -0
- package/src/index.js +131 -0
- package/src/zeyos/connect.js +142 -0
- package/src/zeyos/form.js +254 -0
- package/src/zeyos/icons.js +92 -0
- package/src/zeyos/index.js +21 -0
- package/src/zeyos/modules.js +269 -0
- package/src/zeyos/query.js +199 -0
- package/src/zeyos/schema.js +474 -0
- package/src/zeyos/select.js +175 -0
- package/src/zeyos/table.js +272 -0
- package/styles/base.css +124 -0
- package/styles/icons.css +34 -0
- package/styles/tokens/dark.css +84 -0
- package/styles/tokens/density.css +9 -0
- package/styles/tokens/global.css +80 -0
- package/styles/tokens/modules.css +109 -0
- package/styles/tokens/semantic.css +49 -0
- package/styles/zx.css +61 -0
package/dist/zx-compat.global.js
CHANGED
|
@@ -229,7 +229,8 @@
|
|
|
229
229
|
);
|
|
230
230
|
}
|
|
231
231
|
function isElement(value) {
|
|
232
|
-
return Boolean(value && typeof value === "object" &&
|
|
232
|
+
return Boolean(value && typeof value === "object" && /** @type {{nodeType?: unknown}} */
|
|
233
|
+
value.nodeType === 1);
|
|
233
234
|
}
|
|
234
235
|
function clamp(n, min, max) {
|
|
235
236
|
return Math.min(max, Math.max(min, n));
|
|
@@ -237,11 +238,15 @@
|
|
|
237
238
|
function toArray(value) {
|
|
238
239
|
if (value == null) return [];
|
|
239
240
|
if (Array.isArray(value)) return value.slice();
|
|
240
|
-
|
|
241
|
-
|
|
241
|
+
const candidate = (
|
|
242
|
+
/** @type {any} */
|
|
243
|
+
value
|
|
244
|
+
);
|
|
245
|
+
if (typeof value !== "string" && typeof candidate?.[Symbol.iterator] === "function") {
|
|
246
|
+
return Array.from(candidate);
|
|
242
247
|
}
|
|
243
|
-
if (typeof value !== "string" && typeof
|
|
244
|
-
return Array.from(
|
|
248
|
+
if (typeof value !== "string" && typeof candidate?.length === "number") {
|
|
249
|
+
return Array.from(candidate);
|
|
245
250
|
}
|
|
246
251
|
return [
|
|
247
252
|
/** @type {T} */
|
|
@@ -450,8 +455,12 @@
|
|
|
450
455
|
}
|
|
451
456
|
function isPropsObject(value) {
|
|
452
457
|
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
453
|
-
|
|
454
|
-
|
|
458
|
+
const candidate = (
|
|
459
|
+
/** @type {Record<string, unknown>} */
|
|
460
|
+
value
|
|
461
|
+
);
|
|
462
|
+
if (typeof candidate.nodeType === "number") return false;
|
|
463
|
+
return typeof candidate.toElement !== "function";
|
|
455
464
|
}
|
|
456
465
|
function applyProperty(element, key, value) {
|
|
457
466
|
if (key === "ref") {
|
|
@@ -509,15 +518,33 @@
|
|
|
509
518
|
return "aria-" + key.slice(4).toLowerCase();
|
|
510
519
|
}
|
|
511
520
|
function appendChildren(parent, children) {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
521
|
+
const host2 = (
|
|
522
|
+
/** @type {ParentNode} */
|
|
523
|
+
parent
|
|
524
|
+
);
|
|
525
|
+
for (
|
|
526
|
+
const raw2 of
|
|
527
|
+
/** @type {any[]} */
|
|
528
|
+
children.flat(Infinity)
|
|
529
|
+
) {
|
|
530
|
+
if (raw2 == null) continue;
|
|
531
|
+
if (typeof raw2 === "string" || typeof raw2 === "number") {
|
|
532
|
+
host2.append(document.createTextNode(String(raw2)));
|
|
533
|
+
continue;
|
|
534
|
+
}
|
|
535
|
+
if (typeof raw2 !== "object") continue;
|
|
536
|
+
const child = (
|
|
537
|
+
/** @type {{nodeType?: number, toElement?: () => Node|null}} */
|
|
538
|
+
raw2
|
|
539
|
+
);
|
|
540
|
+
if (typeof child.nodeType === "number") {
|
|
541
|
+
host2.append(
|
|
542
|
+
/** @type {Node} */
|
|
543
|
+
raw2
|
|
544
|
+
);
|
|
545
|
+
} else if (typeof child.toElement === "function") {
|
|
519
546
|
const element = child.toElement();
|
|
520
|
-
if (element)
|
|
547
|
+
if (element) host2.append(element);
|
|
521
548
|
}
|
|
522
549
|
}
|
|
523
550
|
}
|
|
@@ -572,11 +599,18 @@
|
|
|
572
599
|
var Component = class extends EventTarget {
|
|
573
600
|
/** @type {ComponentOptions} */
|
|
574
601
|
static defaults = {};
|
|
602
|
+
/**
|
|
603
|
+
* BEM block a subclass wants on its root, without the `zx-` prefix. Empty on the base, which is
|
|
604
|
+
* the same falsy answer the undeclared property gave — declared so the statics are visible to
|
|
605
|
+
* `this.constructor` and to the generated declarations.
|
|
606
|
+
* @type {string}
|
|
607
|
+
*/
|
|
608
|
+
static cssName = "";
|
|
575
609
|
/** @type {Element} Root element. */
|
|
576
610
|
el;
|
|
577
611
|
/** @type {Record<string, Element>} Elements captured by `h()` ref properties. */
|
|
578
612
|
refs;
|
|
579
|
-
/** @type {Readonly<
|
|
613
|
+
/** @type {Readonly<TOptions>} Merged component options. */
|
|
580
614
|
options;
|
|
581
615
|
#abort = new AbortController();
|
|
582
616
|
#created = false;
|
|
@@ -585,17 +619,27 @@
|
|
|
585
619
|
/**
|
|
586
620
|
* Creates a component around an existing target, or asks `render()` to create its root.
|
|
587
621
|
* @param {Element|string|null} target Existing element, selector, or null.
|
|
588
|
-
* @param {
|
|
622
|
+
* @param {TOptions} [options={}] Component options.
|
|
589
623
|
*/
|
|
590
|
-
constructor(target, options =
|
|
624
|
+
constructor(target, options = (
|
|
625
|
+
/** @type {TOptions} */
|
|
626
|
+
{}
|
|
627
|
+
)) {
|
|
591
628
|
super();
|
|
629
|
+
const self = (
|
|
630
|
+
/** @type {typeof Component} */
|
|
631
|
+
this.constructor
|
|
632
|
+
);
|
|
592
633
|
this.#created = target === null;
|
|
593
634
|
const resolved = resolveElement(target);
|
|
594
635
|
if (target !== null && !resolved) throw new TypeError("Component target could not be resolved");
|
|
595
636
|
this.el = /** @type {Element} */
|
|
596
637
|
resolved;
|
|
597
638
|
this.refs = {};
|
|
598
|
-
const merged =
|
|
639
|
+
const merged = (
|
|
640
|
+
/** @type {TOptions} */
|
|
641
|
+
mergeOptions(self, options)
|
|
642
|
+
);
|
|
599
643
|
const eventOptions = [];
|
|
600
644
|
for (const [key, value] of Object.entries(merged)) {
|
|
601
645
|
if (/^on[a-z]/.test(key) && typeof value === "function") {
|
|
@@ -625,7 +669,7 @@
|
|
|
625
669
|
this.#abort.abort();
|
|
626
670
|
throw new TypeError("Component requires a root Element");
|
|
627
671
|
}
|
|
628
|
-
const cssName =
|
|
672
|
+
const cssName = self.cssName;
|
|
629
673
|
if (typeof cssName === "string" && cssName) {
|
|
630
674
|
const className = `zx-${cssName}`;
|
|
631
675
|
this.#addedRootClass = !this.el.classList.contains(className);
|
|
@@ -746,7 +790,10 @@
|
|
|
746
790
|
this.#destroyed = true;
|
|
747
791
|
this.#abort.abort();
|
|
748
792
|
if (registry.get(this.el) === this) registry.delete(this.el);
|
|
749
|
-
const cssName =
|
|
793
|
+
const cssName = (
|
|
794
|
+
/** @type {typeof Component} */
|
|
795
|
+
this.constructor.cssName
|
|
796
|
+
);
|
|
750
797
|
if (this.#addedRootClass && typeof cssName === "string" && this.el) {
|
|
751
798
|
this.el.classList.remove(`zx-${cssName}`);
|
|
752
799
|
}
|
|
@@ -1730,7 +1777,10 @@
|
|
|
1730
1777
|
if (!lang) return 1;
|
|
1731
1778
|
if (lang.toLowerCase() === "en") return 1;
|
|
1732
1779
|
try {
|
|
1733
|
-
const locale =
|
|
1780
|
+
const locale = (
|
|
1781
|
+
/** @type {Intl.Locale & {getWeekInfo?: () => {firstDay?: number}, weekInfo?: {firstDay?: number}}} */
|
|
1782
|
+
new Intl.Locale(lang)
|
|
1783
|
+
);
|
|
1734
1784
|
const weekInfo = locale.getWeekInfo?.() ?? locale.weekInfo;
|
|
1735
1785
|
if (weekInfo?.firstDay) return weekInfo.firstDay % 7;
|
|
1736
1786
|
} catch {
|
|
@@ -1858,25 +1908,28 @@
|
|
|
1858
1908
|
const url = kitUrl(kit);
|
|
1859
1909
|
const pending = kitLoads.get(url);
|
|
1860
1910
|
if (pending) return pending;
|
|
1861
|
-
const promise =
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1911
|
+
const promise = (
|
|
1912
|
+
/** @type {Promise<void>} */
|
|
1913
|
+
new Promise((resolve, reject) => {
|
|
1914
|
+
const absolute = new URL(url, document.baseURI).href;
|
|
1915
|
+
const existing = [...document.scripts].find((script2) => script2.src === absolute);
|
|
1916
|
+
if (existing && globalThis.FontAwesomeKitConfig) {
|
|
1917
|
+
resolve();
|
|
1918
|
+
return;
|
|
1919
|
+
}
|
|
1920
|
+
const script = existing ?? document.createElement("script");
|
|
1921
|
+
script.addEventListener("load", () => resolve(), { once: true });
|
|
1922
|
+
script.addEventListener("error", () => {
|
|
1923
|
+
kitLoads.delete(url);
|
|
1924
|
+
reject(new Error(`Font Awesome kit failed to load: ${url}`));
|
|
1925
|
+
}, { once: true });
|
|
1926
|
+
if (existing) return;
|
|
1927
|
+
script.src = url;
|
|
1928
|
+
script.async = true;
|
|
1929
|
+
script.crossOrigin = "anonymous";
|
|
1930
|
+
document.head.append(script);
|
|
1931
|
+
})
|
|
1932
|
+
);
|
|
1880
1933
|
kitLoads.set(url, promise);
|
|
1881
1934
|
return promise;
|
|
1882
1935
|
}
|
|
@@ -3133,9 +3186,11 @@
|
|
|
3133
3186
|
const topY = anchorRect.top - offset - floatingRect.height;
|
|
3134
3187
|
if (flip) {
|
|
3135
3188
|
if (prefersBottom && bottomY + floatingRect.height > viewportHeight && topY >= 0) {
|
|
3136
|
-
actualPlacement = placement
|
|
3189
|
+
actualPlacement = /** @type {typeof placement} */
|
|
3190
|
+
placement.replace("bottom", "top");
|
|
3137
3191
|
} else if (!prefersBottom && topY < 0 && bottomY + floatingRect.height <= viewportHeight) {
|
|
3138
|
-
actualPlacement = placement
|
|
3192
|
+
actualPlacement = /** @type {typeof placement} */
|
|
3193
|
+
placement.replace("top", "bottom");
|
|
3139
3194
|
}
|
|
3140
3195
|
}
|
|
3141
3196
|
let left;
|
|
@@ -6148,10 +6203,13 @@
|
|
|
6148
6203
|
const originals = /* @__PURE__ */ new Map();
|
|
6149
6204
|
let destroyed = false;
|
|
6150
6205
|
function items() {
|
|
6151
|
-
return
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6206
|
+
return (
|
|
6207
|
+
/** @type {HTMLElement[]} */
|
|
6208
|
+
Array.from(container.querySelectorAll(itemSelector)).filter((item) => {
|
|
6209
|
+
remember(item);
|
|
6210
|
+
return isAvailable(item);
|
|
6211
|
+
})
|
|
6212
|
+
);
|
|
6155
6213
|
}
|
|
6156
6214
|
function remember(item) {
|
|
6157
6215
|
if (!originals.has(item)) originals.set(item, item.getAttribute("tabindex"));
|
|
@@ -6166,7 +6224,11 @@
|
|
|
6166
6224
|
}
|
|
6167
6225
|
function onKeydown(event) {
|
|
6168
6226
|
const available = items();
|
|
6169
|
-
const current =
|
|
6227
|
+
const current = (
|
|
6228
|
+
/** @type {HTMLElement|null} */
|
|
6229
|
+
/** @type {Element|null} */
|
|
6230
|
+
event.target?.closest?.(itemSelector) ?? null
|
|
6231
|
+
);
|
|
6170
6232
|
const index = available.indexOf(current);
|
|
6171
6233
|
if (index < 0) return;
|
|
6172
6234
|
const previousKey = orientation === "horizontal" ? "ArrowLeft" : "ArrowUp";
|
|
@@ -6184,7 +6246,11 @@
|
|
|
6184
6246
|
available[nextIndex].focus();
|
|
6185
6247
|
}
|
|
6186
6248
|
function onFocus(event) {
|
|
6187
|
-
const item =
|
|
6249
|
+
const item = (
|
|
6250
|
+
/** @type {HTMLElement|null} */
|
|
6251
|
+
/** @type {Element|null} */
|
|
6252
|
+
event.target?.closest?.(itemSelector) ?? null
|
|
6253
|
+
);
|
|
6188
6254
|
if (item && container.contains(item)) update(item);
|
|
6189
6255
|
}
|
|
6190
6256
|
container.addEventListener("keydown", onKeydown, { signal: controller.signal });
|
|
@@ -6244,8 +6310,9 @@
|
|
|
6244
6310
|
};
|
|
6245
6311
|
}
|
|
6246
6312
|
function focusableItems(container) {
|
|
6247
|
-
return
|
|
6248
|
-
|
|
6313
|
+
return (
|
|
6314
|
+
/** @type {HTMLElement[]} */
|
|
6315
|
+
Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR)).filter((item) => isAvailable(item) && item.getClientRects().length > 0)
|
|
6249
6316
|
);
|
|
6250
6317
|
}
|
|
6251
6318
|
function isAvailable(item) {
|
|
@@ -6259,7 +6326,11 @@
|
|
|
6259
6326
|
return String(item.textContent ?? "").trim().toLocaleLowerCase();
|
|
6260
6327
|
}
|
|
6261
6328
|
if (item && typeof item === "object") {
|
|
6262
|
-
const
|
|
6329
|
+
const shape = (
|
|
6330
|
+
/** @type {{label?: unknown, text?: unknown, value?: unknown}} */
|
|
6331
|
+
item
|
|
6332
|
+
);
|
|
6333
|
+
const value = shape.label ?? shape.text ?? shape.value;
|
|
6263
6334
|
if (value != null) return String(value).trim().toLocaleLowerCase();
|
|
6264
6335
|
}
|
|
6265
6336
|
return String(item ?? "").trim().toLocaleLowerCase();
|
|
@@ -8742,11 +8813,19 @@
|
|
|
8742
8813
|
}
|
|
8743
8814
|
function onBreakpoint(handler, options = {}) {
|
|
8744
8815
|
if (typeof handler !== "function") throw new TypeError("onBreakpoint requires a handler");
|
|
8816
|
+
if ("target" in options && !isElement(options.target) && /** @type {unknown} */
|
|
8817
|
+
options.target !== /** @type {unknown} */
|
|
8818
|
+
globalThis) {
|
|
8819
|
+
throw new TypeError("onBreakpoint target must be an Element or the window");
|
|
8820
|
+
}
|
|
8745
8821
|
const target = options.target ?? globalThis;
|
|
8746
|
-
const element = target
|
|
8822
|
+
const element = isElement(target) ? (
|
|
8823
|
+
/** @type {Element} */
|
|
8824
|
+
target
|
|
8825
|
+
) : null;
|
|
8747
8826
|
let name = (
|
|
8748
|
-
/** @type {BreakpointName} */
|
|
8749
|
-
|
|
8827
|
+
/** @type {BreakpointName|null} */
|
|
8828
|
+
null
|
|
8750
8829
|
);
|
|
8751
8830
|
let destroyed = false;
|
|
8752
8831
|
let observer = null;
|
|
@@ -8754,24 +8833,33 @@
|
|
|
8754
8833
|
const update = () => {
|
|
8755
8834
|
if (destroyed) return;
|
|
8756
8835
|
const width = measure();
|
|
8836
|
+
if (element && width === 0) return;
|
|
8757
8837
|
const next = breakpointOf(width);
|
|
8758
8838
|
if (next === name) return;
|
|
8759
8839
|
name = next;
|
|
8760
8840
|
handler(name, width);
|
|
8761
8841
|
};
|
|
8762
|
-
|
|
8763
|
-
|
|
8842
|
+
update();
|
|
8843
|
+
let frame = 0;
|
|
8844
|
+
const schedule = () => {
|
|
8845
|
+
if (frame || destroyed) return;
|
|
8846
|
+
frame = requestAnimationFrame(() => {
|
|
8847
|
+
frame = 0;
|
|
8848
|
+
update();
|
|
8849
|
+
});
|
|
8850
|
+
};
|
|
8764
8851
|
if (element && typeof ResizeObserver === "function") {
|
|
8765
|
-
observer = new ResizeObserver(
|
|
8852
|
+
observer = new ResizeObserver(schedule);
|
|
8766
8853
|
observer.observe(element);
|
|
8767
8854
|
} else {
|
|
8768
8855
|
globalThis.addEventListener?.("resize", update, { passive: true });
|
|
8769
8856
|
}
|
|
8770
8857
|
return {
|
|
8771
|
-
current: () => name,
|
|
8858
|
+
current: () => name ?? breakpointOf(measure()),
|
|
8772
8859
|
destroy: () => {
|
|
8773
8860
|
if (destroyed) return;
|
|
8774
8861
|
destroyed = true;
|
|
8862
|
+
if (frame) cancelAnimationFrame(frame);
|
|
8775
8863
|
observer?.disconnect();
|
|
8776
8864
|
globalThis.removeEventListener?.("resize", update);
|
|
8777
8865
|
}
|
|
@@ -8838,7 +8926,10 @@
|
|
|
8838
8926
|
try {
|
|
8839
8927
|
json2 = JSON.parse(text4);
|
|
8840
8928
|
} catch (cause) {
|
|
8841
|
-
const error =
|
|
8929
|
+
const error = (
|
|
8930
|
+
/** @type {Error & {response?: Response}} */
|
|
8931
|
+
new Error("Invalid JSON response", { cause })
|
|
8932
|
+
);
|
|
8842
8933
|
error.response = response;
|
|
8843
8934
|
throw error;
|
|
8844
8935
|
}
|
|
@@ -8850,7 +8941,10 @@
|
|
|
8850
8941
|
error2.response = response;
|
|
8851
8942
|
throw error2;
|
|
8852
8943
|
}
|
|
8853
|
-
const error =
|
|
8944
|
+
const error = (
|
|
8945
|
+
/** @type {Error & {response?: Response}} */
|
|
8946
|
+
new Error(`HTTP ${response.status} ${response.statusText}`.trim())
|
|
8947
|
+
);
|
|
8854
8948
|
error.response = response;
|
|
8855
8949
|
throw error;
|
|
8856
8950
|
}
|
|
@@ -8958,7 +9052,10 @@
|
|
|
8958
9052
|
for (const item of value) appendFormValue2(form, key, item);
|
|
8959
9053
|
} else {
|
|
8960
9054
|
const isBlob = typeof Blob === "function" && value instanceof Blob;
|
|
8961
|
-
form.append(key, typeof value === "object" && !isBlob ? JSON.stringify(value) :
|
|
9055
|
+
form.append(key, typeof value === "object" && !isBlob ? JSON.stringify(value) : (
|
|
9056
|
+
/** @type {string|Blob} */
|
|
9057
|
+
value
|
|
9058
|
+
));
|
|
8962
9059
|
}
|
|
8963
9060
|
}
|
|
8964
9061
|
function isFileList(value) {
|
|
@@ -9031,7 +9128,11 @@
|
|
|
9031
9128
|
const diff = target.getTime() - reference.getTime();
|
|
9032
9129
|
const division = TIME_DIVISIONS.find(({ ms, limit }) => Math.abs(diff) / ms < limit) ?? TIME_DIVISIONS[TIME_DIVISIONS.length - 1];
|
|
9033
9130
|
const value = Math.round(diff / division.ms);
|
|
9034
|
-
return relativeFormatter(locale, numeric).format(
|
|
9131
|
+
return relativeFormatter(locale, numeric).format(
|
|
9132
|
+
value,
|
|
9133
|
+
/** @type {Intl.RelativeTimeFormatUnit} */
|
|
9134
|
+
division.unit
|
|
9135
|
+
);
|
|
9035
9136
|
}
|
|
9036
9137
|
function format(locale, options, value) {
|
|
9037
9138
|
const key = `${locale}\0${JSON.stringify(options)}`;
|
|
@@ -9335,7 +9436,10 @@
|
|
|
9335
9436
|
}
|
|
9336
9437
|
function toBlob(data, type) {
|
|
9337
9438
|
if (typeof Blob === "function" && data instanceof Blob) return data;
|
|
9338
|
-
const parts =
|
|
9439
|
+
const parts = (
|
|
9440
|
+
/** @type {BlobPart[]} */
|
|
9441
|
+
typeof data === "string" && /^text\/csv\b/i.test(type) ? ["\uFEFF", data] : [data]
|
|
9442
|
+
);
|
|
9339
9443
|
return new Blob(parts, { type });
|
|
9340
9444
|
}
|
|
9341
9445
|
|
|
@@ -10724,6 +10828,8 @@
|
|
|
10724
10828
|
sortMode: "local",
|
|
10725
10829
|
selectable: false,
|
|
10726
10830
|
stickyHeader: true,
|
|
10831
|
+
responsive: false,
|
|
10832
|
+
growing: false,
|
|
10727
10833
|
height: null,
|
|
10728
10834
|
emptyText: null,
|
|
10729
10835
|
rowClass: null,
|
|
@@ -10744,6 +10850,7 @@
|
|
|
10744
10850
|
/** @type {HTMLElement} */
|
|
10745
10851
|
this.el ?? h("div")
|
|
10746
10852
|
);
|
|
10853
|
+
this.el = root;
|
|
10747
10854
|
this._originalChildren = this.el ? Array.from(this.el.childNodes) : null;
|
|
10748
10855
|
this._columns = Array.isArray(this.options.columns) ? this.options.columns.map((column) => ({ ...column })) : [];
|
|
10749
10856
|
this._data = Array.isArray(this.options.data) ? [...this.options.data] : [];
|
|
@@ -10756,6 +10863,11 @@
|
|
|
10756
10863
|
this._editMode = normalizeEditMode(this.options.editMode);
|
|
10757
10864
|
this._edit = null;
|
|
10758
10865
|
this._editMessage = null;
|
|
10866
|
+
this._stacked = false;
|
|
10867
|
+
this._width = null;
|
|
10868
|
+
this._growStep = growStep(this.options.growing);
|
|
10869
|
+
this._rendered = this._growStep ?? Infinity;
|
|
10870
|
+
this._more = null;
|
|
10759
10871
|
this._rovingKey = null;
|
|
10760
10872
|
this._rovingCell = null;
|
|
10761
10873
|
this._rovingMatched = false;
|
|
@@ -10790,6 +10902,7 @@
|
|
|
10790
10902
|
this._renderColumns();
|
|
10791
10903
|
this._renderHeader();
|
|
10792
10904
|
this._renderBody();
|
|
10905
|
+
this._watchWidth();
|
|
10793
10906
|
this.listen(this._tbody, "click", (event) => this._handleBodyClick(event));
|
|
10794
10907
|
this.listen(this._tbody, "dblclick", (event) => this._handleBodyDoubleClick(event));
|
|
10795
10908
|
if (this._editMode !== false) {
|
|
@@ -10823,6 +10936,7 @@
|
|
|
10823
10936
|
* @fires Table#editcancel
|
|
10824
10937
|
*/
|
|
10825
10938
|
setData(rows) {
|
|
10939
|
+
this._rendered = this._growStep ?? Infinity;
|
|
10826
10940
|
this.setLoading(false);
|
|
10827
10941
|
assertRows(rows);
|
|
10828
10942
|
this._data = [...rows];
|
|
@@ -11097,9 +11211,150 @@
|
|
|
11097
11211
|
getEditing() {
|
|
11098
11212
|
return this._edit ? { id: this._edit.id, columnId: this._edit.columnId } : null;
|
|
11099
11213
|
}
|
|
11214
|
+
/**
|
|
11215
|
+
* The rows currently rendered — all of them unless `growing` is on.
|
|
11216
|
+
* @returns {TableRow[]}
|
|
11217
|
+
*/
|
|
11218
|
+
_visibleData() {
|
|
11219
|
+
return this._rendered === Infinity ? this._data : this._data.slice(0, this._rendered);
|
|
11220
|
+
}
|
|
11221
|
+
/**
|
|
11222
|
+
* Renders the next batch of rows.
|
|
11223
|
+
* @param {number} [count] How many to add; defaults to the configured batch size.
|
|
11224
|
+
* @returns {this}
|
|
11225
|
+
* @fires Table#grow
|
|
11226
|
+
*/
|
|
11227
|
+
growBy(count2) {
|
|
11228
|
+
if (!this._growStep) return this;
|
|
11229
|
+
const step = Number(count2) > 0 ? Math.trunc(Number(count2)) : this._growStep;
|
|
11230
|
+
const before = this._rendered;
|
|
11231
|
+
this._rendered = Math.min(this._data.length, this._rendered + step);
|
|
11232
|
+
if (this._rendered === before) return this;
|
|
11233
|
+
this._renderBody();
|
|
11234
|
+
this.emit("grow", { rendered: this._rendered, total: this._data.length });
|
|
11235
|
+
return this;
|
|
11236
|
+
}
|
|
11237
|
+
/**
|
|
11238
|
+
* Renders every remaining row.
|
|
11239
|
+
* @returns {this}
|
|
11240
|
+
* @fires Table#grow
|
|
11241
|
+
*/
|
|
11242
|
+
showAll() {
|
|
11243
|
+
return this.growBy(this._data.length);
|
|
11244
|
+
}
|
|
11245
|
+
/**
|
|
11246
|
+
* How many rows are currently rendered.
|
|
11247
|
+
* @returns {number}
|
|
11248
|
+
*/
|
|
11249
|
+
getRenderedCount() {
|
|
11250
|
+
return Math.min(this._rendered, this._data.length);
|
|
11251
|
+
}
|
|
11252
|
+
/**
|
|
11253
|
+
* Keeps the "show more" control in step with what is rendered.
|
|
11254
|
+
*
|
|
11255
|
+
* The control sits outside the table rather than in a `<tfoot>` row spanning every column: it is
|
|
11256
|
+
* a command, not data, and a button inside the grid would be reachable by the row navigation
|
|
11257
|
+
* keys as though it were a cell.
|
|
11258
|
+
* @returns {void}
|
|
11259
|
+
*/
|
|
11260
|
+
_syncGrowing() {
|
|
11261
|
+
if (!this._growStep) return;
|
|
11262
|
+
const remaining = this._data.length - this.getRenderedCount();
|
|
11263
|
+
if (remaining <= 0) {
|
|
11264
|
+
this._more?.remove();
|
|
11265
|
+
this._more = null;
|
|
11266
|
+
return;
|
|
11267
|
+
}
|
|
11268
|
+
const label = this._message("table.more", "Show %1 more", [remaining]);
|
|
11269
|
+
if (!this._more) {
|
|
11270
|
+
this._more = h("button", {
|
|
11271
|
+
class: "zx-table__more",
|
|
11272
|
+
type: "button",
|
|
11273
|
+
onclick: () => this.growBy()
|
|
11274
|
+
});
|
|
11275
|
+
this.el.append(this._more);
|
|
11276
|
+
}
|
|
11277
|
+
this._more.textContent = label;
|
|
11278
|
+
this._more.setAttribute("aria-label", label);
|
|
11279
|
+
}
|
|
11280
|
+
/**
|
|
11281
|
+
* Resolves a localized message, falling back to a built-in template.
|
|
11282
|
+
* @param {string} key Message key.
|
|
11283
|
+
* @param {string} fallback Template used when the host has no translation.
|
|
11284
|
+
* @param {unknown[]} args Positional interpolation values.
|
|
11285
|
+
* @returns {string}
|
|
11286
|
+
*/
|
|
11287
|
+
_message(key, fallback, args) {
|
|
11288
|
+
const message = this.msg(key, ...args);
|
|
11289
|
+
return message === key ? printf(fallback, args) : message;
|
|
11290
|
+
}
|
|
11291
|
+
/**
|
|
11292
|
+
* Watches the table's own width and stacks the rows below `responsive`.
|
|
11293
|
+
*
|
|
11294
|
+
* The width comes from `onBreakpoint` observing this element rather than the window, which is the
|
|
11295
|
+
* whole point of the option: a table inside a split pane or a modal has no idea how wide the
|
|
11296
|
+
* viewport is, and a media query would stack it on a phone while leaving it unreadable in a
|
|
11297
|
+
* 320px pane on a desktop.
|
|
11298
|
+
* @returns {void}
|
|
11299
|
+
*/
|
|
11300
|
+
_watchWidth() {
|
|
11301
|
+
this._width?.destroy();
|
|
11302
|
+
this._width = null;
|
|
11303
|
+
const threshold = this.options.responsive;
|
|
11304
|
+
if (!threshold || !(threshold in breakpoints)) return;
|
|
11305
|
+
this._width = onBreakpoint(
|
|
11306
|
+
(_name, width) => this._setStacked(width > 0 && width < breakpoints[threshold]),
|
|
11307
|
+
{ target: this.el }
|
|
11308
|
+
);
|
|
11309
|
+
}
|
|
11310
|
+
/**
|
|
11311
|
+
* Enters or leaves stacked mode.
|
|
11312
|
+
* @param {boolean} stacked Whether rows should stack.
|
|
11313
|
+
* @returns {void}
|
|
11314
|
+
* @fires Table#stackedchange
|
|
11315
|
+
*/
|
|
11316
|
+
_setStacked(stacked) {
|
|
11317
|
+
if (this._stacked === stacked) return;
|
|
11318
|
+
this._stacked = stacked;
|
|
11319
|
+
this.el.toggleAttribute("data-stacked", stacked);
|
|
11320
|
+
this._applyStackedRoles(stacked);
|
|
11321
|
+
this.emit("stackedchange", { stacked });
|
|
11322
|
+
}
|
|
11323
|
+
/**
|
|
11324
|
+
* States the table roles explicitly while stacked, and removes them again on the way out.
|
|
11325
|
+
*
|
|
11326
|
+
* Stacking works by changing `display` on the table elements, and a table whose display is not
|
|
11327
|
+
* `table` loses its implicit ARIA roles — leaving a screen reader with a pile of generic blocks
|
|
11328
|
+
* where a table used to be. The roles are only asserted while the layout has taken them away.
|
|
11329
|
+
* @param {boolean} stacked Whether the roles should be present.
|
|
11330
|
+
* @returns {void}
|
|
11331
|
+
*/
|
|
11332
|
+
_applyStackedRoles(stacked) {
|
|
11333
|
+
const parts = [[this._table, "table"], [this._thead, "rowgroup"], [this._tbody, "rowgroup"]];
|
|
11334
|
+
for (const [element, role] of parts) {
|
|
11335
|
+
if (!element) continue;
|
|
11336
|
+
if (stacked) element.setAttribute("role", role);
|
|
11337
|
+
else element.removeAttribute("role");
|
|
11338
|
+
}
|
|
11339
|
+
for (const [selector, role] of [["tr", "row"], ["td", "cell"], ["th", "columnheader"]]) {
|
|
11340
|
+
for (const element of this._table.querySelectorAll(selector)) {
|
|
11341
|
+
if (stacked) element.setAttribute("role", role);
|
|
11342
|
+
else element.removeAttribute("role");
|
|
11343
|
+
}
|
|
11344
|
+
}
|
|
11345
|
+
}
|
|
11346
|
+
/**
|
|
11347
|
+
* Reports whether the rows are currently stacked.
|
|
11348
|
+
* @returns {boolean}
|
|
11349
|
+
*/
|
|
11350
|
+
isStacked() {
|
|
11351
|
+
return Boolean(this._stacked);
|
|
11352
|
+
}
|
|
11100
11353
|
/** Restores an enhanced target and releases all component listeners. @returns {void} */
|
|
11101
11354
|
destroy() {
|
|
11102
11355
|
this._teardownEdit();
|
|
11356
|
+
this._width?.destroy();
|
|
11357
|
+
this._width = null;
|
|
11103
11358
|
if (this.el) delete this.el.dataset.editMode;
|
|
11104
11359
|
if (!this._restored && this._originalChildren) {
|
|
11105
11360
|
this.el.replaceChildren(...this._originalChildren);
|
|
@@ -11127,6 +11382,7 @@
|
|
|
11127
11382
|
/** @returns {void} */
|
|
11128
11383
|
_renderHeader() {
|
|
11129
11384
|
const row2 = h("tr", { class: "zx-table__header-row" });
|
|
11385
|
+
if (this._growStep) row2.setAttribute("aria-rowindex", "1");
|
|
11130
11386
|
if (this.options.selectable === "multi") {
|
|
11131
11387
|
this._selectAll = h("input", {
|
|
11132
11388
|
class: "zx-table__checkbox zx-table__select-all",
|
|
@@ -11140,9 +11396,9 @@
|
|
|
11140
11396
|
row2.append(selectionHeader);
|
|
11141
11397
|
this.listen(this._selectAll, "click", () => {
|
|
11142
11398
|
if (this._selectAll.checked) {
|
|
11143
|
-
for (const dataRow of this.
|
|
11399
|
+
for (const dataRow of this._visibleData()) this._selected.add(this._idFor(dataRow));
|
|
11144
11400
|
} else {
|
|
11145
|
-
this._selected.
|
|
11401
|
+
for (const dataRow of this._visibleData()) this._selected.delete(this._idFor(dataRow));
|
|
11146
11402
|
}
|
|
11147
11403
|
this._selectionAnchorId = null;
|
|
11148
11404
|
this._syncSelection();
|
|
@@ -11184,17 +11440,36 @@
|
|
|
11184
11440
|
this._rovingCell = null;
|
|
11185
11441
|
this._rovingMatched = false;
|
|
11186
11442
|
if (this._data.length === 0) {
|
|
11187
|
-
const text4 = this.options.emptyText == null ? this.msg("table.empty") : String(this.options.emptyText);
|
|
11188
11443
|
fragment.append(h(
|
|
11189
11444
|
"tr",
|
|
11190
11445
|
{ class: "zx-table__empty-row" },
|
|
11191
|
-
h("td", {
|
|
11446
|
+
h("td", {
|
|
11447
|
+
class: "zx-table__empty",
|
|
11448
|
+
colspan: this._columns.length + (this.options.selectable === "multi" ? 1 : 0)
|
|
11449
|
+
}, this._emptyContent())
|
|
11192
11450
|
));
|
|
11193
11451
|
} else {
|
|
11194
|
-
this.
|
|
11452
|
+
this._visibleData().forEach((row2, index) => fragment.append(this._createRow(row2, index)));
|
|
11195
11453
|
}
|
|
11196
11454
|
this._tbody.replaceChildren(fragment);
|
|
11455
|
+
if (this._growStep) this._table.setAttribute("aria-rowcount", String(this._data.length + 1));
|
|
11197
11456
|
this._syncSelectAll();
|
|
11457
|
+
this._syncGrowing();
|
|
11458
|
+
if (this._stacked) this._applyStackedRoles(true);
|
|
11459
|
+
}
|
|
11460
|
+
/**
|
|
11461
|
+
* What to put in the empty row.
|
|
11462
|
+
*
|
|
11463
|
+
* An empty table is a screen in its own right — the place to say why there is nothing and what to
|
|
11464
|
+
* do about it — so this takes a node as readily as a string. A function is re-called on every
|
|
11465
|
+
* render, which matters when the placeholder contains a button: reusing one node would move the
|
|
11466
|
+
* same element between renders and quietly share its listeners.
|
|
11467
|
+
* @returns {Node|string}
|
|
11468
|
+
*/
|
|
11469
|
+
_emptyContent() {
|
|
11470
|
+
const empty = this.options.emptyText;
|
|
11471
|
+
if (empty == null) return this.msg("table.empty");
|
|
11472
|
+
return typeof empty === "function" ? empty() : empty;
|
|
11198
11473
|
}
|
|
11199
11474
|
/** @param {TableRow} row @param {number} index @returns {HTMLTableRowElement} */
|
|
11200
11475
|
_createRow(row2, index) {
|
|
@@ -11203,6 +11478,7 @@
|
|
|
11203
11478
|
/** @type {HTMLTableRowElement} */
|
|
11204
11479
|
h("tr", { dataset: { row: "" } })
|
|
11205
11480
|
);
|
|
11481
|
+
if (this._growStep) tr.setAttribute("aria-rowindex", String(index + 2));
|
|
11206
11482
|
const rowClass = typeof this.options.rowClass === "function" ? this.options.rowClass(row2) : "";
|
|
11207
11483
|
if (rowClass) tr.classList.add(...String(rowClass).split(/\s+/).filter(Boolean));
|
|
11208
11484
|
if (this.options.selectable !== false) tr.setAttribute("aria-selected", String(this._selected.has(id)));
|
|
@@ -11225,6 +11501,8 @@
|
|
|
11225
11501
|
h("td")
|
|
11226
11502
|
);
|
|
11227
11503
|
if (column.align) cell.dataset.align = column.align;
|
|
11504
|
+
cell.dataset.label = column.label;
|
|
11505
|
+
if (column.popin === false) cell.dataset.popin = "false";
|
|
11228
11506
|
if (this._editMode !== false) {
|
|
11229
11507
|
cell.dataset.column = column.id;
|
|
11230
11508
|
if (resolveEditable(column, row2) !== false) {
|
|
@@ -11708,10 +11986,14 @@
|
|
|
11708
11986
|
/** @returns {void} */
|
|
11709
11987
|
_syncSelectAll() {
|
|
11710
11988
|
if (!this._selectAll) return;
|
|
11711
|
-
const
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
11989
|
+
const visible = this._visibleData();
|
|
11990
|
+
const selectedRows = visible.reduce(
|
|
11991
|
+
(count2, row2) => count2 + Number(this._selected.has(this._idFor(row2))),
|
|
11992
|
+
0
|
|
11993
|
+
);
|
|
11994
|
+
this._selectAll.disabled = visible.length === 0;
|
|
11995
|
+
this._selectAll.checked = visible.length > 0 && selectedRows === visible.length;
|
|
11996
|
+
this._selectAll.indeterminate = selectedRows > 0 && selectedRows < visible.length;
|
|
11715
11997
|
}
|
|
11716
11998
|
/** @returns {void} */
|
|
11717
11999
|
_syncSortHeader() {
|
|
@@ -11843,6 +12125,10 @@
|
|
|
11843
12125
|
function sameSet(left, right) {
|
|
11844
12126
|
return left.size === right.size && [...left].every((value) => right.has(value));
|
|
11845
12127
|
}
|
|
12128
|
+
function growStep(growing) {
|
|
12129
|
+
const step = Math.trunc(Number(growing));
|
|
12130
|
+
return Number.isFinite(step) && step > 0 ? step : null;
|
|
12131
|
+
}
|
|
11846
12132
|
|
|
11847
12133
|
// src/elements/reflect.js
|
|
11848
12134
|
var INVALID_ATTRIBUTE = /* @__PURE__ */ Symbol("invalid attribute");
|
|
@@ -21503,6 +21789,12 @@
|
|
|
21503
21789
|
};
|
|
21504
21790
|
var PickerBase = class extends GxWrapper {
|
|
21505
21791
|
static legacyName = "gx.zeyos.DatePicker";
|
|
21792
|
+
/*
|
|
21793
|
+
* A constructor type rather than `typeof ZxDatePicker`: each subclass points this at a different
|
|
21794
|
+
* picker, and inferring the base from its own default would make every subclass's static side
|
|
21795
|
+
* incompatible with it.
|
|
21796
|
+
*/
|
|
21797
|
+
/** @type {new (target: Element|string|null, options?: any) => any} */
|
|
21506
21798
|
static Picker = DatePicker;
|
|
21507
21799
|
/** @param {Element|string|null} display @param {Record<string, any>} [options={}] */
|
|
21508
21800
|
constructor(display, options = {}) {
|
|
@@ -22657,6 +22949,13 @@
|
|
|
22657
22949
|
// src/compat/map/select.js
|
|
22658
22950
|
var SelectBase = class extends GxWrapper {
|
|
22659
22951
|
static legacyName = "gx.zeyos.Select";
|
|
22952
|
+
/*
|
|
22953
|
+
* Widened deliberately: the subclasses below set `'local' | 'async' | 'priority' | 'rest'`, and
|
|
22954
|
+
* a static field annotated with that union would still clash with the `string` each subclass
|
|
22955
|
+
* infers from its own literal. The static sides have to agree or the emitted declarations do
|
|
22956
|
+
* not type-check for a consumer running without `skipLibCheck`.
|
|
22957
|
+
*/
|
|
22958
|
+
/** @type {string|false} */
|
|
22660
22959
|
static filterMode = false;
|
|
22661
22960
|
/** @param {Element|string|null} display @param {Record<string, any>} [options={}] */
|
|
22662
22961
|
constructor(display, options = {}) {
|