ngwr 16.1.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.
Files changed (123) hide show
  1. package/date-picker/styles/_index.scss +89 -1
  2. package/dropdown/styles/_index.scss +37 -1
  3. package/fesm2022/ngwr-date-picker-testing.mjs +18 -0
  4. package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
  5. package/fesm2022/ngwr-date-picker.mjs +152 -8
  6. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  7. package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -1
  8. package/fesm2022/ngwr-date-stamp.mjs +73 -9
  9. package/fesm2022/ngwr-date-stamp.mjs.map +1 -1
  10. package/fesm2022/ngwr-date.mjs +86 -5
  11. package/fesm2022/ngwr-date.mjs.map +1 -1
  12. package/fesm2022/ngwr-dropdown-testing.mjs +38 -3
  13. package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
  14. package/fesm2022/ngwr-dropdown.mjs +358 -24
  15. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  16. package/fesm2022/ngwr-i18n-ar.mjs +7 -2
  17. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  18. package/fesm2022/ngwr-i18n-cs.mjs +7 -2
  19. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  20. package/fesm2022/ngwr-i18n-de.mjs +7 -2
  21. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  22. package/fesm2022/ngwr-i18n-en.mjs +7 -2
  23. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  24. package/fesm2022/ngwr-i18n-es.mjs +7 -2
  25. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  26. package/fesm2022/ngwr-i18n-fr.mjs +7 -2
  27. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  28. package/fesm2022/ngwr-i18n-he.mjs +7 -2
  29. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  30. package/fesm2022/ngwr-i18n-hi.mjs +7 -2
  31. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  32. package/fesm2022/ngwr-i18n-id.mjs +7 -2
  33. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  34. package/fesm2022/ngwr-i18n-it.mjs +7 -2
  35. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  36. package/fesm2022/ngwr-i18n-ja.mjs +7 -2
  37. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  38. package/fesm2022/ngwr-i18n-ko.mjs +7 -2
  39. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  40. package/fesm2022/ngwr-i18n-nl.mjs +7 -2
  41. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  42. package/fesm2022/ngwr-i18n-pl.mjs +7 -2
  43. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  44. package/fesm2022/ngwr-i18n-pt.mjs +7 -2
  45. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  46. package/fesm2022/ngwr-i18n-ru.mjs +7 -2
  47. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  48. package/fesm2022/ngwr-i18n-sv.mjs +7 -2
  49. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  50. package/fesm2022/ngwr-i18n-tr.mjs +7 -2
  51. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  52. package/fesm2022/ngwr-i18n-uk.mjs +7 -2
  53. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  54. package/fesm2022/ngwr-i18n-vi.mjs +7 -2
  55. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  56. package/fesm2022/ngwr-i18n-zh-tw.mjs +7 -2
  57. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  58. package/fesm2022/ngwr-i18n-zh.mjs +7 -2
  59. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  60. package/fesm2022/ngwr-lightbox-testing.mjs +26 -0
  61. package/fesm2022/ngwr-lightbox-testing.mjs.map +1 -1
  62. package/fesm2022/ngwr-lightbox.mjs +246 -10
  63. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  64. package/fesm2022/ngwr-pipes.mjs +28 -6
  65. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  66. package/fesm2022/ngwr-schema-form.mjs +3 -0
  67. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  68. package/fesm2022/ngwr-slider-testing.mjs +17 -0
  69. package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
  70. package/fesm2022/ngwr-slider.mjs +87 -11
  71. package/fesm2022/ngwr-slider.mjs.map +1 -1
  72. package/fesm2022/ngwr-sortable-list-testing.mjs +103 -0
  73. package/fesm2022/ngwr-sortable-list-testing.mjs.map +1 -0
  74. package/fesm2022/ngwr-sortable-list.mjs +257 -53
  75. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  76. package/fesm2022/ngwr-version.mjs +1 -1
  77. package/fesm2022/ngwr-version.mjs.map +1 -1
  78. package/i18n/ar.json +7 -2
  79. package/i18n/cs.json +7 -2
  80. package/i18n/de.json +7 -2
  81. package/i18n/en.json +7 -2
  82. package/i18n/es.json +7 -2
  83. package/i18n/fr.json +7 -2
  84. package/i18n/he.json +7 -2
  85. package/i18n/hi.json +7 -2
  86. package/i18n/id.json +7 -2
  87. package/i18n/it.json +7 -2
  88. package/i18n/ja.json +7 -2
  89. package/i18n/ko.json +7 -2
  90. package/i18n/nl.json +7 -2
  91. package/i18n/pl.json +7 -2
  92. package/i18n/pt.json +7 -2
  93. package/i18n/ru.json +7 -2
  94. package/i18n/sv.json +7 -2
  95. package/i18n/tr.json +7 -2
  96. package/i18n/uk.json +7 -2
  97. package/i18n/vi.json +7 -2
  98. package/i18n/zh-TW.json +7 -2
  99. package/i18n/zh.json +7 -2
  100. package/lightbox/styles/_rules.scss +96 -0
  101. package/llms-full.txt +12 -8
  102. package/llms.txt +12 -0
  103. package/package.json +5 -1
  104. package/schematics/use/symbol-map.json +1 -0
  105. package/skills/ngwr/SKILL.md +1 -1
  106. package/skills/ngwr/references/catalog.md +2 -1
  107. package/slider/styles/_index.scss +106 -0
  108. package/sortable-list/styles/_rules.scss +23 -1
  109. package/types/ngwr-date-picker-testing.d.ts +17 -0
  110. package/types/ngwr-date-picker.d.ts +79 -2
  111. package/types/ngwr-date-stamp-testing.d.ts +1 -1
  112. package/types/ngwr-date-stamp.d.ts +53 -7
  113. package/types/ngwr-date.d.ts +118 -15
  114. package/types/ngwr-dropdown-testing.d.ts +53 -5
  115. package/types/ngwr-dropdown.d.ts +100 -0
  116. package/types/ngwr-lightbox-testing.d.ts +27 -0
  117. package/types/ngwr-lightbox.d.ts +71 -6
  118. package/types/ngwr-pipes.d.ts +33 -13
  119. package/types/ngwr-slider-testing.d.ts +8 -1
  120. package/types/ngwr-slider.d.ts +89 -3
  121. package/types/ngwr-sortable-list-testing.d.ts +79 -0
  122. package/types/ngwr-sortable-list.d.ts +113 -10
  123. package/types/ngwr-version.d.ts +1 -1
