@4sh/ui-kit 0.9.0 → 0.10.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 +10 -9
- package/README.md +10 -9
- package/fesm2022/4sh-ui-kit-base-ui-image.mjs +338 -14
- package/fesm2022/4sh-ui-kit-base-ui-image.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs +1 -76
- package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs +179 -0
- package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-forms.mjs +99 -1
- package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs +1 -25
- package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs +1 -25
- package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs +1 -25
- package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs +1 -25
- package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-overlay.mjs +60 -2
- package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -1
- package/mcp/data/text-search-docs.json +175 -5
- package/mcp/data/ui-config.json +546 -0
- package/mcp/package.json +1 -1
- package/package.json +5 -1
- package/styles/component-vars.scss +39 -1
- package/types/4sh-ui-kit-base-ui-image.d.ts +151 -6
- package/types/4sh-ui-kit-forms-ui-input-date.d.ts +110 -0
- package/types/4sh-ui-kit-forms.d.ts +43 -1
- package/types/4sh-ui-kit-overlay.d.ts +35 -1
|
@@ -1,7 +1,84 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { InjectionToken, Provider } from '@angular/core';
|
|
2
|
+
import { InjectionToken, TemplateRef, Provider } from '@angular/core';
|
|
3
3
|
import { SafeHtml } from '@angular/platform-browser';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* ui-image-preview — the enlarged view (lightbox) opened by `ui-image`'s
|
|
7
|
+
* `preview` mode.
|
|
8
|
+
*
|
|
9
|
+
* A viewport mask holding a toolbar (zoom in/out, rotate, reset, optional
|
|
10
|
+
* download, close) and the image itself, which the three transforms drive
|
|
11
|
+
* through a single `transform`: pan, scale, rotation. Zoom is reachable at the
|
|
12
|
+
* pointer (toolbar, wheel) and at the keyboard (`+`/`-`/`0`/`r`, arrows to pan)
|
|
13
|
+
* — a zoom a keyboard user cannot pan is a zoom they cannot read.
|
|
14
|
+
*
|
|
15
|
+
* Lives in `ui-image`'s entry point: it renders that component's resolved
|
|
16
|
+
* source, so a separate entry point would be a cycle. Mount it directly only to
|
|
17
|
+
* drive the enlarged view yourself.
|
|
18
|
+
*/
|
|
19
|
+
declare class UiImagePreview {
|
|
20
|
+
private readonly document;
|
|
21
|
+
/** URL of the image to show enlarged (already resolved — `http(s)`, `blob:` or `data:`). */
|
|
22
|
+
src: _angular_core.InputSignal<string>;
|
|
23
|
+
/** Alt text of the enlarged image (empty = decorative). */
|
|
24
|
+
alt: _angular_core.InputSignal<string>;
|
|
25
|
+
/** Accessible name of the dialog. */
|
|
26
|
+
ariaLabel: _angular_core.InputSignal<string>;
|
|
27
|
+
/** Zoom increment applied by one toolbar click, one wheel notch or one `+`/`-` press. */
|
|
28
|
+
zoomStep: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
29
|
+
/** Lower zoom bound. */
|
|
30
|
+
minZoom: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
31
|
+
/** Upper zoom bound. */
|
|
32
|
+
maxZoom: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
33
|
+
/** Offer a download action in the toolbar. */
|
|
34
|
+
downloadable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
35
|
+
/** Filename proposed by the download action (defaults to the browser's choice). */
|
|
36
|
+
downloadName: _angular_core.InputSignal<string | undefined>;
|
|
37
|
+
/** Close when the mask around the image is clicked. */
|
|
38
|
+
dismissableMask: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
39
|
+
zoomInAriaLabel: _angular_core.InputSignal<string>;
|
|
40
|
+
zoomOutAriaLabel: _angular_core.InputSignal<string>;
|
|
41
|
+
rotateLeftAriaLabel: _angular_core.InputSignal<string>;
|
|
42
|
+
rotateRightAriaLabel: _angular_core.InputSignal<string>;
|
|
43
|
+
resetAriaLabel: _angular_core.InputSignal<string>;
|
|
44
|
+
downloadAriaLabel: _angular_core.InputSignal<string>;
|
|
45
|
+
closeAriaLabel: _angular_core.InputSignal<string>;
|
|
46
|
+
/** Emitted when the view asks to be dismissed (Escape, close button, mask click). */
|
|
47
|
+
closed: _angular_core.OutputEmitterRef<void>;
|
|
48
|
+
private readonly stage;
|
|
49
|
+
protected readonly scale: _angular_core.WritableSignal<number>;
|
|
50
|
+
protected readonly rotation: _angular_core.WritableSignal<number>;
|
|
51
|
+
protected readonly panX: _angular_core.WritableSignal<number>;
|
|
52
|
+
protected readonly panY: _angular_core.WritableSignal<number>;
|
|
53
|
+
protected readonly canZoomIn: _angular_core.Signal<boolean>;
|
|
54
|
+
protected readonly canZoomOut: _angular_core.Signal<boolean>;
|
|
55
|
+
/** Nothing to reset while the three transforms are at their neutral value. */
|
|
56
|
+
protected readonly isPristine: _angular_core.Signal<boolean>;
|
|
57
|
+
/** Panning only makes sense once the image overflows its stage. */
|
|
58
|
+
protected readonly canPan: _angular_core.Signal<boolean>;
|
|
59
|
+
/** A quarter turn: what is drawn no longer fits the layout box's axes. */
|
|
60
|
+
protected readonly isQuarterTurned: _angular_core.Signal<boolean>;
|
|
61
|
+
protected readonly transform: _angular_core.Signal<string>;
|
|
62
|
+
constructor();
|
|
63
|
+
protected zoomIn(): void;
|
|
64
|
+
protected zoomOut(): void;
|
|
65
|
+
protected rotateLeft(): void;
|
|
66
|
+
protected rotateRight(): void;
|
|
67
|
+
protected reset(): void;
|
|
68
|
+
protected close(): void;
|
|
69
|
+
/** A press that lands on the stage itself (not on the image) is a press outside. */
|
|
70
|
+
protected onStagePointerDown(event: PointerEvent): void;
|
|
71
|
+
protected onWheel(event: WheelEvent): void;
|
|
72
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
73
|
+
private dragOrigin;
|
|
74
|
+
protected onPointerDown(event: PointerEvent): void;
|
|
75
|
+
protected onPointerMove(event: PointerEvent): void;
|
|
76
|
+
protected onPointerUp(event: PointerEvent): void;
|
|
77
|
+
private setScale;
|
|
78
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<UiImagePreview, never>;
|
|
79
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<UiImagePreview, "ui-image-preview", never, { "src": { "alias": "src"; "required": true; "isSignal": true; }; "alt": { "alias": "alt"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "zoomStep": { "alias": "zoomStep"; "required": false; "isSignal": true; }; "minZoom": { "alias": "minZoom"; "required": false; "isSignal": true; }; "maxZoom": { "alias": "maxZoom"; "required": false; "isSignal": true; }; "downloadable": { "alias": "downloadable"; "required": false; "isSignal": true; }; "downloadName": { "alias": "downloadName"; "required": false; "isSignal": true; }; "dismissableMask": { "alias": "dismissableMask"; "required": false; "isSignal": true; }; "zoomInAriaLabel": { "alias": "zoomInAriaLabel"; "required": false; "isSignal": true; }; "zoomOutAriaLabel": { "alias": "zoomOutAriaLabel"; "required": false; "isSignal": true; }; "rotateLeftAriaLabel": { "alias": "rotateLeftAriaLabel"; "required": false; "isSignal": true; }; "rotateRightAriaLabel": { "alias": "rotateRightAriaLabel"; "required": false; "isSignal": true; }; "resetAriaLabel": { "alias": "resetAriaLabel"; "required": false; "isSignal": true; }; "downloadAriaLabel": { "alias": "downloadAriaLabel"; "required": false; "isSignal": true; }; "closeAriaLabel": { "alias": "closeAriaLabel"; "required": false; "isSignal": true; }; }, { "closed": "closed"; }, never, never, true, never>;
|
|
80
|
+
}
|
|
81
|
+
|
|
5
82
|
interface ModeMap {
|
|
6
83
|
base?: string;
|
|
7
84
|
light?: string;
|
|
@@ -32,19 +109,27 @@ declare function provideUiImageAssets(map: UiImageAssetsMap): Provider;
|
|
|
32
109
|
/**
|
|
33
110
|
* ui-image — theme/brand-aware image.
|
|
34
111
|
*
|
|
35
|
-
*
|
|
36
|
-
* theme/brand variants)
|
|
112
|
+
* Three sources: `name` (local asset key resolved through `assets-map.json`,
|
|
113
|
+
* theme/brand variants), `src` (remote/absolute URL — takes precedence), and
|
|
114
|
+
* `src` + `secured` (the URL is fetched through `HttpClient`, so the app's
|
|
115
|
+
* interceptors authenticate it, and the response `Blob` is shown from an object
|
|
116
|
+
* URL revoked with the component).
|
|
37
117
|
* Local `.svg` assets are inlined (`innerHTML`) so they can inherit CSS — after
|
|
38
118
|
* being scrubbed by `sanitizeInlineSvg()`; remote URLs always render through
|
|
39
|
-
* `<img [ngSrc]>` (never inlined)
|
|
119
|
+
* `<img [ngSrc]>` (never inlined), except `data:`/`blob:` payloads, which
|
|
120
|
+
* `NgOptimizedImage` rejects and a plain `<img>` renders.
|
|
40
121
|
* On load failure the `fallback` local asset is shown, then a token-styled
|
|
41
122
|
* placeholder if the fallback also fails (or none is provided).
|
|
123
|
+
*
|
|
124
|
+
* `preview` turns the image into a trigger for the enlarged view
|
|
125
|
+
* (`ui-image-preview`): zoom, rotation, pan, reset, optional download.
|
|
42
126
|
*/
|
|
43
127
|
declare class UiImage {
|
|
44
128
|
private readonly sanitizer;
|
|
45
129
|
private readonly assetsMap;
|
|
46
130
|
private readonly themeService;
|
|
47
131
|
private readonly brandService;
|
|
132
|
+
private readonly isBrowser;
|
|
48
133
|
/** Local asset key in `assets-map.json` (theme/brand-aware resolution). */
|
|
49
134
|
name: _angular_core.InputSignal<string | undefined>;
|
|
50
135
|
/** Remote/absolute URL, rendered via `NgOptimizedImage` — takes precedence over `name`. */
|
|
@@ -58,13 +143,69 @@ declare class UiImage {
|
|
|
58
143
|
height: _angular_core.InputSignal<string | number | undefined>;
|
|
59
144
|
heightUnit: _angular_core.InputSignal<string | undefined>;
|
|
60
145
|
alt: _angular_core.InputSignal<string | undefined>;
|
|
146
|
+
/**
|
|
147
|
+
* Fetch `src` through `HttpClient` instead of letting the browser load it.
|
|
148
|
+
*
|
|
149
|
+
* That is what an endpoint behind an `Authorization` header needs: an `<img
|
|
150
|
+
* src>` is a plain browser request, which carries no interceptor and no
|
|
151
|
+
* bearer token. The response `Blob` is shown from an object URL, revoked as
|
|
152
|
+
* soon as the source changes or the component goes away.
|
|
153
|
+
*
|
|
154
|
+
* Cross-origin still applies: the endpoint must answer the CORS preflight
|
|
155
|
+
* (`Access-Control-Allow-Origin`, and `Access-Control-Allow-Headers` for the
|
|
156
|
+
* auth header) — an `<img>` would have displayed it without any of that.
|
|
157
|
+
*/
|
|
158
|
+
secured: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
159
|
+
/** Send cookies/TLS credentials with the `secured` request (cross-origin sessions). */
|
|
160
|
+
withCredentials: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
161
|
+
/** Visible text of the loading indicator shown while a `secured` fetch is in flight. */
|
|
162
|
+
loadingLabel: _angular_core.InputSignal<string | undefined>;
|
|
163
|
+
/** Accessible name of that loading indicator. */
|
|
164
|
+
loadingAriaLabel: _angular_core.InputSignal<string>;
|
|
165
|
+
/** Clicking the image opens the enlarged view (`ui-image-preview`). */
|
|
166
|
+
preview: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
167
|
+
/** Enlarged view open state (two-way — set it to open the preview yourself). */
|
|
168
|
+
previewVisible: _angular_core.ModelSignal<boolean>;
|
|
169
|
+
/** Accessible name of the trigger (defaults to the image's own `alt`). */
|
|
170
|
+
previewAriaLabel: _angular_core.InputSignal<string | undefined>;
|
|
171
|
+
/** Accessible name of the enlarged view dialog. */
|
|
172
|
+
previewDialogAriaLabel: _angular_core.InputSignal<string>;
|
|
173
|
+
/** Zoom increment of one toolbar click, wheel notch or `+`/`-` press in the preview. */
|
|
174
|
+
zoomStep: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
175
|
+
/** Lower zoom bound in the preview. */
|
|
176
|
+
minZoom: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
177
|
+
/** Upper zoom bound in the preview. */
|
|
178
|
+
maxZoom: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
179
|
+
/** Offer a download action in the preview toolbar. */
|
|
180
|
+
downloadable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
181
|
+
/** Filename proposed by that download action. */
|
|
182
|
+
downloadName: _angular_core.InputSignal<string | undefined>;
|
|
61
183
|
/** Emitted with the failed URL when an image fails to load. */
|
|
62
184
|
loadFailed: _angular_core.OutputEmitterRef<string>;
|
|
185
|
+
/**
|
|
186
|
+
* Replaces the hover indicator of the `preview` mode (the magnifier). Rendered
|
|
187
|
+
* over the image, decorative — the accessible name stays on the trigger.
|
|
188
|
+
*
|
|
189
|
+
* ```html
|
|
190
|
+
* <ui-image src="…" preview>
|
|
191
|
+
* <ng-template #previewIndicator>Agrandir</ng-template>
|
|
192
|
+
* </ui-image>
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
protected readonly previewIndicator: _angular_core.Signal<TemplateRef<unknown> | undefined>;
|
|
63
196
|
protected readonly isRemote: _angular_core.Signal<boolean>;
|
|
64
197
|
/** Inline SVG is reserved for LOCAL assets — a remote `.svg` renders through `<img>` (no XSS surface). */
|
|
65
198
|
protected readonly isInlineSvg: _angular_core.Signal<boolean>;
|
|
199
|
+
/** `secured` only means anything with a `src` to fetch. */
|
|
200
|
+
protected readonly isSecured: _angular_core.Signal<boolean>;
|
|
201
|
+
/** A `data:` payload is already the image — `NgOptimizedImage` refuses it. */
|
|
202
|
+
protected readonly isDataUrl: _angular_core.Signal<boolean>;
|
|
66
203
|
protected readonly localSrc: _angular_core.Signal<string>;
|
|
67
204
|
protected readonly fallbackSrc: _angular_core.Signal<string>;
|
|
205
|
+
private readonly blobResource;
|
|
206
|
+
private readonly blobUrl;
|
|
207
|
+
protected readonly securedLoading: _angular_core.Signal<boolean>;
|
|
208
|
+
private readonly securedFailed;
|
|
68
209
|
protected readonly primarySrc: _angular_core.Signal<string>;
|
|
69
210
|
private readonly primaryImgFailed;
|
|
70
211
|
private readonly fallbackImgFailed;
|
|
@@ -86,6 +227,10 @@ declare class UiImage {
|
|
|
86
227
|
protected readonly showFallback: _angular_core.Signal<boolean>;
|
|
87
228
|
protected readonly showPlaceholder: _angular_core.Signal<boolean>;
|
|
88
229
|
protected readonly displayedSrc: _angular_core.Signal<string>;
|
|
230
|
+
/** `blob:`/`data:` bypass `NgOptimizedImage`; a local fallback never does. */
|
|
231
|
+
protected readonly isRawSrc: _angular_core.Signal<boolean>;
|
|
232
|
+
/** The image is a preview trigger only once there is something to enlarge. */
|
|
233
|
+
protected readonly canPreview: _angular_core.Signal<boolean>;
|
|
89
234
|
protected readonly cssWidth: _angular_core.Signal<string | null>;
|
|
90
235
|
protected readonly cssHeight: _angular_core.Signal<string | null>;
|
|
91
236
|
constructor();
|
|
@@ -94,8 +239,8 @@ declare class UiImage {
|
|
|
94
239
|
private resolvePath;
|
|
95
240
|
private buildPath;
|
|
96
241
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<UiImage, never>;
|
|
97
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<UiImage, "ui-image", never, { "name": { "alias": "name"; "required": false; "isSignal": true; }; "src": { "alias": "src"; "required": false; "isSignal": true; }; "fallback": { "alias": "fallback"; "required": false; "isSignal": true; }; "priority": { "alias": "priority"; "required": false; "isSignal": true; }; "fill": { "alias": "fill"; "required": false; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "widthUnit": { "alias": "widthUnit"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "heightUnit": { "alias": "heightUnit"; "required": false; "isSignal": true; }; "alt": { "alias": "alt"; "required": false; "isSignal": true; }; }, { "loadFailed": "loadFailed"; },
|
|
242
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<UiImage, "ui-image", never, { "name": { "alias": "name"; "required": false; "isSignal": true; }; "src": { "alias": "src"; "required": false; "isSignal": true; }; "fallback": { "alias": "fallback"; "required": false; "isSignal": true; }; "priority": { "alias": "priority"; "required": false; "isSignal": true; }; "fill": { "alias": "fill"; "required": false; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "widthUnit": { "alias": "widthUnit"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "heightUnit": { "alias": "heightUnit"; "required": false; "isSignal": true; }; "alt": { "alias": "alt"; "required": false; "isSignal": true; }; "secured": { "alias": "secured"; "required": false; "isSignal": true; }; "withCredentials": { "alias": "withCredentials"; "required": false; "isSignal": true; }; "loadingLabel": { "alias": "loadingLabel"; "required": false; "isSignal": true; }; "loadingAriaLabel": { "alias": "loadingAriaLabel"; "required": false; "isSignal": true; }; "preview": { "alias": "preview"; "required": false; "isSignal": true; }; "previewVisible": { "alias": "previewVisible"; "required": false; "isSignal": true; }; "previewAriaLabel": { "alias": "previewAriaLabel"; "required": false; "isSignal": true; }; "previewDialogAriaLabel": { "alias": "previewDialogAriaLabel"; "required": false; "isSignal": true; }; "zoomStep": { "alias": "zoomStep"; "required": false; "isSignal": true; }; "minZoom": { "alias": "minZoom"; "required": false; "isSignal": true; }; "maxZoom": { "alias": "maxZoom"; "required": false; "isSignal": true; }; "downloadable": { "alias": "downloadable"; "required": false; "isSignal": true; }; "downloadName": { "alias": "downloadName"; "required": false; "isSignal": true; }; }, { "previewVisible": "previewVisibleChange"; "loadFailed": "loadFailed"; }, ["previewIndicator"], never, true, never>;
|
|
98
243
|
}
|
|
99
244
|
|
|
100
|
-
export { UI_IMAGE_ASSETS, UiImage, provideUiImageAssets };
|
|
245
|
+
export { UI_IMAGE_ASSETS, UiImage, UiImagePreview, provideUiImageAssets };
|
|
101
246
|
export type { UiImageAssetsMap };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { BaseFormField } from '@4sh/ui-kit/forms';
|
|
3
|
+
|
|
4
|
+
/** Granularity of the field — picks which native control the browser renders. */
|
|
5
|
+
type InputDateMode = 'date' | 'time' | 'datetime';
|
|
6
|
+
/**
|
|
7
|
+
* Shape of the emitted value. **Identical to `ui-datepicker`'s**, so a host can swap one for
|
|
8
|
+
* the other (native picker on mobile, overlay on desktop) without converting anything.
|
|
9
|
+
*/
|
|
10
|
+
type InputDateValueType = 'date' | 'iso';
|
|
11
|
+
/** Value carried by the field, whichever `valueType` is in force. */
|
|
12
|
+
type InputDateValue = Date | string | null;
|
|
13
|
+
/**
|
|
14
|
+
* ui-input-date — **native** date/time field on the `ui-field` shell (label + box + helper).
|
|
15
|
+
*
|
|
16
|
+
* The picker belongs to the OS: the system wheel on mobile — which no overlay matches —
|
|
17
|
+
* and the browser's own calendar on desktop. That is the whole reason this component
|
|
18
|
+
* exists next to [`ui-datepicker`](../ui-datepicker), which owns the opposite trade: a
|
|
19
|
+
* calendar carried by the design system, with ranges, multi-month and inline modes.
|
|
20
|
+
*
|
|
21
|
+
* It is a sibling of `ui-input`, not a variant of it: three things a text field cannot do
|
|
22
|
+
* are settled here.
|
|
23
|
+
*
|
|
24
|
+
* 1. **The value is a date, not a string.** `valueType` commits to `Date` or to an ISO
|
|
25
|
+
* string, exactly as `ui-datepicker` does — that alignment is what lets a host branch
|
|
26
|
+
* between the two on viewport without converting anything.
|
|
27
|
+
* 2. **It emits on `change`, never on `input`.** A native temporal control blanks its own
|
|
28
|
+
* value while the entry is incomplete, so an `input`-driven field fires a burst of
|
|
29
|
+
* empty values as the user types — indistinguishable from clearing the field, and quite
|
|
30
|
+
* visible on an autosave or a dependent control.
|
|
31
|
+
* 3. **The label stays raised.** The browser draws its own `jj/mm/aaaa` template in the
|
|
32
|
+
* box, so a floating label at rest would land on top of it.
|
|
33
|
+
*
|
|
34
|
+
* No `placeholder`: the browser ignores it on these types, that template holding the spot.
|
|
35
|
+
*
|
|
36
|
+
* Standalone, `[(ngModel)]` or reactive forms (ControlValueAccessor via BaseFormField).
|
|
37
|
+
*/
|
|
38
|
+
declare class UiInputDate extends BaseFormField<InputDateValue> {
|
|
39
|
+
/** Granularity: a day, a time of day, or both. */
|
|
40
|
+
mode: _angular_core.InputSignal<InputDateMode>;
|
|
41
|
+
/**
|
|
42
|
+
* Shape of the emitted value: `'date'` (a plain `Date`) or `'iso'` (`yyyy-MM-dd`, or
|
|
43
|
+
* `yyyy-MM-ddTHH:mm` as soon as a time is part of it). Incoming values are accepted in
|
|
44
|
+
* **either** shape whatever this says — only the emitted side commits.
|
|
45
|
+
*/
|
|
46
|
+
valueType: _angular_core.InputSignal<InputDateValueType>;
|
|
47
|
+
/** Earliest accepted value, as a `Date` or in the ISO shape of the current `mode`. */
|
|
48
|
+
min: _angular_core.InputSignal<string | Date | undefined>;
|
|
49
|
+
/** Latest accepted value, same two shapes as {@link min}. */
|
|
50
|
+
max: _angular_core.InputSignal<string | Date | undefined>;
|
|
51
|
+
/**
|
|
52
|
+
* Native `step`: days on `date`, **seconds** on `time` / `datetime` (`900` = quarters of
|
|
53
|
+
* an hour; the browser's own default is `60`, i.e. whole minutes).
|
|
54
|
+
*/
|
|
55
|
+
step: _angular_core.InputSignalWithTransform<number | undefined, unknown>;
|
|
56
|
+
/** Emitted when the browser commits a value — never mid-entry. */
|
|
57
|
+
valueChange: _angular_core.OutputEmitterRef<InputDateValue>;
|
|
58
|
+
/** Emitted when the field receives focus. */
|
|
59
|
+
inputFocus: _angular_core.OutputEmitterRef<FocusEvent>;
|
|
60
|
+
/** Emitted when the field loses focus. */
|
|
61
|
+
inputBlur: _angular_core.OutputEmitterRef<FocusEvent>;
|
|
62
|
+
/** @ignore */
|
|
63
|
+
private readonly inputEl;
|
|
64
|
+
/** @ignore The native `type` the OS picker hangs off. */
|
|
65
|
+
protected readonly nativeType: _angular_core.Signal<string>;
|
|
66
|
+
/** @ignore Whether the value carries a time — decides both serializers. */
|
|
67
|
+
private readonly hasTimeComponent;
|
|
68
|
+
/** @ignore Model → the string the native control reads, `''` when there is no value. */
|
|
69
|
+
protected readonly nativeValue: _angular_core.Signal<string>;
|
|
70
|
+
/** @ignore Bounds go through the same serializer as the value: a caller may hand a `Date`
|
|
71
|
+
* or an already-native string, the attribute only ever sees the latter. */
|
|
72
|
+
protected readonly nativeMin: _angular_core.Signal<string | null>;
|
|
73
|
+
/** @ignore */
|
|
74
|
+
protected readonly nativeMax: _angular_core.Signal<string | null>;
|
|
75
|
+
/** @ignore Full `aria-describedby`: the message id, only when a message is rendered. */
|
|
76
|
+
protected readonly resolvedAriaDescribedBy: _angular_core.Signal<string | null>;
|
|
77
|
+
/** Focuses the field. */
|
|
78
|
+
focus(options?: FocusOptions): void;
|
|
79
|
+
/** Native `<input>` element, for a composite host that needs direct DOM access. */
|
|
80
|
+
nativeInputElement(): HTMLInputElement;
|
|
81
|
+
/** @ignore */
|
|
82
|
+
protected uidPrefix(): string;
|
|
83
|
+
/**
|
|
84
|
+
* @ignore The browser committed a value — a complete one, or an empty one because the
|
|
85
|
+
* field was cleared. This is the only place a value leaves the component: `input` fires
|
|
86
|
+
* on every keystroke with the blanks in between, and is deliberately not listened to.
|
|
87
|
+
*/
|
|
88
|
+
protected onNativeChange(): void;
|
|
89
|
+
/** @ignore */
|
|
90
|
+
protected onBlur(event: FocusEvent): void;
|
|
91
|
+
/** @ignore Internal `Date` → the shape `valueType` commits to. Mirrors `ui-datepicker`'s
|
|
92
|
+
* own `serializeValue`, down to the fresh instance: the caller never gets a reference it
|
|
93
|
+
* could mutate behind our back. */
|
|
94
|
+
private serializeValue;
|
|
95
|
+
/** @ignore Incoming value, `Date` or ISO string, auto-detected — cloned when already a
|
|
96
|
+
* `Date`, symmetric with {@link serializeValue}. */
|
|
97
|
+
private parseValue;
|
|
98
|
+
/** @ignore `Date` → the exact string the native control of this `mode` accepts. */
|
|
99
|
+
private toNative;
|
|
100
|
+
/** @ignore The reverse. `null` on anything malformed — a bad value degrades to "no value"
|
|
101
|
+
* rather than throwing, the browser being the one that produced it. */
|
|
102
|
+
private fromNative;
|
|
103
|
+
/** @ignore A bound is optional, and a string one is already native. */
|
|
104
|
+
private toNativeBound;
|
|
105
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<UiInputDate, never>;
|
|
106
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<UiInputDate, "ui-input-date", never, { "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "valueType": { "alias": "valueType"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; "inputFocus": "inputFocus"; "inputBlur": "inputBlur"; }, never, never, true, never>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { UiInputDate };
|
|
110
|
+
export type { InputDateMode, InputDateValue, InputDateValueType };
|
|
@@ -238,6 +238,48 @@ declare function autoFormatSegments(slots: MaskSlot[], data: string, { enforceBo
|
|
|
238
238
|
dataEnd: number;
|
|
239
239
|
};
|
|
240
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Pure date helpers (no framework dependency), shared by every field that has to cross
|
|
243
|
+
* the `Date` ↔ ISO-string boundary — `ui-datepicker`, which parses what the user types,
|
|
244
|
+
* and `ui-input-date`, which reads what the browser's native picker hands back.
|
|
245
|
+
*
|
|
246
|
+
* They lived inside `ui-datepicker`'s entry point while it was the only caller (FSHSP-209
|
|
247
|
+
* moved them here). Two entry points must never import each other, so the second caller
|
|
248
|
+
* left one choice: the shared `forms/` entry point, which exists for exactly this — the
|
|
249
|
+
* helpers a field is built on. Serializing a `Date` from its LOCAL components rather than
|
|
250
|
+
* through `toISOString()` is the subtle part, and it must not be re-derived twice.
|
|
251
|
+
*/
|
|
252
|
+
declare function startOfDay(d: Date): Date;
|
|
253
|
+
declare function firstOfMonth(d: Date): Date;
|
|
254
|
+
declare function isSameDay(a: Date | null | undefined, b: Date | null | undefined): boolean;
|
|
255
|
+
declare function addDays(d: Date, n: number): Date;
|
|
256
|
+
declare function addMonths(d: Date, n: number): Date;
|
|
257
|
+
/** Build a Date and reject overflowed components (e.g. 31 Feb). */
|
|
258
|
+
declare function finalizeParsed(year: number, month: number, day: number, h: number, min: number): Date | null;
|
|
259
|
+
/** Serialize a `Date` to `"yyyy-MM-dd"` from its LOCAL components — never `toISOString()`
|
|
260
|
+
* (which converts to UTC and can shift the day by ±1 depending on the timezone). */
|
|
261
|
+
declare function toIsoDate(d: Date): string;
|
|
262
|
+
/** `"HH:mm"` — the shape a native `<input type="time">` reads and writes. */
|
|
263
|
+
declare function toIsoTime(d: Date): string;
|
|
264
|
+
/** `"yyyy-MM-ddTHH:mm"` — date part built the same local, never-UTC way as {@link toIsoDate}. */
|
|
265
|
+
declare function toIsoDateTime(d: Date): string;
|
|
266
|
+
/** Strict `"yyyy-MM-dd"` parser (rejects anything else, incl. overflowed dates via `finalizeParsed`). */
|
|
267
|
+
declare function parseIsoDate(s: string): Date | null;
|
|
268
|
+
/** Strict `"yyyy-MM-ddTHH:mm"` parser (`showTime`/`timeOnly` round-trip). */
|
|
269
|
+
declare function parseIsoDateTime(s: string): Date | null;
|
|
270
|
+
/**
|
|
271
|
+
* Strict `"HH:mm"` parser, anchored on `reference` (default: today).
|
|
272
|
+
*
|
|
273
|
+
* A bare time is not a point in time; the caller has to say on which day it lands. Mirrors
|
|
274
|
+
* what `ui-datepicker` does in `timeOnly` mode — it too carries a full `Date` — so both
|
|
275
|
+
* components hand back the same shape.
|
|
276
|
+
*/
|
|
277
|
+
declare function parseIsoTime(s: string, reference?: Date): Date | null;
|
|
278
|
+
/** Accepts a `Date` as-is, or parses a `"yyyy-MM-dd"` string — used to let config inputs
|
|
279
|
+
* (`minDate`/`maxDate`/`disabledDates`) take either shape. Invalid strings degrade to `null`
|
|
280
|
+
* (no constraint) rather than throwing: a malformed config shouldn't crash the picker. */
|
|
281
|
+
declare function normalizeDateInput(v: Date | string | null | undefined): Date | null;
|
|
282
|
+
|
|
241
283
|
/**
|
|
242
284
|
* Shared option-resolution helpers for list-based form fields
|
|
243
285
|
* (`ui-select`, `ui-autocomplete`, `ui-input-tags`).
|
|
@@ -287,5 +329,5 @@ declare function formatLabel(template: string, value: string | number): string;
|
|
|
287
329
|
|
|
288
330
|
declare function warnMissingAccessibleName(componentTag: string, message: string): void;
|
|
289
331
|
|
|
290
|
-
export { BaseControlValueAccessor, BaseFieldControl, BaseFormField, MASK_TOKENS, acceptsMaskChar, applyMaskTemplate, autoFormatSegments, buildMaskSlots, caretForMask, createOptionResolver, dropdownOverlayPositions, extractMaskData, formatLabel, parseMaskRanges, warnMissingAccessibleName };
|
|
332
|
+
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 };
|
|
291
333
|
export type { FieldFloatLabel, FieldLevel, FieldSize, MaskBounds, MaskBuildResult, MaskSlot, OptionEntry, OptionResolver, OptionResolverFields };
|
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Background scroll lock shared by every full-screen overlay of the kit
|
|
3
|
+
* (modal, drawer, bottom-sheet, sidebar, image preview).
|
|
4
|
+
*
|
|
5
|
+
* The counter below is module state, so it is only shared as long as every
|
|
6
|
+
* caller resolves to **this** module. That is the whole point of the helper
|
|
7
|
+
* living in a cross-cutting entry point: a copy pasted into a component's own
|
|
8
|
+
* entry point is a separate compilation unit, hence a separate counter, and two
|
|
9
|
+
* overlays from two different entry points then release the body independently
|
|
10
|
+
* — the second one to close restores an `overflow` it captured while already
|
|
11
|
+
* locked, unfreezing the page under the overlay that is still open (or leaving
|
|
12
|
+
* a stale scrollbar gutter once the last one closes).
|
|
13
|
+
*
|
|
14
|
+
* Never re-declare these functions inside a component: import them from
|
|
15
|
+
* `@4sh/ui-kit/overlay`.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Freeze background scroll, compensating the scrollbar gutter to avoid a shift.
|
|
19
|
+
*
|
|
20
|
+
* Ref-counted: nested overlays each take a lock, and only the first one touches
|
|
21
|
+
* the body. Every call must be paired with exactly one {@link unlockBodyScroll}
|
|
22
|
+
* — hold the pairing in the caller (a `locked` flag released on close *and* on
|
|
23
|
+
* destroy), since the helper cannot tell one overlay's locks from another's.
|
|
24
|
+
*
|
|
25
|
+
* @param doc The document owning the `body` to freeze (inject `DOCUMENT`).
|
|
26
|
+
*/
|
|
27
|
+
declare function lockBodyScroll(doc: Document): void;
|
|
28
|
+
/**
|
|
29
|
+
* Release one scroll lock; restore the body when the last overlay closes.
|
|
30
|
+
*
|
|
31
|
+
* @param doc The document passed to the matching {@link lockBodyScroll}.
|
|
32
|
+
*/
|
|
33
|
+
declare function unlockBodyScroll(doc: Document): void;
|
|
34
|
+
|
|
1
35
|
/**
|
|
2
36
|
* Auto-dismiss shared by every floating panel of the kit (menu, context menu,
|
|
3
37
|
* popover, select, autocomplete, input-tags, datepicker, tooltip).
|
|
@@ -28,4 +62,4 @@
|
|
|
28
62
|
*/
|
|
29
63
|
declare function closeOnNavigation(close: () => void): void;
|
|
30
64
|
|
|
31
|
-
export { closeOnNavigation };
|
|
65
|
+
export { closeOnNavigation, lockBodyScroll, unlockBodyScroll };
|