@radix-ng/primitives 0.50.0 → 1.0.0-beta.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/collection/README.md +1 -0
- package/fesm2022/radix-ng-primitives-accordion.mjs +134 -66
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs +224 -132
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-arrow.mjs +26 -10
- package/fesm2022/radix-ng-primitives-arrow.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-aspect-ratio.mjs +6 -6
- package/fesm2022/radix-ng-primitives-aspect-ratio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-avatar.mjs +68 -75
- package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-button.mjs +123 -0
- package/fesm2022/radix-ng-primitives-button.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-calendar.mjs +104 -103
- package/fesm2022/radix-ng-primitives-calendar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs +414 -80
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collapsible.mjs +193 -92
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collection.mjs +72 -0
- package/fesm2022/radix-ng-primitives-collection.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-config.mjs +5 -5
- package/fesm2022/radix-ng-primitives-config.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-context-menu.mjs +143 -427
- package/fesm2022/radix-ng-primitives-context-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-core.mjs +757 -757
- package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-cropper.mjs +55 -53
- package/fesm2022/radix-ng-primitives-cropper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-date-field.mjs +93 -86
- package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dialog.mjs +658 -330
- package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dismissable-layer.mjs +98 -76
- package/fesm2022/radix-ng-primitives-dismissable-layer.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-drawer.mjs +1059 -0
- package/fesm2022/radix-ng-primitives-drawer.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-editable.mjs +20 -20
- package/fesm2022/radix-ng-primitives-editable.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-field.mjs +363 -0
- package/fesm2022/radix-ng-primitives-field.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-fieldset.mjs +79 -0
- package/fesm2022/radix-ng-primitives-fieldset.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-focus-guards.mjs +3 -3
- package/fesm2022/radix-ng-primitives-focus-guards.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-focus-scope.mjs +29 -14
- package/fesm2022/radix-ng-primitives-focus-scope.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-input.mjs +172 -0
- package/fesm2022/radix-ng-primitives-input.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-label.mjs +11 -11
- package/fesm2022/radix-ng-primitives-label.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menu.mjs +1484 -353
- package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menubar.mjs +290 -162
- package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-meter.mjs +271 -0
- package/fesm2022/radix-ng-primitives-meter.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-navigation-menu.mjs +1060 -1553
- package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-number-field.mjs +1102 -366
- package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-pagination.mjs +51 -51
- package/fesm2022/radix-ng-primitives-pagination.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popover.mjs +980 -995
- package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popper.mjs +137 -82
- package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-portal.mjs +40 -16
- package/fesm2022/radix-ng-primitives-portal.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-presence.mjs +134 -246
- package/fesm2022/radix-ng-primitives-presence.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-preview-card.mjs +997 -0
- package/fesm2022/radix-ng-primitives-preview-card.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-progress.mjs +231 -92
- package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +211 -70
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-roving-focus.mjs +127 -77
- package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-select.mjs +791 -511
- package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-separator.mjs +16 -45
- package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-slider.mjs +976 -720
- package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-stepper.mjs +69 -71
- package/fesm2022/radix-ng-primitives-stepper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +128 -124
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tabs.mjs +388 -115
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-time-field.mjs +111 -117
- package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +122 -248
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +99 -62
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toolbar.mjs +307 -94
- package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tooltip.mjs +690 -1079
- package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-visually-hidden.mjs +46 -87
- package/fesm2022/radix-ng-primitives-visually-hidden.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives.mjs.map +1 -1
- package/meter/README.md +3 -0
- package/navigation-menu/README.md +2 -1
- package/package.json +85 -63
- package/portal/README.md +2 -0
- package/preview-card/README.md +3 -0
- package/schematics/collection.json +1 -0
- package/schematics/ng-add/index.d.ts +3 -2
- package/schematics/ng-add/index.js +62 -31
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/package-config.d.ts +4 -2
- package/schematics/ng-add/package-config.js +10 -2
- package/schematics/ng-add/package-config.js.map +1 -1
- package/schematics/ng-add/schema.d.ts +3 -0
- package/schematics/ng-add/schema.js +3 -0
- package/schematics/ng-add/schema.js.map +1 -0
- package/schematics/ng-add/schema.json +14 -0
- package/select/README.md +2 -0
- package/{accordion/index.d.ts → types/radix-ng-primitives-accordion.d.ts} +102 -67
- package/types/radix-ng-primitives-alert-dialog.d.ts +114 -0
- package/{arrow/index.d.ts → types/radix-ng-primitives-arrow.d.ts} +1 -1
- package/{aspect-ratio/index.d.ts → types/radix-ng-primitives-aspect-ratio.d.ts} +1 -1
- package/{avatar/index.d.ts → types/radix-ng-primitives-avatar.d.ts} +7 -11
- package/types/radix-ng-primitives-button.d.ts +73 -0
- package/{calendar/index.d.ts → types/radix-ng-primitives-calendar.d.ts} +2 -3
- package/types/radix-ng-primitives-checkbox.d.ts +337 -0
- package/types/radix-ng-primitives-collapsible.d.ts +159 -0
- package/types/radix-ng-primitives-collection.d.ts +44 -0
- package/{config/index.d.ts → types/radix-ng-primitives-config.d.ts} +1 -1
- package/types/radix-ng-primitives-context-menu.d.ts +73 -0
- package/{core/index.d.ts → types/radix-ng-primitives-core.d.ts} +311 -236
- package/{cropper/index.d.ts → types/radix-ng-primitives-cropper.d.ts} +6 -5
- package/{date-field/index.d.ts → types/radix-ng-primitives-date-field.d.ts} +42 -27
- package/types/radix-ng-primitives-dialog.d.ts +323 -0
- package/{dismissable-layer/index.d.ts → types/radix-ng-primitives-dismissable-layer.d.ts} +15 -7
- package/types/radix-ng-primitives-drawer.d.ts +448 -0
- package/{editable/index.d.ts → types/radix-ng-primitives-editable.d.ts} +1 -1
- package/types/radix-ng-primitives-field.d.ts +373 -0
- package/types/radix-ng-primitives-fieldset.d.ts +48 -0
- package/{focus-scope/index.d.ts → types/radix-ng-primitives-focus-scope.d.ts} +13 -5
- package/types/radix-ng-primitives-input.d.ts +87 -0
- package/{label/index.d.ts → types/radix-ng-primitives-label.d.ts} +0 -1
- package/types/radix-ng-primitives-menu.d.ts +612 -0
- package/types/radix-ng-primitives-menubar.d.ts +66 -0
- package/types/radix-ng-primitives-meter.d.ts +193 -0
- package/types/radix-ng-primitives-navigation-menu.d.ts +488 -0
- package/types/radix-ng-primitives-number-field.d.ts +464 -0
- package/{pagination/index.d.ts → types/radix-ng-primitives-pagination.d.ts} +2 -2
- package/types/radix-ng-primitives-popover.d.ts +416 -0
- package/{popper/index.d.ts → types/radix-ng-primitives-popper.d.ts} +50 -9
- package/types/radix-ng-primitives-portal.d.ts +30 -0
- package/types/radix-ng-primitives-presence.d.ts +55 -0
- package/types/radix-ng-primitives-preview-card.d.ts +359 -0
- package/types/radix-ng-primitives-progress.d.ts +206 -0
- package/{radio/index.d.ts → types/radix-ng-primitives-radio.d.ts} +56 -26
- package/{roving-focus/index.d.ts → types/radix-ng-primitives-roving-focus.d.ts} +38 -27
- package/types/radix-ng-primitives-select.d.ts +512 -0
- package/types/radix-ng-primitives-separator.d.ts +38 -0
- package/types/radix-ng-primitives-slider.d.ts +377 -0
- package/{stepper/index.d.ts → types/radix-ng-primitives-stepper.d.ts} +21 -22
- package/types/radix-ng-primitives-switch.d.ts +121 -0
- package/types/radix-ng-primitives-tabs.d.ts +247 -0
- package/{time-field/index.d.ts → types/radix-ng-primitives-time-field.d.ts} +46 -31
- package/types/radix-ng-primitives-toggle-group.d.ts +116 -0
- package/types/radix-ng-primitives-toggle.d.ts +65 -0
- package/types/radix-ng-primitives-toolbar.d.ts +180 -0
- package/types/radix-ng-primitives-tooltip.d.ts +395 -0
- package/{visually-hidden/index.d.ts → types/radix-ng-primitives-visually-hidden.d.ts} +19 -19
- package/alert-dialog/index.d.ts +0 -57
- package/checkbox/index.d.ts +0 -164
- package/collapsible/index.d.ts +0 -85
- package/context-menu/index.d.ts +0 -129
- package/dialog/index.d.ts +0 -205
- package/dropdown-menu/README.md +0 -1
- package/dropdown-menu/index.d.ts +0 -171
- package/fesm2022/radix-ng-primitives-dropdown-menu.mjs +0 -583
- package/fesm2022/radix-ng-primitives-dropdown-menu.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-hover-card.mjs +0 -1246
- package/fesm2022/radix-ng-primitives-hover-card.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-tooltip2.mjs +0 -740
- package/fesm2022/radix-ng-primitives-tooltip2.mjs.map +0 -1
- package/hover-card/README.md +0 -3
- package/hover-card/index.d.ts +0 -472
- package/menu/index.d.ts +0 -139
- package/menubar/index.d.ts +0 -56
- package/navigation-menu/index.d.ts +0 -405
- package/number-field/index.d.ts +0 -203
- package/popover/index.d.ts +0 -403
- package/portal/index.d.ts +0 -22
- package/presence/index.d.ts +0 -103
- package/progress/index.d.ts +0 -79
- package/select/index.d.ts +0 -214
- package/separator/index.d.ts +0 -63
- package/slider/index.d.ts +0 -263
- package/switch/index.d.ts +0 -105
- package/tabs/index.d.ts +0 -112
- package/toggle/index.d.ts +0 -75
- package/toggle-group/index.d.ts +0 -194
- package/toolbar/index.d.ts +0 -55
- package/tooltip/index.d.ts +0 -433
- package/tooltip2/README.md +0 -3
- package/tooltip2/index.d.ts +0 -325
- /package/{focus-guards/index.d.ts → types/radix-ng-primitives-focus-guards.d.ts} +0 -0
- /package/{index.d.ts → types/radix-ng-primitives.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, ElementRef, input, computed, signal, effect, Directive, model, booleanAttribute, NgModule } from '@angular/core';
|
|
3
|
-
import { useDateField, normalizeDateStep,
|
|
2
|
+
import { InjectionToken, inject, ElementRef, input, computed, signal, effect, Directive, model, booleanAttribute, contentChildren, linkedSignal, NgModule } from '@angular/core';
|
|
3
|
+
import { useDateField, normalizeDateStep, createFormatter, normalizeHourCycle, getDefaultDate, hasTime, syncSegmentValues, initializeSegmentValues, isBefore, createContent, watch, isNullish, ARROW_LEFT, ARROW_RIGHT, isSegmentNavigationKey, provideToken } from '@radix-ng/primitives/core';
|
|
4
4
|
|
|
5
5
|
const DATE_FIELDS_ROOT_CONTEXT = new InjectionToken('DATE_FIELDS_ROOT_CONTEXT');
|
|
6
6
|
function injectDateFieldsRootContext() {
|
|
@@ -10,32 +10,38 @@ function injectDateFieldsRootContext() {
|
|
|
10
10
|
class RdxDateFieldInputDirective {
|
|
11
11
|
constructor() {
|
|
12
12
|
this.elementRef = inject(ElementRef);
|
|
13
|
+
/**
|
|
14
|
+
* The host element of this segment. Consumed by the root to collect focusable
|
|
15
|
+
* segments in DOM order.
|
|
16
|
+
* @ignore
|
|
17
|
+
*/
|
|
18
|
+
this.element = this.elementRef.nativeElement;
|
|
13
19
|
this.rootContext = injectDateFieldsRootContext();
|
|
14
20
|
/**
|
|
15
21
|
* The part of the date to render
|
|
16
22
|
* `'day' | 'month' | 'year' | 'hour' | 'minute' | 'second' | 'dayPeriod' | 'literal' | 'timeZoneName'`
|
|
17
23
|
*/
|
|
18
|
-
this.part = input(...(ngDevMode ? [undefined, { debugName: "part" }] : []));
|
|
24
|
+
this.part = input(...(ngDevMode ? [undefined, { debugName: "part" }] : /* istanbul ignore next */ []));
|
|
19
25
|
/**
|
|
20
26
|
* @ignore
|
|
21
27
|
*/
|
|
22
|
-
this.disabled = computed(() => this.rootContext.disabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
28
|
+
this.disabled = computed(() => this.rootContext.disabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
23
29
|
/**
|
|
24
30
|
* @ignore
|
|
25
31
|
*/
|
|
26
|
-
this.readonly = computed(() => this.rootContext.readonly(), ...(ngDevMode ? [{ debugName: "readonly" }] : []));
|
|
32
|
+
this.readonly = computed(() => this.rootContext.readonly(), ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
27
33
|
/**
|
|
28
34
|
* @ignore
|
|
29
35
|
*/
|
|
30
|
-
this.isInvalid = computed(() => this.rootContext.isInvalid(), ...(ngDevMode ? [{ debugName: "isInvalid" }] : []));
|
|
36
|
+
this.isInvalid = computed(() => this.rootContext.isInvalid(), ...(ngDevMode ? [{ debugName: "isInvalid" }] : /* istanbul ignore next */ []));
|
|
31
37
|
/**
|
|
32
38
|
* @ignore
|
|
33
39
|
*/
|
|
34
|
-
this.hasLeftFocus = signal(true, ...(ngDevMode ? [{ debugName: "hasLeftFocus" }] : []));
|
|
40
|
+
this.hasLeftFocus = signal(true, ...(ngDevMode ? [{ debugName: "hasLeftFocus" }] : /* istanbul ignore next */ []));
|
|
35
41
|
/**
|
|
36
42
|
* @ignore
|
|
37
43
|
*/
|
|
38
|
-
this.lastKeyZero = signal(false, ...(ngDevMode ? [{ debugName: "lastKeyZero" }] : []));
|
|
44
|
+
this.lastKeyZero = signal(false, ...(ngDevMode ? [{ debugName: "lastKeyZero" }] : /* istanbul ignore next */ []));
|
|
39
45
|
this.fieldData = computed(() => {
|
|
40
46
|
return useDateField({
|
|
41
47
|
hasLeftFocus: this.hasLeftFocus,
|
|
@@ -43,7 +49,7 @@ class RdxDateFieldInputDirective {
|
|
|
43
49
|
placeholder: this.rootContext.placeholder,
|
|
44
50
|
hourCycle: this.rootContext.hourCycle(),
|
|
45
51
|
segmentValues: this.rootContext.segmentValues,
|
|
46
|
-
formatter: this.rootContext.formatter,
|
|
52
|
+
formatter: this.rootContext.formatter(),
|
|
47
53
|
part: this.part(),
|
|
48
54
|
disabled: this.rootContext.disabled,
|
|
49
55
|
readonly: this.rootContext.readonly,
|
|
@@ -51,8 +57,8 @@ class RdxDateFieldInputDirective {
|
|
|
51
57
|
modelValue: this.rootContext.value,
|
|
52
58
|
focusNext: this.rootContext.focusNext
|
|
53
59
|
});
|
|
54
|
-
}, ...(ngDevMode ? [{ debugName: "fieldData" }] : []));
|
|
55
|
-
this.attributes = computed(() => this.fieldData().attributes(), ...(ngDevMode ? [{ debugName: "attributes" }] : []));
|
|
60
|
+
}, ...(ngDevMode ? [{ debugName: "fieldData" }] : /* istanbul ignore next */ []));
|
|
61
|
+
this.attributes = computed(() => this.fieldData().attributes(), ...(ngDevMode ? [{ debugName: "attributes" }] : /* istanbul ignore next */ []));
|
|
56
62
|
effect(() => {
|
|
57
63
|
const { handleSegmentClick, handleSegmentKeydown } = this.fieldData();
|
|
58
64
|
this.handleSegmentKeydown = handleSegmentKeydown;
|
|
@@ -77,10 +83,10 @@ class RdxDateFieldInputDirective {
|
|
|
77
83
|
onFocusOut() {
|
|
78
84
|
this.hasLeftFocus.set(true);
|
|
79
85
|
}
|
|
80
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
81
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
86
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxDateFieldInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
87
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxDateFieldInputDirective, isStandalone: true, selector: "[rdxDateFieldInput]", inputs: { part: { classPropertyName: "part", publicName: "part", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mousedown": "part() !== \"literal\" && handleSegmentClick($event)", "keydown": "part() !== \"literal\" && handleSegmentKeydown($event)", "focus": "part() !== \"literal\" && onFocus($event)", "focusout": "part() !== \"literal\" && onFocusOut()" }, properties: { "attr.contenteditable": "disabled() || readonly() ? false : part() !== \"literal\"", "attr.data-rdx-date-field-segment": "part()", "attr.aria-disabled": "disabled() ? \"\" : undefined", "attr.data-disabled": "disabled() ? \"\" : undefined", "attr.data-invalid": "isInvalid() ? \"\" : undefined", "attr.aria-invalid": "isInvalid() ? true : undefined" } }, ngImport: i0 }); }
|
|
82
88
|
}
|
|
83
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
89
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxDateFieldInputDirective, decorators: [{
|
|
84
90
|
type: Directive,
|
|
85
91
|
args: [{
|
|
86
92
|
selector: '[rdxDateFieldInput]',
|
|
@@ -97,55 +103,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
|
|
|
97
103
|
'(focusout)': 'part() !== "literal" && onFocusOut()'
|
|
98
104
|
}
|
|
99
105
|
}]
|
|
100
|
-
}], ctorParameters: () => [] });
|
|
106
|
+
}], ctorParameters: () => [], propDecorators: { part: [{ type: i0.Input, args: [{ isSignal: true, alias: "part", required: false }] }] } });
|
|
101
107
|
|
|
102
108
|
class RdxDateFieldRootDirective {
|
|
103
109
|
constructor() {
|
|
104
|
-
this.elementRef = inject((ElementRef));
|
|
105
110
|
/**
|
|
106
111
|
* The controlled checked state of the calendar.
|
|
107
112
|
*/
|
|
108
|
-
this.value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : []));
|
|
113
|
+
this.value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
109
114
|
/**
|
|
110
115
|
* A callback fired when the date field's value is invalid.
|
|
111
116
|
*/
|
|
112
|
-
this.isDateUnavailable = input(undefined, ...(ngDevMode ? [{ debugName: "isDateUnavailable" }] : []));
|
|
117
|
+
this.isDateUnavailable = input(undefined, ...(ngDevMode ? [{ debugName: "isDateUnavailable" }] : /* istanbul ignore next */ []));
|
|
113
118
|
/**
|
|
114
119
|
* The hour cycle to use for formatting times. Defaults to the locale preference
|
|
115
120
|
*/
|
|
116
|
-
this.hourCycle = input(...(ngDevMode ? [undefined, { debugName: "hourCycle" }] : []));
|
|
121
|
+
this.hourCycle = input(...(ngDevMode ? [undefined, { debugName: "hourCycle" }] : /* istanbul ignore next */ []));
|
|
117
122
|
/**
|
|
118
123
|
* The granularity to use for formatting the field. Defaults to 'day' if a CalendarDate is provided, otherwise defaults to 'minute'.
|
|
119
124
|
* The field will render segments for each part of the date up to and including the specified granularity.
|
|
120
125
|
*/
|
|
121
|
-
this.granularity = input(...(ngDevMode ? [undefined, { debugName: "granularity" }] : []));
|
|
126
|
+
this.granularity = input(...(ngDevMode ? [undefined, { debugName: "granularity" }] : /* istanbul ignore next */ []));
|
|
122
127
|
/**
|
|
123
128
|
* The locale to use for formatting dates.
|
|
124
129
|
*/
|
|
125
|
-
this.locale = input('en', ...(ngDevMode ? [{ debugName: "locale" }] : []));
|
|
126
|
-
this.dir = input('ltr', ...(ngDevMode ? [{ debugName: "dir" }] : []));
|
|
130
|
+
this.locale = input('en', ...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
131
|
+
this.dir = input('ltr', ...(ngDevMode ? [{ debugName: "dir" }] : /* istanbul ignore next */ []));
|
|
127
132
|
/**
|
|
128
133
|
* The minimum valid date that can be entered.
|
|
129
134
|
*/
|
|
130
|
-
this.minValue = input(...(ngDevMode ? [undefined, { debugName: "minValue" }] : []));
|
|
135
|
+
this.minValue = input(...(ngDevMode ? [undefined, { debugName: "minValue" }] : /* istanbul ignore next */ []));
|
|
131
136
|
/**
|
|
132
137
|
* The maximum valid date that can be entered.
|
|
133
138
|
*/
|
|
134
|
-
this.maxValue = input(...(ngDevMode ? [undefined, { debugName: "maxValue" }] : []));
|
|
139
|
+
this.maxValue = input(...(ngDevMode ? [undefined, { debugName: "maxValue" }] : /* istanbul ignore next */ []));
|
|
135
140
|
/**
|
|
136
141
|
* Whether or not to hide the time zone segment of the field.
|
|
137
142
|
*/
|
|
138
|
-
this.hideTimeZone = input(false, ...(ngDevMode ?
|
|
139
|
-
this.disabled = input(false, ...(ngDevMode ?
|
|
143
|
+
this.hideTimeZone = input(false, { ...(ngDevMode ? { debugName: "hideTimeZone" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
144
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
140
145
|
/**
|
|
141
146
|
* Whether or not the field is readonly.
|
|
142
147
|
*/
|
|
143
|
-
this.readonly = input(false, ...(ngDevMode ?
|
|
148
|
+
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
144
149
|
/**
|
|
145
150
|
* The stepping interval for the time fields. Defaults to 1
|
|
146
151
|
*/
|
|
147
|
-
this.step = input(...(ngDevMode ? [undefined, { debugName: "step" }] : []));
|
|
148
|
-
this.step$ = computed(() => normalizeDateStep(this.step()), ...(ngDevMode ? [{ debugName: "step$" }] : []));
|
|
152
|
+
this.step = input(...(ngDevMode ? [undefined, { debugName: "step" }] : /* istanbul ignore next */ []));
|
|
153
|
+
this.step$ = computed(() => normalizeDateStep(this.step()), ...(ngDevMode ? [{ debugName: "step$" }] : /* istanbul ignore next */ []));
|
|
154
|
+
/**
|
|
155
|
+
* Locale- and hour-cycle-aware formatter. Recomputed whenever `locale` or
|
|
156
|
+
* `hourCycle` change so segments always render with the current settings.
|
|
157
|
+
* @ignore
|
|
158
|
+
*/
|
|
159
|
+
this.formatter = computed(() => createFormatter(this.locale(), {
|
|
160
|
+
hourCycle: normalizeHourCycle(this.hourCycle())
|
|
161
|
+
}), ...(ngDevMode ? [{ debugName: "formatter" }] : /* istanbul ignore next */ []));
|
|
149
162
|
/**
|
|
150
163
|
* @ignore
|
|
151
164
|
*/
|
|
@@ -154,32 +167,30 @@ class RdxDateFieldRootDirective {
|
|
|
154
167
|
granularity: this.granularity(),
|
|
155
168
|
defaultValue: this.value(),
|
|
156
169
|
locale: this.locale()
|
|
157
|
-
}), ...(ngDevMode ? [{ debugName: "defaultDate" }] : []));
|
|
170
|
+
}), ...(ngDevMode ? [{ debugName: "defaultDate" }] : /* istanbul ignore next */ []));
|
|
158
171
|
/**
|
|
159
172
|
* The placeholder date, which is used to determine what month to display when no date is selected. This updates as the user navigates the calendar and can be used to programmatically control the calendar view
|
|
160
173
|
*/
|
|
161
|
-
this.placeholder = model(this.defaultDate().copy(), ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
174
|
+
this.placeholder = model(this.defaultDate().copy(), ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
162
175
|
// Internal state
|
|
163
176
|
/**
|
|
177
|
+
* Segment input parts, collected from the projected content in DOM order. This
|
|
178
|
+
* stays in sync with `segmentContents()` (granularity / locale / value changes
|
|
179
|
+
* add or remove segments) instead of being captured once after view init.
|
|
164
180
|
* @ignore
|
|
165
181
|
*/
|
|
166
|
-
this.
|
|
182
|
+
this.segmentInputs = contentChildren(RdxDateFieldInputDirective, ...(ngDevMode ? [{ debugName: "segmentInputs" }] : /* istanbul ignore next */ []));
|
|
167
183
|
/**
|
|
184
|
+
* The focusable (non-literal) segment elements, in DOM order.
|
|
168
185
|
* @ignore
|
|
169
186
|
*/
|
|
170
|
-
this.
|
|
187
|
+
this.segmentElements = computed(() => this.segmentInputs()
|
|
188
|
+
.filter((seg) => seg.part() !== 'literal')
|
|
189
|
+
.map((seg) => seg.element), ...(ngDevMode ? [{ debugName: "segmentElements" }] : /* istanbul ignore next */ []));
|
|
171
190
|
/**
|
|
172
191
|
* @ignore
|
|
173
192
|
*/
|
|
174
|
-
this.
|
|
175
|
-
year: null,
|
|
176
|
-
month: null,
|
|
177
|
-
day: null,
|
|
178
|
-
hour: null,
|
|
179
|
-
minute: null,
|
|
180
|
-
second: null,
|
|
181
|
-
dayPeriod: null
|
|
182
|
-
}, ...(ngDevMode ? [{ debugName: "segmentValues" }] : []));
|
|
193
|
+
this.currentFocusedElement = signal(null, ...(ngDevMode ? [{ debugName: "currentFocusedElement" }] : /* istanbul ignore next */ []));
|
|
183
194
|
/**
|
|
184
195
|
* @ignore
|
|
185
196
|
*/
|
|
@@ -188,7 +199,20 @@ class RdxDateFieldRootDirective {
|
|
|
188
199
|
if (this.granularity())
|
|
189
200
|
return placeholder && !hasTime(placeholder) ? 'day' : this.granularity();
|
|
190
201
|
return placeholder && hasTime(placeholder) ? 'minute' : 'day';
|
|
191
|
-
}, ...(ngDevMode ? [{ debugName: "inferredGranularity" }] : []));
|
|
202
|
+
}, ...(ngDevMode ? [{ debugName: "inferredGranularity" }] : /* istanbul ignore next */ []));
|
|
203
|
+
/**
|
|
204
|
+
* The per-segment values. Writable so segment editing (via `useDateField`) can
|
|
205
|
+
* update individual parts, but re-synced from the model whenever the value,
|
|
206
|
+
* granularity or formatter change — so a controlled `value` set after init is
|
|
207
|
+
* reflected, and an empty field re-initializes when granularity changes.
|
|
208
|
+
* @ignore
|
|
209
|
+
*/
|
|
210
|
+
this.segmentValues = linkedSignal({ ...(ngDevMode ? { debugName: "segmentValues" } : /* istanbul ignore next */ {}), source: () => ({
|
|
211
|
+
value: this.value(),
|
|
212
|
+
granularity: this.inferredGranularity(),
|
|
213
|
+
formatter: this.formatter()
|
|
214
|
+
}),
|
|
215
|
+
computation: ({ value, granularity, formatter }) => value ? { ...syncSegmentValues({ value, formatter }) } : { ...initializeSegmentValues(granularity) } });
|
|
192
216
|
/**
|
|
193
217
|
* @ignore
|
|
194
218
|
*/
|
|
@@ -202,50 +226,51 @@ class RdxDateFieldRootDirective {
|
|
|
202
226
|
if (this.maxValue() && isBefore(this.maxValue(), this.value()))
|
|
203
227
|
return true;
|
|
204
228
|
return false;
|
|
205
|
-
}, ...(ngDevMode ? [{ debugName: "isInvalid" }] : []));
|
|
229
|
+
}, ...(ngDevMode ? [{ debugName: "isInvalid" }] : /* istanbul ignore next */ []));
|
|
206
230
|
/**
|
|
207
231
|
* @ignore
|
|
208
232
|
*/
|
|
209
233
|
this.allSegmentContent = computed(() => createContent({
|
|
210
234
|
granularity: this.inferredGranularity(),
|
|
211
235
|
dateRef: this.placeholder(),
|
|
212
|
-
formatter: this.formatter,
|
|
236
|
+
formatter: this.formatter(),
|
|
213
237
|
hideTimeZone: this.hideTimeZone(),
|
|
214
238
|
hourCycle: this.hourCycle(),
|
|
215
239
|
segmentValues: this.segmentValues(),
|
|
216
240
|
locale: this.locale
|
|
217
|
-
}), ...(ngDevMode ? [{ debugName: "allSegmentContent" }] : []));
|
|
241
|
+
}), ...(ngDevMode ? [{ debugName: "allSegmentContent" }] : /* istanbul ignore next */ []));
|
|
218
242
|
/**
|
|
219
243
|
* An array of segments that should be readonly, which prevent user input on them.
|
|
220
244
|
*/
|
|
221
|
-
this.segmentContents = computed(() => this.allSegmentContent().arr, ...(ngDevMode ? [{ debugName: "segmentContents" }] : []));
|
|
245
|
+
this.segmentContents = computed(() => this.allSegmentContent().arr, ...(ngDevMode ? [{ debugName: "segmentContents" }] : /* istanbul ignore next */ []));
|
|
222
246
|
/**
|
|
223
247
|
* @ignore
|
|
224
248
|
*/
|
|
225
|
-
this.currentSegmentIndex = computed(() =>
|
|
226
|
-
this.currentFocusedElement()?.getAttribute('data-rdx-date-field-segment')), ...(ngDevMode ? [{ debugName: "currentSegmentIndex" }] : []));
|
|
249
|
+
this.currentSegmentIndex = computed(() => this.segmentElements().findIndex((el) => el === this.currentFocusedElement()), ...(ngDevMode ? [{ debugName: "currentSegmentIndex" }] : /* istanbul ignore next */ []));
|
|
227
250
|
/**
|
|
228
251
|
* @ignore
|
|
229
252
|
*/
|
|
230
253
|
this.prevFocusableSegment = computed(() => {
|
|
231
254
|
const sign = this.dir() === 'rtl' ? -1 : 1;
|
|
232
|
-
const
|
|
255
|
+
const elements = this.segmentElements();
|
|
256
|
+
const index = this.currentSegmentIndex();
|
|
257
|
+
const prevCondition = sign > 0 ? index < 0 : index > elements.length - 1;
|
|
233
258
|
if (prevCondition)
|
|
234
259
|
return null;
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}, ...(ngDevMode ? [{ debugName: "prevFocusableSegment" }] : []));
|
|
260
|
+
return elements[index - sign];
|
|
261
|
+
}, ...(ngDevMode ? [{ debugName: "prevFocusableSegment" }] : /* istanbul ignore next */ []));
|
|
238
262
|
/**
|
|
239
263
|
* @ignore
|
|
240
264
|
*/
|
|
241
265
|
this.nextFocusableSegment = computed(() => {
|
|
242
266
|
const sign = this.dir() === 'rtl' ? -1 : 1;
|
|
243
|
-
const
|
|
267
|
+
const elements = this.segmentElements();
|
|
268
|
+
const index = this.currentSegmentIndex();
|
|
269
|
+
const nextCondition = sign < 0 ? index < 0 : index > elements.length - 1;
|
|
244
270
|
if (nextCondition)
|
|
245
271
|
return null;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}, ...(ngDevMode ? [{ debugName: "nextFocusableSegment" }] : []));
|
|
272
|
+
return elements[index + sign];
|
|
273
|
+
}, ...(ngDevMode ? [{ debugName: "nextFocusableSegment" }] : /* istanbul ignore next */ []));
|
|
249
274
|
/**
|
|
250
275
|
* @ignore
|
|
251
276
|
*/
|
|
@@ -258,32 +283,14 @@ class RdxDateFieldRootDirective {
|
|
|
258
283
|
}
|
|
259
284
|
});
|
|
260
285
|
}
|
|
261
|
-
ngOnInit() {
|
|
262
|
-
const defDate = getDefaultDate({
|
|
263
|
-
defaultPlaceholder: undefined,
|
|
264
|
-
granularity: this.granularity(),
|
|
265
|
-
defaultValue: this.value(),
|
|
266
|
-
locale: this.locale()
|
|
267
|
-
});
|
|
268
|
-
this.placeholder.set(defDate.copy());
|
|
269
|
-
this.formatter = createFormatter(this.locale(), {
|
|
270
|
-
hourCycle: normalizeHourCycle(this.hourCycle())
|
|
271
|
-
});
|
|
272
|
-
const initialSegments = initializeSegmentValues(this.inferredGranularity());
|
|
273
|
-
this.segmentValues.set(this.value()
|
|
274
|
-
? { ...syncSegmentValues({ value: this.value(), formatter: this.formatter }) }
|
|
275
|
-
: { ...initialSegments });
|
|
276
|
-
}
|
|
277
|
-
ngAfterViewInit() {
|
|
278
|
-
getSegmentElements(this.elementRef.nativeElement).forEach((item) => this.segmentElements().add(item));
|
|
279
|
-
}
|
|
280
286
|
/**
|
|
281
287
|
* @ignore
|
|
282
288
|
*/
|
|
283
289
|
onKeydown(event) {
|
|
284
|
-
const
|
|
290
|
+
const keyEvent = event;
|
|
291
|
+
const code = keyEvent.code;
|
|
285
292
|
if ([ARROW_LEFT, ARROW_RIGHT].includes(code)) {
|
|
286
|
-
if (!isSegmentNavigationKey(
|
|
293
|
+
if (!isSegmentNavigationKey(keyEvent.key))
|
|
287
294
|
return;
|
|
288
295
|
if (code === ARROW_LEFT) {
|
|
289
296
|
this.prevFocusableSegment()?.focus();
|
|
@@ -299,10 +306,10 @@ class RdxDateFieldRootDirective {
|
|
|
299
306
|
setFocusedElement(el) {
|
|
300
307
|
this.currentFocusedElement.set(el);
|
|
301
308
|
}
|
|
302
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
303
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.
|
|
309
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxDateFieldRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
310
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.9", type: RdxDateFieldRootDirective, isStandalone: true, selector: "[rdxDateFieldRoot]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, isDateUnavailable: { classPropertyName: "isDateUnavailable", publicName: "isDateUnavailable", isSignal: true, isRequired: false, transformFunction: null }, hourCycle: { classPropertyName: "hourCycle", publicName: "hourCycle", isSignal: true, isRequired: false, transformFunction: null }, granularity: { classPropertyName: "granularity", publicName: "granularity", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, dir: { classPropertyName: "dir", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, minValue: { classPropertyName: "minValue", publicName: "minValue", isSignal: true, isRequired: false, transformFunction: null }, maxValue: { classPropertyName: "maxValue", publicName: "maxValue", isSignal: true, isRequired: false, transformFunction: null }, hideTimeZone: { classPropertyName: "hideTimeZone", publicName: "hideTimeZone", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", placeholder: "placeholderChange" }, host: { attributes: { "role": "group" }, listeners: { "keydown": "onKeydown($event)" }, properties: { "attr.aria-disabled": "disabled() ? \"\" : undefined", "attr.data-disabled": "disabled() ? \"\" : undefined", "attr.data-readonly": "readonly() ? \"\" : undefined", "attr.data-invalid": "isInvalid() ? \"\" : undefined", "attr.dir": "dir()" } }, providers: [provideToken(DATE_FIELDS_ROOT_CONTEXT, RdxDateFieldRootDirective)], queries: [{ propertyName: "segmentInputs", predicate: RdxDateFieldInputDirective, isSignal: true }], exportAs: ["rdxDateFieldRoot"], ngImport: i0 }); }
|
|
304
311
|
}
|
|
305
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
312
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxDateFieldRootDirective, decorators: [{
|
|
306
313
|
type: Directive,
|
|
307
314
|
args: [{
|
|
308
315
|
selector: '[rdxDateFieldRoot]',
|
|
@@ -318,15 +325,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
|
|
|
318
325
|
'(keydown)': 'onKeydown($event)'
|
|
319
326
|
}
|
|
320
327
|
}]
|
|
321
|
-
}], ctorParameters: () => [] });
|
|
328
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], isDateUnavailable: [{ type: i0.Input, args: [{ isSignal: true, alias: "isDateUnavailable", required: false }] }], hourCycle: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourCycle", required: false }] }], granularity: [{ type: i0.Input, args: [{ isSignal: true, alias: "granularity", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], dir: [{ type: i0.Input, args: [{ isSignal: true, alias: "dir", required: false }] }], minValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "minValue", required: false }] }], maxValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxValue", required: false }] }], hideTimeZone: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideTimeZone", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }, { type: i0.Output, args: ["placeholderChange"] }], segmentInputs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => RdxDateFieldInputDirective), { isSignal: true }] }] } });
|
|
322
329
|
|
|
323
330
|
const _imports = [RdxDateFieldRootDirective, RdxDateFieldInputDirective];
|
|
324
331
|
class RdxDateFieldModule {
|
|
325
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
326
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
327
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
332
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxDateFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
333
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: RdxDateFieldModule, imports: [RdxDateFieldRootDirective, RdxDateFieldInputDirective], exports: [RdxDateFieldRootDirective, RdxDateFieldInputDirective] }); }
|
|
334
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxDateFieldModule }); }
|
|
328
335
|
}
|
|
329
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
336
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxDateFieldModule, decorators: [{
|
|
330
337
|
type: NgModule,
|
|
331
338
|
args: [{
|
|
332
339
|
imports: [..._imports],
|