@@ -2,7 +2,7 @@ import * as i0 from "@angular/core";
2
2
  import { ElementRef, Signal } from "@angular/core";
3
3
  import { WrClassInput } from "ngwr/utils";
4
4
  import { FormValueControl } from "@angular/forms/signals";
5
- import { WrDateFormat } from "ngwr/date";
5
+ import { WrDateAdapter, WrDateFormat } from "ngwr/date";
6
6
  /**
7
7
  * @license
8
8
  *
@@ -74,6 +74,38 @@ type WrDatePickerSize = 'sm' | 'md' | 'lg';
74
74
  * `WrCalendarRange`, which the picker forwards it to.
75
75
  */
76
76
  type WrDateRange = readonly [Date | null, Date | null];
77
+ /** What a preset's range function is called with. */
78
+ interface WrDateRangePresetContext {
79
+ /**
80
+ * The picker's adapter. In `datetime` mode it reads the display time zone of
81
+ * `withDates({ timeZone })`, so day maths done through it lands on that
82
+ * zone's days.
83
+ */
84
+ readonly adapter: WrDateAdapter<Date>;
85
+ /**
86
+ * The start of today, read when the panel opens. With a display time zone it
87
+ * is the zone's today: a browser-local day in `date` mode, the zone's
88
+ * midnight in `datetime` mode.
89
+ */
90
+ readonly today: Date;
91
+ }
92
+ /** A range worked out when the panel opens, such as one relative to today. */
93
+ type WrDateRangePresetFn = (context: WrDateRangePresetContext) => readonly [Date, Date];
94
+ /**
95
+ * A one-click range in the panel of `<wr-date-range-picker>`.
96
+ *
97
+ * `label` is the app's own text. `range` is a fixed pair, or a function for a
98
+ * range that depends on today: `wrLastDays`, `wrThisWeek`, `wrThisMonth` and
99
+ * `wrLastMonth` return one.
100
+ *
101
+ * In `date` mode both ends are cut to whole days. In `datetime` mode the pair
102
+ * is committed as given; the helpers run from 00:00:00 on the first day to
103
+ * 23:59:59 on the last.
104
+ */
105
+ interface WrDateRangePreset {
106
+ readonly label: string;
107
+ readonly range: readonly [Date, Date] | WrDateRangePresetFn;
108
+ }
77
109
  /**
78
110
  * Unified date / time / date-time picker. Same `<input>` + popover skeleton
79
111
  * for every mode — the overlay content swaps based on `[mode]`:
@@ -614,6 +646,9 @@ type EndRefusals = readonly [WrDateInputError | null, WrDateInputError | null];
614
646
  *
615
647
  * <!-- date + time on both ends -->
616
648
  * <wr-date-range-picker mode="datetime" [(value)]="window" timeFormat="24h" />
649
+ *
650
+ * <!-- one-click ranges, labelled by the app -->
651
+ * <wr-date-range-picker [(value)]="period" [presets]="presets" />
617
652
  * ```
618
653
  *
619
654
  * @see https://ngwr.dev/reference/components/date-picker
@@ -664,6 +699,22 @@ export declare class WrDateRangePicker implements FormValueControl<WrDateRange |
664
699
  * keyboard, emptying both fields clears the value. @default false
665
700
  */
