ngwr 16.0.0 → 16.1.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/badge/styles/_tag.scss +8 -4
- package/button/styles/_index.scss +13 -7
- package/cascader/styles/_rules.scss +4 -2
- package/checkbox/styles/_index.scss +4 -2
- package/date-picker/styles/_index.scss +6 -2
- package/date-stamp/styles/_index.scss +38 -0
- package/dialog/styles/_index.scss +38 -0
- package/fesm2022/internal-CVLvP9b_.mjs +33 -0
- package/fesm2022/internal-CVLvP9b_.mjs.map +1 -0
- package/fesm2022/ngwr-alert.mjs +11 -7
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-avatar.mjs +11 -7
- package/fesm2022/ngwr-avatar.mjs.map +1 -1
- package/fesm2022/ngwr-back-top.mjs +10 -6
- package/fesm2022/ngwr-back-top.mjs.map +1 -1
- package/fesm2022/ngwr-badge.mjs +18 -6
- package/fesm2022/ngwr-badge.mjs.map +1 -1
- package/fesm2022/ngwr-burger.mjs +9 -6
- package/fesm2022/ngwr-burger.mjs.map +1 -1
- package/fesm2022/ngwr-button.mjs +8 -4
- package/fesm2022/ngwr-button.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +19 -8
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +9 -5
- package/fesm2022/ngwr-card.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +11 -5
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs +5 -2
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +10 -6
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-clipboard.mjs +2 -1
- package/fesm2022/ngwr-clipboard.mjs.map +1 -1
- package/fesm2022/ngwr-collapse.mjs +9 -5
- package/fesm2022/ngwr-collapse.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +4 -2
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-comment.mjs +13 -7
- package/fesm2022/ngwr-comment.mjs.map +1 -1
- package/fesm2022/ngwr-compare.mjs +9 -3
- package/fesm2022/ngwr-compare.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +4 -2
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-copy-value.mjs +11 -6
- package/fesm2022/ngwr-copy-value.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +86 -30
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp-testing.mjs +34 -0
- package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -0
- package/fesm2022/ngwr-date-stamp.mjs +149 -0
- package/fesm2022/ngwr-date-stamp.mjs.map +1 -0
- package/fesm2022/ngwr-date.mjs +279 -50
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-descriptions.mjs +9 -5
- package/fesm2022/ngwr-descriptions.mjs.map +1 -1
- package/fesm2022/ngwr-dialog-testing.mjs +23 -2
- package/fesm2022/ngwr-dialog-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +45 -16
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +102 -11
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-divider.mjs +4 -2
- package/fesm2022/ngwr-divider.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +29 -3
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +4 -2
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +5 -2
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar.mjs +4 -2
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +9 -3
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +18 -6
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +2 -0
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +2 -0
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +2 -0
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +2 -0
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +2 -0
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +2 -0
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +2 -0
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +2 -0
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +2 -0
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +2 -0
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +2 -0
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +2 -0
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +2 -0
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +2 -0
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +2 -0
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +2 -0
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +2 -0
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +2 -0
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +2 -0
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +2 -0
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +2 -0
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +2 -0
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +34 -8
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +9 -3
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +4 -2
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +20 -10
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +9 -3
- package/fesm2022/ngwr-keyboard.mjs.map +1 -1
- package/fesm2022/ngwr-knob.mjs +9 -3
- package/fesm2022/ngwr-knob.mjs.map +1 -1
- package/fesm2022/ngwr-layout.mjs +13 -5
- package/fesm2022/ngwr-layout.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +9 -5
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +13 -5
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-load-state.mjs +9 -5
- package/fesm2022/ngwr-load-state.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +84 -1
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +3 -2
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +21 -5
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +93 -4
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +4 -2
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-radio.mjs +9 -5
- package/fesm2022/ngwr-radio.mjs.map +1 -1
- package/fesm2022/ngwr-rating.mjs +9 -3
- package/fesm2022/ngwr-rating.mjs.map +1 -1
- package/fesm2022/ngwr-resizable.mjs +503 -0
- package/fesm2022/ngwr-resizable.mjs.map +1 -0
- package/fesm2022/ngwr-result.mjs +9 -5
- package/fesm2022/ngwr-result.mjs.map +1 -1
- package/fesm2022/ngwr-segmented.mjs +4 -2
- package/fesm2022/ngwr-segmented.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +13 -5
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-skeleton.mjs +4 -2
- package/fesm2022/ngwr-skeleton.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +4 -2
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-speed-dial.mjs +4 -2
- package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
- package/fesm2022/ngwr-spinner.mjs +4 -2
- package/fesm2022/ngwr-spinner.mjs.map +1 -1
- package/fesm2022/ngwr-splitter.mjs +17 -21
- package/fesm2022/ngwr-splitter.mjs.map +1 -1
- package/fesm2022/ngwr-stepper.mjs +9 -3
- package/fesm2022/ngwr-stepper.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +9 -5
- package/fesm2022/ngwr-switch.mjs.map +1 -1
- package/fesm2022/ngwr-table-testing.mjs +5 -1
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +167 -10
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +9 -3
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-timeline.mjs +18 -8
- package/fesm2022/ngwr-timeline.mjs.map +1 -1
- package/fesm2022/ngwr-toast-testing.mjs +6 -1
- package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
- package/fesm2022/ngwr-toast.mjs +529 -104
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +4 -2
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +4 -2
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typography.mjs +9 -3
- package/fesm2022/ngwr-typography.mjs.map +1 -1
- package/fesm2022/ngwr-utils-router.mjs +18 -2
- package/fesm2022/ngwr-utils-router.mjs.map +1 -1
- package/fesm2022/ngwr-utils.mjs +9 -2
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-window.mjs +7 -4
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/fesm2022/ngwr.mjs.map +1 -1
- package/i18n/ar.json +6 -0
- package/i18n/cs.json +6 -0
- package/i18n/de.json +6 -0
- package/i18n/en.json +6 -0
- package/i18n/es.json +6 -0
- package/i18n/fr.json +6 -0
- package/i18n/he.json +6 -0
- package/i18n/hi.json +6 -0
- package/i18n/id.json +6 -0
- package/i18n/it.json +6 -0
- package/i18n/ja.json +6 -0
- package/i18n/ko.json +6 -0
- package/i18n/nl.json +6 -0
- package/i18n/pl.json +6 -0
- package/i18n/pt.json +6 -0
- package/i18n/ru.json +6 -0
- package/i18n/sv.json +6 -0
- package/i18n/tr.json +6 -0
- package/i18n/uk.json +6 -0
- package/i18n/vi.json +6 -0
- package/i18n/zh-TW.json +6 -0
- package/i18n/zh.json +6 -0
- package/input/styles/_index.scss +10 -5
- package/input-number/styles/_index.scss +6 -3
- package/input-otp/styles/_index.scss +4 -2
- package/llms-full.txt +29 -10
- package/llms.txt +8 -4
- package/package.json +15 -1
- package/radio/styles/_index.scss +4 -2
- package/resizable/styles/_index.scss +154 -0
- package/schematics/use/rule.js +1 -0
- package/schematics/use/symbol-map.json +4 -0
- package/select/styles/_index.scss +6 -3
- package/skills/ngwr/SKILL.md +1 -1
- package/skills/ngwr/references/catalog.md +4 -1
- package/skills/ngwr/references/setup.md +3 -0
- package/switch/styles/_index.scss +4 -2
- package/table/styles/_index.scss +53 -0
- package/textarea/styles/_index.scss +4 -2
- package/theme/styles/_motion.scss +6 -0
- package/toast/styles/_index.scss +19 -0
- package/types/ngwr-burger.d.ts +0 -1
- package/types/ngwr-calendar.d.ts +7 -0
- package/types/ngwr-charts-calendar-heatmap.d.ts +2 -1
- package/types/ngwr-clipboard.d.ts +7 -0
- package/types/ngwr-date-picker.d.ts +9 -2
- package/types/ngwr-date-stamp-testing.d.ts +47 -0
- package/types/ngwr-date-stamp.d.ts +81 -0
- package/types/ngwr-date.d.ts +135 -24
- package/types/ngwr-dialog-testing.d.ts +10 -0
- package/types/ngwr-dialog.d.ts +72 -4
- package/types/ngwr-directives.d.ts +36 -1
- package/types/ngwr-drawer.d.ts +21 -0
- package/types/ngwr-i18n.d.ts +44 -14
- package/types/ngwr-overlay.d.ts +36 -0
- package/types/ngwr-pipes.d.ts +15 -0
- package/types/ngwr-popover.d.ts +39 -1
- package/types/ngwr-resizable.d.ts +228 -0
- package/types/ngwr-table-testing.d.ts +3 -1
- package/types/ngwr-table.d.ts +120 -4
- package/types/ngwr-toast-testing.d.ts +12 -1
- package/types/ngwr-toast.d.ts +215 -18
- package/types/ngwr-utils-router.d.ts +22 -0
- package/types/ngwr-utils.d.ts +8 -1
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr.d.ts +1 -0
package/types/ngwr-calendar.d.ts
CHANGED
|
@@ -68,6 +68,11 @@ export declare class WrCalendar {
|
|
|
68
68
|
private readonly dir;
|
|
69
69
|
private readonly host;
|
|
70
70
|
private readonly injector;
|
|
71
|
+
/**
|
|
72
|
+
* Today as this adapter's day. With `withDates({ timeZone })` it is the day
|
|
73
|
+
* the display zone is in, which near midnight is not the browser's.
|
|
74
|
+
*/
|
|
75
|
+
private zoneToday;
|
|
71
76
|
/** Currently displayed month (any date inside it). */
|
|
72
77
|
protected readonly viewDate: import("@angular/core").WritableSignal<Date>;
|
|
73
78
|
/** Date currently focused by keyboard (single roving tabindex). */
|
|
@@ -217,6 +222,8 @@ export declare class WrCalendar {
|
|
|
217
222
|
*/
|
|
218
223
|
private setViewMode;
|
|
219
224
|
private stepViewDate;
|
|
225
|
+
/** Through the adapter, not `Date#getDate`: a zoned adapter's day is not the browser's. */
|
|
226
|
+
protected dayOfMonth(date: Date): number;
|
|
220
227
|
protected isToday(date: Date): boolean;
|
|
221
228
|
protected isOutOfMonth(date: Date): boolean;
|
|
222
229
|
protected isSelected(date: Date): boolean;
|
|
@@ -133,7 +133,8 @@ export declare class WrCalendarHeatmap {
|
|
|
133
133
|
* `false` on the server and in jsdom, which lay nothing out.
|
|
134
134
|
*/
|
|
135
135
|
protected readonly scrollable: import("@angular/core").WritableSignal<boolean>;
|
|
136
|
-
private readonly
|
|
136
|
+
private readonly dateLocale;
|
|
137
|
+
private get locale();
|
|
137
138
|
/**
|
|
138
139
|
* Weekday names from the locale rather than a hard-coded English list — the row order is
|
|
139
140
|
* Sunday-first, matching the grid's own alignment, so 7 Jan 2024 (a Sunday) is the
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
/** Outcome of a clipboard read or permission probe. */
|
|
3
3
|
type WrClipboardPermission = 'granted' | 'denied' | 'prompt' | 'unsupported';
|
|
4
|
+
/**
|
|
5
|
+
* How long a "Copied" confirmation stays, in ms: `<wr-copy-value>` and
|
|
6
|
+
* `[wrCopyToClipboard]` share it.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare const WR_COPIED_DURATION = 1500;
|
|
4
11
|
/**
|
|
5
12
|
* Programmatic clipboard read / write.
|
|
6
13
|
*
|
|
@@ -175,7 +175,9 @@ export declare class WrDatePicker implements FormValueControl<Date | null> {
|
|
|
175
175
|
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, any>;
|
|
176
176
|
/** Read-only — input not typeable, but the trigger icon still opens the overlay. @default false */
|
|
177
177
|
readonly readonly: import("@angular/core").InputSignalWithTransform<boolean, any>;
|
|
178
|
-
private readonly
|
|
178
|
+
private readonly dayAdapter;
|
|
179
|
+
private readonly environment;
|
|
180
|
+
private get adapter();
|
|
179
181
|
private readonly overlay;
|
|
180
182
|
private readonly outsideClick;
|
|
181
183
|
private readonly scrollStrategies;
|
|
@@ -371,6 +373,8 @@ export declare class WrDatePicker implements FormValueControl<Date | null> {
|
|
|
371
373
|
* because the echo guard has to answer "is the display still current", and a
|
|
372
374
|
* `[format]` / `[mode]` change makes it stale with the value untouched. */
|
|
373
375
|
private lastFormat;
|
|
376
|
+
/** The adapter's `displayKey()` the text was last written under. */
|
|
377
|
+
private lastKey;
|
|
374
378
|
constructor();
|
|
375
379
|
protected onInput(event: Event): void;
|
|
376
380
|
/** The clear (×) button — the same commit an emptied field makes. */
|
|
@@ -452,6 +456,7 @@ export declare class WrDatePicker implements FormValueControl<Date | null> {
|
|
|
452
456
|
/** Close the popup. */
|
|
453
457
|
close(): void;
|
|
454
458
|
private openOverlay;
|
|
459
|
+
private panelInjector;
|
|
455
460
|
private attachDate;
|
|
456
461
|
private attachTime;
|
|
457
462
|
private attachDateTime;
|
|
@@ -681,7 +686,9 @@ export declare class WrDateRangePicker implements FormValueControl<WrDateRange |
|
|
|
681
686
|
* @default false
|
|
682
687
|
*/
|
|
683
688
|
readonly readonly: import("@angular/core").InputSignalWithTransform<boolean, any>;
|
|
684
|
-
private readonly
|
|
689
|
+
private readonly dayAdapter;
|
|
690
|
+
private readonly environment;
|
|
691
|
+
private get adapter();
|
|
685
692
|
private readonly overlay;
|
|
686
693
|
private readonly outsideClick;
|
|
687
694
|
private readonly scrollStrategies;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { BaseHarnessFilters, ComponentHarness, HarnessPredicate } from "@angular/cdk/testing";
|
|
2
|
+
/** Narrows which `<wr-date-stamp>` a harness query matches. */
|
|
3
|
+
interface WrDateStampHarnessFilters extends BaseHarnessFilters {
|
|
4
|
+
/** Match the date line: a string is an exact match, a RegExp is tested. An empty stamp matches neither. */
|
|
5
|
+
readonly date?: string | RegExp;
|
|
6
|
+
/** Match only empty (`true`) or only filled (`false`) ones. */
|
|
7
|
+
readonly empty?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Test harness for one `<wr-date-stamp>`: a date over a time.
|
|
11
|
+
*
|
|
12
|
+
* It answers from what the component renders: the two lines as text and the
|
|
13
|
+
* `datetime` attribute of the `<time>` around them. The lines are written in
|
|
14
|
+
* the locale and the time zone of the test's own providers, so a spec that
|
|
15
|
+
* must not depend on either asserts {@link getDateTime}, which is the instant.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const loader = TestbedHarnessEnvironment.loader(fixture);
|
|
20
|
+
* const created = await loader.getHarness(WrDateStampHarness);
|
|
21
|
+
*
|
|
22
|
+
* expect(await created.getDateTime()).toBe('2026-11-12T08:45:00.000Z');
|
|
23
|
+
* expect(await created.getTime()).toBe('13:45');
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @see https://ngwr.dev/guides/testing
|
|
27
|
+
*/
|
|
28
|
+
export declare class WrDateStampHarness extends ComponentHarness {
|
|
29
|
+
static hostSelector: string;
|
|
30
|
+
/** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */
|
|
31
|
+
static with(options?: WrDateStampHarnessFilters): HarnessPredicate<WrDateStampHarness>;
|
|
32
|
+
private readonly time;
|
|
33
|
+
/** The first line, or `null` when the stamp is empty. */
|
|
34
|
+
getDate(): Promise<string | null>;
|
|
35
|
+
/** The second line, or `null` when the stamp is empty or shows a date-only value. */
|
|
36
|
+
getTime(): Promise<string | null>;
|
|
37
|
+
/**
|
|
38
|
+
* The `datetime` attribute: the instant in ISO 8601 (UTC), or `yyyy-MM-dd` for a
|
|
39
|
+
* date-only value. `null` when the stamp is empty.
|
|
40
|
+
*/
|
|
41
|
+
getDateTime(): Promise<string | null>;
|
|
42
|
+
/** Whether the value is empty: no `<time>`, the placeholder in its place. */
|
|
43
|
+
isEmpty(): Promise<boolean>;
|
|
44
|
+
/** The placeholder an empty value shows (`emptyLabel`). Throws when there is a value. */
|
|
45
|
+
getEmptyText(): Promise<string>;
|
|
46
|
+
}
|
|
47
|
+
export type { WrDateStampHarnessFilters };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { WrDateFormat } from "ngwr/date";
|
|
3
|
+
interface Stamp {
|
|
4
|
+
readonly iso: string;
|
|
5
|
+
readonly date: string;
|
|
6
|
+
readonly time: string | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A moment in two lines, for a table cell: the date over the time.
|
|
10
|
+
*
|
|
11
|
+
* Both lines are written by the date adapter, so they are in the interface
|
|
12
|
+
* language and, for an instant, on the wall clock of
|
|
13
|
+
* `withDates({ timeZone })`, and they follow both at runtime. The value is read
|
|
14
|
+
* as `wrDate` reads it: a `Date`, epoch milliseconds or a string. A date-only
|
|
15
|
+
* string (`'2026-11-12'`) is a day, so it shows the date line alone and does
|
|
16
|
+
* not shift with the zone.
|
|
17
|
+
*
|
|
18
|
+
* The lines sit in one `<time>` whose `datetime` is the instant in ISO 8601,
|
|
19
|
+
* or the day for a date-only string. `null`, `undefined`, `''` and a value
|
|
20
|
+
* that is not a date are empty: the component shows `emptyLabel`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```html
|
|
24
|
+
* <wr-date-stamp [value]="row.createdAt" />
|
|
25
|
+
* <wr-date-stamp [value]="row.createdAt" dateFormat="d MMM yyyy" timeFormat="time24hSeconds" />
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @see https://ngwr.dev/reference/components/date-stamp
|
|
29
|
+
*/
|
|
30
|
+
export declare class WrDateStamp {
|
|
31
|
+
constructor();
|
|
32
|
+
/**
|
|
33
|
+
* The moment shown: a `Date`, epoch milliseconds, or a string `wrParseDate`
|
|
34
|
+
* reads. `null`, `undefined`, `''` and a value that is not a date are empty.
|
|
35
|
+
*
|
|
36
|
+
* @default null
|
|
37
|
+
*/
|
|
38
|
+
readonly value: import("@angular/core").InputSignal<string | number | Date | null | undefined>;
|
|
39
|
+
/**
|
|
40
|
+
* Format of the first line: a named key or a token string (`'d MMM yyyy'`).
|
|
41
|
+
*
|
|
42
|
+
* @default 'mediumDate'
|
|
43
|
+
*/
|
|
44
|
+
readonly dateFormat: import("@angular/core").InputSignal<WrDateFormat | (string & {})>;
|
|
45
|
+
/**
|
|
46
|
+
* Format of the second line: a named key (`'time24hSeconds'`) or a token
|
|
47
|
+
* string (`'HH:mm'`).
|
|
48
|
+
*
|
|
49
|
+
* @default 'time'
|
|
50
|
+
*/
|
|
51
|
+
readonly timeFormat: import("@angular/core").InputSignal<WrDateFormat | (string & {})>;
|
|
52
|
+
/** What stands in for an empty value. Falls back to `copyValue.empty`, then `'-'`. */
|
|
53
|
+
readonly emptyLabel: import("@angular/core").InputSignal<string | null>;
|
|
54
|
+
protected readonly resolvedEmptyLabel: import("@angular/core").Signal<string>;
|
|
55
|
+
private readonly adapter;
|
|
56
|
+
protected readonly parts: import("@angular/core").Signal<Stamp | null>;
|
|
57
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WrDateStamp, never>;
|
|
58
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WrDateStamp, "wr-date-stamp", never, {
|
|
59
|
+
"value": {
|
|
60
|
+
"alias": "value";
|
|
61
|
+
"required": false;
|
|
62
|
+
"isSignal": true;
|
|
63
|
+
};
|
|
64
|
+
"dateFormat": {
|
|
65
|
+
"alias": "dateFormat";
|
|
66
|
+
"required": false;
|
|
67
|
+
"isSignal": true;
|
|
68
|
+
};
|
|
69
|
+
"timeFormat": {
|
|
70
|
+
"alias": "timeFormat";
|
|
71
|
+
"required": false;
|
|
72
|
+
"isSignal": true;
|
|
73
|
+
};
|
|
74
|
+
"emptyLabel": {
|
|
75
|
+
"alias": "emptyLabel";
|
|
76
|
+
"required": false;
|
|
77
|
+
"isSignal": true;
|
|
78
|
+
};
|
|
79
|
+
}, {}, never, never, true, never>;
|
|
80
|
+
}
|
|
81
|
+
export {};
|
package/types/ngwr-date.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { InjectionToken, Type } from "@angular/core";
|
|
2
|
+
import { InjectionToken, Signal, Type } from "@angular/core";
|
|
3
3
|
import { WrFeature } from "ngwr/utils";
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
@@ -46,6 +46,25 @@ interface WrDatesOptions {
|
|
|
46
46
|
* browser happens to be.
|
|
47
47
|
*/
|
|
48
48
|
readonly locale?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The time zone dates are SHOWN in: an IANA name (`'Asia/Almaty'`), an offset
|
|
51
|
+
* (`'+05:00'`, `'+05:30'`), or a function returning one. The function runs in
|
|
52
|
+
* an injection context, so it may `inject()` the service that holds the
|
|
53
|
+
* value, and a signal is such a function: a zone that arrives from a runtime
|
|
54
|
+
* config after bootstrap repaints what is on screen. Default, and for `null`
|
|
55
|
+
* or `undefined`: the browser's zone.
|
|
56
|
+
*
|
|
57
|
+
* Display only. A `Date` stays the instant it is, and so does a picker's
|
|
58
|
+
* `value`. `wrDate`, `wrFormatDate` and `wr-date-stamp` print an instant on
|
|
59
|
+
* this zone's wall clock; `wr-date-picker` in `time` and `datetime` mode shows
|
|
60
|
+
* and reads its field and panel on it; the calendar marks this zone's today.
|
|
61
|
+
* A date-only value is a calendar day and does not shift: `mode="date"` and a
|
|
62
|
+
* `'2026-11-12'` string are the 12th in every zone.
|
|
63
|
+
*
|
|
64
|
+
* A value no engine knows falls back to the browser's zone and warns once in
|
|
65
|
+
* dev mode.
|
|
66
|
+
*/
|
|
67
|
+
readonly timeZone?: string | (() => string | null | undefined);
|
|
49
68
|
}
|
|
50
69
|
/** Whether `value` is one of the shared named format keys. */
|
|
51
70
|
declare function wrIsNamedFormat(value: string): value is WrDateFormat;
|
|
@@ -55,7 +74,7 @@ declare function wrIsNamedFormat(value: string): value is WrDateFormat;
|
|
|
55
74
|
* changing component code.
|
|
56
75
|
*
|
|
57
76
|
* Injected with nothing provided it is {@link WrNativeDateAdapter} (native
|
|
58
|
-
* `Date`, `Intl.DateTimeFormat`, the locale from {@link
|
|
77
|
+
* `Date`, `Intl.DateTimeFormat`, the locale from {@link wrDateLocale}), so the
|
|
59
78
|
* date components need no provider. For another library, subclass this,
|
|
60
79
|
* decorate the subclass with `@Service()` and register it via
|
|
61
80
|
* `provideWr(withDates({ adapter: MyAdapter }))`. An undecorated subclass still
|
|
@@ -135,6 +154,26 @@ export declare abstract class WrDateAdapter<TDate = Date> {
|
|
|
135
154
|
* exactly as it was.
|
|
136
155
|
*/
|
|
137
156
|
abstract parse(value: string, formatKeyOrString: WrDateFormat | (string & {})): TDate | null;
|
|
157
|
+
/**
|
|
158
|
+
* This adapter for instants: every accessor, `createDate`, the math, `format`
|
|
159
|
+
* and `parse` read a date on the wall clock of the display time zone
|
|
160
|
+
* (`withDates({ timeZone })`) instead of the browser's. The adapter itself
|
|
161
|
+
* keeps reading the browser's zone, because a calendar day has no zone: the
|
|
162
|
+
* 12th picked in a date-only field is the 12th wherever it is shown.
|
|
163
|
+
*
|
|
164
|
+
* `wrDate`, `wr-date-stamp` and the pickers' modes with a time ask for it.
|
|
165
|
+
* The base class returns itself, so an adapter that does not override this
|
|
166
|
+
* shows every date in the browser's zone.
|
|
167
|
+
*/
|
|
168
|
+
zoned(): WrDateAdapter<TDate>;
|
|
169
|
+
/**
|
|
170
|
+
* What `format` writes in besides its arguments, as one string: the locale,
|
|
171
|
+
* and the time zone on the {@link zoned} adapter. Equal keys mean equal
|
|
172
|
+
* output, so a caller that keeps a formatted string compares keys instead of
|
|
173
|
+
* formatting again. The native adapter reads its signals here: called in a
|
|
174
|
+
* template, a `computed` or an `effect`, it re-runs them when either moves.
|
|
175
|
+
*/
|
|
176
|
+
displayKey(): string;
|
|
138
177
|
/** `0` Sunday, `1` Monday — locale-dependent. */
|
|
139
178
|
abstract getFirstDayOfWeek(): number;
|
|
140
179
|
/** Names ordered from `getFirstDayOfWeek()` onwards. Length 7. */
|
|
@@ -152,7 +191,38 @@ export declare abstract class WrDateAdapter<TDate = Date> {
|
|
|
152
191
|
* {@link WrDateAdapter} over its own date library instead.
|
|
153
192
|
*/
|
|
154
193
|
export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
155
|
-
private readonly
|
|
194
|
+
private readonly localeSource;
|
|
195
|
+
private cache;
|
|
196
|
+
/**
|
|
197
|
+
* What is kept for the current locale, and the locale with it. A signal read,
|
|
198
|
+
* so what formats in a reactive context follows a language switch; the switch
|
|
199
|
+
* drops everything kept for the locale before it.
|
|
200
|
+
*/
|
|
201
|
+
private caches;
|
|
202
|
+
private get locale();
|
|
203
|
+
private readonly zoneSource;
|
|
204
|
+
private readonly injector;
|
|
205
|
+
/** Whether this instance is the one {@link zoned} hands out. */
|
|
206
|
+
private zonal;
|
|
207
|
+
private zonedSelf;
|
|
208
|
+
/**
|
|
209
|
+
* A second instance of the same class, so an app's subclass keeps its
|
|
210
|
+
* overrides. With no `timeZone` option at all it is this instance.
|
|
211
|
+
*/
|
|
212
|
+
zoned(): WrDateAdapter<Date>;
|
|
213
|
+
displayKey(): string;
|
|
214
|
+
private zone;
|
|
215
|
+
private wallZone;
|
|
216
|
+
private readonly walls;
|
|
217
|
+
/**
|
|
218
|
+
* The date on the display zone's wall clock, as a `Date` read with the UTC
|
|
219
|
+
* getters, or `null` on the adapter that reads the browser's zone. Reading a
|
|
220
|
+
* named zone costs an `Intl` call and a month grid asks for the same day many
|
|
221
|
+
* times over, so those are kept.
|
|
222
|
+
*/
|
|
223
|
+
private wall;
|
|
224
|
+
/** The instant a wall clock from {@link wall} names. */
|
|
225
|
+
private instant;
|
|
156
226
|
today(): Date;
|
|
157
227
|
clone(date: Date): Date;
|
|
158
228
|
createDate(year: number, month: number, day: number): Date;
|
|
@@ -197,11 +267,8 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
|
197
267
|
* Constructing one is the expensive part of `format()`, and this adapter is
|
|
198
268
|
* called per CELL: `wr-event-calendar` builds an `aria-label` for every time
|
|
199
269
|
* slot on every day, so a week view asked for hundreds of identical
|
|
200
|
-
* formatters.
|
|
201
|
-
* adapter, so the cache needs no invalidation — that is the whole reason it
|
|
202
|
-
* can be this simple.
|
|
270
|
+
* formatters. They are kept per locale, in {@link caches}.
|
|
203
271
|
*/
|
|
204
|
-
private readonly formatters;
|
|
205
272
|
/**
|
|
206
273
|
* Every `Intl` call this adapter makes pins `calendar: 'gregory'`, and that is a
|
|
207
274
|
* correctness fix rather than a preference.
|
|
@@ -216,6 +283,7 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
|
216
283
|
* describe the same one.
|
|
217
284
|
*/
|
|
218
285
|
private intlOptions;
|
|
286
|
+
/** `utc` is the formatter a wall clock from {@link wall} is printed with. */
|
|
219
287
|
private intl;
|
|
220
288
|
getDayOfWeekNames(style: 'narrow' | 'short' | 'long'): readonly string[];
|
|
221
289
|
/**
|
|
@@ -224,10 +292,8 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
|
224
292
|
* the token formatter, and this method deliberately keeps the heading one.
|
|
225
293
|
*/
|
|
226
294
|
getMonthNames(style: 'narrow' | 'short' | 'long'): readonly string[];
|
|
227
|
-
private numeralsCache;
|
|
228
295
|
/** The locale's own ten digits, cached — empty when its system is algorithmic. */
|
|
229
296
|
private localeNumerals;
|
|
230
|
-
private dayPeriodCache;
|
|
231
297
|
/**
|
|
232
298
|
* `[am, pm]` as the LOCALE writes them — `PM`, `م`, `午後`.
|
|
233
299
|
*
|
|
@@ -239,7 +305,6 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
|
239
305
|
* there and passes a 24-hour pattern here.
|
|
240
306
|
*/
|
|
241
307
|
private dayPeriods;
|
|
242
|
-
private readonly monthNameCache;
|
|
243
308
|
/**
|
|
244
309
|
* `context: 'format'` asks `Intl` for the month name as it appears BESIDE A DAY, which
|
|
245
310
|
* is where a case language stops using the nominative: ru writes `15 марта`, not
|
|
@@ -277,7 +342,6 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
|
277
342
|
private namedMonthNames;
|
|
278
343
|
/** `[am, pm]` as THIS formatter writes them — `ص` / `م` in Arabic, not AM / PM. */
|
|
279
344
|
private dayPeriodNames;
|
|
280
|
-
private readonly namedParsers;
|
|
281
345
|
private parseNamed;
|
|
282
346
|
/**
|
|
283
347
|
* Assemble whatever was read into a `Date`, or refuse.
|
|
@@ -298,6 +362,14 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
|
298
362
|
* Use of this source code is governed by an MIT-style license that can be
|
|
299
363
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
300
364
|
*/
|
|
365
|
+
/**
|
|
366
|
+
* Whether a value names a calendar day (`2026-01-01`, `2026-01`, `2026`) rather
|
|
367
|
+
* than an instant. Such a day is the same day in every time zone, so `wrDate`
|
|
368
|
+
* does not move it to the display zone.
|
|
369
|
+
*
|
|
370
|
+
* @internal
|
|
371
|
+
*/
|
|
372
|
+
export declare function wrIsDateOnly(value: unknown): boolean;
|
|
301
373
|
/**
|
|
302
374
|
* A string or a timestamp as a `Date`, with one exception to `new Date()`: a
|
|
303
375
|
* date-only ISO string names a calendar day, so it is read as that day's LOCAL
|
|
@@ -359,13 +431,37 @@ export declare function wrToLocalDate(value: string | number): Date;
|
|
|
359
431
|
*/
|
|
360
432
|
export declare function wrParseDate(value: Date | string | number | null | undefined): Date | null;
|
|
361
433
|
/**
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
434
|
+
* The locale dates are written in, as a signal. Highest first:
|
|
435
|
+
*
|
|
436
|
+
* 1. `withDates({ locale })`: a pin, which a language switch does not move.
|
|
437
|
+
* 2. `WrI18n.locale()`, when the app calls `provideWrI18n()`: the interface
|
|
438
|
+
* language, which `WrI18n.use()` changes at runtime.
|
|
439
|
+
* 3. `LOCALE_ID`.
|
|
440
|
+
*
|
|
441
|
+
* A catalog name that is not a BCP 47 tag (`en_US`) cannot format a date, so
|
|
442
|
+
* the signal holds `LOCALE_ID` while the interface language is one.
|
|
443
|
+
*
|
|
444
|
+
* Must be called in an injection context. The native adapter formats in it; an
|
|
445
|
+
* adapter of your own reads it to follow the same rule.
|
|
446
|
+
*
|
|
447
|
+
* @example
|
|
448
|
+
* ```ts
|
|
449
|
+
* private readonly locale = wrDateLocale();
|
|
450
|
+
* protected readonly weekday = computed(() =>
|
|
451
|
+
* new Intl.DateTimeFormat(this.locale(), { weekday: 'long' }).format(this.date()),
|
|
452
|
+
* );
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
export declare function wrDateLocale(): Signal<string>;
|
|
456
|
+
/**
|
|
457
|
+
* Replace the date adapter the calendar / date picker / time picker use, pin
|
|
458
|
+
* the locale it formats in, or set the time zone dates are shown in, as a
|
|
459
|
+
* feature of `provideWr()`. Optional: with no call at all they run on
|
|
460
|
+
* {@link WrNativeDateAdapter} in Angular's `LOCALE_ID` and the browser's zone.
|
|
365
461
|
*
|
|
366
|
-
* Omit `locale` and dates follow
|
|
367
|
-
*
|
|
368
|
-
*
|
|
462
|
+
* Omit `locale` and dates follow the interface language of `provideWrI18n()`,
|
|
463
|
+
* `WrI18n.use()` included, and Angular's `LOCALE_ID` in an app without it.
|
|
464
|
+
* Pass one only to pin dates to something else, see {@link wrDateLocale}.
|
|
369
465
|
*
|
|
370
466
|
* The one feature that works in a route's `providers` as well: that subtree
|
|
371
467
|
* gets an adapter of its own.
|
|
@@ -379,15 +475,16 @@ export declare function wrParseDate(value: Date | string | number | null | undef
|
|
|
379
475
|
* providers: [
|
|
380
476
|
* provideWr(withDates({ locale: 'ru-RU' })), // pin the dates
|
|
381
477
|
* // provideWr(withDates({ adapter: MyDateAdapter, locale: 'fr' })), // your own subclass
|
|
478
|
+
* // provideWr(withDates({ timeZone: () => inject(AppConfig).timeZone() })), // a runtime config
|
|
382
479
|
* ],
|
|
383
480
|
* });
|
|
384
481
|
* ```
|
|
385
482
|
*/
|
|
386
483
|
export declare function withDates(options?: WrDatesOptions): WrFeature<'dates'>;
|
|
387
484
|
/**
|
|
388
|
-
* BCP 47 locale tag
|
|
389
|
-
*
|
|
390
|
-
* `
|
|
485
|
+
* The BCP 47 locale tag `withDates({ locale })` pinned, and Angular's
|
|
486
|
+
* `LOCALE_ID` when nothing was. An adapter reads {@link wrDateLocale} instead,
|
|
487
|
+
* which puts the interface language of `provideWrI18n()` between the two.
|
|
391
488
|
*
|
|
392
489
|
* **It used to default to `navigator.language`, and that was wrong in the
|
|
393
490
|
* documented case.** The provider's own first example was the no-argument call,
|
|
@@ -401,10 +498,10 @@ export declare function withDates(options?: WrDatesOptions): WrFeature<'dates'>;
|
|
|
401
498
|
* to match. An app that genuinely wants the browser's tag can still say so:
|
|
402
499
|
* `provideWr(withDates({ locale: navigator.language }))`.
|
|
403
500
|
*
|
|
404
|
-
* The token is a plain string, resolved once
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
* the
|
|
501
|
+
* The token is a plain string, resolved once: the *pinned* date locale, not a
|
|
502
|
+
* live one. `WrI18n.use()` cannot move it, and moves dates only when nothing
|
|
503
|
+
* was pinned. Provide it through `withDates({ locale })`: a bare provider of
|
|
504
|
+
* this token is read as the fallback, not as a pin.
|
|
408
505
|
*
|
|
409
506
|
* **How far it reaches is up to the adapter.** The native one threads it through
|
|
410
507
|
* everything. A subclass over a library that resolves its patterns against a
|
|
@@ -413,4 +510,18 @@ export declare function withDates(options?: WrDatesOptions): WrFeature<'dates'>;
|
|
|
413
510
|
* through `Intl`, localize and the field's own text does not.
|
|
414
511
|
*/
|
|
415
512
|
export declare const WR_DATE_LOCALE: InjectionToken<string>;
|
|
513
|
+
/**
|
|
514
|
+
* The display time zone the {@link WrDateAdapter} implementations read, as a
|
|
515
|
+
* function: an IANA name (`'Asia/Almaty'`) or an offset (`'+05:00'`), and
|
|
516
|
+
* `null` or `undefined` for the browser's own zone. `null` when
|
|
517
|
+
* `withDates({ timeZone })` was not called, which is the browser's zone too.
|
|
518
|
+
*
|
|
519
|
+
* A function rather than a string because the zone often arrives after
|
|
520
|
+
* bootstrap, from a runtime config. The native adapter calls it on every read,
|
|
521
|
+
* so what it formats follows the signals the function reads.
|
|
522
|
+
*
|
|
523
|
+
* Set it with the `timeZone` option of `provideWr(withDates(...))`. An adapter
|
|
524
|
+
* of your own injects it to honour the same option.
|
|
525
|
+
*/
|
|
526
|
+
export declare const WR_DATE_TIME_ZONE: InjectionToken<(() => string | null | undefined) | null>;
|
|
416
527
|
export { type WrDateFormat, type WrDatesOptions, wrIsNamedFormat };
|
|
@@ -57,6 +57,16 @@ export declare class WrDialogHarness extends ContentContainerComponentHarness {
|
|
|
57
57
|
sendEscape(): Promise<void>;
|
|
58
58
|
/** Whether this is a `WrDialog.confirm()` dialog, the one `confirm()` and `cancel()` answer. */
|
|
59
59
|
isConfirm(): Promise<boolean>;
|
|
60
|
+
/** Whether this is a `WrDialog.alert()` dialog, the one `ok()` dismisses. */
|
|
61
|
+
isAlert(): Promise<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* The `intent` a `confirm()` or an `alert()` dialog shows as an icon, or
|
|
64
|
+
* `null` when it has none. Read off the icon's modifier class, which is all
|
|
65
|
+
* the intent leaves in the DOM: the icon is decorative.
|
|
66
|
+
*/
|
|
67
|
+
getIntent(): Promise<'info' | 'success' | 'warning' | 'danger' | null>;
|
|
68
|
+
/** Press the button of a `WrDialog.alert()` dialog. Throws on any other dialog. */
|
|
69
|
+
ok(): Promise<void>;
|
|
60
70
|
/** Press the confirm button of a `WrDialog.confirm()` dialog. Throws on any other dialog. */
|
|
61
71
|
confirm(): Promise<void>;
|
|
62
72
|
/** Press the cancel button of a `WrDialog.confirm()` dialog. Throws on any other dialog. */
|
package/types/ngwr-dialog.d.ts
CHANGED
|
@@ -150,7 +150,20 @@ interface WrDialogOptions<D = unknown> {
|
|
|
150
150
|
* @default false, or what `withDialog()` sets
|
|
151
151
|
*/
|
|
152
152
|
readonly tabTitle?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Where the global toast stack paints while this dialog is open. `'below'`
|
|
155
|
+
* keeps it under the dialog and its backdrop, so a toast neither covers the
|
|
156
|
+
* dialog nor can be reached until the dialog closes. Toasts in a
|
|
157
|
+
* `<wr-toast-outlet>` are page content and are under every dialog anyway.
|
|
158
|
+
* With dialogs stacked, the top one decides.
|
|
159
|
+
* @default 'above'
|
|
160
|
+
*/
|
|
161
|
+
readonly toasts?: 'above' | 'below';
|
|
153
162
|
}
|
|
163
|
+
/** The `WrDialogOptions` that `confirm()` and `alert()` pass through to the dialog. */
|
|
164
|
+
type WrDialogMessageOptions = Pick<WrDialogOptions, 'width' | 'maxWidth' | 'panelClass' | 'closeOnBackdropClick' | 'closeOnEscape' | 'closeOnNavigation' | 'tabTitle' | 'toasts'>;
|
|
165
|
+
/** The meaning a `confirm()` or an `alert()` dialog shows as an icon before its title. */
|
|
166
|
+
type WrDialogIntent = 'info' | 'success' | 'warning' | 'danger';
|
|
154
167
|
/**
|
|
155
168
|
* Options accepted by `WrDialog.confirm()`.
|
|
156
169
|
*
|
|
@@ -158,7 +171,7 @@ interface WrDialogOptions<D = unknown> {
|
|
|
158
171
|
* and a `[wrDialogFooter]` with two `wr-btn`. Anything richer than a title and
|
|
159
172
|
* a line of text is a component of your own through `open()`.
|
|
160
173
|
*/
|
|
161
|
-
interface WrDialogConfirmOptions extends
|
|
174
|
+
interface WrDialogConfirmOptions extends WrDialogMessageOptions {
|
|
162
175
|
/** The question. Names the dialog through `aria-labelledby`. */
|
|
163
176
|
readonly title: string;
|
|
164
177
|
/**
|
|
@@ -174,9 +187,34 @@ interface WrDialogConfirmOptions extends Pick<WrDialogOptions, 'width' | 'maxWid
|
|
|
174
187
|
* Color of the confirm button, the way `confirmColor` on `[wrPopconfirm]`
|
|
175
188
|
* reads. `danger` also moves the initial focus to the cancel button, so a
|
|
176
189
|
* stray Enter does not delete; every other color focuses the confirm button.
|
|
177
|
-
* @default 'primary'
|
|
190
|
+
* @default 'primary', or the `intent` when that is `danger` or `warning`
|
|
178
191
|
*/
|
|
179
192
|
readonly confirmColor?: WrColor;
|
|
193
|
+
/**
|
|
194
|
+
* An icon before the title, in the intent's color. It is decorative: the
|
|
195
|
+
* title and the message say what happened. `danger` and `warning` also color
|
|
196
|
+
* the confirm button unless `confirmColor` is set.
|
|
197
|
+
*/
|
|
198
|
+
readonly intent?: WrDialogIntent;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Options accepted by `WrDialog.alert()`.
|
|
202
|
+
*
|
|
203
|
+
* The layout is `confirm()`'s with one `wr-btn`: a message the user reads and
|
|
204
|
+
* acknowledges.
|
|
205
|
+
*/
|
|
206
|
+
interface WrDialogAlertOptions extends WrDialogMessageOptions {
|
|
207
|
+
/** The message's headline. Names the dialog through `aria-labelledby`. */
|
|
208
|
+
readonly title: string;
|
|
209
|
+
/**
|
|
210
|
+
* Plain text under the title, rendered as text and never as HTML. Describes
|
|
211
|
+
* the dialog through `aria-describedby`.
|
|
212
|
+
*/
|
|
213
|
+
readonly message?: string;
|
|
214
|
+
/** Button text. Falls back to the `common.ok` catalog key. */
|
|
215
|
+
readonly okLabel?: string;
|
|
216
|
+
/** An icon before the title, in the intent's color. It is decorative. */
|
|
217
|
+
readonly intent?: WrDialogIntent;
|
|
180
218
|
}
|
|
181
219
|
/** App-wide dialog defaults, passed to `provideWr(withDialog(...))`. */
|
|
182
220
|
type WrDialogDefaults = Pick<WrDialogOptions, 'tabTitle'>;
|
|
@@ -212,6 +250,7 @@ export declare class WrDialog {
|
|
|
212
250
|
private readonly location;
|
|
213
251
|
private readonly destroyRef;
|
|
214
252
|
private readonly defaults;
|
|
253
|
+
private readonly order;
|
|
215
254
|
open<C, R = unknown, D = unknown>(component: ComponentType<C>, options?: WrDialogOptions<D>): WrDialogRef<C, R>;
|
|
216
255
|
/**
|
|
217
256
|
* Ask a yes-or-no question and get the answer: `true` only when the user
|
|
@@ -227,6 +266,10 @@ export declare class WrDialog {
|
|
|
227
266
|
* is on the confirm button. Focus returns to the opener on close, as it does
|
|
228
267
|
* for `open()`.
|
|
229
268
|
*
|
|
269
|
+
* `intent` puts an icon before the title, and `danger` or `warning` color the
|
|
270
|
+
* confirm button unless `confirmColor` is set, so a `danger` question also
|
|
271
|
+
* starts on the cancel button.
|
|
272
|
+
*
|
|
230
273
|
* On the server nothing can answer, so it resolves `false` at once and opens
|
|
231
274
|
* nothing.
|
|
232
275
|
*
|
|
@@ -236,12 +279,37 @@ export declare class WrDialog {
|
|
|
236
279
|
* title: 'Delete this item?',
|
|
237
280
|
* message: 'This cannot be undone.',
|
|
238
281
|
* confirmLabel: 'Delete',
|
|
239
|
-
*
|
|
282
|
+
* intent: 'danger',
|
|
240
283
|
* });
|
|
241
284
|
* if (ok) remove();
|
|
242
285
|
* ```
|
|
243
286
|
*/
|
|
244
287
|
confirm(options: WrDialogConfirmOptions): Promise<boolean>;
|
|
288
|
+
/**
|
|
289
|
+
* Show a message with one button and wait until the user has dismissed it.
|
|
290
|
+
* The button, Escape, the backdrop, a navigation and the application being
|
|
291
|
+
* torn down all resolve the promise, which settles exactly once with no
|
|
292
|
+
* value and never rejects.
|
|
293
|
+
*
|
|
294
|
+
* The dialog is `confirm()`'s with one button: `role="alertdialog"` for every
|
|
295
|
+
* intent, named by `title` and described by `message`, with no corner
|
|
296
|
+
* dismiss. The button takes the initial focus and its label falls back to the
|
|
297
|
+
* `common.ok` catalog key. `intent` puts an icon before the title.
|
|
298
|
+
*
|
|
299
|
+
* On the server it resolves at once and opens nothing.
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```ts
|
|
303
|
+
* await dialog.alert({
|
|
304
|
+
* title: 'Range too large',
|
|
305
|
+
* message: 'Pick at most 31 days to export.',
|
|
306
|
+
* okLabel: 'Close',
|
|
307
|
+
* intent: 'danger',
|
|
308
|
+
* });
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
alert(options: WrDialogAlertOptions): Promise<void>;
|
|
312
|
+
private ask;
|
|
245
313
|
/**
|
|
246
314
|
* Tie the dialog's lifetime to the URL it was opened on.
|
|
247
315
|
*
|
|
@@ -460,4 +528,4 @@ export declare class WrDialogClose<R = unknown> {
|
|
|
460
528
|
};
|
|
461
529
|
}, {}, never, never, true, never>;
|
|
462
530
|
}
|
|
463
|
-
export type { WrDialogConfirmOptions, WrDialogDefaults, WrDialogOptions, WrDialogRole };
|
|
531
|
+
export type { WrDialogAlertOptions, WrDialogConfirmOptions, WrDialogDefaults, WrDialogIntent, WrDialogMessageOptions, WrDialogOptions, WrDialogRole };
|