ngwr 16.0.0 → 16.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +95 -3
- package/date-stamp/styles/_index.scss +38 -0
- package/dialog/styles/_index.scss +38 -0
- package/dropdown/styles/_index.scss +37 -1
- 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-testing.mjs +18 -0
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +238 -38
- 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 +213 -0
- package/fesm2022/ngwr-date-stamp.mjs.map +1 -0
- package/fesm2022/ngwr-date.mjs +364 -54
- 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-testing.mjs +38 -3
- package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +362 -26
- 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 +9 -2
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +9 -2
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +9 -2
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +9 -2
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +9 -2
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +9 -2
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +9 -2
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +9 -2
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +9 -2
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +9 -2
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +9 -2
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +9 -2
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +9 -2
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +9 -2
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +9 -2
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +9 -2
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +9 -2
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +9 -2
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +9 -2
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +9 -2
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +9 -2
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +9 -2
- 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-testing.mjs +26 -0
- package/fesm2022/ngwr-lightbox-testing.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +255 -15
- 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 +47 -9
- 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-schema-form.mjs +3 -0
- package/fesm2022/ngwr-schema-form.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-testing.mjs +17 -0
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +91 -13
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list-testing.mjs +103 -0
- package/fesm2022/ngwr-sortable-list-testing.mjs.map +1 -0
- package/fesm2022/ngwr-sortable-list.mjs +257 -53
- package/fesm2022/ngwr-sortable-list.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 +13 -2
- package/i18n/cs.json +13 -2
- package/i18n/de.json +13 -2
- package/i18n/en.json +13 -2
- package/i18n/es.json +13 -2
- package/i18n/fr.json +13 -2
- package/i18n/he.json +13 -2
- package/i18n/hi.json +13 -2
- package/i18n/id.json +13 -2
- package/i18n/it.json +13 -2
- package/i18n/ja.json +13 -2
- package/i18n/ko.json +13 -2
- package/i18n/nl.json +13 -2
- package/i18n/pl.json +13 -2
- package/i18n/pt.json +13 -2
- package/i18n/ru.json +13 -2
- package/i18n/sv.json +13 -2
- package/i18n/tr.json +13 -2
- package/i18n/uk.json +13 -2
- package/i18n/vi.json +13 -2
- package/i18n/zh-TW.json +13 -2
- package/i18n/zh.json +13 -2
- package/input/styles/_index.scss +10 -5
- package/input-number/styles/_index.scss +6 -3
- package/input-otp/styles/_index.scss +4 -2
- package/lightbox/styles/_rules.scss +96 -0
- package/llms-full.txt +40 -17
- package/llms.txt +20 -4
- package/package.json +19 -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 +5 -0
- package/select/styles/_index.scss +6 -3
- package/skills/ngwr/SKILL.md +1 -1
- package/skills/ngwr/references/catalog.md +6 -2
- package/skills/ngwr/references/setup.md +3 -0
- package/slider/styles/_index.scss +106 -0
- package/sortable-list/styles/_rules.scss +23 -1
- 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-testing.d.ts +17 -0
- package/types/ngwr-date-picker.d.ts +88 -4
- package/types/ngwr-date-stamp-testing.d.ts +47 -0
- package/types/ngwr-date-stamp.d.ts +127 -0
- package/types/ngwr-date.d.ts +251 -37
- 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-dropdown-testing.d.ts +53 -5
- package/types/ngwr-dropdown.d.ts +100 -0
- package/types/ngwr-i18n.d.ts +44 -14
- package/types/ngwr-lightbox-testing.d.ts +27 -0
- package/types/ngwr-lightbox.d.ts +71 -6
- package/types/ngwr-overlay.d.ts +36 -0
- package/types/ngwr-pipes.d.ts +48 -13
- package/types/ngwr-popover.d.ts +39 -1
- package/types/ngwr-resizable.d.ts +228 -0
- package/types/ngwr-slider-testing.d.ts +8 -1
- package/types/ngwr-slider.d.ts +89 -3
- package/types/ngwr-sortable-list-testing.d.ts +79 -0
- package/types/ngwr-sortable-list.d.ts +113 -10
- 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-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
|
|
@@ -24,6 +24,54 @@ import { WrFeature } from "ngwr/utils";
|
|
|
24
24
|
* implementation for the supported tokens (`yyyy`, `MM`, `dd`, `HH`, …).
|
|
25
25
|
*/
|
|
26
26
|
type WrDateFormat = 'shortDate' | 'mediumDate' | 'longDate' | 'time' | 'time12h' | 'time24h' | 'timeSeconds' | 'time12hSeconds' | 'time24hSeconds' | 'shortDateTime' | 'shortDateTime12h' | 'shortDateTime24h' | 'shortDateTimeSeconds' | 'shortDateTime12hSeconds' | 'shortDateTime24hSeconds' | 'mediumDateTime';
|
|
27
|
+
/**
|
|
28
|
+
* What a number counts since the epoch: milliseconds, microseconds or seconds.
|
|
29
|
+
*
|
|
30
|
+
* `'auto'` decides by magnitude: under `1e10` it is seconds, under `1e13`
|
|
31
|
+
* milliseconds, and microseconds from there. `1e10` seconds and `1e13`
|
|
32
|
+
* milliseconds are both 20 November 2286, and `1e10` milliseconds and `1e13`
|
|
33
|
+
* microseconds are both 26 April 1970, so a date between those two reads the
|
|
34
|
+
* same in every unit. Outside them `'auto'` guesses wrong: name the unit.
|
|
35
|
+
*/
|
|
36
|
+
type WrEpochUnit = 'ms' | 'us' | 's' | 'auto';
|
|
37
|
+
/**
|
|
38
|
+
* The zone a date-time string with no offset (`2026-11-12 13:45:00`) was
|
|
39
|
+
* written in: the display zone of `withDates({ timeZone })`, the browser's, or
|
|
40
|
+
* UTC.
|
|
41
|
+
*/
|
|
42
|
+
type WrZonelessIn = 'display' | 'browser' | 'utc';
|
|
43
|
+
/** How `wrParseDate` reads a value. Every key is optional and defaults to what 16.1 did. */
|
|
44
|
+
interface WrParseDateOptions {
|
|
45
|
+
/**
|
|
46
|
+
* The unit of a number.
|
|
47
|
+
*
|
|
48
|
+
* @default 'ms'
|
|
49
|
+
*/
|
|
50
|
+
readonly epochUnit?: WrEpochUnit;
|
|
51
|
+
/**
|
|
52
|
+
* The zone of a date-time string with no offset. A string with `Z` or an
|
|
53
|
+
* offset, and a date-only string, are not affected.
|
|
54
|
+
*
|
|
55
|
+
* @default 'browser'
|
|
56
|
+
*/
|
|
57
|
+
readonly zonelessIn?: WrZonelessIn;
|
|
58
|
+
/**
|
|
59
|
+
* The display zone `zonelessIn: 'display'` reads in: an IANA name or an
|
|
60
|
+
* offset. `null`, `undefined` and a zone no engine knows are the browser's.
|
|
61
|
+
*/
|
|
62
|
+
readonly timeZone?: string | null;
|
|
63
|
+
}
|
|
64
|
+
/** App-wide defaults of `wr-date-stamp`. The component's own inputs win. */
|
|
65
|
+
interface WrDateStampDefaults {
|
|
66
|
+
/** Format of the date line. Default: `'mediumDate'`. */
|
|
67
|
+
readonly dateFormat?: WrDateFormat | (string & {});
|
|
68
|
+
/** Format of the time line. Default: `'time'`. */
|
|
69
|
+
readonly timeFormat?: WrDateFormat | (string & {});
|
|
70
|
+
/** Show the time alone for a value from today. Default: `false`. */
|
|
71
|
+
readonly todayTimeOnly?: boolean;
|
|
72
|
+
/** Write the seconds in the time line. Default: `false`. */
|
|
73
|
+
readonly seconds?: boolean;
|
|
74
|
+
}
|
|
27
75
|
/**
|
|
28
76
|
* Options for `withDates()`.
|
|
29
77
|
*/
|
|
@@ -46,6 +94,49 @@ interface WrDatesOptions {
|
|
|
46
94
|
* browser happens to be.
|
|
47
95
|
*/
|
|
48
96
|
readonly locale?: string;
|
|
97
|
+
/**
|
|
98
|
+
* The time zone dates are SHOWN in: an IANA name (`'Asia/Almaty'`), an offset
|
|
99
|
+
* (`'+05:00'`, `'+05:30'`), or a function returning one. The function runs in
|
|
100
|
+
* an injection context, so it may `inject()` the service that holds the
|
|
101
|
+
* value, and a signal is such a function: a zone that arrives from a runtime
|
|
102
|
+
* config after bootstrap repaints what is on screen. Default, and for `null`
|
|
103
|
+
* or `undefined`: the browser's zone.
|
|
104
|
+
*
|
|
105
|
+
* Display only. A `Date` stays the instant it is, and so does a picker's
|
|
106
|
+
* `value`. `wrDate`, `wrFormatDate` and `wr-date-stamp` print an instant on
|
|
107
|
+
* this zone's wall clock; `wr-date-picker` in `time` and `datetime` mode shows
|
|
108
|
+
* and reads its field and panel on it; the calendar marks this zone's today.
|
|
109
|
+
* A date-only value is a calendar day and does not shift: `mode="date"` and a
|
|
110
|
+
* `'2026-11-12'` string are the 12th in every zone.
|
|
111
|
+
*
|
|
112
|
+
* A value no engine knows falls back to the browser's zone and warns once in
|
|
113
|
+
* dev mode.
|
|
114
|
+
*/
|
|
115
|
+
readonly timeZone?: string | (() => string | null | undefined);
|
|
116
|
+
/**
|
|
117
|
+
* What a NUMBER counts since the epoch, for `wrDate`, `wrFormatDate` and
|
|
118
|
+
* `wr-date-stamp`: `'ms'`, `'us'` (microseconds, sixteen digits today), `'s'`,
|
|
119
|
+
* or `'auto'`, which decides by magnitude, see {@link WrEpochUnit}.
|
|
120
|
+
*
|
|
121
|
+
* @default 'ms'
|
|
122
|
+
*/
|
|
123
|
+
readonly epochUnit?: WrEpochUnit;
|
|
124
|
+
/**
|
|
125
|
+
* The zone a date-time string with NO offset (`'2026-11-12 13:45:00'`) is
|
|
126
|
+
* read in, for `wrDate`, `wrFormatDate` and `wr-date-stamp`. `'display'`
|
|
127
|
+
* reads it as a wall clock of `timeZone`, so it prints unchanged; `'utc'`
|
|
128
|
+
* reads it as UTC; `'browser'` as the browser's local time. A string with
|
|
129
|
+
* `Z` or an offset is the instant it names, and a date-only string stays a
|
|
130
|
+
* day, whatever this says.
|
|
131
|
+
*
|
|
132
|
+
* @default 'browser'
|
|
133
|
+
*/
|
|
134
|
+
readonly zonelessIn?: WrZonelessIn;
|
|
135
|
+
/**
|
|
136
|
+
* App-wide defaults of `wr-date-stamp`: `dateFormat`, `timeFormat`,
|
|
137
|
+
* `todayTimeOnly` and `seconds`. An input set on a stamp wins.
|
|
138
|
+
*/
|
|
139
|
+
readonly stamp?: WrDateStampDefaults;
|
|
49
140
|
}
|
|
50
141
|
/** Whether `value` is one of the shared named format keys. */
|
|
51
142
|
declare function wrIsNamedFormat(value: string): value is WrDateFormat;
|
|
@@ -55,7 +146,7 @@ declare function wrIsNamedFormat(value: string): value is WrDateFormat;
|
|
|
55
146
|
* changing component code.
|
|
56
147
|
*
|
|
57
148
|
* Injected with nothing provided it is {@link WrNativeDateAdapter} (native
|
|
58
|
-
* `Date`, `Intl.DateTimeFormat`, the locale from {@link
|
|
149
|
+
* `Date`, `Intl.DateTimeFormat`, the locale from {@link wrDateLocale}), so the
|
|
59
150
|
* date components need no provider. For another library, subclass this,
|
|
60
151
|
* decorate the subclass with `@Service()` and register it via
|
|
61
152
|
* `provideWr(withDates({ adapter: MyAdapter }))`. An undecorated subclass still
|
|
@@ -114,7 +205,8 @@ export declare abstract class WrDateAdapter<TDate = Date> {
|
|
|
114
205
|
* adapter that treats one as a raw pattern prints its letters into the field.
|
|
115
206
|
* v15 added them; an adapter written for v14 has to handle them.
|
|
116
207
|
*
|
|
117
|
-
* Supported tokens for raw strings: `yyyy`, `yy`, `
|
|
208
|
+
* Supported tokens for raw strings: `yyyy`, `yy`, `y` (the full year, as
|
|
209
|
+
* `DatePipe` reads it: `d MMM y`), `MMMM`, `MMM`, `MM`, `M`,
|
|
118
210
|
* `dd`, `d`, `HH`, `H`, `hh`, `h`, `mm`, `ss`, `a` (the locale's day-period
|
|
119
211
|
* marker — `PM`, `م`, `午後`).
|
|
120
212
|
*
|
|
@@ -135,6 +227,34 @@ export declare abstract class WrDateAdapter<TDate = Date> {
|
|
|
135
227
|
* exactly as it was.
|
|
136
228
|
*/
|
|
137
229
|
abstract parse(value: string, formatKeyOrString: WrDateFormat | (string & {})): TDate | null;
|
|
230
|
+
/**
|
|
231
|
+
* This adapter for instants: every accessor, `createDate`, the math, `format`
|
|
232
|
+
* and `parse` read a date on the wall clock of the display time zone
|
|
233
|
+
* (`withDates({ timeZone })`) instead of the browser's. The adapter itself
|
|
234
|
+
* keeps reading the browser's zone, because a calendar day has no zone: the
|
|
235
|
+
* 12th picked in a date-only field is the 12th wherever it is shown.
|
|
236
|
+
*
|
|
237
|
+
* `wrDate`, `wr-date-stamp` and the pickers' modes with a time ask for it.
|
|
238
|
+
* The base class returns itself, so an adapter that does not override this
|
|
239
|
+
* shows every date in the browser's zone.
|
|
240
|
+
*/
|
|
241
|
+
zoned(): WrDateAdapter<TDate>;
|
|
242
|
+
/**
|
|
243
|
+
* What `format` writes in besides its arguments, as one string: the locale,
|
|
244
|
+
* and the time zone on the {@link zoned} adapter. Equal keys mean equal
|
|
245
|
+
* output, so a caller that keeps a formatted string compares keys instead of
|
|
246
|
+
* formatting again. The native adapter reads its signals here: called in a
|
|
247
|
+
* template, a `computed` or an `effect`, it re-runs them when either moves.
|
|
248
|
+
*/
|
|
249
|
+
displayKey(): string;
|
|
250
|
+
/**
|
|
251
|
+
* How `wrDate`, `wrFormatDate` and `wr-date-stamp` read a backend value
|
|
252
|
+
* before this adapter formats it: the `epochUnit` and `zonelessIn` of
|
|
253
|
+
* `withDates()`, and the display zone. The base class returns nothing, which
|
|
254
|
+
* is epoch milliseconds and the browser's zone; an adapter of your own
|
|
255
|
+
* returns `inject(WR_DATE_INPUT)` and its zone to honour the options.
|
|
256
|
+
*/
|
|
257
|
+
parseOptions(): WrParseDateOptions;
|
|
138
258
|
/** `0` Sunday, `1` Monday — locale-dependent. */
|
|
139
259
|
abstract getFirstDayOfWeek(): number;
|
|
140
260
|
/** Names ordered from `getFirstDayOfWeek()` onwards. Length 7. */
|
|
@@ -152,7 +272,40 @@ export declare abstract class WrDateAdapter<TDate = Date> {
|
|
|
152
272
|
* {@link WrDateAdapter} over its own date library instead.
|
|
153
273
|
*/
|
|
154
274
|
export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
155
|
-
private readonly
|
|
275
|
+
private readonly localeSource;
|
|
276
|
+
private cache;
|
|
277
|
+
/**
|
|
278
|
+
* What is kept for the current locale, and the locale with it. A signal read,
|
|
279
|
+
* so what formats in a reactive context follows a language switch; the switch
|
|
280
|
+
* drops everything kept for the locale before it.
|
|
281
|
+
*/
|
|
282
|
+
private caches;
|
|
283
|
+
private get locale();
|
|
284
|
+
private readonly zoneSource;
|
|
285
|
+
private readonly injector;
|
|
286
|
+
/** Whether this instance is the one {@link zoned} hands out. */
|
|
287
|
+
private zonal;
|
|
288
|
+
private zonedSelf;
|
|
289
|
+
/**
|
|
290
|
+
* A second instance of the same class, so an app's subclass keeps its
|
|
291
|
+
* overrides. With no `timeZone` option at all it is this instance.
|
|
292
|
+
*/
|
|
293
|
+
zoned(): WrDateAdapter<Date>;
|
|
294
|
+
displayKey(): string;
|
|
295
|
+
private readonly input;
|
|
296
|
+
parseOptions(): WrParseDateOptions;
|
|
297
|
+
private zone;
|
|
298
|
+
private wallZone;
|
|
299
|
+
private readonly walls;
|
|
300
|
+
/**
|
|
301
|
+
* The date on the display zone's wall clock, as a `Date` read with the UTC
|
|
302
|
+
* getters, or `null` on the adapter that reads the browser's zone. Reading a
|
|
303
|
+
* named zone costs an `Intl` call and a month grid asks for the same day many
|
|
304
|
+
* times over, so those are kept.
|
|
305
|
+
*/
|
|
306
|
+
private wall;
|
|
307
|
+
/** The instant a wall clock from {@link wall} names. */
|
|
308
|
+
private instant;
|
|
156
309
|
today(): Date;
|
|
157
310
|
clone(date: Date): Date;
|
|
158
311
|
createDate(year: number, month: number, day: number): Date;
|
|
@@ -197,11 +350,8 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
|
197
350
|
* Constructing one is the expensive part of `format()`, and this adapter is
|
|
198
351
|
* called per CELL: `wr-event-calendar` builds an `aria-label` for every time
|
|
199
352
|
* 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.
|
|
353
|
+
* formatters. They are kept per locale, in {@link caches}.
|
|
203
354
|
*/
|
|
204
|
-
private readonly formatters;
|
|
205
355
|
/**
|
|
206
356
|
* Every `Intl` call this adapter makes pins `calendar: 'gregory'`, and that is a
|
|
207
357
|
* correctness fix rather than a preference.
|
|
@@ -216,6 +366,7 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
|
216
366
|
* describe the same one.
|
|
217
367
|
*/
|
|
218
368
|
private intlOptions;
|
|
369
|
+
/** `utc` is the formatter a wall clock from {@link wall} is printed with. */
|
|
219
370
|
private intl;
|
|
220
371
|
getDayOfWeekNames(style: 'narrow' | 'short' | 'long'): readonly string[];
|
|
221
372
|
/**
|
|
@@ -224,10 +375,8 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
|
224
375
|
* the token formatter, and this method deliberately keeps the heading one.
|
|
225
376
|
*/
|
|
226
377
|
getMonthNames(style: 'narrow' | 'short' | 'long'): readonly string[];
|
|
227
|
-
private numeralsCache;
|
|
228
378
|
/** The locale's own ten digits, cached — empty when its system is algorithmic. */
|
|
229
379
|
private localeNumerals;
|
|
230
|
-
private dayPeriodCache;
|
|
231
380
|
/**
|
|
232
381
|
* `[am, pm]` as the LOCALE writes them — `PM`, `م`, `午後`.
|
|
233
382
|
*
|
|
@@ -239,7 +388,6 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
|
239
388
|
* there and passes a 24-hour pattern here.
|
|
240
389
|
*/
|
|
241
390
|
private dayPeriods;
|
|
242
|
-
private readonly monthNameCache;
|
|
243
391
|
/**
|
|
244
392
|
* `context: 'format'` asks `Intl` for the month name as it appears BESIDE A DAY, which
|
|
245
393
|
* is where a case language stops using the nominative: ru writes `15 марта`, not
|
|
@@ -277,7 +425,6 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
|
277
425
|
private namedMonthNames;
|
|
278
426
|
/** `[am, pm]` as THIS formatter writes them — `ص` / `م` in Arabic, not AM / PM. */
|
|
279
427
|
private dayPeriodNames;
|
|
280
|
-
private readonly namedParsers;
|
|
281
428
|
private parseNamed;
|
|
282
429
|
/**
|
|
283
430
|
* Assemble whatever was read into a `Date`, or refuse.
|
|
@@ -298,6 +445,14 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
|
298
445
|
* Use of this source code is governed by an MIT-style license that can be
|
|
299
446
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
300
447
|
*/
|
|
448
|
+
/**
|
|
449
|
+
* Whether a value names a calendar day (`2026-01-01`, `2026-01`, `2026`) rather
|
|
450
|
+
* than an instant. Such a day is the same day in every time zone, so `wrDate`
|
|
451
|
+
* does not move it to the display zone.
|
|
452
|
+
*
|
|
453
|
+
* @internal
|
|
454
|
+
*/
|
|
455
|
+
export declare function wrIsDateOnly(value: unknown): boolean;
|
|
301
456
|
/**
|
|
302
457
|
* A string or a timestamp as a `Date`, with one exception to `new Date()`: a
|
|
303
458
|
* date-only ISO string names a calendar day, so it is read as that day's LOCAL
|
|
@@ -317,24 +472,24 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
|
|
|
317
472
|
* @internal
|
|
318
473
|
*/
|
|
319
474
|
export declare function wrToLocalDate(value: string | number): Date;
|
|
320
|
-
/**
|
|
321
|
-
* @license
|
|
322
|
-
*
|
|
323
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
324
|
-
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
325
|
-
*/
|
|
326
475
|
/**
|
|
327
476
|
* What a backend sends for a date, as a `Date`, or `null` when it holds none.
|
|
328
477
|
* Never an Invalid Date, so the result needs one check rather than two.
|
|
329
478
|
*
|
|
330
479
|
* - A `Date` comes back as it is, the same object; an Invalid Date gives `null`.
|
|
331
|
-
* - A number is epoch milliseconds
|
|
332
|
-
*
|
|
480
|
+
* - A number is epoch milliseconds, or what `epochUnit` says: `'s'`, `'us'`
|
|
481
|
+
* (microseconds), or `'auto'`, which reads a number under `1e10` as seconds,
|
|
482
|
+
* under `1e13` as milliseconds and anything larger as microseconds, right
|
|
483
|
+
* for a date from 26 April 1970 to 20 November 2286. `NaN`, an infinity and
|
|
484
|
+
* a number outside the range of `Date` give `null`.
|
|
333
485
|
* - `2026-03-01 14:30:00`, a space where ISO 8601 has a `T`, is rewritten to the
|
|
334
486
|
* ISO form first. Chrome reads the space form and Safari gives an Invalid Date
|
|
335
487
|
* for it. Seconds, a fraction and a zone are optional; the fraction is cut to
|
|
336
488
|
* milliseconds and a zone of hours alone (`+05`, as PostgreSQL prints it) is
|
|
337
|
-
* completed. Without a zone it is local time, as the `T` form is
|
|
489
|
+
* completed. Without a zone it is local time, as the `T` form is, unless
|
|
490
|
+
* `zonelessIn` says otherwise: `'utc'` reads both forms as UTC, and
|
|
491
|
+
* `'display'` as a wall clock of the `timeZone` option, the browser's zone
|
|
492
|
+
* when there is none.
|
|
338
493
|
* - A date-only string (`2026-03-01`, `2026-03`, `2026`) is that day's LOCAL
|
|
339
494
|
* midnight, as `wrDate` and `WrValidators.minDate` read it. `new Date()` would
|
|
340
495
|
* make it UTC midnight, the evening before for a reader west of Greenwich.
|
|
@@ -344,7 +499,9 @@ export declare function wrToLocalDate(value: string | number): Date;
|
|
|
344
499
|
* refuses give `null`.
|
|
345
500
|
*
|
|
346
501
|
* Surrounding whitespace is ignored. A plain function: no adapter and no
|
|
347
|
-
* injection context, so it runs in a mapper, a resolver or a store.
|
|
502
|
+
* injection context, so it runs in a mapper, a resolver or a store. For the
|
|
503
|
+
* same reason it does not see `withDates()`: pass the options, or
|
|
504
|
+
* `inject(WrDateAdapter).parseOptions()` for the app's.
|
|
348
505
|
*
|
|
349
506
|
* @example
|
|
350
507
|
* ```ts
|
|
@@ -352,20 +509,47 @@ export declare function wrToLocalDate(value: string | number): Date;
|
|
|
352
509
|
* wrParseDate('2026-03-01'); // 1 March 2026, 00:00 local
|
|
353
510
|
* wrParseDate('2026-03-01T09:30:00+05:00'); // that instant
|
|
354
511
|
* wrParseDate(1772343000000); // epoch milliseconds
|
|
512
|
+
* wrParseDate(1772343000000123, { epochUnit: 'auto' }); // microseconds, by magnitude
|
|
513
|
+
* wrParseDate('2026-03-01 14:30:00', { zonelessIn: 'display', timeZone: '+0500' }); // 09:30 UTC
|
|
355
514
|
* wrParseDate('n/a'); // null
|
|
356
515
|
* ```
|
|
357
516
|
*
|
|
358
517
|
* @see https://ngwr.dev/reference/pipes/wr-date
|
|
359
518
|
*/
|
|
360
|
-
export declare function wrParseDate(value: Date | string | number | null | undefined): Date | null;
|
|
519
|
+
export declare function wrParseDate(value: Date | string | number | null | undefined, options?: WrParseDateOptions): Date | null;
|
|
361
520
|
/**
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
521
|
+
* The locale dates are written in, as a signal. Highest first:
|
|
522
|
+
*
|
|
523
|
+
* 1. `withDates({ locale })`: a pin, which a language switch does not move.
|
|
524
|
+
* 2. `WrI18n.locale()`, when the app calls `provideWrI18n()`: the interface
|
|
525
|
+
* language, which `WrI18n.use()` changes at runtime.
|
|
526
|
+
* 3. `LOCALE_ID`.
|
|
365
527
|
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
528
|
+
* A catalog name that is not a BCP 47 tag (`en_US`) cannot format a date, so
|
|
529
|
+
* the signal holds `LOCALE_ID` while the interface language is one.
|
|
530
|
+
*
|
|
531
|
+
* Must be called in an injection context. The native adapter formats in it; an
|
|
532
|
+
* adapter of your own reads it to follow the same rule.
|
|
533
|
+
*
|
|
534
|
+
* @example
|
|
535
|
+
* ```ts
|
|
536
|
+
* private readonly locale = wrDateLocale();
|
|
537
|
+
* protected readonly weekday = computed(() =>
|
|
538
|
+
* new Intl.DateTimeFormat(this.locale(), { weekday: 'long' }).format(this.date()),
|
|
539
|
+
* );
|
|
540
|
+
* ```
|
|
541
|
+
*/
|
|
542
|
+
export declare function wrDateLocale(): Signal<string>;
|
|
543
|
+
/**
|
|
544
|
+
* Replace the date adapter the calendar / date picker / time picker use, pin
|
|
545
|
+
* the locale it formats in, set the time zone dates are shown in, say how a
|
|
546
|
+
* backend's numbers and zoneless strings are read (`epochUnit`, `zonelessIn`),
|
|
547
|
+
* or set the defaults of `wr-date-stamp`, as a feature of `provideWr()`. Optional: with no call at all they run on
|
|
548
|
+
* {@link WrNativeDateAdapter} in Angular's `LOCALE_ID` and the browser's zone.
|
|
549
|
+
*
|
|
550
|
+
* Omit `locale` and dates follow the interface language of `provideWrI18n()`,
|
|
551
|
+
* `WrI18n.use()` included, and Angular's `LOCALE_ID` in an app without it.
|
|
552
|
+
* Pass one only to pin dates to something else, see {@link wrDateLocale}.
|
|
369
553
|
*
|
|
370
554
|
* The one feature that works in a route's `providers` as well: that subtree
|
|
371
555
|
* gets an adapter of its own.
|
|
@@ -379,15 +563,16 @@ export declare function wrParseDate(value: Date | string | number | null | undef
|
|
|
379
563
|
* providers: [
|
|
380
564
|
* provideWr(withDates({ locale: 'ru-RU' })), // pin the dates
|
|
381
565
|
* // provideWr(withDates({ adapter: MyDateAdapter, locale: 'fr' })), // your own subclass
|
|
566
|
+
* // provideWr(withDates({ timeZone: () => inject(AppConfig).timeZone() })), // a runtime config
|
|
382
567
|
* ],
|
|
383
568
|
* });
|
|
384
569
|
* ```
|
|
385
570
|
*/
|
|
386
571
|
export declare function withDates(options?: WrDatesOptions): WrFeature<'dates'>;
|
|
387
572
|
/**
|
|
388
|
-
* BCP 47 locale tag
|
|
389
|
-
*
|
|
390
|
-
* `
|
|
573
|
+
* The BCP 47 locale tag `withDates({ locale })` pinned, and Angular's
|
|
574
|
+
* `LOCALE_ID` when nothing was. An adapter reads {@link wrDateLocale} instead,
|
|
575
|
+
* which puts the interface language of `provideWrI18n()` between the two.
|
|
391
576
|
*
|
|
392
577
|
* **It used to default to `navigator.language`, and that was wrong in the
|
|
393
578
|
* documented case.** The provider's own first example was the no-argument call,
|
|
@@ -401,10 +586,10 @@ export declare function withDates(options?: WrDatesOptions): WrFeature<'dates'>;
|
|
|
401
586
|
* to match. An app that genuinely wants the browser's tag can still say so:
|
|
402
587
|
* `provideWr(withDates({ locale: navigator.language }))`.
|
|
403
588
|
*
|
|
404
|
-
* The token is a plain string, resolved once
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
* the
|
|
589
|
+
* The token is a plain string, resolved once: the *pinned* date locale, not a
|
|
590
|
+
* live one. `WrI18n.use()` cannot move it, and moves dates only when nothing
|
|
591
|
+
* was pinned. Provide it through `withDates({ locale })`: a bare provider of
|
|
592
|
+
* this token is read as the fallback, not as a pin.
|
|
408
593
|
*
|
|
409
594
|
* **How far it reaches is up to the adapter.** The native one threads it through
|
|
410
595
|
* everything. A subclass over a library that resolves its patterns against a
|
|
@@ -413,4 +598,33 @@ export declare function withDates(options?: WrDatesOptions): WrFeature<'dates'>;
|
|
|
413
598
|
* through `Intl`, localize and the field's own text does not.
|
|
414
599
|
*/
|
|
415
600
|
export declare const WR_DATE_LOCALE: InjectionToken<string>;
|
|
416
|
-
|
|
601
|
+
/**
|
|
602
|
+
* The display time zone the {@link WrDateAdapter} implementations read, as a
|
|
603
|
+
* function: an IANA name (`'Asia/Almaty'`) or an offset (`'+05:00'`), and
|
|
604
|
+
* `null` or `undefined` for the browser's own zone. `null` when
|
|
605
|
+
* `withDates({ timeZone })` was not called, which is the browser's zone too.
|
|
606
|
+
*
|
|
607
|
+
* A function rather than a string because the zone often arrives after
|
|
608
|
+
* bootstrap, from a runtime config. The native adapter calls it on every read,
|
|
609
|
+
* so what it formats follows the signals the function reads.
|
|
610
|
+
*
|
|
611
|
+
* Set it with the `timeZone` option of `provideWr(withDates(...))`. An adapter
|
|
612
|
+
* of your own injects it to honour the same option.
|
|
613
|
+
*/
|
|
614
|
+
export declare const WR_DATE_TIME_ZONE: InjectionToken<(() => string | null | undefined) | null>;
|
|
615
|
+
/**
|
|
616
|
+
* How the native adapter reads a backend value before it formats it: the
|
|
617
|
+
* `epochUnit` and `zonelessIn` options of `withDates()`. An adapter of your own
|
|
618
|
+
* injects it and returns it from `parseOptions()` to honour the same options.
|
|
619
|
+
*/
|
|
620
|
+
export declare const WR_DATE_INPUT: InjectionToken<{
|
|
621
|
+
readonly epochUnit: WrEpochUnit;
|
|
622
|
+
readonly zonelessIn: WrZonelessIn;
|
|
623
|
+
}>;
|
|
624
|
+
/**
|
|
625
|
+
* The app-wide defaults of `wr-date-stamp`: the `stamp` option of
|
|
626
|
+
* `withDates()`. It lives here rather than in `ngwr/date-stamp` so that
|
|
627
|
+
* `withDates()` does not import a component.
|
|
628
|
+
*/
|
|
629
|
+
export declare const WR_DATE_STAMP_DEFAULTS: InjectionToken<WrDateStampDefaults>;
|
|
630
|
+
export { type WrDateFormat, type WrDateStampDefaults, type WrDatesOptions, type WrEpochUnit, type WrParseDateOptions, type WrZonelessIn, 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 };
|
|
@@ -97,26 +97,51 @@ export declare class WrClickOutside {
|
|
|
97
97
|
* `<textarea>` + `document.execCommand('copy')` fallback for older browsers
|
|
98
98
|
* and non-secure contexts.
|
|
99
99
|
*
|
|
100
|
+
* After a successful copy the host carries `wr-copy-to-clipboard--copied` for
|
|
101
|
+
* a moment, a tooltip over it reads "Copied" and the same text is announced
|
|
102
|
+
* politely. `wrCopyToClipboardToast` shows a toast instead of the tooltip and
|
|
103
|
+
* the announcement. A refused write changes nothing and emits `copyFailed`.
|
|
104
|
+
*
|
|
100
105
|
* @example
|
|
101
106
|
* ```html
|
|
102
|
-
* <button [wrCopyToClipboard]="value"
|
|
107
|
+
* <button [wrCopyToClipboard]="value">Copy</button>
|
|
108
|
+
* <button [wrCopyToClipboard]="rows" wrCopyToClipboardToast copiedLabel="Copied to clipboard">Copy all</button>
|
|
103
109
|
* ```
|
|
104
110
|
*/
|
|
105
111
|
export declare class WrCopyToClipboard {
|
|
112
|
+
constructor();
|
|
106
113
|
/** The text to copy. */
|
|
107
114
|
readonly wrCopyToClipboard: import("@angular/core").InputSignal<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Confirm a copy with a toast instead of the tooltip and the announcement.
|
|
117
|
+
*
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
120
|
+
readonly wrCopyToClipboardToast: import("@angular/core").InputSignalWithTransform<boolean, any>;
|
|
121
|
+
/** Text of the tooltip, the announcement and the toast. Falls back to `copyToClipboard.copied`, then `'Copied'`. */
|
|
122
|
+
readonly copiedLabel: import("@angular/core").InputSignal<string | null>;
|
|
108
123
|
/** Emitted with the copied text once the write succeeds. */
|
|
109
124
|
readonly copied: import("@angular/core").OutputEmitterRef<string>;
|
|
110
125
|
/** Emitted if the copy fails (denied permission, no clipboard, …). */
|
|
111
126
|
readonly copyFailed: import("@angular/core").OutputEmitterRef<unknown>;
|
|
127
|
+
/** True for a moment after a successful copy. */
|
|
128
|
+
protected readonly justCopied: import("@angular/core").WritableSignal<boolean>;
|
|
129
|
+
private readonly resolvedCopiedLabel;
|
|
112
130
|
private readonly focusMonitor;
|
|
113
131
|
private readonly doc;
|
|
132
|
+
private readonly injector;
|
|
133
|
+
private readonly tooltip;
|
|
134
|
+
private readonly hostPopover;
|
|
135
|
+
private destroyed;
|
|
136
|
+
private timer;
|
|
114
137
|
/**
|
|
115
138
|
* Copies the bound text, as a click does: `(copied)` or `(copyFailed)` fires
|
|
116
139
|
* either way. Resolves `true` once the text is on the clipboard and `false`
|
|
117
140
|
* when neither path could write it. It never rejects.
|
|
118
141
|
*/
|
|
119
142
|
copy(): Promise<boolean>;
|
|
143
|
+
private confirm;
|
|
144
|
+
private clearTimer;
|
|
120
145
|
/**
|
|
121
146
|
* Legacy clipboard write — hidden textarea + `execCommand('copy')`.
|
|
122
147
|
*
|
|
@@ -135,6 +160,16 @@ export declare class WrCopyToClipboard {
|
|
|
135
160
|
"required": true;
|
|
136
161
|
"isSignal": true;
|
|
137
162
|
};
|
|
163
|
+
"wrCopyToClipboardToast": {
|
|
164
|
+
"alias": "wrCopyToClipboardToast";
|
|
165
|
+
"required": false;
|
|
166
|
+
"isSignal": true;
|
|
167
|
+
};
|
|
168
|
+
"copiedLabel": {
|
|
169
|
+
"alias": "copiedLabel";
|
|
170
|
+
"required": false;
|
|
171
|
+
"isSignal": true;
|
|
172
|
+
};
|
|
138
173
|
}, {
|
|
139
174
|
"copied": "copied";
|
|
140
175
|
"copyFailed": "copyFailed";
|