666
701
  readonly clearable: import("@angular/core").InputSignalWithTransform<boolean, any>;
702
+ /**
703
+ * One-click ranges, drawn as a list of buttons on the start side of the
704
+ * panel. A click commits the range, closes the panel and emits `touch`, in
705
+ * both modes. The preset whose range equals the value is marked pressed, and
706
+ * one that reaches outside `minDate` / `maxDate` is disabled. The labels are
707
+ * the app's: the library ships none.
708
+ *
709
+ * A range function is called when the panel opens, with today in the display
710
+ * time zone. `wrLastDays`, `wrThisWeek`, `wrThisMonth` and `wrLastMonth`
711
+ * return one. See {@link WrDateRangePreset} for what each mode commits.
712
+ *
713
+ * @default []
714
+ */
715
+ readonly presets: import("@angular/core").InputSignal<readonly WrDateRangePreset[]>;
716
+ /** Accessible name of the preset list. The library ships none. */
717
+ readonly presetsLabel: import("@angular/core").InputSignal<string | null>;
667
718
  /** Clear (×) button aria-label. Falls back to `common.clear`. */
668
719
  readonly clearLabel: import("@angular/core").InputSignal<string | null>;
669
720
  protected readonly resolvedClear: Signal<string>;
@@ -1027,6 +1078,16 @@ export declare class WrDateRangePicker implements FormValueControl<WrDateRange |
1027
1078
  "required": false;
1028
1079
  "isSignal": true;
1029
1080
  };
1081
+ "presets": {
1082
+ "alias": "presets";
1083
+ "required": false;
1084
+ "isSignal": true;
1085
+ };
1086
+ "presetsLabel": {
1087
+ "alias": "presetsLabel";
1088
+ "required": false;
1089
+ "isSignal": true;
1090
+ };
1030
1091
  "clearLabel": {
1031
1092
  "alias": "clearLabel";
1032
1093
  "required": false;
@@ -1064,4 +1125,20 @@ export declare class WrDateRangePicker implements FormValueControl<WrDateRange |
1064
1125
  "closed": "closed";
1065
1126
  }, never, never, true, never>;
1066
1127
  }
