@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
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
import { Field } from '../field/field.js';
|
|
3
|
+
export type FieldsetOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Legend text.
|
|
6
|
+
*/
|
|
7
|
+
title?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Grid column count.
|
|
10
|
+
*/
|
|
11
|
+
columns?: 1 | 2 | 3;
|
|
12
|
+
/**
|
|
13
|
+
* Initial fields.
|
|
14
|
+
*/
|
|
15
|
+
fields?: Record<string, FieldOptions | Field | Element | Component>;
|
|
16
|
+
};
|
|
17
|
+
export type FieldOptions = import('../field/field.js').FieldOptions;
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {Object} FieldsetOptions
|
|
20
|
+
* @property {string} [title=''] Legend text.
|
|
21
|
+
* @property {1|2|3} [columns=1] Grid column count.
|
|
22
|
+
* @property {Record<string, FieldOptions|Field|Element|Component>} [fields={}] Initial fields.
|
|
23
|
+
*/
|
|
24
|
+
/** @typedef {import('../field/field.js').FieldOptions} FieldOptions */
|
|
25
|
+
/**
|
|
26
|
+
* Native fieldset that owns and coordinates labelled fields.
|
|
27
|
+
* @extends {Component<FieldsetOptions>}
|
|
28
|
+
*/
|
|
29
|
+
export declare class Fieldset extends Component<FieldsetOptions> {
|
|
30
|
+
_fields: Map<any, any>;
|
|
31
|
+
_ownedFields: Set<any>;
|
|
32
|
+
_origins: Map<any, any>;
|
|
33
|
+
_fieldIdAttributes: Map<any, any>;
|
|
34
|
+
_ownedNodes: any[];
|
|
35
|
+
_columnAttribute: string;
|
|
36
|
+
_grid: HTMLElement;
|
|
37
|
+
static cssName: string;
|
|
38
|
+
/** @type {FieldsetOptions} */
|
|
39
|
+
static defaults: FieldsetOptions;
|
|
40
|
+
/** @returns {HTMLElement} */
|
|
41
|
+
render(): HTMLElement;
|
|
42
|
+
/**
|
|
43
|
+
* Adds a field from options, an existing field, an element, or a component.
|
|
44
|
+
* @param {string} id Logical field identifier.
|
|
45
|
+
* @param {FieldOptions|Field|Element|Component} field Field source.
|
|
46
|
+
* @returns {Field}
|
|
47
|
+
*/
|
|
48
|
+
addField(id: string, field: FieldOptions | Field | Element | Component): Field;
|
|
49
|
+
/**
|
|
50
|
+
* Returns a field by logical identifier.
|
|
51
|
+
* @param {string} id Field identifier.
|
|
52
|
+
* @returns {Field|null}
|
|
53
|
+
*/
|
|
54
|
+
getField(id: string): Field | null;
|
|
55
|
+
/**
|
|
56
|
+
* Reports whether a field exists.
|
|
57
|
+
* @param {string} id Field identifier.
|
|
58
|
+
* @returns {boolean}
|
|
59
|
+
*/
|
|
60
|
+
hasField(id: string): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the fields keyed by logical identifier.
|
|
63
|
+
* @returns {Record<string, Field>}
|
|
64
|
+
*/
|
|
65
|
+
getFields(): Record<string, Field>;
|
|
66
|
+
/**
|
|
67
|
+
* Returns all field values.
|
|
68
|
+
* @returns {Record<string, unknown>}
|
|
69
|
+
*/
|
|
70
|
+
getValues(): Record<string, unknown>;
|
|
71
|
+
/**
|
|
72
|
+
* Sets matching field values.
|
|
73
|
+
* @param {Record<string, unknown>} values Values keyed by field identifier.
|
|
74
|
+
* @param {{silent?: boolean}} [options={}] Set `silent` to suppress field change events.
|
|
75
|
+
* @returns {this}
|
|
76
|
+
*/
|
|
77
|
+
setValues(values: Record<string, unknown>, { silent }?: {
|
|
78
|
+
silent?: boolean;
|
|
79
|
+
}): this;
|
|
80
|
+
/**
|
|
81
|
+
* Returns one field value.
|
|
82
|
+
* @param {string} id Field identifier.
|
|
83
|
+
* @returns {unknown}
|
|
84
|
+
*/
|
|
85
|
+
getValue(id: string): unknown;
|
|
86
|
+
/**
|
|
87
|
+
* Sets one field value.
|
|
88
|
+
* @param {string} id Field identifier.
|
|
89
|
+
* @param {unknown} value New value.
|
|
90
|
+
* @returns {this}
|
|
91
|
+
*/
|
|
92
|
+
setValue(id: string, value: unknown): this;
|
|
93
|
+
/**
|
|
94
|
+
* Restores every field to its initial value.
|
|
95
|
+
* @returns {this}
|
|
96
|
+
*/
|
|
97
|
+
reset(): this;
|
|
98
|
+
/**
|
|
99
|
+
* Removes every field from this fieldset.
|
|
100
|
+
* @returns {this}
|
|
101
|
+
*/
|
|
102
|
+
clear(): this;
|
|
103
|
+
/**
|
|
104
|
+
* Focuses one field.
|
|
105
|
+
* @param {string} id Field identifier.
|
|
106
|
+
* @returns {this}
|
|
107
|
+
*/
|
|
108
|
+
focus(id: string): this;
|
|
109
|
+
/**
|
|
110
|
+
* Applies messages to matching fields and clears unspecified highlights.
|
|
111
|
+
* @param {Record<string, string>} highlights Messages keyed by field identifier.
|
|
112
|
+
* @param {'danger'|'warning'|'success'} [kind='danger'] Highlight kind.
|
|
113
|
+
* @returns {number}
|
|
114
|
+
*/
|
|
115
|
+
setHighlights(highlights?: Record<string, string>, kind?: 'danger' | 'warning' | 'success'): number;
|
|
116
|
+
/**
|
|
117
|
+
* Clears every field highlight.
|
|
118
|
+
* @returns {this}
|
|
119
|
+
*/
|
|
120
|
+
clearHighlights(): this;
|
|
121
|
+
/** @param {Field} field @returns {void} */
|
|
122
|
+
_releaseField(field: Field): void;
|
|
123
|
+
/** @returns {void} */
|
|
124
|
+
destroy(): void;
|
|
125
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type TreeNode = import('../tree/hierarchy.js').TreeNode;
|
|
3
|
+
export type FinderOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Nested nodes.
|
|
6
|
+
*/
|
|
7
|
+
items?: TreeNode[];
|
|
8
|
+
/**
|
|
9
|
+
* Node ID property or reader.
|
|
10
|
+
*/
|
|
11
|
+
valueKey?: string | ((node: TreeNode) => unknown);
|
|
12
|
+
/**
|
|
13
|
+
* Node label property or reader.
|
|
14
|
+
*/
|
|
15
|
+
labelKey?: string | ((node: TreeNode) => string);
|
|
16
|
+
/**
|
|
17
|
+
* Property holding child nodes.
|
|
18
|
+
*/
|
|
19
|
+
childrenKey?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Initially selected node IDs, from the root down.
|
|
22
|
+
*/
|
|
23
|
+
path?: unknown[];
|
|
24
|
+
/**
|
|
25
|
+
* Lazy child loader.
|
|
26
|
+
*/
|
|
27
|
+
load?: ((node: TreeNode) => Promise<TreeNode[]> | TreeNode[]) | null;
|
|
28
|
+
/**
|
|
29
|
+
* Renderer for the leaf preview pane.
|
|
30
|
+
*/
|
|
31
|
+
preview?: ((node: TreeNode) => Node | string | null) | null;
|
|
32
|
+
/**
|
|
33
|
+
* Accessible name of the first column.
|
|
34
|
+
*/
|
|
35
|
+
rootLabel?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Column width in pixels.
|
|
38
|
+
*/
|
|
39
|
+
columnWidth?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Component height in pixels or any CSS length.
|
|
42
|
+
*/
|
|
43
|
+
height?: number | string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Whether to render folder and file icons.
|
|
46
|
+
*/
|
|
47
|
+
icons?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Row renderer.
|
|
50
|
+
*/
|
|
51
|
+
renderItem?: ((node: TreeNode) => Node | string) | null;
|
|
52
|
+
/**
|
|
53
|
+
* Text shown in an empty column.
|
|
54
|
+
*/
|
|
55
|
+
emptyText?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Localized messages.
|
|
58
|
+
*/
|
|
59
|
+
msg?: Record<string, string> | Record<string, Record<string, string>>;
|
|
60
|
+
/**
|
|
61
|
+
* Path listener.
|
|
62
|
+
*/
|
|
63
|
+
onchange?: (event: CustomEvent<{
|
|
64
|
+
path: unknown[];
|
|
65
|
+
nodes: TreeNode[];
|
|
66
|
+
node: TreeNode | null;
|
|
67
|
+
}>) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Activation listener.
|
|
70
|
+
*/
|
|
71
|
+
onactivate?: (event: CustomEvent<{
|
|
72
|
+
node: TreeNode;
|
|
73
|
+
id: unknown;
|
|
74
|
+
}>) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Loader-failure listener.
|
|
77
|
+
*/
|
|
78
|
+
onerror?: (event: CustomEvent<{
|
|
79
|
+
error: Error;
|
|
80
|
+
node: TreeNode;
|
|
81
|
+
id: unknown;
|
|
82
|
+
}>) => void;
|
|
83
|
+
};
|
|
84
|
+
/** @typedef {import('../tree/hierarchy.js').TreeNode} TreeNode */
|
|
85
|
+
/**
|
|
86
|
+
* @typedef {Object} FinderOptions
|
|
87
|
+
* @property {TreeNode[]} [items=[]] Nested nodes.
|
|
88
|
+
* @property {string|((node: TreeNode) => unknown)} [valueKey='ID'] Node ID property or reader.
|
|
89
|
+
* @property {string|((node: TreeNode) => string)} [labelKey='name'] Node label property or reader.
|
|
90
|
+
* @property {string} [childrenKey='children'] Property holding child nodes.
|
|
91
|
+
* @property {unknown[]} [path=[]] Initially selected node IDs, from the root down.
|
|
92
|
+
* @property {((node: TreeNode) => Promise<TreeNode[]>|TreeNode[])|null} [load=null] Lazy child loader.
|
|
93
|
+
* @property {((node: TreeNode) => Node|string|null)|null} [preview=null] Renderer for the leaf preview pane.
|
|
94
|
+
* @property {string} [rootLabel=''] Accessible name of the first column.
|
|
95
|
+
* @property {number} [columnWidth=220] Column width in pixels.
|
|
96
|
+
* @property {number|string|null} [height=320] Component height in pixels or any CSS length.
|
|
97
|
+
* @property {boolean} [icons=true] Whether to render folder and file icons.
|
|
98
|
+
* @property {((node: TreeNode) => Node|string)|null} [renderItem=null] Row renderer.
|
|
99
|
+
* @property {string} [emptyText='Empty'] Text shown in an empty column.
|
|
100
|
+
* @property {Record<string, string>|Record<string, Record<string, string>>} [msg] Localized messages.
|
|
101
|
+
* @property {(event: CustomEvent<{path: unknown[], nodes: TreeNode[], node: TreeNode|null}>) => void} [onchange] Path listener.
|
|
102
|
+
* @property {(event: CustomEvent<{node: TreeNode, id: unknown}>) => void} [onactivate] Activation listener.
|
|
103
|
+
* @property {(event: CustomEvent<{error: Error, node: TreeNode, id: unknown}>) => void} [onerror] Loader-failure listener.
|
|
104
|
+
*/
|
|
105
|
+
/**
|
|
106
|
+
* Miller-columns hierarchy browser: each column lists the children of the row selected in the
|
|
107
|
+
* column to its left, the way the macOS Finder's column view works.
|
|
108
|
+
*
|
|
109
|
+
* Columns are linked listboxes with a single roving tab stop across the whole component: Up and
|
|
110
|
+
* Down move inside a column, Right steps into the selection's children, Left steps back.
|
|
111
|
+
*
|
|
112
|
+
* @fires Finder#change
|
|
113
|
+
* @fires Finder#activate
|
|
114
|
+
* @fires Finder#error
|
|
115
|
+
* @extends {Component<FinderOptions>}
|
|
116
|
+
*/
|
|
117
|
+
export declare class Finder extends Component<FinderOptions> {
|
|
118
|
+
_items: any[] | import("../tree/hierarchy.js").TreeNode[];
|
|
119
|
+
_path: any[];
|
|
120
|
+
_columns: any[] | {
|
|
121
|
+
nodes: TreeNode[];
|
|
122
|
+
selectedId: unknown;
|
|
123
|
+
owner: TreeNode | null;
|
|
124
|
+
}[];
|
|
125
|
+
_activeColumn: any;
|
|
126
|
+
/** @type {Map<unknown, Promise<void>>} In-flight lazy loads, keyed by node ID. */
|
|
127
|
+
_loading: Map<unknown, Promise<void>>;
|
|
128
|
+
_pathSequence: any;
|
|
129
|
+
_createdRoot: boolean;
|
|
130
|
+
_snapshot: import("../../core/dom.js").TargetSnapshot;
|
|
131
|
+
_readers: import("../tree/hierarchy.js").NodeReaders;
|
|
132
|
+
_childrenKey: string;
|
|
133
|
+
_handleTypeahead: (event: KeyboardEvent | string) => void;
|
|
134
|
+
static cssName: string;
|
|
135
|
+
/** @type {FinderOptions} */
|
|
136
|
+
static defaults: FinderOptions;
|
|
137
|
+
/** @returns {HTMLElement} */
|
|
138
|
+
render(): HTMLElement;
|
|
139
|
+
/**
|
|
140
|
+
* Returns the selected IDs from the root down.
|
|
141
|
+
* @returns {unknown[]}
|
|
142
|
+
*/
|
|
143
|
+
getPath(): unknown[];
|
|
144
|
+
/**
|
|
145
|
+
* Returns the selected nodes from the root down.
|
|
146
|
+
* @returns {TreeNode[]}
|
|
147
|
+
*/
|
|
148
|
+
getNodes(): TreeNode[];
|
|
149
|
+
/**
|
|
150
|
+
* Returns the deepest selected node.
|
|
151
|
+
* @returns {TreeNode|null}
|
|
152
|
+
*/
|
|
153
|
+
getSelection(): TreeNode | null;
|
|
154
|
+
/**
|
|
155
|
+
* Selects a path, loading every branch along it.
|
|
156
|
+
* @param {unknown[]} ids Node IDs from the root down.
|
|
157
|
+
* @param {{silent?: boolean, focus?: boolean}} [options={}] Behavior.
|
|
158
|
+
* @returns {Promise<this>}
|
|
159
|
+
* @fires Finder#change
|
|
160
|
+
*/
|
|
161
|
+
setPath(ids: unknown[], { silent, focus }?: {
|
|
162
|
+
silent?: boolean;
|
|
163
|
+
focus?: boolean;
|
|
164
|
+
}): Promise<this>;
|
|
165
|
+
/**
|
|
166
|
+
* Reveals and selects a node anywhere in the tree.
|
|
167
|
+
* @param {unknown} id Node ID.
|
|
168
|
+
* @param {{silent?: boolean}} [options={}] Behavior.
|
|
169
|
+
* @returns {Promise<this>}
|
|
170
|
+
*/
|
|
171
|
+
reveal(id: unknown, { silent }?: {
|
|
172
|
+
silent?: boolean;
|
|
173
|
+
}): Promise<this>;
|
|
174
|
+
/**
|
|
175
|
+
* Replaces the whole hierarchy and clears the path.
|
|
176
|
+
* @param {TreeNode[]} items Nested nodes.
|
|
177
|
+
* @returns {this}
|
|
178
|
+
*/
|
|
179
|
+
setItems(items: TreeNode[]): this;
|
|
180
|
+
/** Focuses the active column. @returns {this} */
|
|
181
|
+
focus(): this;
|
|
182
|
+
/**
|
|
183
|
+
* Rebuilds every column from the current path.
|
|
184
|
+
* @param {{focus?: boolean}} options Behavior.
|
|
185
|
+
* @returns {void}
|
|
186
|
+
*/
|
|
187
|
+
_render({ focus }: {
|
|
188
|
+
focus?: boolean;
|
|
189
|
+
}): void;
|
|
190
|
+
/**
|
|
191
|
+
* @param {{nodes: TreeNode[], selectedId: unknown, owner: TreeNode|null}} column Column spec.
|
|
192
|
+
* @param {number} index Column index.
|
|
193
|
+
* @returns {HTMLElement}
|
|
194
|
+
*/
|
|
195
|
+
_renderColumn(column: {
|
|
196
|
+
nodes: TreeNode[];
|
|
197
|
+
selectedId: unknown;
|
|
198
|
+
owner: TreeNode | null;
|
|
199
|
+
}, index: number): HTMLElement;
|
|
200
|
+
/** Keeps exactly one tab stop across all columns. @returns {void} */
|
|
201
|
+
_syncTabStop(): void;
|
|
202
|
+
/** @param {MouseEvent} event @returns {void} */
|
|
203
|
+
_onClick(event: MouseEvent): void;
|
|
204
|
+
/** @param {MouseEvent} event @returns {void} */
|
|
205
|
+
_onDoubleClick(event: MouseEvent): void;
|
|
206
|
+
/** @param {KeyboardEvent} event @returns {void} */
|
|
207
|
+
_onKeydown(event: KeyboardEvent): void;
|
|
208
|
+
/**
|
|
209
|
+
* Selects a row in a column, truncating the path below it.
|
|
210
|
+
* @param {number} column Column index.
|
|
211
|
+
* @param {number} index Row index inside the column.
|
|
212
|
+
* @param {{focus?: boolean}} [options={}] Behavior.
|
|
213
|
+
* @returns {Promise<void>}
|
|
214
|
+
* @fires Finder#change
|
|
215
|
+
*/
|
|
216
|
+
_selectAt(column: number, index: number, { focus }?: {
|
|
217
|
+
focus?: boolean;
|
|
218
|
+
}): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Moves into a branch's children column.
|
|
221
|
+
* @param {number} column Column index.
|
|
222
|
+
* @param {number} index Row index.
|
|
223
|
+
* @returns {Promise<void>}
|
|
224
|
+
*/
|
|
225
|
+
_enter(column: number, index: number): Promise<void>;
|
|
226
|
+
/**
|
|
227
|
+
* Loads a branch's children through the configured loader, once.
|
|
228
|
+
* @param {TreeNode} node Branch node.
|
|
229
|
+
* @returns {Promise<void>}
|
|
230
|
+
*/
|
|
231
|
+
_ensureChildren(node: TreeNode): Promise<void>;
|
|
232
|
+
/** @param {number} column @returns {TreeNode[]} */
|
|
233
|
+
_columnNodes(column: number): TreeNode[];
|
|
234
|
+
/** @param {Element} row @returns {{column: number, index: number}} */
|
|
235
|
+
_locate(row: Element): {
|
|
236
|
+
column: number;
|
|
237
|
+
index: number;
|
|
238
|
+
};
|
|
239
|
+
/** @param {number} column @param {number} index @returns {HTMLElement|null} */
|
|
240
|
+
_rowAt(column: number, index: number): HTMLElement | null;
|
|
241
|
+
/** @param {number} column @returns {HTMLElement|null} */
|
|
242
|
+
_activeRow(column: number): HTMLElement | null;
|
|
243
|
+
/** @returns {void} */
|
|
244
|
+
_emitChange(): void;
|
|
245
|
+
/** @param {string} key @param {string} fallback @returns {string} */
|
|
246
|
+
_message(key: string, fallback: string): string;
|
|
247
|
+
/** Restores an enhanced target to the markup it had before the takeover. @returns {void} */
|
|
248
|
+
destroy(): void;
|
|
249
|
+
}
|
|
250
|
+
/** Path change. @event Finder#change @type {CustomEvent<{path: unknown[], nodes: TreeNode[], node: TreeNode|null}>} */
|
|
251
|
+
/** Leaf activated by Enter or double-click. @event Finder#activate @type {CustomEvent<{node: TreeNode, id: unknown}>} */
|
|
252
|
+
/** A lazy loader rejected. @event Finder#error @type {CustomEvent<{error: Error, node: TreeNode, id: unknown}>} */
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
import { Fieldset } from '../fieldset/fieldset.js';
|
|
3
|
+
export type FormAction = {
|
|
4
|
+
/**
|
|
5
|
+
* Action identifier.
|
|
6
|
+
*/
|
|
7
|
+
id?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Button text.
|
|
10
|
+
*/
|
|
11
|
+
label?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Kernel icon name.
|
|
14
|
+
*/
|
|
15
|
+
icon?: string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Visual intent.
|
|
18
|
+
*/
|
|
19
|
+
kind?: 'default' | 'primary' | 'danger' | 'ghost';
|
|
20
|
+
/**
|
|
21
|
+
* Button size.
|
|
22
|
+
*/
|
|
23
|
+
size?: 'md' | 'sm';
|
|
24
|
+
/**
|
|
25
|
+
* Native button type.
|
|
26
|
+
*/
|
|
27
|
+
type?: 'button' | 'submit' | 'reset';
|
|
28
|
+
/**
|
|
29
|
+
* Disabled state.
|
|
30
|
+
*/
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Native button title.
|
|
34
|
+
*/
|
|
35
|
+
title?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Click callback.
|
|
38
|
+
*/
|
|
39
|
+
onClick?: (event: MouseEvent, form: Form) => void;
|
|
40
|
+
};
|
|
41
|
+
export type FormOptions = {
|
|
42
|
+
/**
|
|
43
|
+
* Initial fieldsets.
|
|
44
|
+
*/
|
|
45
|
+
fieldsets?: Array<Fieldset | import('../fieldset/fieldset.js').FieldsetOptions>;
|
|
46
|
+
/**
|
|
47
|
+
* Form action descriptors.
|
|
48
|
+
*/
|
|
49
|
+
actions?: FormAction[];
|
|
50
|
+
/**
|
|
51
|
+
* Native `novalidate` state.
|
|
52
|
+
*/
|
|
53
|
+
novalidate?: boolean;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* @typedef {Object} FormAction
|
|
57
|
+
* @property {string} [id] Action identifier.
|
|
58
|
+
* @property {string} [label] Button text.
|
|
59
|
+
* @property {string|null} [icon=null] Kernel icon name.
|
|
60
|
+
* @property {'default'|'primary'|'danger'|'ghost'} [kind='default'] Visual intent.
|
|
61
|
+
* @property {'md'|'sm'} [size='md'] Button size.
|
|
62
|
+
* @property {'button'|'submit'|'reset'} [type='button'] Native button type.
|
|
63
|
+
* @property {boolean} [disabled=false] Disabled state.
|
|
64
|
+
* @property {string} [title] Native button title.
|
|
65
|
+
* @property {(event: MouseEvent, form: Form) => void} [onClick] Click callback.
|
|
66
|
+
*/
|
|
67
|
+
/**
|
|
68
|
+
* @typedef {Object} FormOptions
|
|
69
|
+
* @property {Array<Fieldset|import('../fieldset/fieldset.js').FieldsetOptions>} [fieldsets=[]] Initial fieldsets.
|
|
70
|
+
* @property {FormAction[]} [actions=[]] Form action descriptors.
|
|
71
|
+
* @property {boolean} [novalidate=true] Native `novalidate` state.
|
|
72
|
+
*/
|
|
73
|
+
/**
|
|
74
|
+
* Real form element coordinating fieldsets, validation, and actions.
|
|
75
|
+
* @fires Form#submit
|
|
76
|
+
* @fires Form#invalid
|
|
77
|
+
* @fires Form#change
|
|
78
|
+
* @extends {Component<FormOptions>}
|
|
79
|
+
*/
|
|
80
|
+
export declare class Form extends Component<FormOptions> {
|
|
81
|
+
_fieldsets: any[];
|
|
82
|
+
_ownedFieldsets: Set<any>;
|
|
83
|
+
_origins: Map<any, any>;
|
|
84
|
+
_ownedNodes: any[];
|
|
85
|
+
_novalidateAttribute: string;
|
|
86
|
+
_body: HTMLElement;
|
|
87
|
+
_actions: HTMLElement;
|
|
88
|
+
_actionDescriptors: {
|
|
89
|
+
id?: string;
|
|
90
|
+
label?: string;
|
|
91
|
+
icon?: string | null;
|
|
92
|
+
kind?: 'default' | 'primary' | 'danger' | 'ghost';
|
|
93
|
+
size?: 'md' | 'sm';
|
|
94
|
+
type?: 'button' | 'submit' | 'reset';
|
|
95
|
+
disabled?: boolean;
|
|
96
|
+
title?: string;
|
|
97
|
+
onClick?: (event: MouseEvent, form: Form) => void;
|
|
98
|
+
}[];
|
|
99
|
+
static cssName: string;
|
|
100
|
+
/** @type {FormOptions & {msg: Record<string, string>}} */
|
|
101
|
+
static defaults: FormOptions & {
|
|
102
|
+
msg: Record<string, string>;
|
|
103
|
+
};
|
|
104
|
+
/** @returns {HTMLElement} */
|
|
105
|
+
render(): HTMLElement;
|
|
106
|
+
/**
|
|
107
|
+
* Adds an existing fieldset or constructs one from options.
|
|
108
|
+
* @param {Fieldset|import('../fieldset/fieldset.js').FieldsetOptions} fieldset Fieldset source.
|
|
109
|
+
* @returns {Fieldset}
|
|
110
|
+
*/
|
|
111
|
+
addFieldset(fieldset: Fieldset | import('../fieldset/fieldset.js').FieldsetOptions): Fieldset;
|
|
112
|
+
/**
|
|
113
|
+
* Replaces the rendered action buttons.
|
|
114
|
+
* @param {FormAction[]} list Button descriptors.
|
|
115
|
+
* @returns {this}
|
|
116
|
+
*/
|
|
117
|
+
setActions(list: FormAction[]): this;
|
|
118
|
+
/**
|
|
119
|
+
* Returns all values merged in fieldset order.
|
|
120
|
+
* @returns {Record<string, unknown>}
|
|
121
|
+
*/
|
|
122
|
+
getValues(): Record<string, unknown>;
|
|
123
|
+
/**
|
|
124
|
+
* Sets matching values across all fieldsets.
|
|
125
|
+
* @param {Record<string, unknown>} values Values keyed by field identifier.
|
|
126
|
+
* @param {{silent?: boolean}} [options={}] Set `silent` to suppress field change events.
|
|
127
|
+
* @returns {this}
|
|
128
|
+
*/
|
|
129
|
+
setValues(values: Record<string, unknown>, { silent }?: {
|
|
130
|
+
silent?: boolean;
|
|
131
|
+
}): this;
|
|
132
|
+
/**
|
|
133
|
+
* Returns the first matching field.
|
|
134
|
+
* @param {string} id Field identifier.
|
|
135
|
+
* @returns {import('../field/field.js').Field|null}
|
|
136
|
+
*/
|
|
137
|
+
getField(id: string): import('../field/field.js').Field | null;
|
|
138
|
+
/**
|
|
139
|
+
* Sets one matching field value.
|
|
140
|
+
* @param {string} id Field identifier.
|
|
141
|
+
* @param {unknown} value New value.
|
|
142
|
+
* @returns {this}
|
|
143
|
+
*/
|
|
144
|
+
setValue(id: string, value: unknown): this;
|
|
145
|
+
/**
|
|
146
|
+
* Returns one matching field value.
|
|
147
|
+
* @param {string} id Field identifier.
|
|
148
|
+
* @returns {unknown}
|
|
149
|
+
*/
|
|
150
|
+
getValue(id: string): unknown;
|
|
151
|
+
/**
|
|
152
|
+
* Resets all fieldsets and highlights.
|
|
153
|
+
* @returns {this}
|
|
154
|
+
*/
|
|
155
|
+
reset(): this;
|
|
156
|
+
/**
|
|
157
|
+
* Applies field highlights across all fieldsets.
|
|
158
|
+
* @param {Record<string, string>} highlights Messages keyed by field identifier.
|
|
159
|
+
* @param {'danger'|'warning'|'success'} [kind='danger'] Highlight kind.
|
|
160
|
+
* @returns {number}
|
|
161
|
+
*/
|
|
162
|
+
setHighlights(highlights: Record<string, string>, kind?: 'danger' | 'warning' | 'success'): number;
|
|
163
|
+
/**
|
|
164
|
+
* Clears all field highlights.
|
|
165
|
+
* @returns {this}
|
|
166
|
+
*/
|
|
167
|
+
clearHighlights(): this;
|
|
168
|
+
/**
|
|
169
|
+
* Validates and emits a preventable submit event.
|
|
170
|
+
* @returns {boolean} True when valid and not prevented.
|
|
171
|
+
* @fires Form#submit
|
|
172
|
+
* @fires Form#invalid
|
|
173
|
+
*/
|
|
174
|
+
submit(): boolean;
|
|
175
|
+
/** @param {Event} event @returns {void} */
|
|
176
|
+
_handleAction(event: Event): void;
|
|
177
|
+
/** @returns {void} */
|
|
178
|
+
destroy(): void;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Successful form submission event.
|
|
182
|
+
* @event Form#submit
|
|
183
|
+
* @type {CustomEvent<{values: Record<string, unknown>}>
|
|
184
|
+
*/
|
|
185
|
+
/**
|
|
186
|
+
* Form validation failure event.
|
|
187
|
+
* @event Form#invalid
|
|
188
|
+
* @type {CustomEvent<{errors: Record<string, string>}>
|
|
189
|
+
*/
|
|
190
|
+
/**
|
|
191
|
+
* Delegated field value change event.
|
|
192
|
+
* @event Form#change
|
|
193
|
+
* @type {CustomEvent<{id: string, value: unknown}>
|
|
194
|
+
*/
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type GroupboxOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Section title.
|
|
5
|
+
*/
|
|
6
|
+
title?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Initial expanded state.
|
|
9
|
+
*/
|
|
10
|
+
open?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Open callback.
|
|
13
|
+
*/
|
|
14
|
+
onopen?: (event: CustomEvent<Record<string, never>>) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Close callback.
|
|
17
|
+
*/
|
|
18
|
+
onclose?: (event: CustomEvent<Record<string, never>>) => void;
|
|
19
|
+
};
|
|
20
|
+
export type GroupboxContent = string | Node | Component;
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {Object} GroupboxOptions
|
|
23
|
+
* @property {string} [title=''] Section title.
|
|
24
|
+
* @property {boolean} [open=true] Initial expanded state.
|
|
25
|
+
* @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open callback.
|
|
26
|
+
* @property {(event: CustomEvent<Record<string, never>>) => void} [onclose] Close callback.
|
|
27
|
+
*/
|
|
28
|
+
/** @typedef {string|Node|Component} GroupboxContent */
|
|
29
|
+
/**
|
|
30
|
+
* Collapsible section backed by native details and summary elements.
|
|
31
|
+
* @fires Groupbox#open
|
|
32
|
+
* @fires Groupbox#close
|
|
33
|
+
* @extends {Component<GroupboxOptions>}
|
|
34
|
+
*/
|
|
35
|
+
export declare class Groupbox extends Component<GroupboxOptions> {
|
|
36
|
+
_adoption: any;
|
|
37
|
+
_createdRoot: boolean;
|
|
38
|
+
_original: {
|
|
39
|
+
attributes: [string, string][];
|
|
40
|
+
children: Node[];
|
|
41
|
+
};
|
|
42
|
+
_lastOpen: any;
|
|
43
|
+
_cleaned: boolean;
|
|
44
|
+
static cssName: string;
|
|
45
|
+
/** @type {Readonly<GroupboxOptions>} */
|
|
46
|
+
static defaults: Readonly<GroupboxOptions>;
|
|
47
|
+
/**
|
|
48
|
+
* Creates or adopts a native details section.
|
|
49
|
+
* @param {Element|string|null} target Existing details, plain container, selector, or null.
|
|
50
|
+
* @param {GroupboxOptions} [options={}] Groupbox options.
|
|
51
|
+
*/
|
|
52
|
+
constructor(target: Element | string | null, options?: GroupboxOptions);
|
|
53
|
+
/** @returns {HTMLDetailsElement} */
|
|
54
|
+
render(): HTMLDetailsElement;
|
|
55
|
+
/**
|
|
56
|
+
* Expands the section.
|
|
57
|
+
* @returns {this}
|
|
58
|
+
*/
|
|
59
|
+
open(): this;
|
|
60
|
+
/**
|
|
61
|
+
* Collapses the section.
|
|
62
|
+
* @returns {this}
|
|
63
|
+
*/
|
|
64
|
+
close(): this;
|
|
65
|
+
/**
|
|
66
|
+
* Toggles the section.
|
|
67
|
+
* @returns {this}
|
|
68
|
+
*/
|
|
69
|
+
toggle(): this;
|
|
70
|
+
/**
|
|
71
|
+
* Reports whether the section is expanded.
|
|
72
|
+
* @returns {boolean}
|
|
73
|
+
*/
|
|
74
|
+
isOpen(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Replaces the visible title.
|
|
77
|
+
* @param {string} title Next title.
|
|
78
|
+
* @returns {this}
|
|
79
|
+
*/
|
|
80
|
+
setTitle(title: string): this;
|
|
81
|
+
/**
|
|
82
|
+
* Replaces the section body.
|
|
83
|
+
* @param {GroupboxContent} content Next text, node, or component.
|
|
84
|
+
* @returns {this}
|
|
85
|
+
*/
|
|
86
|
+
setContent(content: GroupboxContent): this;
|
|
87
|
+
/** @returns {void} */
|
|
88
|
+
destroy(): void;
|
|
89
|
+
}
|