@4sh/ui-kit 0.15.0 → 0.17.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/README.fr.md +18 -10
- package/README.md +18 -10
- package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs +542 -150
- package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-actions-ui-button.mjs +622 -248
- package/fesm2022/4sh-ui-kit-actions-ui-button.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-actions-ui-link.mjs +385 -152
- package/fesm2022/4sh-ui-kit-actions-ui-link.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs +748 -433
- package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-base-ui-icon.mjs +227 -135
- package/fesm2022/4sh-ui-kit-base-ui-icon.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-base-ui-image.mjs +1200 -633
- package/fesm2022/4sh-ui-kit-base-ui-image.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs +1675 -953
- package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs +243 -117
- package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs +2294 -2039
- package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs +1058 -1113
- package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs +1108 -0
- package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-forms-ui-field.mjs +397 -141
- package/fesm2022/4sh-ui-kit-forms-ui-field.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs +1529 -583
- package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs +383 -224
- package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs +345 -177
- package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs +280 -130
- package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs +507 -246
- package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs +401 -291
- package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs +1277 -697
- package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input.mjs +467 -194
- package/fesm2022/4sh-ui-kit-forms-ui-input.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs +394 -270
- package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-label.mjs +140 -60
- package/fesm2022/4sh-ui-kit-forms-ui-label.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs +386 -167
- package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs +150 -87
- package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs +345 -180
- package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs +582 -392
- package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-select.mjs +1552 -888
- package/fesm2022/4sh-ui-kit-forms-ui-select.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs +485 -338
- package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs +503 -311
- package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs +271 -131
- package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs +457 -214
- package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs +711 -371
- package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs +235 -121
- package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms.mjs +723 -596
- package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs +546 -242
- package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs +335 -157
- package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs +53 -33
- package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs +218 -121
- package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs +192 -100
- package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs +456 -204
- package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs +314 -147
- package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs +179 -82
- package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs +268 -123
- package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs +391 -146
- package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs +158 -76
- package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs +159 -80
- package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs +295 -131
- package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs +211 -83
- package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs +784 -414
- package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs +822 -476
- package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs +1014 -599
- package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-card.mjs +403 -189
- package/fesm2022/4sh-ui-kit-layout-ui-card.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs +707 -272
- package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs +1146 -568
- package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs +519 -308
- package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-motion.mjs +252 -150
- package/fesm2022/4sh-ui-kit-motion.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs +793 -341
- package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs +351 -194
- package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs +511 -220
- package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs +910 -548
- package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs +1128 -555
- package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs +915 -470
- package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs +931 -474
- package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-overlay.mjs +26 -109
- package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-ripple.mjs +329 -290
- package/fesm2022/4sh-ui-kit-ripple.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs +709 -248
- package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-table-ui-table.mjs +2633 -1370
- package/fesm2022/4sh-ui-kit-table-ui-table.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-theming.mjs +112 -113
- package/fesm2022/4sh-ui-kit-theming.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-types.mjs +0 -12
- package/fesm2022/4sh-ui-kit.mjs +3 -15
- package/fesm2022/4sh-ui-kit.mjs.map +1 -1
- package/mcp/data/component-api.json +313 -2
- package/mcp/data/text-search-docs.json +177 -17
- package/mcp/data/ui-config.json +378 -1
- package/mcp/index.js +8190 -2876
- package/mcp/package.json +1 -1
- package/package.json +5 -1
- package/styles/component-vars.scss +22 -1
- package/styles/utils/_mixins.scss +11 -0
- package/types/4sh-ui-kit-actions-ui-button-split.d.ts +198 -87
- package/types/4sh-ui-kit-actions-ui-button.d.ts +240 -116
- package/types/4sh-ui-kit-actions-ui-link.d.ts +136 -67
- package/types/4sh-ui-kit-actions-ui-speed-dial.d.ts +287 -180
- package/types/4sh-ui-kit-base-ui-icon.d.ts +92 -58
- package/types/4sh-ui-kit-base-ui-image.d.ts +406 -205
- package/types/4sh-ui-kit-forms-ui-autocomplete.d.ts +577 -367
- package/types/4sh-ui-kit-forms-ui-checkbox.d.ts +77 -42
- package/types/4sh-ui-kit-forms-ui-datepicker.d.ts +953 -700
- package/types/4sh-ui-kit-forms-ui-editor.d.ts +374 -340
- package/types/4sh-ui-kit-forms-ui-field-sign.d.ts +325 -0
- package/types/4sh-ui-kit-forms-ui-field.d.ts +150 -64
- package/types/4sh-ui-kit-forms-ui-file-upload.d.ts +583 -241
- package/types/4sh-ui-kit-forms-ui-input-date.d.ts +152 -103
- package/types/4sh-ui-kit-forms-ui-input-group.d.ts +109 -63
- package/types/4sh-ui-kit-forms-ui-input-mask.d.ts +93 -57
- package/types/4sh-ui-kit-forms-ui-input-number.d.ts +171 -93
- package/types/4sh-ui-kit-forms-ui-input-otp.d.ts +137 -100
- package/types/4sh-ui-kit-forms-ui-input-tags.d.ts +469 -309
- package/types/4sh-ui-kit-forms-ui-input.d.ts +198 -116
- package/types/4sh-ui-kit-forms-ui-knob.d.ts +132 -80
- package/types/4sh-ui-kit-forms-ui-label.d.ts +47 -22
- package/types/4sh-ui-kit-forms-ui-nudger.d.ts +134 -67
- package/types/4sh-ui-kit-forms-ui-radio.d.ts +48 -33
- package/types/4sh-ui-kit-forms-ui-rating.d.ts +120 -86
- package/types/4sh-ui-kit-forms-ui-segment-control.d.ts +221 -147
- package/types/4sh-ui-kit-forms-ui-select.d.ts +561 -357
- package/types/4sh-ui-kit-forms-ui-slider.d.ts +156 -105
- package/types/4sh-ui-kit-forms-ui-swatch-picker.d.ts +133 -97
- package/types/4sh-ui-kit-forms-ui-textarea.d.ts +90 -54
- package/types/4sh-ui-kit-forms-ui-toggle-block.d.ts +158 -94
- package/types/4sh-ui-kit-forms-ui-toggle-button.d.ts +314 -178
- package/types/4sh-ui-kit-forms-ui-toggle.d.ts +88 -54
- package/types/4sh-ui-kit-forms.d.ts +291 -186
- package/types/4sh-ui-kit-informative-ui-accordion.d.ts +162 -92
- package/types/4sh-ui-kit-informative-ui-alert.d.ts +128 -62
- package/types/4sh-ui-kit-informative-ui-avatar-group.d.ts +8 -8
- package/types/4sh-ui-kit-informative-ui-avatar.d.ts +81 -44
- package/types/4sh-ui-kit-informative-ui-badge.d.ts +71 -41
- package/types/4sh-ui-kit-informative-ui-chip.d.ts +194 -99
- package/types/4sh-ui-kit-informative-ui-empty-state.d.ts +105 -65
- package/types/4sh-ui-kit-informative-ui-helper.d.ts +64 -34
- package/types/4sh-ui-kit-informative-ui-progress-bar.d.ts +120 -65
- package/types/4sh-ui-kit-informative-ui-read-only.d.ts +147 -67
- package/types/4sh-ui-kit-informative-ui-separator.d.ts +65 -35
- package/types/4sh-ui-kit-informative-ui-skeleton.d.ts +62 -32
- package/types/4sh-ui-kit-informative-ui-spinner.d.ts +111 -50
- package/types/4sh-ui-kit-informative-ui-tag.d.ts +77 -37
- package/types/4sh-ui-kit-informative-ui-toast.d.ts +300 -180
- package/types/4sh-ui-kit-informative-ui-tooltip.d.ts +269 -141
- package/types/4sh-ui-kit-layout-ui-bottom-sheet.d.ts +360 -221
- package/types/4sh-ui-kit-layout-ui-card.d.ts +119 -79
- package/types/4sh-ui-kit-layout-ui-drawer.d.ts +244 -120
- package/types/4sh-ui-kit-layout-ui-modal.d.ts +409 -222
- package/types/4sh-ui-kit-layout-ui-popover.d.ts +149 -91
- package/types/4sh-ui-kit-motion.d.ts +117 -67
- package/types/4sh-ui-kit-navigation-ui-bottom-tab-bar.d.ts +279 -145
- package/types/4sh-ui-kit-navigation-ui-breadcrumb.d.ts +134 -96
- package/types/4sh-ui-kit-navigation-ui-context-menu.d.ts +148 -89
- package/types/4sh-ui-kit-navigation-ui-menu.d.ts +282 -201
- package/types/4sh-ui-kit-navigation-ui-sidebar.d.ts +425 -261
- package/types/4sh-ui-kit-navigation-ui-stepper.d.ts +279 -183
- package/types/4sh-ui-kit-navigation-ui-tabs.d.ts +275 -173
- package/types/4sh-ui-kit-overlay.d.ts +6 -6
- package/types/4sh-ui-kit-ripple.d.ts +99 -74
- package/types/4sh-ui-kit-table-ui-paginator.d.ts +237 -133
- package/types/4sh-ui-kit-table-ui-table.d.ts +769 -470
- package/types/4sh-ui-kit-theming.d.ts +27 -29
- package/types/4sh-ui-kit-types.d.ts +6 -5
- package/types/4sh-ui-kit.d.ts +4 -3
- package/fesm2022/4sh-ui-kit-types.mjs.map +0 -1
|
@@ -1,651 +1,778 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { takeUntilDestroyed } from
|
|
4
|
-
import { NgControl, PristineChangeEvent,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
/** Propagate a user-driven value change to the form (view → form). */
|
|
73
|
-
emitChange(value) {
|
|
74
|
-
this.onChange(value);
|
|
75
|
-
}
|
|
76
|
-
/** Mark the control as touched (call on blur). */
|
|
77
|
-
emitTouch() {
|
|
78
|
-
this.onTouched();
|
|
79
|
-
this.touched.set(true);
|
|
80
|
-
this.untouched.set(false);
|
|
81
|
-
}
|
|
82
|
-
/** Mirror the NgControl state into the signals. Wired automatically; safe to call once manually if needed. */
|
|
83
|
-
watchNgControlEvents() {
|
|
84
|
-
const control = this.injector.get(NgControl, null, { optional: true, self: true })?.control;
|
|
85
|
-
if (!control)
|
|
86
|
-
return;
|
|
87
|
-
const mirror = () => {
|
|
88
|
-
this.pristine.set(control.pristine);
|
|
89
|
-
this.dirty.set(control.dirty);
|
|
90
|
-
this.touched.set(control.touched);
|
|
91
|
-
this.untouched.set(control.untouched);
|
|
92
|
-
this.controlInvalid.set(control.invalid);
|
|
93
|
-
this.controlErrors.set(control.errors);
|
|
94
|
-
};
|
|
95
|
-
// Signal-forms interop provides a fake NgControl without an `events`
|
|
96
|
-
// stream, but its getters read the field's signals: mirroring inside
|
|
97
|
-
// an effect tracks them and keeps the state live.
|
|
98
|
-
if (!control.events) {
|
|
99
|
-
effect(mirror, { injector: this.injector });
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
// Seed with the current state (events only fire on transitions).
|
|
103
|
-
mirror();
|
|
104
|
-
control.events.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
|
105
|
-
if (event instanceof PristineChangeEvent) {
|
|
106
|
-
this.pristine.set(event.pristine);
|
|
107
|
-
this.dirty.set(!event.pristine);
|
|
108
|
-
}
|
|
109
|
-
else if (event instanceof TouchedChangeEvent) {
|
|
110
|
-
this.touched.set(event.touched);
|
|
111
|
-
this.untouched.set(!event.touched);
|
|
112
|
-
}
|
|
113
|
-
else if (event instanceof StatusChangeEvent) {
|
|
114
|
-
this.controlInvalid.set(event.status === 'INVALID');
|
|
115
|
-
this.controlErrors.set(control.errors);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { DestroyRef, Directive, Injector, afterNextRender, booleanAttribute, computed, effect, inject, input, isDevMode, output, signal } from "@angular/core";
|
|
3
|
+
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
4
|
+
import { NgControl, PristineChangeEvent, StatusChangeEvent, TouchedChangeEvent } from "@angular/forms";
|
|
5
|
+
var BaseControlValueAccessor = class {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.injector = inject(Injector);
|
|
8
|
+
this.destroyRef = inject(DestroyRef);
|
|
9
|
+
this.dirty = signal(false, ...ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []);
|
|
10
|
+
this.pristine = signal(true, ...ngDevMode ? [{ debugName: "pristine" }] : /* istanbul ignore next */ []);
|
|
11
|
+
this.touched = signal(false, ...ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []);
|
|
12
|
+
this.untouched = signal(true, ...ngDevMode ? [{ debugName: "untouched" }] : /* istanbul ignore next */ []);
|
|
13
|
+
this.controlInvalid = signal(false, ...ngDevMode ? [{ debugName: "controlInvalid" }] : /* istanbul ignore next */ []);
|
|
14
|
+
this.controlErrors = signal(null, ...ngDevMode ? [{ debugName: "controlErrors" }] : /* istanbul ignore next */ []);
|
|
15
|
+
this.controlDisabled = signal(false, ...ngDevMode ? [{ debugName: "controlDisabled" }] : /* istanbul ignore next */ []);
|
|
16
|
+
this.showError = computed(() => this.controlInvalid() && (this.touched() || this.dirty()), ...ngDevMode ? [{ debugName: "showError" }] : /* istanbul ignore next */ []);
|
|
17
|
+
this.onChange = () => {};
|
|
18
|
+
this.onTouched = () => {};
|
|
19
|
+
afterNextRender(() => this.watchNgControlEvents());
|
|
20
|
+
}
|
|
21
|
+
registerOnChange(fn) {
|
|
22
|
+
this.onChange = fn;
|
|
23
|
+
}
|
|
24
|
+
registerOnTouched(fn) {
|
|
25
|
+
this.onTouched = fn;
|
|
26
|
+
}
|
|
27
|
+
setDisabledState(isDisabled) {
|
|
28
|
+
this.controlDisabled.set(isDisabled);
|
|
29
|
+
}
|
|
30
|
+
emitChange(value) {
|
|
31
|
+
this.onChange(value);
|
|
32
|
+
}
|
|
33
|
+
emitTouch() {
|
|
34
|
+
this.onTouched();
|
|
35
|
+
this.touched.set(true);
|
|
36
|
+
this.untouched.set(false);
|
|
37
|
+
}
|
|
38
|
+
watchNgControlEvents() {
|
|
39
|
+
const control = this.injector.get(NgControl, null, {
|
|
40
|
+
optional: true,
|
|
41
|
+
self: true
|
|
42
|
+
})?.control;
|
|
43
|
+
if (!control) return;
|
|
44
|
+
const mirror = () => {
|
|
45
|
+
this.pristine.set(control.pristine);
|
|
46
|
+
this.dirty.set(control.dirty);
|
|
47
|
+
this.touched.set(control.touched);
|
|
48
|
+
this.untouched.set(control.untouched);
|
|
49
|
+
this.controlInvalid.set(control.invalid);
|
|
50
|
+
this.controlErrors.set(control.errors);
|
|
51
|
+
};
|
|
52
|
+
if (!control.events) {
|
|
53
|
+
effect(mirror, { injector: this.injector });
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
mirror();
|
|
57
|
+
control.events.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
|
58
|
+
if (event instanceof PristineChangeEvent) {
|
|
59
|
+
this.pristine.set(event.pristine);
|
|
60
|
+
this.dirty.set(!event.pristine);
|
|
61
|
+
} else if (event instanceof TouchedChangeEvent) {
|
|
62
|
+
this.touched.set(event.touched);
|
|
63
|
+
this.untouched.set(!event.touched);
|
|
64
|
+
} else if (event instanceof StatusChangeEvent) {
|
|
65
|
+
this.controlInvalid.set(event.status === "INVALID");
|
|
66
|
+
this.controlErrors.set(control.errors);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
121
71
|
let nextUid = 0;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
72
|
+
var BaseFieldControl = class BaseFieldControl extends BaseControlValueAccessor {
|
|
73
|
+
constructor() {
|
|
74
|
+
super(...arguments);
|
|
75
|
+
this.ariaLabel = input(...ngDevMode ? [void 0, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
76
|
+
this.ariaLabelledBy = input(...ngDevMode ? [void 0, { debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []);
|
|
77
|
+
this.inputId = input(...ngDevMode ? [void 0, { debugName: "inputId" }] : /* istanbul ignore next */ []);
|
|
78
|
+
this.name = input(...ngDevMode ? [void 0, { debugName: "name" }] : /* istanbul ignore next */ []);
|
|
79
|
+
this.required = input(false, {
|
|
80
|
+
...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
|
|
81
|
+
transform: booleanAttribute
|
|
82
|
+
});
|
|
83
|
+
this.disabled = input(false, {
|
|
84
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
85
|
+
transform: booleanAttribute
|
|
86
|
+
});
|
|
87
|
+
this.readonly = input(false, {
|
|
88
|
+
...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
|
|
89
|
+
transform: booleanAttribute
|
|
90
|
+
});
|
|
91
|
+
this.invalid = input(false, {
|
|
92
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
93
|
+
transform: booleanAttribute
|
|
94
|
+
});
|
|
95
|
+
this.tabindex = input(...ngDevMode ? [void 0, { debugName: "tabindex" }] : /* istanbul ignore next */ []);
|
|
96
|
+
this.uid = `${this.uidPrefix()}-${nextUid++}`;
|
|
97
|
+
this.modelValue = signal(void 0, ...ngDevMode ? [{ debugName: "modelValue" }] : /* istanbul ignore next */ []);
|
|
98
|
+
this.resolvedId = computed(() => this.inputId() ?? this.uid, ...ngDevMode ? [{ debugName: "resolvedId" }] : /* istanbul ignore next */ []);
|
|
99
|
+
this.messageId = computed(() => `${this.resolvedId()}-message`, ...ngDevMode ? [{ debugName: "messageId" }] : /* istanbul ignore next */ []);
|
|
100
|
+
this.isDisabled = computed(() => this.disabled() || this.controlDisabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
101
|
+
this.isInvalid = computed(() => this.invalid() || this.showError(), ...ngDevMode ? [{ debugName: "isInvalid" }] : /* istanbul ignore next */ []);
|
|
102
|
+
}
|
|
103
|
+
writeValue(value) {
|
|
104
|
+
this.modelValue.set(value);
|
|
105
|
+
}
|
|
106
|
+
uidPrefix() {
|
|
107
|
+
return "ui-field";
|
|
108
|
+
}
|
|
109
|
+
static {
|
|
110
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
111
|
+
minVersion: "12.0.0",
|
|
112
|
+
version: "22.3.0",
|
|
113
|
+
ngImport: i0,
|
|
114
|
+
type: BaseFieldControl,
|
|
115
|
+
deps: null,
|
|
116
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
static {
|
|
120
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
121
|
+
minVersion: "17.1.0",
|
|
122
|
+
version: "22.3.0",
|
|
123
|
+
type: BaseFieldControl,
|
|
124
|
+
isStandalone: true,
|
|
125
|
+
inputs: {
|
|
126
|
+
ariaLabel: {
|
|
127
|
+
classPropertyName: "ariaLabel",
|
|
128
|
+
publicName: "ariaLabel",
|
|
129
|
+
isSignal: true,
|
|
130
|
+
isRequired: false,
|
|
131
|
+
transformFunction: null
|
|
132
|
+
},
|
|
133
|
+
ariaLabelledBy: {
|
|
134
|
+
classPropertyName: "ariaLabelledBy",
|
|
135
|
+
publicName: "ariaLabelledBy",
|
|
136
|
+
isSignal: true,
|
|
137
|
+
isRequired: false,
|
|
138
|
+
transformFunction: null
|
|
139
|
+
},
|
|
140
|
+
inputId: {
|
|
141
|
+
classPropertyName: "inputId",
|
|
142
|
+
publicName: "inputId",
|
|
143
|
+
isSignal: true,
|
|
144
|
+
isRequired: false,
|
|
145
|
+
transformFunction: null
|
|
146
|
+
},
|
|
147
|
+
name: {
|
|
148
|
+
classPropertyName: "name",
|
|
149
|
+
publicName: "name",
|
|
150
|
+
isSignal: true,
|
|
151
|
+
isRequired: false,
|
|
152
|
+
transformFunction: null
|
|
153
|
+
},
|
|
154
|
+
required: {
|
|
155
|
+
classPropertyName: "required",
|
|
156
|
+
publicName: "required",
|
|
157
|
+
isSignal: true,
|
|
158
|
+
isRequired: false,
|
|
159
|
+
transformFunction: null
|
|
160
|
+
},
|
|
161
|
+
disabled: {
|
|
162
|
+
classPropertyName: "disabled",
|
|
163
|
+
publicName: "disabled",
|
|
164
|
+
isSignal: true,
|
|
165
|
+
isRequired: false,
|
|
166
|
+
transformFunction: null
|
|
167
|
+
},
|
|
168
|
+
readonly: {
|
|
169
|
+
classPropertyName: "readonly",
|
|
170
|
+
publicName: "readonly",
|
|
171
|
+
isSignal: true,
|
|
172
|
+
isRequired: false,
|
|
173
|
+
transformFunction: null
|
|
174
|
+
},
|
|
175
|
+
invalid: {
|
|
176
|
+
classPropertyName: "invalid",
|
|
177
|
+
publicName: "invalid",
|
|
178
|
+
isSignal: true,
|
|
179
|
+
isRequired: false,
|
|
180
|
+
transformFunction: null
|
|
181
|
+
},
|
|
182
|
+
tabindex: {
|
|
183
|
+
classPropertyName: "tabindex",
|
|
184
|
+
publicName: "tabindex",
|
|
185
|
+
isSignal: true,
|
|
186
|
+
isRequired: false,
|
|
187
|
+
transformFunction: null
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
usesInheritance: true,
|
|
191
|
+
ngImport: i0
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
196
|
+
minVersion: "12.0.0",
|
|
197
|
+
version: "22.3.0",
|
|
198
|
+
ngImport: i0,
|
|
199
|
+
type: BaseFieldControl,
|
|
200
|
+
decorators: [{ type: Directive }],
|
|
201
|
+
propDecorators: {
|
|
202
|
+
ariaLabel: [{
|
|
203
|
+
type: i0.Input,
|
|
204
|
+
args: [{
|
|
205
|
+
isSignal: true,
|
|
206
|
+
alias: "ariaLabel",
|
|
207
|
+
required: false
|
|
208
|
+
}]
|
|
209
|
+
}],
|
|
210
|
+
ariaLabelledBy: [{
|
|
211
|
+
type: i0.Input,
|
|
212
|
+
args: [{
|
|
213
|
+
isSignal: true,
|
|
214
|
+
alias: "ariaLabelledBy",
|
|
215
|
+
required: false
|
|
216
|
+
}]
|
|
217
|
+
}],
|
|
218
|
+
inputId: [{
|
|
219
|
+
type: i0.Input,
|
|
220
|
+
args: [{
|
|
221
|
+
isSignal: true,
|
|
222
|
+
alias: "inputId",
|
|
223
|
+
required: false
|
|
224
|
+
}]
|
|
225
|
+
}],
|
|
226
|
+
name: [{
|
|
227
|
+
type: i0.Input,
|
|
228
|
+
args: [{
|
|
229
|
+
isSignal: true,
|
|
230
|
+
alias: "name",
|
|
231
|
+
required: false
|
|
232
|
+
}]
|
|
233
|
+
}],
|
|
234
|
+
required: [{
|
|
235
|
+
type: i0.Input,
|
|
236
|
+
args: [{
|
|
237
|
+
isSignal: true,
|
|
238
|
+
alias: "required",
|
|
239
|
+
required: false
|
|
240
|
+
}]
|
|
241
|
+
}],
|
|
242
|
+
disabled: [{
|
|
243
|
+
type: i0.Input,
|
|
244
|
+
args: [{
|
|
245
|
+
isSignal: true,
|
|
246
|
+
alias: "disabled",
|
|
247
|
+
required: false
|
|
248
|
+
}]
|
|
249
|
+
}],
|
|
250
|
+
readonly: [{
|
|
251
|
+
type: i0.Input,
|
|
252
|
+
args: [{
|
|
253
|
+
isSignal: true,
|
|
254
|
+
alias: "readonly",
|
|
255
|
+
required: false
|
|
256
|
+
}]
|
|
257
|
+
}],
|
|
258
|
+
invalid: [{
|
|
259
|
+
type: i0.Input,
|
|
260
|
+
args: [{
|
|
261
|
+
isSignal: true,
|
|
262
|
+
alias: "invalid",
|
|
263
|
+
required: false
|
|
264
|
+
}]
|
|
265
|
+
}],
|
|
266
|
+
tabindex: [{
|
|
267
|
+
type: i0.Input,
|
|
268
|
+
args: [{
|
|
269
|
+
isSignal: true,
|
|
270
|
+
alias: "tabindex",
|
|
271
|
+
required: false
|
|
272
|
+
}]
|
|
273
|
+
}]
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
var BaseFormField = class BaseFormField extends BaseFieldControl {
|
|
277
|
+
constructor() {
|
|
278
|
+
super(...arguments);
|
|
279
|
+
this.label = input(...ngDevMode ? [void 0, { debugName: "label" }] : /* istanbul ignore next */ []);
|
|
280
|
+
this.helperText = input(...ngDevMode ? [void 0, { debugName: "helperText" }] : /* istanbul ignore next */ []);
|
|
281
|
+
this.errorText = input(...ngDevMode ? [void 0, { debugName: "errorText" }] : /* istanbul ignore next */ []);
|
|
282
|
+
this.showMessageIcon = input(false, {
|
|
283
|
+
...ngDevMode ? { debugName: "showMessageIcon" } : /* istanbul ignore next */ {},
|
|
284
|
+
transform: booleanAttribute
|
|
285
|
+
});
|
|
286
|
+
this.messageIcon = input(...ngDevMode ? [void 0, { debugName: "messageIcon" }] : /* istanbul ignore next */ []);
|
|
287
|
+
this.size = input("default", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
288
|
+
this.level = input("default", ...ngDevMode ? [{ debugName: "level" }] : /* istanbul ignore next */ []);
|
|
289
|
+
this.floatLabel = input(...ngDevMode ? [void 0, { debugName: "floatLabel" }] : /* istanbul ignore next */ []);
|
|
290
|
+
this.hasFloatLabel = computed(() => !!this.floatLabel() && !!this.label(), ...ngDevMode ? [{ debugName: "hasFloatLabel" }] : /* istanbul ignore next */ []);
|
|
291
|
+
this.effectiveLevel = computed(() => this.isInvalid() ? "error" : this.level(), ...ngDevMode ? [{ debugName: "effectiveLevel" }] : /* istanbul ignore next */ []);
|
|
292
|
+
this.displayMessage = computed(() => this.isInvalid() && this.errorText() ? this.errorText() : this.helperText(), ...ngDevMode ? [{ debugName: "displayMessage" }] : /* istanbul ignore next */ []);
|
|
293
|
+
this.displayValue = computed(() => {
|
|
294
|
+
const v = this.modelValue();
|
|
295
|
+
return v === void 0 || v === null ? "" : String(v);
|
|
296
|
+
}, ...ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []);
|
|
297
|
+
}
|
|
298
|
+
static {
|
|
299
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
300
|
+
minVersion: "12.0.0",
|
|
301
|
+
version: "22.3.0",
|
|
302
|
+
ngImport: i0,
|
|
303
|
+
type: BaseFormField,
|
|
304
|
+
deps: null,
|
|
305
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
static {
|
|
309
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
310
|
+
minVersion: "17.1.0",
|
|
311
|
+
version: "22.3.0",
|
|
312
|
+
type: BaseFormField,
|
|
313
|
+
isStandalone: true,
|
|
314
|
+
inputs: {
|
|
315
|
+
label: {
|
|
316
|
+
classPropertyName: "label",
|
|
317
|
+
publicName: "label",
|
|
318
|
+
isSignal: true,
|
|
319
|
+
isRequired: false,
|
|
320
|
+
transformFunction: null
|
|
321
|
+
},
|
|
322
|
+
helperText: {
|
|
323
|
+
classPropertyName: "helperText",
|
|
324
|
+
publicName: "helperText",
|
|
325
|
+
isSignal: true,
|
|
326
|
+
isRequired: false,
|
|
327
|
+
transformFunction: null
|
|
328
|
+
},
|
|
329
|
+
errorText: {
|
|
330
|
+
classPropertyName: "errorText",
|
|
331
|
+
publicName: "errorText",
|
|
332
|
+
isSignal: true,
|
|
333
|
+
isRequired: false,
|
|
334
|
+
transformFunction: null
|
|
335
|
+
},
|
|
336
|
+
showMessageIcon: {
|
|
337
|
+
classPropertyName: "showMessageIcon",
|
|
338
|
+
publicName: "showMessageIcon",
|
|
339
|
+
isSignal: true,
|
|
340
|
+
isRequired: false,
|
|
341
|
+
transformFunction: null
|
|
342
|
+
},
|
|
343
|
+
messageIcon: {
|
|
344
|
+
classPropertyName: "messageIcon",
|
|
345
|
+
publicName: "messageIcon",
|
|
346
|
+
isSignal: true,
|
|
347
|
+
isRequired: false,
|
|
348
|
+
transformFunction: null
|
|
349
|
+
},
|
|
350
|
+
size: {
|
|
351
|
+
classPropertyName: "size",
|
|
352
|
+
publicName: "size",
|
|
353
|
+
isSignal: true,
|
|
354
|
+
isRequired: false,
|
|
355
|
+
transformFunction: null
|
|
356
|
+
},
|
|
357
|
+
level: {
|
|
358
|
+
classPropertyName: "level",
|
|
359
|
+
publicName: "level",
|
|
360
|
+
isSignal: true,
|
|
361
|
+
isRequired: false,
|
|
362
|
+
transformFunction: null
|
|
363
|
+
},
|
|
364
|
+
floatLabel: {
|
|
365
|
+
classPropertyName: "floatLabel",
|
|
366
|
+
publicName: "floatLabel",
|
|
367
|
+
isSignal: true,
|
|
368
|
+
isRequired: false,
|
|
369
|
+
transformFunction: null
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
usesInheritance: true,
|
|
373
|
+
ngImport: i0
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
378
|
+
minVersion: "12.0.0",
|
|
379
|
+
version: "22.3.0",
|
|
380
|
+
ngImport: i0,
|
|
381
|
+
type: BaseFormField,
|
|
382
|
+
decorators: [{ type: Directive }],
|
|
383
|
+
propDecorators: {
|
|
384
|
+
label: [{
|
|
385
|
+
type: i0.Input,
|
|
386
|
+
args: [{
|
|
387
|
+
isSignal: true,
|
|
388
|
+
alias: "label",
|
|
389
|
+
required: false
|
|
390
|
+
}]
|
|
391
|
+
}],
|
|
392
|
+
helperText: [{
|
|
393
|
+
type: i0.Input,
|
|
394
|
+
args: [{
|
|
395
|
+
isSignal: true,
|
|
396
|
+
alias: "helperText",
|
|
397
|
+
required: false
|
|
398
|
+
}]
|
|
399
|
+
}],
|
|
400
|
+
errorText: [{
|
|
401
|
+
type: i0.Input,
|
|
402
|
+
args: [{
|
|
403
|
+
isSignal: true,
|
|
404
|
+
alias: "errorText",
|
|
405
|
+
required: false
|
|
406
|
+
}]
|
|
407
|
+
}],
|
|
408
|
+
showMessageIcon: [{
|
|
409
|
+
type: i0.Input,
|
|
410
|
+
args: [{
|
|
411
|
+
isSignal: true,
|
|
412
|
+
alias: "showMessageIcon",
|
|
413
|
+
required: false
|
|
414
|
+
}]
|
|
415
|
+
}],
|
|
416
|
+
messageIcon: [{
|
|
417
|
+
type: i0.Input,
|
|
418
|
+
args: [{
|
|
419
|
+
isSignal: true,
|
|
420
|
+
alias: "messageIcon",
|
|
421
|
+
required: false
|
|
422
|
+
}]
|
|
423
|
+
}],
|
|
424
|
+
size: [{
|
|
425
|
+
type: i0.Input,
|
|
426
|
+
args: [{
|
|
427
|
+
isSignal: true,
|
|
428
|
+
alias: "size",
|
|
429
|
+
required: false
|
|
430
|
+
}]
|
|
431
|
+
}],
|
|
432
|
+
level: [{
|
|
433
|
+
type: i0.Input,
|
|
434
|
+
args: [{
|
|
435
|
+
isSignal: true,
|
|
436
|
+
alias: "level",
|
|
437
|
+
required: false
|
|
438
|
+
}]
|
|
439
|
+
}],
|
|
440
|
+
floatLabel: [{
|
|
441
|
+
type: i0.Input,
|
|
442
|
+
args: [{
|
|
443
|
+
isSignal: true,
|
|
444
|
+
alias: "floatLabel",
|
|
445
|
+
required: false
|
|
446
|
+
}]
|
|
447
|
+
}]
|
|
448
|
+
}
|
|
449
|
+
});
|
|
262
450
|
function dropdownOverlayPositions(autoFlip) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
451
|
+
const belowStart = {
|
|
452
|
+
originX: "start",
|
|
453
|
+
originY: "bottom",
|
|
454
|
+
overlayX: "start",
|
|
455
|
+
overlayY: "top",
|
|
456
|
+
offsetY: 8
|
|
457
|
+
};
|
|
458
|
+
const belowEnd = {
|
|
459
|
+
originX: "end",
|
|
460
|
+
originY: "bottom",
|
|
461
|
+
overlayX: "end",
|
|
462
|
+
overlayY: "top",
|
|
463
|
+
offsetY: 8
|
|
464
|
+
};
|
|
465
|
+
return autoFlip ? [
|
|
466
|
+
belowStart,
|
|
467
|
+
belowEnd,
|
|
468
|
+
{
|
|
469
|
+
originX: "start",
|
|
470
|
+
originY: "top",
|
|
471
|
+
overlayX: "start",
|
|
472
|
+
overlayY: "bottom",
|
|
473
|
+
offsetY: -8
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
originX: "end",
|
|
477
|
+
originY: "top",
|
|
478
|
+
overlayX: "end",
|
|
479
|
+
overlayY: "bottom",
|
|
480
|
+
offsetY: -8
|
|
481
|
+
}
|
|
482
|
+
] : [belowStart, belowEnd];
|
|
292
483
|
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Pure masking engine shared by `ui-input-mask` and `ui-datepicker` (auto-formatting the typed
|
|
296
|
-
* date). Same precedent as `overlay-positions.ts` in this folder: framework-free functions, no
|
|
297
|
-
* class/Directive/Component, reusable by any form component that needs literal-inserting input
|
|
298
|
-
* masking. Extracted from `ui-input-mask.ts` — behavior is a byte-for-byte copy, only `this.mask()`
|
|
299
|
-
* /`this.ranges()`/`this.slotChar()` become explicit parameters.
|
|
300
|
-
*/
|
|
301
|
-
/** Mask tokens → accepted character class. */
|
|
302
484
|
const MASK_TOKENS = {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
485
|
+
"9": /[0-9]/,
|
|
486
|
+
a: /[a-zA-Z]/,
|
|
487
|
+
"*": /[a-zA-Z0-9]/
|
|
306
488
|
};
|
|
307
|
-
/** Parse the `ranges` input (`"1-31 1-12 1900-2100"`) into one bound per numeric segment. */
|
|
308
489
|
function parseMaskRanges(ranges) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
490
|
+
return ranges.trim().split(/\s+/).map((part) => {
|
|
491
|
+
const m = /^(\d+)-(\d+)$/.exec(part);
|
|
492
|
+
return m ? {
|
|
493
|
+
min: Number(m[1]),
|
|
494
|
+
max: Number(m[2])
|
|
495
|
+
} : null;
|
|
496
|
+
});
|
|
316
497
|
}
|
|
317
|
-
/**
|
|
318
|
-
* Resolve the mask template into slots: literals, input slots, and the `ranges` bounds attached
|
|
319
|
-
* to every slot of the numeric segment (consecutive `9` tokens) it belongs to.
|
|
320
|
-
*/
|
|
321
498
|
function buildMaskSlots(mask, bounds, tokens = MASK_TOKENS) {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
499
|
+
const slots = [];
|
|
500
|
+
const segments = [];
|
|
501
|
+
let segment = null;
|
|
502
|
+
for (const m of mask) {
|
|
503
|
+
const rgx = tokens[m];
|
|
504
|
+
const slot = rgx ? {
|
|
505
|
+
char: null,
|
|
506
|
+
rgx
|
|
507
|
+
} : { char: m };
|
|
508
|
+
slots.push(slot);
|
|
509
|
+
if (rgx && m === "9") {
|
|
510
|
+
if (!segment) segments.push(segment = []);
|
|
511
|
+
segment.push(slot);
|
|
512
|
+
} else segment = null;
|
|
513
|
+
}
|
|
514
|
+
segments.forEach((seg, i) => {
|
|
515
|
+
const range = bounds[i] ?? {
|
|
516
|
+
min: -Infinity,
|
|
517
|
+
max: Infinity
|
|
518
|
+
};
|
|
519
|
+
seg.forEach((slot, pos) => slot.bound = {
|
|
520
|
+
...range,
|
|
521
|
+
pos,
|
|
522
|
+
len: seg.length
|
|
523
|
+
});
|
|
524
|
+
});
|
|
525
|
+
return slots;
|
|
346
526
|
}
|
|
347
|
-
/** Keep only the data characters (alphanumeric) of a raw input string. */
|
|
348
527
|
function extractMaskData(raw) {
|
|
349
|
-
|
|
528
|
+
return raw.replace(/[^a-zA-Z0-9]/g, "");
|
|
350
529
|
}
|
|
351
|
-
/**
|
|
352
|
-
* Can `ch` fill this slot? It must match the token class and — when the segment is bounded
|
|
353
|
-
* AND `enforceBounds` — the digits typed so far plus `ch` must still admit at least one in-range
|
|
354
|
-
* completion of the remaining positions (`2` then `4` is refused on `0-23`, `2` then `3` is
|
|
355
|
-
* accepted).
|
|
356
|
-
*
|
|
357
|
-
* `enforceBounds = false` skips that second check (still requires the token class to match):
|
|
358
|
-
* meant for re-deriving the mask after characters were REMOVED, not typed. The bounds check
|
|
359
|
-
* exists to reject an invalid *new* leading digit while typing forward (e.g. `8` can never start
|
|
360
|
-
* a valid `1-31` day, so it's skipped rather than accepted) — applied instead to the digits left
|
|
361
|
-
* over after a deletion, that same skip can discard a still-valid residual digit and misalign
|
|
362
|
-
* every segment after it. See `autoFormatSegments`.
|
|
363
|
-
*/
|
|
364
530
|
function acceptsMaskChar(slot, segment, ch, enforceBounds = true) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
const low = Number(segment + ch) * scale;
|
|
372
|
-
return low <= bound.max && low + scale - 1 >= bound.min;
|
|
531
|
+
if (!slot.rgx?.test(ch)) return false;
|
|
532
|
+
const bound = slot.bound;
|
|
533
|
+
if (!enforceBounds || !bound) return true;
|
|
534
|
+
const scale = 10 ** (bound.len - bound.pos - 1);
|
|
535
|
+
const low = Number(segment + ch) * scale;
|
|
536
|
+
return low <= bound.max && low + scale - 1 >= bound.min;
|
|
373
537
|
}
|
|
374
|
-
/** Apply the mask template to a sequence of data characters (fills empty positions with `slotChar`). */
|
|
375
538
|
function applyMaskTemplate(slots, data, slotChar) {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}
|
|
408
|
-
// Masked value = up to the last typed character (no trailing literals/slots).
|
|
409
|
-
return { display, masked: masked.slice(0, lastFilled), data: used, tokenIndices };
|
|
539
|
+
let di = 0;
|
|
540
|
+
let display = "";
|
|
541
|
+
let masked = "";
|
|
542
|
+
let lastFilled = 0;
|
|
543
|
+
let used = "";
|
|
544
|
+
const tokenIndices = [];
|
|
545
|
+
let segment = "";
|
|
546
|
+
for (const slot of slots) {
|
|
547
|
+
if (slot.char !== null) {
|
|
548
|
+
display += slot.char;
|
|
549
|
+
masked += slot.char;
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
tokenIndices.push(display.length);
|
|
553
|
+
if (!slot.bound || slot.bound.pos === 0) segment = "";
|
|
554
|
+
while (di < data.length && !acceptsMaskChar(slot, segment, data[di])) di++;
|
|
555
|
+
if (di < data.length) {
|
|
556
|
+
display += data[di];
|
|
557
|
+
masked += data[di];
|
|
558
|
+
used += data[di];
|
|
559
|
+
if (slot.bound) segment += data[di];
|
|
560
|
+
di++;
|
|
561
|
+
lastFilled = masked.length;
|
|
562
|
+
} else display += slotChar;
|
|
563
|
+
}
|
|
564
|
+
return {
|
|
565
|
+
display,
|
|
566
|
+
masked: masked.slice(0, lastFilled),
|
|
567
|
+
data: used,
|
|
568
|
+
tokenIndices
|
|
569
|
+
};
|
|
410
570
|
}
|
|
411
|
-
/** Caret position for `n` typed data characters (literals skipped, end-of-text once all filled). */
|
|
412
571
|
function caretForMask(tokenIndices, n, length) {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
return length; // all filled → end
|
|
417
|
-
return tokenIndices[n]; // next input position (literals skipped)
|
|
572
|
+
if (n <= 0) return tokenIndices[0] ?? 0;
|
|
573
|
+
if (n >= tokenIndices.length) return length;
|
|
574
|
+
return tokenIndices[n];
|
|
418
575
|
}
|
|
419
|
-
/**
|
|
420
|
-
* Auto-format-as-you-type variant of {@link applyMaskTemplate}: inserts a literal separator as
|
|
421
|
-
* soon as the segment right before it is complete, without ever padding unfilled positions with
|
|
422
|
-
* a filler character (unlike `applyMaskTemplate`, meant for a field that displays the full
|
|
423
|
-
* template at rest). Used by `ui-datepicker`'s typeable trigger to auto-insert "/" as digits are
|
|
424
|
-
* typed, the same way a card-expiry field auto-inserts its "/".
|
|
425
|
-
*/
|
|
426
576
|
function autoFormatSegments(slots, data, { enforceBounds = true } = {}) {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
if (di >= data.length)
|
|
454
|
-
break; // no more data: stop, no filler
|
|
455
|
-
text += data[di];
|
|
456
|
-
dataEnd = text.length;
|
|
457
|
-
if (slot.bound)
|
|
458
|
-
segment += data[di];
|
|
459
|
-
atSegmentEnd = !!slot.bound && slot.bound.pos === slot.bound.len - 1;
|
|
460
|
-
di++;
|
|
461
|
-
}
|
|
462
|
-
return { text, tokenIndices, dataEnd };
|
|
577
|
+
let di = 0;
|
|
578
|
+
let text = "";
|
|
579
|
+
let segment = "";
|
|
580
|
+
let atSegmentEnd = false;
|
|
581
|
+
const tokenIndices = [];
|
|
582
|
+
let dataEnd = 0;
|
|
583
|
+
for (const slot of slots) {
|
|
584
|
+
if (slot.char !== null) {
|
|
585
|
+
if (atSegmentEnd) text += slot.char;
|
|
586
|
+
continue;
|
|
587
|
+
}
|
|
588
|
+
tokenIndices.push(text.length);
|
|
589
|
+
if (!slot.bound || slot.bound.pos === 0) segment = "";
|
|
590
|
+
while (di < data.length && !acceptsMaskChar(slot, segment, data[di], enforceBounds)) di++;
|
|
591
|
+
if (di >= data.length) break;
|
|
592
|
+
text += data[di];
|
|
593
|
+
dataEnd = text.length;
|
|
594
|
+
if (slot.bound) segment += data[di];
|
|
595
|
+
atSegmentEnd = !!slot.bound && slot.bound.pos === slot.bound.len - 1;
|
|
596
|
+
di++;
|
|
597
|
+
}
|
|
598
|
+
return {
|
|
599
|
+
text,
|
|
600
|
+
tokenIndices,
|
|
601
|
+
dataEnd
|
|
602
|
+
};
|
|
463
603
|
}
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Pure date helpers (no framework dependency), shared by every field that has to cross
|
|
467
|
-
* the `Date` ↔ ISO-string boundary — `ui-datepicker`, which parses what the user types,
|
|
468
|
-
* and `ui-input-date`, which reads what the browser's native picker hands back.
|
|
469
|
-
*
|
|
470
|
-
* They lived inside `ui-datepicker`'s entry point while it was the only caller (FSHSP-209
|
|
471
|
-
* moved them here). Two entry points must never import each other, so the second caller
|
|
472
|
-
* left one choice: the shared `forms/` entry point, which exists for exactly this — the
|
|
473
|
-
* helpers a field is built on. Serializing a `Date` from its LOCAL components rather than
|
|
474
|
-
* through `toISOString()` is the subtle part, and it must not be re-derived twice.
|
|
475
|
-
*/
|
|
476
604
|
function startOfDay(d) {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
605
|
+
const x = new Date(d);
|
|
606
|
+
x.setHours(0, 0, 0, 0);
|
|
607
|
+
return x;
|
|
480
608
|
}
|
|
481
609
|
function firstOfMonth(d) {
|
|
482
|
-
|
|
610
|
+
return new Date(d.getFullYear(), d.getMonth(), 1);
|
|
483
611
|
}
|
|
484
612
|
function isSameDay(a, b) {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
return (a.getFullYear() === b.getFullYear() &&
|
|
488
|
-
a.getMonth() === b.getMonth() &&
|
|
489
|
-
a.getDate() === b.getDate());
|
|
613
|
+
if (!a || !b) return false;
|
|
614
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
490
615
|
}
|
|
491
616
|
function addDays(d, n) {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
617
|
+
const x = new Date(d);
|
|
618
|
+
x.setDate(x.getDate() + n);
|
|
619
|
+
return x;
|
|
495
620
|
}
|
|
496
621
|
function addMonths(d, n) {
|
|
497
|
-
|
|
622
|
+
return new Date(d.getFullYear(), d.getMonth() + n, 1);
|
|
498
623
|
}
|
|
499
|
-
/** Build a Date and reject overflowed components (e.g. 31 Feb). */
|
|
500
624
|
function finalizeParsed(year, month, day, h, min) {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
return null;
|
|
506
|
-
return d;
|
|
625
|
+
if (month < 0 || month > 11 || day < 1 || day > 31 || h > 23 || min > 59) return null;
|
|
626
|
+
const d = new Date(year, month, day, h, min, 0, 0);
|
|
627
|
+
if (d.getFullYear() !== year || d.getMonth() !== month || d.getDate() !== day) return null;
|
|
628
|
+
return d;
|
|
507
629
|
}
|
|
508
630
|
const ISO_DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
509
631
|
const ISO_DATETIME_RE = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;
|
|
510
632
|
const ISO_TIME_RE = /^(\d{2}):(\d{2})$/;
|
|
511
633
|
function pad2(n) {
|
|
512
|
-
|
|
634
|
+
return String(n).padStart(2, "0");
|
|
513
635
|
}
|
|
514
|
-
/** Serialize a `Date` to `"yyyy-MM-dd"` from its LOCAL components — never `toISOString()`
|
|
515
|
-
* (which converts to UTC and can shift the day by ±1 depending on the timezone). */
|
|
516
636
|
function toIsoDate(d) {
|
|
517
|
-
|
|
637
|
+
return `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;
|
|
518
638
|
}
|
|
519
|
-
/** `"HH:mm"` — the shape a native `<input type="time">` reads and writes. */
|
|
520
639
|
function toIsoTime(d) {
|
|
521
|
-
|
|
640
|
+
return `${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
|
|
522
641
|
}
|
|
523
|
-
/** `"yyyy-MM-ddTHH:mm"` — date part built the same local, never-UTC way as {@link toIsoDate}. */
|
|
524
642
|
function toIsoDateTime(d) {
|
|
525
|
-
|
|
643
|
+
return `${toIsoDate(d)}T${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
|
|
526
644
|
}
|
|
527
|
-
/** Strict `"yyyy-MM-dd"` parser (rejects anything else, incl. overflowed dates via `finalizeParsed`). */
|
|
528
645
|
function parseIsoDate(s) {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
return finalizeParsed(Number(m[1]), Number(m[2]) - 1, Number(m[3]), 0, 0);
|
|
646
|
+
const m = ISO_DATE_RE.exec(s);
|
|
647
|
+
if (!m) return null;
|
|
648
|
+
return finalizeParsed(Number(m[1]), Number(m[2]) - 1, Number(m[3]), 0, 0);
|
|
533
649
|
}
|
|
534
|
-
/** Strict `"yyyy-MM-ddTHH:mm"` parser (`showTime`/`timeOnly` round-trip). */
|
|
535
650
|
function parseIsoDateTime(s) {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
return finalizeParsed(Number(m[1]), Number(m[2]) - 1, Number(m[3]), Number(m[4]), Number(m[5]));
|
|
651
|
+
const m = ISO_DATETIME_RE.exec(s);
|
|
652
|
+
if (!m) return null;
|
|
653
|
+
return finalizeParsed(Number(m[1]), Number(m[2]) - 1, Number(m[3]), Number(m[4]), Number(m[5]));
|
|
540
654
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
* what `ui-datepicker` does in `timeOnly` mode — it too carries a full `Date` — so both
|
|
546
|
-
* components hand back the same shape.
|
|
547
|
-
*/
|
|
548
|
-
function parseIsoTime(s, reference = new Date()) {
|
|
549
|
-
const m = ISO_TIME_RE.exec(s);
|
|
550
|
-
if (!m)
|
|
551
|
-
return null;
|
|
552
|
-
return finalizeParsed(reference.getFullYear(), reference.getMonth(), reference.getDate(), Number(m[1]), Number(m[2]));
|
|
655
|
+
function parseIsoTime(s, reference = /* @__PURE__ */ new Date()) {
|
|
656
|
+
const m = ISO_TIME_RE.exec(s);
|
|
657
|
+
if (!m) return null;
|
|
658
|
+
return finalizeParsed(reference.getFullYear(), reference.getMonth(), reference.getDate(), Number(m[1]), Number(m[2]));
|
|
553
659
|
}
|
|
554
|
-
/** Accepts a `Date` as-is, or parses a `"yyyy-MM-dd"` string — used to let config inputs
|
|
555
|
-
* (`minDate`/`maxDate`/`disabledDates`) take either shape. Invalid strings degrade to `null`
|
|
556
|
-
* (no constraint) rather than throwing: a malformed config shouldn't crash the picker. */
|
|
557
660
|
function normalizeDateInput(v) {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
return v instanceof Date ? v : parseIsoDate(v);
|
|
661
|
+
if (!v) return null;
|
|
662
|
+
return v instanceof Date ? v : parseIsoDate(v);
|
|
561
663
|
}
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* Shared option-resolution helpers for list-based form fields
|
|
565
|
-
* (`ui-select`, `ui-autocomplete`, `ui-input-tags`).
|
|
566
|
-
*
|
|
567
|
-
* Options can be primitives or objects; `optionValue` / `optionLabel` /
|
|
568
|
-
* `optionDisabled` are (dot-path) fields read on object options, and `dataKey`
|
|
569
|
-
* drives object equality. The accessors are passed as thunks so the resolver
|
|
570
|
-
* stays reactive when bound to signal inputs.
|
|
571
|
-
*/
|
|
572
664
|
function createOptionResolver(fields) {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
return { toEntry, getField, resolveValue, resolveLabel, resolveDisabled, asText, equals };
|
|
665
|
+
const isObject = (option) => typeof option === "object" && option !== null;
|
|
666
|
+
const getField = (target, path) => {
|
|
667
|
+
if (!path || !isObject(target)) return void 0;
|
|
668
|
+
return path.split(".").reduce((acc, key) => isObject(acc) ? acc[key] : void 0, target);
|
|
669
|
+
};
|
|
670
|
+
const asText = (value) => value === null || value === void 0 ? null : String(value);
|
|
671
|
+
const resolveValue = (option) => {
|
|
672
|
+
const field = fields.optionValue();
|
|
673
|
+
if (field && isObject(option)) return getField(option, field);
|
|
674
|
+
return option;
|
|
675
|
+
};
|
|
676
|
+
const resolveLabel = (option) => {
|
|
677
|
+
const field = fields.optionLabel();
|
|
678
|
+
if (field && isObject(option)) return asText(getField(option, field));
|
|
679
|
+
if (isObject(option) && "label" in option) return asText(option["label"]);
|
|
680
|
+
return asText(option);
|
|
681
|
+
};
|
|
682
|
+
const resolveDisabled = (option) => {
|
|
683
|
+
const field = fields.optionDisabled();
|
|
684
|
+
if (field && isObject(option)) return !!getField(option, field);
|
|
685
|
+
if (isObject(option) && "disabled" in option) return !!option["disabled"];
|
|
686
|
+
return false;
|
|
687
|
+
};
|
|
688
|
+
const equals = (a, b) => {
|
|
689
|
+
const key = fields.dataKey();
|
|
690
|
+
if (key && isObject(a) && isObject(b)) return a[key] === b[key];
|
|
691
|
+
return a === b;
|
|
692
|
+
};
|
|
693
|
+
const toEntry = (option) => ({
|
|
694
|
+
value: resolveValue(option),
|
|
695
|
+
label: resolveLabel(option) ?? "",
|
|
696
|
+
disabled: resolveDisabled(option),
|
|
697
|
+
original: option
|
|
698
|
+
});
|
|
699
|
+
return {
|
|
700
|
+
toEntry,
|
|
701
|
+
getField,
|
|
702
|
+
resolveValue,
|
|
703
|
+
resolveLabel,
|
|
704
|
+
resolveDisabled,
|
|
705
|
+
asText,
|
|
706
|
+
equals
|
|
707
|
+
};
|
|
617
708
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
* Substitutes the `{0}` token of a (possibly user-overridden) label with a value.
|
|
621
|
-
* Plain split/join — never interprets `$` sequences in `value` (unlike `String.replace`).
|
|
622
|
-
*/
|
|
623
|
-
function formatLabel(template, value) {
|
|
624
|
-
return template.split('{0}').join(String(value));
|
|
709
|
+
function formatLabel(template, ...values) {
|
|
710
|
+
return template.replace(/\{(0|[1-9]\d*)\}/g, (token, index) => Number(index) < values.length ? String(values[Number(index)]) : token);
|
|
625
711
|
}
|
|
626
|
-
|
|
627
|
-
// Dev-only a11y guard shared by form controls that require an accessible name
|
|
628
|
-
// (`ariaLabel`/`ariaLabelledBy`/`label`). Centralizes the "how to warn" (console + dev-mode
|
|
629
|
-
// gating) so each component only supplies its own trigger condition and message text.
|
|
630
712
|
function warnMissingAccessibleName(componentTag, message) {
|
|
631
|
-
|
|
632
|
-
console.warn(`[${componentTag}] ${message}`);
|
|
633
|
-
}
|
|
713
|
+
if (isDevMode()) console.warn(`[${componentTag}] ${message}`);
|
|
634
714
|
}
|
|
715
|
+
const AUTOFILL_ANIMATION = "ui-browser-fill";
|
|
716
|
+
var UiBrowserFill = class UiBrowserFill {
|
|
717
|
+
constructor() {
|
|
718
|
+
this.browserFill = output();
|
|
719
|
+
}
|
|
720
|
+
onAnimationStart(event) {
|
|
721
|
+
if (event.animationName.endsWith(AUTOFILL_ANIMATION)) this.browserFill.emit(event);
|
|
722
|
+
}
|
|
723
|
+
static {
|
|
724
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
725
|
+
minVersion: "12.0.0",
|
|
726
|
+
version: "22.3.0",
|
|
727
|
+
ngImport: i0,
|
|
728
|
+
type: UiBrowserFill,
|
|
729
|
+
deps: [],
|
|
730
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
static {
|
|
734
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
735
|
+
minVersion: "14.0.0",
|
|
736
|
+
version: "22.3.0",
|
|
737
|
+
type: UiBrowserFill,
|
|
738
|
+
isStandalone: true,
|
|
739
|
+
selector: "[uiBrowserFill]",
|
|
740
|
+
outputs: { browserFill: "browserFill" },
|
|
741
|
+
host: {
|
|
742
|
+
listeners: {
|
|
743
|
+
"change": "browserFill.emit($event)",
|
|
744
|
+
"animationstart": "onAnimationStart($event)"
|
|
745
|
+
},
|
|
746
|
+
classAttribute: "ui-browser-fill"
|
|
747
|
+
},
|
|
748
|
+
ngImport: i0
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
753
|
+
minVersion: "12.0.0",
|
|
754
|
+
version: "22.3.0",
|
|
755
|
+
ngImport: i0,
|
|
756
|
+
type: UiBrowserFill,
|
|
757
|
+
decorators: [{
|
|
758
|
+
type: Directive,
|
|
759
|
+
args: [{
|
|
760
|
+
selector: "[uiBrowserFill]",
|
|
761
|
+
host: {
|
|
762
|
+
class: "ui-browser-fill",
|
|
763
|
+
"(change)": "browserFill.emit($event)",
|
|
764
|
+
"(animationstart)": "onAnimationStart($event)"
|
|
765
|
+
}
|
|
766
|
+
}]
|
|
767
|
+
}],
|
|
768
|
+
propDecorators: { browserFill: [{
|
|
769
|
+
type: i0.Output,
|
|
770
|
+
args: ["browserFill"]
|
|
771
|
+
}] }
|
|
772
|
+
});
|
|
773
|
+
function hasFocus(element) {
|
|
774
|
+
return element.getRootNode().activeElement === element;
|
|
775
|
+
}
|
|
776
|
+
export { BaseControlValueAccessor, BaseFieldControl, BaseFormField, MASK_TOKENS, UiBrowserFill, acceptsMaskChar, addDays, addMonths, applyMaskTemplate, autoFormatSegments, buildMaskSlots, caretForMask, createOptionResolver, dropdownOverlayPositions, extractMaskData, finalizeParsed, firstOfMonth, formatLabel, hasFocus, isSameDay, normalizeDateInput, parseIsoDate, parseIsoDateTime, parseIsoTime, parseMaskRanges, startOfDay, toIsoDate, toIsoDateTime, toIsoTime, warnMissingAccessibleName };
|
|
635
777
|
|
|
636
|
-
|
|
637
|
-
* Public API Surface of ui-kit/forms
|
|
638
|
-
*
|
|
639
|
-
* Shared form infrastructure: the base classes every `ui-*` field inherits
|
|
640
|
-
* from, plus the helpers those fields rely on. Importing a field component
|
|
641
|
-
* (e.g. `@4sh/ui-kit/forms/ui-input`) pulls this in automatically — you only import
|
|
642
|
-
* from here directly when building your OWN field on top of the kit's
|
|
643
|
-
* conventions.
|
|
644
|
-
*/
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* Generated bundle index. Do not edit.
|
|
648
|
-
*/
|
|
649
|
-
|
|
650
|
-
export { BaseControlValueAccessor, BaseFieldControl, BaseFormField, MASK_TOKENS, acceptsMaskChar, addDays, addMonths, applyMaskTemplate, autoFormatSegments, buildMaskSlots, caretForMask, createOptionResolver, dropdownOverlayPositions, extractMaskData, finalizeParsed, firstOfMonth, formatLabel, isSameDay, normalizeDateInput, parseIsoDate, parseIsoDateTime, parseIsoTime, parseMaskRanges, startOfDay, toIsoDate, toIsoDateTime, toIsoTime, warnMissingAccessibleName };
|
|
651
|
-
//# sourceMappingURL=4sh-ui-kit-forms.mjs.map
|
|
778
|
+
//# sourceMappingURL=4sh-ui-kit-forms.mjs.map
|