@zeyos/zx 4.3.4 → 5.0.0
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 +438 -0
- package/README.md +49 -10
- package/dist/types/components/activity-item/activity-item.d.ts +351 -0
- package/dist/types/components/activity-list/activity-list.d.ts +217 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -3
- package/dist/types/components/avatar/avatar.d.ts +46 -7
- package/dist/types/components/badge/badge.d.ts +21 -1
- package/dist/types/components/button/button.d.ts +23 -0
- package/dist/types/components/calendar/calendar.d.ts +19 -0
- package/dist/types/components/card/card.d.ts +7 -0
- package/dist/types/components/card-view/card-view.d.ts +11 -3
- package/dist/types/components/card-view/record-card.d.ts +7 -1
- package/dist/types/components/chart/chart.d.ts +10 -0
- package/dist/types/components/checklist/checklist.d.ts +9 -0
- package/dist/types/components/code-editor/code-editor.d.ts +149 -0
- package/dist/types/components/code-editor/field-adapter.d.ts +5 -0
- package/dist/types/components/context-menu/context-menu.d.ts +18 -2
- package/dist/types/components/date-picker/date-picker.d.ts +8 -0
- package/dist/types/components/date-picker/time-picker.d.ts +7 -0
- package/dist/types/components/datebox/date-range-box.d.ts +5 -1
- package/dist/types/components/datebox/datebox.d.ts +7 -2
- package/dist/types/components/dialog/dialog.d.ts +75 -6
- package/dist/types/components/dropdown/dropdown.d.ts +2 -2
- package/dist/types/components/entity-ref/entity-ref.d.ts +331 -0
- package/dist/types/components/field/field.d.ts +24 -2
- package/dist/types/components/fieldset/fieldset.d.ts +19 -1
- package/dist/types/components/file-item/file-item.d.ts +262 -0
- package/dist/types/components/file-list/file-list.d.ts +171 -0
- package/dist/types/components/filter/filter.d.ts +91 -36
- package/dist/types/components/filter-panel/filter-panel.d.ts +449 -0
- package/dist/types/components/form/form.d.ts +12 -1
- package/dist/types/components/kanban-view/kanban-card.d.ts +146 -0
- package/dist/types/components/kanban-view/kanban-view.d.ts +170 -4
- package/dist/types/components/launcher/launcher.d.ts +278 -26
- package/dist/types/components/list-toolbar/list-toolbar.d.ts +599 -0
- package/dist/types/components/menu-button/menu-button.d.ts +37 -42
- package/dist/types/components/message/message.d.ts +126 -17
- package/dist/types/components/modal/modal.d.ts +61 -2
- package/dist/types/components/navigation-bar/navigation-bar.d.ts +105 -21
- package/dist/types/components/panel/panel.d.ts +7 -0
- package/dist/types/components/search/search.d.ts +7 -0
- package/dist/types/components/select/color.d.ts +12 -0
- package/dist/types/components/select/glyphs.d.ts +124 -0
- package/dist/types/components/select/select.d.ts +15 -3
- package/dist/types/components/sort-control/sort-control.d.ts +105 -0
- package/dist/types/components/stat-tile/stat-tile.d.ts +288 -0
- package/dist/types/components/tabbox/tabbox.d.ts +16 -0
- package/dist/types/components/table/table.d.ts +190 -1
- package/dist/types/components/table-view/table-view.d.ts +11 -5
- package/dist/types/components/tag-picker/tag-picker.d.ts +21 -4
- package/dist/types/components/timebox/timebox.d.ts +7 -0
- package/dist/types/components/tree/tree.d.ts +13 -0
- package/dist/types/components/value-list/value-list.d.ts +8 -0
- package/dist/types/components/view/record-view.d.ts +96 -5
- package/dist/types/core/breakpoint.d.ts +1 -1
- package/dist/types/core/icons.d.ts +37 -22
- package/dist/types/core/motion.d.ts +59 -0
- package/dist/types/core/overlay-host.d.ts +15 -1
- package/dist/types/index.d.ts +16 -3
- package/dist/types/internal/app-rail.d.ts +10 -0
- package/dist/types/internal/menu-items.d.ts +134 -0
- package/dist/types/zeyos/connect.d.ts +6 -0
- package/dist/types/zeyos/form.d.ts +50 -9
- package/dist/types/zeyos/index.d.ts +1 -1
- package/dist/types/zeyos/query.d.ts +79 -0
- package/dist/types/zeyos/schema.d.ts +24 -1
- package/dist/types/zeyos/table.d.ts +100 -14
- package/dist/types/zeyos/view.d.ts +10 -0
- package/dist/zx-zeyos.esm.js +2206 -489
- package/dist/zx-zeyos.esm.min.js +56 -1
- package/dist/zx.css +3322 -724
- package/dist/zx.esm.js +12244 -5809
- package/dist/zx.esm.min.js +58 -3
- package/dist/zx.global.js +12246 -5811
- package/dist/zx.global.min.js +58 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +1683 -146
- package/docs/llms.md +777 -110
- package/docs/llms.txt +14 -8
- package/package.json +1 -1
- package/src/components/account-menu/account-menu.css +35 -10
- package/src/components/activity-item/activity-item.css +137 -0
- package/src/components/activity-item/activity-item.js +602 -0
- package/src/components/activity-list/activity-list.css +99 -0
- package/src/components/activity-list/activity-list.js +409 -0
- package/src/components/app-icon/app-icon.css +1 -1
- package/src/components/app-rail/app-rail.css +191 -22
- package/src/components/app-sidebar/app-sidebar.css +349 -24
- package/src/components/app-sidebar/app-sidebar.js +86 -11
- package/src/components/aurora/aurora.css +5 -3
- package/src/components/avatar/avatar.css +32 -7
- package/src/components/avatar/avatar.js +72 -8
- package/src/components/badge/badge.css +54 -2
- package/src/components/badge/badge.js +29 -2
- package/src/components/button/button.css +74 -8
- package/src/components/button/button.js +44 -1
- package/src/components/calendar/calendar.css +46 -46
- package/src/components/calendar/calendar.js +33 -3
- package/src/components/card/card.css +2 -2
- package/src/components/card/card.js +12 -1
- package/src/components/card-view/card-view.css +10 -7
- package/src/components/card-view/card-view.js +25 -9
- package/src/components/card-view/record-card.js +7 -3
- package/src/components/chart/chart.css +4 -1
- package/src/components/chart/chart.js +12 -0
- package/src/components/check-button/check-button.css +10 -2
- package/src/components/checklist/checklist.css +9 -2
- package/src/components/checklist/checklist.js +11 -5
- package/src/components/checklist/field-adapter.js +3 -1
- package/src/components/code-editor/code-editor.css +68 -0
- package/src/components/code-editor/code-editor.js +306 -0
- package/src/components/code-editor/field-adapter.js +34 -0
- package/src/components/context-menu/context-menu.css +87 -5
- package/src/components/context-menu/context-menu.js +22 -30
- package/src/components/copy/copy-button.css +6 -0
- package/src/components/copy/copy-input.css +8 -3
- package/src/components/data-filter/data-filter.css +5 -4
- package/src/components/date-picker/date-picker.css +6 -6
- package/src/components/date-picker/date-picker.js +22 -8
- package/src/components/date-picker/date-range-picker.css +3 -3
- package/src/components/date-picker/month-picker.js +3 -3
- package/src/components/date-picker/time-picker.css +1 -1
- package/src/components/date-picker/time-picker.js +20 -8
- package/src/components/datebox/date-range-box.css +79 -2
- package/src/components/datebox/date-range-box.js +13 -2
- package/src/components/datebox/datebox.css +79 -2
- package/src/components/datebox/datebox.js +13 -2
- package/src/components/dialog/dialog.css +26 -0
- package/src/components/dialog/dialog.js +174 -70
- package/src/components/dropdown/dropdown.css +1 -1
- package/src/components/dropdown/dropdown.js +7 -5
- package/src/components/empty-state/empty-state.css +2 -2
- package/src/components/entity-ref/entity-ref.css +182 -0
- package/src/components/entity-ref/entity-ref.js +496 -0
- package/src/components/field/field.css +28 -9
- package/src/components/field/field.js +68 -26
- package/src/components/field-upload/field-upload.css +1 -1
- package/src/components/fieldset/fieldset.css +5 -3
- package/src/components/fieldset/fieldset.js +28 -5
- package/src/components/file-item/file-item.css +88 -0
- package/src/components/file-item/file-item.js +505 -0
- package/src/components/file-list/file-list.css +51 -0
- package/src/components/file-list/file-list.js +320 -0
- package/src/components/filter/filter.css +27 -1
- package/src/components/filter/filter.js +205 -47
- package/src/components/filter-panel/filter-panel.css +104 -0
- package/src/components/filter-panel/filter-panel.js +964 -0
- package/src/components/finder/finder.css +15 -13
- package/src/components/form/form.css +5 -4
- package/src/components/form/form.js +11 -2
- package/src/components/grid/grid.css +1 -1
- package/src/components/groupbox/groupbox.css +1 -1
- package/src/components/kanban-view/kanban-card.js +247 -0
- package/src/components/kanban-view/kanban-view.css +226 -8
- package/src/components/kanban-view/kanban-view.js +255 -12
- package/src/components/launcher/launcher.css +107 -25
- package/src/components/launcher/launcher.js +557 -63
- package/src/components/list-toolbar/list-toolbar.css +194 -0
- package/src/components/list-toolbar/list-toolbar.js +851 -0
- package/src/components/master-panel/master-panel.css +2 -0
- package/src/components/menu-button/menu-button.css +87 -5
- package/src/components/menu-button/menu-button.js +86 -46
- package/src/components/message/message.css +38 -5
- package/src/components/message/message.js +230 -17
- package/src/components/modal/modal.css +15 -0
- package/src/components/modal/modal.js +159 -3
- package/src/components/navigation-bar/navigation-bar.css +95 -11
- package/src/components/navigation-bar/navigation-bar.js +171 -4
- package/src/components/number-field/field-adapter.js +1 -0
- package/src/components/number-field/number-field.css +70 -0
- package/src/components/number-field/number-field.js +2 -0
- package/src/components/pagination/pagination.css +8 -6
- package/src/components/panel/panel.css +1 -1
- package/src/components/panel/panel.js +13 -2
- package/src/components/rating/rating.css +7 -0
- package/src/components/search/search.js +17 -5
- package/src/components/select/color.js +22 -0
- package/src/components/select/field-adapter.js +6 -1
- package/src/components/select/glyphs.js +165 -0
- package/src/components/select/select.css +138 -45
- package/src/components/select/select.js +86 -47
- package/src/components/sheet/sheet.css +11 -8
- package/src/components/slider/slider.css +16 -2
- package/src/components/slider/slider.js +1 -1
- package/src/components/sort-control/sort-control.css +20 -0
- package/src/components/sort-control/sort-control.js +140 -0
- package/src/components/stat-tile/stat-tile.css +208 -0
- package/src/components/stat-tile/stat-tile.js +601 -0
- package/src/components/tabbox/tabbox.css +32 -27
- package/src/components/tabbox/tabbox.js +17 -2
- package/src/components/table/table.css +155 -31
- package/src/components/table/table.js +386 -33
- package/src/components/table-view/table-view.css +8 -2
- package/src/components/table-view/table-view.js +21 -6
- package/src/components/tag-picker/tag-picker.css +86 -6
- package/src/components/tag-picker/tag-picker.js +25 -8
- package/src/components/timebox/timebox.css +22 -2
- package/src/components/timebox/timebox.js +18 -5
- package/src/components/toggle/toggle.css +12 -1
- package/src/components/toolbar/toolbar.js +2 -2
- package/src/components/tooltip/tooltip.css +4 -0
- package/src/components/tooltip/tooltip.js +10 -3
- package/src/components/tree/tree.css +25 -16
- package/src/components/tree/tree.js +31 -0
- package/src/components/value-list/value-list.css +3 -3
- package/src/components/value-list/value-list.js +22 -6
- package/src/components/view/record-view.css +5 -0
- package/src/components/view/record-view.js +100 -7
- package/src/core/breakpoint.js +1 -1
- package/src/core/icons.js +259 -57
- package/src/core/motion.js +147 -0
- package/src/core/overlay-host.js +21 -2
- package/src/index.js +30 -3
- package/src/internal/app-rail.js +18 -1
- package/src/internal/menu-items.js +142 -0
- package/src/zeyos/connect.js +6 -2
- package/src/zeyos/form.js +67 -27
- package/src/zeyos/index.js +1 -1
- package/src/zeyos/query.js +153 -0
- package/src/zeyos/schema.js +144 -27
- package/src/zeyos/table.js +68 -5
- package/src/zeyos/view.js +6 -0
- package/styles/base.css +56 -0
- package/styles/icons.css +11 -1
- package/styles/print.css +192 -0
- package/styles/tokens/dark.css +113 -37
- package/styles/tokens/global.css +121 -27
- package/styles/tokens/semantic.css +100 -31
- package/styles/tokens/themes.css +7 -6
- package/styles/zx.css +11 -1
- package/styles/tokens/density.css +0 -9
|
@@ -17,6 +17,14 @@ export type DialogButton = {
|
|
|
17
17
|
* Whether this button receives initial focus.
|
|
18
18
|
*/
|
|
19
19
|
autofocus?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the footer button is disabled.
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Visible shortcut hint; the host binds the action.
|
|
26
|
+
*/
|
|
27
|
+
shortcut?: import('../button/button.js').ButtonShortcut;
|
|
20
28
|
};
|
|
21
29
|
export type DialogOptions = {
|
|
22
30
|
/**
|
|
@@ -42,7 +50,7 @@ export type DialogOptions = {
|
|
|
42
50
|
toElement: () => Node | null;
|
|
43
51
|
} | null;
|
|
44
52
|
/**
|
|
45
|
-
* Element whose nearest Zx theme scope owns the overlay; defaults to the opener.
|
|
53
|
+
* Element whose nearest Zx theme scope owns the overlay; defaults to the opener. Resolved on every open, so a scope connected after construction still owns it.
|
|
46
54
|
*/
|
|
47
55
|
scope?: Element | string | null;
|
|
48
56
|
/**
|
|
@@ -129,6 +137,14 @@ export type ConfirmOptions = {
|
|
|
129
137
|
* Whether the confirmation action is dangerous.
|
|
130
138
|
*/
|
|
131
139
|
danger?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Text the reader must type before the confirm button
|
|
142
|
+
* enables — the name of what is about to be deleted, say. The dialog adds an input labelled
|
|
143
|
+
* "Type <confirmText> to confirm" (message `dialog.typeToConfirm`, `%1` standing for the text),
|
|
144
|
+
* focuses it, and enables the confirm button, and Enter, only while its value matches exactly,
|
|
145
|
+
* ignoring surrounding spaces.
|
|
146
|
+
*/
|
|
147
|
+
confirmText?: string | null;
|
|
132
148
|
};
|
|
133
149
|
export type PromptOptions = {
|
|
134
150
|
/**
|
|
@@ -147,6 +163,14 @@ export type PromptOptions = {
|
|
|
147
163
|
* Input placeholder.
|
|
148
164
|
*/
|
|
149
165
|
placeholder?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Confirmation label.
|
|
168
|
+
*/
|
|
169
|
+
okLabel?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Cancellation label.
|
|
172
|
+
*/
|
|
173
|
+
cancelLabel?: string;
|
|
150
174
|
};
|
|
151
175
|
/** @typedef {'default'|'primary'|'danger'|'ghost'} DialogButtonKind */
|
|
152
176
|
/**
|
|
@@ -155,6 +179,8 @@ export type PromptOptions = {
|
|
|
155
179
|
* @property {DialogButtonKind} [kind='default'] Visual button kind.
|
|
156
180
|
* @property {'close'|'cancel'|((dialog: Dialog) => void)} [action='close'] Button action.
|
|
157
181
|
* @property {boolean} [autofocus=false] Whether this button receives initial focus.
|
|
182
|
+
* @property {boolean} [disabled=false] Whether the footer button is disabled.
|
|
183
|
+
* @property {import('../button/button.js').ButtonShortcut} [shortcut] Visible shortcut hint; the host binds the action.
|
|
158
184
|
*/
|
|
159
185
|
/**
|
|
160
186
|
* @typedef {Object} DialogOptions
|
|
@@ -163,7 +189,7 @@ export type PromptOptions = {
|
|
|
163
189
|
* @property {DialogButton[]} [buttons=[]] Footer buttons.
|
|
164
190
|
* @property {boolean} [closable=true] Whether Escape and the header button may close the dialog.
|
|
165
191
|
* @property {Node|string|number|{toElement: () => Node|null}|null} [content=null] Body content.
|
|
166
|
-
* @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns the overlay; defaults to the opener.
|
|
192
|
+
* @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns the overlay; defaults to the opener. Resolved on every open, so a scope connected after construction still owns it.
|
|
167
193
|
* @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open event listener.
|
|
168
194
|
* @property {(event: CustomEvent<{result: unknown}>) => void} [onclose] Close event listener.
|
|
169
195
|
* @property {(event: CustomEvent<Record<string, never>>) => void} [oncancel] Cancel event listener.
|
|
@@ -194,6 +220,11 @@ export type PromptOptions = {
|
|
|
194
220
|
* @property {string} [okLabel='OK'] Confirmation label.
|
|
195
221
|
* @property {string} [cancelLabel='Cancel'] Cancellation label.
|
|
196
222
|
* @property {boolean} [danger=false] Whether the confirmation action is dangerous.
|
|
223
|
+
* @property {string|null} [confirmText=null] Text the reader must type before the confirm button
|
|
224
|
+
* enables — the name of what is about to be deleted, say. The dialog adds an input labelled
|
|
225
|
+
* "Type <confirmText> to confirm" (message `dialog.typeToConfirm`, `%1` standing for the text),
|
|
226
|
+
* focuses it, and enables the confirm button, and Enter, only while its value matches exactly,
|
|
227
|
+
* ignoring surrounding spaces.
|
|
197
228
|
*/
|
|
198
229
|
/**
|
|
199
230
|
* @typedef {Object} PromptOptions
|
|
@@ -201,6 +232,8 @@ export type PromptOptions = {
|
|
|
201
232
|
* @property {Node|string|number|null} [message=''] Prompt message.
|
|
202
233
|
* @property {string} [value=''] Initial input value.
|
|
203
234
|
* @property {string} [placeholder=''] Input placeholder.
|
|
235
|
+
* @property {string} [okLabel='OK'] Confirmation label.
|
|
236
|
+
* @property {string} [cancelLabel='Cancel'] Cancellation label.
|
|
204
237
|
*/
|
|
205
238
|
/**
|
|
206
239
|
* Structured modal with a title, body, footer actions, and switchable views.
|
|
@@ -275,17 +308,18 @@ export declare class Dialog extends Modal {
|
|
|
275
308
|
*/
|
|
276
309
|
static alert({ title, message, okLabel }?: AlertOptions): Promise<void>;
|
|
277
310
|
/**
|
|
278
|
-
* Opens a confirmation dialog.
|
|
311
|
+
* Opens a confirmation dialog. With `confirmText` it becomes a type-to-confirm dialog: the
|
|
312
|
+
* confirm button stays disabled until the reader has typed that text.
|
|
279
313
|
* @param {ConfirmOptions} [options={}] Confirmation options.
|
|
280
|
-
* @returns {Promise<boolean>}
|
|
314
|
+
* @returns {Promise<boolean>} True when confirmed; false on Cancel, Escape, or the close button.
|
|
281
315
|
*/
|
|
282
|
-
static confirm({ title, message, okLabel, cancelLabel, danger }?: ConfirmOptions): Promise<boolean>;
|
|
316
|
+
static confirm({ title, message, okLabel, cancelLabel, danger, confirmText }?: ConfirmOptions): Promise<boolean>;
|
|
283
317
|
/**
|
|
284
318
|
* Opens a single-line text prompt.
|
|
285
319
|
* @param {PromptOptions} [options={}] Prompt options.
|
|
286
320
|
* @returns {Promise<string|null>}
|
|
287
321
|
*/
|
|
288
|
-
static prompt({ title, message, value, placeholder }?: PromptOptions): Promise<string | null>;
|
|
322
|
+
static prompt({ title, message, value, placeholder, okLabel, cancelLabel }?: PromptOptions): Promise<string | null>;
|
|
289
323
|
/**
|
|
290
324
|
* Applies the dialog width. Subclasses that size themselves on a different axis override this.
|
|
291
325
|
*
|
|
@@ -295,4 +329,39 @@ export declare class Dialog extends Modal {
|
|
|
295
329
|
* @returns {void}
|
|
296
330
|
*/
|
|
297
331
|
_applySize(size: 'sm' | 'md' | 'lg' | number): void;
|
|
332
|
+
/**
|
|
333
|
+
* Resolves a component message, falling back to the built-in English text.
|
|
334
|
+
* @param {string} key Message key.
|
|
335
|
+
* @param {string} fallback English default.
|
|
336
|
+
* @returns {string}
|
|
337
|
+
*/
|
|
338
|
+
_message(key: string, fallback: string): string;
|
|
298
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* Reports whether what the reader typed confirms a type-to-confirm dialog: the same text, exactly
|
|
342
|
+
* — case and inner spacing included — once surrounding spaces are ignored on both sides.
|
|
343
|
+
* @param {unknown} typed Input value.
|
|
344
|
+
* @param {unknown} expected Text the dialog asks for.
|
|
345
|
+
* @returns {boolean}
|
|
346
|
+
*/
|
|
347
|
+
export declare function typedConfirmation(typed: unknown, expected: unknown): boolean;
|
|
348
|
+
/**
|
|
349
|
+
* Splits the type-to-confirm message around `%1`, where the text to type goes. A translation that
|
|
350
|
+
* leaves `%1` out gets the text after it, following a space; a second `%1` is filled in as text.
|
|
351
|
+
* @param {string} template Message such as "Type %1 to confirm".
|
|
352
|
+
* @param {string} expected Text to type.
|
|
353
|
+
* @returns {[string, string]} The text before and after the text to type.
|
|
354
|
+
*/
|
|
355
|
+
export declare function typeToConfirmParts(template: string, expected: string): [string, string];
|
|
356
|
+
/**
|
|
357
|
+
* Copies footer-button descriptors without mutating the caller's array or objects, and settles
|
|
358
|
+
* the two booleans the footer renders from.
|
|
359
|
+
*
|
|
360
|
+
* `autofocus` and `disabled` are resolved together because they contradict each other: a control
|
|
361
|
+
* that refuses activation must not be the one initial focus lands on, and a host that writes both
|
|
362
|
+
* has said what it wants twice. Deciding it here rather than at render time keeps `Sheet` — which
|
|
363
|
+
* takes the same descriptors through the same footer — on one answer.
|
|
364
|
+
* @param {DialogButton[]|null|undefined} list Button descriptors.
|
|
365
|
+
* @returns {DialogButton[]} Normalized copies.
|
|
366
|
+
*/
|
|
367
|
+
export declare function normalizeDialogButtons(list: DialogButton[] | null | undefined): DialogButton[];
|
|
@@ -29,7 +29,7 @@ export type DropdownOptions = {
|
|
|
29
29
|
*/
|
|
30
30
|
closeOnSelect?: boolean;
|
|
31
31
|
/**
|
|
32
|
-
* Element whose nearest Zx theme scope owns the panel; defaults to the anchor.
|
|
32
|
+
* Element whose nearest Zx theme scope owns the panel; defaults to the anchor. Resolved on every open, so an anchor connected after construction still gets its scope.
|
|
33
33
|
*/
|
|
34
34
|
scope?: Element | string | null;
|
|
35
35
|
/**
|
|
@@ -49,7 +49,7 @@ export type DropdownOptions = {
|
|
|
49
49
|
* @property {boolean} [matchWidth=false] Whether the panel matches the anchor width.
|
|
50
50
|
* @property {'click'|'manual'} [openOn='click'] Trigger behavior.
|
|
51
51
|
* @property {boolean} [closeOnSelect=false] Whether a click within the panel closes it.
|
|
52
|
-
* @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns the panel; defaults to the anchor.
|
|
52
|
+
* @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns the panel; defaults to the anchor. Resolved on every open, so an anchor connected after construction still gets its scope.
|
|
53
53
|
* @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open event listener.
|
|
54
54
|
* @property {(event: CustomEvent<Record<string, never>>) => void} [onclose] Close event listener.
|
|
55
55
|
*/
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type EntityRefContent = string | number | Node | Component | null;
|
|
3
|
+
export type EntityRefIcon = string | Node | Component | (() => string | Node | Component | null) | null;
|
|
4
|
+
export type EntityRefLink = {
|
|
5
|
+
/**
|
|
6
|
+
* Native primary-link destination.
|
|
7
|
+
*/
|
|
8
|
+
href: string;
|
|
9
|
+
/**
|
|
10
|
+
* Native browsing context.
|
|
11
|
+
*/
|
|
12
|
+
target?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Native link relationship.
|
|
15
|
+
*/
|
|
16
|
+
rel?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Native download hint; a string supplies the filename.
|
|
19
|
+
*/
|
|
20
|
+
download?: boolean | string;
|
|
21
|
+
/**
|
|
22
|
+
* Optional callback after an uncanceled activation; navigation remains native.
|
|
23
|
+
*/
|
|
24
|
+
onclick?: (event: MouseEvent, entity: Readonly<EntityRefState>, component: EntityRef) => void;
|
|
25
|
+
};
|
|
26
|
+
export type EntityRefMetadata = {
|
|
27
|
+
/**
|
|
28
|
+
* Metadata label.
|
|
29
|
+
*/
|
|
30
|
+
label: string;
|
|
31
|
+
/**
|
|
32
|
+
* Metadata value.
|
|
33
|
+
*/
|
|
34
|
+
value: EntityRefContent;
|
|
35
|
+
/**
|
|
36
|
+
* Optional Zx icon before the value.
|
|
37
|
+
*/
|
|
38
|
+
icon?: string | null;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the label is visible instead of visually hidden.
|
|
41
|
+
*/
|
|
42
|
+
showLabel?: boolean;
|
|
43
|
+
};
|
|
44
|
+
export type EntityRefAction = {
|
|
45
|
+
/**
|
|
46
|
+
* Stable action identifier.
|
|
47
|
+
*/
|
|
48
|
+
id: string;
|
|
49
|
+
/**
|
|
50
|
+
* Visible label.
|
|
51
|
+
*/
|
|
52
|
+
label?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Optional Zx icon.
|
|
55
|
+
*/
|
|
56
|
+
icon?: string | null;
|
|
57
|
+
/**
|
|
58
|
+
* Accessible/native title, required when the label is empty.
|
|
59
|
+
*/
|
|
60
|
+
title?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Optional safe native link destination; otherwise a button is rendered.
|
|
63
|
+
*/
|
|
64
|
+
href?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Native link browsing context.
|
|
67
|
+
*/
|
|
68
|
+
target?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Native link relationship.
|
|
71
|
+
*/
|
|
72
|
+
rel?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Visual intent.
|
|
75
|
+
*/
|
|
76
|
+
kind?: 'default' | 'primary' | 'danger' | 'ghost';
|
|
77
|
+
/**
|
|
78
|
+
* Whether activation is unavailable.
|
|
79
|
+
*/
|
|
80
|
+
disabled?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Callback after an uncanceled activation.
|
|
83
|
+
*/
|
|
84
|
+
onselect?: (id: string, action: Readonly<EntityRefAction>, entity: Readonly<EntityRefState>, component: EntityRef) => void;
|
|
85
|
+
};
|
|
86
|
+
export type EntityRefActionEntry = Element | EntityRefAction;
|
|
87
|
+
export type EntityRefLinkValue = string | EntityRefLink | null;
|
|
88
|
+
export type EntityRefOptions = {
|
|
89
|
+
/**
|
|
90
|
+
* Application-owned entity identifier included in events.
|
|
91
|
+
*/
|
|
92
|
+
id?: unknown;
|
|
93
|
+
/**
|
|
94
|
+
* Primary identity text.
|
|
95
|
+
*/
|
|
96
|
+
title?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Secondary identity text or safe caller-supplied content.
|
|
99
|
+
*/
|
|
100
|
+
subtitle?: EntityRefContent;
|
|
101
|
+
/**
|
|
102
|
+
* Icon name, node, component, or lazy renderer.
|
|
103
|
+
*/
|
|
104
|
+
icon?: EntityRefIcon;
|
|
105
|
+
/**
|
|
106
|
+
* Labelled dense metadata.
|
|
107
|
+
*/
|
|
108
|
+
metadata?: EntityRefMetadata[];
|
|
109
|
+
/**
|
|
110
|
+
* Optional native primary link.
|
|
111
|
+
*/
|
|
112
|
+
link?: EntityRefLinkValue;
|
|
113
|
+
/**
|
|
114
|
+
* Secondary controls; element actions keep their own behavior.
|
|
115
|
+
*/
|
|
116
|
+
actions?: EntityRefActionEntry[];
|
|
117
|
+
/**
|
|
118
|
+
* Size of the icon and the identity text.
|
|
119
|
+
*/
|
|
120
|
+
size?: 'sm' | 'md' | 'lg';
|
|
121
|
+
/**
|
|
122
|
+
* Whether long identity text may wrap instead of truncating.
|
|
123
|
+
*/
|
|
124
|
+
wrap?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Accessible name for secondary actions.
|
|
127
|
+
*/
|
|
128
|
+
actionsLabel?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Preventable primary-link listener.
|
|
131
|
+
*/
|
|
132
|
+
onactivate?: (event: CustomEvent<{
|
|
133
|
+
id: unknown;
|
|
134
|
+
entity: Readonly<EntityRefState>;
|
|
135
|
+
href: string;
|
|
136
|
+
event: MouseEvent;
|
|
137
|
+
}>) => void;
|
|
138
|
+
/**
|
|
139
|
+
* Preventable delegated-action listener.
|
|
140
|
+
*/
|
|
141
|
+
onaction?: (event: CustomEvent<{
|
|
142
|
+
id: string;
|
|
143
|
+
action: Readonly<EntityRefAction>;
|
|
144
|
+
entity: Readonly<EntityRefState>;
|
|
145
|
+
event: MouseEvent;
|
|
146
|
+
}>) => void;
|
|
147
|
+
};
|
|
148
|
+
export type EntityRefState = {
|
|
149
|
+
/**
|
|
150
|
+
* Entity identifier.
|
|
151
|
+
*/
|
|
152
|
+
id: unknown;
|
|
153
|
+
/**
|
|
154
|
+
* Primary identity.
|
|
155
|
+
*/
|
|
156
|
+
title: string;
|
|
157
|
+
/**
|
|
158
|
+
* Secondary identity.
|
|
159
|
+
*/
|
|
160
|
+
subtitle: EntityRefContent;
|
|
161
|
+
/**
|
|
162
|
+
* Identity icon.
|
|
163
|
+
*/
|
|
164
|
+
icon: EntityRefIcon;
|
|
165
|
+
/**
|
|
166
|
+
* Normalized metadata copies.
|
|
167
|
+
*/
|
|
168
|
+
metadata: EntityRefMetadata[];
|
|
169
|
+
/**
|
|
170
|
+
* Safe native link.
|
|
171
|
+
*/
|
|
172
|
+
link: EntityRefLink | null;
|
|
173
|
+
/**
|
|
174
|
+
* Normalized action copies or elements.
|
|
175
|
+
*/
|
|
176
|
+
actions: EntityRefActionEntry[];
|
|
177
|
+
/**
|
|
178
|
+
* Presentation size.
|
|
179
|
+
*/
|
|
180
|
+
size: 'sm' | 'md' | 'lg';
|
|
181
|
+
/**
|
|
182
|
+
* Wrapping state.
|
|
183
|
+
*/
|
|
184
|
+
wrap: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Action-group label.
|
|
187
|
+
*/
|
|
188
|
+
actionsLabel: string;
|
|
189
|
+
};
|
|
190
|
+
/** @typedef {string|number|Node|Component|null} EntityRefContent */
|
|
191
|
+
/** @typedef {string|Node|Component|(()=>string|Node|Component|null)|null} EntityRefIcon */
|
|
192
|
+
/**
|
|
193
|
+
* @typedef {Object} EntityRefLink
|
|
194
|
+
* @property {string} href Native primary-link destination.
|
|
195
|
+
* @property {string} [target] Native browsing context.
|
|
196
|
+
* @property {string} [rel] Native link relationship.
|
|
197
|
+
* @property {boolean|string} [download] Native download hint; a string supplies the filename.
|
|
198
|
+
* @property {(event: MouseEvent, entity: Readonly<EntityRefState>, component: EntityRef) => void} [onclick]
|
|
199
|
+
* Optional callback after an uncanceled activation; navigation remains native.
|
|
200
|
+
*/
|
|
201
|
+
/**
|
|
202
|
+
* @typedef {Object} EntityRefMetadata
|
|
203
|
+
* @property {string} label Metadata label.
|
|
204
|
+
* @property {EntityRefContent} value Metadata value.
|
|
205
|
+
* @property {string|null} [icon=null] Optional Zx icon before the value.
|
|
206
|
+
* @property {boolean} [showLabel=true] Whether the label is visible instead of visually hidden.
|
|
207
|
+
*/
|
|
208
|
+
/**
|
|
209
|
+
* @typedef {Object} EntityRefAction
|
|
210
|
+
* @property {string} id Stable action identifier.
|
|
211
|
+
* @property {string} [label=''] Visible label.
|
|
212
|
+
* @property {string|null} [icon=null] Optional Zx icon.
|
|
213
|
+
* @property {string} [title] Accessible/native title, required when the label is empty.
|
|
214
|
+
* @property {string} [href] Optional safe native link destination; otherwise a button is rendered.
|
|
215
|
+
* @property {string} [target] Native link browsing context.
|
|
216
|
+
* @property {string} [rel] Native link relationship.
|
|
217
|
+
* @property {'default'|'primary'|'danger'|'ghost'} [kind='ghost'] Visual intent.
|
|
218
|
+
* @property {boolean} [disabled=false] Whether activation is unavailable.
|
|
219
|
+
* @property {(id: string, action: Readonly<EntityRefAction>, entity: Readonly<EntityRefState>, component: EntityRef) => void} [onselect]
|
|
220
|
+
* Callback after an uncanceled activation.
|
|
221
|
+
*/
|
|
222
|
+
/** @typedef {Element|EntityRefAction} EntityRefActionEntry */
|
|
223
|
+
/** @typedef {string|EntityRefLink|null} EntityRefLinkValue */
|
|
224
|
+
/**
|
|
225
|
+
* @typedef {Object} EntityRefOptions
|
|
226
|
+
* @property {unknown} [id=null] Application-owned entity identifier included in events.
|
|
227
|
+
* @property {string} [title=''] Primary identity text.
|
|
228
|
+
* @property {EntityRefContent} [subtitle=null] Secondary identity text or safe caller-supplied content.
|
|
229
|
+
* @property {EntityRefIcon} [icon=null] Icon name, node, component, or lazy renderer.
|
|
230
|
+
* @property {EntityRefMetadata[]} [metadata=[]] Labelled dense metadata.
|
|
231
|
+
* @property {EntityRefLinkValue} [link=null] Optional native primary link.
|
|
232
|
+
* @property {EntityRefActionEntry[]} [actions=[]] Secondary controls; element actions keep their own behavior.
|
|
233
|
+
* @property {'sm'|'md'|'lg'} [size='md'] Size of the icon and the identity text.
|
|
234
|
+
* @property {boolean} [wrap=false] Whether long identity text may wrap instead of truncating.
|
|
235
|
+
* @property {string} [actionsLabel='Entity actions'] Accessible name for secondary actions.
|
|
236
|
+
* @property {(event: CustomEvent<{id: unknown, entity: Readonly<EntityRefState>, href: string, event: MouseEvent}>) => void} [onactivate]
|
|
237
|
+
* Preventable primary-link listener.
|
|
238
|
+
* @property {(event: CustomEvent<{id: string, action: Readonly<EntityRefAction>, entity: Readonly<EntityRefState>, event: MouseEvent}>) => void} [onaction]
|
|
239
|
+
* Preventable delegated-action listener.
|
|
240
|
+
*/
|
|
241
|
+
/**
|
|
242
|
+
* @typedef {Object} EntityRefState
|
|
243
|
+
* @property {unknown} id Entity identifier.
|
|
244
|
+
* @property {string} title Primary identity.
|
|
245
|
+
* @property {EntityRefContent} subtitle Secondary identity.
|
|
246
|
+
* @property {EntityRefIcon} icon Identity icon.
|
|
247
|
+
* @property {EntityRefMetadata[]} metadata Normalized metadata copies.
|
|
248
|
+
* @property {EntityRefLink|null} link Safe native link.
|
|
249
|
+
* @property {EntityRefActionEntry[]} actions Normalized action copies or elements.
|
|
250
|
+
* @property {'sm'|'md'|'lg'} size Presentation size.
|
|
251
|
+
* @property {boolean} wrap Wrapping state.
|
|
252
|
+
* @property {string} actionsLabel Action-group label.
|
|
253
|
+
*/
|
|
254
|
+
/**
|
|
255
|
+
* Dense entity identity for tables, feeds, selectors, and detail metadata. It owns presentation and
|
|
256
|
+
* safe native-link/action semantics; routing, permissions, context menus, and persistence remain
|
|
257
|
+
* application-owned.
|
|
258
|
+
* @fires EntityRef#activate
|
|
259
|
+
* @fires EntityRef#action
|
|
260
|
+
* @extends {Component<EntityRefOptions>}
|
|
261
|
+
*/
|
|
262
|
+
export declare class EntityRef extends Component<EntityRefOptions> {
|
|
263
|
+
_createdRoot: boolean;
|
|
264
|
+
_snapshot: import("../../core/dom.js").TargetSnapshot;
|
|
265
|
+
_destroyed: boolean;
|
|
266
|
+
_state: EntityRefState;
|
|
267
|
+
_renderedActions: any[] | EntityRefActionEntry[];
|
|
268
|
+
static cssName: string;
|
|
269
|
+
/** @type {Readonly<EntityRefOptions>} */
|
|
270
|
+
static defaults: Readonly<EntityRefOptions>;
|
|
271
|
+
/**
|
|
272
|
+
* Creates or enhances a dense entity reference.
|
|
273
|
+
* @param {Element|string|null} [target=null] Existing host, selector, or null.
|
|
274
|
+
* @param {EntityRefOptions} [options={}] Entity presentation.
|
|
275
|
+
*/
|
|
276
|
+
constructor(target?: Element | string | null, options?: EntityRefOptions);
|
|
277
|
+
/** @returns {HTMLElement} */
|
|
278
|
+
render(): HTMLElement;
|
|
279
|
+
/**
|
|
280
|
+
* Updates any subset of the identity without replacing the root.
|
|
281
|
+
* @param {Partial<EntityRefOptions>} values Next values.
|
|
282
|
+
* @returns {this}
|
|
283
|
+
*/
|
|
284
|
+
set(values?: Partial<EntityRefOptions>): this;
|
|
285
|
+
/** Replaces the metadata collection. @param {EntityRefMetadata[]} metadata Metadata. @returns {this} */
|
|
286
|
+
setMetadata(metadata: EntityRefMetadata[]): this;
|
|
287
|
+
/** Replaces the secondary action controls. @param {EntityRefActionEntry[]} actions Actions. @returns {this} */
|
|
288
|
+
setActions(actions: EntityRefActionEntry[]): this;
|
|
289
|
+
/** Sets or clears the primary link. @param {EntityRefLinkValue} link Link. @returns {this} */
|
|
290
|
+
setLink(link: EntityRefLinkValue): this;
|
|
291
|
+
/**
|
|
292
|
+
* Returns a defensive presentation snapshot. Caller-supplied Nodes and Components retain their
|
|
293
|
+
* identity; arrays and descriptors are copied.
|
|
294
|
+
* @returns {Readonly<EntityRefState>}
|
|
295
|
+
*/
|
|
296
|
+
getEntity(): Readonly<EntityRefState>;
|
|
297
|
+
/** Focuses the primary link or the first enabled action. @returns {this} */
|
|
298
|
+
focus(): this;
|
|
299
|
+
/** Restores an enhanced target exactly, or removes an owned reference. @returns {void} */
|
|
300
|
+
destroy(): void;
|
|
301
|
+
/** @returns {void} */
|
|
302
|
+
_sync(): void;
|
|
303
|
+
/** @param {MouseEvent} event @returns {void} */
|
|
304
|
+
_handleClick(event: MouseEvent): void;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Normalizes an entity-reference contract without touching the DOM.
|
|
308
|
+
* @param {Partial<EntityRefOptions>|null|undefined} values Candidate values.
|
|
309
|
+
* @returns {EntityRefState}
|
|
310
|
+
*/
|
|
311
|
+
export declare function normalizeEntityRef(values?: Partial<EntityRefOptions> | null | undefined): EntityRefState;
|
|
312
|
+
/**
|
|
313
|
+
* Normalizes and secures a primary native link.
|
|
314
|
+
* @param {EntityRefLinkValue|unknown} value Candidate link.
|
|
315
|
+
* @returns {EntityRefLink|null}
|
|
316
|
+
*/
|
|
317
|
+
export declare function normalizeEntityRefLink(value: EntityRefLinkValue | unknown): EntityRefLink | null;
|
|
318
|
+
/**
|
|
319
|
+
* Normalizes labelled metadata, omitting entries without a label or displayable value.
|
|
320
|
+
* @param {unknown} values Candidate metadata.
|
|
321
|
+
* @returns {EntityRefMetadata[]}
|
|
322
|
+
*/
|
|
323
|
+
export declare function normalizeEntityRefMetadata(values: unknown): EntityRefMetadata[];
|
|
324
|
+
/**
|
|
325
|
+
* Normalizes delegated actions while preserving caller-supplied Elements.
|
|
326
|
+
* @param {unknown} values Candidate actions.
|
|
327
|
+
* @returns {EntityRefActionEntry[]}
|
|
328
|
+
*/
|
|
329
|
+
export declare function normalizeEntityRefActions(values: unknown): EntityRefActionEntry[];
|
|
330
|
+
/** Fired when the native primary link is activated. @event EntityRef#activate @type {CustomEvent<{id: unknown, entity: Readonly<EntityRefState>, href: string, event: MouseEvent}>} */
|
|
331
|
+
/** Fired when a delegated secondary action is activated. @event EntityRef#action @type {CustomEvent<{id: string, action: Readonly<EntityRefAction>, entity: Readonly<EntityRefState>, event: MouseEvent}>} */
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
2
|
export type FieldOptions = {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* DOM id of the control. Generated when omitted; a Fieldset
|
|
5
|
+
* derives it from its `idPrefix` and the field key, so a key never becomes a DOM id by itself.
|
|
5
6
|
*/
|
|
6
7
|
id?: string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Field name: the `name` of a native control and the key the
|
|
10
|
+
* field is filed under. A Fieldset sets it to the field key; a standalone field falls back to `id`.
|
|
11
|
+
*/
|
|
12
|
+
name?: string | null;
|
|
7
13
|
/**
|
|
8
14
|
* Registered field type.
|
|
9
15
|
*/
|
|
@@ -88,6 +94,12 @@ export type FieldAdapter = {
|
|
|
88
94
|
* Release adapter-owned resources.
|
|
89
95
|
*/
|
|
90
96
|
destroy?: () => void;
|
|
97
|
+
/**
|
|
98
|
+
* The element the field's label, description, and validity
|
|
99
|
+
* belong to when it is not `el` — the text input inside a composite control. Left out, a
|
|
100
|
+
* wrapper that cannot be labelled hands them to the first unnamed form control inside it.
|
|
101
|
+
*/
|
|
102
|
+
labelTarget?: Element;
|
|
91
103
|
};
|
|
92
104
|
export type FieldAdapterFactory = (field: Field, options: Readonly<FieldOptions>) => FieldAdapter;
|
|
93
105
|
export type NumericCoercion = {
|
|
@@ -96,7 +108,10 @@ export type NumericCoercion = {
|
|
|
96
108
|
};
|
|
97
109
|
/**
|
|
98
110
|
* @typedef {Object} FieldOptions
|
|
99
|
-
* @property {string|null} [id=null]
|
|
111
|
+
* @property {string|null} [id=null] DOM id of the control. Generated when omitted; a Fieldset
|
|
112
|
+
* derives it from its `idPrefix` and the field key, so a key never becomes a DOM id by itself.
|
|
113
|
+
* @property {string|null} [name=null] Field name: the `name` of a native control and the key the
|
|
114
|
+
* field is filed under. A Fieldset sets it to the field key; a standalone field falls back to `id`.
|
|
100
115
|
* @property {string} [type='text'] Registered field type.
|
|
101
116
|
* @property {string} [label=''] Visible label.
|
|
102
117
|
* @property {string} [description=''] Supporting description.
|
|
@@ -119,6 +134,9 @@ export type NumericCoercion = {
|
|
|
119
134
|
* @property {() => void} focus Focus the control.
|
|
120
135
|
* @property {(disabled: boolean) => void} setDisabled Set disabled state.
|
|
121
136
|
* @property {() => void} [destroy] Release adapter-owned resources.
|
|
137
|
+
* @property {Element} [labelTarget] The element the field's label, description, and validity
|
|
138
|
+
* belong to when it is not `el` — the text input inside a composite control. Left out, a
|
|
139
|
+
* wrapper that cannot be labelled hands them to the first unnamed form control inside it.
|
|
122
140
|
*/
|
|
123
141
|
/** @typedef {(field: Field, options: Readonly<FieldOptions>) => FieldAdapter} FieldAdapterFactory */
|
|
124
142
|
/** @typedef {{valid: boolean, value: number|string}} NumericCoercion */
|
|
@@ -133,8 +151,12 @@ export declare class Field extends Component<FieldOptions> {
|
|
|
133
151
|
_ownedComponents: Set<any>;
|
|
134
152
|
_ownedNodes: any[];
|
|
135
153
|
_rootAttributes: Map<string, string>;
|
|
154
|
+
/** @type {string} The control's DOM id: `options.id`, or a generated one. */
|
|
136
155
|
controlId: string;
|
|
156
|
+
/** @type {string} The field name (`options.name`, else `options.id`), '' when there is none. */
|
|
157
|
+
name: string;
|
|
137
158
|
adapter: FieldAdapter;
|
|
159
|
+
_labelled: Element;
|
|
138
160
|
_baseDescribedBy: string;
|
|
139
161
|
_descriptionId: string;
|
|
140
162
|
_highlightId: string;
|
|
@@ -13,6 +13,12 @@ export type FieldsetOptions = {
|
|
|
13
13
|
* Initial fields.
|
|
14
14
|
*/
|
|
15
15
|
fields?: Record<string, FieldOptions | Field | Element | Component>;
|
|
16
|
+
/**
|
|
17
|
+
* Prefix of the DOM ids generated for the fields, as
|
|
18
|
+
* `<idPrefix>-<key>`. Null generates one per instance, so the same fieldset mounted twice
|
|
19
|
+
* never repeats an id and a field key never collides with an element id elsewhere on the page.
|
|
20
|
+
*/
|
|
21
|
+
idPrefix?: string | null;
|
|
16
22
|
};
|
|
17
23
|
export type FieldOptions = import('../field/field.js').FieldOptions;
|
|
18
24
|
/**
|
|
@@ -20,6 +26,9 @@ export type FieldOptions = import('../field/field.js').FieldOptions;
|
|
|
20
26
|
* @property {string} [title=''] Legend text.
|
|
21
27
|
* @property {1|2|3} [columns=1] Grid column count.
|
|
22
28
|
* @property {Record<string, FieldOptions|Field|Element|Component>} [fields={}] Initial fields.
|
|
29
|
+
* @property {string|null} [idPrefix=null] Prefix of the DOM ids generated for the fields, as
|
|
30
|
+
* `<idPrefix>-<key>`. Null generates one per instance, so the same fieldset mounted twice
|
|
31
|
+
* never repeats an id and a field key never collides with an element id elsewhere on the page.
|
|
23
32
|
*/
|
|
24
33
|
/** @typedef {import('../field/field.js').FieldOptions} FieldOptions */
|
|
25
34
|
/**
|
|
@@ -32,6 +41,7 @@ export declare class Fieldset extends Component<FieldsetOptions> {
|
|
|
32
41
|
_origins: Map<any, any>;
|
|
33
42
|
_fieldIdAttributes: Map<any, any>;
|
|
34
43
|
_ownedNodes: any[];
|
|
44
|
+
_idPrefix: string;
|
|
35
45
|
_columnAttribute: string;
|
|
36
46
|
_grid: HTMLElement;
|
|
37
47
|
static cssName: string;
|
|
@@ -40,7 +50,9 @@ export declare class Fieldset extends Component<FieldsetOptions> {
|
|
|
40
50
|
/** @returns {HTMLElement} */
|
|
41
51
|
render(): HTMLElement;
|
|
42
52
|
/**
|
|
43
|
-
* Adds a field from options, an existing field, an element, or a component.
|
|
53
|
+
* Adds a field from options, an existing field, an element, or a component. The key becomes the
|
|
54
|
+
* field's `name` and its `data-field-id`; the control's DOM id is `<idPrefix>-<key>`, unless the
|
|
55
|
+
* field options give an `id` of their own that differs from the key.
|
|
44
56
|
* @param {string} id Logical field identifier.
|
|
45
57
|
* @param {FieldOptions|Field|Element|Component} field Field source.
|
|
46
58
|
* @returns {Field}
|
|
@@ -118,6 +130,12 @@ export declare class Fieldset extends Component<FieldsetOptions> {
|
|
|
118
130
|
* @returns {this}
|
|
119
131
|
*/
|
|
120
132
|
clearHighlights(): this;
|
|
133
|
+
/**
|
|
134
|
+
* The DOM id generated for a field key: unique per instance unless `idPrefix` was given.
|
|
135
|
+
* @param {string} key Field key.
|
|
136
|
+
* @returns {string}
|
|
137
|
+
*/
|
|
138
|
+
_controlId(key: string): string;
|
|
121
139
|
/** @param {Field} field @returns {void} */
|
|
122
140
|
_releaseField(field: Field): void;
|
|
123
141
|
/** @returns {void} */
|