@zeyos/zx 2.1.0 → 2.2.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 +39 -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 +362 -33
- package/dist/zx-compat.esm.min.js +1 -1
- package/dist/zx-compat.global.js +359 -67
- package/dist/zx-compat.global.min.js +3 -3
- package/dist/zx-zeyos.esm.js +342 -43
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +68 -6
- package/dist/zx.esm.js +346 -67
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +346 -67
- 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 +28 -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 +1693 -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,292 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type NumberFieldOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Initial value, or null for empty.
|
|
5
|
+
*/
|
|
6
|
+
value?: number | null;
|
|
7
|
+
/**
|
|
8
|
+
* Lowest accepted value.
|
|
9
|
+
*/
|
|
10
|
+
min?: number | null;
|
|
11
|
+
/**
|
|
12
|
+
* Highest accepted value.
|
|
13
|
+
*/
|
|
14
|
+
max?: number | null;
|
|
15
|
+
/**
|
|
16
|
+
* Increment applied by the buttons and arrow keys.
|
|
17
|
+
*/
|
|
18
|
+
step?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Multiple of `step` applied by PageUp/PageDown.
|
|
21
|
+
*/
|
|
22
|
+
largeStep?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Decimal places; derived from `step` when null.
|
|
25
|
+
*/
|
|
26
|
+
precision?: number | null;
|
|
27
|
+
/**
|
|
28
|
+
* Whether stepping past a bound wraps to the other one.
|
|
29
|
+
*/
|
|
30
|
+
wrap?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Empty-state text.
|
|
33
|
+
*/
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Accessible name for the spinbutton.
|
|
37
|
+
*/
|
|
38
|
+
label?: string | null;
|
|
39
|
+
/**
|
|
40
|
+
* Suffix rendered inside the control (e.g. `%`, `kg`).
|
|
41
|
+
*/
|
|
42
|
+
unit?: string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Whether interaction is disabled.
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the value is read-only.
|
|
49
|
+
*/
|
|
50
|
+
readonly?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Whether an empty value is invalid.
|
|
53
|
+
*/
|
|
54
|
+
required?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Native form field name.
|
|
57
|
+
*/
|
|
58
|
+
name?: string | null;
|
|
59
|
+
/**
|
|
60
|
+
* Whether to render thousands separators while idle.
|
|
61
|
+
*/
|
|
62
|
+
group?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Locale for formatting; defaults to the document locale.
|
|
65
|
+
*/
|
|
66
|
+
locale?: string | null;
|
|
67
|
+
/**
|
|
68
|
+
* Localized messages.
|
|
69
|
+
*/
|
|
70
|
+
msg?: Record<string, string> | Record<string, Record<string, string>>;
|
|
71
|
+
/**
|
|
72
|
+
* Committed-value listener.
|
|
73
|
+
*/
|
|
74
|
+
onchange?: (event: CustomEvent<{
|
|
75
|
+
value: number | null;
|
|
76
|
+
}>) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Per-keystroke listener.
|
|
79
|
+
*/
|
|
80
|
+
oninput?: (event: CustomEvent<{
|
|
81
|
+
value: number | null;
|
|
82
|
+
}>) => void;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* @typedef {Object} NumberFieldOptions
|
|
86
|
+
* @property {number|null} [value=null] Initial value, or null for empty.
|
|
87
|
+
* @property {number|null} [min=null] Lowest accepted value.
|
|
88
|
+
* @property {number|null} [max=null] Highest accepted value.
|
|
89
|
+
* @property {number} [step=1] Increment applied by the buttons and arrow keys.
|
|
90
|
+
* @property {number} [largeStep=10] Multiple of `step` applied by PageUp/PageDown.
|
|
91
|
+
* @property {number|null} [precision=null] Decimal places; derived from `step` when null.
|
|
92
|
+
* @property {boolean} [wrap=false] Whether stepping past a bound wraps to the other one.
|
|
93
|
+
* @property {string} [placeholder=''] Empty-state text.
|
|
94
|
+
* @property {string|null} [label=null] Accessible name for the spinbutton.
|
|
95
|
+
* @property {string|null} [unit=null] Suffix rendered inside the control (e.g. `%`, `kg`).
|
|
96
|
+
* @property {boolean} [disabled=false] Whether interaction is disabled.
|
|
97
|
+
* @property {boolean} [readonly=false] Whether the value is read-only.
|
|
98
|
+
* @property {boolean} [required=false] Whether an empty value is invalid.
|
|
99
|
+
* @property {string|null} [name=null] Native form field name.
|
|
100
|
+
* @property {boolean} [group=false] Whether to render thousands separators while idle.
|
|
101
|
+
* @property {string|null} [locale=null] Locale for formatting; defaults to the document locale.
|
|
102
|
+
* @property {Record<string, string>|Record<string, Record<string, string>>} [msg] Localized messages.
|
|
103
|
+
* @property {(event: CustomEvent<{value: number|null}>) => void} [onchange] Committed-value listener.
|
|
104
|
+
* @property {(event: CustomEvent<{value: number|null}>) => void} [oninput] Per-keystroke listener.
|
|
105
|
+
*/
|
|
106
|
+
/**
|
|
107
|
+
* Numeric input with decrement and increment buttons, following the APG spinbutton pattern.
|
|
108
|
+
*
|
|
109
|
+
* The step buttons are pointer affordances only (`tabindex="-1"`, `aria-hidden`): the input
|
|
110
|
+
* itself is the spinbutton, so keyboard and screen-reader users step with the arrow keys rather
|
|
111
|
+
* than tabbing through two extra controls in every form row.
|
|
112
|
+
*
|
|
113
|
+
* @fires NumberField#change
|
|
114
|
+
* @fires NumberField#input
|
|
115
|
+
* @extends {Component<NumberFieldOptions>}
|
|
116
|
+
*/
|
|
117
|
+
export declare class NumberField extends Component<NumberFieldOptions> {
|
|
118
|
+
_value: number;
|
|
119
|
+
_disabled: boolean;
|
|
120
|
+
_readonly: boolean;
|
|
121
|
+
_editing: boolean;
|
|
122
|
+
_createdRoot: boolean;
|
|
123
|
+
_snapshot: import("../../core/dom.js").TargetSnapshot;
|
|
124
|
+
_step: number;
|
|
125
|
+
_precision: number;
|
|
126
|
+
_min: number;
|
|
127
|
+
_max: number;
|
|
128
|
+
_localeSeparators: {
|
|
129
|
+
group: string;
|
|
130
|
+
decimal: string;
|
|
131
|
+
};
|
|
132
|
+
static cssName: string;
|
|
133
|
+
/** @type {NumberFieldOptions} */
|
|
134
|
+
static defaults: NumberFieldOptions;
|
|
135
|
+
/** @returns {HTMLElement} */
|
|
136
|
+
render(): HTMLElement;
|
|
137
|
+
/** Current value, or null when empty. @returns {number|null} */
|
|
138
|
+
get value(): number | null;
|
|
139
|
+
/** @param {number|null} next Next value. */
|
|
140
|
+
set value(next: number | null);
|
|
141
|
+
/**
|
|
142
|
+
* Returns the current value.
|
|
143
|
+
* @returns {number|null}
|
|
144
|
+
*/
|
|
145
|
+
get(): number | null;
|
|
146
|
+
/**
|
|
147
|
+
* Sets the value, snapping it to `step` and clamping it into `[min, max]`.
|
|
148
|
+
* @param {number|string|null} next Next value; empty strings and null clear the field.
|
|
149
|
+
* @param {{silent?: boolean}} [options={}] Set `silent` to suppress `change`.
|
|
150
|
+
* @returns {this}
|
|
151
|
+
* @fires NumberField#change
|
|
152
|
+
*/
|
|
153
|
+
set(next: number | string | null, { silent }?: {
|
|
154
|
+
silent?: boolean;
|
|
155
|
+
}): this;
|
|
156
|
+
/**
|
|
157
|
+
* Increases the value by `count` steps.
|
|
158
|
+
* @param {number} [count=1] Number of steps.
|
|
159
|
+
* @returns {this}
|
|
160
|
+
* @fires NumberField#change
|
|
161
|
+
*/
|
|
162
|
+
stepUp(count?: number): this;
|
|
163
|
+
/**
|
|
164
|
+
* Decreases the value by `count` steps.
|
|
165
|
+
* @param {number} [count=1] Number of steps.
|
|
166
|
+
* @returns {this}
|
|
167
|
+
* @fires NumberField#change
|
|
168
|
+
*/
|
|
169
|
+
stepDown(count?: number): this;
|
|
170
|
+
/**
|
|
171
|
+
* Restores the configured initial value.
|
|
172
|
+
* @param {{silent?: boolean}} [options={}] Reset behavior.
|
|
173
|
+
* @returns {this}
|
|
174
|
+
*/
|
|
175
|
+
reset({ silent }?: {
|
|
176
|
+
silent?: boolean;
|
|
177
|
+
}): this;
|
|
178
|
+
/** Focuses the input. @returns {this} */
|
|
179
|
+
focus(): this;
|
|
180
|
+
/** Returns the underlying input element. @returns {HTMLInputElement} */
|
|
181
|
+
getInput(): HTMLInputElement;
|
|
182
|
+
/** Enables user interaction. @returns {this} */
|
|
183
|
+
enable(): this;
|
|
184
|
+
/** Disables user interaction. @returns {this} */
|
|
185
|
+
disable(): this;
|
|
186
|
+
/**
|
|
187
|
+
* Sets the read-only state.
|
|
188
|
+
* @param {boolean} readonly Whether the value is read-only.
|
|
189
|
+
* @returns {this}
|
|
190
|
+
*/
|
|
191
|
+
setReadonly(readonly: boolean): this;
|
|
192
|
+
/**
|
|
193
|
+
* Replaces the accepted range.
|
|
194
|
+
* @param {number|null} min Lowest accepted value.
|
|
195
|
+
* @param {number|null} max Highest accepted value.
|
|
196
|
+
* @returns {this}
|
|
197
|
+
*/
|
|
198
|
+
setRange(min: number | null, max: number | null): this;
|
|
199
|
+
/** @param {'down'|'up'} direction @param {string} glyph @returns {HTMLButtonElement} */
|
|
200
|
+
_stepButton(direction: 'down' | 'up', glyph: string): HTMLButtonElement;
|
|
201
|
+
/** @returns {number|null} */
|
|
202
|
+
get _rangeMin(): number | null;
|
|
203
|
+
/** @returns {number|null} */
|
|
204
|
+
get _rangeMax(): number | null;
|
|
205
|
+
/**
|
|
206
|
+
* Parses, snaps, and clamps an arbitrary input value.
|
|
207
|
+
* @param {unknown} raw Value from an option, a method call, or the input element.
|
|
208
|
+
* @returns {number|null}
|
|
209
|
+
*/
|
|
210
|
+
_coerce(raw: unknown): number | null;
|
|
211
|
+
/**
|
|
212
|
+
* Applies `count` steps relative to the current value.
|
|
213
|
+
* @param {number} count Signed step count.
|
|
214
|
+
* @returns {this}
|
|
215
|
+
*/
|
|
216
|
+
_stepBy(count: number): this;
|
|
217
|
+
/**
|
|
218
|
+
* The grouping and decimal separators of the configured locale.
|
|
219
|
+
* @returns {{group: string, decimal: string}}
|
|
220
|
+
*/
|
|
221
|
+
_separators(): {
|
|
222
|
+
group: string;
|
|
223
|
+
decimal: string;
|
|
224
|
+
};
|
|
225
|
+
/** @returns {void} */
|
|
226
|
+
_onInput(): void;
|
|
227
|
+
/** @param {KeyboardEvent} event @returns {void} */
|
|
228
|
+
_onKeydown(event: KeyboardEvent): void;
|
|
229
|
+
/** Parses whatever the user typed and normalizes the displayed text. @returns {void} */
|
|
230
|
+
_commit(): void;
|
|
231
|
+
/** @returns {void} */
|
|
232
|
+
_syncInput(): void;
|
|
233
|
+
/**
|
|
234
|
+
* @param {number|null} value Value to announce.
|
|
235
|
+
* @returns {void}
|
|
236
|
+
*/
|
|
237
|
+
_syncAria(value: number | null): void;
|
|
238
|
+
/**
|
|
239
|
+
* @param {number} value Value to render.
|
|
240
|
+
* @param {boolean} editing Whether the field currently has focus.
|
|
241
|
+
* @returns {string}
|
|
242
|
+
*/
|
|
243
|
+
_format(value: number, editing: boolean): string;
|
|
244
|
+
/**
|
|
245
|
+
* @param {string} key Message key.
|
|
246
|
+
* @param {string} fallback Text used when the host has no translation.
|
|
247
|
+
* @returns {string}
|
|
248
|
+
*/
|
|
249
|
+
_message(key: string, fallback: string): string;
|
|
250
|
+
/** @returns {void} */
|
|
251
|
+
_syncDisabled(): void;
|
|
252
|
+
/** Restores an enhanced target to the markup it had before the takeover. @returns {void} */
|
|
253
|
+
destroy(): void;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Committed value change.
|
|
257
|
+
* @event NumberField#change
|
|
258
|
+
* @type {CustomEvent<{value: number|null}>}
|
|
259
|
+
*/
|
|
260
|
+
/**
|
|
261
|
+
* Per-keystroke value change; the value may still be unsnapped or out of range.
|
|
262
|
+
* @event NumberField#input
|
|
263
|
+
* @type {CustomEvent<{value: number|null}>}
|
|
264
|
+
*/
|
|
265
|
+
/**
|
|
266
|
+
* Parses a user-entered number.
|
|
267
|
+
*
|
|
268
|
+
* With `separators` (from the field's locale) the grouping character is removed and the decimal
|
|
269
|
+
* character is honoured, so a displayed `1,234` in en-US reads back as 1234 rather than 1.234.
|
|
270
|
+
* Without them, the last of `.` or `,` is treated as the decimal point and the other as grouping,
|
|
271
|
+
* which is the best available guess for free-form typing.
|
|
272
|
+
*
|
|
273
|
+
* @param {unknown} raw Value to parse.
|
|
274
|
+
* @param {{group: string, decimal: string}|null} [separators=null] Known locale separators.
|
|
275
|
+
* @returns {number|null} The number, or null when the input is empty or unparseable.
|
|
276
|
+
*/
|
|
277
|
+
export declare function parseNumber(raw: unknown, separators?: {
|
|
278
|
+
group: string;
|
|
279
|
+
decimal: string;
|
|
280
|
+
} | null): number | null;
|
|
281
|
+
/**
|
|
282
|
+
* Snaps a number onto the step grid and clamps it into the accepted range.
|
|
283
|
+
* @param {number} value Raw value.
|
|
284
|
+
* @param {{min: number|null, max: number|null, step: number, precision: number}} spec Constraints.
|
|
285
|
+
* @returns {number}
|
|
286
|
+
*/
|
|
287
|
+
export declare function snapNumber(value: number, { min, max, step, precision }: {
|
|
288
|
+
min: number | null;
|
|
289
|
+
max: number | null;
|
|
290
|
+
step: number;
|
|
291
|
+
precision: number;
|
|
292
|
+
}): number;
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type PaginationMode = 'pages' | 'loadmore';
|
|
3
|
+
export type PaginationRangeOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* One-based current page.
|
|
6
|
+
*/
|
|
7
|
+
page: number;
|
|
8
|
+
/**
|
|
9
|
+
* Total number of pages.
|
|
10
|
+
*/
|
|
11
|
+
pages: number;
|
|
12
|
+
/**
|
|
13
|
+
* Pages shown either side of the current one.
|
|
14
|
+
*/
|
|
15
|
+
siblings?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Pages pinned at each end of the range.
|
|
18
|
+
*/
|
|
19
|
+
boundaries?: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {Object} PaginationRangeOptions
|
|
23
|
+
* @property {number} page One-based current page.
|
|
24
|
+
* @property {number} pages Total number of pages.
|
|
25
|
+
* @property {number} [siblings=1] Pages shown either side of the current one.
|
|
26
|
+
* @property {number} [boundaries=1] Pages pinned at each end of the range.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Computes the page window: the numbers a pager shows, with `'…'` standing in for every run it
|
|
30
|
+
* skipped. Pure arithmetic, no DOM — the component renders whatever this returns.
|
|
31
|
+
*
|
|
32
|
+
* The window has a fixed width of `boundaries * 2 + siblings * 2 + 3` entries (the current page
|
|
33
|
+
* plus two possible gaps), so it never jitters as the user walks through the pages. Any shorter
|
|
34
|
+
* range is returned in full. A single skipped page is printed instead of a gap, because `…`
|
|
35
|
+
* standing for one number would be a lie. `boundaries: 0` drops the pinned first and last pages.
|
|
36
|
+
* @param {PaginationRangeOptions} options Window description.
|
|
37
|
+
* @returns {Array<number|'…'>} One-based page numbers interleaved with ellipses.
|
|
38
|
+
*/
|
|
39
|
+
export declare function paginationRange({ page, pages, siblings, boundaries }?: PaginationRangeOptions): Array<number | '…'>;
|
|
40
|
+
export type PaginationOptions = {
|
|
41
|
+
/**
|
|
42
|
+
* One-based current page.
|
|
43
|
+
*/
|
|
44
|
+
page?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Rows per page.
|
|
47
|
+
*/
|
|
48
|
+
pageSize?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Total row count; 0 is one empty page.
|
|
51
|
+
*/
|
|
52
|
+
total?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Choices offered by the page-size select.
|
|
55
|
+
*/
|
|
56
|
+
pageSizes?: number[];
|
|
57
|
+
/**
|
|
58
|
+
* Pages shown either side of the current one.
|
|
59
|
+
*/
|
|
60
|
+
siblings?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Pages pinned at each end of the range.
|
|
63
|
+
*/
|
|
64
|
+
boundaries?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Whether to render the page-size select.
|
|
67
|
+
*/
|
|
68
|
+
showPageSize?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether to render the "26–50 of 312" summary.
|
|
71
|
+
*/
|
|
72
|
+
showSummary?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* `pages` renders a numbered pager, `loadmore` a single
|
|
75
|
+
* "Load more" button for append-style lists.
|
|
76
|
+
*/
|
|
77
|
+
mode?: PaginationMode;
|
|
78
|
+
/**
|
|
79
|
+
* Whether every control starts disabled.
|
|
80
|
+
*/
|
|
81
|
+
disabled?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Localized messages.
|
|
84
|
+
*/
|
|
85
|
+
msg?: Record<string, string> | Record<string, Record<string, string>>;
|
|
86
|
+
/**
|
|
87
|
+
* Change listener.
|
|
88
|
+
*/
|
|
89
|
+
onchange?: (event: CustomEvent<PaginationChangeDetail>) => void;
|
|
90
|
+
};
|
|
91
|
+
export type PaginationState = {
|
|
92
|
+
/**
|
|
93
|
+
* One-based current page.
|
|
94
|
+
*/
|
|
95
|
+
page: number;
|
|
96
|
+
/**
|
|
97
|
+
* Rows per page.
|
|
98
|
+
*/
|
|
99
|
+
pageSize: number;
|
|
100
|
+
/**
|
|
101
|
+
* Total row count.
|
|
102
|
+
*/
|
|
103
|
+
total: number;
|
|
104
|
+
/**
|
|
105
|
+
* Number of pages; at least 1.
|
|
106
|
+
*/
|
|
107
|
+
pages: number;
|
|
108
|
+
/**
|
|
109
|
+
* Zero-based row offset of the current page.
|
|
110
|
+
*/
|
|
111
|
+
offset: number;
|
|
112
|
+
};
|
|
113
|
+
export type PaginationChangeDetail = PaginationState;
|
|
114
|
+
/**
|
|
115
|
+
* @typedef {Object} PaginationOptions
|
|
116
|
+
* @property {number} [page=1] One-based current page.
|
|
117
|
+
* @property {number} [pageSize=25] Rows per page.
|
|
118
|
+
* @property {number} [total=0] Total row count; 0 is one empty page.
|
|
119
|
+
* @property {number[]} [pageSizes=[25, 50, 100]] Choices offered by the page-size select.
|
|
120
|
+
* @property {number} [siblings=1] Pages shown either side of the current one.
|
|
121
|
+
* @property {number} [boundaries=1] Pages pinned at each end of the range.
|
|
122
|
+
* @property {boolean} [showPageSize=true] Whether to render the page-size select.
|
|
123
|
+
* @property {boolean} [showSummary=true] Whether to render the "26–50 of 312" summary.
|
|
124
|
+
* @property {PaginationMode} [mode='pages'] `pages` renders a numbered pager, `loadmore` a single
|
|
125
|
+
* "Load more" button for append-style lists.
|
|
126
|
+
* @property {boolean} [disabled=false] Whether every control starts disabled.
|
|
127
|
+
* @property {Record<string, string>|Record<string, Record<string, string>>} [msg] Localized messages.
|
|
128
|
+
* @property {(event: CustomEvent<PaginationChangeDetail>) => void} [onchange] Change listener.
|
|
129
|
+
*/
|
|
130
|
+
/**
|
|
131
|
+
* @typedef {Object} PaginationState
|
|
132
|
+
* @property {number} page One-based current page.
|
|
133
|
+
* @property {number} pageSize Rows per page.
|
|
134
|
+
* @property {number} total Total row count.
|
|
135
|
+
* @property {number} pages Number of pages; at least 1.
|
|
136
|
+
* @property {number} offset Zero-based row offset of the current page.
|
|
137
|
+
*/
|
|
138
|
+
/** @typedef {PaginationState} PaginationChangeDetail */
|
|
139
|
+
/**
|
|
140
|
+
* The pager for a server-backed list. It owns no data: it reports which slice the user asked for
|
|
141
|
+
* and lets the application fetch it, which is exactly the shape `zeyosTable()` expects —
|
|
142
|
+
* `offset`/`pageSize` for `load()` in `pages` mode, or one `change` per `loadMore()` in
|
|
143
|
+
* `loadmore` mode.
|
|
144
|
+
*
|
|
145
|
+
* `page` is clamped into `[1, pages]` after every state change, so shrinking `total` under the
|
|
146
|
+
* user's feet can never leave the pager pointing past the end of the data.
|
|
147
|
+
* @fires Pagination#change
|
|
148
|
+
* @extends {Component<PaginationOptions>}
|
|
149
|
+
*/
|
|
150
|
+
export declare class Pagination extends Component<PaginationOptions> {
|
|
151
|
+
_createdRoot: boolean;
|
|
152
|
+
_snapshot: import("../../core/dom.js").TargetSnapshot;
|
|
153
|
+
_destroyed: boolean;
|
|
154
|
+
_pageSize: number;
|
|
155
|
+
_total: number;
|
|
156
|
+
_page: number;
|
|
157
|
+
_disabled: boolean;
|
|
158
|
+
_sizeKey: any;
|
|
159
|
+
_pageSizes: number[];
|
|
160
|
+
static cssName: string;
|
|
161
|
+
/** @type {Readonly<PaginationOptions>} */
|
|
162
|
+
static defaults: Readonly<PaginationOptions>;
|
|
163
|
+
/**
|
|
164
|
+
* Creates or enhances a pager.
|
|
165
|
+
* @param {Element|string|null} target Existing container, selector, or null.
|
|
166
|
+
* @param {PaginationOptions} [options={}] Pagination options.
|
|
167
|
+
*/
|
|
168
|
+
constructor(target: Element | string | null, options?: PaginationOptions);
|
|
169
|
+
/**
|
|
170
|
+
* Builds the pager. Runs inside the base constructor, so instance state is initialized here.
|
|
171
|
+
* @returns {HTMLElement}
|
|
172
|
+
*/
|
|
173
|
+
render(): HTMLElement;
|
|
174
|
+
/**
|
|
175
|
+
* Moves to a page, clamped into `[1, pages]`.
|
|
176
|
+
* @param {number} page One-based page number.
|
|
177
|
+
* @returns {this}
|
|
178
|
+
* @fires Pagination#change
|
|
179
|
+
*/
|
|
180
|
+
setPage(page: number): this;
|
|
181
|
+
/**
|
|
182
|
+
* Replaces the total row count and re-clamps the page. Silent: servers report the count as part
|
|
183
|
+
* of a response the pager itself asked for, so echoing a `change` back would loop.
|
|
184
|
+
* @param {number} total Total row count.
|
|
185
|
+
* @returns {this}
|
|
186
|
+
*/
|
|
187
|
+
setTotal(total: number): this;
|
|
188
|
+
/**
|
|
189
|
+
* Replaces the page size and returns to page 1.
|
|
190
|
+
* @param {number} pageSize Rows per page.
|
|
191
|
+
* @returns {this}
|
|
192
|
+
* @fires Pagination#change
|
|
193
|
+
*/
|
|
194
|
+
setPageSize(pageSize: number): this;
|
|
195
|
+
/**
|
|
196
|
+
* Applies any combination of page, page size, and total in one pass, then clamps the page.
|
|
197
|
+
* `change` fires when the effective page or page size moved — updating only `total` is silent
|
|
198
|
+
* unless the new count clamps the page.
|
|
199
|
+
* @param {Partial<Pick<PaginationState, 'page'|'pageSize'|'total'>>} [state={}] Values to change.
|
|
200
|
+
* @param {{silent?: boolean}} [options={}] Set `silent` to suppress the event.
|
|
201
|
+
* @returns {this}
|
|
202
|
+
* @fires Pagination#change
|
|
203
|
+
*/
|
|
204
|
+
setState(state?: Partial<Pick<PaginationState, 'page' | 'pageSize' | 'total'>>, { silent }?: {
|
|
205
|
+
silent?: boolean;
|
|
206
|
+
}): this;
|
|
207
|
+
/**
|
|
208
|
+
* Returns the current slice description.
|
|
209
|
+
* @returns {PaginationState}
|
|
210
|
+
*/
|
|
211
|
+
getState(): PaginationState;
|
|
212
|
+
/**
|
|
213
|
+
* Enables every control.
|
|
214
|
+
* @returns {this}
|
|
215
|
+
*/
|
|
216
|
+
enable(): this;
|
|
217
|
+
/**
|
|
218
|
+
* Disables every control, for instance while a page is in flight.
|
|
219
|
+
* @returns {this}
|
|
220
|
+
*/
|
|
221
|
+
disable(): this;
|
|
222
|
+
/**
|
|
223
|
+
* Aborts listeners and restores an enhanced target to the markup it had before the takeover.
|
|
224
|
+
* @returns {void}
|
|
225
|
+
*/
|
|
226
|
+
destroy(): void;
|
|
227
|
+
/** @returns {number} Page count; an empty list is one empty page. */
|
|
228
|
+
_pageCount(): number;
|
|
229
|
+
/** @returns {HTMLElement} The page-size select and its visible label. */
|
|
230
|
+
_renderPageSize(): HTMLElement;
|
|
231
|
+
/** @returns {HTMLElement} Previous / page buttons / next. */
|
|
232
|
+
_renderPages(): HTMLElement;
|
|
233
|
+
/**
|
|
234
|
+
* @param {string} ref Ref name.
|
|
235
|
+
* @param {string} glyph Icon name.
|
|
236
|
+
* @param {string} label Accessible name.
|
|
237
|
+
* @returns {HTMLElement}
|
|
238
|
+
*/
|
|
239
|
+
_navButton(ref: string, glyph: string, label: string): HTMLElement;
|
|
240
|
+
/** @returns {HTMLElement} The append-style trigger. */
|
|
241
|
+
_renderLoadMore(): HTMLElement;
|
|
242
|
+
/** Attaches the delegated listeners once, after the shell exists. @returns {void} */
|
|
243
|
+
_wire(): void;
|
|
244
|
+
/** Pushes the current state onto every control. @returns {void} */
|
|
245
|
+
_sync(): void;
|
|
246
|
+
/**
|
|
247
|
+
* @returns {string} The "26–50 of 312" line.
|
|
248
|
+
*/
|
|
249
|
+
_summary(): string;
|
|
250
|
+
/** Rebuilds the page-size options only when the choice set actually changed. @returns {void} */
|
|
251
|
+
_syncPageSize(): void;
|
|
252
|
+
/**
|
|
253
|
+
* Rebuilds the page buttons, keeping the keyboard focus on the same page number when the user
|
|
254
|
+
* paged with the keyboard and that number survived the rebuild.
|
|
255
|
+
* @param {number} pages Page count.
|
|
256
|
+
* @returns {void}
|
|
257
|
+
*/
|
|
258
|
+
_syncPages(pages: number): void;
|
|
259
|
+
/**
|
|
260
|
+
* Resolves a message through the host translator, falling back to the built-in English text.
|
|
261
|
+
* @param {string} key Message key.
|
|
262
|
+
* @param {string} fallback Built-in text, with `%1`-style placeholders.
|
|
263
|
+
* @param {...unknown} args Interpolation values.
|
|
264
|
+
* @returns {string}
|
|
265
|
+
*/
|
|
266
|
+
_message(key: string, fallback: string, ...args: unknown[]): string;
|
|
267
|
+
}
|