nxt-pick-datetime 13.0.1 → 15.0.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/README.md +130 -147
- package/assets/picker.scss +88 -93
- package/esm2020/lib/class/date-time-adapter.class.mjs +8 -8
- package/esm2020/lib/class/date-time-format.class.mjs +2 -2
- package/esm2020/lib/class/date-time.class.mjs +54 -71
- package/esm2020/lib/class/dialog-config.class.mjs +3 -13
- package/esm2020/lib/class/dialog-ref.class.mjs +9 -10
- package/esm2020/lib/date-time/calendar/calendar.component.mjs +89 -94
- package/esm2020/lib/date-time/calendar-body/calendar-body.component.mjs +32 -28
- package/esm2020/lib/date-time/calendar-month-view/calendar-month-view.component.mjs +71 -80
- package/esm2020/lib/date-time/calendar-multi-year-view/calendar-multi-year-view.component.mjs +57 -63
- package/esm2020/lib/date-time/calendar-year-view/calendar-year-view.component.mjs +57 -68
- package/esm2020/lib/date-time/date-time-inline/date-time-inline.component.mjs +68 -78
- package/esm2020/lib/date-time/date-time-picker/date-time-picker.component.mjs +164 -182
- package/esm2020/lib/date-time/date-time-picker-container/date-time-picker-container.animations.mjs +2 -2
- package/esm2020/lib/date-time/date-time-picker-container/date-time-picker-container.component.mjs +109 -117
- package/esm2020/lib/date-time/date-time-picker-input.directive.mjs +185 -203
- package/esm2020/lib/date-time/date-time-picker-intl.service.mjs +5 -5
- package/esm2020/lib/date-time/date-time-picker-trigger.directive.mjs +20 -19
- package/esm2020/lib/date-time/date-time.module.mjs +79 -71
- package/esm2020/lib/date-time/number-fixed-len.pipe.mjs +9 -13
- package/esm2020/lib/date-time/timer/timer.component.mjs +64 -59
- package/esm2020/lib/date-time/timer-box/timer-box.component.mjs +22 -17
- package/esm2020/lib/dialog/dialog-container/dialog-container.component.mjs +44 -49
- package/esm2020/lib/dialog/dialog.module.mjs +26 -19
- package/esm2020/lib/dialog/dialog.service.mjs +52 -49
- package/esm2020/lib/utils/object.mjs +3 -3
- package/esm2020/moment-adapter/date-time-adapter.class.mjs +17 -16
- package/esm2020/moment-adapter/date-time-format.class.mjs +2 -2
- package/esm2020/moment-adapter/moment-adapter.module.mjs +18 -22
- package/esm2020/moment-adapter/nxt-pick-datetime-moment-adapter.mjs +1 -1
- package/esm2020/moment-adapter/public-api.mjs +2 -2
- package/esm2020/native-adapter/date-time-adapter.class.mjs +13 -13
- package/esm2020/native-adapter/date-time-format.class.mjs +2 -2
- package/esm2020/native-adapter/native-adapter.module.mjs +24 -22
- package/esm2020/native-adapter/nxt-pick-datetime-native-adapter.mjs +1 -1
- package/esm2020/native-adapter/public-api.mjs +2 -2
- package/esm2020/nxt-pick-datetime.mjs +1 -1
- package/esm2020/public-api.mjs +14 -14
- package/fesm2015/nxt-pick-datetime-moment-adapter.mjs +33 -35
- package/fesm2015/nxt-pick-datetime-moment-adapter.mjs.map +1 -1
- package/fesm2015/nxt-pick-datetime-native-adapter.mjs +36 -33
- package/fesm2015/nxt-pick-datetime-native-adapter.mjs.map +1 -1
- package/fesm2015/nxt-pick-datetime.mjs +1234 -1257
- package/fesm2015/nxt-pick-datetime.mjs.map +1 -1
- package/fesm2020/nxt-pick-datetime-moment-adapter.mjs +33 -35
- package/fesm2020/nxt-pick-datetime-moment-adapter.mjs.map +1 -1
- package/fesm2020/nxt-pick-datetime-native-adapter.mjs +36 -33
- package/fesm2020/nxt-pick-datetime-native-adapter.mjs.map +1 -1
- package/fesm2020/nxt-pick-datetime.mjs +1164 -1247
- package/fesm2020/nxt-pick-datetime.mjs.map +1 -1
- package/lib/class/date-time-adapter.class.d.ts +31 -31
- package/lib/class/date-time-format.class.d.ts +2 -2
- package/lib/class/date-time.class.d.ts +24 -23
- package/lib/class/dialog-config.class.d.ts +5 -5
- package/lib/class/dialog-ref.class.d.ts +16 -17
- package/lib/date-time/calendar/calendar.component.d.ts +41 -41
- package/lib/date-time/calendar-body/calendar-body.component.d.ts +11 -11
- package/lib/date-time/calendar-month-view/calendar-month-view.component.d.ts +40 -40
- package/lib/date-time/calendar-multi-year-view/calendar-multi-year-view.component.d.ts +38 -38
- package/lib/date-time/calendar-year-view/calendar-year-view.component.d.ts +36 -36
- package/lib/date-time/date-time-inline/date-time-inline.component.d.ts +38 -40
- package/lib/date-time/date-time-picker/date-time-picker.component.d.ts +51 -53
- package/lib/date-time/date-time-picker-container/date-time-picker-container.animations.d.ts +1 -1
- package/lib/date-time/date-time-picker-container/date-time-picker-container.component.d.ts +38 -39
- package/lib/date-time/date-time-picker-input.directive.d.ts +59 -53
- package/lib/date-time/date-time-picker-intl.service.d.ts +3 -3
- package/lib/date-time/date-time-picker-trigger.directive.d.ts +9 -9
- package/lib/date-time/date-time.module.d.ts +4 -4
- package/lib/date-time/number-fixed-len.pipe.d.ts +2 -2
- package/lib/date-time/timer/timer.component.d.ts +22 -22
- package/lib/date-time/timer-box/timer-box.component.d.ts +10 -10
- package/lib/dialog/dialog-container/dialog-container.component.d.ts +28 -24
- package/lib/dialog/dialog.module.d.ts +4 -4
- package/lib/dialog/dialog.service.d.ts +28 -28
- package/moment-adapter/date-time-adapter.class.d.ts +9 -9
- package/moment-adapter/date-time-format.class.d.ts +2 -2
- package/moment-adapter/moment-adapter.module.d.ts +0 -5
- package/moment-adapter/public-api.d.ts +1 -1
- package/native-adapter/date-time-adapter.class.d.ts +6 -6
- package/native-adapter/date-time-format.class.d.ts +2 -2
- package/native-adapter/native-adapter.module.d.ts +0 -5
- package/native-adapter/public-api.d.ts +1 -1
- package/package.json +17 -15
- package/public-api.d.ts +13 -13
- package/moment-adapter/package.json +0 -10
- package/native-adapter/package.json +0 -10
- /package/{nxt-pick-datetime.d.ts → index.d.ts} +0 -0
- /package/moment-adapter/{nxt-pick-datetime-moment-adapter.d.ts → index.d.ts} +0 -0
- /package/native-adapter/{nxt-pick-datetime-native-adapter.d.ts → index.d.ts} +0 -0
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, LOCALE_ID, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, HostBinding,
|
|
3
|
-
import { Subject,
|
|
2
|
+
import { InjectionToken, inject, LOCALE_ID, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, HostBinding, Inject, ViewChild, Injectable, Directive, Pipe, HostListener, forwardRef, Optional, TemplateRef, Injector, SkipSelf, NgModule } from '@angular/core';
|
|
3
|
+
import { Subject, of, merge, defer } from 'rxjs';
|
|
4
4
|
import { coerceNumberProperty, coerceBooleanProperty, coerceArray } from '@angular/cdk/coercion';
|
|
5
5
|
import { ENTER, PAGE_DOWN, PAGE_UP, END, HOME, DOWN_ARROW, UP_ARROW, RIGHT_ARROW, LEFT_ARROW, SPACE, ESCAPE } from '@angular/cdk/keycodes';
|
|
6
6
|
import { take, debounceTime, distinctUntilChanged, filter, concatAll } from 'rxjs/operators';
|
|
7
|
-
import * as
|
|
8
|
-
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
9
|
-
import * as
|
|
7
|
+
import * as i3 from '@angular/common';
|
|
8
|
+
import { DOCUMENT, Location, CommonModule } from '@angular/common';
|
|
9
|
+
import * as i4 from '@angular/cdk/a11y';
|
|
10
10
|
import { A11yModule } from '@angular/cdk/a11y';
|
|
11
11
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators } from '@angular/forms';
|
|
12
12
|
import { trigger, state, style, transition, group, query, animateChild, animate, keyframes } from '@angular/animations';
|
|
13
|
-
import * as i1
|
|
13
|
+
import * as i1 from '@angular/cdk/overlay';
|
|
14
14
|
import { NoopScrollStrategy, Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
|
15
15
|
import * as i2 from '@angular/cdk/portal';
|
|
16
16
|
import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, PortalModule } from '@angular/cdk/portal';
|
|
17
17
|
|
|
18
18
|
/** InjectionToken for date time picker that can be used to override default locale code. */
|
|
19
|
-
const
|
|
19
|
+
const NXT_DATE_TIME_LOCALE = new InjectionToken('NXT_DATE_TIME_LOCALE', {
|
|
20
20
|
providedIn: 'root',
|
|
21
|
-
factory:
|
|
21
|
+
factory: NXT_DATE_TIME_LOCALE_FACTORY
|
|
22
22
|
});
|
|
23
23
|
/** @docs-private */
|
|
24
|
-
function
|
|
24
|
+
function NXT_DATE_TIME_LOCALE_FACTORY() {
|
|
25
25
|
return inject(LOCALE_ID);
|
|
26
26
|
}
|
|
27
|
-
/** Provider for
|
|
28
|
-
const
|
|
29
|
-
provide:
|
|
27
|
+
/** Provider for NXT_DATE_TIME_LOCALE injection token. */
|
|
28
|
+
const NXT_DATE_TIME_LOCALE_PROVIDER = {
|
|
29
|
+
provide: NXT_DATE_TIME_LOCALE,
|
|
30
30
|
useExisting: LOCALE_ID
|
|
31
31
|
};
|
|
32
32
|
class DateTimeAdapter {
|
|
@@ -98,7 +98,7 @@ class DateTimeAdapter {
|
|
|
98
98
|
* to also deserialize the format used by your backend.
|
|
99
99
|
*/
|
|
100
100
|
deserialize(value) {
|
|
101
|
-
if (value == null ||
|
|
101
|
+
if (value == null || value == undefined ||
|
|
102
102
|
(this.isDateInstance(value) && this.isValid(value))) {
|
|
103
103
|
return value;
|
|
104
104
|
}
|
|
@@ -126,7 +126,7 @@ class DateTimeAdapter {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/** InjectionToken for date time picker that can be used to override default format. */
|
|
129
|
-
const
|
|
129
|
+
const NXT_DATE_TIME_FORMATS = new InjectionToken('NXT_DATE_TIME_FORMATS');
|
|
130
130
|
|
|
131
131
|
class CalendarCell {
|
|
132
132
|
constructor(value, displayValue, ariaLabel, enabled, out = false, cellClass = '') {
|
|
@@ -138,7 +138,18 @@ class CalendarCell {
|
|
|
138
138
|
this.cellClass = cellClass;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
class
|
|
141
|
+
class CalendarBodyComponent {
|
|
142
|
+
get calendarBodyClass() {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
get isInSingleMode() {
|
|
146
|
+
return this.selectMode === 'single';
|
|
147
|
+
}
|
|
148
|
+
get isInRangeMode() {
|
|
149
|
+
return (this.selectMode === 'range' ||
|
|
150
|
+
this.selectMode === 'rangeFrom' ||
|
|
151
|
+
this.selectMode === 'rangeTo');
|
|
152
|
+
}
|
|
142
153
|
constructor(elmRef, ngZone) {
|
|
143
154
|
this.elmRef = elmRef;
|
|
144
155
|
this.ngZone = ngZone;
|
|
@@ -159,17 +170,6 @@ class OwlCalendarBodyComponent {
|
|
|
159
170
|
* */
|
|
160
171
|
this.select = new EventEmitter();
|
|
161
172
|
}
|
|
162
|
-
get owlDTCalendarBodyClass() {
|
|
163
|
-
return true;
|
|
164
|
-
}
|
|
165
|
-
get isInSingleMode() {
|
|
166
|
-
return this.selectMode === 'single';
|
|
167
|
-
}
|
|
168
|
-
get isInRangeMode() {
|
|
169
|
-
return (this.selectMode === 'range' ||
|
|
170
|
-
this.selectMode === 'rangeFrom' ||
|
|
171
|
-
this.selectMode === 'rangeTo');
|
|
172
|
-
}
|
|
173
173
|
ngOnInit() { }
|
|
174
174
|
selectCell(cell) {
|
|
175
175
|
this.select.emit(cell);
|
|
@@ -193,39 +193,43 @@ class OwlCalendarBodyComponent {
|
|
|
193
193
|
const toValue = this.selectedValues[1];
|
|
194
194
|
return value === fromValue || value === toValue;
|
|
195
195
|
}
|
|
196
|
+
return false;
|
|
196
197
|
}
|
|
197
198
|
/**
|
|
198
199
|
* Check if the cell in the range
|
|
199
200
|
* */
|
|
200
201
|
isInRange(value) {
|
|
201
202
|
if (this.isInRangeMode) {
|
|
202
|
-
const fromValue = this.selectedValues[0];
|
|
203
|
-
const toValue = this.selectedValues[1];
|
|
204
|
-
if (fromValue !==
|
|
203
|
+
const fromValue = this.selectedValues?.[0];
|
|
204
|
+
const toValue = this.selectedValues?.[1];
|
|
205
|
+
if (fromValue !== undefined && toValue !== undefined) {
|
|
205
206
|
return value >= fromValue && value <= toValue;
|
|
206
207
|
}
|
|
207
208
|
else {
|
|
208
209
|
return value === fromValue || value === toValue;
|
|
209
210
|
}
|
|
210
211
|
}
|
|
212
|
+
return false;
|
|
211
213
|
}
|
|
212
214
|
/**
|
|
213
215
|
* Check if the cell is the range from
|
|
214
216
|
* */
|
|
215
217
|
isRangeFrom(value) {
|
|
216
218
|
if (this.isInRangeMode) {
|
|
217
|
-
const fromValue = this.selectedValues[0];
|
|
218
|
-
return fromValue !==
|
|
219
|
+
const fromValue = this.selectedValues?.[0];
|
|
220
|
+
return fromValue !== undefined && value === fromValue;
|
|
219
221
|
}
|
|
222
|
+
return false;
|
|
220
223
|
}
|
|
221
224
|
/**
|
|
222
225
|
* Check if the cell is the range to
|
|
223
226
|
* */
|
|
224
227
|
isRangeTo(value) {
|
|
225
228
|
if (this.isInRangeMode) {
|
|
226
|
-
const toValue = this.selectedValues[1];
|
|
227
|
-
return toValue !==
|
|
229
|
+
const toValue = this.selectedValues?.[1];
|
|
230
|
+
return toValue !== undefined && value === toValue;
|
|
228
231
|
}
|
|
232
|
+
return false;
|
|
229
233
|
}
|
|
230
234
|
/**
|
|
231
235
|
* Focus to a active cell
|
|
@@ -237,17 +241,17 @@ class OwlCalendarBodyComponent {
|
|
|
237
241
|
.pipe(take(1))
|
|
238
242
|
.subscribe(() => {
|
|
239
243
|
this.elmRef.nativeElement
|
|
240
|
-
|
|
241
|
-
|
|
244
|
+
?.querySelector('.nxt-dt-calendar-cell-active')
|
|
245
|
+
?.focus();
|
|
242
246
|
});
|
|
243
247
|
});
|
|
244
248
|
}
|
|
245
249
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
250
|
+
CalendarBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: CalendarBodyComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
251
|
+
CalendarBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: CalendarBodyComponent, selector: "[nxtDateTimeCalendarBody]", inputs: { activeCell: "activeCell", rows: "rows", numCols: "numCols", cellRatio: "cellRatio", todayValue: "todayValue", selectedValues: "selectedValues", selectMode: "selectMode" }, outputs: { select: "select" }, host: { properties: { "class.nxt-dt-calendar-body": "this.calendarBodyClass" } }, exportAs: ["nxtDateTimeCalendarBody"], ngImport: i0, template: "<tr *ngFor=\"let row of rows; let rowIndex = index\"\n role=\"row\">\n <td *ngFor=\"let item of row; let colIndex = index\"\n class=\"nxt-dt-calendar-cell {{item.cellClass}}\"\n [tabindex]=\"isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.nxt-dt-calendar-cell-active]=\"isActiveCell(rowIndex, colIndex)\"\n [class.nxt-dt-calendar-cell-disabled]=\"!item.enabled\"\n [class.nxt-dt-calendar-cell-in-range]=\"isInRange(item.value)\"\n [class.nxt-dt-calendar-cell-range-from]=\"isRangeFrom(item.value)\"\n [class.nxt-dt-calendar-cell-range-to]=\"isRangeTo(item.value)\"\n [attr.aria-label]=\"item.ariaLabel\"\n [attr.aria-disabled]=\"!item.enabled || null\"\n [style.width.%]=\"100 / numCols\"\n [style.paddingTop.%]=\"50 * cellRatio / numCols\"\n [style.paddingBottom.%]=\"50 * cellRatio / numCols\"\n (click)=\"selectCell(item)\">\n <span class=\"nxt-dt-calendar-cell-content\"\n [ngClass]=\"{\n 'nxt-dt-calendar-cell-out': item.out,\n 'nxt-dt-calendar-cell-today': item.value === todayValue,\n 'nxt-dt-calendar-cell-selected': isSelected(item.value)\n }\">\n {{item.displayValue}}\n </span>\n </td>\n</tr>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
252
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: CalendarBodyComponent, decorators: [{
|
|
249
253
|
type: Component,
|
|
250
|
-
args: [{ selector: '[
|
|
254
|
+
args: [{ selector: '[nxtDateTimeCalendarBody]', exportAs: 'nxtDateTimeCalendarBody', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<tr *ngFor=\"let row of rows; let rowIndex = index\"\n role=\"row\">\n <td *ngFor=\"let item of row; let colIndex = index\"\n class=\"nxt-dt-calendar-cell {{item.cellClass}}\"\n [tabindex]=\"isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.nxt-dt-calendar-cell-active]=\"isActiveCell(rowIndex, colIndex)\"\n [class.nxt-dt-calendar-cell-disabled]=\"!item.enabled\"\n [class.nxt-dt-calendar-cell-in-range]=\"isInRange(item.value)\"\n [class.nxt-dt-calendar-cell-range-from]=\"isRangeFrom(item.value)\"\n [class.nxt-dt-calendar-cell-range-to]=\"isRangeTo(item.value)\"\n [attr.aria-label]=\"item.ariaLabel\"\n [attr.aria-disabled]=\"!item.enabled || null\"\n [style.width.%]=\"100 / numCols\"\n [style.paddingTop.%]=\"50 * cellRatio / numCols\"\n [style.paddingBottom.%]=\"50 * cellRatio / numCols\"\n (click)=\"selectCell(item)\">\n <span class=\"nxt-dt-calendar-cell-content\"\n [ngClass]=\"{\n 'nxt-dt-calendar-cell-out': item.out,\n 'nxt-dt-calendar-cell-today': item.value === todayValue,\n 'nxt-dt-calendar-cell-selected': isSelected(item.value)\n }\">\n {{item.displayValue}}\n </span>\n </td>\n</tr>\n" }]
|
|
251
255
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { activeCell: [{
|
|
252
256
|
type: Input
|
|
253
257
|
}], rows: [{
|
|
@@ -264,50 +268,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
264
268
|
type: Input
|
|
265
269
|
}], select: [{
|
|
266
270
|
type: Output
|
|
267
|
-
}],
|
|
271
|
+
}], calendarBodyClass: [{
|
|
268
272
|
type: HostBinding,
|
|
269
|
-
args: ['class.
|
|
273
|
+
args: ['class.nxt-dt-calendar-body']
|
|
270
274
|
}] } });
|
|
271
275
|
|
|
272
276
|
const DAYS_PER_WEEK = 7;
|
|
273
277
|
const WEEKS_PER_VIEW = 6;
|
|
274
|
-
class
|
|
275
|
-
constructor(cdRef, dateTimeAdapter, dateTimeFormats) {
|
|
276
|
-
this.cdRef = cdRef;
|
|
277
|
-
this.dateTimeAdapter = dateTimeAdapter;
|
|
278
|
-
this.dateTimeFormats = dateTimeFormats;
|
|
279
|
-
/**
|
|
280
|
-
* Whether to hide dates in other months at the start or end of the current month.
|
|
281
|
-
* */
|
|
282
|
-
this.hideOtherMonths = false;
|
|
283
|
-
/**
|
|
284
|
-
* Define the first day of a week
|
|
285
|
-
* Sunday: 0 ~ Saturday: 6
|
|
286
|
-
* */
|
|
287
|
-
this._firstDayOfWeek = 0;
|
|
288
|
-
/**
|
|
289
|
-
* The select mode of the picker;
|
|
290
|
-
* */
|
|
291
|
-
this._selectMode = 'single';
|
|
292
|
-
this._selecteds = [];
|
|
293
|
-
this.localeSub = Subscription.EMPTY;
|
|
294
|
-
this.initiated = false;
|
|
295
|
-
/**
|
|
296
|
-
* An array to hold all selectedDates' value
|
|
297
|
-
* the value is the day number in current month
|
|
298
|
-
* */
|
|
299
|
-
this.selectedDates = [];
|
|
300
|
-
/**
|
|
301
|
-
* Callback to invoke when a new date is selected
|
|
302
|
-
* */
|
|
303
|
-
this.selectedChange = new EventEmitter();
|
|
304
|
-
/**
|
|
305
|
-
* Callback to invoke when any date is selected.
|
|
306
|
-
* */
|
|
307
|
-
this.userSelection = new EventEmitter();
|
|
308
|
-
/** Emits when any date is activated. */
|
|
309
|
-
this.pickerMomentChange = new EventEmitter();
|
|
310
|
-
}
|
|
278
|
+
class MonthViewComponent {
|
|
311
279
|
get firstDayOfWeek() {
|
|
312
280
|
return this._firstDayOfWeek;
|
|
313
281
|
}
|
|
@@ -344,7 +312,7 @@ class OwlMonthViewComponent {
|
|
|
344
312
|
}
|
|
345
313
|
}
|
|
346
314
|
get selecteds() {
|
|
347
|
-
return this._selecteds;
|
|
315
|
+
return this._selecteds || [];
|
|
348
316
|
}
|
|
349
317
|
set selecteds(values) {
|
|
350
318
|
this._selecteds = values.map(v => {
|
|
@@ -377,10 +345,10 @@ class OwlMonthViewComponent {
|
|
|
377
345
|
this.cdRef.markForCheck();
|
|
378
346
|
}
|
|
379
347
|
}
|
|
380
|
-
get
|
|
348
|
+
get min() {
|
|
381
349
|
return this._minDate;
|
|
382
350
|
}
|
|
383
|
-
set
|
|
351
|
+
set min(value) {
|
|
384
352
|
value = this.dateTimeAdapter.deserialize(value);
|
|
385
353
|
this._minDate = this.getValidDate(value);
|
|
386
354
|
if (this.initiated) {
|
|
@@ -388,10 +356,10 @@ class OwlMonthViewComponent {
|
|
|
388
356
|
this.cdRef.markForCheck();
|
|
389
357
|
}
|
|
390
358
|
}
|
|
391
|
-
get
|
|
359
|
+
get max() {
|
|
392
360
|
return this._maxDate;
|
|
393
361
|
}
|
|
394
|
-
set
|
|
362
|
+
set max(value) {
|
|
395
363
|
value = this.dateTimeAdapter.deserialize(value);
|
|
396
364
|
this._maxDate = this.getValidDate(value);
|
|
397
365
|
if (this.initiated) {
|
|
@@ -411,6 +379,7 @@ class OwlMonthViewComponent {
|
|
|
411
379
|
this.firstRowOffset -
|
|
412
380
|
1);
|
|
413
381
|
}
|
|
382
|
+
return;
|
|
414
383
|
}
|
|
415
384
|
get isInSingleMode() {
|
|
416
385
|
return this.selectMode === 'single';
|
|
@@ -420,9 +389,41 @@ class OwlMonthViewComponent {
|
|
|
420
389
|
this.selectMode === 'rangeFrom' ||
|
|
421
390
|
this.selectMode === 'rangeTo');
|
|
422
391
|
}
|
|
423
|
-
get
|
|
392
|
+
get calendarView() {
|
|
424
393
|
return true;
|
|
425
394
|
}
|
|
395
|
+
constructor(cdRef, dateTimeAdapter, dateTimeFormats) {
|
|
396
|
+
this.cdRef = cdRef;
|
|
397
|
+
this.dateTimeAdapter = dateTimeAdapter;
|
|
398
|
+
this.dateTimeFormats = dateTimeFormats;
|
|
399
|
+
/**
|
|
400
|
+
* Whether to hide dates in other months at the start or end of the current month.
|
|
401
|
+
* */
|
|
402
|
+
this.hideOtherMonths = false;
|
|
403
|
+
/**
|
|
404
|
+
* Define the first day of a week
|
|
405
|
+
* Sunday: 0 ~ Saturday: 6
|
|
406
|
+
* */
|
|
407
|
+
this._firstDayOfWeek = 0;
|
|
408
|
+
/**
|
|
409
|
+
* The select mode of the picker;
|
|
410
|
+
* */
|
|
411
|
+
this._selectMode = 'single';
|
|
412
|
+
this._selecteds = new Array();
|
|
413
|
+
this.initiated = false;
|
|
414
|
+
// the index of cell that contains the first date of the month
|
|
415
|
+
this.firstRowOffset = 0;
|
|
416
|
+
/**
|
|
417
|
+
* Callback to invoke when a new date is selected
|
|
418
|
+
* */
|
|
419
|
+
this.selectedChange = new EventEmitter();
|
|
420
|
+
/**
|
|
421
|
+
* Callback to invoke when any date is selected.
|
|
422
|
+
* */
|
|
423
|
+
this.userSelection = new EventEmitter();
|
|
424
|
+
/** Emits when any date is activated. */
|
|
425
|
+
this.pickerMomentChange = new EventEmitter();
|
|
426
|
+
}
|
|
426
427
|
ngOnInit() {
|
|
427
428
|
this.generateWeekDays();
|
|
428
429
|
this.localeSub = this.dateTimeAdapter.localeChanges.subscribe(() => {
|
|
@@ -436,7 +437,8 @@ class OwlMonthViewComponent {
|
|
|
436
437
|
this.initiated = true;
|
|
437
438
|
}
|
|
438
439
|
ngOnDestroy() {
|
|
439
|
-
this.localeSub
|
|
440
|
+
this.localeSub?.unsubscribe();
|
|
441
|
+
this.localeSub = undefined;
|
|
440
442
|
}
|
|
441
443
|
/**
|
|
442
444
|
* Handle a calendarCell selected
|
|
@@ -543,7 +545,7 @@ class OwlMonthViewComponent {
|
|
|
543
545
|
if (!this.pickerMoment) {
|
|
544
546
|
return;
|
|
545
547
|
}
|
|
546
|
-
this.todayDate =
|
|
548
|
+
this.todayDate = undefined;
|
|
547
549
|
// the first weekday of the month
|
|
548
550
|
const startWeekdayOfMonth = this.dateTimeAdapter.getDay(this.firstDateOfMonth);
|
|
549
551
|
const firstDayOfWeek = this.firstDayOfWeek;
|
|
@@ -586,7 +588,7 @@ class OwlMonthViewComponent {
|
|
|
586
588
|
// check if date is not in current month
|
|
587
589
|
const dayValue = daysDiff + 1;
|
|
588
590
|
const out = dayValue < 1 || dayValue > daysInMonth;
|
|
589
|
-
const cellClass = '
|
|
591
|
+
const cellClass = 'nxt-dt-day-' + this.dateTimeAdapter.getDay(date);
|
|
590
592
|
return new CalendarCell(dayValue, dateName, ariaLabel, enabled, out, cellClass);
|
|
591
593
|
}
|
|
592
594
|
/**
|
|
@@ -595,10 +597,10 @@ class OwlMonthViewComponent {
|
|
|
595
597
|
isDateEnabled(date) {
|
|
596
598
|
return (!!date &&
|
|
597
599
|
(!this.dateFilter || this.dateFilter(date, 'date')) &&
|
|
598
|
-
(!this.
|
|
599
|
-
this.dateTimeAdapter.compare(date, this.
|
|
600
|
-
(!this.
|
|
601
|
-
this.dateTimeAdapter.compare(date, this.
|
|
600
|
+
(!this.min ||
|
|
601
|
+
this.dateTimeAdapter.compare(date, this.min) >= 0) &&
|
|
602
|
+
(!this.max ||
|
|
603
|
+
this.dateTimeAdapter.compare(date, this.max) <= 0));
|
|
602
604
|
}
|
|
603
605
|
/**
|
|
604
606
|
* Get a valid date object
|
|
@@ -607,10 +609,10 @@ class OwlMonthViewComponent {
|
|
|
607
609
|
return this.dateTimeAdapter.isDateInstance(obj) &&
|
|
608
610
|
this.dateTimeAdapter.isValid(obj)
|
|
609
611
|
? obj
|
|
610
|
-
:
|
|
612
|
+
: undefined;
|
|
611
613
|
}
|
|
612
614
|
/**
|
|
613
|
-
* Check if the give dates are
|
|
615
|
+
* Check if the give dates are defined and in the same month
|
|
614
616
|
*/
|
|
615
617
|
isSameMonth(dateLeft, dateRight) {
|
|
616
618
|
return !!(dateLeft &&
|
|
@@ -633,38 +635,32 @@ class OwlMonthViewComponent {
|
|
|
633
635
|
return;
|
|
634
636
|
}
|
|
635
637
|
if (this.isInSingleMode && this.selected) {
|
|
636
|
-
const dayDiff = this.dateTimeAdapter.differenceInCalendarDays(this.selected, this.firstDateOfMonth);
|
|
638
|
+
const dayDiff = this.dateTimeAdapter.differenceInCalendarDays(this.selected, this.firstDateOfMonth) ?? 0;
|
|
637
639
|
this.selectedDates[0] = dayDiff + 1;
|
|
638
640
|
return;
|
|
639
641
|
}
|
|
640
642
|
if (this.isInRangeMode && this.selecteds) {
|
|
641
643
|
this.selectedDates = this.selecteds.map(selected => {
|
|
642
644
|
if (this.dateTimeAdapter.isValid(selected)) {
|
|
643
|
-
const dayDiff = this.dateTimeAdapter.differenceInCalendarDays(selected, this.firstDateOfMonth);
|
|
645
|
+
const dayDiff = this.dateTimeAdapter.differenceInCalendarDays(selected, this.firstDateOfMonth) ?? 0;
|
|
644
646
|
return dayDiff + 1;
|
|
645
647
|
}
|
|
646
|
-
|
|
647
|
-
return null;
|
|
648
|
-
}
|
|
648
|
+
return;
|
|
649
649
|
});
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
652
|
focusActiveCell() {
|
|
653
|
-
this.calendarBodyElm
|
|
653
|
+
this.calendarBodyElm?.focusActiveCell();
|
|
654
654
|
}
|
|
655
655
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
656
|
+
MonthViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: MonthViewComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: DateTimeAdapter }, { token: NXT_DATE_TIME_FORMATS }], target: i0.ɵɵFactoryTarget.Component });
|
|
657
|
+
MonthViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: MonthViewComponent, selector: "nxt-date-time-month-view", inputs: { hideOtherMonths: "hideOtherMonths", firstDayOfWeek: "firstDayOfWeek", selectMode: "selectMode", selected: "selected", selecteds: "selecteds", pickerMoment: "pickerMoment", dateFilter: "dateFilter", min: "min", max: "max" }, outputs: { selectedChange: "selectedChange", userSelection: "userSelection", pickerMomentChange: "pickerMomentChange" }, host: { properties: { "class.nxt-dt-calendar-view": "this.calendarView" } }, viewQueries: [{ propertyName: "calendarBodyElm", first: true, predicate: CalendarBodyComponent, descendants: true, static: true }], ngImport: i0, template: "<table class=\"nxt-dt-calendar-table nxt-dt-calendar-month-table\"\n [class.nxt-dt-calendar-only-current-month]=\"hideOtherMonths\">\n <thead class=\"nxt-dt-calendar-header\">\n <tr class=\"nxt-dt-weekdays\">\n <th *ngFor=\"let weekday of weekdays\"\n [attr.aria-label]=\"weekday.long\"\n class=\"nxt-dt-weekday\"\n scope=\"col\">\n <span>{{weekday.short}}</span>\n </th>\n </tr>\n <tr>\n <th class=\"nxt-dt-calendar-table-divider\"\n aria-hidden=\"true\"\n colspan=\"7\"></th>\n </tr>\n </thead>\n <tbody nxtDateTimeCalendarBody\n role=\"grid\"\n [rows]=\"days\"\n [todayValue]=\"todayDate ?? undefined\"\n [selectedValues]=\"selectedDates\"\n [selectMode]=\"selectMode\"\n [activeCell]=\"activeCell ?? 0\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\">\n </tbody>\n</table>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: CalendarBodyComponent, selector: "[nxtDateTimeCalendarBody]", inputs: ["activeCell", "rows", "numCols", "cellRatio", "todayValue", "selectedValues", "selectMode"], outputs: ["select"], exportAs: ["nxtDateTimeCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
658
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: MonthViewComponent, decorators: [{
|
|
659
659
|
type: Component,
|
|
660
|
-
args: [{ selector: '
|
|
661
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: DateTimeAdapter, decorators: [{
|
|
662
|
-
type: Optional
|
|
663
|
-
}] }, { type: undefined, decorators: [{
|
|
664
|
-
type: Optional
|
|
665
|
-
}, {
|
|
660
|
+
args: [{ selector: 'nxt-date-time-month-view', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"nxt-dt-calendar-table nxt-dt-calendar-month-table\"\n [class.nxt-dt-calendar-only-current-month]=\"hideOtherMonths\">\n <thead class=\"nxt-dt-calendar-header\">\n <tr class=\"nxt-dt-weekdays\">\n <th *ngFor=\"let weekday of weekdays\"\n [attr.aria-label]=\"weekday.long\"\n class=\"nxt-dt-weekday\"\n scope=\"col\">\n <span>{{weekday.short}}</span>\n </th>\n </tr>\n <tr>\n <th class=\"nxt-dt-calendar-table-divider\"\n aria-hidden=\"true\"\n colspan=\"7\"></th>\n </tr>\n </thead>\n <tbody nxtDateTimeCalendarBody\n role=\"grid\"\n [rows]=\"days\"\n [todayValue]=\"todayDate ?? undefined\"\n [selectedValues]=\"selectedDates\"\n [selectMode]=\"selectMode\"\n [activeCell]=\"activeCell ?? 0\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\">\n </tbody>\n</table>\n" }]
|
|
661
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: DateTimeAdapter }, { type: undefined, decorators: [{
|
|
666
662
|
type: Inject,
|
|
667
|
-
args: [
|
|
663
|
+
args: [NXT_DATE_TIME_FORMATS]
|
|
668
664
|
}] }]; }, propDecorators: { hideOtherMonths: [{
|
|
669
665
|
type: Input
|
|
670
666
|
}], firstDayOfWeek: [{
|
|
@@ -679,9 +675,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
679
675
|
type: Input
|
|
680
676
|
}], dateFilter: [{
|
|
681
677
|
type: Input
|
|
682
|
-
}],
|
|
678
|
+
}], min: [{
|
|
683
679
|
type: Input
|
|
684
|
-
}],
|
|
680
|
+
}], max: [{
|
|
685
681
|
type: Input
|
|
686
682
|
}], selectedChange: [{
|
|
687
683
|
type: Output
|
|
@@ -691,13 +687,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
691
687
|
type: Output
|
|
692
688
|
}], calendarBodyElm: [{
|
|
693
689
|
type: ViewChild,
|
|
694
|
-
args: [
|
|
695
|
-
}],
|
|
690
|
+
args: [CalendarBodyComponent, { static: true }]
|
|
691
|
+
}], calendarView: [{
|
|
696
692
|
type: HostBinding,
|
|
697
|
-
args: ['class.
|
|
693
|
+
args: ['class.nxt-dt-calendar-view']
|
|
698
694
|
}] } });
|
|
699
695
|
|
|
700
|
-
class
|
|
696
|
+
class DateTimeIntl {
|
|
701
697
|
constructor() {
|
|
702
698
|
/**
|
|
703
699
|
* Stream that emits whenever the labels here are changed. Use this to notify
|
|
@@ -746,9 +742,9 @@ class OwlDateTimeIntl {
|
|
|
746
742
|
this.hour12PMLabel = $localize `:@@nxt-pick-datetime.time-pm:PM`;
|
|
747
743
|
}
|
|
748
744
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
745
|
+
DateTimeIntl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeIntl, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
746
|
+
DateTimeIntl.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeIntl, providedIn: 'root' });
|
|
747
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeIntl, decorators: [{
|
|
752
748
|
type: Injectable,
|
|
753
749
|
args: [{
|
|
754
750
|
providedIn: 'root'
|
|
@@ -757,31 +753,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
757
753
|
|
|
758
754
|
const YEARS_PER_ROW = 3;
|
|
759
755
|
const YEAR_ROWS = 7;
|
|
760
|
-
class
|
|
761
|
-
constructor(cdRef, pickerIntl, dateTimeAdapter) {
|
|
762
|
-
this.cdRef = cdRef;
|
|
763
|
-
this.pickerIntl = pickerIntl;
|
|
764
|
-
this.dateTimeAdapter = dateTimeAdapter;
|
|
765
|
-
/**
|
|
766
|
-
* The select mode of the picker;
|
|
767
|
-
* */
|
|
768
|
-
this._selectMode = 'single';
|
|
769
|
-
this._selecteds = [];
|
|
770
|
-
this.initiated = false;
|
|
771
|
-
/**
|
|
772
|
-
* Callback to invoke when a new month is selected
|
|
773
|
-
* */
|
|
774
|
-
// eslint-disable-next-line @angular-eslint/no-output-native
|
|
775
|
-
this.change = new EventEmitter();
|
|
776
|
-
/**
|
|
777
|
-
* Emits the selected year. This doesn't imply a change on the selected date
|
|
778
|
-
* */
|
|
779
|
-
this.yearSelected = new EventEmitter();
|
|
780
|
-
/** Emits when any date is activated. */
|
|
781
|
-
this.pickerMomentChange = new EventEmitter();
|
|
782
|
-
/** Emits when use keyboard enter to select a calendar cell */
|
|
783
|
-
this.keyboardEnter = new EventEmitter();
|
|
784
|
-
}
|
|
756
|
+
class MultiYearViewComponent {
|
|
785
757
|
get selectMode() {
|
|
786
758
|
return this._selectMode;
|
|
787
759
|
}
|
|
@@ -834,20 +806,20 @@ class OwlMultiYearViewComponent {
|
|
|
834
806
|
this.generateYearList();
|
|
835
807
|
}
|
|
836
808
|
}
|
|
837
|
-
get
|
|
809
|
+
get min() {
|
|
838
810
|
return this._minDate;
|
|
839
811
|
}
|
|
840
|
-
set
|
|
812
|
+
set min(value) {
|
|
841
813
|
value = this.dateTimeAdapter.deserialize(value);
|
|
842
814
|
this._minDate = this.getValidDate(value);
|
|
843
815
|
if (this.initiated) {
|
|
844
816
|
this.generateYearList();
|
|
845
817
|
}
|
|
846
818
|
}
|
|
847
|
-
get
|
|
819
|
+
get max() {
|
|
848
820
|
return this._maxDate;
|
|
849
821
|
}
|
|
850
|
-
set
|
|
822
|
+
set max(value) {
|
|
851
823
|
value = this.dateTimeAdapter.deserialize(value);
|
|
852
824
|
this._maxDate = this.getValidDate(value);
|
|
853
825
|
if (this.initiated) {
|
|
@@ -874,11 +846,13 @@ class OwlMultiYearViewComponent {
|
|
|
874
846
|
if (this._pickerMoment) {
|
|
875
847
|
return this.dateTimeAdapter.getYear(this._pickerMoment) % (YEARS_PER_ROW * YEAR_ROWS);
|
|
876
848
|
}
|
|
849
|
+
return;
|
|
877
850
|
}
|
|
878
851
|
get tableHeader() {
|
|
879
852
|
if (this._years && this._years.length > 0) {
|
|
880
853
|
return `${this._years[0][0].displayValue} ~ ${this._years[YEAR_ROWS - 1][YEARS_PER_ROW - 1].displayValue}`;
|
|
881
854
|
}
|
|
855
|
+
return;
|
|
882
856
|
}
|
|
883
857
|
get prevButtonLabel() {
|
|
884
858
|
return this.pickerIntl.prevMultiYearLabel;
|
|
@@ -886,12 +860,36 @@ class OwlMultiYearViewComponent {
|
|
|
886
860
|
get nextButtonLabel() {
|
|
887
861
|
return this.pickerIntl.nextMultiYearLabel;
|
|
888
862
|
}
|
|
889
|
-
get
|
|
863
|
+
get calendarView() {
|
|
890
864
|
return true;
|
|
891
865
|
}
|
|
892
|
-
get
|
|
866
|
+
get calendarMultiYearView() {
|
|
893
867
|
return true;
|
|
894
868
|
}
|
|
869
|
+
constructor(cdRef, pickerIntl, dateTimeAdapter) {
|
|
870
|
+
this.cdRef = cdRef;
|
|
871
|
+
this.pickerIntl = pickerIntl;
|
|
872
|
+
this.dateTimeAdapter = dateTimeAdapter;
|
|
873
|
+
/**
|
|
874
|
+
* The select mode of the picker;
|
|
875
|
+
* */
|
|
876
|
+
this._selectMode = 'single';
|
|
877
|
+
this._selecteds = new Array();
|
|
878
|
+
this.initiated = false;
|
|
879
|
+
/**
|
|
880
|
+
* Callback to invoke when a new month is selected
|
|
881
|
+
* */
|
|
882
|
+
// eslint-disable-next-line @angular-eslint/no-output-native
|
|
883
|
+
this.change = new EventEmitter();
|
|
884
|
+
/**
|
|
885
|
+
* Emits the selected year. This doesn't imply a change on the selected date
|
|
886
|
+
* */
|
|
887
|
+
this.yearSelected = new EventEmitter();
|
|
888
|
+
/** Emits when any date is activated. */
|
|
889
|
+
this.pickerMomentChange = new EventEmitter();
|
|
890
|
+
/** Emits when use keyboard enter to select a calendar cell */
|
|
891
|
+
this.keyboardEnter = new EventEmitter();
|
|
892
|
+
}
|
|
895
893
|
ngOnInit() {
|
|
896
894
|
}
|
|
897
895
|
ngAfterContentInit() {
|
|
@@ -945,14 +943,14 @@ class OwlMultiYearViewComponent {
|
|
|
945
943
|
}
|
|
946
944
|
/** Whether the previous period button is enabled. */
|
|
947
945
|
previousEnabled() {
|
|
948
|
-
if (!this.
|
|
946
|
+
if (!this.min) {
|
|
949
947
|
return true;
|
|
950
948
|
}
|
|
951
|
-
return !this.
|
|
949
|
+
return !this.min || !this.isSameYearList(this._pickerMoment, this.min);
|
|
952
950
|
}
|
|
953
951
|
/** Whether the next period button is enabled. */
|
|
954
952
|
nextEnabled() {
|
|
955
|
-
return !this.
|
|
953
|
+
return !this.max || !this.isSameYearList(this._pickerMoment, this.max);
|
|
956
954
|
}
|
|
957
955
|
handleCalendarKeydown(event) {
|
|
958
956
|
let moment;
|
|
@@ -1013,7 +1011,7 @@ class OwlMultiYearViewComponent {
|
|
|
1013
1011
|
createYearCell(year) {
|
|
1014
1012
|
const startDateOfYear = this.dateTimeAdapter.createDate(year, 0, 1);
|
|
1015
1013
|
const ariaLabel = this.dateTimeAdapter.getYearName(startDateOfYear);
|
|
1016
|
-
const cellClass = '
|
|
1014
|
+
const cellClass = 'nxt-dt-year-' + year;
|
|
1017
1015
|
return new CalendarCell(year, year.toString(), ariaLabel, this.isYearEnabled(year), false, cellClass);
|
|
1018
1016
|
}
|
|
1019
1017
|
setSelectedYears() {
|
|
@@ -1026,20 +1024,12 @@ class OwlMultiYearViewComponent {
|
|
|
1026
1024
|
if (this.dateTimeAdapter.isValid(selected)) {
|
|
1027
1025
|
return this.dateTimeAdapter.getYear(selected);
|
|
1028
1026
|
}
|
|
1029
|
-
|
|
1030
|
-
return null;
|
|
1031
|
-
}
|
|
1027
|
+
return;
|
|
1032
1028
|
});
|
|
1033
1029
|
}
|
|
1034
1030
|
}
|
|
1035
1031
|
/** Whether the given year is enabled. */
|
|
1036
1032
|
isYearEnabled(year) {
|
|
1037
|
-
// disable if the year is greater than maxDate lower than minDate
|
|
1038
|
-
if (year === undefined || year === null ||
|
|
1039
|
-
(this.maxDate && year > this.dateTimeAdapter.getYear(this.maxDate)) ||
|
|
1040
|
-
(this.minDate && year < this.dateTimeAdapter.getYear(this.minDate))) {
|
|
1041
|
-
return false;
|
|
1042
|
-
}
|
|
1043
1033
|
// enable if it reaches here and there's no filter defined
|
|
1044
1034
|
if (!this.dateFilter) {
|
|
1045
1035
|
return true;
|
|
@@ -1061,20 +1051,20 @@ class OwlMultiYearViewComponent {
|
|
|
1061
1051
|
* Get a valid date object
|
|
1062
1052
|
*/
|
|
1063
1053
|
getValidDate(obj) {
|
|
1064
|
-
return (this.dateTimeAdapter.isDateInstance(obj) && this.dateTimeAdapter.isValid(obj))
|
|
1054
|
+
return (this.dateTimeAdapter.isDateInstance(obj) && this.dateTimeAdapter.isValid(obj))
|
|
1055
|
+
? obj
|
|
1056
|
+
: undefined;
|
|
1065
1057
|
}
|
|
1066
1058
|
focusActiveCell() {
|
|
1067
|
-
this.calendarBodyElm
|
|
1059
|
+
this.calendarBodyElm?.focusActiveCell();
|
|
1068
1060
|
}
|
|
1069
1061
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1062
|
+
MultiYearViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: MultiYearViewComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: DateTimeIntl }, { token: DateTimeAdapter }], target: i0.ɵɵFactoryTarget.Component });
|
|
1063
|
+
MultiYearViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: MultiYearViewComponent, selector: "nxt-date-time-multi-year-view", inputs: { selectMode: "selectMode", selected: "selected", selecteds: "selecteds", pickerMoment: "pickerMoment", dateFilter: "dateFilter", min: "min", max: "max" }, outputs: { change: "change", yearSelected: "yearSelected", pickerMomentChange: "pickerMomentChange", keyboardEnter: "keyboardEnter" }, host: { properties: { "class.nxt-dt-calendar-view": "this.calendarView", "class.nxt-dt-calendar-multi-year-view": "this.calendarMultiYearView" } }, viewQueries: [{ propertyName: "calendarBodyElm", first: true, predicate: CalendarBodyComponent, descendants: true, static: true }], ngImport: i0, template: "<button class=\"nxt-dt-control-button nxt-dt-control-arrow-button\"\n [disabled]=\"!previousEnabled()\"\n [attr.aria-label]=\"prevButtonLabel\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"prevYearList($event)\">\n <span class=\"nxt-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Left\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path style=\"fill-rule: evenodd; clip-rule: evenodd;\"\n d=\"M96.633,125.369l95.053-94.533c7.101-7.055,7.101-18.492,0-25.546 c-7.1-7.054-18.613-7.054-25.714,0L58.989,111.689c-3.784,3.759-5.487,8.759-5.238,13.68c-0.249,4.922,1.454,9.921,5.238,13.681 l106.983,106.398c7.101,7.055,18.613,7.055,25.714,0c7.101-7.054,7.101-18.491,0-25.544L96.633,125.369z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n<table class=\"nxt-dt-calendar-table nxt-dt-calendar-multi-year-table\">\n <thead class=\"nxt-dt-calendar-header\">\n <tr>\n <th colspan=\"3\">{{tableHeader}}</th>\n </tr>\n </thead>\n <tbody nxtDateTimeCalendarBody\n role=\"grid\"\n [rows]=\"years\"\n [numCols]=\"3\"\n [cellRatio]=\"3 / 7\"\n [activeCell]=\"activeCell ?? 0\"\n [todayValue]=\"todayYear\"\n [selectedValues]=\"selectedYears\"\n [selectMode]=\"selectMode\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\"></tbody>\n</table>\n<button class=\"nxt-dt-control-button nxt-dt-control-arrow-button\"\n [disabled]=\"!nextEnabled()\"\n [attr.aria-label]=\"nextButtonLabel\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"nextYearList($event)\">\n <span class=\"nxt-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Right\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\">\n <path style=\"fill-rule:evenodd;clip-rule:evenodd;\"\n d=\"M191.75,111.689L84.766,5.291c-7.1-7.055-18.613-7.055-25.713,0\n c-7.101,7.054-7.101,18.49,0,25.544l95.053,94.534l-95.053,94.533c-7.101,7.054-7.101,18.491,0,25.545\n c7.1,7.054,18.613,7.054,25.713,0L191.75,139.05c3.784-3.759,5.487-8.759,5.238-13.681\n C197.237,120.447,195.534,115.448,191.75,111.689z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n", styles: [""], dependencies: [{ kind: "component", type: CalendarBodyComponent, selector: "[nxtDateTimeCalendarBody]", inputs: ["activeCell", "rows", "numCols", "cellRatio", "todayValue", "selectedValues", "selectMode"], outputs: ["select"], exportAs: ["nxtDateTimeCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1064
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: MultiYearViewComponent, decorators: [{
|
|
1073
1065
|
type: Component,
|
|
1074
|
-
args: [{ selector: '
|
|
1075
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type:
|
|
1076
|
-
type: Optional
|
|
1077
|
-
}] }]; }, propDecorators: { selectMode: [{
|
|
1066
|
+
args: [{ selector: 'nxt-date-time-multi-year-view', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<button class=\"nxt-dt-control-button nxt-dt-control-arrow-button\"\n [disabled]=\"!previousEnabled()\"\n [attr.aria-label]=\"prevButtonLabel\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"prevYearList($event)\">\n <span class=\"nxt-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Left\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path style=\"fill-rule: evenodd; clip-rule: evenodd;\"\n d=\"M96.633,125.369l95.053-94.533c7.101-7.055,7.101-18.492,0-25.546 c-7.1-7.054-18.613-7.054-25.714,0L58.989,111.689c-3.784,3.759-5.487,8.759-5.238,13.68c-0.249,4.922,1.454,9.921,5.238,13.681 l106.983,106.398c7.101,7.055,18.613,7.055,25.714,0c7.101-7.054,7.101-18.491,0-25.544L96.633,125.369z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n<table class=\"nxt-dt-calendar-table nxt-dt-calendar-multi-year-table\">\n <thead class=\"nxt-dt-calendar-header\">\n <tr>\n <th colspan=\"3\">{{tableHeader}}</th>\n </tr>\n </thead>\n <tbody nxtDateTimeCalendarBody\n role=\"grid\"\n [rows]=\"years\"\n [numCols]=\"3\"\n [cellRatio]=\"3 / 7\"\n [activeCell]=\"activeCell ?? 0\"\n [todayValue]=\"todayYear\"\n [selectedValues]=\"selectedYears\"\n [selectMode]=\"selectMode\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\"></tbody>\n</table>\n<button class=\"nxt-dt-control-button nxt-dt-control-arrow-button\"\n [disabled]=\"!nextEnabled()\"\n [attr.aria-label]=\"nextButtonLabel\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"nextYearList($event)\">\n <span class=\"nxt-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Right\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\">\n <path style=\"fill-rule:evenodd;clip-rule:evenodd;\"\n d=\"M191.75,111.689L84.766,5.291c-7.1-7.055-18.613-7.055-25.713,0\n c-7.101,7.054-7.101,18.49,0,25.544l95.053,94.534l-95.053,94.533c-7.101,7.054-7.101,18.491,0,25.545\n c7.1,7.054,18.613,7.054,25.713,0L191.75,139.05c3.784-3.759,5.487-8.759,5.238-13.681\n C197.237,120.447,195.534,115.448,191.75,111.689z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n" }]
|
|
1067
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: DateTimeIntl }, { type: DateTimeAdapter }]; }, propDecorators: { selectMode: [{
|
|
1078
1068
|
type: Input
|
|
1079
1069
|
}], selected: [{
|
|
1080
1070
|
type: Input
|
|
@@ -1084,9 +1074,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
1084
1074
|
type: Input
|
|
1085
1075
|
}], dateFilter: [{
|
|
1086
1076
|
type: Input
|
|
1087
|
-
}],
|
|
1077
|
+
}], min: [{
|
|
1088
1078
|
type: Input
|
|
1089
|
-
}],
|
|
1079
|
+
}], max: [{
|
|
1090
1080
|
type: Input
|
|
1091
1081
|
}], change: [{
|
|
1092
1082
|
type: Output
|
|
@@ -1098,48 +1088,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
1098
1088
|
type: Output
|
|
1099
1089
|
}], calendarBodyElm: [{
|
|
1100
1090
|
type: ViewChild,
|
|
1101
|
-
args: [
|
|
1102
|
-
}],
|
|
1091
|
+
args: [CalendarBodyComponent, { static: true }]
|
|
1092
|
+
}], calendarView: [{
|
|
1103
1093
|
type: HostBinding,
|
|
1104
|
-
args: ['class.
|
|
1105
|
-
}],
|
|
1094
|
+
args: ['class.nxt-dt-calendar-view']
|
|
1095
|
+
}], calendarMultiYearView: [{
|
|
1106
1096
|
type: HostBinding,
|
|
1107
|
-
args: ['class.
|
|
1097
|
+
args: ['class.nxt-dt-calendar-multi-year-view']
|
|
1108
1098
|
}] } });
|
|
1109
1099
|
|
|
1110
1100
|
const MONTHS_PER_YEAR = 12;
|
|
1111
1101
|
const MONTHS_PER_ROW = 3;
|
|
1112
|
-
class
|
|
1113
|
-
constructor(cdRef, dateTimeAdapter, dateTimeFormats) {
|
|
1114
|
-
this.cdRef = cdRef;
|
|
1115
|
-
this.dateTimeAdapter = dateTimeAdapter;
|
|
1116
|
-
this.dateTimeFormats = dateTimeFormats;
|
|
1117
|
-
/**
|
|
1118
|
-
* The select mode of the picker;
|
|
1119
|
-
* */
|
|
1120
|
-
this._selectMode = 'single';
|
|
1121
|
-
this._selecteds = [];
|
|
1122
|
-
this.localeSub = Subscription.EMPTY;
|
|
1123
|
-
this.initiated = false;
|
|
1124
|
-
/**
|
|
1125
|
-
* An array to hold all selectedDates' month value
|
|
1126
|
-
* the value is the month number in current year
|
|
1127
|
-
* */
|
|
1128
|
-
this.selectedMonths = [];
|
|
1129
|
-
/**
|
|
1130
|
-
* Callback to invoke when a new month is selected
|
|
1131
|
-
* */
|
|
1132
|
-
this.change = new EventEmitter();
|
|
1133
|
-
/**
|
|
1134
|
-
* Emits the selected year. This doesn't imply a change on the selected date
|
|
1135
|
-
* */
|
|
1136
|
-
this.monthSelected = new EventEmitter();
|
|
1137
|
-
/** Emits when any date is activated. */
|
|
1138
|
-
this.pickerMomentChange = new EventEmitter();
|
|
1139
|
-
/** Emits when use keyboard enter to select a calendar cell */
|
|
1140
|
-
this.keyboardEnter = new EventEmitter();
|
|
1141
|
-
this.monthNames = this.dateTimeAdapter.getMonthNames('short');
|
|
1142
|
-
}
|
|
1102
|
+
class YearViewComponent {
|
|
1143
1103
|
get selectMode() {
|
|
1144
1104
|
return this._selectMode;
|
|
1145
1105
|
}
|
|
@@ -1191,20 +1151,20 @@ class OwlYearViewComponent {
|
|
|
1191
1151
|
this.generateMonthList();
|
|
1192
1152
|
}
|
|
1193
1153
|
}
|
|
1194
|
-
get
|
|
1154
|
+
get min() {
|
|
1195
1155
|
return this._minDate;
|
|
1196
1156
|
}
|
|
1197
|
-
set
|
|
1157
|
+
set min(value) {
|
|
1198
1158
|
value = this.dateTimeAdapter.deserialize(value);
|
|
1199
1159
|
this._minDate = this.getValidDate(value);
|
|
1200
1160
|
if (this.initiated) {
|
|
1201
1161
|
this.generateMonthList();
|
|
1202
1162
|
}
|
|
1203
1163
|
}
|
|
1204
|
-
get
|
|
1164
|
+
get max() {
|
|
1205
1165
|
return this._maxDate;
|
|
1206
1166
|
}
|
|
1207
|
-
set
|
|
1167
|
+
set max(value) {
|
|
1208
1168
|
value = this.dateTimeAdapter.deserialize(value);
|
|
1209
1169
|
this._maxDate = this.getValidDate(value);
|
|
1210
1170
|
if (this.initiated) {
|
|
@@ -1218,6 +1178,7 @@ class OwlYearViewComponent {
|
|
|
1218
1178
|
if (this._pickerMoment) {
|
|
1219
1179
|
return this.dateTimeAdapter.getMonth(this._pickerMoment);
|
|
1220
1180
|
}
|
|
1181
|
+
return;
|
|
1221
1182
|
}
|
|
1222
1183
|
get isInSingleMode() {
|
|
1223
1184
|
return this.selectMode === 'single';
|
|
@@ -1227,9 +1188,33 @@ class OwlYearViewComponent {
|
|
|
1227
1188
|
this.selectMode === 'rangeFrom' ||
|
|
1228
1189
|
this.selectMode === 'rangeTo');
|
|
1229
1190
|
}
|
|
1230
|
-
get
|
|
1191
|
+
get calendarView() {
|
|
1231
1192
|
return true;
|
|
1232
1193
|
}
|
|
1194
|
+
constructor(cdRef, dateTimeAdapter, dateTimeFormats) {
|
|
1195
|
+
this.cdRef = cdRef;
|
|
1196
|
+
this.dateTimeAdapter = dateTimeAdapter;
|
|
1197
|
+
this.dateTimeFormats = dateTimeFormats;
|
|
1198
|
+
/**
|
|
1199
|
+
* The select mode of the picker;
|
|
1200
|
+
* */
|
|
1201
|
+
this._selectMode = 'single';
|
|
1202
|
+
this._selecteds = new Array();
|
|
1203
|
+
this.initiated = false;
|
|
1204
|
+
/**
|
|
1205
|
+
* Callback to invoke when a new month is selected
|
|
1206
|
+
* */
|
|
1207
|
+
this.change = new EventEmitter();
|
|
1208
|
+
/**
|
|
1209
|
+
* Emits the selected year. This doesn't imply a change on the selected date
|
|
1210
|
+
* */
|
|
1211
|
+
this.monthSelected = new EventEmitter();
|
|
1212
|
+
/** Emits when any date is activated. */
|
|
1213
|
+
this.pickerMomentChange = new EventEmitter();
|
|
1214
|
+
/** Emits when use keyboard enter to select a calendar cell */
|
|
1215
|
+
this.keyboardEnter = new EventEmitter();
|
|
1216
|
+
this.monthNames = this.dateTimeAdapter.getMonthNames('short');
|
|
1217
|
+
}
|
|
1233
1218
|
ngOnInit() {
|
|
1234
1219
|
this.localeSub = this.dateTimeAdapter.localeChanges.subscribe(() => {
|
|
1235
1220
|
this.generateMonthList();
|
|
@@ -1241,7 +1226,8 @@ class OwlYearViewComponent {
|
|
|
1241
1226
|
this.initiated = true;
|
|
1242
1227
|
}
|
|
1243
1228
|
ngOnDestroy() {
|
|
1244
|
-
this.localeSub
|
|
1229
|
+
this.localeSub?.unsubscribe();
|
|
1230
|
+
this.localeSub = undefined;
|
|
1245
1231
|
}
|
|
1246
1232
|
/**
|
|
1247
1233
|
* Handle a calendarCell selected
|
|
@@ -1343,7 +1329,7 @@ class OwlYearViewComponent {
|
|
|
1343
1329
|
createMonthCell(month) {
|
|
1344
1330
|
const startDateOfMonth = this.dateTimeAdapter.createDate(this.dateTimeAdapter.getYear(this.pickerMoment), month, 1);
|
|
1345
1331
|
const ariaLabel = this.dateTimeAdapter.format(startDateOfMonth, this.dateTimeFormats.monthYearA11yLabel);
|
|
1346
|
-
const cellClass = '
|
|
1332
|
+
const cellClass = 'nxt-dt-month-' + month;
|
|
1347
1333
|
return new CalendarCell(month, this.monthNames[month], ariaLabel, this.isMonthEnabled(month), false, cellClass);
|
|
1348
1334
|
}
|
|
1349
1335
|
/**
|
|
@@ -1356,10 +1342,10 @@ class OwlYearViewComponent {
|
|
|
1356
1342
|
for (let date = firstDateOfMonth; this.dateTimeAdapter.getMonth(date) === month; date = this.dateTimeAdapter.addCalendarDays(date, 1)) {
|
|
1357
1343
|
if (!!date &&
|
|
1358
1344
|
(!this.dateFilter || this.dateFilter(date, 'month')) &&
|
|
1359
|
-
(!this.
|
|
1360
|
-
this.dateTimeAdapter.compare(date, this.
|
|
1361
|
-
(!this.
|
|
1362
|
-
this.dateTimeAdapter.compare(date, this.
|
|
1345
|
+
(!this.min ||
|
|
1346
|
+
this.dateTimeAdapter.compare(date, this.min) >= 0) &&
|
|
1347
|
+
(!this.max ||
|
|
1348
|
+
this.dateTimeAdapter.compare(date, this.max) <= 0)) {
|
|
1363
1349
|
return true;
|
|
1364
1350
|
}
|
|
1365
1351
|
}
|
|
@@ -1367,7 +1353,7 @@ class OwlYearViewComponent {
|
|
|
1367
1353
|
}
|
|
1368
1354
|
/**
|
|
1369
1355
|
* Gets the month in this year that the given Date falls on.
|
|
1370
|
-
* Returns
|
|
1356
|
+
* Returns undefined if the given Date is in another year.
|
|
1371
1357
|
*/
|
|
1372
1358
|
getMonthInCurrentYear(date) {
|
|
1373
1359
|
if (this.getValidDate(date) && this.getValidDate(this._pickerMoment)) {
|
|
@@ -1385,9 +1371,7 @@ class OwlYearViewComponent {
|
|
|
1385
1371
|
return this.dateTimeAdapter.getMonth(date);
|
|
1386
1372
|
}
|
|
1387
1373
|
}
|
|
1388
|
-
|
|
1389
|
-
return null;
|
|
1390
|
-
}
|
|
1374
|
+
return;
|
|
1391
1375
|
}
|
|
1392
1376
|
/**
|
|
1393
1377
|
* Set the selectedMonths value
|
|
@@ -1420,24 +1404,20 @@ class OwlYearViewComponent {
|
|
|
1420
1404
|
return this.dateTimeAdapter.isDateInstance(obj) &&
|
|
1421
1405
|
this.dateTimeAdapter.isValid(obj)
|
|
1422
1406
|
? obj
|
|
1423
|
-
:
|
|
1407
|
+
: undefined;
|
|
1424
1408
|
}
|
|
1425
1409
|
focusActiveCell() {
|
|
1426
|
-
this.calendarBodyElm
|
|
1410
|
+
this.calendarBodyElm?.focusActiveCell();
|
|
1427
1411
|
}
|
|
1428
1412
|
}
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1413
|
+
YearViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: YearViewComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: DateTimeAdapter }, { token: NXT_DATE_TIME_FORMATS }], target: i0.ɵɵFactoryTarget.Component });
|
|
1414
|
+
YearViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: YearViewComponent, selector: "nxt-date-time-year-view", inputs: { selectMode: "selectMode", selected: "selected", selecteds: "selecteds", pickerMoment: "pickerMoment", dateFilter: "dateFilter", min: "min", max: "max" }, outputs: { change: "change", monthSelected: "monthSelected", pickerMomentChange: "pickerMomentChange", keyboardEnter: "keyboardEnter" }, host: { properties: { "class.nxt-dt-calendar-view": "this.calendarView" } }, viewQueries: [{ propertyName: "calendarBodyElm", first: true, predicate: CalendarBodyComponent, descendants: true, static: true }], ngImport: i0, template: "<table class=\"nxt-dt-calendar-table nxt-dt-calendar-year-table\">\n <thead class=\"nxt-dt-calendar-header\">\n <tr>\n <th class=\"nxt-dt-calendar-table-divider\"\n aria-hidden=\"true\"\n colspan=\"3\"></th>\n </tr>\n </thead>\n <tbody nxtDateTimeCalendarBody\n role=\"grid\"\n [rows]=\"months\"\n [numCols]=\"3\"\n [cellRatio]=\"3 / 7\"\n [activeCell]=\"activeCell ?? 0\"\n [todayValue]=\"todayMonth??undefined\"\n [selectedValues]=\"selectedMonths\"\n [selectMode]=\"selectMode\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\">\n </tbody>\n</table>\n", styles: [""], dependencies: [{ kind: "component", type: CalendarBodyComponent, selector: "[nxtDateTimeCalendarBody]", inputs: ["activeCell", "rows", "numCols", "cellRatio", "todayValue", "selectedValues", "selectMode"], outputs: ["select"], exportAs: ["nxtDateTimeCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1415
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: YearViewComponent, decorators: [{
|
|
1432
1416
|
type: Component,
|
|
1433
|
-
args: [{ selector: '
|
|
1434
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: DateTimeAdapter, decorators: [{
|
|
1435
|
-
type: Optional
|
|
1436
|
-
}] }, { type: undefined, decorators: [{
|
|
1437
|
-
type: Optional
|
|
1438
|
-
}, {
|
|
1417
|
+
args: [{ selector: 'nxt-date-time-year-view', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"nxt-dt-calendar-table nxt-dt-calendar-year-table\">\n <thead class=\"nxt-dt-calendar-header\">\n <tr>\n <th class=\"nxt-dt-calendar-table-divider\"\n aria-hidden=\"true\"\n colspan=\"3\"></th>\n </tr>\n </thead>\n <tbody nxtDateTimeCalendarBody\n role=\"grid\"\n [rows]=\"months\"\n [numCols]=\"3\"\n [cellRatio]=\"3 / 7\"\n [activeCell]=\"activeCell ?? 0\"\n [todayValue]=\"todayMonth??undefined\"\n [selectedValues]=\"selectedMonths\"\n [selectMode]=\"selectMode\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\">\n </tbody>\n</table>\n" }]
|
|
1418
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: DateTimeAdapter }, { type: undefined, decorators: [{
|
|
1439
1419
|
type: Inject,
|
|
1440
|
-
args: [
|
|
1420
|
+
args: [NXT_DATE_TIME_FORMATS]
|
|
1441
1421
|
}] }]; }, propDecorators: { selectMode: [{
|
|
1442
1422
|
type: Input
|
|
1443
1423
|
}], selected: [{
|
|
@@ -1448,9 +1428,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
1448
1428
|
type: Input
|
|
1449
1429
|
}], dateFilter: [{
|
|
1450
1430
|
type: Input
|
|
1451
|
-
}],
|
|
1431
|
+
}], min: [{
|
|
1452
1432
|
type: Input
|
|
1453
|
-
}],
|
|
1433
|
+
}], max: [{
|
|
1454
1434
|
type: Input
|
|
1455
1435
|
}], change: [{
|
|
1456
1436
|
type: Output
|
|
@@ -1462,82 +1442,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
1462
1442
|
type: Output
|
|
1463
1443
|
}], calendarBodyElm: [{
|
|
1464
1444
|
type: ViewChild,
|
|
1465
|
-
args: [
|
|
1466
|
-
}],
|
|
1445
|
+
args: [CalendarBodyComponent, { static: true }]
|
|
1446
|
+
}], calendarView: [{
|
|
1467
1447
|
type: HostBinding,
|
|
1468
|
-
args: ['class.
|
|
1448
|
+
args: ['class.nxt-dt-calendar-view']
|
|
1469
1449
|
}] } });
|
|
1470
1450
|
|
|
1471
|
-
class
|
|
1472
|
-
|
|
1473
|
-
this.elmRef = elmRef;
|
|
1474
|
-
this.pickerIntl = pickerIntl;
|
|
1475
|
-
this.ngZone = ngZone;
|
|
1476
|
-
this.cdRef = cdRef;
|
|
1477
|
-
this.dateTimeAdapter = dateTimeAdapter;
|
|
1478
|
-
this.dateTimeFormats = dateTimeFormats;
|
|
1479
|
-
/**
|
|
1480
|
-
* Set the first day of week
|
|
1481
|
-
*/
|
|
1482
|
-
this.firstDayOfWeek = 0;
|
|
1483
|
-
this._selecteds = [];
|
|
1484
|
-
/**
|
|
1485
|
-
* The view that the calendar should start in.
|
|
1486
|
-
*/
|
|
1487
|
-
this.startView = 'month';
|
|
1488
|
-
/** Emits when the currently picker moment changes. */
|
|
1489
|
-
this.pickerMomentChange = new EventEmitter();
|
|
1490
|
-
/** Emits when the currently selected date changes. */
|
|
1491
|
-
this.selectedChange = new EventEmitter();
|
|
1492
|
-
/** Emits when any date is selected. */
|
|
1493
|
-
this.userSelection = new EventEmitter();
|
|
1494
|
-
/**
|
|
1495
|
-
* Emits the selected year. This doesn't imply a change on the selected date
|
|
1496
|
-
* */
|
|
1497
|
-
this.yearSelected = new EventEmitter();
|
|
1498
|
-
/**
|
|
1499
|
-
* Emits the selected month. This doesn't imply a change on the selected date
|
|
1500
|
-
* */
|
|
1501
|
-
this.monthSelected = new EventEmitter();
|
|
1502
|
-
/**
|
|
1503
|
-
* Date filter for the month and year view
|
|
1504
|
-
*/
|
|
1505
|
-
this.dateFilterForViews = (date) => (!!date &&
|
|
1506
|
-
(!this.dateFilter || this.dateFilter(date, 'date')) &&
|
|
1507
|
-
(!this.minDate ||
|
|
1508
|
-
this.dateTimeAdapter.compare(date, this.minDate) >= 0) &&
|
|
1509
|
-
(!this.maxDate ||
|
|
1510
|
-
this.dateTimeAdapter.compare(date, this.maxDate) <= 0));
|
|
1511
|
-
this.intlChangesSub = Subscription.EMPTY;
|
|
1512
|
-
/**
|
|
1513
|
-
* Used for scheduling that focus should be moved to the active cell on the next tick.
|
|
1514
|
-
* We need to schedule it, rather than do it immediately, because we have to wait
|
|
1515
|
-
* for Angular to re-evaluate the view children.
|
|
1516
|
-
*/
|
|
1517
|
-
this.moveFocusOnNextTick = false;
|
|
1518
|
-
this.intlChangesSub = this.pickerIntl.changes.subscribe(() => {
|
|
1519
|
-
this.cdRef.markForCheck();
|
|
1520
|
-
});
|
|
1521
|
-
}
|
|
1522
|
-
get minDate() {
|
|
1451
|
+
class CalendarComponent {
|
|
1452
|
+
get min() {
|
|
1523
1453
|
return this._minDate;
|
|
1524
1454
|
}
|
|
1525
|
-
set
|
|
1455
|
+
set min(value) {
|
|
1526
1456
|
value = this.dateTimeAdapter.deserialize(value);
|
|
1527
1457
|
value = this.getValidDate(value);
|
|
1528
1458
|
this._minDate = value
|
|
1529
1459
|
? this.dateTimeAdapter.createDate(this.dateTimeAdapter.getYear(value), this.dateTimeAdapter.getMonth(value), this.dateTimeAdapter.getDate(value))
|
|
1530
|
-
:
|
|
1460
|
+
: undefined;
|
|
1531
1461
|
}
|
|
1532
|
-
get
|
|
1462
|
+
get max() {
|
|
1533
1463
|
return this._maxDate;
|
|
1534
1464
|
}
|
|
1535
|
-
set
|
|
1465
|
+
set max(value) {
|
|
1536
1466
|
value = this.dateTimeAdapter.deserialize(value);
|
|
1537
1467
|
value = this.getValidDate(value);
|
|
1538
1468
|
this._maxDate = value
|
|
1539
1469
|
? this.dateTimeAdapter.createDate(this.dateTimeAdapter.getYear(value), this.dateTimeAdapter.getMonth(value), this.dateTimeAdapter.getDate(value))
|
|
1540
|
-
:
|
|
1470
|
+
: undefined;
|
|
1541
1471
|
}
|
|
1542
1472
|
get pickerMoment() {
|
|
1543
1473
|
return this._pickerMoment;
|
|
@@ -1580,9 +1510,7 @@ class OwlCalendarComponent {
|
|
|
1580
1510
|
else if (this._currentView === 'year') {
|
|
1581
1511
|
return this.pickerIntl.prevYearLabel;
|
|
1582
1512
|
}
|
|
1583
|
-
|
|
1584
|
-
return null;
|
|
1585
|
-
}
|
|
1513
|
+
return;
|
|
1586
1514
|
}
|
|
1587
1515
|
get nextButtonLabel() {
|
|
1588
1516
|
if (this._currentView === 'month') {
|
|
@@ -1591,9 +1519,7 @@ class OwlCalendarComponent {
|
|
|
1591
1519
|
else if (this._currentView === 'year') {
|
|
1592
1520
|
return this.pickerIntl.nextYearLabel;
|
|
1593
1521
|
}
|
|
1594
|
-
|
|
1595
|
-
return null;
|
|
1596
|
-
}
|
|
1522
|
+
return;
|
|
1597
1523
|
}
|
|
1598
1524
|
get currentView() {
|
|
1599
1525
|
return this._currentView;
|
|
@@ -1617,11 +1543,64 @@ class OwlCalendarComponent {
|
|
|
1617
1543
|
return this._currentView === 'month';
|
|
1618
1544
|
}
|
|
1619
1545
|
/**
|
|
1620
|
-
* Bind class '
|
|
1546
|
+
* Bind class 'nxt-dt-calendar' to host
|
|
1621
1547
|
* */
|
|
1622
|
-
get
|
|
1548
|
+
get calendarClass() {
|
|
1623
1549
|
return true;
|
|
1624
1550
|
}
|
|
1551
|
+
constructor(elmRef, pickerIntl, ngZone, cdRef, dateTimeAdapter, dateTimeFormats) {
|
|
1552
|
+
this.elmRef = elmRef;
|
|
1553
|
+
this.pickerIntl = pickerIntl;
|
|
1554
|
+
this.ngZone = ngZone;
|
|
1555
|
+
this.cdRef = cdRef;
|
|
1556
|
+
this.dateTimeAdapter = dateTimeAdapter;
|
|
1557
|
+
this.dateTimeFormats = dateTimeFormats;
|
|
1558
|
+
/**
|
|
1559
|
+
* Set the first day of week
|
|
1560
|
+
*/
|
|
1561
|
+
this.firstDayOfWeek = 0;
|
|
1562
|
+
this._selecteds = new Array();
|
|
1563
|
+
/**
|
|
1564
|
+
* The view that the calendar should start in.
|
|
1565
|
+
*/
|
|
1566
|
+
this.startView = 'month';
|
|
1567
|
+
/**
|
|
1568
|
+
* Whether to hide dates in other months at the start or end of the current month.
|
|
1569
|
+
* */
|
|
1570
|
+
this.hideOtherMonths = false;
|
|
1571
|
+
/** Emits when the currently picker moment changes. */
|
|
1572
|
+
this.pickerMomentChange = new EventEmitter();
|
|
1573
|
+
/** Emits when the currently selected date changes. */
|
|
1574
|
+
this.selectedChange = new EventEmitter();
|
|
1575
|
+
/** Emits when any date is selected. */
|
|
1576
|
+
this.userSelection = new EventEmitter();
|
|
1577
|
+
/**
|
|
1578
|
+
* Emits the selected year. This doesn't imply a change on the selected date
|
|
1579
|
+
* */
|
|
1580
|
+
this.yearSelected = new EventEmitter();
|
|
1581
|
+
/**
|
|
1582
|
+
* Emits the selected month. This doesn't imply a change on the selected date
|
|
1583
|
+
* */
|
|
1584
|
+
this.monthSelected = new EventEmitter();
|
|
1585
|
+
/**
|
|
1586
|
+
* Date filter for the month and year view
|
|
1587
|
+
*/
|
|
1588
|
+
this.dateFilterForViews = (date) => (!!date &&
|
|
1589
|
+
(!this.dateFilter || this.dateFilter(date, 'date')) &&
|
|
1590
|
+
(!this.min ||
|
|
1591
|
+
this.dateTimeAdapter.compare(date, this.min) >= 0) &&
|
|
1592
|
+
(!this.max ||
|
|
1593
|
+
this.dateTimeAdapter.compare(date, this.max) <= 0));
|
|
1594
|
+
/**
|
|
1595
|
+
* Used for scheduling that focus should be moved to the active cell on the next tick.
|
|
1596
|
+
* We need to schedule it, rather than do it immediately, because we have to wait
|
|
1597
|
+
* for Angular to re-evaluate the view children.
|
|
1598
|
+
*/
|
|
1599
|
+
this.moveFocusOnNextTick = false;
|
|
1600
|
+
this.intlChangesSub = this.pickerIntl.changes.subscribe(() => {
|
|
1601
|
+
this.cdRef.markForCheck();
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1625
1604
|
ngOnInit() { }
|
|
1626
1605
|
ngAfterContentInit() {
|
|
1627
1606
|
this._currentView = this.startView;
|
|
@@ -1633,7 +1612,8 @@ class OwlCalendarComponent {
|
|
|
1633
1612
|
}
|
|
1634
1613
|
}
|
|
1635
1614
|
ngOnDestroy() {
|
|
1636
|
-
this.intlChangesSub
|
|
1615
|
+
this.intlChangesSub?.unsubscribe();
|
|
1616
|
+
this.intlChangesSub = undefined;
|
|
1637
1617
|
}
|
|
1638
1618
|
/**
|
|
1639
1619
|
* Toggle between month view and year view
|
|
@@ -1682,7 +1662,7 @@ class OwlCalendarComponent {
|
|
|
1682
1662
|
* Change the pickerMoment value
|
|
1683
1663
|
*/
|
|
1684
1664
|
handlePickerMomentChange(date) {
|
|
1685
|
-
this.pickerMoment = this.dateTimeAdapter.clampDate(date, this.
|
|
1665
|
+
this.pickerMoment = this.dateTimeAdapter.clampDate(date, this.min, this.max);
|
|
1686
1666
|
this.pickerMomentChange.emit(this.pickerMoment);
|
|
1687
1667
|
return;
|
|
1688
1668
|
}
|
|
@@ -1693,13 +1673,13 @@ class OwlCalendarComponent {
|
|
|
1693
1673
|
* Whether the previous period button is enabled.
|
|
1694
1674
|
*/
|
|
1695
1675
|
prevButtonEnabled() {
|
|
1696
|
-
return (!this.
|
|
1676
|
+
return (!this.min || !this.isSameView(this.pickerMoment, this.min));
|
|
1697
1677
|
}
|
|
1698
1678
|
/**
|
|
1699
1679
|
* Whether the next period button is enabled.
|
|
1700
1680
|
*/
|
|
1701
1681
|
nextButtonEnabled() {
|
|
1702
|
-
return (!this.
|
|
1682
|
+
return (!this.max || !this.isSameView(this.pickerMoment, this.max));
|
|
1703
1683
|
}
|
|
1704
1684
|
/**
|
|
1705
1685
|
* Focus to the host element
|
|
@@ -1711,8 +1691,8 @@ class OwlCalendarComponent {
|
|
|
1711
1691
|
.pipe(take(1))
|
|
1712
1692
|
.subscribe(() => {
|
|
1713
1693
|
this.elmRef.nativeElement
|
|
1714
|
-
|
|
1715
|
-
|
|
1694
|
+
?.querySelector('.nxt-dt-calendar-cell-active')
|
|
1695
|
+
?.focus();
|
|
1716
1696
|
});
|
|
1717
1697
|
});
|
|
1718
1698
|
}
|
|
@@ -1751,28 +1731,24 @@ class OwlCalendarComponent {
|
|
|
1751
1731
|
return this.dateTimeAdapter.isDateInstance(obj) &&
|
|
1752
1732
|
this.dateTimeAdapter.isValid(obj)
|
|
1753
1733
|
? obj
|
|
1754
|
-
:
|
|
1734
|
+
: undefined;
|
|
1755
1735
|
}
|
|
1756
1736
|
}
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1737
|
+
CalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: CalendarComponent, deps: [{ token: i0.ElementRef }, { token: DateTimeIntl }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: DateTimeAdapter }, { token: NXT_DATE_TIME_FORMATS }], target: i0.ɵɵFactoryTarget.Component });
|
|
1738
|
+
CalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: CalendarComponent, selector: "nxt-date-time-calendar", inputs: { dateFilter: "dateFilter", firstDayOfWeek: "firstDayOfWeek", min: "min", max: "max", pickerMoment: "pickerMoment", selectMode: "selectMode", selected: "selected", selecteds: "selecteds", startView: "startView", hideOtherMonths: "hideOtherMonths" }, outputs: { pickerMomentChange: "pickerMomentChange", selectedChange: "selectedChange", userSelection: "userSelection", yearSelected: "yearSelected", monthSelected: "monthSelected" }, host: { properties: { "class.nxt-dt-calendar": "this.calendarClass" } }, ngImport: i0, template: "<div class=\"nxt-dt-calendar-control\">\n <!-- focus when keyboard tab (http://kizu.ru/en/blog/keyboard-only-focus/#x) -->\n <button class=\"nxt-dt-control nxt-dt-control-button nxt-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"0\"\n [style.visibility]=\"showControlArrows? 'visible': 'hidden'\"\n [disabled]=\"!prevButtonEnabled()\"\n [attr.aria-label]=\"prevButtonLabel\"\n (click)=\"previousClicked()\">\n <span class=\"nxt-dt-control-content nxt-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Left\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path style=\"fill-rule: evenodd; clip-rule: evenodd;\"\n d=\"M96.633,125.369l95.053-94.533c7.101-7.055,7.101-18.492,0-25.546 c-7.1-7.054-18.613-7.054-25.714,0L58.989,111.689c-3.784,3.759-5.487,8.759-5.238,13.68c-0.249,4.922,1.454,9.921,5.238,13.681 l106.983,106.398c7.101,7.055,18.613,7.055,25.714,0c7.101-7.054,7.101-18.491,0-25.544L96.633,125.369z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n </button>\n <div class=\"nxt-dt-calendar-control-content\">\n <button class=\"nxt-dt-control nxt-dt-control-button nxt-dt-control-period-button\"\n type=\"button\"\n tabindex=\"0\"\n [attr.aria-label]=\"periodButtonLabel\"\n (click)=\"toggleViews()\">\n <span class=\"nxt-dt-control-content nxt-dt-control-button-content\"\n tabindex=\"-1\">\n {{periodButtonText}}\n\n <span class=\"nxt-dt-control-button-arrow\"\n [style.transform]=\"'rotate(' + (isMonthView? 0 : 180) +'deg)'\">\n <!-- <editor-fold desc=\"SVG Arrow\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n width=\"50%\"\n height=\"50%\"\n viewBox=\"0 0 292.362 292.362\"\n style=\"enable-background:new 0 0 292.362 292.362;\"\n xml:space=\"preserve\">\n <g>\n <path d=\"M286.935,69.377c-3.614-3.617-7.898-5.424-12.848-5.424H18.274c-4.952,0-9.233,1.807-12.85,5.424\n C1.807,72.998,0,77.279,0,82.228c0,4.948,1.807,9.229,5.424,12.847l127.907,127.907c3.621,3.617,7.902,5.428,12.85,5.428\n s9.233-1.811,12.847-5.428L286.935,95.074c3.613-3.617,5.427-7.898,5.427-12.847C292.362,77.279,290.548,72.998,286.935,69.377z\" />\n </g>\n </svg>\n <!-- </editor-fold> -->\n </span>\n </span>\n </button>\n </div>\n <button class=\"nxt-dt-control nxt-dt-control-button nxt-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"0\"\n [style.visibility]=\"showControlArrows? 'visible': 'hidden'\"\n [disabled]=\"!nextButtonEnabled()\"\n [attr.aria-label]=\"nextButtonLabel\"\n (click)=\"nextClicked()\">\n <span class=\"nxt-dt-control-content nxt-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Right\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\">\n <path style=\"fill-rule:evenodd;clip-rule:evenodd;\"\n d=\"M191.75,111.689L84.766,5.291c-7.1-7.055-18.613-7.055-25.713,0\n c-7.101,7.054-7.101,18.49,0,25.544l95.053,94.534l-95.053,94.533c-7.101,7.054-7.101,18.491,0,25.545\n c7.1,7.054,18.613,7.054,25.713,0L191.75,139.05c3.784-3.759,5.487-8.759,5.238-13.681\n C197.237,120.447,195.534,115.448,191.75,111.689z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n </button>\n</div>\n<div class=\"nxt-dt-calendar-main\"\n cdkMonitorSubtreeFocus\n [ngSwitch]=\"currentView\"\n tabindex=\"-1\">\n <nxt-date-time-month-view *ngSwitchCase=\"'month'\"\n [pickerMoment]=\"pickerMoment\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode ?? 'single'\"\n [min]=\"min\"\n [max]=\"max\"\n [dateFilter]=\"dateFilter\"\n [hideOtherMonths]=\"hideOtherMonths\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (selectedChange)=\"dateSelected($event)\"\n (userSelection)=\"userSelected()\"></nxt-date-time-month-view>\n\n <nxt-date-time-year-view *ngSwitchCase=\"'year'\"\n [pickerMoment]=\"pickerMoment\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode ?? 'single'\"\n [min]=\"min\"\n [max]=\"max\"\n [dateFilter]=\"dateFilter\"\n (keyboardEnter)=\"focusActiveCell()\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (monthSelected)=\"selectMonthInYearView($event)\"\n (change)=\"goToDateInView($event, 'month')\"></nxt-date-time-year-view>\n\n <nxt-date-time-multi-year-view *ngSwitchCase=\"'multi-years'\"\n [pickerMoment]=\"pickerMoment\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode ?? 'single'\"\n [min]=\"min\"\n [max]=\"max\"\n [dateFilter]=\"dateFilter\"\n (keyboardEnter)=\"focusActiveCell()\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (yearSelected)=\"selectYearInMultiYearView($event)\"\n (change)=\"goToDateInView($event, 'year')\"></nxt-date-time-multi-year-view>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i4.CdkMonitorFocus, selector: "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", outputs: ["cdkFocusChange"], exportAs: ["cdkMonitorFocus"] }, { kind: "component", type: MultiYearViewComponent, selector: "nxt-date-time-multi-year-view", inputs: ["selectMode", "selected", "selecteds", "pickerMoment", "dateFilter", "min", "max"], outputs: ["change", "yearSelected", "pickerMomentChange", "keyboardEnter"] }, { kind: "component", type: YearViewComponent, selector: "nxt-date-time-year-view", inputs: ["selectMode", "selected", "selecteds", "pickerMoment", "dateFilter", "min", "max"], outputs: ["change", "monthSelected", "pickerMomentChange", "keyboardEnter"] }, { kind: "component", type: MonthViewComponent, selector: "nxt-date-time-month-view", inputs: ["hideOtherMonths", "firstDayOfWeek", "selectMode", "selected", "selecteds", "pickerMoment", "dateFilter", "min", "max"], outputs: ["selectedChange", "userSelection", "pickerMomentChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1739
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: CalendarComponent, decorators: [{
|
|
1760
1740
|
type: Component,
|
|
1761
|
-
args: [{ selector: '
|
|
1762
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type:
|
|
1763
|
-
type: Optional
|
|
1764
|
-
}] }, { type: undefined, decorators: [{
|
|
1765
|
-
type: Optional
|
|
1766
|
-
}, {
|
|
1741
|
+
args: [{ selector: 'nxt-date-time-calendar', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"nxt-dt-calendar-control\">\n <!-- focus when keyboard tab (http://kizu.ru/en/blog/keyboard-only-focus/#x) -->\n <button class=\"nxt-dt-control nxt-dt-control-button nxt-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"0\"\n [style.visibility]=\"showControlArrows? 'visible': 'hidden'\"\n [disabled]=\"!prevButtonEnabled()\"\n [attr.aria-label]=\"prevButtonLabel\"\n (click)=\"previousClicked()\">\n <span class=\"nxt-dt-control-content nxt-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Left\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path style=\"fill-rule: evenodd; clip-rule: evenodd;\"\n d=\"M96.633,125.369l95.053-94.533c7.101-7.055,7.101-18.492,0-25.546 c-7.1-7.054-18.613-7.054-25.714,0L58.989,111.689c-3.784,3.759-5.487,8.759-5.238,13.68c-0.249,4.922,1.454,9.921,5.238,13.681 l106.983,106.398c7.101,7.055,18.613,7.055,25.714,0c7.101-7.054,7.101-18.491,0-25.544L96.633,125.369z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n </button>\n <div class=\"nxt-dt-calendar-control-content\">\n <button class=\"nxt-dt-control nxt-dt-control-button nxt-dt-control-period-button\"\n type=\"button\"\n tabindex=\"0\"\n [attr.aria-label]=\"periodButtonLabel\"\n (click)=\"toggleViews()\">\n <span class=\"nxt-dt-control-content nxt-dt-control-button-content\"\n tabindex=\"-1\">\n {{periodButtonText}}\n\n <span class=\"nxt-dt-control-button-arrow\"\n [style.transform]=\"'rotate(' + (isMonthView? 0 : 180) +'deg)'\">\n <!-- <editor-fold desc=\"SVG Arrow\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n width=\"50%\"\n height=\"50%\"\n viewBox=\"0 0 292.362 292.362\"\n style=\"enable-background:new 0 0 292.362 292.362;\"\n xml:space=\"preserve\">\n <g>\n <path d=\"M286.935,69.377c-3.614-3.617-7.898-5.424-12.848-5.424H18.274c-4.952,0-9.233,1.807-12.85,5.424\n C1.807,72.998,0,77.279,0,82.228c0,4.948,1.807,9.229,5.424,12.847l127.907,127.907c3.621,3.617,7.902,5.428,12.85,5.428\n s9.233-1.811,12.847-5.428L286.935,95.074c3.613-3.617,5.427-7.898,5.427-12.847C292.362,77.279,290.548,72.998,286.935,69.377z\" />\n </g>\n </svg>\n <!-- </editor-fold> -->\n </span>\n </span>\n </button>\n </div>\n <button class=\"nxt-dt-control nxt-dt-control-button nxt-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"0\"\n [style.visibility]=\"showControlArrows? 'visible': 'hidden'\"\n [disabled]=\"!nextButtonEnabled()\"\n [attr.aria-label]=\"nextButtonLabel\"\n (click)=\"nextClicked()\">\n <span class=\"nxt-dt-control-content nxt-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Right\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\">\n <path style=\"fill-rule:evenodd;clip-rule:evenodd;\"\n d=\"M191.75,111.689L84.766,5.291c-7.1-7.055-18.613-7.055-25.713,0\n c-7.101,7.054-7.101,18.49,0,25.544l95.053,94.534l-95.053,94.533c-7.101,7.054-7.101,18.491,0,25.545\n c7.1,7.054,18.613,7.054,25.713,0L191.75,139.05c3.784-3.759,5.487-8.759,5.238-13.681\n C197.237,120.447,195.534,115.448,191.75,111.689z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n </button>\n</div>\n<div class=\"nxt-dt-calendar-main\"\n cdkMonitorSubtreeFocus\n [ngSwitch]=\"currentView\"\n tabindex=\"-1\">\n <nxt-date-time-month-view *ngSwitchCase=\"'month'\"\n [pickerMoment]=\"pickerMoment\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode ?? 'single'\"\n [min]=\"min\"\n [max]=\"max\"\n [dateFilter]=\"dateFilter\"\n [hideOtherMonths]=\"hideOtherMonths\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (selectedChange)=\"dateSelected($event)\"\n (userSelection)=\"userSelected()\"></nxt-date-time-month-view>\n\n <nxt-date-time-year-view *ngSwitchCase=\"'year'\"\n [pickerMoment]=\"pickerMoment\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode ?? 'single'\"\n [min]=\"min\"\n [max]=\"max\"\n [dateFilter]=\"dateFilter\"\n (keyboardEnter)=\"focusActiveCell()\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (monthSelected)=\"selectMonthInYearView($event)\"\n (change)=\"goToDateInView($event, 'month')\"></nxt-date-time-year-view>\n\n <nxt-date-time-multi-year-view *ngSwitchCase=\"'multi-years'\"\n [pickerMoment]=\"pickerMoment\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode ?? 'single'\"\n [min]=\"min\"\n [max]=\"max\"\n [dateFilter]=\"dateFilter\"\n (keyboardEnter)=\"focusActiveCell()\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (yearSelected)=\"selectYearInMultiYearView($event)\"\n (change)=\"goToDateInView($event, 'year')\"></nxt-date-time-multi-year-view>\n</div>\n" }]
|
|
1742
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: DateTimeIntl }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: DateTimeAdapter }, { type: undefined, decorators: [{
|
|
1767
1743
|
type: Inject,
|
|
1768
|
-
args: [
|
|
1744
|
+
args: [NXT_DATE_TIME_FORMATS]
|
|
1769
1745
|
}] }]; }, propDecorators: { dateFilter: [{
|
|
1770
1746
|
type: Input
|
|
1771
1747
|
}], firstDayOfWeek: [{
|
|
1772
1748
|
type: Input
|
|
1773
|
-
}],
|
|
1749
|
+
}], min: [{
|
|
1774
1750
|
type: Input
|
|
1775
|
-
}],
|
|
1751
|
+
}], max: [{
|
|
1776
1752
|
type: Input
|
|
1777
1753
|
}], pickerMoment: [{
|
|
1778
1754
|
type: Input
|
|
@@ -1796,70 +1772,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
1796
1772
|
type: Output
|
|
1797
1773
|
}], monthSelected: [{
|
|
1798
1774
|
type: Output
|
|
1799
|
-
}],
|
|
1775
|
+
}], calendarClass: [{
|
|
1800
1776
|
type: HostBinding,
|
|
1801
|
-
args: ['class.
|
|
1777
|
+
args: ['class.nxt-dt-calendar']
|
|
1802
1778
|
}] } });
|
|
1803
1779
|
|
|
1804
1780
|
let nextUniqueId = 0;
|
|
1805
|
-
class
|
|
1806
|
-
constructor(dateTimeAdapter, dateTimeFormats) {
|
|
1807
|
-
this.dateTimeAdapter = dateTimeAdapter;
|
|
1808
|
-
this.dateTimeFormats = dateTimeFormats;
|
|
1809
|
-
/**
|
|
1810
|
-
* Whether to show the second's timer
|
|
1811
|
-
*/
|
|
1812
|
-
this._showSecondsTimer = false;
|
|
1813
|
-
/**
|
|
1814
|
-
* Whether the timer is in hour12 format
|
|
1815
|
-
*/
|
|
1816
|
-
this._hour12Timer = false;
|
|
1817
|
-
/**
|
|
1818
|
-
* The view that the calendar should start in.
|
|
1819
|
-
*/
|
|
1820
|
-
this.startView = 'month';
|
|
1821
|
-
/**
|
|
1822
|
-
* Hours to change per step
|
|
1823
|
-
*/
|
|
1824
|
-
this._stepHour = 1;
|
|
1825
|
-
/**
|
|
1826
|
-
* Minutes to change per step
|
|
1827
|
-
*/
|
|
1828
|
-
this._stepMinute = 1;
|
|
1829
|
-
/**
|
|
1830
|
-
* Seconds to change per step
|
|
1831
|
-
*/
|
|
1832
|
-
this._stepSecond = 1;
|
|
1833
|
-
/**
|
|
1834
|
-
* Set the first day of week
|
|
1835
|
-
*/
|
|
1836
|
-
this._firstDayOfWeek = 0;
|
|
1837
|
-
/**
|
|
1838
|
-
* Whether to hide dates in other months at the start or end of the current month.
|
|
1839
|
-
*/
|
|
1840
|
-
this._hideOtherMonths = false;
|
|
1841
|
-
/**
|
|
1842
|
-
* Date Time Checker to check if the give dateTime is selectable
|
|
1843
|
-
*/
|
|
1844
|
-
this.dateTimeChecker = (dateTime) => (!!dateTime &&
|
|
1845
|
-
(!this.dateTimeFilter || this.dateTimeFilter(dateTime)) &&
|
|
1846
|
-
(!this.minDateTime ||
|
|
1847
|
-
this.dateTimeAdapter.compare(dateTime, this.minDateTime) >=
|
|
1848
|
-
0) &&
|
|
1849
|
-
(!this.maxDateTime ||
|
|
1850
|
-
this.dateTimeAdapter.compare(dateTime, this.maxDateTime) <= 0));
|
|
1851
|
-
if (!this.dateTimeAdapter) {
|
|
1852
|
-
throw Error('OwlDateTimePicker: No provider found for DateTimeAdapter. You must import one of the following ' +
|
|
1853
|
-
'modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ' +
|
|
1854
|
-
'custom implementation.');
|
|
1855
|
-
}
|
|
1856
|
-
if (!this.dateTimeFormats) {
|
|
1857
|
-
throw Error('OwlDateTimePicker: No provider found for OWL_DATE_TIME_FORMATS. You must import one of the following ' +
|
|
1858
|
-
'modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ' +
|
|
1859
|
-
'custom implementation.');
|
|
1860
|
-
}
|
|
1861
|
-
this._id = `owl-dt-picker-${nextUniqueId++}`;
|
|
1862
|
-
}
|
|
1781
|
+
class DateTimeDirective {
|
|
1863
1782
|
get showSecondsTimer() {
|
|
1864
1783
|
return this._showSecondsTimer;
|
|
1865
1784
|
}
|
|
@@ -1921,24 +1840,64 @@ class OwlDateTimeDirective {
|
|
|
1921
1840
|
get disabled() {
|
|
1922
1841
|
return false;
|
|
1923
1842
|
}
|
|
1843
|
+
constructor(dateTimeAdapter, dateTimeFormats) {
|
|
1844
|
+
this.dateTimeAdapter = dateTimeAdapter;
|
|
1845
|
+
this.dateTimeFormats = dateTimeFormats;
|
|
1846
|
+
/**
|
|
1847
|
+
* Whether to show the second's timer
|
|
1848
|
+
*/
|
|
1849
|
+
this._showSecondsTimer = false;
|
|
1850
|
+
/**
|
|
1851
|
+
* Whether the timer is in hour12 format
|
|
1852
|
+
*/
|
|
1853
|
+
this._hour12Timer = false;
|
|
1854
|
+
/**
|
|
1855
|
+
* The view that the calendar should start in.
|
|
1856
|
+
*/
|
|
1857
|
+
this.startView = 'month';
|
|
1858
|
+
/**
|
|
1859
|
+
* Hours to change per step
|
|
1860
|
+
*/
|
|
1861
|
+
this._stepHour = 1;
|
|
1862
|
+
/**
|
|
1863
|
+
* Minutes to change per step
|
|
1864
|
+
*/
|
|
1865
|
+
this._stepMinute = 1;
|
|
1866
|
+
/**
|
|
1867
|
+
* Seconds to change per step
|
|
1868
|
+
*/
|
|
1869
|
+
this._stepSecond = 1;
|
|
1870
|
+
/**
|
|
1871
|
+
* Set the first day of week
|
|
1872
|
+
*/
|
|
1873
|
+
this._firstDayOfWeek = 0;
|
|
1874
|
+
/**
|
|
1875
|
+
* Whether to hide dates in other months at the start or end of the current month.
|
|
1876
|
+
*/
|
|
1877
|
+
this._hideOtherMonths = false;
|
|
1878
|
+
/**
|
|
1879
|
+
* Date Time Checker to check if the give dateTime is selectable
|
|
1880
|
+
*/
|
|
1881
|
+
this.dateTimeChecker = (dateTime) => (!!dateTime &&
|
|
1882
|
+
(!this.dateTimeFilter || this.dateTimeFilter(dateTime)) &&
|
|
1883
|
+
(!this.min || this.dateTimeAdapter.compare(dateTime, this.min) >= 0) &&
|
|
1884
|
+
(!this.max || this.dateTimeAdapter.compare(dateTime, this.max) <= 0));
|
|
1885
|
+
this._id = `nxt-dt-picker-${nextUniqueId++}`;
|
|
1886
|
+
}
|
|
1924
1887
|
getValidDate(obj) {
|
|
1925
1888
|
return this.dateTimeAdapter.isDateInstance(obj) &&
|
|
1926
1889
|
this.dateTimeAdapter.isValid(obj)
|
|
1927
1890
|
? obj
|
|
1928
|
-
:
|
|
1891
|
+
: undefined;
|
|
1929
1892
|
}
|
|
1930
1893
|
}
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1894
|
+
DateTimeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeDirective, deps: [{ token: DateTimeAdapter }, { token: NXT_DATE_TIME_FORMATS }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1895
|
+
DateTimeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.1", type: DateTimeDirective, inputs: { showSecondsTimer: "showSecondsTimer", hour12Timer: "hour12Timer", startView: "startView", stepHour: "stepHour", stepMinute: "stepMinute", stepSecond: "stepSecond", firstDayOfWeek: "firstDayOfWeek", hideOtherMonths: "hideOtherMonths" }, ngImport: i0 });
|
|
1896
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeDirective, decorators: [{
|
|
1934
1897
|
type: Directive
|
|
1935
|
-
}], ctorParameters: function () { return [{ type: DateTimeAdapter, decorators: [{
|
|
1936
|
-
type: Optional
|
|
1937
|
-
}] }, { type: undefined, decorators: [{
|
|
1938
|
-
type: Optional
|
|
1939
|
-
}, {
|
|
1898
|
+
}], ctorParameters: function () { return [{ type: DateTimeAdapter }, { type: undefined, decorators: [{
|
|
1940
1899
|
type: Inject,
|
|
1941
|
-
args: [
|
|
1900
|
+
args: [NXT_DATE_TIME_FORMATS]
|
|
1942
1901
|
}] }]; }, propDecorators: { showSecondsTimer: [{
|
|
1943
1902
|
type: Input
|
|
1944
1903
|
}], hour12Timer: [{
|
|
@@ -1959,41 +1918,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
1959
1918
|
|
|
1960
1919
|
class NumberFixedLenPipe {
|
|
1961
1920
|
transform(num, len) {
|
|
1921
|
+
if (num == undefined || !Number.isFinite(num))
|
|
1922
|
+
return undefined;
|
|
1962
1923
|
const number = Math.floor(num);
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
}
|
|
1967
|
-
let numString = number.toString();
|
|
1968
|
-
while (numString.length < length) {
|
|
1969
|
-
numString = '0' + numString;
|
|
1970
|
-
}
|
|
1971
|
-
return numString;
|
|
1924
|
+
if (len == undefined || !Number.isFinite(len))
|
|
1925
|
+
return number;
|
|
1926
|
+
return number.toFixed(0).padStart(Math.floor(len), '0');
|
|
1972
1927
|
}
|
|
1973
1928
|
}
|
|
1974
|
-
NumberFixedLenPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1975
|
-
NumberFixedLenPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "
|
|
1976
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1929
|
+
NumberFixedLenPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: NumberFixedLenPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1930
|
+
NumberFixedLenPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.1", ngImport: i0, type: NumberFixedLenPipe, name: "numberFixedLen" });
|
|
1931
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: NumberFixedLenPipe, decorators: [{
|
|
1977
1932
|
type: Pipe,
|
|
1978
1933
|
args: [{
|
|
1979
1934
|
name: 'numberFixedLen'
|
|
1980
1935
|
}]
|
|
1981
1936
|
}] });
|
|
1982
1937
|
|
|
1983
|
-
class
|
|
1938
|
+
class TimerBoxComponent {
|
|
1939
|
+
get displayValue() {
|
|
1940
|
+
return this.boxValue || this.value;
|
|
1941
|
+
}
|
|
1942
|
+
get timerBoxClass() {
|
|
1943
|
+
return true;
|
|
1944
|
+
}
|
|
1984
1945
|
constructor() {
|
|
1985
1946
|
this.showDivider = false;
|
|
1947
|
+
this.upBtnDisabled = false;
|
|
1948
|
+
this.downBtnDisabled = false;
|
|
1949
|
+
this.value = 0;
|
|
1950
|
+
this.min = 0;
|
|
1951
|
+
this.max = 0;
|
|
1986
1952
|
this.step = 1;
|
|
1987
1953
|
this.valueChange = new EventEmitter();
|
|
1988
1954
|
this.inputChange = new EventEmitter();
|
|
1989
1955
|
this.inputStream = new Subject();
|
|
1990
|
-
this.inputStreamSub = Subscription.EMPTY;
|
|
1991
|
-
}
|
|
1992
|
-
get displayValue() {
|
|
1993
|
-
return this.boxValue || this.value;
|
|
1994
|
-
}
|
|
1995
|
-
get owlDTTimerBoxClass() {
|
|
1996
|
-
return true;
|
|
1997
1956
|
}
|
|
1998
1957
|
ngOnInit() {
|
|
1999
1958
|
this.inputStreamSub = this.inputStream.pipe(debounceTime(500), distinctUntilChanged()).subscribe((val) => {
|
|
@@ -2004,7 +1963,8 @@ class OwlTimerBoxComponent {
|
|
|
2004
1963
|
});
|
|
2005
1964
|
}
|
|
2006
1965
|
ngOnDestroy() {
|
|
2007
|
-
this.inputStreamSub
|
|
1966
|
+
this.inputStreamSub?.unsubscribe();
|
|
1967
|
+
this.inputStreamSub = undefined;
|
|
2008
1968
|
}
|
|
2009
1969
|
upBtnClicked() {
|
|
2010
1970
|
this.updateValue(this.value + this.step);
|
|
@@ -2025,11 +1985,11 @@ class OwlTimerBoxComponent {
|
|
|
2025
1985
|
this.inputChange.emit(value);
|
|
2026
1986
|
}
|
|
2027
1987
|
}
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1988
|
+
TimerBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TimerBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1989
|
+
TimerBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: TimerBoxComponent, selector: "nxt-date-time-timer-box", inputs: { showDivider: "showDivider", upBtnAriaLabel: "upBtnAriaLabel", upBtnDisabled: "upBtnDisabled", downBtnAriaLabel: "downBtnAriaLabel", downBtnDisabled: "downBtnDisabled", boxValue: "boxValue", value: "value", min: "min", max: "max", step: "step", inputLabel: "inputLabel" }, outputs: { valueChange: "valueChange", inputChange: "inputChange" }, host: { properties: { "class.nxt-dt-timer-box": "this.timerBoxClass" } }, ngImport: i0, template: "<div *ngIf=\"showDivider\"\n class=\"nxt-dt-timer-divider\"\n aria-hidden=\"true\"></div>\n<button class=\"nxt-dt-control-button nxt-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"upBtnDisabled\"\n [attr.aria-label]=\"upBtnAriaLabel\"\n (click)=\"upBtnClicked()\">\n <span class=\"nxt-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Up\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 451.847 451.846\"\n style=\"enable-background:new 0 0 451.847 451.846;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path d=\"M248.292,106.406l194.281,194.29c12.365,12.359,12.365,32.391,0,44.744c-12.354,12.354-32.391,12.354-44.744,0\n L225.923,173.529L54.018,345.44c-12.36,12.354-32.395,12.354-44.748,0c-12.359-12.354-12.359-32.391,0-44.75L203.554,106.4\n c6.18-6.174,14.271-9.259,22.369-9.259C234.018,97.141,242.115,100.232,248.292,106.406z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n<label class=\"nxt-dt-timer-content\">\n <input class=\"nxt-dt-timer-input\"\n maxlength=\"2\"\n [value]=\"displayValue | numberFixedLen : 2\"\n (input)=\"handleInputChange(valueInput.value)\"\n #valueInput>\n <span class=\"nxt-hidden-accessible\">{{inputLabel}}</span>\n</label>\n<button class=\"nxt-dt-control-button nxt-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"downBtnDisabled\"\n [attr.aria-label]=\"downBtnAriaLabel\"\n (click)=\"downBtnClicked()\">\n <span class=\"nxt-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Down\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 451.847 451.846\"\n style=\"enable-background:new 0 0 451.847 451.846;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path d=\"M225.923,354.706c-8.098,0-16.195-3.092-22.369-9.263L9.27,151.157c-12.359-12.359-12.359-32.397,0-44.751\n c12.354-12.354,32.388-12.354,44.748,0l171.905,171.915l171.906-171.909c12.359-12.354,32.391-12.354,44.744,0\n c12.365,12.354,12.365,32.392,0,44.751L248.292,345.449C242.115,351.621,234.018,354.706,225.923,354.706z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: NumberFixedLenPipe, name: "numberFixedLen" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1990
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TimerBoxComponent, decorators: [{
|
|
2031
1991
|
type: Component,
|
|
2032
|
-
args: [{
|
|
1992
|
+
args: [{ selector: 'nxt-date-time-timer-box', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"showDivider\"\n class=\"nxt-dt-timer-divider\"\n aria-hidden=\"true\"></div>\n<button class=\"nxt-dt-control-button nxt-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"upBtnDisabled\"\n [attr.aria-label]=\"upBtnAriaLabel\"\n (click)=\"upBtnClicked()\">\n <span class=\"nxt-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Up\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 451.847 451.846\"\n style=\"enable-background:new 0 0 451.847 451.846;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path d=\"M248.292,106.406l194.281,194.29c12.365,12.359,12.365,32.391,0,44.744c-12.354,12.354-32.391,12.354-44.744,0\n L225.923,173.529L54.018,345.44c-12.36,12.354-32.395,12.354-44.748,0c-12.359-12.354-12.359-32.391,0-44.75L203.554,106.4\n c6.18-6.174,14.271-9.259,22.369-9.259C234.018,97.141,242.115,100.232,248.292,106.406z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n<label class=\"nxt-dt-timer-content\">\n <input class=\"nxt-dt-timer-input\"\n maxlength=\"2\"\n [value]=\"displayValue | numberFixedLen : 2\"\n (input)=\"handleInputChange(valueInput.value)\"\n #valueInput>\n <span class=\"nxt-hidden-accessible\">{{inputLabel}}</span>\n</label>\n<button class=\"nxt-dt-control-button nxt-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"downBtnDisabled\"\n [attr.aria-label]=\"downBtnAriaLabel\"\n (click)=\"downBtnClicked()\">\n <span class=\"nxt-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Down\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 451.847 451.846\"\n style=\"enable-background:new 0 0 451.847 451.846;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path d=\"M225.923,354.706c-8.098,0-16.195-3.092-22.369-9.263L9.27,151.157c-12.359-12.359-12.359-32.397,0-44.751\n c12.354-12.354,32.388-12.354,44.748,0l171.905,171.915l171.906-171.909c12.359-12.354,32.391-12.354,44.744,0\n c12.365,12.354,12.365,32.392,0,44.751L248.292,345.449C242.115,351.621,234.018,354.706,225.923,354.706z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n" }]
|
|
2033
1993
|
}], ctorParameters: function () { return []; }, propDecorators: { showDivider: [{
|
|
2034
1994
|
type: Input
|
|
2035
1995
|
}], upBtnAriaLabel: [{
|
|
@@ -2056,52 +2016,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
2056
2016
|
type: Output
|
|
2057
2017
|
}], inputChange: [{
|
|
2058
2018
|
type: Output
|
|
2059
|
-
}],
|
|
2019
|
+
}], timerBoxClass: [{
|
|
2060
2020
|
type: HostBinding,
|
|
2061
|
-
args: ['class.
|
|
2021
|
+
args: ['class.nxt-dt-timer-box']
|
|
2062
2022
|
}] } });
|
|
2063
2023
|
|
|
2064
|
-
class
|
|
2065
|
-
constructor(ngZone, elmRef, pickerIntl, cdRef, dateTimeAdapter) {
|
|
2066
|
-
this.ngZone = ngZone;
|
|
2067
|
-
this.elmRef = elmRef;
|
|
2068
|
-
this.pickerIntl = pickerIntl;
|
|
2069
|
-
this.cdRef = cdRef;
|
|
2070
|
-
this.dateTimeAdapter = dateTimeAdapter;
|
|
2071
|
-
this.isPM = false; // a flag indicates the current timer moment is in PM or AM
|
|
2072
|
-
/**
|
|
2073
|
-
* Hours to change per step
|
|
2074
|
-
*/
|
|
2075
|
-
this.stepHour = 1;
|
|
2076
|
-
/**
|
|
2077
|
-
* Minutes to change per step
|
|
2078
|
-
*/
|
|
2079
|
-
this.stepMinute = 1;
|
|
2080
|
-
/**
|
|
2081
|
-
* Seconds to change per step
|
|
2082
|
-
*/
|
|
2083
|
-
this.stepSecond = 1;
|
|
2084
|
-
this.selectedChange = new EventEmitter();
|
|
2085
|
-
}
|
|
2024
|
+
class TimerComponent {
|
|
2086
2025
|
get pickerMoment() {
|
|
2087
2026
|
return this._pickerMoment;
|
|
2088
2027
|
}
|
|
2089
2028
|
set pickerMoment(value) {
|
|
2090
2029
|
value = this.dateTimeAdapter.deserialize(value);
|
|
2091
|
-
this._pickerMoment =
|
|
2092
|
-
this.getValidDate(value) || this.dateTimeAdapter.now();
|
|
2030
|
+
this._pickerMoment = this.getValidDate(value) || this.dateTimeAdapter.now();
|
|
2093
2031
|
}
|
|
2094
|
-
get
|
|
2032
|
+
get min() {
|
|
2095
2033
|
return this._minDateTime;
|
|
2096
2034
|
}
|
|
2097
|
-
set
|
|
2035
|
+
set min(value) {
|
|
2098
2036
|
value = this.dateTimeAdapter.deserialize(value);
|
|
2099
2037
|
this._minDateTime = this.getValidDate(value);
|
|
2100
2038
|
}
|
|
2101
|
-
get
|
|
2039
|
+
get max() {
|
|
2102
2040
|
return this._maxDateTime;
|
|
2103
2041
|
}
|
|
2104
|
-
set
|
|
2042
|
+
set max(value) {
|
|
2105
2043
|
value = this.dateTimeAdapter.deserialize(value);
|
|
2106
2044
|
this._maxDateTime = this.getValidDate(value);
|
|
2107
2045
|
}
|
|
@@ -2165,12 +2103,41 @@ class OwlTimerComponent {
|
|
|
2165
2103
|
? this.pickerIntl.hour12PMLabel
|
|
2166
2104
|
: this.pickerIntl.hour12AMLabel;
|
|
2167
2105
|
}
|
|
2168
|
-
get
|
|
2106
|
+
get timerClass() {
|
|
2169
2107
|
return true;
|
|
2170
2108
|
}
|
|
2171
|
-
get
|
|
2109
|
+
get timeTabIndex() {
|
|
2172
2110
|
return -1;
|
|
2173
2111
|
}
|
|
2112
|
+
constructor(ngZone, elmRef, pickerIntl, cdRef, dateTimeAdapter) {
|
|
2113
|
+
this.ngZone = ngZone;
|
|
2114
|
+
this.elmRef = elmRef;
|
|
2115
|
+
this.pickerIntl = pickerIntl;
|
|
2116
|
+
this.cdRef = cdRef;
|
|
2117
|
+
this.dateTimeAdapter = dateTimeAdapter;
|
|
2118
|
+
this.isPM = false; // a flag indicates the current timer moment is in PM or AM
|
|
2119
|
+
/**
|
|
2120
|
+
* Whether to show the second's timer
|
|
2121
|
+
*/
|
|
2122
|
+
this.showSecondsTimer = false;
|
|
2123
|
+
/**
|
|
2124
|
+
* Whether the timer is in hour12 format
|
|
2125
|
+
*/
|
|
2126
|
+
this.hour12Timer = false;
|
|
2127
|
+
/**
|
|
2128
|
+
* Hours to change per step
|
|
2129
|
+
*/
|
|
2130
|
+
this.stepHour = 1;
|
|
2131
|
+
/**
|
|
2132
|
+
* Minutes to change per step
|
|
2133
|
+
*/
|
|
2134
|
+
this.stepMinute = 1;
|
|
2135
|
+
/**
|
|
2136
|
+
* Seconds to change per step
|
|
2137
|
+
*/
|
|
2138
|
+
this.stepSecond = 1;
|
|
2139
|
+
this.selectedChange = new EventEmitter();
|
|
2140
|
+
}
|
|
2174
2141
|
ngOnInit() { }
|
|
2175
2142
|
/**
|
|
2176
2143
|
* Focus to the host element
|
|
@@ -2232,43 +2199,43 @@ class OwlTimerComponent {
|
|
|
2232
2199
|
* Check if the up hour button is enabled
|
|
2233
2200
|
*/
|
|
2234
2201
|
upHourEnabled() {
|
|
2235
|
-
return (!this.
|
|
2236
|
-
this.compareHours(this.stepHour, this.
|
|
2202
|
+
return (!this.max ||
|
|
2203
|
+
this.compareHours(this.stepHour, this.max) < 1);
|
|
2237
2204
|
}
|
|
2238
2205
|
/**
|
|
2239
2206
|
* Check if the down hour button is enabled
|
|
2240
2207
|
*/
|
|
2241
2208
|
downHourEnabled() {
|
|
2242
|
-
return (!this.
|
|
2243
|
-
this.compareHours(-this.stepHour, this.
|
|
2209
|
+
return (!this.min ||
|
|
2210
|
+
this.compareHours(-this.stepHour, this.min) > -1);
|
|
2244
2211
|
}
|
|
2245
2212
|
/**
|
|
2246
2213
|
* Check if the up minute button is enabled
|
|
2247
2214
|
*/
|
|
2248
2215
|
upMinuteEnabled() {
|
|
2249
|
-
return (!this.
|
|
2250
|
-
this.compareMinutes(this.stepMinute, this.
|
|
2216
|
+
return (!this.max ||
|
|
2217
|
+
this.compareMinutes(this.stepMinute, this.max) < 1);
|
|
2251
2218
|
}
|
|
2252
2219
|
/**
|
|
2253
2220
|
* Check if the down minute button is enabled
|
|
2254
2221
|
*/
|
|
2255
2222
|
downMinuteEnabled() {
|
|
2256
|
-
return (!this.
|
|
2257
|
-
this.compareMinutes(-this.stepMinute, this.
|
|
2223
|
+
return (!this.min ||
|
|
2224
|
+
this.compareMinutes(-this.stepMinute, this.min) > -1);
|
|
2258
2225
|
}
|
|
2259
2226
|
/**
|
|
2260
2227
|
* Check if the up second button is enabled
|
|
2261
2228
|
*/
|
|
2262
2229
|
upSecondEnabled() {
|
|
2263
|
-
return (!this.
|
|
2264
|
-
this.compareSeconds(this.stepSecond, this.
|
|
2230
|
+
return (!this.max ||
|
|
2231
|
+
this.compareSeconds(this.stepSecond, this.max) < 1);
|
|
2265
2232
|
}
|
|
2266
2233
|
/**
|
|
2267
2234
|
* Check if the down second button is enabled
|
|
2268
2235
|
*/
|
|
2269
2236
|
downSecondEnabled() {
|
|
2270
|
-
return (!this.
|
|
2271
|
-
this.compareSeconds(-this.stepSecond, this.
|
|
2237
|
+
return (!this.min ||
|
|
2238
|
+
this.compareSeconds(-this.stepSecond, this.min) > -1);
|
|
2272
2239
|
}
|
|
2273
2240
|
/**
|
|
2274
2241
|
* PickerMoment's hour value +/- certain amount and compare it to the give date
|
|
@@ -2310,21 +2277,19 @@ class OwlTimerComponent {
|
|
|
2310
2277
|
return this.dateTimeAdapter.isDateInstance(obj) &&
|
|
2311
2278
|
this.dateTimeAdapter.isValid(obj)
|
|
2312
2279
|
? obj
|
|
2313
|
-
:
|
|
2280
|
+
: undefined;
|
|
2314
2281
|
}
|
|
2315
2282
|
}
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2283
|
+
TimerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TimerComponent, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }, { token: DateTimeIntl }, { token: i0.ChangeDetectorRef }, { token: DateTimeAdapter }], target: i0.ɵɵFactoryTarget.Component });
|
|
2284
|
+
TimerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: TimerComponent, selector: "nxt-date-time-timer", inputs: { pickerMoment: "pickerMoment", min: "min", max: "max", showSecondsTimer: "showSecondsTimer", hour12Timer: "hour12Timer", stepHour: "stepHour", stepMinute: "stepMinute", stepSecond: "stepSecond" }, outputs: { selectedChange: "selectedChange" }, host: { properties: { "class.nxt-dt-timer": "this.timerClass", "attr.tabindex": "this.timeTabIndex" } }, ngImport: i0, template: "<nxt-date-time-timer-box [upBtnAriaLabel]=\"upHourButtonLabel\"\n [downBtnAriaLabel]=\"downHourButtonLabel\"\n [upBtnDisabled]=\"!upHourEnabled()\"\n [downBtnDisabled]=\"!downHourEnabled()\"\n [boxValue]=\"hourBoxValue\"\n [value]=\"hourValue\"\n [min]=\"0\"\n [max]=\"23\"\n [step]=\"stepHour\"\n inputLabel=\"Hour\"\n (inputChange)=\"setHourValueViaInput($event)\"\n (valueChange)=\"setHourValue($event)\"></nxt-date-time-timer-box>\n<nxt-date-time-timer-box [showDivider]=\"true\"\n [upBtnAriaLabel]=\"upMinuteButtonLabel\"\n [downBtnAriaLabel]=\"downMinuteButtonLabel\"\n [upBtnDisabled]=\"!upMinuteEnabled()\"\n [downBtnDisabled]=\"!downMinuteEnabled()\"\n [value]=\"minuteValue\"\n [min]=\"0\"\n [max]=\"59\"\n [step]=\"stepMinute\"\n inputLabel=\"Minute\"\n (inputChange)=\"setMinuteValue($event)\"\n (valueChange)=\"setMinuteValue($event)\"></nxt-date-time-timer-box>\n<nxt-date-time-timer-box *ngIf=\"showSecondsTimer\"\n [showDivider]=\"true\"\n [upBtnAriaLabel]=\"upSecondButtonLabel\"\n [downBtnAriaLabel]=\"downSecondButtonLabel\"\n [upBtnDisabled]=\"!upSecondEnabled()\"\n [downBtnDisabled]=\"!downSecondEnabled()\"\n [value]=\"secondValue\"\n [min]=\"0\"\n [max]=\"59\"\n [step]=\"stepSecond\"\n inputLabel=\"Second\"\n (inputChange)=\"setSecondValue($event)\"\n (valueChange)=\"setSecondValue($event)\"></nxt-date-time-timer-box>\n\n<div *ngIf=\"hour12Timer\"\n class=\"nxt-dt-timer-hour12\">\n <button class=\"nxt-dt-control-button nxt-dt-timer-hour12-box\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"setMeridiem($event)\">\n <span class=\"nxt-dt-control-button-content\"\n tabindex=\"-1\">\n {{hour12ButtonLabel}}\n </span>\n </button>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TimerBoxComponent, selector: "nxt-date-time-timer-box", inputs: ["showDivider", "upBtnAriaLabel", "upBtnDisabled", "downBtnAriaLabel", "downBtnDisabled", "boxValue", "value", "min", "max", "step", "inputLabel"], outputs: ["valueChange", "inputChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TimerComponent, decorators: [{
|
|
2319
2286
|
type: Component,
|
|
2320
|
-
args: [{
|
|
2321
|
-
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ElementRef }, { type:
|
|
2322
|
-
type: Optional
|
|
2323
|
-
}] }]; }, propDecorators: { pickerMoment: [{
|
|
2287
|
+
args: [{ selector: 'nxt-date-time-timer', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<nxt-date-time-timer-box [upBtnAriaLabel]=\"upHourButtonLabel\"\n [downBtnAriaLabel]=\"downHourButtonLabel\"\n [upBtnDisabled]=\"!upHourEnabled()\"\n [downBtnDisabled]=\"!downHourEnabled()\"\n [boxValue]=\"hourBoxValue\"\n [value]=\"hourValue\"\n [min]=\"0\"\n [max]=\"23\"\n [step]=\"stepHour\"\n inputLabel=\"Hour\"\n (inputChange)=\"setHourValueViaInput($event)\"\n (valueChange)=\"setHourValue($event)\"></nxt-date-time-timer-box>\n<nxt-date-time-timer-box [showDivider]=\"true\"\n [upBtnAriaLabel]=\"upMinuteButtonLabel\"\n [downBtnAriaLabel]=\"downMinuteButtonLabel\"\n [upBtnDisabled]=\"!upMinuteEnabled()\"\n [downBtnDisabled]=\"!downMinuteEnabled()\"\n [value]=\"minuteValue\"\n [min]=\"0\"\n [max]=\"59\"\n [step]=\"stepMinute\"\n inputLabel=\"Minute\"\n (inputChange)=\"setMinuteValue($event)\"\n (valueChange)=\"setMinuteValue($event)\"></nxt-date-time-timer-box>\n<nxt-date-time-timer-box *ngIf=\"showSecondsTimer\"\n [showDivider]=\"true\"\n [upBtnAriaLabel]=\"upSecondButtonLabel\"\n [downBtnAriaLabel]=\"downSecondButtonLabel\"\n [upBtnDisabled]=\"!upSecondEnabled()\"\n [downBtnDisabled]=\"!downSecondEnabled()\"\n [value]=\"secondValue\"\n [min]=\"0\"\n [max]=\"59\"\n [step]=\"stepSecond\"\n inputLabel=\"Second\"\n (inputChange)=\"setSecondValue($event)\"\n (valueChange)=\"setSecondValue($event)\"></nxt-date-time-timer-box>\n\n<div *ngIf=\"hour12Timer\"\n class=\"nxt-dt-timer-hour12\">\n <button class=\"nxt-dt-control-button nxt-dt-timer-hour12-box\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"setMeridiem($event)\">\n <span class=\"nxt-dt-control-button-content\"\n tabindex=\"-1\">\n {{hour12ButtonLabel}}\n </span>\n </button>\n</div>\n" }]
|
|
2288
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ElementRef }, { type: DateTimeIntl }, { type: i0.ChangeDetectorRef }, { type: DateTimeAdapter }]; }, propDecorators: { pickerMoment: [{
|
|
2324
2289
|
type: Input
|
|
2325
|
-
}],
|
|
2290
|
+
}], min: [{
|
|
2326
2291
|
type: Input
|
|
2327
|
-
}],
|
|
2292
|
+
}], max: [{
|
|
2328
2293
|
type: Input
|
|
2329
2294
|
}], showSecondsTimer: [{
|
|
2330
2295
|
type: Input
|
|
@@ -2338,15 +2303,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
2338
2303
|
type: Input
|
|
2339
2304
|
}], selectedChange: [{
|
|
2340
2305
|
type: Output
|
|
2341
|
-
}],
|
|
2306
|
+
}], timerClass: [{
|
|
2342
2307
|
type: HostBinding,
|
|
2343
|
-
args: ['class.
|
|
2344
|
-
}],
|
|
2308
|
+
args: ['class.nxt-dt-timer']
|
|
2309
|
+
}], timeTabIndex: [{
|
|
2345
2310
|
type: HostBinding,
|
|
2346
2311
|
args: ['attr.tabindex']
|
|
2347
2312
|
}] } });
|
|
2348
2313
|
|
|
2349
|
-
const
|
|
2314
|
+
const dateTimePickerAnimations = {
|
|
2350
2315
|
transformPicker: trigger('transformPicker', [
|
|
2351
2316
|
state('void', style({ opacity: 0, transform: 'scale(1, 0)' })),
|
|
2352
2317
|
state('enter', style({ opacity: 1, transform: 'scale(1, 1)' })),
|
|
@@ -2363,43 +2328,18 @@ const owlDateTimePickerAnimations = {
|
|
|
2363
2328
|
])
|
|
2364
2329
|
};
|
|
2365
2330
|
|
|
2366
|
-
class
|
|
2367
|
-
constructor(cdRef, elmRef, pickerIntl, dateTimeAdapter) {
|
|
2368
|
-
this.cdRef = cdRef;
|
|
2369
|
-
this.elmRef = elmRef;
|
|
2370
|
-
this.pickerIntl = pickerIntl;
|
|
2371
|
-
this.dateTimeAdapter = dateTimeAdapter;
|
|
2372
|
-
this.activeSelectedIndex = 0; // The current active SelectedIndex in range select mode (0: 'from', 1: 'to')
|
|
2373
|
-
/**
|
|
2374
|
-
* Stream emits when try to hide picker
|
|
2375
|
-
* */
|
|
2376
|
-
this.hidePicker$ = new Subject();
|
|
2377
|
-
/**
|
|
2378
|
-
* Stream emits when try to confirm the selected value
|
|
2379
|
-
* */
|
|
2380
|
-
this.confirmSelected$ = new Subject();
|
|
2381
|
-
this.pickerOpened$ = new Subject();
|
|
2382
|
-
}
|
|
2383
|
-
get hidePickerStream() {
|
|
2384
|
-
return this.hidePicker$.asObservable();
|
|
2385
|
-
}
|
|
2386
|
-
get confirmSelectedStream() {
|
|
2387
|
-
return this.confirmSelected$.asObservable();
|
|
2388
|
-
}
|
|
2389
|
-
get pickerOpenedStream() {
|
|
2390
|
-
return this.pickerOpened$.asObservable();
|
|
2391
|
-
}
|
|
2331
|
+
class DateTimeContainerComponent {
|
|
2392
2332
|
get pickerMoment() {
|
|
2393
2333
|
return this._clamPickerMoment;
|
|
2394
2334
|
}
|
|
2395
2335
|
set pickerMoment(value) {
|
|
2396
2336
|
if (value) {
|
|
2397
|
-
this._clamPickerMoment = this.dateTimeAdapter.clampDate(value, this.picker
|
|
2337
|
+
this._clamPickerMoment = this.dateTimeAdapter.clampDate(value, this.picker?.min, this.picker?.max);
|
|
2398
2338
|
}
|
|
2399
2339
|
this.cdRef.markForCheck();
|
|
2400
2340
|
}
|
|
2401
2341
|
get pickerType() {
|
|
2402
|
-
return this.picker
|
|
2342
|
+
return this.picker?.pickerType;
|
|
2403
2343
|
}
|
|
2404
2344
|
get cancelLabel() {
|
|
2405
2345
|
return this.pickerIntl.cancelBtnLabel;
|
|
@@ -2423,18 +2363,18 @@ class OwlDateTimeContainerComponent {
|
|
|
2423
2363
|
* The range 'from' formatted value
|
|
2424
2364
|
* */
|
|
2425
2365
|
get fromFormattedValue() {
|
|
2426
|
-
const value = this.picker
|
|
2366
|
+
const value = this.picker?.selecteds[0];
|
|
2427
2367
|
return value
|
|
2428
|
-
? this.dateTimeAdapter.format(value, this.picker
|
|
2368
|
+
? this.dateTimeAdapter.format(value, this.picker?.formatString)
|
|
2429
2369
|
: '';
|
|
2430
2370
|
}
|
|
2431
2371
|
/**
|
|
2432
2372
|
* The range 'to' formatted value
|
|
2433
2373
|
* */
|
|
2434
2374
|
get toFormattedValue() {
|
|
2435
|
-
const value = this.picker
|
|
2375
|
+
const value = this.picker?.selecteds[1];
|
|
2436
2376
|
return value
|
|
2437
|
-
? this.dateTimeAdapter.format(value, this.picker
|
|
2377
|
+
? this.dateTimeAdapter.format(value, this.picker?.formatString)
|
|
2438
2378
|
: '';
|
|
2439
2379
|
}
|
|
2440
2380
|
/**
|
|
@@ -2443,33 +2383,52 @@ class OwlDateTimeContainerComponent {
|
|
|
2443
2383
|
* 2) picker type is NOT 'calendar' and the picker mode is NOT 'inline'
|
|
2444
2384
|
* */
|
|
2445
2385
|
get showControlButtons() {
|
|
2446
|
-
return (this.picker
|
|
2447
|
-
(this.picker
|
|
2448
|
-
this.picker
|
|
2386
|
+
return (this.picker?.pickerMode === 'dialog' ||
|
|
2387
|
+
(this.picker?.pickerType !== 'calendar' &&
|
|
2388
|
+
this.picker?.pickerMode !== 'inline'));
|
|
2449
2389
|
}
|
|
2450
2390
|
get containerElm() {
|
|
2451
2391
|
return this.elmRef.nativeElement;
|
|
2452
2392
|
}
|
|
2453
|
-
get
|
|
2393
|
+
get containerClass() {
|
|
2454
2394
|
return true;
|
|
2455
2395
|
}
|
|
2456
|
-
get
|
|
2457
|
-
return this.picker
|
|
2396
|
+
get popupContainerClass() {
|
|
2397
|
+
return this.picker?.pickerMode === 'popup';
|
|
2458
2398
|
}
|
|
2459
|
-
get
|
|
2460
|
-
return this.picker
|
|
2399
|
+
get dialogContainerClass() {
|
|
2400
|
+
return this.picker?.pickerMode === 'dialog';
|
|
2461
2401
|
}
|
|
2462
|
-
get
|
|
2463
|
-
return this.picker
|
|
2402
|
+
get inlineContainerClass() {
|
|
2403
|
+
return this.picker?.pickerMode === 'inline';
|
|
2464
2404
|
}
|
|
2465
|
-
get
|
|
2466
|
-
return this.picker
|
|
2405
|
+
get containerDisabledClass() {
|
|
2406
|
+
return !!this.picker?.disabled;
|
|
2467
2407
|
}
|
|
2468
|
-
get
|
|
2469
|
-
return this.picker
|
|
2408
|
+
get containerId() {
|
|
2409
|
+
return this.picker?.id;
|
|
2470
2410
|
}
|
|
2471
|
-
get
|
|
2472
|
-
return this.picker
|
|
2411
|
+
get containerAnimation() {
|
|
2412
|
+
return this.picker?.pickerMode === 'inline' ? '' : 'enter';
|
|
2413
|
+
}
|
|
2414
|
+
constructor(cdRef, elmRef, pickerIntl, dateTimeAdapter) {
|
|
2415
|
+
this.cdRef = cdRef;
|
|
2416
|
+
this.elmRef = elmRef;
|
|
2417
|
+
this.pickerIntl = pickerIntl;
|
|
2418
|
+
this.dateTimeAdapter = dateTimeAdapter;
|
|
2419
|
+
this.activeSelectedIndex = 0; // The current active SelectedIndex in range select mode (0: 'from', 1: 'to')
|
|
2420
|
+
/**
|
|
2421
|
+
* Stream emits when try to hide picker
|
|
2422
|
+
* */
|
|
2423
|
+
this.hidePicker$ = new Subject();
|
|
2424
|
+
this.hidePickerStream = this.hidePicker$.asObservable();
|
|
2425
|
+
/**
|
|
2426
|
+
* Stream emits when try to confirm the selected value
|
|
2427
|
+
* */
|
|
2428
|
+
this.confirmSelected$ = new Subject();
|
|
2429
|
+
this.confirmSelectedStream = this.confirmSelected$.asObservable();
|
|
2430
|
+
this.pickerOpened$ = new Subject();
|
|
2431
|
+
this.pickerOpenedStream = this.pickerOpened$.asObservable();
|
|
2473
2432
|
}
|
|
2474
2433
|
ngOnInit() { }
|
|
2475
2434
|
ngAfterContentInit() {
|
|
@@ -2486,21 +2445,21 @@ class OwlDateTimeContainerComponent {
|
|
|
2486
2445
|
}
|
|
2487
2446
|
dateSelected(date) {
|
|
2488
2447
|
let result;
|
|
2489
|
-
if (this.picker
|
|
2448
|
+
if (this.picker?.isInSingleMode) {
|
|
2490
2449
|
result = this.dateSelectedInSingleMode(date);
|
|
2491
2450
|
if (result) {
|
|
2492
2451
|
this.pickerMoment = result;
|
|
2493
2452
|
this.picker.select(result);
|
|
2494
2453
|
}
|
|
2495
2454
|
else {
|
|
2496
|
-
// we close the picker when result is
|
|
2455
|
+
// we close the picker when result is undefined and pickerType is calendar.
|
|
2497
2456
|
if (this.pickerType === 'calendar') {
|
|
2498
|
-
this.hidePicker$.next(
|
|
2457
|
+
this.hidePicker$.next();
|
|
2499
2458
|
}
|
|
2500
2459
|
}
|
|
2501
2460
|
return;
|
|
2502
2461
|
}
|
|
2503
|
-
if (this.picker
|
|
2462
|
+
if (this.picker?.isInRangeMode) {
|
|
2504
2463
|
result = this.dateSelectedInRangeMode(date);
|
|
2505
2464
|
if (result) {
|
|
2506
2465
|
this.pickerMoment = result[this.activeSelectedIndex];
|
|
@@ -2510,7 +2469,7 @@ class OwlDateTimeContainerComponent {
|
|
|
2510
2469
|
}
|
|
2511
2470
|
timeSelected(time) {
|
|
2512
2471
|
this.pickerMoment = this.dateTimeAdapter.clone(time);
|
|
2513
|
-
if (!this.picker
|
|
2472
|
+
if (!this.picker?.dateTimeChecker(this.pickerMoment)) {
|
|
2514
2473
|
return;
|
|
2515
2474
|
}
|
|
2516
2475
|
if (this.picker.isInSingleMode) {
|
|
@@ -2518,7 +2477,7 @@ class OwlDateTimeContainerComponent {
|
|
|
2518
2477
|
return;
|
|
2519
2478
|
}
|
|
2520
2479
|
if (this.picker.isInRangeMode) {
|
|
2521
|
-
const selecteds = [...this.picker
|
|
2480
|
+
const selecteds = [...this.picker?.selecteds || []];
|
|
2522
2481
|
// check if the 'from' is after 'to' or 'to'is before 'from'
|
|
2523
2482
|
// In this case, we set both the 'from' and 'to' the same value
|
|
2524
2483
|
if ((this.activeSelectedIndex === 0 &&
|
|
@@ -2540,7 +2499,7 @@ class OwlDateTimeContainerComponent {
|
|
|
2540
2499
|
* Handle click on cancel button
|
|
2541
2500
|
*/
|
|
2542
2501
|
onCancelClicked(event) {
|
|
2543
|
-
this.hidePicker$.next(
|
|
2502
|
+
this.hidePicker$.next();
|
|
2544
2503
|
event.preventDefault();
|
|
2545
2504
|
return;
|
|
2546
2505
|
}
|
|
@@ -2548,8 +2507,8 @@ class OwlDateTimeContainerComponent {
|
|
|
2548
2507
|
* Handle click on set button
|
|
2549
2508
|
*/
|
|
2550
2509
|
onSetClicked(event) {
|
|
2551
|
-
if (!this.picker
|
|
2552
|
-
this.hidePicker$.next(
|
|
2510
|
+
if (!this.picker?.dateTimeChecker?.(this.pickerMoment)) {
|
|
2511
|
+
this.hidePicker$.next();
|
|
2553
2512
|
event.preventDefault();
|
|
2554
2513
|
return;
|
|
2555
2514
|
}
|
|
@@ -2592,10 +2551,10 @@ class OwlDateTimeContainerComponent {
|
|
|
2592
2551
|
* Set the value of activeSelectedIndex
|
|
2593
2552
|
*/
|
|
2594
2553
|
setActiveSelectedIndex(index) {
|
|
2595
|
-
if (this.picker
|
|
2554
|
+
if (this.picker?.selectMode === 'range' &&
|
|
2596
2555
|
this.activeSelectedIndex !== index) {
|
|
2597
2556
|
this.activeSelectedIndex = index;
|
|
2598
|
-
const selected = this.picker
|
|
2557
|
+
const selected = this.picker?.selecteds[this.activeSelectedIndex];
|
|
2599
2558
|
if (this.picker.selecteds && selected) {
|
|
2600
2559
|
this.pickerMoment = this.dateTimeAdapter.clone(selected);
|
|
2601
2560
|
}
|
|
@@ -2603,16 +2562,16 @@ class OwlDateTimeContainerComponent {
|
|
|
2603
2562
|
return;
|
|
2604
2563
|
}
|
|
2605
2564
|
initPicker() {
|
|
2606
|
-
this.pickerMoment = this.picker
|
|
2607
|
-
this.activeSelectedIndex = this.picker
|
|
2565
|
+
this.pickerMoment = this.picker?.startAt || this.dateTimeAdapter.now();
|
|
2566
|
+
this.activeSelectedIndex = this.picker?.selectMode === 'rangeTo' ? 1 : 0;
|
|
2608
2567
|
}
|
|
2609
2568
|
/**
|
|
2610
2569
|
* Select calendar date in single mode,
|
|
2611
|
-
* it returns
|
|
2570
|
+
* it returns undefined when date is not selected.
|
|
2612
2571
|
*/
|
|
2613
2572
|
dateSelectedInSingleMode(date) {
|
|
2614
|
-
if (this.dateTimeAdapter.isSameDay(date, this.picker
|
|
2615
|
-
return
|
|
2573
|
+
if (this.dateTimeAdapter.isSameDay(date, this.picker?.selected)) {
|
|
2574
|
+
return undefined;
|
|
2616
2575
|
}
|
|
2617
2576
|
return this.updateAndCheckCalendarDate(date);
|
|
2618
2577
|
}
|
|
@@ -2620,42 +2579,42 @@ class OwlDateTimeContainerComponent {
|
|
|
2620
2579
|
* Select dates in range Mode
|
|
2621
2580
|
*/
|
|
2622
2581
|
dateSelectedInRangeMode(date) {
|
|
2623
|
-
let from = this.picker
|
|
2624
|
-
let to = this.picker
|
|
2582
|
+
let from = this.picker?.selecteds[0];
|
|
2583
|
+
let to = this.picker?.selecteds[1];
|
|
2625
2584
|
const result = this.updateAndCheckCalendarDate(date);
|
|
2626
2585
|
if (!result) {
|
|
2627
|
-
return
|
|
2586
|
+
return;
|
|
2628
2587
|
}
|
|
2629
2588
|
// if the given calendar day is after or equal to 'from',
|
|
2630
2589
|
// set ths given date as 'to'
|
|
2631
|
-
// otherwise, set it as 'from' and set 'to' to
|
|
2632
|
-
if (this.picker
|
|
2590
|
+
// otherwise, set it as 'from' and set 'to' to undefined
|
|
2591
|
+
if (this.picker?.selectMode === 'range') {
|
|
2633
2592
|
if (this.picker.selecteds &&
|
|
2634
2593
|
this.picker.selecteds.length &&
|
|
2635
2594
|
!to &&
|
|
2636
2595
|
from &&
|
|
2637
|
-
this.dateTimeAdapter.differenceInCalendarDays(result, from) >= 0) {
|
|
2596
|
+
(this.dateTimeAdapter.differenceInCalendarDays(result, from) ?? 0) >= 0) {
|
|
2638
2597
|
to = result;
|
|
2639
2598
|
this.activeSelectedIndex = 1;
|
|
2640
2599
|
}
|
|
2641
2600
|
else {
|
|
2642
2601
|
from = result;
|
|
2643
|
-
to =
|
|
2602
|
+
to = undefined;
|
|
2644
2603
|
this.activeSelectedIndex = 0;
|
|
2645
2604
|
}
|
|
2646
2605
|
}
|
|
2647
|
-
else if (this.picker
|
|
2606
|
+
else if (this.picker?.selectMode === 'rangeFrom') {
|
|
2648
2607
|
from = result;
|
|
2649
|
-
// if the from value is after the to value, set the to value as
|
|
2608
|
+
// if the from value is after the to value, set the to value as undefined
|
|
2650
2609
|
if (to && this.dateTimeAdapter.compare(from, to) > 0) {
|
|
2651
|
-
to =
|
|
2610
|
+
to = undefined;
|
|
2652
2611
|
}
|
|
2653
2612
|
}
|
|
2654
|
-
else if (this.picker
|
|
2613
|
+
else if (this.picker?.selectMode === 'rangeTo') {
|
|
2655
2614
|
to = result;
|
|
2656
|
-
// if the from value is after the to value, set the from value as
|
|
2615
|
+
// if the from value is after the to value, set the from value as undefined
|
|
2657
2616
|
if (from && this.dateTimeAdapter.compare(from, to) > 0) {
|
|
2658
|
-
from =
|
|
2617
|
+
from = undefined;
|
|
2659
2618
|
}
|
|
2660
2619
|
}
|
|
2661
2620
|
return [from, to];
|
|
@@ -2665,26 +2624,26 @@ class OwlDateTimeContainerComponent {
|
|
|
2665
2624
|
* Because the calendar date has 00:00:00 as default time, if the picker type is 'both',
|
|
2666
2625
|
* we need to update the given calendar date's time before selecting it.
|
|
2667
2626
|
* if it is valid, return the updated dateTime
|
|
2668
|
-
* if it is not valid, return
|
|
2627
|
+
* if it is not valid, return undefined
|
|
2669
2628
|
*/
|
|
2670
2629
|
updateAndCheckCalendarDate(date) {
|
|
2671
2630
|
let result;
|
|
2672
2631
|
// if the picker is 'both', update the calendar date's time value
|
|
2673
|
-
if (this.picker
|
|
2632
|
+
if (this.picker?.pickerType === 'both') {
|
|
2674
2633
|
result = this.dateTimeAdapter.createDate(this.dateTimeAdapter.getYear(date), this.dateTimeAdapter.getMonth(date), this.dateTimeAdapter.getDate(date), this.dateTimeAdapter.getHours(this.pickerMoment), this.dateTimeAdapter.getMinutes(this.pickerMoment), this.dateTimeAdapter.getSeconds(this.pickerMoment));
|
|
2675
|
-
result = this.dateTimeAdapter.clampDate(result, this.picker.
|
|
2634
|
+
result = this.dateTimeAdapter.clampDate(result, this.picker.min, this.picker.max);
|
|
2676
2635
|
}
|
|
2677
2636
|
else {
|
|
2678
2637
|
result = this.dateTimeAdapter.clone(date);
|
|
2679
2638
|
}
|
|
2680
2639
|
// check the updated dateTime
|
|
2681
|
-
return this.picker
|
|
2640
|
+
return this.picker?.dateTimeChecker(result) ? result : undefined;
|
|
2682
2641
|
}
|
|
2683
2642
|
/**
|
|
2684
2643
|
* Focus to the picker
|
|
2685
2644
|
* */
|
|
2686
2645
|
focusPicker() {
|
|
2687
|
-
if (this.picker
|
|
2646
|
+
if (this.picker?.pickerMode === 'inline') {
|
|
2688
2647
|
return;
|
|
2689
2648
|
}
|
|
2690
2649
|
if (this.calendar) {
|
|
@@ -2695,44 +2654,42 @@ class OwlDateTimeContainerComponent {
|
|
|
2695
2654
|
}
|
|
2696
2655
|
}
|
|
2697
2656
|
}
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2657
|
+
DateTimeContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeContainerComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: DateTimeIntl }, { token: DateTimeAdapter }], target: i0.ɵɵFactoryTarget.Component });
|
|
2658
|
+
DateTimeContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: DateTimeContainerComponent, selector: "nxt-date-time-container", host: { listeners: { "@transformPicker.done": "handleContainerAnimationDone($event)" }, properties: { "class.nxt-dt-container": "this.containerClass", "class.nxt-dt-popup-container": "this.popupContainerClass", "class.nxt-dt-dialog-container": "this.dialogContainerClass", "class.nxt-dt-inline-container": "this.inlineContainerClass", "class.nxt-dt-container-disabled": "this.containerDisabledClass", "attr.id": "this.containerId", "@transformPicker": "this.containerAnimation" } }, viewQueries: [{ propertyName: "calendar", first: true, predicate: CalendarComponent, descendants: true }, { propertyName: "timer", first: true, predicate: TimerComponent, descendants: true }], ngImport: i0, template: "<div [cdkTrapFocus]=\"picker?.pickerMode !== 'inline'\"\n [@fadeInPicker]=\"picker?.pickerMode === 'inline'? '' : 'enter'\"\n class=\"nxt-dt-container-inner\">\n\n <nxt-date-time-calendar *ngIf=\"pickerType === 'both' || pickerType === 'calendar'\"\n class=\"nxt-dt-container-row\"\n [firstDayOfWeek]=\"picker?.firstDayOfWeek ?? 0\"\n [(pickerMoment)]=\"pickerMoment\"\n [selected]=\"picker?.selected\"\n [selecteds]=\"picker?.selecteds ?? []\"\n [selectMode]=\"picker?.selectMode\"\n [min]=\"picker?.min\"\n [max]=\"picker?.max\"\n [dateFilter]=\"picker?.dateTimeFilter\"\n [startView]=\"picker?.startView ?? 'month'\"\n [hideOtherMonths]=\"!!picker?.hideOtherMonths\"\n (yearSelected)=\"picker?.selectYear($event)\"\n (monthSelected)=\"picker?.selectMonth($event)\"\n (selectedChange)=\"dateSelected($event)\"></nxt-date-time-calendar>\n\n <nxt-date-time-timer *ngIf=\"pickerType === 'both' || pickerType === 'timer'\"\n class=\"nxt-dt-container-row\"\n [pickerMoment]=\"pickerMoment\"\n [min]=\"picker?.min\"\n [max]=\"picker?.max\"\n [showSecondsTimer]=\"!!picker?.showSecondsTimer\"\n [hour12Timer]=\"!!picker?.hour12Timer\"\n [stepHour]=\"picker?.stepHour ?? 1\"\n [stepMinute]=\"picker?.stepMinute ?? 1\"\n [stepSecond]=\"picker?.stepSecond ?? 1\"\n (selectedChange)=\"timeSelected($event)\"></nxt-date-time-timer>\n\n <div *ngIf=\"picker?.isInRangeMode\"\n role=\"radiogroup\"\n class=\"nxt-dt-container-info nxt-dt-container-row\">\n <div role=\"radio\"\n [tabindex]=\"activeSelectedIndex === 0 ? 0 : -1\"\n [attr.aria-checked]=\"activeSelectedIndex === 0\"\n class=\"nxt-dt-control nxt-dt-container-range nxt-dt-container-from\"\n [ngClass]=\"{'nxt-dt-container-info-active': activeSelectedIndex === 0}\"\n (click)=\"handleClickOnInfoGroup($event, 0)\"\n (keydown)=\"handleKeydownOnInfoGroup($event, to, 0)\"\n #from>\n <span class=\"nxt-dt-control-content nxt-dt-container-range-content\"\n tabindex=\"-1\">\n <span class=\"nxt-dt-container-info-label\">{{fromLabel}}:</span>\n <span class=\"nxt-dt-container-info-value\">{{fromFormattedValue}}</span>\n </span>\n </div>\n <div role=\"radio\"\n [tabindex]=\"activeSelectedIndex === 1 ? 0 : -1\"\n [attr.aria-checked]=\"activeSelectedIndex === 1\"\n class=\"nxt-dt-control nxt-dt-container-range nxt-dt-container-to\"\n [ngClass]=\"{'nxt-dt-container-info-active': activeSelectedIndex === 1}\"\n (click)=\"handleClickOnInfoGroup($event, 1)\"\n (keydown)=\"handleKeydownOnInfoGroup($event, from, 1)\"\n #to>\n <span class=\"nxt-dt-control-content nxt-dt-container-range-content\"\n tabindex=\"-1\">\n <span class=\"nxt-dt-container-info-label\">{{toLabel}}:</span>\n <span class=\"nxt-dt-container-info-value\">{{toFormattedValue}}</span>\n </span>\n </div>\n </div>\n\n <div *ngIf=\"showControlButtons\"\n class=\"nxt-dt-container-buttons nxt-dt-container-row\">\n <button class=\"nxt-dt-control nxt-dt-control-button nxt-dt-container-control-button\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"onCancelClicked($event)\">\n <span class=\"nxt-dt-control-content nxt-dt-control-button-content\"\n tabindex=\"-1\">\n {{cancelLabel}}\n </span>\n </button>\n <button class=\"nxt-dt-control nxt-dt-control-button nxt-dt-container-control-button\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"onSetClicked($event)\">\n <span class=\"nxt-dt-control-content nxt-dt-control-button-content\"\n tabindex=\"-1\">\n {{setLabel}}\n </span>\n </button>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: TimerComponent, selector: "nxt-date-time-timer", inputs: ["pickerMoment", "min", "max", "showSecondsTimer", "hour12Timer", "stepHour", "stepMinute", "stepSecond"], outputs: ["selectedChange"] }, { kind: "component", type: CalendarComponent, selector: "nxt-date-time-calendar", inputs: ["dateFilter", "firstDayOfWeek", "min", "max", "pickerMoment", "selectMode", "selected", "selecteds", "startView", "hideOtherMonths"], outputs: ["pickerMomentChange", "selectedChange", "userSelection", "yearSelected", "monthSelected"] }], animations: [
|
|
2659
|
+
dateTimePickerAnimations.transformPicker,
|
|
2660
|
+
dateTimePickerAnimations.fadeInPicker
|
|
2702
2661
|
], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2703
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2662
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeContainerComponent, decorators: [{
|
|
2704
2663
|
type: Component,
|
|
2705
|
-
args: [{
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
], template: "<div [cdkTrapFocus]=\"picker?.pickerMode !== 'inline'\"\n [@fadeInPicker]=\"picker?.pickerMode === 'inline'? '' : 'enter'\"\n class=\"
|
|
2709
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type:
|
|
2710
|
-
type: Optional
|
|
2711
|
-
}] }]; }, propDecorators: { calendar: [{
|
|
2664
|
+
args: [{ selector: 'nxt-date-time-container', changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, animations: [
|
|
2665
|
+
dateTimePickerAnimations.transformPicker,
|
|
2666
|
+
dateTimePickerAnimations.fadeInPicker
|
|
2667
|
+
], template: "<div [cdkTrapFocus]=\"picker?.pickerMode !== 'inline'\"\n [@fadeInPicker]=\"picker?.pickerMode === 'inline'? '' : 'enter'\"\n class=\"nxt-dt-container-inner\">\n\n <nxt-date-time-calendar *ngIf=\"pickerType === 'both' || pickerType === 'calendar'\"\n class=\"nxt-dt-container-row\"\n [firstDayOfWeek]=\"picker?.firstDayOfWeek ?? 0\"\n [(pickerMoment)]=\"pickerMoment\"\n [selected]=\"picker?.selected\"\n [selecteds]=\"picker?.selecteds ?? []\"\n [selectMode]=\"picker?.selectMode\"\n [min]=\"picker?.min\"\n [max]=\"picker?.max\"\n [dateFilter]=\"picker?.dateTimeFilter\"\n [startView]=\"picker?.startView ?? 'month'\"\n [hideOtherMonths]=\"!!picker?.hideOtherMonths\"\n (yearSelected)=\"picker?.selectYear($event)\"\n (monthSelected)=\"picker?.selectMonth($event)\"\n (selectedChange)=\"dateSelected($event)\"></nxt-date-time-calendar>\n\n <nxt-date-time-timer *ngIf=\"pickerType === 'both' || pickerType === 'timer'\"\n class=\"nxt-dt-container-row\"\n [pickerMoment]=\"pickerMoment\"\n [min]=\"picker?.min\"\n [max]=\"picker?.max\"\n [showSecondsTimer]=\"!!picker?.showSecondsTimer\"\n [hour12Timer]=\"!!picker?.hour12Timer\"\n [stepHour]=\"picker?.stepHour ?? 1\"\n [stepMinute]=\"picker?.stepMinute ?? 1\"\n [stepSecond]=\"picker?.stepSecond ?? 1\"\n (selectedChange)=\"timeSelected($event)\"></nxt-date-time-timer>\n\n <div *ngIf=\"picker?.isInRangeMode\"\n role=\"radiogroup\"\n class=\"nxt-dt-container-info nxt-dt-container-row\">\n <div role=\"radio\"\n [tabindex]=\"activeSelectedIndex === 0 ? 0 : -1\"\n [attr.aria-checked]=\"activeSelectedIndex === 0\"\n class=\"nxt-dt-control nxt-dt-container-range nxt-dt-container-from\"\n [ngClass]=\"{'nxt-dt-container-info-active': activeSelectedIndex === 0}\"\n (click)=\"handleClickOnInfoGroup($event, 0)\"\n (keydown)=\"handleKeydownOnInfoGroup($event, to, 0)\"\n #from>\n <span class=\"nxt-dt-control-content nxt-dt-container-range-content\"\n tabindex=\"-1\">\n <span class=\"nxt-dt-container-info-label\">{{fromLabel}}:</span>\n <span class=\"nxt-dt-container-info-value\">{{fromFormattedValue}}</span>\n </span>\n </div>\n <div role=\"radio\"\n [tabindex]=\"activeSelectedIndex === 1 ? 0 : -1\"\n [attr.aria-checked]=\"activeSelectedIndex === 1\"\n class=\"nxt-dt-control nxt-dt-container-range nxt-dt-container-to\"\n [ngClass]=\"{'nxt-dt-container-info-active': activeSelectedIndex === 1}\"\n (click)=\"handleClickOnInfoGroup($event, 1)\"\n (keydown)=\"handleKeydownOnInfoGroup($event, from, 1)\"\n #to>\n <span class=\"nxt-dt-control-content nxt-dt-container-range-content\"\n tabindex=\"-1\">\n <span class=\"nxt-dt-container-info-label\">{{toLabel}}:</span>\n <span class=\"nxt-dt-container-info-value\">{{toFormattedValue}}</span>\n </span>\n </div>\n </div>\n\n <div *ngIf=\"showControlButtons\"\n class=\"nxt-dt-container-buttons nxt-dt-container-row\">\n <button class=\"nxt-dt-control nxt-dt-control-button nxt-dt-container-control-button\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"onCancelClicked($event)\">\n <span class=\"nxt-dt-control-content nxt-dt-control-button-content\"\n tabindex=\"-1\">\n {{cancelLabel}}\n </span>\n </button>\n <button class=\"nxt-dt-control nxt-dt-control-button nxt-dt-container-control-button\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"onSetClicked($event)\">\n <span class=\"nxt-dt-control-content nxt-dt-control-button-content\"\n tabindex=\"-1\">\n {{setLabel}}\n </span>\n </button>\n </div>\n</div>\n" }]
|
|
2668
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: DateTimeIntl }, { type: DateTimeAdapter }]; }, propDecorators: { calendar: [{
|
|
2712
2669
|
type: ViewChild,
|
|
2713
|
-
args: [
|
|
2670
|
+
args: [CalendarComponent]
|
|
2714
2671
|
}], timer: [{
|
|
2715
2672
|
type: ViewChild,
|
|
2716
|
-
args: [
|
|
2717
|
-
}],
|
|
2673
|
+
args: [TimerComponent]
|
|
2674
|
+
}], containerClass: [{
|
|
2718
2675
|
type: HostBinding,
|
|
2719
|
-
args: ['class.
|
|
2720
|
-
}],
|
|
2676
|
+
args: ['class.nxt-dt-container']
|
|
2677
|
+
}], popupContainerClass: [{
|
|
2721
2678
|
type: HostBinding,
|
|
2722
|
-
args: ['class.
|
|
2723
|
-
}],
|
|
2679
|
+
args: ['class.nxt-dt-popup-container']
|
|
2680
|
+
}], dialogContainerClass: [{
|
|
2724
2681
|
type: HostBinding,
|
|
2725
|
-
args: ['class.
|
|
2726
|
-
}],
|
|
2682
|
+
args: ['class.nxt-dt-dialog-container']
|
|
2683
|
+
}], inlineContainerClass: [{
|
|
2727
2684
|
type: HostBinding,
|
|
2728
|
-
args: ['class.
|
|
2729
|
-
}],
|
|
2685
|
+
args: ['class.nxt-dt-inline-container']
|
|
2686
|
+
}], containerDisabledClass: [{
|
|
2730
2687
|
type: HostBinding,
|
|
2731
|
-
args: ['class.
|
|
2732
|
-
}],
|
|
2688
|
+
args: ['class.nxt-dt-container-disabled']
|
|
2689
|
+
}], containerId: [{
|
|
2733
2690
|
type: HostBinding,
|
|
2734
2691
|
args: ['attr.id']
|
|
2735
|
-
}],
|
|
2692
|
+
}], containerAnimation: [{
|
|
2736
2693
|
type: HostBinding,
|
|
2737
2694
|
args: ['@transformPicker']
|
|
2738
2695
|
}], handleContainerAnimationDone: [{
|
|
@@ -2740,41 +2697,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
2740
2697
|
args: ['@transformPicker.done', ['$event']]
|
|
2741
2698
|
}] } });
|
|
2742
2699
|
|
|
2743
|
-
const
|
|
2700
|
+
const NXT_DATETIME_VALUE_ACCESSOR$1 = {
|
|
2744
2701
|
provide: NG_VALUE_ACCESSOR,
|
|
2745
|
-
useExisting: forwardRef(() =>
|
|
2702
|
+
useExisting: forwardRef(() => DateTimeInlineComponent),
|
|
2746
2703
|
multi: true
|
|
2747
2704
|
};
|
|
2748
|
-
class
|
|
2749
|
-
constructor(changeDetector, dateTimeAdapter, dateTimeFormats) {
|
|
2750
|
-
super(dateTimeAdapter, dateTimeFormats);
|
|
2751
|
-
this.changeDetector = changeDetector;
|
|
2752
|
-
this.dateTimeAdapter = dateTimeAdapter;
|
|
2753
|
-
this.dateTimeFormats = dateTimeFormats;
|
|
2754
|
-
/**
|
|
2755
|
-
* Set the type of the dateTime picker
|
|
2756
|
-
* 'both' -- show both calendar and timer
|
|
2757
|
-
* 'calendar' -- show only calendar
|
|
2758
|
-
* 'timer' -- show only timer
|
|
2759
|
-
*/
|
|
2760
|
-
this._pickerType = 'both';
|
|
2761
|
-
this._disabled = false;
|
|
2762
|
-
this._selectMode = 'single';
|
|
2763
|
-
this._values = [];
|
|
2764
|
-
/**
|
|
2765
|
-
* Emits selected year in multi-year view
|
|
2766
|
-
* This doesn't imply a change on the selected date.
|
|
2767
|
-
* */
|
|
2768
|
-
this.yearSelected = new EventEmitter();
|
|
2769
|
-
/**
|
|
2770
|
-
* Emits selected month in year view
|
|
2771
|
-
* This doesn't imply a change on the selected date.
|
|
2772
|
-
* */
|
|
2773
|
-
this.monthSelected = new EventEmitter();
|
|
2774
|
-
this._selecteds = [];
|
|
2775
|
-
this.onModelChange = () => { };
|
|
2776
|
-
this.onModelTouched = () => { };
|
|
2777
|
-
}
|
|
2705
|
+
class DateTimeInlineComponent extends DateTimeDirective {
|
|
2778
2706
|
get pickerType() {
|
|
2779
2707
|
return this._pickerType;
|
|
2780
2708
|
}
|
|
@@ -2797,7 +2725,7 @@ class OwlDateTimeInlineComponent extends OwlDateTimeDirective {
|
|
|
2797
2725
|
mode !== 'range' &&
|
|
2798
2726
|
mode !== 'rangeFrom' &&
|
|
2799
2727
|
mode !== 'rangeTo') {
|
|
2800
|
-
throw Error('
|
|
2728
|
+
throw Error('DateTime Error: invalid selectMode value!');
|
|
2801
2729
|
}
|
|
2802
2730
|
this._selectMode = mode;
|
|
2803
2731
|
}
|
|
@@ -2806,17 +2734,17 @@ class OwlDateTimeInlineComponent extends OwlDateTimeDirective {
|
|
|
2806
2734
|
return this._startAt;
|
|
2807
2735
|
}
|
|
2808
2736
|
if (this.selectMode === 'single') {
|
|
2809
|
-
return this.value
|
|
2737
|
+
return this.value;
|
|
2810
2738
|
}
|
|
2811
2739
|
else if (this.selectMode === 'range' ||
|
|
2812
2740
|
this.selectMode === 'rangeFrom') {
|
|
2813
|
-
return this.values[0]
|
|
2741
|
+
return this.values?.[0];
|
|
2814
2742
|
}
|
|
2815
2743
|
else if (this.selectMode === 'rangeTo') {
|
|
2816
|
-
return this.values[1]
|
|
2744
|
+
return this.values?.[1];
|
|
2817
2745
|
}
|
|
2818
2746
|
else {
|
|
2819
|
-
return
|
|
2747
|
+
return;
|
|
2820
2748
|
}
|
|
2821
2749
|
}
|
|
2822
2750
|
set startAt(date) {
|
|
@@ -2828,19 +2756,17 @@ class OwlDateTimeInlineComponent extends OwlDateTimeDirective {
|
|
|
2828
2756
|
set dateTimeFilter(filter) {
|
|
2829
2757
|
this._dateTimeFilter = filter;
|
|
2830
2758
|
}
|
|
2831
|
-
get
|
|
2832
|
-
return this._min
|
|
2759
|
+
get min() {
|
|
2760
|
+
return this._min;
|
|
2833
2761
|
}
|
|
2834
|
-
|
|
2835
|
-
set minDateTime(value) {
|
|
2762
|
+
set min(value) {
|
|
2836
2763
|
this._min = this.getValidDate(this.dateTimeAdapter.deserialize(value));
|
|
2837
2764
|
this.changeDetector.markForCheck();
|
|
2838
2765
|
}
|
|
2839
|
-
get
|
|
2840
|
-
return this._max
|
|
2766
|
+
get max() {
|
|
2767
|
+
return this._max;
|
|
2841
2768
|
}
|
|
2842
|
-
|
|
2843
|
-
set maxDateTime(value) {
|
|
2769
|
+
set max(value) {
|
|
2844
2770
|
this._max = this.getValidDate(this.dateTimeAdapter.deserialize(value));
|
|
2845
2771
|
this.changeDetector.markForCheck();
|
|
2846
2772
|
}
|
|
@@ -2861,7 +2787,7 @@ class OwlDateTimeInlineComponent extends OwlDateTimeDirective {
|
|
|
2861
2787
|
values = values.map(v => {
|
|
2862
2788
|
v = this.dateTimeAdapter.deserialize(v);
|
|
2863
2789
|
v = this.getValidDate(v);
|
|
2864
|
-
return v
|
|
2790
|
+
return (v && this.dateTimeAdapter.clone(v));
|
|
2865
2791
|
});
|
|
2866
2792
|
this._values = [...values];
|
|
2867
2793
|
this.selecteds = [...values];
|
|
@@ -2899,20 +2825,48 @@ class OwlDateTimeInlineComponent extends OwlDateTimeDirective {
|
|
|
2899
2825
|
this._selectMode === 'rangeFrom' ||
|
|
2900
2826
|
this._selectMode === 'rangeTo');
|
|
2901
2827
|
}
|
|
2902
|
-
get
|
|
2828
|
+
get inlineClass() {
|
|
2903
2829
|
return true;
|
|
2904
2830
|
}
|
|
2831
|
+
constructor(changeDetector, dateTimeAdapter, dateTimeFormats) {
|
|
2832
|
+
super(dateTimeAdapter, dateTimeFormats);
|
|
2833
|
+
this.changeDetector = changeDetector;
|
|
2834
|
+
/**
|
|
2835
|
+
* Set the type of the dateTime picker
|
|
2836
|
+
* 'both' -- show both calendar and timer
|
|
2837
|
+
* 'calendar' -- show only calendar
|
|
2838
|
+
* 'timer' -- show only timer
|
|
2839
|
+
*/
|
|
2840
|
+
this._pickerType = 'both';
|
|
2841
|
+
this._disabled = false;
|
|
2842
|
+
this._selectMode = 'single';
|
|
2843
|
+
/**
|
|
2844
|
+
* Emits selected year in multi-year view
|
|
2845
|
+
* This doesn't imply a change on the selected date.
|
|
2846
|
+
* */
|
|
2847
|
+
this.yearSelected = new EventEmitter();
|
|
2848
|
+
/**
|
|
2849
|
+
* Emits selected month in year view
|
|
2850
|
+
* This doesn't imply a change on the selected date.
|
|
2851
|
+
* */
|
|
2852
|
+
this.monthSelected = new EventEmitter();
|
|
2853
|
+
this._selecteds = new Array();
|
|
2854
|
+
}
|
|
2905
2855
|
ngOnInit() {
|
|
2906
|
-
this.container
|
|
2856
|
+
if (this.container)
|
|
2857
|
+
this.container.picker = this;
|
|
2907
2858
|
}
|
|
2908
2859
|
writeValue(value) {
|
|
2860
|
+
value = value ?? undefined;
|
|
2909
2861
|
if (this.isInSingleMode) {
|
|
2910
2862
|
this.value = value;
|
|
2911
|
-
this.container
|
|
2863
|
+
if (this.container)
|
|
2864
|
+
this.container.pickerMoment = value;
|
|
2912
2865
|
}
|
|
2913
2866
|
else {
|
|
2914
2867
|
this.values = value;
|
|
2915
|
-
|
|
2868
|
+
if (this.container)
|
|
2869
|
+
this.container.pickerMoment = this._values?.[this.container.activeSelectedIndex];
|
|
2916
2870
|
}
|
|
2917
2871
|
}
|
|
2918
2872
|
registerOnChange(fn) {
|
|
@@ -2934,8 +2888,8 @@ class OwlDateTimeInlineComponent extends OwlDateTimeDirective {
|
|
|
2934
2888
|
else {
|
|
2935
2889
|
this.value = date;
|
|
2936
2890
|
}
|
|
2937
|
-
this.onModelChange(date);
|
|
2938
|
-
this.onModelTouched();
|
|
2891
|
+
this.onModelChange?.(date);
|
|
2892
|
+
this.onModelTouched?.();
|
|
2939
2893
|
}
|
|
2940
2894
|
/**
|
|
2941
2895
|
* Emits the selected year in multi-year view
|
|
@@ -2950,21 +2904,17 @@ class OwlDateTimeInlineComponent extends OwlDateTimeDirective {
|
|
|
2950
2904
|
this.monthSelected.emit(normalizedMonth);
|
|
2951
2905
|
}
|
|
2952
2906
|
}
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2907
|
+
DateTimeInlineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeInlineComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: DateTimeAdapter }, { token: NXT_DATE_TIME_FORMATS }], target: i0.ɵɵFactoryTarget.Component });
|
|
2908
|
+
DateTimeInlineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: DateTimeInlineComponent, selector: "nxt-date-time-inline", inputs: { pickerType: "pickerType", disabled: "disabled", selectMode: "selectMode", startAt: "startAt", dateTimeFilter: "dateTimeFilter", min: "min", max: "max", value: "value", values: "values" }, outputs: { yearSelected: "yearSelected", monthSelected: "monthSelected" }, host: { properties: { "class.nxt-dt-inline": "this.inlineClass" } }, providers: [NXT_DATETIME_VALUE_ACCESSOR$1], viewQueries: [{ propertyName: "container", first: true, predicate: DateTimeContainerComponent, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<nxt-date-time-container></nxt-date-time-container>\n", styles: [""], dependencies: [{ kind: "component", type: DateTimeContainerComponent, selector: "nxt-date-time-container" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2909
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeInlineComponent, decorators: [{
|
|
2956
2910
|
type: Component,
|
|
2957
|
-
args: [{ selector: '
|
|
2958
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: DateTimeAdapter, decorators: [{
|
|
2959
|
-
type: Optional
|
|
2960
|
-
}] }, { type: undefined, decorators: [{
|
|
2961
|
-
type: Optional
|
|
2962
|
-
}, {
|
|
2911
|
+
args: [{ selector: 'nxt-date-time-inline', changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, providers: [NXT_DATETIME_VALUE_ACCESSOR$1], template: "<nxt-date-time-container></nxt-date-time-container>\n" }]
|
|
2912
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: DateTimeAdapter }, { type: undefined, decorators: [{
|
|
2963
2913
|
type: Inject,
|
|
2964
|
-
args: [
|
|
2914
|
+
args: [NXT_DATE_TIME_FORMATS]
|
|
2965
2915
|
}] }]; }, propDecorators: { container: [{
|
|
2966
2916
|
type: ViewChild,
|
|
2967
|
-
args: [
|
|
2917
|
+
args: [DateTimeContainerComponent, { static: true }]
|
|
2968
2918
|
}], pickerType: [{
|
|
2969
2919
|
type: Input
|
|
2970
2920
|
}], disabled: [{
|
|
@@ -2974,14 +2924,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
2974
2924
|
}], startAt: [{
|
|
2975
2925
|
type: Input
|
|
2976
2926
|
}], dateTimeFilter: [{
|
|
2977
|
-
type: Input
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
}], maxDateTime: [{
|
|
2983
|
-
type: Input,
|
|
2984
|
-
args: ['max']
|
|
2927
|
+
type: Input
|
|
2928
|
+
}], min: [{
|
|
2929
|
+
type: Input
|
|
2930
|
+
}], max: [{
|
|
2931
|
+
type: Input
|
|
2985
2932
|
}], value: [{
|
|
2986
2933
|
type: Input
|
|
2987
2934
|
}], values: [{
|
|
@@ -2990,175 +2937,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
2990
2937
|
type: Output
|
|
2991
2938
|
}], monthSelected: [{
|
|
2992
2939
|
type: Output
|
|
2993
|
-
}],
|
|
2940
|
+
}], inlineClass: [{
|
|
2994
2941
|
type: HostBinding,
|
|
2995
|
-
args: ['class.
|
|
2942
|
+
args: ['class.nxt-dt-inline']
|
|
2996
2943
|
}] } });
|
|
2997
2944
|
|
|
2998
|
-
const
|
|
2945
|
+
const NXT_DATETIME_VALUE_ACCESSOR = {
|
|
2999
2946
|
provide: NG_VALUE_ACCESSOR,
|
|
3000
|
-
useExisting: forwardRef(() =>
|
|
2947
|
+
useExisting: forwardRef(() => DateTimeInputDirective),
|
|
3001
2948
|
multi: true
|
|
3002
2949
|
};
|
|
3003
|
-
const
|
|
2950
|
+
const NXT_DATETIME_VALIDATORS = {
|
|
3004
2951
|
provide: NG_VALIDATORS,
|
|
3005
|
-
useExisting: forwardRef(() =>
|
|
2952
|
+
useExisting: forwardRef(() => DateTimeInputDirective),
|
|
3006
2953
|
multi: true
|
|
3007
2954
|
};
|
|
3008
|
-
class
|
|
3009
|
-
constructor(elmRef, renderer, dateTimeAdapter, dateTimeFormats) {
|
|
3010
|
-
this.elmRef = elmRef;
|
|
3011
|
-
this.renderer = renderer;
|
|
3012
|
-
this.dateTimeAdapter = dateTimeAdapter;
|
|
3013
|
-
this.dateTimeFormats = dateTimeFormats;
|
|
3014
|
-
/**
|
|
3015
|
-
* The picker's select mode
|
|
3016
|
-
*/
|
|
3017
|
-
this._selectMode = 'single';
|
|
3018
|
-
/**
|
|
3019
|
-
* The character to separate the 'from' and 'to' in input value
|
|
3020
|
-
*/
|
|
3021
|
-
this.rangeSeparator = '~';
|
|
3022
|
-
this._values = [];
|
|
3023
|
-
/**
|
|
3024
|
-
* Callback to invoke when `change` event is fired on this `<input>`
|
|
3025
|
-
* */
|
|
3026
|
-
this.dateTimeChange = new EventEmitter();
|
|
3027
|
-
/**
|
|
3028
|
-
* Callback to invoke when an `input` event is fired on this `<input>`.
|
|
3029
|
-
* */
|
|
3030
|
-
this.dateTimeInput = new EventEmitter();
|
|
3031
|
-
this.dtPickerSub = Subscription.EMPTY;
|
|
3032
|
-
this.localeSub = Subscription.EMPTY;
|
|
3033
|
-
this.lastValueValid = true;
|
|
3034
|
-
this.onModelChange = () => { };
|
|
3035
|
-
this.onModelTouched = () => { };
|
|
3036
|
-
this.validatorOnChange = () => { };
|
|
3037
|
-
/** The form control validator for whether the input parses. */
|
|
3038
|
-
this.parseValidator = () => this.lastValueValid
|
|
3039
|
-
? null
|
|
3040
|
-
: { owlDateTimeParse: { text: this.elmRef.nativeElement.value } };
|
|
3041
|
-
/** The form control validator for the min date. */
|
|
3042
|
-
this.minValidator = (control) => {
|
|
3043
|
-
if (this.isInSingleMode) {
|
|
3044
|
-
const controlValue = this.getValidDate(this.dateTimeAdapter.deserialize(control.value));
|
|
3045
|
-
return !this.min ||
|
|
3046
|
-
!controlValue ||
|
|
3047
|
-
this.dateTimeAdapter.compare(this.min, controlValue) <= 0
|
|
3048
|
-
? null
|
|
3049
|
-
: { owlDateTimeMin: { min: this.min, actual: controlValue } };
|
|
3050
|
-
}
|
|
3051
|
-
else if (this.isInRangeMode && control.value) {
|
|
3052
|
-
const controlValueFrom = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[0]));
|
|
3053
|
-
const controlValueTo = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[1]));
|
|
3054
|
-
return !this.min ||
|
|
3055
|
-
!controlValueFrom ||
|
|
3056
|
-
!controlValueTo ||
|
|
3057
|
-
this.dateTimeAdapter.compare(this.min, controlValueFrom) <= 0
|
|
3058
|
-
? null
|
|
3059
|
-
: {
|
|
3060
|
-
owlDateTimeMin: {
|
|
3061
|
-
min: this.min,
|
|
3062
|
-
actual: [controlValueFrom, controlValueTo]
|
|
3063
|
-
}
|
|
3064
|
-
};
|
|
3065
|
-
}
|
|
3066
|
-
};
|
|
3067
|
-
/** The form control validator for the max date. */
|
|
3068
|
-
this.maxValidator = (control) => {
|
|
3069
|
-
if (this.isInSingleMode) {
|
|
3070
|
-
const controlValue = this.getValidDate(this.dateTimeAdapter.deserialize(control.value));
|
|
3071
|
-
return !this.max ||
|
|
3072
|
-
!controlValue ||
|
|
3073
|
-
this.dateTimeAdapter.compare(this.max, controlValue) >= 0
|
|
3074
|
-
? null
|
|
3075
|
-
: { owlDateTimeMax: { max: this.max, actual: controlValue } };
|
|
3076
|
-
}
|
|
3077
|
-
else if (this.isInRangeMode && control.value) {
|
|
3078
|
-
const controlValueFrom = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[0]));
|
|
3079
|
-
const controlValueTo = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[1]));
|
|
3080
|
-
return !this.max ||
|
|
3081
|
-
!controlValueFrom ||
|
|
3082
|
-
!controlValueTo ||
|
|
3083
|
-
this.dateTimeAdapter.compare(this.max, controlValueTo) >= 0
|
|
3084
|
-
? null
|
|
3085
|
-
: {
|
|
3086
|
-
owlDateTimeMax: {
|
|
3087
|
-
max: this.max,
|
|
3088
|
-
actual: [controlValueFrom, controlValueTo]
|
|
3089
|
-
}
|
|
3090
|
-
};
|
|
3091
|
-
}
|
|
3092
|
-
};
|
|
3093
|
-
/** The form control validator for the date filter. */
|
|
3094
|
-
this.filterValidator = (control) => {
|
|
3095
|
-
const controlValue = this.getValidDate(this.dateTimeAdapter.deserialize(control.value));
|
|
3096
|
-
return !this._dateTimeFilter ||
|
|
3097
|
-
!controlValue ||
|
|
3098
|
-
this._dateTimeFilter(controlValue)
|
|
3099
|
-
? null
|
|
3100
|
-
: { owlDateTimeFilter: true };
|
|
3101
|
-
};
|
|
3102
|
-
/**
|
|
3103
|
-
* The form control validator for the range.
|
|
3104
|
-
* Check whether the 'before' value is before the 'to' value
|
|
3105
|
-
* */
|
|
3106
|
-
this.rangeValidator = (control) => {
|
|
3107
|
-
if (this.isInSingleMode || !control.value) {
|
|
3108
|
-
return null;
|
|
3109
|
-
}
|
|
3110
|
-
const controlValueFrom = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[0]));
|
|
3111
|
-
const controlValueTo = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[1]));
|
|
3112
|
-
return !controlValueFrom ||
|
|
3113
|
-
!controlValueTo ||
|
|
3114
|
-
this.dateTimeAdapter.compare(controlValueFrom, controlValueTo) <= 0
|
|
3115
|
-
? null
|
|
3116
|
-
: { owlDateTimeRange: true };
|
|
3117
|
-
};
|
|
3118
|
-
/** The combined form control validator for this input. */
|
|
3119
|
-
this.validator = Validators.compose([
|
|
3120
|
-
this.parseValidator,
|
|
3121
|
-
this.minValidator,
|
|
3122
|
-
this.maxValidator,
|
|
3123
|
-
this.filterValidator,
|
|
3124
|
-
this.rangeValidator
|
|
3125
|
-
]);
|
|
3126
|
-
/** Emits when the value changes (either due to user input or programmatic change). */
|
|
3127
|
-
this.valueChange = new EventEmitter();
|
|
3128
|
-
/** Emits when the disabled state has changed */
|
|
3129
|
-
this.disabledChange = new EventEmitter();
|
|
3130
|
-
if (!this.dateTimeAdapter) {
|
|
3131
|
-
throw Error('OwlDateTimePicker: No provider found for DateTimePicker. You must import one of the following ' +
|
|
3132
|
-
'modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ' +
|
|
3133
|
-
'custom implementation.');
|
|
3134
|
-
}
|
|
3135
|
-
if (!this.dateTimeFormats) {
|
|
3136
|
-
throw Error('OwlDateTimePicker: No provider found for OWL_DATE_TIME_FORMATS. You must import one of the following ' +
|
|
3137
|
-
'modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ' +
|
|
3138
|
-
'custom implementation.');
|
|
3139
|
-
}
|
|
3140
|
-
this.localeSub = this.dateTimeAdapter.localeChanges.subscribe(() => {
|
|
3141
|
-
this.value = this.value;
|
|
3142
|
-
});
|
|
3143
|
-
}
|
|
2955
|
+
class DateTimeInputDirective {
|
|
3144
2956
|
/**
|
|
3145
2957
|
* The date time picker that this input is associated with.
|
|
3146
2958
|
* */
|
|
3147
|
-
set
|
|
2959
|
+
set dateTime(value) {
|
|
3148
2960
|
this.registerDateTimePicker(value);
|
|
3149
2961
|
}
|
|
3150
2962
|
/**
|
|
3151
2963
|
* A function to filter date time
|
|
3152
2964
|
*/
|
|
3153
|
-
set
|
|
2965
|
+
set dateTimeFilter(filter) {
|
|
3154
2966
|
this._dateTimeFilter = filter;
|
|
3155
|
-
this.validatorOnChange();
|
|
2967
|
+
this.validatorOnChange?.();
|
|
3156
2968
|
}
|
|
3157
2969
|
get dateTimeFilter() {
|
|
3158
2970
|
return this._dateTimeFilter;
|
|
3159
2971
|
}
|
|
3160
2972
|
get disabled() {
|
|
3161
|
-
return
|
|
2973
|
+
return this._disabled;
|
|
3162
2974
|
}
|
|
3163
2975
|
set disabled(value) {
|
|
3164
2976
|
const newValue = coerceBooleanProperty(value);
|
|
@@ -3167,12 +2979,8 @@ class OwlDateTimeInputDirective {
|
|
|
3167
2979
|
this._disabled = newValue;
|
|
3168
2980
|
this.disabledChange.emit(newValue);
|
|
3169
2981
|
}
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
// Normally, native input elements automatically blur if they turn disabled. This behavior
|
|
3173
|
-
// is problematic, because it would mean that it triggers another change detection cycle,
|
|
3174
|
-
// which then causes a changed after checked error if the input element was focused before.
|
|
3175
|
-
element.blur();
|
|
2982
|
+
if (newValue) {
|
|
2983
|
+
element.blur?.();
|
|
3176
2984
|
}
|
|
3177
2985
|
}
|
|
3178
2986
|
get min() {
|
|
@@ -3180,14 +2988,14 @@ class OwlDateTimeInputDirective {
|
|
|
3180
2988
|
}
|
|
3181
2989
|
set min(value) {
|
|
3182
2990
|
this._min = this.getValidDate(this.dateTimeAdapter.deserialize(value));
|
|
3183
|
-
this.validatorOnChange();
|
|
2991
|
+
this.validatorOnChange?.();
|
|
3184
2992
|
}
|
|
3185
2993
|
get max() {
|
|
3186
2994
|
return this._max;
|
|
3187
2995
|
}
|
|
3188
2996
|
set max(value) {
|
|
3189
2997
|
this._max = this.getValidDate(this.dateTimeAdapter.deserialize(value));
|
|
3190
|
-
this.validatorOnChange();
|
|
2998
|
+
this.validatorOnChange?.();
|
|
3191
2999
|
}
|
|
3192
3000
|
get selectMode() {
|
|
3193
3001
|
return this._selectMode;
|
|
@@ -3197,7 +3005,7 @@ class OwlDateTimeInputDirective {
|
|
|
3197
3005
|
mode !== 'range' &&
|
|
3198
3006
|
mode !== 'rangeFrom' &&
|
|
3199
3007
|
mode !== 'rangeTo') {
|
|
3200
|
-
throw Error('
|
|
3008
|
+
throw Error('DateTime Error: invalid selectMode value!');
|
|
3201
3009
|
}
|
|
3202
3010
|
this._selectMode = mode;
|
|
3203
3011
|
}
|
|
@@ -3206,7 +3014,7 @@ class OwlDateTimeInputDirective {
|
|
|
3206
3014
|
}
|
|
3207
3015
|
set value(value) {
|
|
3208
3016
|
value = this.dateTimeAdapter.deserialize(value);
|
|
3209
|
-
this.lastValueValid = !value || this.dateTimeAdapter.isValid(value);
|
|
3017
|
+
this.lastValueValid = !value || !!this.dateTimeAdapter.isValid(value);
|
|
3210
3018
|
value = this.getValidDate(value);
|
|
3211
3019
|
const oldDate = this._value;
|
|
3212
3020
|
this._value = value;
|
|
@@ -3251,36 +3059,160 @@ class OwlDateTimeInputDirective {
|
|
|
3251
3059
|
this._selectMode === 'rangeFrom' ||
|
|
3252
3060
|
this._selectMode === 'rangeTo');
|
|
3253
3061
|
}
|
|
3254
|
-
get
|
|
3062
|
+
get inputAriaHaspopup() {
|
|
3255
3063
|
return true;
|
|
3256
3064
|
}
|
|
3257
|
-
get
|
|
3258
|
-
return (this.dtPicker
|
|
3065
|
+
get inputAriaOwns() {
|
|
3066
|
+
return (this.dtPicker?.opened && this.dtPicker.id) || undefined;
|
|
3259
3067
|
}
|
|
3260
3068
|
get minIso8601() {
|
|
3261
|
-
return this.min ? this.dateTimeAdapter.toIso8601(this.min) :
|
|
3069
|
+
return this.min ? this.dateTimeAdapter.toIso8601(this.min) : undefined;
|
|
3262
3070
|
}
|
|
3263
3071
|
get maxIso8601() {
|
|
3264
|
-
return this.max ? this.dateTimeAdapter.toIso8601(this.max) :
|
|
3072
|
+
return this.max ? this.dateTimeAdapter.toIso8601(this.max) : undefined;
|
|
3265
3073
|
}
|
|
3266
|
-
get
|
|
3074
|
+
get inputDisabled() {
|
|
3267
3075
|
return this.disabled;
|
|
3268
3076
|
}
|
|
3077
|
+
constructor(elmRef, renderer, dateTimeAdapter, dateTimeFormats) {
|
|
3078
|
+
this.elmRef = elmRef;
|
|
3079
|
+
this.renderer = renderer;
|
|
3080
|
+
this.dateTimeAdapter = dateTimeAdapter;
|
|
3081
|
+
this.dateTimeFormats = dateTimeFormats;
|
|
3082
|
+
/** Whether the date time picker's input is disabled. */
|
|
3083
|
+
this._disabled = false;
|
|
3084
|
+
/**
|
|
3085
|
+
* The picker's select mode
|
|
3086
|
+
*/
|
|
3087
|
+
this._selectMode = 'single';
|
|
3088
|
+
/**
|
|
3089
|
+
* The character to separate the 'from' and 'to' in input value
|
|
3090
|
+
*/
|
|
3091
|
+
this.rangeSeparator = '~';
|
|
3092
|
+
this._values = [];
|
|
3093
|
+
/**
|
|
3094
|
+
* Callback to invoke when `change` event is fired on this `<input>`
|
|
3095
|
+
* */
|
|
3096
|
+
this.dateTimeChange = new EventEmitter();
|
|
3097
|
+
/**
|
|
3098
|
+
* Callback to invoke when an `input` event is fired on this `<input>`.
|
|
3099
|
+
* */
|
|
3100
|
+
this.dateTimeInput = new EventEmitter();
|
|
3101
|
+
this.lastValueValid = true;
|
|
3102
|
+
/** The form control validator for whether the input parses. */
|
|
3103
|
+
this.parseValidator = () => this.lastValueValid
|
|
3104
|
+
? null
|
|
3105
|
+
: { dateTimeParse: { text: this.elmRef.nativeElement.value } };
|
|
3106
|
+
/** The form control validator for the min date. */
|
|
3107
|
+
this.minValidator = (control) => {
|
|
3108
|
+
if (this.isInSingleMode) {
|
|
3109
|
+
const controlValue = this.getValidDate(this.dateTimeAdapter.deserialize(control.value));
|
|
3110
|
+
return !this.min ||
|
|
3111
|
+
!controlValue ||
|
|
3112
|
+
this.dateTimeAdapter.compare(this.min, controlValue) <= 0
|
|
3113
|
+
? null
|
|
3114
|
+
: { dateTimeMin: { min: this.min, actual: controlValue } };
|
|
3115
|
+
}
|
|
3116
|
+
else if (this.isInRangeMode && control.value) {
|
|
3117
|
+
const controlValueFrom = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[0]));
|
|
3118
|
+
const controlValueTo = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[1]));
|
|
3119
|
+
return !this.min ||
|
|
3120
|
+
!controlValueFrom ||
|
|
3121
|
+
!controlValueTo ||
|
|
3122
|
+
this.dateTimeAdapter.compare(this.min, controlValueFrom) <= 0
|
|
3123
|
+
? null
|
|
3124
|
+
: {
|
|
3125
|
+
dateTimeMin: {
|
|
3126
|
+
min: this.min,
|
|
3127
|
+
actual: [controlValueFrom, controlValueTo]
|
|
3128
|
+
}
|
|
3129
|
+
};
|
|
3130
|
+
}
|
|
3131
|
+
return null;
|
|
3132
|
+
};
|
|
3133
|
+
/** The form control validator for the max date. */
|
|
3134
|
+
this.maxValidator = (control) => {
|
|
3135
|
+
if (this.isInSingleMode) {
|
|
3136
|
+
const controlValue = this.getValidDate(this.dateTimeAdapter.deserialize(control.value));
|
|
3137
|
+
return !this.max ||
|
|
3138
|
+
!controlValue ||
|
|
3139
|
+
this.dateTimeAdapter.compare(this.max, controlValue) >= 0
|
|
3140
|
+
? null
|
|
3141
|
+
: { dateTimeMax: { max: this.max, actual: controlValue } };
|
|
3142
|
+
}
|
|
3143
|
+
else if (this.isInRangeMode && control.value) {
|
|
3144
|
+
const controlValueFrom = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[0]));
|
|
3145
|
+
const controlValueTo = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[1]));
|
|
3146
|
+
return !this.max ||
|
|
3147
|
+
!controlValueFrom ||
|
|
3148
|
+
!controlValueTo ||
|
|
3149
|
+
this.dateTimeAdapter.compare(this.max, controlValueTo) >= 0
|
|
3150
|
+
? null
|
|
3151
|
+
: {
|
|
3152
|
+
dateTimeMax: {
|
|
3153
|
+
max: this.max,
|
|
3154
|
+
actual: [controlValueFrom, controlValueTo]
|
|
3155
|
+
}
|
|
3156
|
+
};
|
|
3157
|
+
}
|
|
3158
|
+
return null;
|
|
3159
|
+
};
|
|
3160
|
+
/** The form control validator for the date filter. */
|
|
3161
|
+
this.filterValidator = (control) => {
|
|
3162
|
+
const controlValue = this.getValidDate(this.dateTimeAdapter.deserialize(control.value));
|
|
3163
|
+
return !this._dateTimeFilter ||
|
|
3164
|
+
!controlValue ||
|
|
3165
|
+
this._dateTimeFilter(controlValue)
|
|
3166
|
+
? null
|
|
3167
|
+
: { dateTimeFilter: true };
|
|
3168
|
+
};
|
|
3169
|
+
/**
|
|
3170
|
+
* The form control validator for the range.
|
|
3171
|
+
* Check whether the 'before' value is before the 'to' value
|
|
3172
|
+
* */
|
|
3173
|
+
this.rangeValidator = (control) => {
|
|
3174
|
+
if (this.isInSingleMode || !control.value) {
|
|
3175
|
+
return null;
|
|
3176
|
+
}
|
|
3177
|
+
const controlValueFrom = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[0]));
|
|
3178
|
+
const controlValueTo = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[1]));
|
|
3179
|
+
return !controlValueFrom ||
|
|
3180
|
+
!controlValueTo ||
|
|
3181
|
+
this.dateTimeAdapter.compare(controlValueFrom, controlValueTo) <= 0
|
|
3182
|
+
? null
|
|
3183
|
+
: { dateTimeRange: true };
|
|
3184
|
+
};
|
|
3185
|
+
/** The combined form control validator for this input. */
|
|
3186
|
+
this.validator = Validators.compose([
|
|
3187
|
+
this.parseValidator,
|
|
3188
|
+
this.minValidator,
|
|
3189
|
+
this.maxValidator,
|
|
3190
|
+
this.filterValidator,
|
|
3191
|
+
this.rangeValidator
|
|
3192
|
+
]);
|
|
3193
|
+
/** Emits when the value changes (either due to user input or programmatic change). */
|
|
3194
|
+
this.valueChange = new EventEmitter();
|
|
3195
|
+
/** Emits when the disabled state has changed */
|
|
3196
|
+
this.disabledChange = new EventEmitter();
|
|
3197
|
+
this.localeSub = this.dateTimeAdapter.localeChanges.subscribe(() => {
|
|
3198
|
+
this.value = this.value;
|
|
3199
|
+
});
|
|
3200
|
+
}
|
|
3269
3201
|
ngOnInit() {
|
|
3270
3202
|
if (!this.dtPicker) {
|
|
3271
|
-
throw Error('
|
|
3203
|
+
throw Error('DateTimePicker: the picker input doesn\'t have any associated nxt-date-time component');
|
|
3272
3204
|
}
|
|
3273
3205
|
}
|
|
3274
3206
|
ngAfterContentInit() {
|
|
3275
|
-
this.dtPickerSub = this.dtPicker
|
|
3207
|
+
this.dtPickerSub = this.dtPicker?.confirmSelectedChange.subscribe((selecteds) => {
|
|
3276
3208
|
if (Array.isArray(selecteds)) {
|
|
3277
3209
|
this.values = selecteds;
|
|
3278
3210
|
}
|
|
3279
3211
|
else {
|
|
3280
3212
|
this.value = selecteds;
|
|
3281
3213
|
}
|
|
3282
|
-
this.onModelChange(selecteds);
|
|
3283
|
-
this.onModelTouched();
|
|
3214
|
+
this.onModelChange?.(selecteds);
|
|
3215
|
+
this.onModelTouched?.();
|
|
3284
3216
|
this.dateTimeChange.emit({
|
|
3285
3217
|
source: this,
|
|
3286
3218
|
value: selecteds,
|
|
@@ -3294,12 +3226,15 @@ class OwlDateTimeInputDirective {
|
|
|
3294
3226
|
});
|
|
3295
3227
|
}
|
|
3296
3228
|
ngOnDestroy() {
|
|
3297
|
-
this.dtPickerSub
|
|
3298
|
-
this.
|
|
3229
|
+
this.dtPickerSub?.unsubscribe();
|
|
3230
|
+
this.dtPickerSub = undefined;
|
|
3231
|
+
this.localeSub?.unsubscribe();
|
|
3232
|
+
this.localeSub = undefined;
|
|
3299
3233
|
this.valueChange.complete();
|
|
3300
3234
|
this.disabledChange.complete();
|
|
3301
3235
|
}
|
|
3302
3236
|
writeValue(value) {
|
|
3237
|
+
value = value ?? undefined;
|
|
3303
3238
|
if (this.isInSingleMode) {
|
|
3304
3239
|
this.value = value;
|
|
3305
3240
|
}
|
|
@@ -3327,12 +3262,12 @@ class OwlDateTimeInputDirective {
|
|
|
3327
3262
|
* */
|
|
3328
3263
|
handleKeydownOnHost(event) {
|
|
3329
3264
|
if (event.altKey && event.keyCode === DOWN_ARROW) {
|
|
3330
|
-
this.dtPicker
|
|
3265
|
+
this.dtPicker?.open();
|
|
3331
3266
|
event.preventDefault();
|
|
3332
3267
|
}
|
|
3333
3268
|
}
|
|
3334
3269
|
handleBlurOnHost(_event) {
|
|
3335
|
-
this.onModelTouched();
|
|
3270
|
+
this.onModelTouched?.();
|
|
3336
3271
|
}
|
|
3337
3272
|
handleInputOnHost(event) {
|
|
3338
3273
|
const value = event.target.value;
|
|
@@ -3366,7 +3301,7 @@ class OwlDateTimeInputDirective {
|
|
|
3366
3301
|
formatNativeInputValue() {
|
|
3367
3302
|
if (this.isInSingleMode) {
|
|
3368
3303
|
this.renderer.setProperty(this.elmRef.nativeElement, 'value', this._value
|
|
3369
|
-
? this.dateTimeAdapter.format(this._value, this.dtPicker
|
|
3304
|
+
? this.dateTimeAdapter.format(this._value, this.dtPicker?.formatString)
|
|
3370
3305
|
: '');
|
|
3371
3306
|
}
|
|
3372
3307
|
else if (this.isInRangeMode) {
|
|
@@ -3374,13 +3309,13 @@ class OwlDateTimeInputDirective {
|
|
|
3374
3309
|
const from = this._values[0];
|
|
3375
3310
|
const to = this._values[1];
|
|
3376
3311
|
const fromFormatted = from
|
|
3377
|
-
? this.dateTimeAdapter.format(from, this.dtPicker
|
|
3312
|
+
? this.dateTimeAdapter.format(from, this.dtPicker?.formatString)
|
|
3378
3313
|
: '';
|
|
3379
3314
|
const toFormatted = to
|
|
3380
|
-
? this.dateTimeAdapter.format(to, this.dtPicker
|
|
3315
|
+
? this.dateTimeAdapter.format(to, this.dtPicker?.formatString)
|
|
3381
3316
|
: '';
|
|
3382
3317
|
if (!fromFormatted && !toFormatted) {
|
|
3383
|
-
this.renderer.setProperty(this.elmRef.nativeElement, 'value',
|
|
3318
|
+
this.renderer.setProperty(this.elmRef.nativeElement, 'value', undefined);
|
|
3384
3319
|
}
|
|
3385
3320
|
else {
|
|
3386
3321
|
if (this._selectMode === 'range') {
|
|
@@ -3420,7 +3355,7 @@ class OwlDateTimeInputDirective {
|
|
|
3420
3355
|
return this.dateTimeAdapter.isDateInstance(obj) &&
|
|
3421
3356
|
this.dateTimeAdapter.isValid(obj)
|
|
3422
3357
|
? obj
|
|
3423
|
-
:
|
|
3358
|
+
: undefined;
|
|
3424
3359
|
}
|
|
3425
3360
|
/**
|
|
3426
3361
|
* Convert a time string to a date-time string
|
|
@@ -3434,27 +3369,25 @@ class OwlDateTimeInputDirective {
|
|
|
3434
3369
|
const dateString = this.dateTimeAdapter.format(v, this.dateTimeFormats.datePickerInput);
|
|
3435
3370
|
return dateString + ' ' + timeString;
|
|
3436
3371
|
}
|
|
3437
|
-
|
|
3438
|
-
return null;
|
|
3439
|
-
}
|
|
3372
|
+
return undefined;
|
|
3440
3373
|
}
|
|
3441
3374
|
/**
|
|
3442
3375
|
* Handle input change in single mode
|
|
3443
3376
|
*/
|
|
3444
3377
|
changeInputInSingleMode(inputValue) {
|
|
3445
3378
|
let value = inputValue;
|
|
3446
|
-
if (this.dtPicker
|
|
3379
|
+
if (this.dtPicker?.pickerType === 'timer') {
|
|
3447
3380
|
value = this.convertTimeStringToDateTimeString(value, this.value);
|
|
3448
3381
|
}
|
|
3449
3382
|
let result = this.dateTimeAdapter.parse(value, this.dateTimeFormats.parseInput);
|
|
3450
3383
|
this.lastValueValid = !result || this.dateTimeAdapter.isValid(result);
|
|
3451
3384
|
result = this.getValidDate(result);
|
|
3452
3385
|
// if the newValue is the same as the oldValue, we intend to not fire the valueChange event
|
|
3453
|
-
// result equals to
|
|
3454
|
-
if (!this.isSameValue(result, this._value) || result ===
|
|
3386
|
+
// result equals to undefined means there is input event, but the input value is invalid
|
|
3387
|
+
if (!this.isSameValue(result, this._value) || result === undefined) {
|
|
3455
3388
|
this._value = result;
|
|
3456
3389
|
this.valueChange.emit(result);
|
|
3457
|
-
this.onModelChange(result);
|
|
3390
|
+
this.onModelChange?.(result);
|
|
3458
3391
|
this.dateTimeInput.emit({
|
|
3459
3392
|
source: this,
|
|
3460
3393
|
value: result,
|
|
@@ -3469,7 +3402,7 @@ class OwlDateTimeInputDirective {
|
|
|
3469
3402
|
const originalValue = this._selectMode === 'rangeFrom'
|
|
3470
3403
|
? this._values[0]
|
|
3471
3404
|
: this._values[1];
|
|
3472
|
-
if (this.dtPicker
|
|
3405
|
+
if (this.dtPicker?.pickerType === 'timer') {
|
|
3473
3406
|
inputValue = this.convertTimeStringToDateTimeString(inputValue, originalValue);
|
|
3474
3407
|
}
|
|
3475
3408
|
let result = this.dateTimeAdapter.parse(inputValue, this.dateTimeFormats.parseInput);
|
|
@@ -3489,7 +3422,7 @@ class OwlDateTimeInputDirective {
|
|
|
3489
3422
|
? [result, this._values[1]]
|
|
3490
3423
|
: [this._values[0], result];
|
|
3491
3424
|
this.valueChange.emit(this._values);
|
|
3492
|
-
this.onModelChange(this._values);
|
|
3425
|
+
this.onModelChange?.(this._values);
|
|
3493
3426
|
this.dateTimeInput.emit({
|
|
3494
3427
|
source: this,
|
|
3495
3428
|
value: this._values,
|
|
@@ -3503,7 +3436,7 @@ class OwlDateTimeInputDirective {
|
|
|
3503
3436
|
const selecteds = inputValue.split(this.rangeSeparator);
|
|
3504
3437
|
let fromString = selecteds[0];
|
|
3505
3438
|
let toString = selecteds[1];
|
|
3506
|
-
if (this.dtPicker
|
|
3439
|
+
if (this.dtPicker?.pickerType === 'timer') {
|
|
3507
3440
|
fromString = this.convertTimeStringToDateTimeString(fromString, this.values[0]);
|
|
3508
3441
|
toString = this.convertTimeStringToDateTimeString(toString, this.values[1]);
|
|
3509
3442
|
}
|
|
@@ -3517,10 +3450,10 @@ class OwlDateTimeInputDirective {
|
|
|
3517
3450
|
// if the newValue is the same as the oldValue, we intend to not fire the valueChange event
|
|
3518
3451
|
if (!this.isSameValue(from, this._values[0]) ||
|
|
3519
3452
|
!this.isSameValue(to, this._values[1]) ||
|
|
3520
|
-
(from
|
|
3453
|
+
(!from && !to)) {
|
|
3521
3454
|
this._values = [from, to];
|
|
3522
3455
|
this.valueChange.emit(this._values);
|
|
3523
|
-
this.onModelChange(this._values);
|
|
3456
|
+
this.onModelChange?.(this._values);
|
|
3524
3457
|
this.dateTimeInput.emit({
|
|
3525
3458
|
source: this,
|
|
3526
3459
|
value: this._values,
|
|
@@ -3538,31 +3471,28 @@ class OwlDateTimeInputDirective {
|
|
|
3538
3471
|
return first == second;
|
|
3539
3472
|
}
|
|
3540
3473
|
}
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
], exportAs: ["
|
|
3546
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3474
|
+
DateTimeInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeInputDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: DateTimeAdapter }, { token: NXT_DATE_TIME_FORMATS }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3475
|
+
DateTimeInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.1", type: DateTimeInputDirective, selector: "input[nxtDateTime]", inputs: { dateTime: ["nxtDateTime", "dateTime"], dateTimeFilter: "dateTimeFilter", _disabled: "_disabled", min: "min", max: "max", selectMode: "selectMode", rangeSeparator: "rangeSeparator", value: "value", values: "values" }, outputs: { dateTimeChange: "dateTimeChange", dateTimeInput: "dateTimeInput" }, host: { listeners: { "keydown": "handleKeydownOnHost($event)", "blur": "handleBlurOnHost($event)", "input": "handleInputOnHost($event)", "change": "handleChangeOnHost($event)" }, properties: { "attr.aria-haspopup": "this.inputAriaHaspopup", "attr.aria-owns": "this.inputAriaOwns", "attr.min": "this.minIso8601", "attr.max": "this.maxIso8601", "disabled": "this.inputDisabled" } }, providers: [
|
|
3476
|
+
NXT_DATETIME_VALUE_ACCESSOR,
|
|
3477
|
+
NXT_DATETIME_VALIDATORS
|
|
3478
|
+
], exportAs: ["nxtDateTimeInput"], ngImport: i0 });
|
|
3479
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeInputDirective, decorators: [{
|
|
3547
3480
|
type: Directive,
|
|
3548
3481
|
args: [{
|
|
3549
|
-
selector: 'input[
|
|
3550
|
-
exportAs: '
|
|
3482
|
+
selector: 'input[nxtDateTime]',
|
|
3483
|
+
exportAs: 'nxtDateTimeInput',
|
|
3551
3484
|
providers: [
|
|
3552
|
-
|
|
3553
|
-
|
|
3485
|
+
NXT_DATETIME_VALUE_ACCESSOR,
|
|
3486
|
+
NXT_DATETIME_VALIDATORS
|
|
3554
3487
|
]
|
|
3555
3488
|
}]
|
|
3556
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: DateTimeAdapter, decorators: [{
|
|
3557
|
-
type: Optional
|
|
3558
|
-
}] }, { type: undefined, decorators: [{
|
|
3559
|
-
type: Optional
|
|
3560
|
-
}, {
|
|
3489
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: DateTimeAdapter }, { type: undefined, decorators: [{
|
|
3561
3490
|
type: Inject,
|
|
3562
|
-
args: [
|
|
3563
|
-
}] }]; }, propDecorators: {
|
|
3564
|
-
type: Input
|
|
3565
|
-
|
|
3491
|
+
args: [NXT_DATE_TIME_FORMATS]
|
|
3492
|
+
}] }]; }, propDecorators: { dateTime: [{
|
|
3493
|
+
type: Input,
|
|
3494
|
+
args: ['nxtDateTime']
|
|
3495
|
+
}], dateTimeFilter: [{
|
|
3566
3496
|
type: Input
|
|
3567
3497
|
}], _disabled: [{
|
|
3568
3498
|
type: Input
|
|
@@ -3582,10 +3512,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
3582
3512
|
type: Output
|
|
3583
3513
|
}], dateTimeInput: [{
|
|
3584
3514
|
type: Output
|
|
3585
|
-
}],
|
|
3515
|
+
}], inputAriaHaspopup: [{
|
|
3586
3516
|
type: HostBinding,
|
|
3587
3517
|
args: ['attr.aria-haspopup']
|
|
3588
|
-
}],
|
|
3518
|
+
}], inputAriaOwns: [{
|
|
3589
3519
|
type: HostBinding,
|
|
3590
3520
|
args: ['attr.aria-owns']
|
|
3591
3521
|
}], minIso8601: [{
|
|
@@ -3594,7 +3524,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
3594
3524
|
}], maxIso8601: [{
|
|
3595
3525
|
type: HostBinding,
|
|
3596
3526
|
args: ['attr.max']
|
|
3597
|
-
}],
|
|
3527
|
+
}], inputDisabled: [{
|
|
3598
3528
|
type: HostBinding,
|
|
3599
3529
|
args: ['disabled']
|
|
3600
3530
|
}], handleKeydownOnHost: [{
|
|
@@ -3611,24 +3541,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
3611
3541
|
args: ['change', ['$event']]
|
|
3612
3542
|
}] } });
|
|
3613
3543
|
|
|
3614
|
-
class
|
|
3615
|
-
constructor(changeDetector) {
|
|
3616
|
-
this.changeDetector = changeDetector;
|
|
3617
|
-
this.stateChanges = Subscription.EMPTY;
|
|
3618
|
-
}
|
|
3544
|
+
class DateTimeTriggerDirective {
|
|
3619
3545
|
get disabled() {
|
|
3620
|
-
return this._disabled
|
|
3546
|
+
return this._disabled ?? !!this.dtPicker?.disabled;
|
|
3621
3547
|
}
|
|
3622
3548
|
set disabled(value) {
|
|
3623
3549
|
this._disabled = value;
|
|
3624
3550
|
}
|
|
3625
|
-
get
|
|
3551
|
+
get triggerDisabledClass() {
|
|
3626
3552
|
return this.disabled;
|
|
3627
3553
|
}
|
|
3554
|
+
constructor(changeDetector) {
|
|
3555
|
+
this.changeDetector = changeDetector;
|
|
3556
|
+
}
|
|
3628
3557
|
ngOnInit() {
|
|
3629
3558
|
}
|
|
3630
3559
|
ngOnChanges(changes) {
|
|
3631
|
-
if (changes
|
|
3560
|
+
if ('datepicker' in changes) {
|
|
3632
3561
|
this.watchStateChanges();
|
|
3633
3562
|
}
|
|
3634
3563
|
}
|
|
@@ -3636,7 +3565,8 @@ class OwlDateTimeTriggerDirective {
|
|
|
3636
3565
|
this.watchStateChanges();
|
|
3637
3566
|
}
|
|
3638
3567
|
ngOnDestroy() {
|
|
3639
|
-
this.stateChanges
|
|
3568
|
+
this.stateChanges?.unsubscribe();
|
|
3569
|
+
this.stateChanges = undefined;
|
|
3640
3570
|
}
|
|
3641
3571
|
handleClickOnHost(event) {
|
|
3642
3572
|
if (this.dtPicker) {
|
|
@@ -3645,7 +3575,8 @@ class OwlDateTimeTriggerDirective {
|
|
|
3645
3575
|
}
|
|
3646
3576
|
}
|
|
3647
3577
|
watchStateChanges() {
|
|
3648
|
-
this.stateChanges
|
|
3578
|
+
this.stateChanges?.unsubscribe();
|
|
3579
|
+
this.stateChanges = undefined;
|
|
3649
3580
|
const inputDisabled = this.dtPicker && this.dtPicker.dtInput ?
|
|
3650
3581
|
this.dtPicker.dtInput.disabledChange : of();
|
|
3651
3582
|
const pickerDisabled = this.dtPicker ?
|
|
@@ -3656,41 +3587,35 @@ class OwlDateTimeTriggerDirective {
|
|
|
3656
3587
|
});
|
|
3657
3588
|
}
|
|
3658
3589
|
}
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3590
|
+
DateTimeTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeTriggerDirective, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3591
|
+
DateTimeTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.1", type: DateTimeTriggerDirective, selector: "[nxtDateTimeTrigger]", inputs: { dtPicker: ["nxtDateTimeTrigger", "dtPicker"], disabled: "disabled" }, host: { listeners: { "click": "handleClickOnHost($event)" }, properties: { "class.nxt-dt-trigger-disabled": "this.triggerDisabledClass" } }, usesOnChanges: true, ngImport: i0 });
|
|
3592
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeTriggerDirective, decorators: [{
|
|
3662
3593
|
type: Directive,
|
|
3663
3594
|
args: [{
|
|
3664
|
-
selector: '[
|
|
3595
|
+
selector: '[nxtDateTimeTrigger]'
|
|
3665
3596
|
}]
|
|
3666
3597
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { dtPicker: [{
|
|
3667
3598
|
type: Input,
|
|
3668
|
-
args: ['
|
|
3599
|
+
args: ['nxtDateTimeTrigger']
|
|
3669
3600
|
}], disabled: [{
|
|
3670
3601
|
type: Input
|
|
3671
|
-
}],
|
|
3602
|
+
}], triggerDisabledClass: [{
|
|
3672
3603
|
type: HostBinding,
|
|
3673
|
-
args: ['class.
|
|
3604
|
+
args: ['class.nxt-dt-trigger-disabled']
|
|
3674
3605
|
}], handleClickOnHost: [{
|
|
3675
3606
|
type: HostListener,
|
|
3676
3607
|
args: ['click', ['$event']]
|
|
3677
3608
|
}] } });
|
|
3678
3609
|
|
|
3679
3610
|
let uniqueId = 0;
|
|
3680
|
-
class
|
|
3611
|
+
class DialogConfig {
|
|
3681
3612
|
constructor() {
|
|
3682
|
-
/**
|
|
3683
|
-
* ID of the element that describes the dialog.
|
|
3684
|
-
*/
|
|
3685
|
-
this.ariaDescribedBy = null;
|
|
3686
3613
|
/**
|
|
3687
3614
|
* Whether to focus the dialog when the dialog is opened
|
|
3688
3615
|
*/
|
|
3689
3616
|
this.autoFocus = true;
|
|
3690
3617
|
/** Whether the dialog has a backdrop. */
|
|
3691
3618
|
this.hasBackdrop = true;
|
|
3692
|
-
/** Data being injected into the child component. */
|
|
3693
|
-
this.data = null;
|
|
3694
3619
|
/** Whether the user can use escape or clicking outside to close a modal. */
|
|
3695
3620
|
this.disableClose = false;
|
|
3696
3621
|
/**
|
|
@@ -3701,10 +3626,6 @@ class OwlDialogConfig {
|
|
|
3701
3626
|
* Custom class for the pane
|
|
3702
3627
|
* */
|
|
3703
3628
|
this.paneClass = '';
|
|
3704
|
-
/**
|
|
3705
|
-
* Mouse Event
|
|
3706
|
-
* */
|
|
3707
|
-
this.event = null;
|
|
3708
3629
|
/**
|
|
3709
3630
|
* Custom class for the backdrop
|
|
3710
3631
|
* */
|
|
@@ -3727,11 +3648,11 @@ class OwlDialogConfig {
|
|
|
3727
3648
|
* Learn more this from https://material.angular.io/cdk/overlay/overview#scroll-strategies
|
|
3728
3649
|
* */
|
|
3729
3650
|
this.scrollStrategy = new NoopScrollStrategy();
|
|
3730
|
-
this.id = `
|
|
3651
|
+
this.id = `nxt-dialog-${uniqueId++}`;
|
|
3731
3652
|
}
|
|
3732
3653
|
}
|
|
3733
3654
|
|
|
3734
|
-
class
|
|
3655
|
+
class DialogRef {
|
|
3735
3656
|
constructor(overlayRef, container, id, location) {
|
|
3736
3657
|
this.overlayRef = overlayRef;
|
|
3737
3658
|
this.container = container;
|
|
@@ -3739,31 +3660,30 @@ class OwlDialogRef {
|
|
|
3739
3660
|
this._beforeClose$ = new Subject();
|
|
3740
3661
|
this._afterOpen$ = new Subject();
|
|
3741
3662
|
this._afterClosed$ = new Subject();
|
|
3742
|
-
/** Subscription to changes in the user's location. */
|
|
3743
|
-
this.locationChanged = Subscription.EMPTY;
|
|
3744
3663
|
/** Whether the user is allowed to close the dialog. */
|
|
3745
|
-
this.disableClose = this.container.config
|
|
3664
|
+
this.disableClose = !!this.container.config?.disableClose;
|
|
3746
3665
|
this.container.animationStateChanged
|
|
3747
3666
|
.pipe(filter((event) => event.phaseName === 'done' && event.toState === 'enter'), take(1))
|
|
3748
3667
|
.subscribe(() => {
|
|
3749
|
-
this._afterOpen$.next();
|
|
3668
|
+
this._afterOpen$.next(undefined);
|
|
3750
3669
|
this._afterOpen$.complete();
|
|
3751
3670
|
});
|
|
3752
3671
|
this.container.animationStateChanged
|
|
3753
3672
|
.pipe(filter((event) => event.phaseName === 'done' && event.toState === 'exit'), take(1))
|
|
3754
3673
|
.subscribe(() => {
|
|
3755
3674
|
this.overlayRef.dispose();
|
|
3756
|
-
this.locationChanged
|
|
3675
|
+
this.locationChanged?.unsubscribe();
|
|
3676
|
+
this.locationChanged = undefined;
|
|
3757
3677
|
this._afterClosed$.next(this.result);
|
|
3758
3678
|
this._afterClosed$.complete();
|
|
3759
|
-
this.componentInstance =
|
|
3679
|
+
this.componentInstance = undefined;
|
|
3760
3680
|
});
|
|
3761
3681
|
this.overlayRef.keydownEvents()
|
|
3762
3682
|
.pipe(filter(event => event.keyCode === ESCAPE && !this.disableClose))
|
|
3763
3683
|
.subscribe(() => this.close());
|
|
3764
3684
|
if (location) {
|
|
3765
3685
|
this.locationChanged = location.subscribe(() => {
|
|
3766
|
-
if (this.container.config
|
|
3686
|
+
if (this.container.config?.closeOnNavigation) {
|
|
3767
3687
|
this.close();
|
|
3768
3688
|
}
|
|
3769
3689
|
});
|
|
@@ -3857,11 +3777,11 @@ class OwlDialogRef {
|
|
|
3857
3777
|
* @param sources The source objects from which properties will be copied.
|
|
3858
3778
|
*/
|
|
3859
3779
|
function extendObject(dest, ...sources) {
|
|
3860
|
-
if (dest == null) {
|
|
3780
|
+
if (dest == null || dest == undefined) {
|
|
3861
3781
|
throw TypeError('Cannot convert undefined or null to object');
|
|
3862
3782
|
}
|
|
3863
3783
|
for (const source of sources) {
|
|
3864
|
-
if (source != null) {
|
|
3784
|
+
if (source != null && source != undefined) {
|
|
3865
3785
|
for (const key in source) {
|
|
3866
3786
|
if (source.hasOwnProperty(key)) {
|
|
3867
3787
|
dest[key] = source[key];
|
|
@@ -3881,15 +3801,37 @@ const zoomFadeInFrom = {
|
|
|
3881
3801
|
transform: 'translateX({{ x }}) translateY({{ y }}) scale({{scale}})',
|
|
3882
3802
|
transformOrigin: '{{ ox }} {{ oy }}'
|
|
3883
3803
|
};
|
|
3884
|
-
class
|
|
3804
|
+
class DialogContainerComponent extends BasePortalOutlet {
|
|
3805
|
+
get config() {
|
|
3806
|
+
return this._config;
|
|
3807
|
+
}
|
|
3808
|
+
get dialogContainerClass() {
|
|
3809
|
+
return true;
|
|
3810
|
+
}
|
|
3811
|
+
get dialogContainerTabIndex() {
|
|
3812
|
+
return -1;
|
|
3813
|
+
}
|
|
3814
|
+
get dialogContainerId() {
|
|
3815
|
+
return this._config?.id;
|
|
3816
|
+
}
|
|
3817
|
+
get dialogContainerRole() {
|
|
3818
|
+
return this._config?.role;
|
|
3819
|
+
}
|
|
3820
|
+
get dialogContainerAriaLabelledby() {
|
|
3821
|
+
return this.ariaLabelledBy;
|
|
3822
|
+
}
|
|
3823
|
+
get dialogContainerAriaDescribedby() {
|
|
3824
|
+
return this._config?.ariaDescribedBy;
|
|
3825
|
+
}
|
|
3826
|
+
get dialogContainerAnimation() {
|
|
3827
|
+
return { value: this.state, params: this.params };
|
|
3828
|
+
}
|
|
3885
3829
|
constructor(changeDetector, elementRef, focusTrapFactory, document) {
|
|
3886
3830
|
super();
|
|
3887
3831
|
this.changeDetector = changeDetector;
|
|
3888
3832
|
this.elementRef = elementRef;
|
|
3889
3833
|
this.focusTrapFactory = focusTrapFactory;
|
|
3890
3834
|
this.document = document;
|
|
3891
|
-
/** ID of the element that should be considered as the dialog's label. */
|
|
3892
|
-
this.ariaLabelledBy = null;
|
|
3893
3835
|
/** Emits when an animation state changes. */
|
|
3894
3836
|
this.animationStateChanged = new EventEmitter();
|
|
3895
3837
|
this.isAnimating = false;
|
|
@@ -3902,40 +3844,13 @@ class OwlDialogContainerComponent extends BasePortalOutlet {
|
|
|
3902
3844
|
oy: '50%',
|
|
3903
3845
|
scale: 0
|
|
3904
3846
|
};
|
|
3905
|
-
// A variable to hold the focused element before the dialog was open.
|
|
3906
|
-
// This would help us to refocus back to element when the dialog was closed.
|
|
3907
|
-
this.elementFocusedBeforeDialogWasOpened = null;
|
|
3908
|
-
}
|
|
3909
|
-
get config() {
|
|
3910
|
-
return this._config;
|
|
3911
|
-
}
|
|
3912
|
-
get owlDialogContainerClass() {
|
|
3913
|
-
return true;
|
|
3914
|
-
}
|
|
3915
|
-
get owlDialogContainerTabIndex() {
|
|
3916
|
-
return -1;
|
|
3917
|
-
}
|
|
3918
|
-
get owlDialogContainerId() {
|
|
3919
|
-
return this._config.id;
|
|
3920
|
-
}
|
|
3921
|
-
get owlDialogContainerRole() {
|
|
3922
|
-
return this._config.role || null;
|
|
3923
|
-
}
|
|
3924
|
-
get owlDialogContainerAriaLabelledby() {
|
|
3925
|
-
return this.ariaLabelledBy;
|
|
3926
|
-
}
|
|
3927
|
-
get owlDialogContainerAriaDescribedby() {
|
|
3928
|
-
return this._config.ariaDescribedBy || null;
|
|
3929
|
-
}
|
|
3930
|
-
get owlDialogContainerAnimation() {
|
|
3931
|
-
return { value: this.state, params: this.params };
|
|
3932
3847
|
}
|
|
3933
3848
|
ngOnInit() { }
|
|
3934
3849
|
/**
|
|
3935
3850
|
* Attach a ComponentPortal as content to this dialog container.
|
|
3936
3851
|
*/
|
|
3937
3852
|
attachComponentPortal(portal) {
|
|
3938
|
-
if (this.portalOutlet
|
|
3853
|
+
if (this.portalOutlet?.hasAttached()) {
|
|
3939
3854
|
throw Error('Attempting to attach dialog content after content is already attached');
|
|
3940
3855
|
}
|
|
3941
3856
|
this.savePreviouslyFocusedElement();
|
|
@@ -3998,30 +3913,30 @@ class OwlDialogContainerComponent extends BasePortalOutlet {
|
|
|
3998
3913
|
if (this.document) {
|
|
3999
3914
|
this.elementFocusedBeforeDialogWasOpened = this.document
|
|
4000
3915
|
.activeElement;
|
|
4001
|
-
Promise.resolve().then(() => this.elementRef.nativeElement.focus());
|
|
3916
|
+
Promise.resolve().then(() => this.elementRef.nativeElement.focus()).catch(() => { });
|
|
4002
3917
|
}
|
|
4003
3918
|
}
|
|
4004
3919
|
trapFocus() {
|
|
4005
3920
|
if (!this.focusTrap) {
|
|
4006
3921
|
this.focusTrap = this.focusTrapFactory.create(this.elementRef.nativeElement);
|
|
4007
3922
|
}
|
|
4008
|
-
if (this._config
|
|
4009
|
-
this.focusTrap
|
|
3923
|
+
if (this._config?.autoFocus) {
|
|
3924
|
+
this.focusTrap?.focusInitialElementWhenReady().catch(() => { });
|
|
4010
3925
|
}
|
|
4011
3926
|
}
|
|
4012
3927
|
restoreFocus() {
|
|
4013
3928
|
const toFocus = this.elementFocusedBeforeDialogWasOpened;
|
|
4014
|
-
// We need the extra check, because IE can set the `activeElement` to null in some cases.
|
|
4015
3929
|
if (toFocus && typeof toFocus.focus === 'function') {
|
|
4016
3930
|
toFocus.focus();
|
|
4017
3931
|
}
|
|
4018
3932
|
if (this.focusTrap) {
|
|
4019
3933
|
this.focusTrap.destroy();
|
|
3934
|
+
this.focusTrap = undefined;
|
|
4020
3935
|
}
|
|
4021
3936
|
}
|
|
4022
3937
|
}
|
|
4023
|
-
|
|
4024
|
-
|
|
3938
|
+
DialogContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DialogContainerComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i4.ConfigurableFocusTrapFactory }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
3939
|
+
DialogContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: DialogContainerComponent, selector: "nxt-dialog-container", host: { listeners: { "@slideModal.start": "onAnimationStart($event)", "@slideModal.done": "onAnimationDone($event)" }, properties: { "class.nxt-dialog-container": "this.dialogContainerClass", "attr.tabindex": "this.dialogContainerTabIndex", "attr.id": "this.dialogContainerId", "attr.role": "this.dialogContainerRole", "attr.aria-labelledby": "this.dialogContainerAriaLabelledby", "attr.aria-describedby": "this.dialogContainerAriaDescribedby", "@slideModal": "this.dialogContainerAnimation" } }, viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-template cdkPortalOutlet></ng-template>\n", dependencies: [{ kind: "directive", type: i2.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], animations: [
|
|
4025
3940
|
trigger('slideModal', [
|
|
4026
3941
|
transition('void => enter', [
|
|
4027
3942
|
style(zoomFadeInFrom),
|
|
@@ -4045,9 +3960,9 @@ OwlDialogContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.
|
|
|
4045
3960
|
transition('enter => exit', [animateChild(), animate(200, style(zoomFadeIn))], { params: { x: '0px', y: '0px', ox: '50%', oy: '50%' } })
|
|
4046
3961
|
])
|
|
4047
3962
|
] });
|
|
4048
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3963
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DialogContainerComponent, decorators: [{
|
|
4049
3964
|
type: Component,
|
|
4050
|
-
args: [{ selector: '
|
|
3965
|
+
args: [{ selector: 'nxt-dialog-container', animations: [
|
|
4051
3966
|
trigger('slideModal', [
|
|
4052
3967
|
transition('void => enter', [
|
|
4053
3968
|
style(zoomFadeInFrom),
|
|
@@ -4071,7 +3986,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
4071
3986
|
transition('enter => exit', [animateChild(), animate(200, style(zoomFadeIn))], { params: { x: '0px', y: '0px', ox: '50%', oy: '50%' } })
|
|
4072
3987
|
])
|
|
4073
3988
|
], template: "<ng-template cdkPortalOutlet></ng-template>\n" }]
|
|
4074
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type:
|
|
3989
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i4.ConfigurableFocusTrapFactory }, { type: Document, decorators: [{
|
|
4075
3990
|
type: Optional
|
|
4076
3991
|
}, {
|
|
4077
3992
|
type: Inject,
|
|
@@ -4079,25 +3994,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
4079
3994
|
}] }]; }, propDecorators: { portalOutlet: [{
|
|
4080
3995
|
type: ViewChild,
|
|
4081
3996
|
args: [CdkPortalOutlet, { static: true }]
|
|
4082
|
-
}],
|
|
3997
|
+
}], dialogContainerClass: [{
|
|
4083
3998
|
type: HostBinding,
|
|
4084
|
-
args: ['class.
|
|
4085
|
-
}],
|
|
3999
|
+
args: ['class.nxt-dialog-container']
|
|
4000
|
+
}], dialogContainerTabIndex: [{
|
|
4086
4001
|
type: HostBinding,
|
|
4087
4002
|
args: ['attr.tabindex']
|
|
4088
|
-
}],
|
|
4003
|
+
}], dialogContainerId: [{
|
|
4089
4004
|
type: HostBinding,
|
|
4090
4005
|
args: ['attr.id']
|
|
4091
|
-
}],
|
|
4006
|
+
}], dialogContainerRole: [{
|
|
4092
4007
|
type: HostBinding,
|
|
4093
4008
|
args: ['attr.role']
|
|
4094
|
-
}],
|
|
4009
|
+
}], dialogContainerAriaLabelledby: [{
|
|
4095
4010
|
type: HostBinding,
|
|
4096
4011
|
args: ['attr.aria-labelledby']
|
|
4097
|
-
}],
|
|
4012
|
+
}], dialogContainerAriaDescribedby: [{
|
|
4098
4013
|
type: HostBinding,
|
|
4099
4014
|
args: ['attr.aria-describedby']
|
|
4100
|
-
}],
|
|
4015
|
+
}], dialogContainerAnimation: [{
|
|
4101
4016
|
type: HostBinding,
|
|
4102
4017
|
args: ['@slideModal']
|
|
4103
4018
|
}], onAnimationStart: [{
|
|
@@ -4108,26 +4023,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
4108
4023
|
args: ['@slideModal.done', ['$event']]
|
|
4109
4024
|
}] } });
|
|
4110
4025
|
|
|
4111
|
-
const
|
|
4026
|
+
const NXT_DIALOG_DATA = new InjectionToken('NXT_DIALOG_DATA');
|
|
4112
4027
|
/**
|
|
4113
4028
|
* Injection token that determines the scroll handling while the dialog is open.
|
|
4114
4029
|
* */
|
|
4115
|
-
const
|
|
4116
|
-
function
|
|
4030
|
+
const NXT_DIALOG_SCROLL_STRATEGY = new InjectionToken('NXT_DIALOG_SCROLL_STRATEGY');
|
|
4031
|
+
function NXT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {
|
|
4117
4032
|
const fn = () => overlay.scrollStrategies.block();
|
|
4118
4033
|
return fn;
|
|
4119
4034
|
}
|
|
4120
4035
|
/** @docs-private */
|
|
4121
|
-
const
|
|
4122
|
-
provide:
|
|
4036
|
+
const NXT_DIALOG_SCROLL_STRATEGY_PROVIDER = {
|
|
4037
|
+
provide: NXT_DIALOG_SCROLL_STRATEGY,
|
|
4123
4038
|
deps: [Overlay],
|
|
4124
|
-
useFactory:
|
|
4039
|
+
useFactory: NXT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY
|
|
4125
4040
|
};
|
|
4126
4041
|
/** I
|
|
4127
4042
|
* njection token that can be used to specify default dialog options.
|
|
4128
4043
|
* */
|
|
4129
|
-
const
|
|
4130
|
-
class
|
|
4044
|
+
const NXT_DIALOG_DEFAULT_OPTIONS = new InjectionToken('NXT_DIALOG_DEFAULT_OPTIONS');
|
|
4045
|
+
class DialogService {
|
|
4046
|
+
/** Keeps track of the currently-open dialogs. */
|
|
4047
|
+
get openDialogs() {
|
|
4048
|
+
return this.parentDialog
|
|
4049
|
+
? this.parentDialog.openDialogs
|
|
4050
|
+
: this._openDialogsAtThisLevel;
|
|
4051
|
+
}
|
|
4052
|
+
/** Stream that emits when a dialog has been opened. */
|
|
4053
|
+
get afterOpen() {
|
|
4054
|
+
return this.parentDialog
|
|
4055
|
+
? this.parentDialog.afterOpen
|
|
4056
|
+
: this._afterOpenAtThisLevel;
|
|
4057
|
+
}
|
|
4058
|
+
get _afterAllClosed() {
|
|
4059
|
+
const parent = this.parentDialog;
|
|
4060
|
+
return parent
|
|
4061
|
+
? parent._afterAllClosed
|
|
4062
|
+
: this._afterAllClosedAtThisLevel;
|
|
4063
|
+
}
|
|
4131
4064
|
constructor(overlay, injector, location, scrollStrategy, defaultOptions, parentDialog, overlayContainer) {
|
|
4132
4065
|
this.overlay = overlay;
|
|
4133
4066
|
this.injector = injector;
|
|
@@ -4151,24 +4084,6 @@ class OwlDialogService {
|
|
|
4151
4084
|
location.subscribe(() => this.closeAll());
|
|
4152
4085
|
}
|
|
4153
4086
|
}
|
|
4154
|
-
/** Keeps track of the currently-open dialogs. */
|
|
4155
|
-
get openDialogs() {
|
|
4156
|
-
return this.parentDialog
|
|
4157
|
-
? this.parentDialog.openDialogs
|
|
4158
|
-
: this._openDialogsAtThisLevel;
|
|
4159
|
-
}
|
|
4160
|
-
/** Stream that emits when a dialog has been opened. */
|
|
4161
|
-
get afterOpen() {
|
|
4162
|
-
return this.parentDialog
|
|
4163
|
-
? this.parentDialog.afterOpen
|
|
4164
|
-
: this._afterOpenAtThisLevel;
|
|
4165
|
-
}
|
|
4166
|
-
get _afterAllClosed() {
|
|
4167
|
-
const parent = this.parentDialog;
|
|
4168
|
-
return parent
|
|
4169
|
-
? parent._afterAllClosed
|
|
4170
|
-
: this._afterAllClosedAtThisLevel;
|
|
4171
|
-
}
|
|
4172
4087
|
open(componentOrTemplateRef, config) {
|
|
4173
4088
|
config = applyConfigDefaults(config, this.defaultOptions);
|
|
4174
4089
|
if (config.id && this.getDialogById(config.id)) {
|
|
@@ -4205,7 +4120,7 @@ class OwlDialogService {
|
|
|
4205
4120
|
return this.openDialogs.find(dialog => dialog.id === id);
|
|
4206
4121
|
}
|
|
4207
4122
|
attachDialogContent(componentOrTemplateRef, dialogContainer, overlayRef, config) {
|
|
4208
|
-
const dialogRef = new
|
|
4123
|
+
const dialogRef = new DialogRef(overlayRef, dialogContainer, config.id, this.location);
|
|
4209
4124
|
if (config.hasBackdrop) {
|
|
4210
4125
|
overlayRef.backdropClick().subscribe(() => {
|
|
4211
4126
|
if (!dialogRef.disableClose) {
|
|
@@ -4213,9 +4128,7 @@ class OwlDialogService {
|
|
|
4213
4128
|
}
|
|
4214
4129
|
});
|
|
4215
4130
|
}
|
|
4216
|
-
if (componentOrTemplateRef instanceof TemplateRef) {
|
|
4217
|
-
}
|
|
4218
|
-
else {
|
|
4131
|
+
if (!(componentOrTemplateRef instanceof TemplateRef)) {
|
|
4219
4132
|
const injector = this.createInjector(config, dialogRef, dialogContainer);
|
|
4220
4133
|
const contentRef = dialogContainer.attachComponentPortal(new ComponentPortal(componentOrTemplateRef, undefined, injector));
|
|
4221
4134
|
dialogRef.componentInstance = contentRef.instance;
|
|
@@ -4231,9 +4144,9 @@ class OwlDialogService {
|
|
|
4231
4144
|
config.viewContainerRef.injector;
|
|
4232
4145
|
return Injector.create({
|
|
4233
4146
|
providers: [
|
|
4234
|
-
{ provide:
|
|
4235
|
-
{ provide:
|
|
4236
|
-
{ provide:
|
|
4147
|
+
{ provide: DialogRef, useValue: dialogRef },
|
|
4148
|
+
{ provide: DialogContainerComponent, useValue: dialogContainer },
|
|
4149
|
+
{ provide: NXT_DIALOG_DATA, useValue: config.data }
|
|
4237
4150
|
],
|
|
4238
4151
|
parent: userInjector || this.injector
|
|
4239
4152
|
});
|
|
@@ -4243,7 +4156,7 @@ class OwlDialogService {
|
|
|
4243
4156
|
return this.overlay.create(overlayConfig);
|
|
4244
4157
|
}
|
|
4245
4158
|
attachDialogContainer(overlayRef, config) {
|
|
4246
|
-
const containerPortal = new ComponentPortal(
|
|
4159
|
+
const containerPortal = new ComponentPortal(DialogContainerComponent, config.viewContainerRef);
|
|
4247
4160
|
const containerRef = overlayRef.attach(containerPortal);
|
|
4248
4161
|
containerRef.instance.setConfig(config);
|
|
4249
4162
|
return containerRef.instance;
|
|
@@ -4305,25 +4218,31 @@ class OwlDialogService {
|
|
|
4305
4218
|
}
|
|
4306
4219
|
}
|
|
4307
4220
|
}
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4221
|
+
DialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DialogService, deps: [{ token: i1.Overlay }, { token: i0.Injector }, { token: Location, optional: true }, { token: NXT_DIALOG_SCROLL_STRATEGY }, { token: NXT_DIALOG_DEFAULT_OPTIONS, optional: true }, { token: DialogService, optional: true, skipSelf: true }, { token: i1.OverlayContainer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4222
|
+
DialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DialogService });
|
|
4223
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DialogService, decorators: [{
|
|
4311
4224
|
type: Injectable
|
|
4312
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
4225
|
+
}], ctorParameters: function () { return [{ type: i1.Overlay }, { type: i0.Injector }, { type: undefined, decorators: [{
|
|
4313
4226
|
type: Optional
|
|
4227
|
+
}, {
|
|
4228
|
+
type: Inject,
|
|
4229
|
+
args: [Location]
|
|
4314
4230
|
}] }, { type: undefined, decorators: [{
|
|
4315
4231
|
type: Inject,
|
|
4316
|
-
args: [
|
|
4317
|
-
}] }, { type:
|
|
4232
|
+
args: [NXT_DIALOG_SCROLL_STRATEGY]
|
|
4233
|
+
}] }, { type: undefined, decorators: [{
|
|
4318
4234
|
type: Optional
|
|
4319
4235
|
}, {
|
|
4320
4236
|
type: Inject,
|
|
4321
|
-
args: [
|
|
4322
|
-
}] }, { type:
|
|
4237
|
+
args: [NXT_DIALOG_DEFAULT_OPTIONS]
|
|
4238
|
+
}] }, { type: undefined, decorators: [{
|
|
4323
4239
|
type: Optional
|
|
4324
4240
|
}, {
|
|
4325
4241
|
type: SkipSelf
|
|
4326
|
-
}
|
|
4242
|
+
}, {
|
|
4243
|
+
type: Inject,
|
|
4244
|
+
args: [DialogService]
|
|
4245
|
+
}] }, { type: i1.OverlayContainer }]; } });
|
|
4327
4246
|
/**
|
|
4328
4247
|
* Applies default options to the dialog config.
|
|
4329
4248
|
*
|
|
@@ -4332,85 +4251,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
4332
4251
|
* @returns The new configuration object.
|
|
4333
4252
|
*/
|
|
4334
4253
|
function applyConfigDefaults(config, defaultOptions) {
|
|
4335
|
-
return extendObject(new
|
|
4254
|
+
return extendObject(new DialogConfig(), config, defaultOptions);
|
|
4336
4255
|
}
|
|
4337
4256
|
|
|
4338
4257
|
/** Injection token that determines the scroll handling while the dtPicker is open. */
|
|
4339
|
-
const
|
|
4258
|
+
const NXT_DTPICKER_SCROLL_STRATEGY = new InjectionToken('NXT_DTPICKER_SCROLL_STRATEGY');
|
|
4340
4259
|
/** @docs-private */
|
|
4341
|
-
function
|
|
4260
|
+
function NXT_DTPICKER_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {
|
|
4342
4261
|
const fn = () => overlay.scrollStrategies.block();
|
|
4343
4262
|
return fn;
|
|
4344
4263
|
}
|
|
4345
4264
|
/** @docs-private */
|
|
4346
|
-
const
|
|
4347
|
-
provide:
|
|
4265
|
+
const NXT_DTPICKER_SCROLL_STRATEGY_PROVIDER = {
|
|
4266
|
+
provide: NXT_DTPICKER_SCROLL_STRATEGY,
|
|
4348
4267
|
deps: [Overlay],
|
|
4349
|
-
useFactory:
|
|
4268
|
+
useFactory: NXT_DTPICKER_SCROLL_STRATEGY_PROVIDER_FACTORY
|
|
4350
4269
|
};
|
|
4351
|
-
class
|
|
4352
|
-
constructor(overlay, viewContainerRef, dialogService, ngZone, changeDetector, dateTimeAdapter, defaultScrollStrategy, dateTimeFormats, document) {
|
|
4353
|
-
super(dateTimeAdapter, dateTimeFormats);
|
|
4354
|
-
this.overlay = overlay;
|
|
4355
|
-
this.viewContainerRef = viewContainerRef;
|
|
4356
|
-
this.dialogService = dialogService;
|
|
4357
|
-
this.ngZone = ngZone;
|
|
4358
|
-
this.changeDetector = changeDetector;
|
|
4359
|
-
this.dateTimeAdapter = dateTimeAdapter;
|
|
4360
|
-
this.dateTimeFormats = dateTimeFormats;
|
|
4361
|
-
this.document = document;
|
|
4362
|
-
/** Custom class for the picker backdrop. */
|
|
4363
|
-
this.backdropClass = [];
|
|
4364
|
-
/** Custom class for the picker overlay pane. */
|
|
4365
|
-
this.panelClass = [];
|
|
4366
|
-
/**
|
|
4367
|
-
* Set the type of the dateTime picker
|
|
4368
|
-
* 'both' -- show both calendar and timer
|
|
4369
|
-
* 'calendar' -- show only calendar
|
|
4370
|
-
* 'timer' -- show only timer
|
|
4371
|
-
*/
|
|
4372
|
-
this._pickerType = 'both';
|
|
4373
|
-
/**
|
|
4374
|
-
* Whether the picker open as a dialog
|
|
4375
|
-
*/
|
|
4376
|
-
this._pickerMode = 'popup';
|
|
4377
|
-
/** Whether the calendar is open. */
|
|
4378
|
-
this._opened = false;
|
|
4379
|
-
/**
|
|
4380
|
-
* Callback when the picker is closed
|
|
4381
|
-
* */
|
|
4382
|
-
this.afterPickerClosed = new EventEmitter();
|
|
4383
|
-
/**
|
|
4384
|
-
* Callback when the picker is open
|
|
4385
|
-
* */
|
|
4386
|
-
this.afterPickerOpen = new EventEmitter();
|
|
4387
|
-
/**
|
|
4388
|
-
* Emits selected year in multi-year view
|
|
4389
|
-
* This doesn't imply a change on the selected date.
|
|
4390
|
-
* */
|
|
4391
|
-
this.yearSelected = new EventEmitter();
|
|
4392
|
-
/**
|
|
4393
|
-
* Emits selected month in year view
|
|
4394
|
-
* This doesn't imply a change on the selected date.
|
|
4395
|
-
* */
|
|
4396
|
-
this.monthSelected = new EventEmitter();
|
|
4397
|
-
/**
|
|
4398
|
-
* Emit when the selected value has been confirmed
|
|
4399
|
-
* */
|
|
4400
|
-
this.confirmSelectedChange = new EventEmitter();
|
|
4401
|
-
/**
|
|
4402
|
-
* Emits when the date time picker is disabled.
|
|
4403
|
-
* */
|
|
4404
|
-
this.disabledChange = new EventEmitter();
|
|
4405
|
-
this.dtInputSub = Subscription.EMPTY;
|
|
4406
|
-
this.hidePickerStreamSub = Subscription.EMPTY;
|
|
4407
|
-
this.confirmSelectedStreamSub = Subscription.EMPTY;
|
|
4408
|
-
this.pickerOpenedStreamSub = Subscription.EMPTY;
|
|
4409
|
-
/** The element that was focused before the date time picker was opened. */
|
|
4410
|
-
this.focusedElementBeforeOpen = null;
|
|
4411
|
-
this._selecteds = [];
|
|
4412
|
-
this.defaultScrollStrategy = defaultScrollStrategy;
|
|
4413
|
-
}
|
|
4270
|
+
class DateTimeComponent extends DateTimeDirective {
|
|
4414
4271
|
get startAt() {
|
|
4415
4272
|
// If an explicit startAt is set we start there, otherwise we start at whatever the currently
|
|
4416
4273
|
// selected value is.
|
|
@@ -4419,19 +4276,17 @@ class OwlDateTimeComponent extends OwlDateTimeDirective {
|
|
|
4419
4276
|
}
|
|
4420
4277
|
if (this._dtInput) {
|
|
4421
4278
|
if (this._dtInput.selectMode === 'single') {
|
|
4422
|
-
return this._dtInput.value
|
|
4279
|
+
return this._dtInput.value;
|
|
4423
4280
|
}
|
|
4424
4281
|
else if (this._dtInput.selectMode === 'range' ||
|
|
4425
4282
|
this._dtInput.selectMode === 'rangeFrom') {
|
|
4426
|
-
return this._dtInput.values[0]
|
|
4283
|
+
return this._dtInput.values[0];
|
|
4427
4284
|
}
|
|
4428
4285
|
else if (this._dtInput.selectMode === 'rangeTo') {
|
|
4429
|
-
return this._dtInput.values[1]
|
|
4286
|
+
return this._dtInput.values[1];
|
|
4430
4287
|
}
|
|
4431
4288
|
}
|
|
4432
|
-
|
|
4433
|
-
return null;
|
|
4434
|
-
}
|
|
4289
|
+
return;
|
|
4435
4290
|
}
|
|
4436
4291
|
set startAt(date) {
|
|
4437
4292
|
this._startAt = this.getValidDate(this.dateTimeAdapter.deserialize(date));
|
|
@@ -4459,9 +4314,7 @@ class OwlDateTimeComponent extends OwlDateTimeDirective {
|
|
|
4459
4314
|
}
|
|
4460
4315
|
}
|
|
4461
4316
|
get disabled() {
|
|
4462
|
-
return this._disabled
|
|
4463
|
-
? this._dtInput.disabled
|
|
4464
|
-
: !!this._disabled;
|
|
4317
|
+
return this._disabled ?? !!this._dtInput?.disabled;
|
|
4465
4318
|
}
|
|
4466
4319
|
set disabled(value) {
|
|
4467
4320
|
value = coerceBooleanProperty(value);
|
|
@@ -4490,36 +4343,91 @@ class OwlDateTimeComponent extends OwlDateTimeDirective {
|
|
|
4490
4343
|
this.changeDetector.markForCheck();
|
|
4491
4344
|
}
|
|
4492
4345
|
get selecteds() {
|
|
4493
|
-
return this._selecteds;
|
|
4346
|
+
return this._selecteds || [];
|
|
4494
4347
|
}
|
|
4495
4348
|
set selecteds(values) {
|
|
4496
4349
|
this._selecteds = values;
|
|
4497
4350
|
this.changeDetector.markForCheck();
|
|
4498
4351
|
}
|
|
4499
4352
|
/** The minimum selectable date. */
|
|
4500
|
-
get
|
|
4501
|
-
return this._dtInput && this._dtInput.min;
|
|
4353
|
+
get min() {
|
|
4354
|
+
return (this._dtInput && this._dtInput.min);
|
|
4502
4355
|
}
|
|
4503
4356
|
/** The maximum selectable date. */
|
|
4504
|
-
get
|
|
4505
|
-
return this._dtInput && this._dtInput.max;
|
|
4357
|
+
get max() {
|
|
4358
|
+
return (this._dtInput && this._dtInput.max);
|
|
4506
4359
|
}
|
|
4507
4360
|
get dateTimeFilter() {
|
|
4508
|
-
return this._dtInput
|
|
4361
|
+
return this._dtInput?.dateTimeFilter;
|
|
4509
4362
|
}
|
|
4510
4363
|
get selectMode() {
|
|
4511
|
-
return this._dtInput
|
|
4364
|
+
return this._dtInput?.selectMode;
|
|
4512
4365
|
}
|
|
4513
4366
|
get isInSingleMode() {
|
|
4514
|
-
return this._dtInput
|
|
4367
|
+
return !!this._dtInput?.isInSingleMode;
|
|
4515
4368
|
}
|
|
4516
4369
|
get isInRangeMode() {
|
|
4517
|
-
return this._dtInput
|
|
4370
|
+
return !!this._dtInput?.isInRangeMode;
|
|
4371
|
+
}
|
|
4372
|
+
constructor(overlay, viewContainerRef, dialogService, ngZone, changeDetector, dateTimeAdapter, defaultScrollStrategy, dateTimeFormats, document) {
|
|
4373
|
+
super(dateTimeAdapter, dateTimeFormats);
|
|
4374
|
+
this.overlay = overlay;
|
|
4375
|
+
this.viewContainerRef = viewContainerRef;
|
|
4376
|
+
this.dialogService = dialogService;
|
|
4377
|
+
this.ngZone = ngZone;
|
|
4378
|
+
this.changeDetector = changeDetector;
|
|
4379
|
+
this.defaultScrollStrategy = defaultScrollStrategy;
|
|
4380
|
+
this.document = document;
|
|
4381
|
+
/** Custom class for the picker backdrop. */
|
|
4382
|
+
this.backdropClass = [];
|
|
4383
|
+
/** Custom class for the picker overlay pane. */
|
|
4384
|
+
this.panelClass = [];
|
|
4385
|
+
/**
|
|
4386
|
+
* Set the type of the dateTime picker
|
|
4387
|
+
* 'both' -- show both calendar and timer
|
|
4388
|
+
* 'calendar' -- show only calendar
|
|
4389
|
+
* 'timer' -- show only timer
|
|
4390
|
+
*/
|
|
4391
|
+
this._pickerType = 'both';
|
|
4392
|
+
/**
|
|
4393
|
+
* Whether the picker open as a dialog
|
|
4394
|
+
*/
|
|
4395
|
+
this._pickerMode = 'popup';
|
|
4396
|
+
/** Whether the calendar is open. */
|
|
4397
|
+
this._opened = false;
|
|
4398
|
+
/**
|
|
4399
|
+
* Callback when the picker is closed
|
|
4400
|
+
* */
|
|
4401
|
+
this.afterPickerClosed = new EventEmitter();
|
|
4402
|
+
/**
|
|
4403
|
+
* Callback when the picker is open
|
|
4404
|
+
* */
|
|
4405
|
+
this.afterPickerOpen = new EventEmitter();
|
|
4406
|
+
/**
|
|
4407
|
+
* Emits selected year in multi-year view
|
|
4408
|
+
* This doesn't imply a change on the selected date.
|
|
4409
|
+
* */
|
|
4410
|
+
this.yearSelected = new EventEmitter();
|
|
4411
|
+
/**
|
|
4412
|
+
* Emits selected month in year view
|
|
4413
|
+
* This doesn't imply a change on the selected date.
|
|
4414
|
+
* */
|
|
4415
|
+
this.monthSelected = new EventEmitter();
|
|
4416
|
+
/**
|
|
4417
|
+
* Emit when the selected value has been confirmed
|
|
4418
|
+
* */
|
|
4419
|
+
this.confirmSelectedChange = new EventEmitter();
|
|
4420
|
+
/**
|
|
4421
|
+
* Emits when the date time picker is disabled.
|
|
4422
|
+
* */
|
|
4423
|
+
this.disabledChange = new EventEmitter();
|
|
4424
|
+
this._selecteds = new Array();
|
|
4518
4425
|
}
|
|
4519
4426
|
ngOnInit() { }
|
|
4520
4427
|
ngOnDestroy() {
|
|
4521
4428
|
this.close();
|
|
4522
|
-
this.dtInputSub
|
|
4429
|
+
this.dtInputSub?.unsubscribe();
|
|
4430
|
+
this.dtInputSub = undefined;
|
|
4523
4431
|
this.disabledChange.complete();
|
|
4524
4432
|
if (this.popupRef) {
|
|
4525
4433
|
this.popupRef.dispose();
|
|
@@ -4527,7 +4435,7 @@ class OwlDateTimeComponent extends OwlDateTimeDirective {
|
|
|
4527
4435
|
}
|
|
4528
4436
|
registerInput(input) {
|
|
4529
4437
|
if (this._dtInput) {
|
|
4530
|
-
throw Error('A
|
|
4438
|
+
throw Error('A Nxt DateTimePicker can only be associated with a single input.');
|
|
4531
4439
|
}
|
|
4532
4440
|
this._dtInput = input;
|
|
4533
4441
|
this.dtInputSub = this._dtInput.valueChange.subscribe((value) => {
|
|
@@ -4565,13 +4473,14 @@ class OwlDateTimeComponent extends OwlDateTimeDirective {
|
|
|
4565
4473
|
this.openAsDialog();
|
|
4566
4474
|
else
|
|
4567
4475
|
this.openAsPopup();
|
|
4568
|
-
this.pickerContainer
|
|
4476
|
+
if (this.pickerContainer)
|
|
4477
|
+
this.pickerContainer.picker = this;
|
|
4569
4478
|
// Listen to picker container's hidePickerStream
|
|
4570
|
-
this.hidePickerStreamSub = this.pickerContainer
|
|
4479
|
+
this.hidePickerStreamSub = this.pickerContainer?.hidePickerStream.subscribe(() => {
|
|
4571
4480
|
this.close();
|
|
4572
4481
|
});
|
|
4573
4482
|
// Listen to picker container's confirmSelectedStream
|
|
4574
|
-
this.confirmSelectedStreamSub = this.pickerContainer
|
|
4483
|
+
this.confirmSelectedStreamSub = this.pickerContainer?.confirmSelectedStream.subscribe((event) => {
|
|
4575
4484
|
this.confirmSelect(event);
|
|
4576
4485
|
});
|
|
4577
4486
|
}
|
|
@@ -4631,27 +4540,21 @@ class OwlDateTimeComponent extends OwlDateTimeDirective {
|
|
|
4631
4540
|
this.pickerContainerPortal.isAttached) {
|
|
4632
4541
|
this.pickerContainerPortal.detach();
|
|
4633
4542
|
}
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
this.confirmSelectedStreamSub = null;
|
|
4641
|
-
}
|
|
4642
|
-
if (this.pickerOpenedStreamSub) {
|
|
4643
|
-
this.pickerOpenedStreamSub.unsubscribe();
|
|
4644
|
-
this.pickerOpenedStreamSub = null;
|
|
4645
|
-
}
|
|
4543
|
+
this.hidePickerStreamSub?.unsubscribe();
|
|
4544
|
+
this.hidePickerStreamSub = undefined;
|
|
4545
|
+
this.confirmSelectedStreamSub?.unsubscribe();
|
|
4546
|
+
this.confirmSelectedStreamSub = undefined;
|
|
4547
|
+
this.pickerOpenedStreamSub?.unsubscribe();
|
|
4548
|
+
this.pickerOpenedStreamSub = undefined;
|
|
4646
4549
|
if (this.dialogRef) {
|
|
4647
4550
|
this.dialogRef.close();
|
|
4648
|
-
this.dialogRef =
|
|
4551
|
+
this.dialogRef = undefined;
|
|
4649
4552
|
}
|
|
4650
4553
|
const completeClose = () => {
|
|
4651
4554
|
if (this._opened) {
|
|
4652
4555
|
this._opened = false;
|
|
4653
|
-
this.afterPickerClosed.emit(
|
|
4654
|
-
this.focusedElementBeforeOpen =
|
|
4556
|
+
this.afterPickerClosed.emit();
|
|
4557
|
+
this.focusedElementBeforeOpen = undefined;
|
|
4655
4558
|
}
|
|
4656
4559
|
};
|
|
4657
4560
|
if (this.focusedElementBeforeOpen &&
|
|
@@ -4686,19 +4589,19 @@ class OwlDateTimeComponent extends OwlDateTimeDirective {
|
|
|
4686
4589
|
* Open the picker as a dialog
|
|
4687
4590
|
*/
|
|
4688
4591
|
openAsDialog() {
|
|
4689
|
-
this.dialogRef = this.dialogService.open(
|
|
4592
|
+
this.dialogRef = this.dialogService.open(DateTimeContainerComponent, {
|
|
4690
4593
|
autoFocus: false,
|
|
4691
4594
|
backdropClass: [
|
|
4692
4595
|
'cdk-overlay-dark-backdrop',
|
|
4693
4596
|
...coerceArray(this.backdropClass)
|
|
4694
4597
|
],
|
|
4695
|
-
paneClass: ['
|
|
4598
|
+
paneClass: ['nxt-dt-dialog', ...coerceArray(this.panelClass)],
|
|
4696
4599
|
viewContainerRef: this.viewContainerRef,
|
|
4697
4600
|
scrollStrategy: this.scrollStrategy || this.defaultScrollStrategy()
|
|
4698
4601
|
});
|
|
4699
4602
|
this.pickerContainer = this.dialogRef.componentInstance;
|
|
4700
4603
|
this.dialogRef.afterOpen().subscribe(() => {
|
|
4701
|
-
this.afterPickerOpen.emit(
|
|
4604
|
+
this.afterPickerOpen.emit();
|
|
4702
4605
|
this._opened = true;
|
|
4703
4606
|
});
|
|
4704
4607
|
this.dialogRef.afterClosed().subscribe(() => this.close());
|
|
@@ -4708,26 +4611,26 @@ class OwlDateTimeComponent extends OwlDateTimeDirective {
|
|
|
4708
4611
|
*/
|
|
4709
4612
|
openAsPopup() {
|
|
4710
4613
|
if (!this.pickerContainerPortal) {
|
|
4711
|
-
this.pickerContainerPortal = new ComponentPortal(
|
|
4614
|
+
this.pickerContainerPortal = new ComponentPortal(DateTimeContainerComponent, this.viewContainerRef);
|
|
4712
4615
|
}
|
|
4713
4616
|
if (!this.popupRef) {
|
|
4714
4617
|
this.createPopup();
|
|
4715
4618
|
}
|
|
4716
|
-
if (!this.popupRef
|
|
4717
|
-
const componentRef = this.popupRef
|
|
4718
|
-
this.pickerContainer = componentRef
|
|
4619
|
+
if (!this.popupRef?.hasAttached()) {
|
|
4620
|
+
const componentRef = this.popupRef?.attach(this.pickerContainerPortal);
|
|
4621
|
+
this.pickerContainer = componentRef?.instance;
|
|
4719
4622
|
// Update the position once the calendar has rendered.
|
|
4720
4623
|
this.ngZone.onStable
|
|
4721
4624
|
.asObservable()
|
|
4722
4625
|
.pipe(take(1))
|
|
4723
4626
|
.subscribe(() => {
|
|
4724
|
-
this.popupRef
|
|
4627
|
+
this.popupRef?.updatePosition();
|
|
4725
4628
|
});
|
|
4726
4629
|
// emit open stream
|
|
4727
|
-
this.pickerOpenedStreamSub = this.pickerContainer
|
|
4630
|
+
this.pickerOpenedStreamSub = this.pickerContainer?.pickerOpenedStream
|
|
4728
4631
|
.pipe(take(1))
|
|
4729
4632
|
.subscribe(() => {
|
|
4730
|
-
this.afterPickerOpen.emit(
|
|
4633
|
+
this.afterPickerOpen.emit();
|
|
4731
4634
|
this._opened = true;
|
|
4732
4635
|
});
|
|
4733
4636
|
}
|
|
@@ -4741,84 +4644,82 @@ class OwlDateTimeComponent extends OwlDateTimeDirective {
|
|
|
4741
4644
|
...coerceArray(this.backdropClass)
|
|
4742
4645
|
],
|
|
4743
4646
|
scrollStrategy: this.scrollStrategy || this.defaultScrollStrategy(),
|
|
4744
|
-
panelClass: ['
|
|
4647
|
+
panelClass: ['nxt-dt-popup', ...coerceArray(this.panelClass)]
|
|
4745
4648
|
});
|
|
4746
4649
|
this.popupRef = this.overlay.create(overlayConfig);
|
|
4747
4650
|
merge(this.popupRef.backdropClick(), this.popupRef.detachments(), this.popupRef
|
|
4748
4651
|
.keydownEvents()
|
|
4749
|
-
.pipe(filter(event => event.keyCode === ESCAPE ||
|
|
4652
|
+
.pipe(filter(event => !!(event.keyCode === ESCAPE ||
|
|
4750
4653
|
(this._dtInput &&
|
|
4751
4654
|
event.altKey &&
|
|
4752
|
-
event.keyCode === UP_ARROW)))).subscribe(() => this.close());
|
|
4655
|
+
event.keyCode === UP_ARROW))))).subscribe(() => this.close());
|
|
4753
4656
|
}
|
|
4754
4657
|
/**
|
|
4755
4658
|
* Create the popup PositionStrategy.
|
|
4756
4659
|
* */
|
|
4757
4660
|
createPopupPositionStrategy() {
|
|
4758
|
-
|
|
4759
|
-
.
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4661
|
+
if (this._dtInput)
|
|
4662
|
+
return this.overlay
|
|
4663
|
+
.position()
|
|
4664
|
+
.flexibleConnectedTo(this._dtInput.elementRef)
|
|
4665
|
+
.withTransformOriginOn('.nxt-dt-container')
|
|
4666
|
+
.withFlexibleDimensions(false)
|
|
4667
|
+
.withPush(false)
|
|
4668
|
+
.withPositions([
|
|
4669
|
+
{
|
|
4670
|
+
originX: 'start',
|
|
4671
|
+
originY: 'bottom',
|
|
4672
|
+
overlayX: 'start',
|
|
4673
|
+
overlayY: 'top'
|
|
4674
|
+
},
|
|
4675
|
+
{
|
|
4676
|
+
originX: 'start',
|
|
4677
|
+
originY: 'top',
|
|
4678
|
+
overlayX: 'start',
|
|
4679
|
+
overlayY: 'bottom'
|
|
4680
|
+
},
|
|
4681
|
+
{
|
|
4682
|
+
originX: 'end',
|
|
4683
|
+
originY: 'bottom',
|
|
4684
|
+
overlayX: 'end',
|
|
4685
|
+
overlayY: 'top'
|
|
4686
|
+
},
|
|
4687
|
+
{
|
|
4688
|
+
originX: 'end',
|
|
4689
|
+
originY: 'top',
|
|
4690
|
+
overlayX: 'end',
|
|
4691
|
+
overlayY: 'bottom'
|
|
4692
|
+
},
|
|
4693
|
+
{
|
|
4694
|
+
originX: 'start',
|
|
4695
|
+
originY: 'top',
|
|
4696
|
+
overlayX: 'start',
|
|
4697
|
+
overlayY: 'top',
|
|
4698
|
+
offsetY: -176
|
|
4699
|
+
},
|
|
4700
|
+
{
|
|
4701
|
+
originX: 'start',
|
|
4702
|
+
originY: 'top',
|
|
4703
|
+
overlayX: 'start',
|
|
4704
|
+
overlayY: 'top',
|
|
4705
|
+
offsetY: -352
|
|
4706
|
+
}
|
|
4707
|
+
]);
|
|
4708
|
+
return;
|
|
4804
4709
|
}
|
|
4805
4710
|
}
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4711
|
+
DateTimeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeComponent, deps: [{ token: i1.Overlay }, { token: i0.ViewContainerRef }, { token: DialogService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: DateTimeAdapter }, { token: NXT_DTPICKER_SCROLL_STRATEGY }, { token: NXT_DATE_TIME_FORMATS }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
4712
|
+
DateTimeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: DateTimeComponent, selector: "nxt-date-time", inputs: { backdropClass: "backdropClass", panelClass: "panelClass", startAt: "startAt", pickerType: "pickerType", pickerMode: "pickerMode", disabled: "disabled", opened: "opened", scrollStrategy: "scrollStrategy" }, outputs: { afterPickerClosed: "afterPickerClosed", afterPickerOpen: "afterPickerOpen", yearSelected: "yearSelected", monthSelected: "monthSelected" }, usesInheritance: true, ngImport: i0, template: "<p>date-time-picker works!</p>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4713
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeComponent, decorators: [{
|
|
4809
4714
|
type: Component,
|
|
4810
|
-
args: [{ selector: '
|
|
4811
|
-
}], ctorParameters: function () { return [{ type: i1
|
|
4812
|
-
type: Optional
|
|
4813
|
-
}] }, { type: undefined, decorators: [{
|
|
4715
|
+
args: [{ selector: 'nxt-date-time', changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, template: "<p>date-time-picker works!</p>\n" }]
|
|
4716
|
+
}], ctorParameters: function () { return [{ type: i1.Overlay }, { type: i0.ViewContainerRef }, { type: DialogService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: DateTimeAdapter }, { type: undefined, decorators: [{
|
|
4814
4717
|
type: Inject,
|
|
4815
|
-
args: [
|
|
4718
|
+
args: [NXT_DTPICKER_SCROLL_STRATEGY]
|
|
4816
4719
|
}] }, { type: undefined, decorators: [{
|
|
4817
|
-
type: Optional
|
|
4818
|
-
}, {
|
|
4819
4720
|
type: Inject,
|
|
4820
|
-
args: [
|
|
4821
|
-
}] }, { type:
|
|
4721
|
+
args: [NXT_DATE_TIME_FORMATS]
|
|
4722
|
+
}] }, { type: Document, decorators: [{
|
|
4822
4723
|
type: Optional
|
|
4823
4724
|
}, {
|
|
4824
4725
|
type: Inject,
|
|
@@ -4849,96 +4750,111 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
4849
4750
|
type: Output
|
|
4850
4751
|
}] } });
|
|
4851
4752
|
|
|
4852
|
-
class
|
|
4753
|
+
class DialogModule {
|
|
4853
4754
|
}
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4755
|
+
DialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4756
|
+
DialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.1", ngImport: i0, type: DialogModule, declarations: [DialogContainerComponent], imports: [CommonModule,
|
|
4757
|
+
A11yModule,
|
|
4758
|
+
OverlayModule,
|
|
4759
|
+
PortalModule] });
|
|
4760
|
+
DialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DialogModule, providers: [
|
|
4761
|
+
NXT_DIALOG_SCROLL_STRATEGY_PROVIDER,
|
|
4762
|
+
DialogService
|
|
4763
|
+
], imports: [CommonModule,
|
|
4764
|
+
A11yModule,
|
|
4765
|
+
OverlayModule,
|
|
4766
|
+
PortalModule] });
|
|
4767
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DialogModule, decorators: [{
|
|
4861
4768
|
type: NgModule,
|
|
4862
4769
|
args: [{
|
|
4863
|
-
imports: [CommonModule, A11yModule, OverlayModule, PortalModule],
|
|
4864
|
-
exports: [],
|
|
4865
4770
|
declarations: [
|
|
4866
|
-
|
|
4771
|
+
DialogContainerComponent
|
|
4867
4772
|
],
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4773
|
+
imports: [
|
|
4774
|
+
CommonModule,
|
|
4775
|
+
A11yModule,
|
|
4776
|
+
OverlayModule,
|
|
4777
|
+
PortalModule
|
|
4871
4778
|
],
|
|
4872
|
-
|
|
4873
|
-
|
|
4779
|
+
providers: [
|
|
4780
|
+
NXT_DIALOG_SCROLL_STRATEGY_PROVIDER,
|
|
4781
|
+
DialogService
|
|
4874
4782
|
]
|
|
4875
4783
|
}]
|
|
4876
4784
|
}] });
|
|
4877
4785
|
|
|
4878
|
-
class
|
|
4786
|
+
class DateTimeModule {
|
|
4879
4787
|
}
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4788
|
+
DateTimeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4789
|
+
DateTimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.1", ngImport: i0, type: DateTimeModule, declarations: [DateTimeTriggerDirective,
|
|
4790
|
+
DateTimeInputDirective,
|
|
4791
|
+
DateTimeComponent,
|
|
4792
|
+
DateTimeContainerComponent,
|
|
4793
|
+
MultiYearViewComponent,
|
|
4794
|
+
YearViewComponent,
|
|
4795
|
+
MonthViewComponent,
|
|
4796
|
+
TimerComponent,
|
|
4797
|
+
TimerBoxComponent,
|
|
4798
|
+
CalendarComponent,
|
|
4799
|
+
CalendarBodyComponent,
|
|
4892
4800
|
NumberFixedLenPipe,
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4801
|
+
DateTimeInlineComponent], imports: [CommonModule,
|
|
4802
|
+
OverlayModule,
|
|
4803
|
+
DialogModule,
|
|
4804
|
+
A11yModule], exports: [CalendarComponent,
|
|
4805
|
+
TimerComponent,
|
|
4806
|
+
DateTimeTriggerDirective,
|
|
4807
|
+
DateTimeInputDirective,
|
|
4808
|
+
DateTimeComponent,
|
|
4809
|
+
DateTimeInlineComponent,
|
|
4810
|
+
MultiYearViewComponent,
|
|
4811
|
+
YearViewComponent,
|
|
4812
|
+
MonthViewComponent] });
|
|
4813
|
+
DateTimeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeModule, providers: [
|
|
4814
|
+
DateTimeIntl,
|
|
4815
|
+
NXT_DTPICKER_SCROLL_STRATEGY_PROVIDER
|
|
4816
|
+
], imports: [CommonModule,
|
|
4817
|
+
OverlayModule,
|
|
4818
|
+
DialogModule,
|
|
4819
|
+
A11yModule] });
|
|
4820
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: DateTimeModule, decorators: [{
|
|
4907
4821
|
type: NgModule,
|
|
4908
4822
|
args: [{
|
|
4909
|
-
imports: [CommonModule, OverlayModule, OwlDialogModule, A11yModule],
|
|
4910
|
-
exports: [
|
|
4911
|
-
OwlCalendarComponent,
|
|
4912
|
-
OwlTimerComponent,
|
|
4913
|
-
OwlDateTimeTriggerDirective,
|
|
4914
|
-
OwlDateTimeInputDirective,
|
|
4915
|
-
OwlDateTimeComponent,
|
|
4916
|
-
OwlDateTimeInlineComponent,
|
|
4917
|
-
OwlMultiYearViewComponent,
|
|
4918
|
-
OwlYearViewComponent,
|
|
4919
|
-
OwlMonthViewComponent
|
|
4920
|
-
],
|
|
4921
4823
|
declarations: [
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4824
|
+
DateTimeTriggerDirective,
|
|
4825
|
+
DateTimeInputDirective,
|
|
4826
|
+
DateTimeComponent,
|
|
4827
|
+
DateTimeContainerComponent,
|
|
4828
|
+
MultiYearViewComponent,
|
|
4829
|
+
YearViewComponent,
|
|
4830
|
+
MonthViewComponent,
|
|
4831
|
+
TimerComponent,
|
|
4832
|
+
TimerBoxComponent,
|
|
4833
|
+
CalendarComponent,
|
|
4834
|
+
CalendarBodyComponent,
|
|
4933
4835
|
NumberFixedLenPipe,
|
|
4934
|
-
|
|
4836
|
+
DateTimeInlineComponent
|
|
4935
4837
|
],
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4838
|
+
imports: [
|
|
4839
|
+
CommonModule,
|
|
4840
|
+
OverlayModule,
|
|
4841
|
+
DialogModule,
|
|
4842
|
+
A11yModule
|
|
4843
|
+
],
|
|
4844
|
+
exports: [
|
|
4845
|
+
CalendarComponent,
|
|
4846
|
+
TimerComponent,
|
|
4847
|
+
DateTimeTriggerDirective,
|
|
4848
|
+
DateTimeInputDirective,
|
|
4849
|
+
DateTimeComponent,
|
|
4850
|
+
DateTimeInlineComponent,
|
|
4851
|
+
MultiYearViewComponent,
|
|
4852
|
+
YearViewComponent,
|
|
4853
|
+
MonthViewComponent
|
|
4939
4854
|
],
|
|
4940
|
-
|
|
4941
|
-
|
|
4855
|
+
providers: [
|
|
4856
|
+
DateTimeIntl,
|
|
4857
|
+
NXT_DTPICKER_SCROLL_STRATEGY_PROVIDER
|
|
4942
4858
|
]
|
|
4943
4859
|
}]
|
|
4944
4860
|
}] });
|
|
@@ -4947,4 +4863,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
|
|
|
4947
4863
|
* Generated bundle index. Do not edit.
|
|
4948
4864
|
*/
|
|
4949
4865
|
|
|
4950
|
-
export {
|
|
4866
|
+
export { CalendarComponent, DateTimeAdapter, DateTimeComponent, DateTimeInlineComponent, DateTimeInputDirective, DateTimeIntl, DateTimeModule, DateTimeTriggerDirective, MonthViewComponent, MultiYearViewComponent, NXT_DATE_TIME_FORMATS, NXT_DATE_TIME_LOCALE, NXT_DATE_TIME_LOCALE_PROVIDER, TimerComponent, YearViewComponent };
|
|
4867
|
+
//# sourceMappingURL=nxt-pick-datetime.mjs.map
|