1067
- export type { WrDateInputError, WrDatePickerSize, WrDateRange, WrDateRangeInputError };
1128
+ /**
1129
+ * The last `days` days, today included: `wrLastDays(7)` is today and the six
1130
+ * days before it, and `wrLastDays(1)` is today.
1131
+ *
1132
+ * @example
1133
+ * ```ts
1134
+ * readonly presets: WrDateRangePreset[] = [{ label: 'Last 7 days', range: wrLastDays(7) }];
1135
+ * ```
1136
+ */
1137
+ export declare function wrLastDays(days: number): WrDateRangePresetFn;
1138
+ /** The week today is in, from the locale's first day of the week to its last. */
1139
+ export declare function wrThisWeek(): WrDateRangePresetFn;
1140
+ /** The month today is in, from its first day to its last. */
1141
+ export declare function wrThisMonth(): WrDateRangePresetFn;
1142
+ /** The month before the one today is in, from its first day to its last. */
1143
+ export declare function wrLastMonth(): WrDateRangePresetFn;
1144
+ export type { WrDateInputError, WrDatePickerSize, WrDateRange, WrDateRangeInputError, WrDateRangePreset, WrDateRangePresetContext, WrDateRangePresetFn };
@@ -30,7 +30,7 @@ export declare class WrDateStampHarness extends ComponentHarness {
30
30
  /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */
31
31
  static with(options?: WrDateStampHarnessFilters): HarnessPredicate<WrDateStampHarness>;
32
32
  private readonly time;
33
- /** The first line, or `null` when the stamp is empty. */
33
+ /** The first line, or `null` when the stamp is empty or `todayTimeOnly` shows a value from today. */
34
34
  getDate(): Promise<string | null>;
35
35
  /** The second line, or `null` when the stamp is empty or shows a date-only value. */
36
36
  getTime(): Promise<string | null>;
@@ -1,8 +1,8 @@
1
1
  import * as i0 from "@angular/core";
2
- import { WrDateFormat } from "ngwr/date";
2
+ import { WrDateFormat, WrEpochUnit } from "ngwr/date";
3
3
  interface Stamp {
4
4
  readonly iso: string;
5
- readonly date: string;
5
+ readonly date: string | null;
6
6
  readonly time: string | null;
7
7
  }
8
8
  /**
@@ -11,9 +11,13 @@ interface Stamp {
11
11
  * Both lines are written by the date adapter, so they are in the interface
12
12
  * language and, for an instant, on the wall clock of
13
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.
14
+ * as `wrDate` reads it: a `Date`, an epoch number or a string, under the
15
+ * `epochUnit` and `zonelessIn` of `withDates()`. A date-only string
16
+ * (`'2026-11-12'`) is a day, so it shows the date line alone and does not
17
+ * shift with the zone.
18
+ *
19
+ * `withDates({ stamp })` sets the formats, `todayTimeOnly` and `seconds` for
20
+ * every stamp of the app; an input set here wins.
17
21
  *
18
22
  * The lines sit in one `<time>` whose `datetime` is the instant in ISO 8601,
19
23
  * or the day for a date-only string. `null`, `undefined`, `''` and a value
@@ -23,14 +27,16 @@ interface Stamp {
23
27
  * ```html
24
28
  * <wr-date-stamp [value]="row.createdAt" />
25
29
  * <wr-date-stamp [value]="row.createdAt" dateFormat="d MMM yyyy" timeFormat="time24hSeconds" />
30
+ * <wr-date-stamp [value]="message.sentAt" todayTimeOnly seconds />
26
31
  * ```
27
32
  *
28
33
  * @see https://ngwr.dev/reference/components/date-stamp
29
34
  */
30
35
  export declare class WrDateStamp {
31
36
  constructor();
37
+ private readonly defaults;
32
38
  /**
33
- * The moment shown: a `Date`, epoch milliseconds, or a string `wrParseDate`
39
+ * The moment shown: a `Date`, an epoch number, or a string `wrParseDate`
34
40
  * reads. `null`, `undefined`, `''` and a value that is not a date are empty.
35
41
  *
36
42
  * @default null
@@ -38,17 +44,42 @@ export declare class WrDateStamp {
38
44
  readonly value: import("@angular/core").InputSignal<string | number | Date | null | undefined>;
39
45
  /**
40
46
  * Format of the first line: a named key or a token string (`'d MMM yyyy'`).
47
+ * `withDates({ stamp })` changes the default.
41
48
  *
42
49
  * @default 'mediumDate'
43
50
  */
44
51
  readonly dateFormat: import("@angular/core").InputSignal<WrDateFormat | (string & {})>;
45
52
  /**
46
53
  * Format of the second line: a named key (`'time24hSeconds'`) or a token
47
- * string (`'HH:mm'`).
54
+ * string (`'HH:mm'`). `withDates({ stamp })` changes the default.
48
55
  *
49
56
  * @default 'time'
50
57
  */
51
58
  readonly timeFormat: import("@angular/core").InputSignal<WrDateFormat | (string & {})>;
59
+ /**
60
+ * Write the seconds in the time line: `'time'` is read as `'timeSeconds'`
61
+ * and `'HH:mm'` as `'HH:mm:ss'`. A format that already has them is left
62
+ * alone. `withDates({ stamp })` changes the default.
63
+ *
64
+ * @default false
65
+ */
66
+ readonly seconds: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
67
+ /**
68
+ * Show the time alone for a value from today. Today is the day in the
69
+ * display zone, read when the stamp renders: one left on screen past
70
+ * midnight keeps its single line. A date-only value keeps its date.
71
+ * `withDates({ stamp })` changes the default.
72
+ *
73
+ * @default false
74
+ */
75
+ readonly todayTimeOnly: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
76
+ /**
77
+ * What a number in `value` counts since the epoch: `'ms'`, `'us'`, `'s'` or
78
+ * `'auto'`, by size. `null` follows `withDates({ epochUnit })`.
79
+ *
80
+ * @default null
81
+ */
82
+ readonly epochUnit: import("@angular/core").InputSignal<WrEpochUnit | null>;
52
83
  /** What stands in for an empty value. Falls back to `copyValue.empty`, then `'-'`. */
53
84
  readonly emptyLabel: import("@angular/core").InputSignal<string | null>;
54
85
  protected readonly resolvedEmptyLabel: import("@angular/core").Signal<string>;
@@ -71,6 +102,21 @@ export declare class WrDateStamp {
71
102
  "required": false;
72
103
  "isSignal": true;
73
104
  };
105
+ "seconds": {
106
+ "alias": "seconds";
107
+ "required": false;
108
+ "isSignal": true;
109
+ };
110
+ "todayTimeOnly": {
111
+ "alias": "todayTimeOnly";
112
+ "required": false;
113
+ "isSignal": true;
114
+ };
115
+ "epochUnit": {
116
+ "alias": "epochUnit";
117
+ "required": false;
118
+ "isSignal": true;
119
+ };
74
120
  "emptyLabel": {
75
121
  "alias": "emptyLabel";
76
122
  "required": false;
@@ -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
  */
@@ -65,6 +113,30 @@ interface WrDatesOptions {
65
113
  * dev mode.
66
114
  */
67
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;
68
140
  }
69
141
  /** Whether `value` is one of the shared named format keys. */
70
142
  declare function wrIsNamedFormat(value: string): value is WrDateFormat;
@@ -133,7 +205,8 @@ export declare abstract class WrDateAdapter<TDate = Date> {
133
205
  * adapter that treats one as a raw pattern prints its letters into the field.
134
206
  * v15 added them; an adapter written for v14 has to handle them.
135
207
  *
136
- * Supported tokens for raw strings: `yyyy`, `yy`, `MMMM`, `MMM`, `MM`, `M`,
208
+ * Supported tokens for raw strings: `yyyy`, `yy`, `y` (the full year, as
209
+ * `DatePipe` reads it: `d MMM y`), `MMMM`, `MMM`, `MM`, `M`,
137
210
  * `dd`, `d`, `HH`, `H`, `hh`, `h`, `mm`, `ss`, `a` (the locale's day-period
138
211
  * marker — `PM`, `م`, `午後`).
139
212
  *
@@ -174,6 +247,14 @@ export declare abstract class WrDateAdapter<TDate = Date> {
174
247
  * template, a `computed` or an `effect`, it re-runs them when either moves.
175
248
  */
176
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;
177
258
  /** `0` Sunday, `1` Monday — locale-dependent. */
178
259
  abstract getFirstDayOfWeek(): number;
179
260
  /** Names ordered from `getFirstDayOfWeek()` onwards. Length 7. */
@@ -211,6 +292,8 @@ export declare class WrNativeDateAdapter extends WrDateAdapter<Date> {
211
292
  */
212
293
  zoned(): WrDateAdapter<Date>;
213
294
  displayKey(): string;
295
+ private readonly input;
296
+ parseOptions(): WrParseDateOptions;
214
297
  private zone;
215
298
  private wallZone;
216
299
  private readonly walls;
@@ -389,24 +472,24 @@ export declare function wrIsDateOnly(value: unknown): boolean;
389
472
  * @internal
390
473
  */
391
474
  export declare function wrToLocalDate(value: string | number): Date;
392
- /**
393
- * @license
394
- *
395
- * Use of this source code is governed by an MIT-style license that can be
396
- * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
397
- */
398
475
  /**
399
476
  * What a backend sends for a date, as a `Date`, or `null` when it holds none.
400
477
  * Never an Invalid Date, so the result needs one check rather than two.
401
478
  *
402
479
  * - A `Date` comes back as it is, the same object; an Invalid Date gives `null`.
403
- * - A number is epoch milliseconds; `NaN`, an infinity and a number outside the
404
- * range of `Date` give `null`.
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`.
405
485
  * - `2026-03-01 14:30:00`, a space where ISO 8601 has a `T`, is rewritten to the
406
486
  * ISO form first. Chrome reads the space form and Safari gives an Invalid Date
407
487
  * for it. Seconds, a fraction and a zone are optional; the fraction is cut to
408
488
  * milliseconds and a zone of hours alone (`+05`, as PostgreSQL prints it) is
409
- * 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.
410
493
  * - A date-only string (`2026-03-01`, `2026-03`, `2026`) is that day's LOCAL
411
494
  * midnight, as `wrDate` and `WrValidators.minDate` read it. `new Date()` would
412
495
  * make it UTC midnight, the evening before for a reader west of Greenwich.
@@ -416,7 +499,9 @@ export declare function wrToLocalDate(value: string | number): Date;
416
499
  * refuses give `null`.
417
500
  *
418
501
  * Surrounding whitespace is ignored. A plain function: no adapter and no
419
- * 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.
420
505
  *
421
506
  * @example
422
507
  * ```ts
@@ -424,12 +509,14 @@ export declare function wrToLocalDate(value: string | number): Date;
424
509
  * wrParseDate('2026-03-01'); // 1 March 2026, 00:00 local
425
510
  * wrParseDate('2026-03-01T09:30:00+05:00'); // that instant
426
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
427
514
  * wrParseDate('n/a'); // null
428
515
  * ```
429
516
  *
430
517
  * @see https://ngwr.dev/reference/pipes/wr-date
431
518
  */
432
- 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;
433
520
  /**
434
521
  * The locale dates are written in, as a signal. Highest first:
435
522
  *
@@ -455,8 +542,9 @@ export declare function wrParseDate(value: Date | string | number | null | undef
455
542
  export declare function wrDateLocale(): Signal<string>;
456
543
  /**
457
544
  * 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
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
460
548
  * {@link WrNativeDateAdapter} in Angular's `LOCALE_ID` and the browser's zone.
461
549
  *
462
550
  * Omit `locale` and dates follow the interface language of `provideWrI18n()`,
@@ -524,4 +612,19 @@ export declare const WR_DATE_LOCALE: InjectionToken<string>;
524
612
  * of your own injects it to honour the same option.
525
613
  */
526
614
  export declare const WR_DATE_TIME_ZONE: InjectionToken<(() => string | null | undefined) | null>;
527
- export { type WrDateFormat, type WrDatesOptions, wrIsNamedFormat };
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 };
@@ -1,4 +1,4 @@
1
- import { BaseHarnessFilters, ComponentHarness, ContentContainerComponentHarness, HarnessLoader, HarnessPredicate } from "@angular/cdk/testing";
1
+ import { BaseHarnessFilters, ComponentHarness, ComponentHarnessConstructor, ContentContainerComponentHarness, HarnessLoader, HarnessPredicate, TestElement } from "@angular/cdk/testing";
2
2
  /** Narrows which `[wrDropdown]` trigger a harness query matches. */
3
3
  interface WrDropdownHarnessFilters extends BaseHarnessFilters {
4
4
  /**
@@ -40,6 +40,8 @@ export declare class WrDropdownItemHarness extends ComponentHarness {
40
40
  getRole(): Promise<string | null>;
41
41
  /** Whether the item refuses activation. */
42
42
  isDisabled(): Promise<boolean>;
43
+ /** Whether the item opens a submenu. `WrDropdownHarness.openSubmenu()` opens it. */
44
+ hasSubmenu(): Promise<boolean>;
43
45
  /** Whether the item shows a leading icon. */
44
46
  hasIcon(): Promise<boolean>;
45
47
  /** The leading icon's registered name, or `null` when the item has no icon. */
@@ -71,8 +73,8 @@ export declare class WrDropdownItemHarness extends ComponentHarness {
71
73
  * That scoped loader is also this harness's CONTENT loader, so
72
74
  * `dropdown.getHarness(…)` resolves inside THIS dropdown's menu: the consumer's
73
75
  * own components in the menu are reachable without the spec ever touching the
74
- * overlay, and so is a nested `[wrDropdown]`, which is how a submenu is built
75
- * here (the component ships no submenu API of its own).
76
+ * overlay, and so is a nested `[wrDropdown]`. A submenu is reached with
77
+ * `openSubmenu()`, which answers with a harness scoped to that submenu.
76
78
  *
77
79
  * @example
78
80
  * ```ts
@@ -90,7 +92,7 @@ export declare class WrDropdownHarness extends ContentContainerComponentHarness
90
92
  /** The directive's host — whatever element the consumer put `[wrDropdown]` on. */
91
93
  static hostSelector: string;
92
94
  /** Build a predicate that narrows the query. */
93
- static with(options?: WrDropdownHarnessFilters): HarnessPredicate<WrDropdownHarness>;
95
+ static with<T extends WrDropdownHarness>(this: ComponentHarnessConstructor<T>, options?: WrDropdownHarnessFilters): HarnessPredicate<T>;
94
96
  /** The trigger's visible text. */
95
97
  getTriggerText(): Promise<string>;
96
98
  /** Whether the menu is showing. */
@@ -149,6 +151,14 @@ export declare class WrDropdownHarness extends ContentContainerComponentHarness
149
151
  * the menu, so a consumer who wants one calls `close()` themselves.
150
152
  */
151
153
  clickItem(filters: WrDropdownItemHarnessFilters): Promise<void>;
154
+ /**
155
+ * Open the menu if it is closed, then open the submenu of the item with this
156
+ * label and answer with its harness: `getItems()`, `clickItem()` and a further
157
+ * `openSubmenu()` all read that submenu and nothing else.
158
+ *
159
+ * A click opens it, since hovering waits out the item's `showDelay`.
160
+ */
161
+ openSubmenu(text: string | RegExp): Promise<WrDropdownSubmenuHarness>;
152
162
  /**
153
163
  * The label of the item that currently holds focus, or `null` when focus is
154
164
  * elsewhere.
@@ -169,8 +179,46 @@ export declare class WrDropdownHarness extends ContentContainerComponentHarness
169
179
  */
170
180
  protected getRootHarnessLoader(): Promise<HarnessLoader>;
171
181
  /** This dropdown's menu element in the overlay. */
172
- private menu;
182
+ protected menu(): Promise<TestElement>;
173
183
  /** The id the trigger publishes as `aria-controls`, which its menu carries. */
174
184
  private menuId;
175
185
  }
186
+ /**
187
+ * Test harness for an item carrying `[wrDropdownSubmenu]`, and the submenu it
188
+ * opens. Usually reached through `openSubmenu()` on the level above.
189
+ *
190
+ * It is a `WrDropdownHarness` whose trigger is the item, so everything that
191
+ * reads a menu reads the submenu, scoped the same way, by the id the item
192
+ * publishes. Two things differ. `hoverTrigger()` opens nothing by itself: the
193
+ * item waits out its `showDelay`, which is the spec's own fake timer to
194
+ * advance. And clicking a leaf item closes every submenu, so `clickItem()`
195
+ * leaves this one closed, while the root menu stays open as it always has.
196
+ *
197
+ * Which side the submenu opened on is not readable: jsdom has no layout.
198
+ *
199
+ * @example
200
+ * ```ts
201
+ * const file = await loader.getHarness(WrDropdownHarness.with({ text: 'File' }));
202
+ * const exportAs = await file.openSubmenu('Export');
203
+ *
204
+ * expect(await exportAs.getItemTexts()).toEqual(['CSV', 'PDF', 'Excel']);
205
+ * await exportAs.clickItem({ text: 'CSV' });
206
+ * ```
207
+ *
208
+ * @see https://ngwr.dev/guides/testing
209
+ */
210
+ export declare class WrDropdownSubmenuHarness extends WrDropdownHarness {
211
+ /** The class the directive puts on its item. */
212
+ static hostSelector: string;
213
+ /** Open the submenu with a click on its item. */
214
+ open(): Promise<void>;
215
+ /**
216
+ * Open the submenu from the keyboard, with Enter on its item. Enter rather
217
+ * than the arrow because the arrow that opens a submenu depends on the
218
+ * reading direction, and Enter does not.
219
+ */
220
+ openByKeyboard(): Promise<void>;
221
+ /** Close the submenu with Escape typed inside it, which closes this level only. */
222
+ close(): Promise<void>;
223
+ }
176
224
  export type { WrDropdownHarnessFilters, WrDropdownItemHarnessFilters };
@@ -138,6 +138,8 @@ export declare class WrDropdown {
138
138
  */
139
139
  protected get triggerId(): string;
140
140
  private overlayRef;
141
+ /** The root menu's link to the submenus open below it. */
142
+ private level;
141
143
  constructor();
142
144
  /** Open the menu. */
143
145
  open(): void;
@@ -181,7 +183,12 @@ export declare class WrDropdown {
181
183
  /** @internal Trigger keydown — ArrowDown/Up/Enter/Space open the menu. */
182
184
  protected onKeydown(event: KeyboardEvent): void;
183
185
  private handleMenuKeydown;
186
+ /** The focus stops of `pane`, the root menu's own by default. */
184
187
  private getItems;
188
+ /** Whether `node` is in the root menu or in a submenu open below it. */
189
+ private inMenus;
190
+ /** A `trigger="hover"` menu closes once the pointer is off the trigger and every pane. */
191
+ private onMenusLeave;
185
192
  private focusItemAt;
186
193
  private readonly onOverlayMouseLeave;
187
194
  static ɵfac: i0.ɵɵFactoryDeclaration<WrDropdown, never>;
@@ -249,4 +256,97 @@ export declare class WrDropdownItem {
249
256
  };
250
257
  }, {}, never, ["*"], true, never>;
251
258
  }
259
+ /**
260
+ * Put on a `<wr-dropdown-item>` to open another `<wr-dropdown-menu>` beside it.
261
+ * The submenu's own items can carry it too, to any depth.
262
+ *
263
+ * @example
264
+ * ```html
265
+ * <button [wrDropdown]="file">File</button>
266
+ *
267
+ * <wr-dropdown-menu #file>
268
+ * <wr-dropdown-item>New</wr-dropdown-item>
269
+ * <wr-dropdown-item [wrDropdownSubmenu]="exportAs">Export</wr-dropdown-item>
270
+ * </wr-dropdown-menu>
271
+ *
272
+ * <wr-dropdown-menu #exportAs>
273
+ * <wr-dropdown-item (click)="export('csv')">CSV</wr-dropdown-item>
274
+ * <wr-dropdown-item (click)="export('pdf')">PDF</wr-dropdown-item>
275
+ * </wr-dropdown-menu>
276
+ * ```
277
+ *
278
+ * @see https://ngwr.dev/reference/components/dropdown
279
+ */
280
+ export declare class WrDropdownSubmenu {
281
+ /** Menu to open beside the item. Pass a `<wr-dropdown-menu>` template reference. */
282
+ readonly menu: import("@angular/core").InputSignal<WrDropdownMenu>;
283
+ /** How long the pointer rests on the item before the submenu opens, in ms. @default 150 */
284
+ readonly showDelay: import("@angular/core").InputSignalWithTransform<number, unknown>;
285
+ /**
286
+ * How long the submenu stays once the pointer has left both the item and the
287
+ * submenu, in ms. Long enough to cross a neighbouring item on the way in.
288
+ * @default 150
289
+ */
290
+ readonly hideDelay: import("@angular/core").InputSignalWithTransform<number, unknown>;
291
+ private readonly host;
292
+ private readonly focusMonitor;
293
+ private readonly overlay;
294
+ private readonly dir;
295
+ private readonly outsideClick;
296
+ private readonly vcr;
297
+ private readonly scrollStrategies;
298
+ private readonly injector;
299
+ private readonly openState;
300
+ /** Whether the submenu is open. Read-only: `open()` and `close()` change it. */
301
+ readonly isOpen: import("@angular/core").Signal<boolean>;
302
+ private readonly fallbackId;
303
+ /** The consumer's own `id` wins, read fresh for the reason `WrDropdown` gives. */
304
+ protected get itemId(): string;
305
+ private overlayRef;
306
+ private level;
307
+ private outside;
308
+ private showTimer;
309
+ private hideTimer;
310
+ constructor();
311
+ /** Open the submenu and move focus to its first item. The item has to be in an open menu. */
312
+ open(): void;
313
+ /** Close the submenu and every submenu below it. */
314
+ close(): void;
315
+ /** @internal A real click opens; Enter and Space arrive as a click with no pointer behind it. */
316
+ protected onClick(event: MouseEvent): void;
317
+ /** @internal The arrow pointing the way the menus cascade walks into the submenu. */
318
+ protected onKeydown(event: KeyboardEvent): void;
319
+ /** @internal */
320
+ protected onMouseEnter(): void;
321
+ /** @internal */
322
+ protected onMouseLeave(event: MouseEvent): void;
323
+ private get disabled();
324
+ /** A pointer shows the submenu and leaves the caret alone; the keyboard walks in. */
325
+ private show;
326
+ private attach;
327
+ private dispose;
328
+ private hideLater;
329
+ private readonly clearTimers;
330
+ private readonly onPaneLeave;
331
+ /** Choosing a leaf closes every submenu, up to the root menu's own item. */
332
+ private readonly onPaneClick;
333
+ static ɵfac: i0.ɵɵFactoryDeclaration<WrDropdownSubmenu, never>;
334
+ static ɵdir: i0.ɵɵDirectiveDeclaration<WrDropdownSubmenu, "[wrDropdownSubmenu]", ["wrDropdownSubmenu"], {
335
+ "menu": {
336
+ "alias": "wrDropdownSubmenu";
337
+ "required": true;
338
+ "isSignal": true;
339
+ };
340
+ "showDelay": {
341
+ "alias": "showDelay";
342
+ "required": false;
343
+ "isSignal": true;
344
+ };
345
+ "hideDelay": {
346
+ "alias": "hideDelay";
347
+ "required": false;
348
+ "isSignal": true;
349
+ };
350
+ }, {}, never, never, true, never>;
351
+ }
252
352
  export type { WrDropdownPosition, WrDropdownTrigger };