@radix-ng/primitives 0.51.0 → 1.0.0-beta.1
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/fesm2022/radix-ng-primitives-accordion.mjs +105 -38
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs +221 -129
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-arrow.mjs +20 -4
- package/fesm2022/radix-ng-primitives-arrow.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-aspect-ratio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-avatar.mjs +54 -61
- 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 +95 -83
- package/fesm2022/radix-ng-primitives-calendar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs +378 -54
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collapsible.mjs +182 -81
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collection.mjs +40 -57
- package/fesm2022/radix-ng-primitives-collection.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-config.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-context-menu.mjs +140 -424
- package/fesm2022/radix-ng-primitives-context-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-core.mjs +845 -744
- package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-cropper.mjs +288 -308
- package/fesm2022/radix-ng-primitives-cropper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-date-field.mjs +104 -58
- package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dialog.mjs +655 -327
- package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dismissable-layer.mjs +70 -46
- package/fesm2022/radix-ng-primitives-dismissable-layer.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-drawer.mjs +960 -0
- package/fesm2022/radix-ng-primitives-drawer.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-editable.mjs +304 -23
- 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-scope.mjs +23 -8
- 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 +6 -6
- package/fesm2022/radix-ng-primitives-label.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menu.mjs +1907 -363
- 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 +1052 -1553
- package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-number-field.mjs +1102 -367
- package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-pagination.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popover.mjs +978 -989
- package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popper.mjs +111 -44
- package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-portal.mjs +34 -10
- 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 +223 -84
- package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +191 -51
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-roving-focus.mjs +96 -50
- package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-scroll-area.mjs +923 -0
- package/fesm2022/radix-ng-primitives-scroll-area.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-select.mjs +791 -509
- package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-separator.mjs +12 -35
- package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-slider.mjs +969 -717
- package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-stepper.mjs +15 -19
- package/fesm2022/radix-ng-primitives-stepper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +125 -113
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tabs.mjs +390 -108
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-time-field.mjs +55 -46
- package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toast.mjs +839 -0
- package/fesm2022/radix-ng-primitives-toast.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +121 -247
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +98 -61
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toolbar.mjs +303 -92
- package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tooltip.mjs +699 -1072
- package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-visually-hidden.mjs +25 -66
- package/fesm2022/radix-ng-primitives-visually-hidden.mjs.map +1 -1
- package/meter/README.md +3 -0
- package/navigation-menu/README.md +2 -1
- package/package.json +39 -18
- 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/types/radix-ng-primitives-accordion.d.ts +51 -16
- package/types/radix-ng-primitives-alert-dialog.d.ts +95 -38
- package/types/radix-ng-primitives-arrow.d.ts +1 -1
- package/types/radix-ng-primitives-aspect-ratio.d.ts +1 -1
- package/types/radix-ng-primitives-avatar.d.ts +7 -11
- package/types/radix-ng-primitives-button.d.ts +73 -0
- package/types/radix-ng-primitives-calendar.d.ts +39 -20
- package/types/radix-ng-primitives-checkbox.d.ts +204 -35
- package/types/radix-ng-primitives-collapsible.d.ts +114 -40
- package/types/radix-ng-primitives-collection.d.ts +38 -34
- package/types/radix-ng-primitives-config.d.ts +1 -1
- package/types/radix-ng-primitives-context-menu.d.ts +61 -116
- package/types/radix-ng-primitives-core.d.ts +345 -235
- package/types/radix-ng-primitives-cropper.d.ts +89 -56
- package/types/radix-ng-primitives-date-field.d.ts +49 -28
- package/types/radix-ng-primitives-dialog.d.ts +283 -165
- package/types/radix-ng-primitives-dismissable-layer.d.ts +15 -7
- package/types/radix-ng-primitives-drawer.d.ts +426 -0
- package/types/radix-ng-primitives-editable.d.ts +91 -14
- package/types/radix-ng-primitives-field.d.ts +374 -0
- package/types/radix-ng-primitives-fieldset.d.ts +49 -0
- package/types/radix-ng-primitives-focus-scope.d.ts +15 -6
- package/types/radix-ng-primitives-input.d.ts +87 -0
- package/types/radix-ng-primitives-label.d.ts +0 -1
- package/types/radix-ng-primitives-menu.d.ts +584 -99
- package/types/radix-ng-primitives-menubar.d.ts +61 -50
- package/types/radix-ng-primitives-meter.d.ts +194 -0
- package/types/radix-ng-primitives-navigation-menu.d.ts +422 -340
- package/types/radix-ng-primitives-number-field.d.ts +405 -145
- package/types/radix-ng-primitives-pagination.d.ts +2 -2
- package/types/radix-ng-primitives-popover.d.ts +366 -351
- package/types/radix-ng-primitives-popper.d.ts +68 -11
- package/types/radix-ng-primitives-portal.d.ts +14 -6
- package/types/radix-ng-primitives-presence.d.ts +28 -76
- package/types/radix-ng-primitives-preview-card.d.ts +359 -0
- package/types/radix-ng-primitives-progress.d.ts +175 -48
- package/types/radix-ng-primitives-radio.d.ts +55 -25
- package/types/radix-ng-primitives-roving-focus.d.ts +33 -23
- package/types/radix-ng-primitives-scroll-area.d.ts +253 -0
- package/types/radix-ng-primitives-select.d.ts +475 -177
- package/types/radix-ng-primitives-separator.d.ts +7 -32
- package/types/radix-ng-primitives-slider.d.ts +315 -201
- package/types/radix-ng-primitives-stepper.d.ts +5 -7
- package/types/radix-ng-primitives-switch.d.ts +86 -71
- package/types/radix-ng-primitives-tabs.d.ts +213 -79
- package/types/radix-ng-primitives-time-field.d.ts +42 -27
- package/types/radix-ng-primitives-toast.d.ts +378 -0
- package/types/radix-ng-primitives-toggle-group.d.ts +86 -164
- package/types/radix-ng-primitives-toggle.d.ts +43 -53
- package/types/radix-ng-primitives-toolbar.d.ts +164 -38
- package/types/radix-ng-primitives-tooltip.d.ts +348 -384
- package/types/radix-ng-primitives-visually-hidden.d.ts +19 -19
- package/dropdown-menu/README.md +0 -1
- package/fesm2022/radix-ng-primitives-dropdown-menu.mjs +0 -581
- package/fesm2022/radix-ng-primitives-dropdown-menu.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-hover-card.mjs +0 -1238
- package/fesm2022/radix-ng-primitives-hover-card.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-select2.mjs +0 -897
- package/fesm2022/radix-ng-primitives-select2.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-tooltip2.mjs +0 -735
- package/fesm2022/radix-ng-primitives-tooltip2.mjs.map +0 -1
- package/hover-card/README.md +0 -3
- package/select2/README.md +0 -3
- package/tooltip2/README.md +0 -3
- package/types/radix-ng-primitives-dropdown-menu.d.ts +0 -171
- package/types/radix-ng-primitives-hover-card.d.ts +0 -471
- package/types/radix-ng-primitives-select2.d.ts +0 -511
- package/types/radix-ng-primitives-tooltip2.d.ts +0 -325
|
@@ -35,14 +35,14 @@ class RdxCalendarCellTriggerDirective {
|
|
|
35
35
|
* Current selected state
|
|
36
36
|
*/
|
|
37
37
|
this.isSelectedDate = computed(() => this.rootContext.isDateSelected(this.day()), ...(ngDevMode ? [{ debugName: "isSelectedDate" }] : /* istanbul ignore next */ []));
|
|
38
|
-
this.isDisabled = computed(() => this.rootContext.
|
|
38
|
+
this.isDisabled = computed(() => this.rootContext.dateDisabled(this.day()), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
39
39
|
this.isOutsideView = computed(() => {
|
|
40
40
|
return !isSameMonth(this.day(), this.month());
|
|
41
41
|
}, ...(ngDevMode ? [{ debugName: "isOutsideView" }] : /* istanbul ignore next */ []));
|
|
42
42
|
this.isFocusedDate = computed(() => {
|
|
43
43
|
return !this.rootContext.disabled() && isSameDay(this.day(), this.rootContext.placeholder());
|
|
44
44
|
}, ...(ngDevMode ? [{ debugName: "isFocusedDate" }] : /* istanbul ignore next */ []));
|
|
45
|
-
this.isUnavailable = computed(() => this.rootContext.
|
|
45
|
+
this.isUnavailable = computed(() => this.rootContext.dateUnavailable(this.day()), ...(ngDevMode ? [{ debugName: "isUnavailable" }] : /* istanbul ignore next */ []));
|
|
46
46
|
this.labelText = computed(() => {
|
|
47
47
|
return this.rootContext.formatter.custom(toDate(this.day()), {
|
|
48
48
|
weekday: 'long',
|
|
@@ -55,12 +55,21 @@ class RdxCalendarCellTriggerDirective {
|
|
|
55
55
|
* @ignore
|
|
56
56
|
*/
|
|
57
57
|
this.SELECTOR = '[data-rdx-calendar-cell-trigger]:not([data-outside-view]):not([data-outside-visible-view])';
|
|
58
|
-
|
|
59
|
-
ngAfterViewInit() {
|
|
58
|
+
// Host element is available in the constructor; no AfterViewInit needed.
|
|
60
59
|
this.currentElement = this.elementRef.nativeElement;
|
|
61
60
|
}
|
|
62
61
|
onClick() {
|
|
63
|
-
this.
|
|
62
|
+
this.select();
|
|
63
|
+
}
|
|
64
|
+
/** Select the date unless the cell is disabled/unavailable or the calendar is readonly. */
|
|
65
|
+
select() {
|
|
66
|
+
if (this.isDisabled() || this.isUnavailable() || this.rootContext.readonly()) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const day = this.day();
|
|
70
|
+
if (day) {
|
|
71
|
+
this.changeDate(day);
|
|
72
|
+
}
|
|
64
73
|
}
|
|
65
74
|
onArrowKey(event) {
|
|
66
75
|
const keyEvent = event;
|
|
@@ -87,7 +96,7 @@ class RdxCalendarCellTriggerDirective {
|
|
|
87
96
|
break;
|
|
88
97
|
case kbd.ENTER:
|
|
89
98
|
case kbd.SPACE_CODE:
|
|
90
|
-
this.
|
|
99
|
+
this.select();
|
|
91
100
|
}
|
|
92
101
|
}
|
|
93
102
|
shiftFocus(node, add) {
|
|
@@ -98,10 +107,7 @@ class RdxCalendarCellTriggerDirective {
|
|
|
98
107
|
const index = allCollectionItems.indexOf(node);
|
|
99
108
|
const newIndex = index + add;
|
|
100
109
|
if (newIndex >= 0 && newIndex < allCollectionItems.length) {
|
|
101
|
-
|
|
102
|
-
this.shiftFocus(allCollectionItems[newIndex], add);
|
|
103
|
-
}
|
|
104
|
-
allCollectionItems[newIndex].focus();
|
|
110
|
+
this.focusCell(allCollectionItems, newIndex, add);
|
|
105
111
|
return;
|
|
106
112
|
}
|
|
107
113
|
if (newIndex < 0) {
|
|
@@ -109,50 +115,46 @@ class RdxCalendarCellTriggerDirective {
|
|
|
109
115
|
return;
|
|
110
116
|
this.rootContext.prevPage();
|
|
111
117
|
setTimeout(() => {
|
|
112
|
-
const
|
|
113
|
-
if (!
|
|
118
|
+
const cells = this.getSelectableCells(parentElement);
|
|
119
|
+
if (!cells.length)
|
|
114
120
|
return;
|
|
115
|
-
|
|
116
|
-
//
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
this.shiftFocus(newCollectionItems[computedIndex], add);
|
|
121
|
-
}
|
|
122
|
-
newCollectionItems[computedIndex].focus();
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const computedIndex = newCollectionItems.length - Math.abs(newIndex);
|
|
126
|
-
if (newCollectionItems[computedIndex].hasAttribute('data-disabled')) {
|
|
127
|
-
this.shiftFocus(newCollectionItems[computedIndex], add);
|
|
128
|
-
}
|
|
129
|
-
newCollectionItems[computedIndex].focus();
|
|
121
|
+
const computedIndex = !this.rootContext.pagedNavigation() && this.rootContext.numberOfMonths() > 1
|
|
122
|
+
? // placeholder is the first month of the new page
|
|
123
|
+
getDaysInMonth(this.rootContext.placeholder()) - Math.abs(newIndex)
|
|
124
|
+
: cells.length - Math.abs(newIndex);
|
|
125
|
+
this.focusCell(cells, computedIndex, add);
|
|
130
126
|
});
|
|
127
|
+
return;
|
|
131
128
|
}
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
// newIndex >= allCollectionItems.length
|
|
130
|
+
if (!this.rootContext.nextPage)
|
|
131
|
+
return;
|
|
132
|
+
this.rootContext.nextPage();
|
|
133
|
+
setTimeout(() => {
|
|
134
|
+
const cells = this.getSelectableCells(parentElement);
|
|
135
|
+
if (!cells.length)
|
|
134
136
|
return;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
});
|
|
137
|
+
let computedIndex;
|
|
138
|
+
if (!this.rootContext.pagedNavigation() && this.rootContext.numberOfMonths() > 1) {
|
|
139
|
+
const numberOfDays = getDaysInMonth(this.rootContext.placeholder().add({ months: this.rootContext.numberOfMonths() - 1 }));
|
|
140
|
+
computedIndex = newIndex - allCollectionItems.length + (cells.length - numberOfDays);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
computedIndex = newIndex - allCollectionItems.length;
|
|
144
|
+
}
|
|
145
|
+
this.focusCell(cells, computedIndex, add);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/** Focus the cell at `index`, skipping over a disabled cell in the same direction. */
|
|
149
|
+
focusCell(cells, index, add) {
|
|
150
|
+
const cell = cells[index];
|
|
151
|
+
if (!cell)
|
|
152
|
+
return;
|
|
153
|
+
if (cell.hasAttribute('data-disabled')) {
|
|
154
|
+
this.shiftFocus(cell, add);
|
|
155
|
+
return;
|
|
155
156
|
}
|
|
157
|
+
cell.focus();
|
|
156
158
|
}
|
|
157
159
|
/**
|
|
158
160
|
* @ignore
|
|
@@ -191,7 +193,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
191
193
|
'(keydown)': 'onArrowKey($event)'
|
|
192
194
|
}
|
|
193
195
|
}]
|
|
194
|
-
}], propDecorators: { day: [{ type: i0.Input, args: [{ isSignal: true, alias: "day", required: false }] }], month: [{ type: i0.Input, args: [{ isSignal: true, alias: "month", required: false }] }] } });
|
|
196
|
+
}], ctorParameters: () => [], propDecorators: { day: [{ type: i0.Input, args: [{ isSignal: true, alias: "day", required: false }] }], month: [{ type: i0.Input, args: [{ isSignal: true, alias: "month", required: false }] }] } });
|
|
195
197
|
|
|
196
198
|
class RdxCalendarCellDirective {
|
|
197
199
|
constructor() {
|
|
@@ -202,7 +204,7 @@ class RdxCalendarCellDirective {
|
|
|
202
204
|
this.date = input(...(ngDevMode ? [undefined, { debugName: "date" }] : /* istanbul ignore next */ []));
|
|
203
205
|
}
|
|
204
206
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCalendarCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
205
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxCalendarCellDirective, isStandalone: true, selector: "td[rdxCalendarCell]", inputs: { date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "gridcell" }, properties: { "attr.aria-selected": "rootContext.isDateSelected
|
|
207
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxCalendarCellDirective, isStandalone: true, selector: "td[rdxCalendarCell]", inputs: { date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "gridcell" }, properties: { "attr.aria-selected": "rootContext.isDateSelected(date()!) ? true : undefined", "attr.aria-disabled": "rootContext.dateDisabled(date()!) || rootContext.dateUnavailable(date()!) ? true : undefined", "attr.data-disabled": "rootContext.dateDisabled(date()!) ? \"\" : undefined" } }, ngImport: i0 }); }
|
|
206
208
|
}
|
|
207
209
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCalendarCellDirective, decorators: [{
|
|
208
210
|
type: Directive,
|
|
@@ -210,9 +212,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
210
212
|
selector: 'td[rdxCalendarCell]',
|
|
211
213
|
host: {
|
|
212
214
|
role: 'gridcell',
|
|
213
|
-
'[attr.aria-selected]': 'rootContext.isDateSelected
|
|
214
|
-
'[attr.aria-disabled]': 'rootContext.
|
|
215
|
-
'[attr.data-disabled]': 'rootContext.
|
|
215
|
+
'[attr.aria-selected]': 'rootContext.isDateSelected(date()!) ? true : undefined',
|
|
216
|
+
'[attr.aria-disabled]': 'rootContext.dateDisabled(date()!) || rootContext.dateUnavailable(date()!) ? true : undefined',
|
|
217
|
+
'[attr.data-disabled]': 'rootContext.dateDisabled(date()!) ? "" : undefined'
|
|
216
218
|
}
|
|
217
219
|
}]
|
|
218
220
|
}], propDecorators: { date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }] } });
|
|
@@ -257,7 +259,7 @@ class RdxCalendarGridDirective {
|
|
|
257
259
|
constructor() {
|
|
258
260
|
this.rootContext = injectCalendarRootContext();
|
|
259
261
|
this.disabled = computed(() => (this.rootContext.disabled() ? true : undefined), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
260
|
-
this.readonly = computed(() => (this.rootContext.readonly ? true : undefined), ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
262
|
+
this.readonly = computed(() => (this.rootContext.readonly() ? true : undefined), ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
261
263
|
}
|
|
262
264
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCalendarGridDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
263
265
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxCalendarGridDirective, isStandalone: true, selector: "table[rdxCalendarGrid]", host: { attributes: { "tabindex": "-1", "role": "grid" }, properties: { "attr.aria-readonly": "readonly()", "attr.aria-disabled": "disabled()", "attr.data-readonly": "readonly() && \"\"", "attr.data-disabled": "disabled() && \"\"" } }, ngImport: i0 }); }
|
|
@@ -361,7 +363,7 @@ class RdxCalendarPrevDirective {
|
|
|
361
363
|
/**
|
|
362
364
|
* @ignore
|
|
363
365
|
*/
|
|
364
|
-
this.disabled = computed(() => this.rootContext.disabled() || this.rootContext.
|
|
366
|
+
this.disabled = computed(() => this.rootContext.disabled() || this.rootContext.isPrevButtonDisabled(this.prevPage()), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
365
367
|
}
|
|
366
368
|
onClick() {
|
|
367
369
|
this.rootContext.prevPage(this.prevPage());
|
|
@@ -663,16 +665,16 @@ class RdxCalendarRootDirective {
|
|
|
663
665
|
*/
|
|
664
666
|
this.defaultPlaceholder = model(...(ngDevMode ? [undefined, { debugName: "defaultPlaceholder" }] : /* istanbul ignore next */ []));
|
|
665
667
|
this.locale = input('en', ...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
666
|
-
this.defaultDate = getDefaultDate({
|
|
668
|
+
this.defaultDate = computed(() => getDefaultDate({
|
|
667
669
|
defaultPlaceholder: this.defaultPlaceholder(),
|
|
668
670
|
defaultValue: this.value(),
|
|
669
671
|
locale: this.locale()
|
|
670
|
-
});
|
|
672
|
+
}), ...(ngDevMode ? [{ debugName: "defaultDate" }] : /* istanbul ignore next */ []));
|
|
671
673
|
/**
|
|
672
674
|
* The placeholder date, which is used to determine what month to display when no date is selected.
|
|
673
675
|
* This updates as the user navigates the calendar and can be used to programmatically control the calendar view
|
|
674
676
|
*/
|
|
675
|
-
this.placeholder = model(this.defaultPlaceholder() ?? this.defaultDate.copy(), ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
677
|
+
this.placeholder = model(this.defaultPlaceholder() ?? this.defaultDate().copy(), ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
676
678
|
this.multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
677
679
|
/**
|
|
678
680
|
* Whether to always display 6 weeks in the calendar
|
|
@@ -742,14 +744,13 @@ class RdxCalendarRootDirective {
|
|
|
742
744
|
this._disabled = linkedSignal(this.disabled, ...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
|
|
743
745
|
this._pagedNavigation = linkedSignal(this.pagedNavigation, ...(ngDevMode ? [{ debugName: "_pagedNavigation" }] : /* istanbul ignore next */ []));
|
|
744
746
|
this.startingWeekNumber = computed(() => {
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
.map((_, idx) => {
|
|
747
|
+
const months = this.months();
|
|
748
|
+
const firstWeek = months?.[0]?.weeks;
|
|
749
|
+
if (!firstWeek?.length) {
|
|
750
|
+
return [];
|
|
751
|
+
}
|
|
752
|
+
const firstDayOfGrid = startOfWeek(firstWeek[0][0], this.locale());
|
|
753
|
+
return Array.from({ length: firstWeek.length }).map((_, idx) => {
|
|
753
754
|
const firstDayOfWeek = firstDayOfGrid.add({ weeks: idx });
|
|
754
755
|
const thursday = firstDayOfWeek.add({ days: 3 });
|
|
755
756
|
const firstDayOfYear = startOfYear(thursday);
|
|
@@ -759,11 +760,28 @@ class RdxCalendarRootDirective {
|
|
|
759
760
|
/**
|
|
760
761
|
* @ignore
|
|
761
762
|
*/
|
|
762
|
-
this.headingValue =
|
|
763
|
+
this.headingValue = computed(() => this.calendar.headingValue(), ...(ngDevMode ? [{ debugName: "headingValue" }] : /* istanbul ignore next */ []));
|
|
764
|
+
/**
|
|
765
|
+
* @ignore
|
|
766
|
+
*/
|
|
767
|
+
this.fullCalendarLabel = computed(() => this.calendar.fullCalendarLabel(), ...(ngDevMode ? [{ debugName: "fullCalendarLabel" }] : /* istanbul ignore next */ []));
|
|
763
768
|
/**
|
|
769
|
+
* Selection + validity state, recomputed when the value or the matchers change.
|
|
764
770
|
* @ignore
|
|
765
771
|
*/
|
|
766
|
-
this.
|
|
772
|
+
this._state = computed(() => calendarState({
|
|
773
|
+
date: this.value,
|
|
774
|
+
isDateDisabled: this.isDateDisabled(),
|
|
775
|
+
isDateUnavailable: this.isDateUnavailable()
|
|
776
|
+
}), ...(ngDevMode ? [{ debugName: "_state" }] : /* istanbul ignore next */ []));
|
|
777
|
+
/**
|
|
778
|
+
* @ignore
|
|
779
|
+
*/
|
|
780
|
+
this.isDateSelected = (date) => this._state().isDateSelected(date);
|
|
781
|
+
/**
|
|
782
|
+
* @ignore
|
|
783
|
+
*/
|
|
784
|
+
this.isInvalid = computed(() => this._state().isInvalid(), ...(ngDevMode ? [{ debugName: "isInvalid" }] : /* istanbul ignore next */ []));
|
|
767
785
|
this.calendar = calendar({
|
|
768
786
|
locale: this.locale,
|
|
769
787
|
placeholder: this.placeholder,
|
|
@@ -781,24 +799,21 @@ class RdxCalendarRootDirective {
|
|
|
781
799
|
nextPage: this.propsNextPage,
|
|
782
800
|
prevPage: this.propsPrevPage
|
|
783
801
|
});
|
|
802
|
+
// Host element exists in the constructor; no need for AfterViewInit.
|
|
803
|
+
this.currentElement = this.elementRef.nativeElement;
|
|
784
804
|
this.nextPage = this.calendar.nextPage;
|
|
785
805
|
this.prevPage = this.calendar.prevPage;
|
|
786
806
|
this.isOutsideVisibleView = this.calendar.isOutsideVisibleView;
|
|
787
807
|
this.isNextButtonDisabled = this.calendar.isNextButtonDisabled;
|
|
788
808
|
this.isPrevButtonDisabled = this.calendar.isPrevButtonDisabled;
|
|
789
809
|
this.formatter = this.calendar.formatter;
|
|
810
|
+
// Resolved matchers (fold in `disabled`, min/max and the input matchers).
|
|
811
|
+
this.dateDisabled = this.calendar.isDateDisabled;
|
|
812
|
+
this.dateUnavailable = this.calendar.isDateUnavailable;
|
|
813
|
+
// Bridge the composable's grid output into the exposed models.
|
|
790
814
|
effect(() => {
|
|
791
815
|
this.months.set(this.calendar.month());
|
|
792
816
|
this.weekDays.set(this.calendar.weekdays());
|
|
793
|
-
this.fullCalendarLabel.set(this.calendar.fullCalendarLabel());
|
|
794
|
-
this.headingValue.set(this.calendar.headingValue());
|
|
795
|
-
const { isInvalid, isDateSelected } = calendarState({
|
|
796
|
-
date: this.value,
|
|
797
|
-
isDateDisabled: this.isDateDisabled(),
|
|
798
|
-
isDateUnavailable: this.isDateUnavailable()
|
|
799
|
-
});
|
|
800
|
-
this.isDateSelected = isDateSelected;
|
|
801
|
-
this.isInvalid = isInvalid();
|
|
802
817
|
});
|
|
803
818
|
watch([this.value], ([_modelValue]) => {
|
|
804
819
|
if (Array.isArray(_modelValue) && _modelValue.length) {
|
|
@@ -812,9 +827,6 @@ class RdxCalendarRootDirective {
|
|
|
812
827
|
}
|
|
813
828
|
});
|
|
814
829
|
}
|
|
815
|
-
ngAfterViewInit() {
|
|
816
|
-
this.currentElement = this.elementRef.nativeElement;
|
|
817
|
-
}
|
|
818
830
|
/**
|
|
819
831
|
* @ignore
|
|
820
832
|
*/
|
|
@@ -861,7 +873,7 @@ class RdxCalendarRootDirective {
|
|
|
861
873
|
}
|
|
862
874
|
}
|
|
863
875
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCalendarRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
864
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxCalendarRootDirective, isStandalone: true, selector: "[rdxCalendarRoot]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultPlaceholder: { classPropertyName: "defaultPlaceholder", publicName: "defaultPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, fixedWeeks: { classPropertyName: "fixedWeeks", publicName: "fixedWeeks", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, preventDeselect: { classPropertyName: "preventDeselect", publicName: "preventDeselect", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, numberOfMonths: { classPropertyName: "numberOfMonths", publicName: "numberOfMonths", 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 }, weekdayFormat: { classPropertyName: "weekdayFormat", publicName: "weekdayFormat", isSignal: true, isRequired: false, transformFunction: null }, calendarLabel: { classPropertyName: "calendarLabel", publicName: "calendarLabel", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, pagedNavigation: { classPropertyName: "pagedNavigation", publicName: "pagedNavigation", isSignal: true, isRequired: false, transformFunction: null }, propsNextPage: { classPropertyName: "propsNextPage", publicName: "propsNextPage", isSignal: true, isRequired: false, transformFunction: null }, propsPrevPage: { classPropertyName: "propsPrevPage", publicName: "propsPrevPage", isSignal: true, isRequired: false, transformFunction: null }, isDateDisabled: { classPropertyName: "isDateDisabled", publicName: "isDateDisabled", isSignal: true, isRequired: false, transformFunction: null }, isDateUnavailable: { classPropertyName: "isDateUnavailable", publicName: "isDateUnavailable", isSignal: true, isRequired: false, transformFunction: null }, initialFocus: { classPropertyName: "initialFocus", publicName: "initialFocus", isSignal: true, isRequired: false, transformFunction: null }, months: { classPropertyName: "months", publicName: "months", isSignal: true, isRequired: false, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", defaultPlaceholder: "defaultPlaceholderChange", placeholder: "placeholderChange", months: "monthsChange", weekDays: "weekDaysChange" }, host: { attributes: { "role": "application" }, properties: { "attr.aria-label": "fullCalendarLabel()", "attr.data-disabled": "disabled() ? \"\" : undefined", "attr.data-readonly": "readonly() ? \"\" : undefined", "attr.data-invalid": "isInvalid ? \"\" : undefined", "attr.dir": "dir()" } }, providers: [{ provide: CALENDAR_ROOT_CONTEXT, useExisting: forwardRef(() => RdxCalendarRootDirective) }], exportAs: ["rdxCalendarRoot"], ngImport: i0 }); }
|
|
876
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxCalendarRootDirective, isStandalone: true, selector: "[rdxCalendarRoot]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultPlaceholder: { classPropertyName: "defaultPlaceholder", publicName: "defaultPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, fixedWeeks: { classPropertyName: "fixedWeeks", publicName: "fixedWeeks", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, preventDeselect: { classPropertyName: "preventDeselect", publicName: "preventDeselect", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, numberOfMonths: { classPropertyName: "numberOfMonths", publicName: "numberOfMonths", 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 }, weekdayFormat: { classPropertyName: "weekdayFormat", publicName: "weekdayFormat", isSignal: true, isRequired: false, transformFunction: null }, calendarLabel: { classPropertyName: "calendarLabel", publicName: "calendarLabel", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, pagedNavigation: { classPropertyName: "pagedNavigation", publicName: "pagedNavigation", isSignal: true, isRequired: false, transformFunction: null }, propsNextPage: { classPropertyName: "propsNextPage", publicName: "propsNextPage", isSignal: true, isRequired: false, transformFunction: null }, propsPrevPage: { classPropertyName: "propsPrevPage", publicName: "propsPrevPage", isSignal: true, isRequired: false, transformFunction: null }, isDateDisabled: { classPropertyName: "isDateDisabled", publicName: "isDateDisabled", isSignal: true, isRequired: false, transformFunction: null }, isDateUnavailable: { classPropertyName: "isDateUnavailable", publicName: "isDateUnavailable", isSignal: true, isRequired: false, transformFunction: null }, initialFocus: { classPropertyName: "initialFocus", publicName: "initialFocus", isSignal: true, isRequired: false, transformFunction: null }, months: { classPropertyName: "months", publicName: "months", isSignal: true, isRequired: false, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", defaultPlaceholder: "defaultPlaceholderChange", placeholder: "placeholderChange", months: "monthsChange", weekDays: "weekDaysChange" }, host: { attributes: { "role": "application" }, properties: { "attr.aria-label": "fullCalendarLabel()", "attr.data-disabled": "disabled() ? \"\" : undefined", "attr.data-readonly": "readonly() ? \"\" : undefined", "attr.data-invalid": "isInvalid() ? \"\" : undefined", "attr.dir": "dir()" } }, providers: [{ provide: CALENDAR_ROOT_CONTEXT, useExisting: forwardRef(() => RdxCalendarRootDirective) }], exportAs: ["rdxCalendarRoot"], ngImport: i0 }); }
|
|
865
877
|
}
|
|
866
878
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxCalendarRootDirective, decorators: [{
|
|
867
879
|
type: Directive,
|
|
@@ -874,7 +886,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
874
886
|
'[attr.aria-label]': 'fullCalendarLabel()',
|
|
875
887
|
'[attr.data-disabled]': 'disabled() ? "" : undefined',
|
|
876
888
|
'[attr.data-readonly]': 'readonly() ? "" : undefined',
|
|
877
|
-
'[attr.data-invalid]': 'isInvalid ? "" : undefined',
|
|
889
|
+
'[attr.data-invalid]': 'isInvalid() ? "" : undefined',
|
|
878
890
|
'[attr.dir]': 'dir()'
|
|
879
891
|
}
|
|
880
892
|
}]
|