@anglr/datetime 9.0.0 → 10.0.0-beta.20250123121222
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/changelog.md +5 -7
- package/es2022/date-fns/src/services/dateFnsDateApi.service.js +3 -3
- package/es2022/moment/src/services/momentDateApi.service.js +3 -3
- package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js +4 -3
- package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js.map +1 -1
- package/es2022/src/directives/datePickerInput/datePickerInput.directive.js +4 -3
- package/es2022/src/directives/datePickerInput/datePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js +4 -3
- package/es2022/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js.map +1 -1
- package/es2022/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js +4 -3
- package/es2022/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js +4 -3
- package/es2022/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js +4 -3
- package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js.map +1 -1
- package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js +4 -3
- package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/withNow/withNow.directive.js +4 -3
- package/es2022/src/directives/withNow/withNow.directive.js.map +1 -1
- package/es2022/src/directives/withTime/withTime.directive.js +8 -7
- package/es2022/src/directives/withTime/withTime.directive.js.map +1 -1
- package/es2022/src/directives/withToday/withToday.directive.js +4 -3
- package/es2022/src/directives/withToday/withToday.directive.js.map +1 -1
- package/es2022/src/index.js +2 -1
- package/es2022/src/index.js.map +1 -1
- package/es2022/src/modules/calendar/components/monthCalendar/monthCalendar.component.js +4 -4
- package/es2022/src/modules/calendar/components/monthCalendar/monthCalendar.component.js.map +1 -1
- package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js +4 -3
- package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js.map +1 -1
- package/es2022/src/modules/calendar/modules/monthCalendar.module.js +4 -4
- package/es2022/src/modules/calendar/services/eventParser/eventParser.service.js +3 -3
- package/es2022/src/modules/{datePipes/datePipes.module.js → datePipes.module.js} +8 -15
- package/es2022/src/modules/datePipes.module.js.map +1 -0
- package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js +4 -3
- package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeBase.js +3 -3
- package/es2022/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js +4 -3
- package/es2022/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +4 -3
- package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +6 -5
- package/es2022/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +6 -5
- package/es2022/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +6 -5
- package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/modules/dateTime.module.js +4 -4
- package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +10 -11
- package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +6 -6
- package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js +6 -6
- package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js +9 -8
- package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js +5 -5
- package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +5 -5
- package/es2022/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js +4 -3
- package/es2022/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js +4 -3
- package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/modules/dateTimePicker.module.js +4 -4
- package/es2022/src/modules/index.js +1 -1
- package/es2022/src/modules/index.js.map +1 -1
- package/es2022/src/pipes/{dateConvert/dateConvert.pipe.js → dateConvert.pipe.js} +5 -5
- package/es2022/src/pipes/dateConvert.pipe.js.map +1 -0
- package/es2022/src/pipes/{dateFormat/dateFormat.pipe.js → dateFormat.pipe.js} +5 -5
- package/es2022/src/pipes/dateFormat.pipe.js.map +1 -0
- package/es2022/src/services/datePositionParser/datePositionParser.service.js +3 -3
- package/es2022/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js +3 -3
- package/es2022/src/services/dateValueProvider/dateValueProvider.service.js +3 -3
- package/lerna.json +4 -0
- package/package.json +29 -35
- package/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.d.ts.map +1 -1
- package/src/directives/datePickerInput/datePickerInput.directive.d.ts.map +1 -1
- package/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.d.ts.map +1 -1
- package/src/directives/dateTimePickerInput/dateTimePickerInput.directive.d.ts.map +1 -1
- package/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.d.ts.map +1 -1
- package/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.d.ts.map +1 -1
- package/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.d.ts.map +1 -1
- package/src/directives/withNow/withNow.directive.d.ts.map +1 -1
- package/src/directives/withTime/withTime.directive.d.ts.map +1 -1
- package/src/directives/withToday/withToday.directive.d.ts.map +1 -1
- package/src/index.d.ts +2 -1
- package/src/index.d.ts.map +1 -1
- package/src/modules/calendar/components/monthCalendar/monthCalendar.component.d.ts.map +1 -1
- package/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.d.ts.map +1 -1
- package/src/modules/datePipes.module.d.ts +12 -0
- package/src/modules/datePipes.module.d.ts.map +1 -0
- package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeBase.d.ts +1 -1
- package/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.d.ts +1 -0
- package/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.d.ts.map +1 -1
- package/src/modules/index.d.ts +1 -1
- package/src/modules/index.d.ts.map +1 -1
- package/src/pipes/{dateConvert/dateConvert.pipe.d.ts → dateConvert.pipe.d.ts} +1 -1
- package/src/pipes/dateConvert.pipe.d.ts.map +1 -0
- package/src/pipes/{dateFormat/dateFormat.pipe.d.ts → dateFormat.pipe.d.ts} +2 -2
- package/src/pipes/dateFormat.pipe.d.ts.map +1 -0
- package/version.bak +1 -1
- package/es2022/src/modules/datePipes/datePipes.module.js.map +0 -1
- package/es2022/src/modules/datePipes/index.js +0 -2
- package/es2022/src/modules/datePipes/index.js.map +0 -1
- package/es2022/src/pipes/dateConvert/dateConvert.pipe.js.map +0 -1
- package/es2022/src/pipes/dateFormat/dateFormat.pipe.js.map +0 -1
- package/es2022/src/pipes/index.js +0 -5
- package/es2022/src/pipes/index.js.map +0 -1
- package/es2022/src/pipes/isAfter/isAfter.pipe.js +0 -38
- package/es2022/src/pipes/isAfter/isAfter.pipe.js.map +0 -1
- package/es2022/src/pipes/isBefore/isBefore.pipe.js +0 -38
- package/es2022/src/pipes/isBefore/isBefore.pipe.js.map +0 -1
- package/src/modules/datePipes/datePipes.module.d.ts +0 -14
- package/src/modules/datePipes/datePipes.module.d.ts.map +0 -1
- package/src/modules/datePipes/index.d.ts +0 -2
- package/src/modules/datePipes/index.d.ts.map +0 -1
- package/src/pipes/dateConvert/dateConvert.pipe.d.ts.map +0 -1
- package/src/pipes/dateFormat/dateFormat.pipe.d.ts.map +0 -1
- package/src/pipes/index.d.ts +0 -5
- package/src/pipes/index.d.ts.map +0 -1
- package/src/pipes/isAfter/isAfter.pipe.d.ts +0 -19
- package/src/pipes/isAfter/isAfter.pipe.d.ts.map +0 -1
- package/src/pipes/isBefore/isBefore.pipe.d.ts +0 -19
- package/src/pipes/isBefore/isBefore.pipe.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withToday.directive.js","sourceRoot":"","sources":["../../../../src/directives/withToday/withToday.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAC;;;AAGrD;;GAEG;
|
|
1
|
+
{"version":3,"file":"withToday.directive.js","sourceRoot":"","sources":["../../../../src/directives/withToday/withToday.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAC;;;AAGrD;;GAEG;AAMH,MAAM,OAAO,kBAAkB;IAS3B,iEAAiE;IACjE,YAAY,KAAoC,EAClB,OAAuB;QATrD,sEAAsE;QAEtE;;WAEG;QACO,sBAAiB,GAAiB,IAAI,YAAY,EAAE,CAAC;QAM3D,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YAElD,IAAG,CAAC,KAAK,CAAC,KAAK,EACf,CAAC;gBACG,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC;YACnD,CAAC;QACL,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;QAEd,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;8GA9BQ,kBAAkB,wDAWP,QAAQ;kGAXnB,kBAAkB;;2FAAlB,kBAAkB;kBAL9B,SAAS;mBACV;oBACI,QAAQ,EAAE,uBAAuB;oBACjC,UAAU,EAAE,IAAI;iBACnB;;0BAYgB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Directive, Inject, OnDestroy} from '@angular/core';\nimport {Subscription} from 'rxjs';\n\nimport {DATE_API} from '../../misc/tokens';\nimport {DateTimeInputDirective} from '../../modules';\nimport {DateApi} from '../../services';\n\n/**\n * Directive that sets today (start of a day) as day for empty date time on focus\n */\n@Directive(\n{\n selector: '[dateTime][withToday]',\n standalone: true,\n})\nexport class WithTodayDirective<TDate = unknown> implements OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n //######################### constructor #########################\n constructor(input: DateTimeInputDirective<TDate>,\n @Inject(DATE_API) dateApi: DateApi<TDate>,)\n {\n this.initSubscriptions.add(input.focus.subscribe(() =>\n {\n if(!input.value)\n {\n input.value = dateApi.now().startOfDay().value;\n }\n }));\n }\n \n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.initSubscriptions.unsubscribe();\n }\n}"]}
|
package/es2022/src/index.js
CHANGED
|
@@ -8,5 +8,6 @@ export * from './misc/utils';
|
|
|
8
8
|
export * from './misc/validators';
|
|
9
9
|
export * from './modules';
|
|
10
10
|
export * from './services';
|
|
11
|
-
export * from './pipes';
|
|
11
|
+
export * from './pipes/dateConvert.pipe';
|
|
12
|
+
export * from './pipes/dateFormat.pipe';
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/es2022/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './directives';\nexport * from './interfaces';\nexport * from './misc/constants';\nexport * from './misc/enums';\nexport * from './misc/tokens';\nexport * from './misc/types';\nexport * from './misc/utils';\nexport * from './misc/validators';\nexport * from './modules';\nexport * from './services';\nexport * from './pipes/dateConvert.pipe';\nexport * from './pipes/dateFormat.pipe';"]}
|
|
@@ -118,14 +118,14 @@ export class MonthCalendarComponent {
|
|
|
118
118
|
//TODO: test whether event are refreshed when changed
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
122
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
121
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MonthCalendarComponent, deps: [{ token: DATE_API }, { token: FORMAT_PROVIDER }, { token: i1.EventParser }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
122
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.7", type: MonthCalendarComponent, isStandalone: true, selector: "month-calendar", inputs: { showWeekNumber: { classPropertyName: "showWeekNumber", publicName: "showWeekNumber", isSignal: true, isRequired: false, transformFunction: null }, display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, weekDayName: { classPropertyName: "weekDayName", publicName: "weekDayName", isSignal: true, isRequired: false, transformFunction: null }, dayAspectRatio: { classPropertyName: "dayAspectRatio", publicName: "dayAspectRatio", isSignal: true, isRequired: false, transformFunction: null }, events: { classPropertyName: "events", publicName: "events", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
123
123
|
EventParser,
|
|
124
124
|
], queries: [{ propertyName: "customCalendarDayTemplate", first: true, predicate: CalendarDayTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "defaultCalendarDayTemplate", first: true, predicate: CalendarDayTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "<div *calendarDayTemplate=\"let data\" class=\"default-calendar-day\" [class.is-weekend]=\"data.isWeekend\" [class.is-other-month]=\"!data.isCurrentMonth\">{{data.day}}</div>\n\n<div></div>\n\n@for(dayName of weekDayNames(); track dayName)\n{\n <div [class.week-day-name]=\"dayName\">{{dayName}}</div>\n}\n\n@for(weekData of calendarData() | keyvalue; track weekData)\n{\n <div class=\"week-number\">\n @if(showWeekNumber())\n {\n {{weekData.key}}\n }\n </div>\n \n @for(dayData of weekData.value; track dayData)\n {\n <div [style.padding-bottom.%]=\"dayAspectRatio()\" class=\"day-wrapper\">\n <div class=\"day-content\"><ng-container *ngTemplateOutlet=\"calendarDayTemplate(); context: {$implicit: dayData}\"/></div>\n </div>\n }\n}\n", dependencies: [{ kind: "directive", type: CalendarDayTemplateDirective, selector: "[calendarDayTemplate]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
125
125
|
}
|
|
126
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
126
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MonthCalendarComponent, decorators: [{
|
|
127
127
|
type: Component,
|
|
128
|
-
args: [{ selector: 'month-calendar', imports: [
|
|
128
|
+
args: [{ selector: 'month-calendar', standalone: true, imports: [
|
|
129
129
|
CalendarDayTemplateDirective,
|
|
130
130
|
NgTemplateOutlet,
|
|
131
131
|
KeyValuePipe,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monthCalendar.component.js","sourceRoot":"","sources":["../../../../../../src/modules/calendar/components/monthCalendar/monthCalendar.component.ts","../../../../../../src/modules/calendar/components/monthCalendar/monthCalendar.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,WAAW,EAAU,KAAK,EAAe,SAAS,EAAE,YAAY,EAA4B,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAC/L,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAa,QAA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I,QAAQ,EACzB,CAAC;oBACG,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;oBACjF,GAAG,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;gBAClC,CAAC;YACL,CAAC;YACD,qDAAqD;QACzD,CAAC,CAAC,CAAC;IACP,CAAC;8GAzJQ,sBAAsB,kBA2DX,QAAQ,aACR,eAAe;kGA5D1B,sBAAsB,kvBAL/B;YACI,WAAW;SACd,iFAgCkH,4BAA4B,2BAAS,WAAW,yGALxD,4BAA4B,2BAAS,WAAW,6CCpE/J,gzBAyBA,4CDSQ,4BAA4B,kEAC5B,gBAAgB,+IAChB,YAAY;;2FAQP,sBAAsB;kBAhBlC,SAAS;+BAEI,gBAAgB,WAG1B;wBACI,4BAA4B;wBAC5B,gBAAgB;wBAChB,YAAY;qBACf,aAED;wBACI,WAAW;qBACd,mBACgB,uBAAuB,CAAC,MAAM;;0BA6DlC,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,eAAe","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, TemplateRef, Signal, input, InputSignal, viewChild, contentChild, InputSignalWithTransform, computed, effect, inject} from '@angular/core';\nimport {KeyValuePipe, NgTemplateOutlet} from '@angular/common';\nimport {Dictionary, isString} from '@jscrpt/common';\n\nimport {CalendarDayData, EventData} from '../../interfaces';\nimport {CalendarDayTemplateDirective, CalendarDayTemplateContext} from '../../directives';\nimport {MonthCalendarDayFormat, CalendarDayAspectRatio} from '../../misc';\nimport {EventParser} from '../../services';\nimport {DATE_API, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateApi} from '../../../../services';\nimport {FormatProvider} from '../../../../interfaces';\n\n/**\n * Transform function for `CalendarDayAspectRatio` allowing enter value as number or member name of `CalendarDayAspectRatio`\n */\nfunction dayAspectRatioAttribute(value: keyof typeof CalendarDayAspectRatio|number): CalendarDayAspectRatio\n{\n if(isString(value))\n {\n return CalendarDayAspectRatio[value];\n }\n\n return value;\n}\n\n/**\n * Component used for displaying month calendar\n */\n@Component(\n{\n selector: 'month-calendar',\n templateUrl: 'monthCalendar.component.html',\n imports:\n [\n CalendarDayTemplateDirective,\n NgTemplateOutlet,\n KeyValuePipe,\n ],\n providers:\n [\n EventParser,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class MonthCalendarComponent<TDate = unknown, TEvent = unknown>\n{\n //######################### protected properties - template bindings #########################\n\n /**\n * Data that represents calendar data\n */\n protected calendarData: Signal<Dictionary<CalendarDayData<TDate, TEvent>[]>>;\n\n /**\n * Calendar day template to be used\n */\n protected calendarDayTemplate: Signal<TemplateRef<CalendarDayTemplateContext>>;\n\n /**\n * Array of weekday names\n */\n protected weekDayNames: Signal<string[]>;\n\n //######################### protected properties - children #########################\n\n /**\n * Default calendar day template\n */\n protected defaultCalendarDayTemplate: Signal<TemplateRef<CalendarDayTemplateContext>> = viewChild.required(CalendarDayTemplateDirective, {read: TemplateRef});\n\n /**\n * Custom calendar day template\n */\n protected customCalendarDayTemplate: Signal<TemplateRef<CalendarDayTemplateContext>|undefined|null> = contentChild(CalendarDayTemplateDirective, {read: TemplateRef});\n\n //######################### public properties - inputs #########################\n\n /**\n * Indication that week number should be displayed\n */\n public showWeekNumber: InputSignal<boolean> = input(false);\n\n /**\n * Date that should be displayed in month calendar\n */\n public display: InputSignal<TDate> = input(inject<DateApi<TDate>>(DATE_API).now().value);\n\n /**\n * Format for displaying week day names\n */\n public weekDayName: InputSignal<MonthCalendarDayFormat|keyof typeof MonthCalendarDayFormat> = input<MonthCalendarDayFormat|keyof typeof MonthCalendarDayFormat>(MonthCalendarDayFormat.Short);\n\n /**\n * Aspect ratio for displayed calendar day cell\n */\n public dayAspectRatio: InputSignalWithTransform<CalendarDayAspectRatio, keyof typeof CalendarDayAspectRatio|number> = input<CalendarDayAspectRatio, keyof typeof CalendarDayAspectRatio|number>(CalendarDayAspectRatio.ThreeToTwo, {transform: dayAspectRatioAttribute});\n\n /**\n * Array of events that should be displayed\n */\n public events: InputSignal<EventData<TDate, TEvent>[]> = input<EventData<TDate, TEvent>[]>([]);\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected dateApi: DateApi<TDate>,\n @Inject(FORMAT_PROVIDER) protected formatProvider: FormatProvider,\n protected eventParser: EventParser<TDate, TEvent>,)\n {\n this.calendarDayTemplate = computed(() => this.customCalendarDayTemplate() ?? this.defaultCalendarDayTemplate());\n\n this.weekDayNames = computed(() =>\n {\n const weekDayNames = [];\n\n switch(this.weekDayName())\n {\n default:\n // case MonthCalendarDayFormat.None:\n {\n for(let x = 0; x < 7; x++)\n {\n weekDayNames.push('');\n }\n\n break;\n }\n case MonthCalendarDayFormat.Short:\n {\n const names = this.dateApi.weekdays(true);\n weekDayNames.push(...names);\n\n break;\n }\n case MonthCalendarDayFormat.Full:\n {\n const names = this.dateApi.weekdays();\n weekDayNames.push(...names);\n\n break;\n }\n }\n\n return weekDayNames;\n });\n\n this.calendarData = computed(() =>\n {\n const display = this.display();\n const workDate = this.dateApi.getValue(display);\n\n workDate.startOfMonth()\n .startOfWeek();\n\n const calendarData: Dictionary<CalendarDayData<TDate, TEvent>[]> = {};\n\n do\n {\n const weekData: CalendarDayData<TDate, TEvent>[] = calendarData[workDate.format(this.formatProvider.week)] = [];\n\n for(let x = 0; x < 7; x++)\n {\n weekData.push(\n {\n date: workDate.value,\n day: workDate.dayOfMonth(),\n events: [],\n isCurrentMonth: workDate.isSameMonth(display),\n isWeekend: workDate.isWeekend(),\n week: +workDate.format(this.formatProvider.week),\n });\n\n workDate.addDays(1);\n }\n\n workDate.startOfWeek();\n }\n while(workDate.isSameMonth(display));\n\n return calendarData;\n });\n\n effect(() =>\n {\n const events = this.eventParser.getEventsPerDay(this.events());\n const calendarData = this.calendarData();\n\n for(const week in calendarData)\n {\n const weekData = calendarData[week];\n\n for(const day of weekData)\n {\n const found = events.find(itm => this.dateApi.getValue(itm[0]).isSame(day.date));\n day.events = found?.[1] ?? [];\n }\n }\n //TODO: test whether event are refreshed when changed\n });\n }\n}","<div *calendarDayTemplate=\"let data\" class=\"default-calendar-day\" [class.is-weekend]=\"data.isWeekend\" [class.is-other-month]=\"!data.isCurrentMonth\">{{data.day}}</div>\n\n<div></div>\n\n@for(dayName of weekDayNames(); track dayName)\n{\n <div [class.week-day-name]=\"dayName\">{{dayName}}</div>\n}\n\n@for(weekData of calendarData() | keyvalue; track weekData)\n{\n <div class=\"week-number\">\n @if(showWeekNumber())\n {\n {{weekData.key}}\n }\n </div>\n \n @for(dayData of weekData.value; track dayData)\n {\n <div [style.padding-bottom.%]=\"dayAspectRatio()\" class=\"day-wrapper\">\n <div class=\"day-content\"><ng-container *ngTemplateOutlet=\"calendarDayTemplate(); context: {$implicit: dayData}\"/></div>\n </div>\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"monthCalendar.component.js","sourceRoot":"","sources":["../../../../../../src/modules/calendar/components/monthCalendar/monthCalendar.component.ts","../../../../../../src/modules/calendar/components/monthCalendar/monthCalendar.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,WAAW,EAAU,KAAK,EAAe,SAAS,EAAE,YAAY,EAA4B,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAC/L,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAa,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAGpD,OAAO,EAAC,4BAA4B,EAA6B,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAC,WAAW,EAA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AAG,CAAC,IAAI,CAAC,CAAC,CAAC;oBACjF,GAAG,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;gBAClC,CAAC;YACL,CAAC;YACD,qDAAqD;QACzD,CAAC,CAAC,CAAC;IACP,CAAC;8GAzJQ,sBAAsB,kBA2DX,QAAQ,aACR,eAAe;kGA5D1B,sBAAsB,kvBAL/B;YACI,WAAW;SACd,iFAgCkH,4BAA4B,2BAAS,WAAW,yGALxD,4BAA4B,2BAAS,WAAW,6CCrE/J,gzBAyBA,4CDUQ,4BAA4B,kEAC5B,gBAAgB,+IAChB,YAAY;;2FAQP,sBAAsB;kBAjBlC,SAAS;+BAEI,gBAAgB,cAEd,IAAI,WAEhB;wBACI,4BAA4B;wBAC5B,gBAAgB;wBAChB,YAAY;qBACf,aAED;wBACI,WAAW;qBACd,mBACgB,uBAAuB,CAAC,MAAM;;0BA6DlC,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,eAAe","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, TemplateRef, Signal, input, InputSignal, viewChild, contentChild, InputSignalWithTransform, computed, effect, inject} from '@angular/core';\nimport {KeyValuePipe, NgTemplateOutlet} from '@angular/common';\nimport {Dictionary, isString} from '@jscrpt/common';\n\nimport {CalendarDayData, EventData} from '../../interfaces';\nimport {CalendarDayTemplateDirective, CalendarDayTemplateContext} from '../../directives';\nimport {MonthCalendarDayFormat, CalendarDayAspectRatio} from '../../misc';\nimport {EventParser} from '../../services';\nimport {DATE_API, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateApi} from '../../../../services';\nimport {FormatProvider} from '../../../../interfaces';\n\n/**\n * Transform function for `CalendarDayAspectRatio` allowing enter value as number or member name of `CalendarDayAspectRatio`\n */\nfunction dayAspectRatioAttribute(value: keyof typeof CalendarDayAspectRatio|number): CalendarDayAspectRatio\n{\n if(isString(value))\n {\n return CalendarDayAspectRatio[value];\n }\n\n return value;\n}\n\n/**\n * Component used for displaying month calendar\n */\n@Component(\n{\n selector: 'month-calendar',\n templateUrl: 'monthCalendar.component.html',\n standalone: true,\n imports:\n [\n CalendarDayTemplateDirective,\n NgTemplateOutlet,\n KeyValuePipe,\n ],\n providers:\n [\n EventParser,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class MonthCalendarComponent<TDate = unknown, TEvent = unknown>\n{\n //######################### protected properties - template bindings #########################\n\n /**\n * Data that represents calendar data\n */\n protected calendarData: Signal<Dictionary<CalendarDayData<TDate, TEvent>[]>>;\n\n /**\n * Calendar day template to be used\n */\n protected calendarDayTemplate: Signal<TemplateRef<CalendarDayTemplateContext>>;\n\n /**\n * Array of weekday names\n */\n protected weekDayNames: Signal<string[]>;\n\n //######################### protected properties - children #########################\n\n /**\n * Default calendar day template\n */\n protected defaultCalendarDayTemplate: Signal<TemplateRef<CalendarDayTemplateContext>> = viewChild.required(CalendarDayTemplateDirective, {read: TemplateRef});\n\n /**\n * Custom calendar day template\n */\n protected customCalendarDayTemplate: Signal<TemplateRef<CalendarDayTemplateContext>|undefined|null> = contentChild(CalendarDayTemplateDirective, {read: TemplateRef});\n\n //######################### public properties - inputs #########################\n\n /**\n * Indication that week number should be displayed\n */\n public showWeekNumber: InputSignal<boolean> = input(false);\n\n /**\n * Date that should be displayed in month calendar\n */\n public display: InputSignal<TDate> = input(inject<DateApi<TDate>>(DATE_API).now().value);\n\n /**\n * Format for displaying week day names\n */\n public weekDayName: InputSignal<MonthCalendarDayFormat|keyof typeof MonthCalendarDayFormat> = input<MonthCalendarDayFormat|keyof typeof MonthCalendarDayFormat>(MonthCalendarDayFormat.Short);\n\n /**\n * Aspect ratio for displayed calendar day cell\n */\n public dayAspectRatio: InputSignalWithTransform<CalendarDayAspectRatio, keyof typeof CalendarDayAspectRatio|number> = input<CalendarDayAspectRatio, keyof typeof CalendarDayAspectRatio|number>(CalendarDayAspectRatio.ThreeToTwo, {transform: dayAspectRatioAttribute});\n\n /**\n * Array of events that should be displayed\n */\n public events: InputSignal<EventData<TDate, TEvent>[]> = input<EventData<TDate, TEvent>[]>([]);\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected dateApi: DateApi<TDate>,\n @Inject(FORMAT_PROVIDER) protected formatProvider: FormatProvider,\n protected eventParser: EventParser<TDate, TEvent>,)\n {\n this.calendarDayTemplate = computed(() => this.customCalendarDayTemplate() ?? this.defaultCalendarDayTemplate());\n\n this.weekDayNames = computed(() =>\n {\n const weekDayNames = [];\n\n switch(this.weekDayName())\n {\n default:\n // case MonthCalendarDayFormat.None:\n {\n for(let x = 0; x < 7; x++)\n {\n weekDayNames.push('');\n }\n \n break;\n }\n case MonthCalendarDayFormat.Short:\n {\n const names = this.dateApi.weekdays(true);\n weekDayNames.push(...names);\n \n break;\n }\n case MonthCalendarDayFormat.Full:\n {\n const names = this.dateApi.weekdays();\n weekDayNames.push(...names);\n \n break;\n }\n }\n\n return weekDayNames;\n });\n\n this.calendarData = computed(() =>\n {\n const display = this.display();\n const workDate = this.dateApi.getValue(display);\n\n workDate.startOfMonth()\n .startOfWeek();\n \n const calendarData: Dictionary<CalendarDayData<TDate, TEvent>[]> = {};\n \n do\n {\n const weekData: CalendarDayData<TDate, TEvent>[] = calendarData[workDate.format(this.formatProvider.week)] = [];\n \n for(let x = 0; x < 7; x++)\n {\n weekData.push(\n {\n date: workDate.value,\n day: workDate.dayOfMonth(),\n events: [],\n isCurrentMonth: workDate.isSameMonth(display),\n isWeekend: workDate.isWeekend(),\n week: +workDate.format(this.formatProvider.week),\n });\n \n workDate.addDays(1);\n }\n \n workDate.startOfWeek();\n }\n while(workDate.isSameMonth(display));\n \n return calendarData;\n });\n\n effect(() =>\n {\n const events = this.eventParser.getEventsPerDay(this.events());\n const calendarData = this.calendarData();\n\n for(const week in calendarData)\n {\n const weekData = calendarData[week];\n \n for(const day of weekData)\n {\n const found = events.find(itm => this.dateApi.getValue(itm[0]).isSame(day.date));\n day.events = found?.[1] ?? [];\n }\n }\n //TODO: test whether event are refreshed when changed\n });\n }\n}","<div *calendarDayTemplate=\"let data\" class=\"default-calendar-day\" [class.is-weekend]=\"data.isWeekend\" [class.is-other-month]=\"!data.isCurrentMonth\">{{data.day}}</div>\n\n<div></div>\n\n@for(dayName of weekDayNames(); track dayName)\n{\n <div [class.week-day-name]=\"dayName\">{{dayName}}</div>\n}\n\n@for(weekData of calendarData() | keyvalue; track weekData)\n{\n <div class=\"week-number\">\n @if(showWeekNumber())\n {\n {{weekData.key}}\n }\n </div>\n \n @for(dayData of weekData.value; track dayData)\n {\n <div [style.padding-bottom.%]=\"dayAspectRatio()\" class=\"day-wrapper\">\n <div class=\"day-content\"><ng-container *ngTemplateOutlet=\"calendarDayTemplate(); context: {$implicit: dayData}\"/></div>\n </div>\n }\n}\n"]}
|
package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js
CHANGED
|
@@ -15,13 +15,14 @@ export class CalendarDayTemplateDirective {
|
|
|
15
15
|
static ngTemplateContextGuard(_dir, _ctx) {
|
|
16
16
|
return true;
|
|
17
17
|
}
|
|
18
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
19
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
18
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CalendarDayTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
19
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: CalendarDayTemplateDirective, isStandalone: true, selector: "[calendarDayTemplate]", ngImport: i0 }); }
|
|
20
20
|
}
|
|
21
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CalendarDayTemplateDirective, decorators: [{
|
|
22
22
|
type: Directive,
|
|
23
23
|
args: [{
|
|
24
24
|
selector: '[calendarDayTemplate]',
|
|
25
|
+
standalone: true,
|
|
25
26
|
}]
|
|
26
27
|
}], ctorParameters: () => [{ type: i0.TemplateRef }] });
|
|
27
28
|
//# sourceMappingURL=calendarDayTemplate.directive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendarDayTemplate.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;;AAIrD;;GAEG;
|
|
1
|
+
{"version":3,"file":"calendarDayTemplate.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;;AAIrD;;GAEG;AAMH,MAAM,OAAO,4BAA4B;IAErC,iEAAiE;IACjE,YAAmB,QAAgE;QAAhE,aAAQ,GAAR,QAAQ,CAAwD;IAEnF,CAAC;IAED,wEAAwE;IAExE;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAAC,IAAkC,EAAE,IAAa;QAE3E,OAAO,IAAI,CAAC;IAChB,CAAC;8GAfQ,4BAA4B;kGAA5B,4BAA4B;;2FAA5B,4BAA4B;kBALxC,SAAS;mBACV;oBACI,QAAQ,EAAE,uBAAuB;oBACjC,UAAU,EAAE,IAAI;iBACnB","sourcesContent":["import {Directive, TemplateRef} from '@angular/core';\n\nimport {CalendarDayTemplateContext} from './calendarDayTemplate.context';\n\n/**\n * Directive used for obtaining custom calendar day template\n */\n@Directive(\n{\n selector: '[calendarDayTemplate]',\n standalone: true,\n})\nexport class CalendarDayTemplateDirective<TDate = unknown, TEvent = unknown>\n{\n //######################### constructor #########################\n constructor(public template: TemplateRef<CalendarDayTemplateContext<TDate, TEvent>>)\n {\n }\n\n //######################### ng language server #########################\n \n /**\n * Allows typechecking for template\n */\n static ngTemplateContextGuard(_dir: CalendarDayTemplateDirective, _ctx: unknown): _ctx is CalendarDayTemplateContext\n {\n return true;\n }\n}"]}
|
|
@@ -6,13 +6,13 @@ import * as i0 from "@angular/core";
|
|
|
6
6
|
* Module used for calendar displaying month
|
|
7
7
|
*/
|
|
8
8
|
export class MonthCalendarModule {
|
|
9
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
10
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
9
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MonthCalendarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
10
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.7", ngImport: i0, type: MonthCalendarModule, imports: [CalendarDayTemplateDirective,
|
|
11
11
|
MonthCalendarComponent], exports: [MonthCalendarComponent,
|
|
12
12
|
CalendarDayTemplateDirective] }); }
|
|
13
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
13
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MonthCalendarModule }); }
|
|
14
14
|
}
|
|
15
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MonthCalendarModule, decorators: [{
|
|
16
16
|
type: NgModule,
|
|
17
17
|
args: [{
|
|
18
18
|
imports: [
|
|
@@ -62,10 +62,10 @@ export class EventParser {
|
|
|
62
62
|
}
|
|
63
63
|
return result;
|
|
64
64
|
}
|
|
65
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
66
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
65
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: EventParser, deps: [{ token: DATE_API }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
66
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: EventParser }); }
|
|
67
67
|
}
|
|
68
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: EventParser, decorators: [{
|
|
69
69
|
type: Injectable
|
|
70
70
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
71
71
|
type: Inject,
|
|
@@ -1,35 +1,28 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
|
-
import { DateConvertPipe
|
|
2
|
+
import { DateConvertPipe } from '../pipes/dateConvert.pipe';
|
|
3
|
+
import { DateFormatPipe } from '../pipes/dateFormat.pipe';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
/**
|
|
5
6
|
* Module used for exporting date pipes
|
|
6
7
|
*/
|
|
7
8
|
export class DatePipesModule {
|
|
8
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
9
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
10
|
-
|
|
11
|
-
DateFormatPipe,
|
|
12
|
-
DateConvertPipe], exports: [IsAfterPipe,
|
|
13
|
-
IsBeforePipe,
|
|
14
|
-
DateFormatPipe,
|
|
9
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DatePipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
10
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.7", ngImport: i0, type: DatePipesModule, imports: [DateFormatPipe,
|
|
11
|
+
DateConvertPipe], exports: [DateFormatPipe,
|
|
15
12
|
DateConvertPipe] }); }
|
|
16
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
13
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DatePipesModule }); }
|
|
17
14
|
}
|
|
18
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DatePipesModule, decorators: [{
|
|
19
16
|
type: NgModule,
|
|
20
17
|
args: [{
|
|
21
18
|
imports: [
|
|
22
|
-
IsAfterPipe,
|
|
23
|
-
IsBeforePipe,
|
|
24
19
|
DateFormatPipe,
|
|
25
20
|
DateConvertPipe,
|
|
26
21
|
],
|
|
27
22
|
exports: [
|
|
28
|
-
IsAfterPipe,
|
|
29
|
-
IsBeforePipe,
|
|
30
23
|
DateFormatPipe,
|
|
31
24
|
DateConvertPipe,
|
|
32
|
-
]
|
|
25
|
+
]
|
|
33
26
|
}]
|
|
34
27
|
}] });
|
|
35
28
|
//# sourceMappingURL=datePipes.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datePipes.module.js","sourceRoot":"","sources":["../../../src/modules/datePipes.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;;AAExD;;GAEG;AAcH,MAAM,OAAO,eAAe;8GAAf,eAAe;+GAAf,eAAe,YATpB,cAAc;YACd,eAAe,aAIf,cAAc;YACd,eAAe;+GAGV,eAAe;;2FAAf,eAAe;kBAb3B,QAAQ;mBACT;oBACI,OAAO,EACP;wBACI,cAAc;wBACd,eAAe;qBAClB;oBACD,OAAO,EACP;wBACI,cAAc;wBACd,eAAe;qBAClB;iBACJ","sourcesContent":["import {NgModule} from '@angular/core';\n\nimport {DateConvertPipe} from '../pipes/dateConvert.pipe';\nimport {DateFormatPipe} from '../pipes/dateFormat.pipe';\n\n/**\n * Module used for exporting date pipes\n */\n@NgModule(\n{\n imports:\n [\n DateFormatPipe,\n DateConvertPipe,\n ],\n exports:\n [\n DateFormatPipe,\n DateConvertPipe,\n ]\n})\nexport class DatePipesModule\n{\n}"]}
|
|
@@ -220,8 +220,8 @@ export class DateTimeDirective {
|
|
|
220
220
|
*/
|
|
221
221
|
onMinDateTimeChange() {
|
|
222
222
|
}
|
|
223
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
224
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
223
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
224
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: DateTimeDirective, isStandalone: true, selector: "[dateTime]", inputs: { valueFormat: "valueFormat", format: "format", customFormat: "customFormat", dataFormat: "dataFormat", maxDateTime: "maxDateTime", minDateTime: "minDateTime" }, ngImport: i0 }); }
|
|
225
225
|
}
|
|
226
226
|
__decorate([
|
|
227
227
|
BindThis,
|
|
@@ -235,10 +235,11 @@ __decorate([
|
|
|
235
235
|
__metadata("design:paramtypes", [Object]),
|
|
236
236
|
__metadata("design:returntype", void 0)
|
|
237
237
|
], DateTimeDirective.prototype, "maxDateSet", null);
|
|
238
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeDirective, decorators: [{
|
|
239
239
|
type: Directive,
|
|
240
240
|
args: [{
|
|
241
241
|
selector: '[dateTime]',
|
|
242
|
+
standalone: true,
|
|
242
243
|
}]
|
|
243
244
|
}], propDecorators: { valueFormat: [{
|
|
244
245
|
type: Input
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTime.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTime/dateTime.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAY,MAAM,eAAe,CAAC;AAClE,OAAO,EAAU,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAC,YAAY,EAAE,KAAK,EAAc,OAAO,EAAe,MAAM,MAAM,CAAC;AAG5E,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAElE,OAAO,EAAC,sBAAsB,EAAC,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;;AAE7C;;GAEG;AAKH,MAAM,OAAO,iBAAiB;IAJ9B;QAMI,0EAA0E;QAE1E;;WAEG;QACO,8BAAyB,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAEzE;;WAEG;QACO,8BAAyB,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAEzE;;WAEG;QACO,+BAA0B,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAsB1E;;WAEG;QACO,iBAAY,GAAwB,mBAAmB,CAAC,YAAY,CAAC;QAE/E;;WAEG;QACO,YAAO,GA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;;;;mDAMR;2FAtSQ,iBAAiB;kBAJ7B,SAAS;mBACV;oBACI,QAAQ,EAAE,YAAY;iBACzB;8BAiGc,WAAW;sBADrB,KAAK;gBAqBK,MAAM;sBADhB,KAAK;gBAeK,YAAY;sBADtB,KAAK;gBAeC,UAAU;sBADhB,KAAK;gBAOK,WAAW;sBADrB,KAAK;gBAwDK,WAAW;sBADrB,KAAK;gBAyEI,UAAU,MAYV,UAAU","sourcesContent":["import {Directive, inject, Input, OnDestroy} from '@angular/core';\nimport {Action1, BindThis, isBlank, isString} from '@jscrpt/common';\nimport {debounceTime, merge, Observable, Subject, Subscription} from 'rxjs';\n\nimport {FormatProvider} from '../../../../interfaces';\nimport {DateTimeValueFormat} from '../../../../misc/enums';\nimport {DATE_API, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateTimeInputOutputValue} from '../../../../misc/types';\nimport {getSingleDateTimeValue} from '../../../../misc/utils';\nimport {DateApi, DateValue} from '../../../../services';\nimport {DateTimeBase} from '../dateTimeBase';\n\n/**\n * Directive that holds shared data for date time, like formats, restrictions\n */\n@Directive(\n{\n selector: '[dateTime]',\n})\nexport class DateTimeDirective<TDate = unknown> implements OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subject used for emitting changes in max date time value\n */\n protected maxDateTimeChangesSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subject used for emitting changes in min date time value\n */\n protected minDateTimeChangesSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subject used for emitting changes in custom format value\n */\n protected customFormatChangesSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subscription for max date instance value changes\n */\n protected maxDateInstanceChange: Subscription|undefined|null;\n\n /**\n * Subscription for min date instance value changes\n */\n protected minDateInstanceChange: Subscription|undefined|null;\n\n /**\n * Max allowed value of date time\n */\n protected ɵmaxDateTime: TDate|undefined|null;\n\n /**\n * Min allowed value of date time\n */\n protected ɵminDateTime: TDate|undefined|null;\n\n /**\n * Date time value format which is being worked with in this date time\n */\n protected ɵvalueFormat: DateTimeValueFormat = DateTimeValueFormat.DateInstance;\n\n /**\n * Format of string representation of date\n */\n protected ɵformat: keyof FormatProvider = 'date';\n\n /**\n * Date api instance, used for date time manipulation\n */\n protected dateApi: DateApi<TDate> = inject(DATE_API) as DateApi<TDate>;\n\n /**\n * Provider for available formats\n */\n protected formatProvider: FormatProvider = inject(FORMAT_PROVIDER);\n\n /**\n * Custom format string representation of date\n */\n protected ɵcustomFormat: string = this.dateApi.getFormat(this.formatProvider[this.ɵformat]);\n\n //######################### public properties #########################\n\n /**\n * Occurs when there are changes in max date time value\n */\n public get maxDateTimeChanges(): Observable<void>\n {\n return this.maxDateTimeChangesSubject.asObservable();\n }\n\n /**\n * Occurs when there are changes in min date time value\n */\n public get minDateTimeChanges(): Observable<void>\n {\n return this.minDateTimeChangesSubject.asObservable();\n }\n\n /**\n * Occurs when there are changes in custom format value\n */\n public get customFormatChanges(): Observable<void>\n {\n return this.customFormatChangesSubject.asObservable();\n }\n\n //######################### public properties - inputs #########################\n\n /**\n * Gets or sets date time value format which is being worked with in this date time\n */\n @Input()\n public get valueFormat(): DateTimeValueFormat\n {\n return this.ɵvalueFormat;\n }\n public set valueFormat(value: DateTimeValueFormat)\n {\n if(isString(value))\n {\n this.ɵvalueFormat = DateTimeValueFormat[value] as unknown as DateTimeValueFormat;\n\n return;\n }\n\n this.ɵvalueFormat = value;\n }\n\n /**\n * Gets or sets format of string representation of date\n */\n @Input()\n public get format(): keyof FormatProvider\n {\n return this.ɵformat;\n }\n public set format(value: keyof FormatProvider)\n {\n this.ɵformat = value;\n this.customFormat = this.dateApi.getFormat(this.formatProvider[value]);\n }\n\n /**\n * Gets or sets custom format string representation of date\n */\n @Input()\n public get customFormat(): string\n {\n return this.ɵcustomFormat;\n }\n public set customFormat(value: string)\n {\n this.ɵcustomFormat = value;\n this.customFormatChangesSubject.next();\n }\n\n /**\n * Represents data format that is used as value of date time when `DateTimeValueFormat.DataString` is set to `valueFormat`\n */\n @Input()\n public dataFormat: string|undefined|null;\n\n /**\n * Gets or sets max allowed date for date time\n */\n @Input()\n public get maxDateTime(): TDate|undefined|null\n {\n return this.ɵmaxDateTime;\n }\n public set maxDateTime(value: TDate|undefined|null)\n {\n this.maxDateInstanceChange?.unsubscribe();\n this.maxDateInstanceChange = null;\n\n if(isBlank(value))\n {\n this.maxDateSet(value);\n\n return;\n }\n\n let val: DateTimeInputOutputValue<TDate> = value;\n\n if(value instanceof DateTimeBase)\n {\n this.maxDateInstanceChange = merge(value.valueChange, value.valueSet)\n .pipe(debounceTime(10))\n .subscribe(() =>\n {\n const val = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(val))\n {\n this.maxDateSet(null);\n\n return;\n }\n\n this.setMinMaxValue(val, this.maxDateSet);\n });\n\n const v = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(v))\n {\n this.maxDateSet(null);\n\n return;\n }\n\n val = v;\n }\n\n this.setMinMaxValue(val, this.maxDateSet);\n }\n\n /**\n * Gets or sets min allowed date for date time\n */\n @Input()\n public get minDateTime(): TDate|undefined|null\n {\n return this.ɵminDateTime;\n }\n public set minDateTime(value: TDate|undefined|null)\n {\n this.minDateInstanceChange?.unsubscribe();\n this.minDateInstanceChange = null;\n\n if(isBlank(value))\n {\n this.minDateSet(value);\n\n return;\n }\n\n let val: DateTimeInputOutputValue<TDate> = value;\n\n if(value instanceof DateTimeBase)\n {\n this.minDateInstanceChange = merge(value.valueChange, value.valueSet)\n .pipe(debounceTime(10))\n .subscribe(() =>\n {\n const val = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(val))\n {\n this.minDateSet(null);\n\n return;\n }\n\n this.setMinMaxValue(val, this.minDateSet);\n });\n\n const v = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(v))\n {\n this.minDateSet(null);\n\n return;\n }\n\n val = v;\n }\n\n this.setMinMaxValue(val, this.minDateSet);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.maxDateInstanceChange?.unsubscribe();\n this.maxDateInstanceChange = null;\n\n this.minDateInstanceChange?.unsubscribe();\n this.minDateInstanceChange = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets min date time and notifies about changes\n * @param value - Value to be set\n */\n @BindThis\n protected minDateSet(value: TDate|undefined|null): void\n {\n this.ɵminDateTime = value;\n this.minDateTimeChangesSubject.next();\n this.onMinDateTimeChange();\n }\n\n /**\n * Sets max date time and notifies about changes\n * @param value - Value to be set\n */\n @BindThis\n protected maxDateSet(value: TDate|undefined|null): void\n {\n this.ɵmaxDateTime = value;\n this.maxDateTimeChangesSubject.next();\n this.onMaxDateTimeChange();\n }\n\n /**\n * Sets min or max date time value\n * @param value - Value to be set\n * @param setter - Action used for setting value\n */\n protected setMinMaxValue(value: DateValue|TDate, setter: Action1<TDate|undefined|null>): void\n {\n const val = this.dateApi.getValue(value, this.dataFormat ?? this.customFormat);\n\n if(val.isValid())\n {\n setter(val.value);\n }\n else\n {\n setter(null);\n }\n }\n\n /**\n * Called whenever max date time restriction changes\n */\n protected onMaxDateTimeChange(): void\n {\n }\n\n /**\n * Called whenever min date time restriction changes\n */\n protected onMinDateTimeChange(): void\n {\n }\n\n //######################### ng language server #########################\n\n /**\n * Custom input type for `valueFormat` input\n */\n public static ngAcceptInputType_valueFormat: keyof typeof DateTimeValueFormat|DateTimeValueFormat;\n\n /**\n * Custom input type for `maxDateTime` input\n */\n public static ngAcceptInputType_maxDateTime: DateValue|DateTimeBase;\n\n /**\n * Custom input type for `minDateTime` input\n */\n public static ngAcceptInputType_minDateTime: DateValue|DateTimeBase;\n}"]}
|
|
1
|
+
{"version":3,"file":"dateTime.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTime/dateTime.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAY,MAAM,eAAe,CAAC;AAClE,OAAO,EAAU,QAAQ,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AU,CAAC,KAA2B;QAE5C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,yBAAyB,CAAC,IAAI,EAAE,CAAC;QACtC,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACO,cAAc,CAAC,KAAsB,EAAE,MAAqC;QAElF,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QAE/E,IAAG,GAAG,CAAC,OAAO,EAAE,EAChB,CAAC;YACG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;aAED,CAAC;YACG,MAAM,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;IACL,CAAC;IAED;;OAEG;IACO,mBAAmB;IAE7B,CAAC;IAED;;OAEG;IACO,mBAAmB;IAE7B,CAAC;8GAvUQ,iBAAiB;kGAAjB,iBAAiB;;AAqRhB;IADT,QAAQ;;;;mDAMR;AAOS;IADT,QAAQ;;;;mDAMR;2FAtSQ,iBAAiB;kBAL7B,SAAS;mBACV;oBACI,QAAQ,EAAE,YAAY;oBACtB,UAAU,EAAE,IAAI;iBACnB;8BAiGc,WAAW;sBADrB,KAAK;gBAqBK,MAAM;sBADhB,KAAK;gBAeK,YAAY;sBADtB,KAAK;gBAeC,UAAU;sBADhB,KAAK;gBAOK,WAAW;sBADrB,KAAK;gBAwDK,WAAW;sBADrB,KAAK;gBAyEI,UAAU,MAYV,UAAU","sourcesContent":["import {Directive, inject, Input, OnDestroy} from '@angular/core';\nimport {Action1, BindThis, isBlank, isString} from '@jscrpt/common';\nimport {debounceTime, merge, Observable, Subject, Subscription} from 'rxjs';\n\nimport {FormatProvider} from '../../../../interfaces';\nimport {DateTimeValueFormat} from '../../../../misc/enums';\nimport {DATE_API, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateTimeInputOutputValue} from '../../../../misc/types';\nimport {getSingleDateTimeValue} from '../../../../misc/utils';\nimport {DateApi, DateValue} from '../../../../services';\nimport {DateTimeBase} from '../dateTimeBase';\n\n/**\n * Directive that holds shared data for date time, like formats, restrictions\n */\n@Directive(\n{\n selector: '[dateTime]',\n standalone: true,\n})\nexport class DateTimeDirective<TDate = unknown> implements OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subject used for emitting changes in max date time value\n */\n protected maxDateTimeChangesSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subject used for emitting changes in min date time value\n */\n protected minDateTimeChangesSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subject used for emitting changes in custom format value\n */\n protected customFormatChangesSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subscription for max date instance value changes\n */\n protected maxDateInstanceChange: Subscription|undefined|null;\n\n /**\n * Subscription for min date instance value changes\n */\n protected minDateInstanceChange: Subscription|undefined|null;\n\n /**\n * Max allowed value of date time\n */\n protected ɵmaxDateTime: TDate|undefined|null;\n\n /**\n * Min allowed value of date time\n */\n protected ɵminDateTime: TDate|undefined|null;\n\n /**\n * Date time value format which is being worked with in this date time\n */\n protected ɵvalueFormat: DateTimeValueFormat = DateTimeValueFormat.DateInstance;\n\n /**\n * Format of string representation of date\n */\n protected ɵformat: keyof FormatProvider = 'date';\n\n /**\n * Date api instance, used for date time manipulation\n */\n protected dateApi: DateApi<TDate> = inject(DATE_API) as DateApi<TDate>;\n\n /**\n * Provider for available formats\n */\n protected formatProvider: FormatProvider = inject(FORMAT_PROVIDER);\n\n /**\n * Custom format string representation of date\n */\n protected ɵcustomFormat: string = this.dateApi.getFormat(this.formatProvider[this.ɵformat]);\n\n //######################### public properties #########################\n\n /**\n * Occurs when there are changes in max date time value\n */\n public get maxDateTimeChanges(): Observable<void>\n {\n return this.maxDateTimeChangesSubject.asObservable();\n }\n\n /**\n * Occurs when there are changes in min date time value\n */\n public get minDateTimeChanges(): Observable<void>\n {\n return this.minDateTimeChangesSubject.asObservable();\n }\n\n /**\n * Occurs when there are changes in custom format value\n */\n public get customFormatChanges(): Observable<void>\n {\n return this.customFormatChangesSubject.asObservable();\n }\n\n //######################### public properties - inputs #########################\n\n /**\n * Gets or sets date time value format which is being worked with in this date time\n */\n @Input()\n public get valueFormat(): DateTimeValueFormat\n {\n return this.ɵvalueFormat;\n }\n public set valueFormat(value: DateTimeValueFormat)\n {\n if(isString(value))\n {\n this.ɵvalueFormat = DateTimeValueFormat[value] as unknown as DateTimeValueFormat;\n\n return;\n }\n\n this.ɵvalueFormat = value;\n }\n\n /**\n * Gets or sets format of string representation of date\n */\n @Input()\n public get format(): keyof FormatProvider\n {\n return this.ɵformat;\n }\n public set format(value: keyof FormatProvider)\n {\n this.ɵformat = value;\n this.customFormat = this.dateApi.getFormat(this.formatProvider[value]);\n }\n\n /**\n * Gets or sets custom format string representation of date\n */\n @Input()\n public get customFormat(): string\n {\n return this.ɵcustomFormat;\n }\n public set customFormat(value: string)\n {\n this.ɵcustomFormat = value;\n this.customFormatChangesSubject.next();\n }\n\n /**\n * Represents data format that is used as value of date time when `DateTimeValueFormat.DataString` is set to `valueFormat`\n */\n @Input()\n public dataFormat: string|undefined|null;\n\n /**\n * Gets or sets max allowed date for date time\n */\n @Input()\n public get maxDateTime(): TDate|undefined|null\n {\n return this.ɵmaxDateTime;\n }\n public set maxDateTime(value: TDate|undefined|null)\n {\n this.maxDateInstanceChange?.unsubscribe();\n this.maxDateInstanceChange = null;\n\n if(isBlank(value))\n {\n this.maxDateSet(value);\n\n return;\n }\n\n let val: DateTimeInputOutputValue<TDate> = value;\n\n if(value instanceof DateTimeBase)\n {\n this.maxDateInstanceChange = merge(value.valueChange, value.valueSet)\n .pipe(debounceTime(10))\n .subscribe(() =>\n {\n const val = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(val))\n {\n this.maxDateSet(null);\n\n return;\n }\n\n this.setMinMaxValue(val, this.maxDateSet);\n });\n\n const v = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(v))\n {\n this.maxDateSet(null);\n\n return;\n }\n\n val = v;\n }\n \n this.setMinMaxValue(val, this.maxDateSet);\n }\n\n /**\n * Gets or sets min allowed date for date time\n */\n @Input()\n public get minDateTime(): TDate|undefined|null\n {\n return this.ɵminDateTime;\n }\n public set minDateTime(value: TDate|undefined|null)\n {\n this.minDateInstanceChange?.unsubscribe();\n this.minDateInstanceChange = null;\n\n if(isBlank(value))\n {\n this.minDateSet(value);\n\n return;\n }\n\n let val: DateTimeInputOutputValue<TDate> = value;\n\n if(value instanceof DateTimeBase)\n {\n this.minDateInstanceChange = merge(value.valueChange, value.valueSet)\n .pipe(debounceTime(10))\n .subscribe(() =>\n {\n const val = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(val))\n {\n this.minDateSet(null);\n\n return;\n }\n\n this.setMinMaxValue(val, this.minDateSet);\n });\n\n const v = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(v))\n {\n this.minDateSet(null);\n\n return;\n }\n\n val = v;\n }\n\n this.setMinMaxValue(val, this.minDateSet);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.maxDateInstanceChange?.unsubscribe();\n this.maxDateInstanceChange = null;\n\n this.minDateInstanceChange?.unsubscribe();\n this.minDateInstanceChange = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets min date time and notifies about changes\n * @param value - Value to be set\n */\n @BindThis\n protected minDateSet(value: TDate|undefined|null): void\n {\n this.ɵminDateTime = value;\n this.minDateTimeChangesSubject.next();\n this.onMinDateTimeChange();\n }\n\n /**\n * Sets max date time and notifies about changes\n * @param value - Value to be set\n */\n @BindThis\n protected maxDateSet(value: TDate|undefined|null): void\n {\n this.ɵmaxDateTime = value;\n this.maxDateTimeChangesSubject.next();\n this.onMaxDateTimeChange();\n }\n\n /**\n * Sets min or max date time value\n * @param value - Value to be set\n * @param setter - Action used for setting value\n */\n protected setMinMaxValue(value: DateValue|TDate, setter: Action1<TDate|undefined|null>): void\n {\n const val = this.dateApi.getValue(value, this.dataFormat ?? this.customFormat);\n\n if(val.isValid())\n {\n setter(val.value);\n }\n else\n {\n setter(null);\n }\n }\n\n /**\n * Called whenever max date time restriction changes\n */\n protected onMaxDateTimeChange(): void\n {\n }\n\n /**\n * Called whenever min date time restriction changes\n */\n protected onMinDateTimeChange(): void\n {\n }\n\n //######################### ng language server #########################\n \n /**\n * Custom input type for `valueFormat` input\n */\n public static ngAcceptInputType_valueFormat: keyof typeof DateTimeValueFormat|DateTimeValueFormat;\n\n /**\n * Custom input type for `maxDateTime` input\n */\n public static ngAcceptInputType_maxDateTime: DateValue|DateTimeBase;\n\n /**\n * Custom input type for `minDateTime` input\n */\n public static ngAcceptInputType_minDateTime: DateValue|DateTimeBase;\n}"]}
|
|
@@ -56,10 +56,10 @@ export class DateTimeBase {
|
|
|
56
56
|
*/
|
|
57
57
|
onMinDateTimeChange() {
|
|
58
58
|
}
|
|
59
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
60
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
59
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
60
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: DateTimeBase, ngImport: i0 }); }
|
|
61
61
|
}
|
|
62
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeBase, decorators: [{
|
|
63
63
|
type: Directive
|
|
64
64
|
}], ctorParameters: () => [] });
|
|
65
65
|
//# sourceMappingURL=dateTimeBase.js.map
|
|
@@ -69,8 +69,8 @@ export class DateTimeControlValueAccessorDirective {
|
|
|
69
69
|
setDisabledState(isDisabled) {
|
|
70
70
|
this.input.disabled = isDisabled;
|
|
71
71
|
}
|
|
72
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
73
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
72
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeControlValueAccessorDirective, deps: [{ token: DATE_TIME_INPUT }, { token: i1.DateTimeDirective }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
73
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: DateTimeControlValueAccessorDirective, isStandalone: true, selector: "[dateTime][formControlName],[dateTime][formControl],[dateTime][ngModel]", providers: [
|
|
74
74
|
{
|
|
75
75
|
provide: NG_VALUE_ACCESSOR,
|
|
76
76
|
useExisting: forwardRef(() => DateTimeControlValueAccessorDirective),
|
|
@@ -78,7 +78,7 @@ export class DateTimeControlValueAccessorDirective {
|
|
|
78
78
|
},
|
|
79
79
|
], ngImport: i0 }); }
|
|
80
80
|
}
|
|
81
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
81
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeControlValueAccessorDirective, decorators: [{
|
|
82
82
|
type: Directive,
|
|
83
83
|
args: [{
|
|
84
84
|
selector: '[dateTime][formControlName],[dateTime][formControl],[dateTime][ngModel]',
|
|
@@ -89,6 +89,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImpor
|
|
|
89
89
|
multi: true,
|
|
90
90
|
},
|
|
91
91
|
],
|
|
92
|
+
standalone: true,
|
|
92
93
|
}]
|
|
93
94
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
94
95
|
type: Inject,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeControlValueAccessor.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAoB,UAAU,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AACzF,OAAO,EAAuB,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAGlC,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;;;AAE3D;;GAEG;
|
|
1
|
+
{"version":3,"file":"dateTimeControlValueAccessor.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAoB,UAAU,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AACzF,OAAO,EAAuB,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAGlC,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;;;AAE3D;;GAEG;AAeH,MAAM,OAAO,qCAAqC;IAS9C,iEAAiE;IACjE,YAA+C,KAA2B,EACpD,QAAkC;QADT,UAAK,G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KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACI,gBAAgB,CAAC,UAAmB;QAEvC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;IACrC,CAAC;8GAjFQ,qCAAqC,kBAU1B,eAAe;kGAV1B,qCAAqC,sHAV9C;YAEI;gBACI,OAAO,EAAE,iBAAiB;gBAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,qCAAqC,CAAC;gBACpE,KAAK,EAAE,IAAI;aACd;SACJ;;2FAGQ,qCAAqC;kBAdjD,SAAS;mBACV;oBACI,QAAQ,EAAE,yEAAyE;oBACnF,SAAS,EACT;wBAEI;4BACI,OAAO,EAAE,iBAAiB;4BAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,sCAAsC,CAAC;4BACpE,KAAK,EAAE,IAAI;yBACd;qBACJ;oBACD,UAAU,EAAE,IAAI;iBACnB;;0BAWgB,MAAM;2BAAC,eAAe","sourcesContent":["import {Directive, ExistingProvider, forwardRef, Inject, OnDestroy} from '@angular/core';\nimport {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {isNumber} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DateTimeInput} from '../../../../interfaces';\nimport {DATE_TIME_INPUT} from '../../../../misc/tokens';\nimport {DateTimeInputOutputValue} from '../../../../misc/types';\nimport {DateTimeDirective} from '../dateTime/dateTime.directive';\nimport {DateTimeValueFormat} from '../../../../misc/enums';\n\n/**\n * Control value accessor that is used for getting and setting value for date time\n */\n@Directive(\n{\n selector: '[dateTime][formControlName],[dateTime][formControl],[dateTime][ngModel]',\n providers:\n [\n <ExistingProvider>\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => DateTimeControlValueAccessorDirective),\n multi: true,\n },\n ],\n standalone: true,\n})\nexport class DateTimeControlValueAccessorDirective<TDate = unknown> implements ControlValueAccessor, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n //######################### constructor #########################\n constructor(@Inject(DATE_TIME_INPUT) protected input: DateTimeInput<TDate>,\n protected dateTime: DateTimeDirective<TDate>,)\n {\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.initSubscriptions.unsubscribe();\n }\n\n //######################### public methods - implementation of ControlValueAccessor #########################\n\n /**\n * @inheritdoc\n */\n public writeValue(value: DateTimeInputOutputValue<TDate>|undefined|null): void\n {\n if(this.dateTime.valueFormat == DateTimeValueFormat.UnixTimestamp)\n {\n if(!isNumber(value))\n {\n throw new Error('DateTimeControlValueAccessorDirective: value is not a number!');\n }\n else\n {\n value = value * 1000;\n }\n }\n\n this.input.value = value;\n }\n\n /**\n * @inheritdoc\n */\n public registerOnChange(fn: (data: DateTimeInputOutputValue<TDate>|undefined|null) => void): void\n {\n this.initSubscriptions.add(this.input.valueChange.subscribe(() =>\n {\n const value = this.input.value;\n\n if(this.dateTime.valueFormat == DateTimeValueFormat.UnixTimestamp && isNumber(value))\n {\n fn(value / 1000);\n }\n else\n {\n fn(this.input.value);\n }\n }));\n }\n\n /**\n * @inheritdoc\n */\n public registerOnTouched(fn: () => void): void\n {\n this.initSubscriptions.add(this.input.focus.subscribe(() => fn()));\n }\n\n /**\n * @inheritdoc\n */\n public setDisabledState(isDisabled: boolean): void\n {\n this.input.disabled = isDisabled;\n }\n}"]}
|
|
@@ -124,8 +124,8 @@ export class DateTimeInputDirective extends DateTimeBase {
|
|
|
124
124
|
handleBlur(event) {
|
|
125
125
|
this.blur.emit(event);
|
|
126
126
|
}
|
|
127
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
128
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
127
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeInputDirective, deps: [{ token: i0.ElementRef }, { token: DATE_API }, { token: i1.DateValueProvider }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
128
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: DateTimeInputDirective, isStandalone: true, selector: "input[dateTime][dateTimeInput]", providers: [
|
|
129
129
|
{
|
|
130
130
|
provide: DATE_TIME_INPUT,
|
|
131
131
|
useExisting: forwardRef(() => DateTimeInputDirective),
|
|
@@ -150,7 +150,7 @@ __decorate([
|
|
|
150
150
|
__metadata("design:paramtypes", [FocusEvent]),
|
|
151
151
|
__metadata("design:returntype", void 0)
|
|
152
152
|
], DateTimeInputDirective.prototype, "handleBlur", null);
|
|
153
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
153
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeInputDirective, decorators: [{
|
|
154
154
|
type: Directive,
|
|
155
155
|
args: [{
|
|
156
156
|
selector: 'input[dateTime][dateTimeInput]',
|
|
@@ -160,6 +160,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImpor
|
|
|
160
160
|
useExisting: forwardRef(() => DateTimeInputDirective),
|
|
161
161
|
},
|
|
162
162
|
],
|
|
163
|
+
standalone: true,
|
|
163
164
|
exportAs: 'dateTime',
|
|
164
165
|
}]
|
|
165
166
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeInput.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,E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IAED;;;OAGG;IAEO,UAAU,CAAC,KAAiB;QAElC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;8GAhKQ,sBAAsB,4CAiFX,QAAQ;kGAjFnB,sBAAsB,6EAT/B;YAEI;gBACI,OAAO,EAAE,eAAe;gBACxB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC;aACxD;SACJ;;AA6HS;IADT,QAAQ;;;;yDAmBR;AAOS;IADT,QAAQ;;qCACoB,UAAU;;yDAGtC;AAOS;IADT,QAAQ;;qCACmB,UAAU;;wDAGrC;2FAhKQ,sBAAsB;kBAblC,SAAS;mBACV;oBACI,QAAQ,EAAE,gCAAgC;oBAC1C,SAAS,EACT;wBAEI;4BACI,OAAO,EAAE,eAAe;4BACxB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,uBAAuB,CAAC;yBACxD;qBACJ;oBACD,QAAQ,EAAE,UAAU;iBACvB;;0BAkFgB,MAAM;2BAAC,QAAQ;yEAyClB,WAAW,MAyBX,WAAW,MAUX,UAAU","sourcesContent":["import {Directive, ElementRef, EventEmitter, ExistingProvider, forwardRef, Inject, OnDestroy} from '@angular/core';\nimport {BindThis} from '@jscrpt/common';\n\nimport {DateTimeInput} from '../../../../interfaces';\nimport {DATE_API, DATE_TIME_INPUT} from '../../../../misc/tokens';\nimport {DateTimeInputOutputValue, DateTimeObjectValue} from '../../../../misc/types';\nimport {formatDateTime, getInternalValue} from '../../../../misc/utils';\nimport {DateApi, DateValueProvider} from '../../../../services';\nimport {DateTimeBase} from '../dateTimeBase';\nimport {DateTimeValueFormat} from '../../../../misc/enums';\n\n//TODO: range is unimplemented\n\n/**\n * Directive that is used for setting up date time input\n */\n@Directive(\n{\n selector: 'input[dateTime][dateTimeInput]',\n providers:\n [\n <ExistingProvider>\n {\n provide: DATE_TIME_INPUT,\n useExisting: forwardRef(() => DateTimeInputDirective),\n },\n ],\n exportAs: 'dateTime',\n})\nexport class DateTimeInputDirective<TDate = unknown> extends DateTimeBase<TDate> implements DateTimeInput, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Internal representation of current date time value\n */\n protected internalValue: DateTimeObjectValue<TDate>|undefined|null;\n\n //######################### public properties - implementation of DateTimeInput #########################\n\n /**\n * @inheritdoc\n */\n public get rawValue(): string|undefined|null\n {\n return this.elementRef.nativeElement.value;\n }\n public set rawValue(value: string|undefined|null)\n {\n this.elementRef.nativeElement.value = value ?? '';\n }\n\n /**\n * @inheritdoc\n */\n public override get value(): DateTimeInputOutputValue<TDate>|undefined|null\n {\n return this.ɵValue;\n }\n public override set value(value: DateTimeInputOutputValue<TDate>|undefined|null)\n {\n //accepts all available formats\n this.setInternalValue(value);\n this.ɵValue = formatDateTime(this.internalValue, this.dateTimeData.valueFormat, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n\n //not range value\n if(!Array.isArray(this.internalValue))\n {\n this.rawValue = this.internalValue?.format(this.dateTimeData.customFormat);\n }\n else\n {\n //TODO: add support for ranges\n }\n\n this.valueSet.next();\n }\n\n /**\n * @inheritdoc\n */\n public get disabled(): boolean\n {\n return this.elementRef.nativeElement.disabled;\n }\n public set disabled(value: boolean)\n {\n this.elementRef.nativeElement.disabled = value;\n }\n\n /**\n * Html element that represents input itself\n */\n public get element(): HTMLElement\n {\n return this.elementRef.nativeElement;\n }\n\n /**\n * @inheritdoc\n */\n public focus: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n\n /**\n * @inheritdoc\n */\n public blur: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n\n //######################### constructors #########################\n constructor(protected elementRef: ElementRef<HTMLInputElement>,\n @Inject(DATE_API) protected dateApi: DateApi<TDate>,\n protected valueProvider: DateValueProvider<TDate>,)\n {\n super();\n\n this.elementRef.nativeElement.addEventListener('input', this.handleInput);\n this.elementRef.nativeElement.addEventListener('focus', this.handleFocus);\n this.elementRef.nativeElement.addEventListener('blur', this.handleBlur);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public override ngOnDestroy(): void\n {\n super.ngOnDestroy();\n\n this.elementRef.nativeElement.removeEventListener('input', this.handleInput);\n this.elementRef.nativeElement.removeEventListener('focus', this.handleFocus);\n this.elementRef.nativeElement.removeEventListener('blur', this.handleBlur);\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets internal value and fix lowest time difference\n * @param value - Value to be set\n * @param dateTimeFormat - Date time format type, optional, if not specified autodetection of format will be used, used when obtaining value from users input\n */\n protected setInternalValue(value: DateTimeInputOutputValue<TDate>|undefined|null,\n dateTimeFormat: DateTimeValueFormat|undefined|null = null,): void\n {\n this.internalValue = getInternalValue(value, this.dateApi, this.dateTimeData, this.valueProvider, dateTimeFormat);\n }\n\n /**\n * Handles input event on input\n */\n @BindThis\n protected handleInput(): void\n {\n if(!this.rawValue)\n {\n this.internalValue = null;\n this.ɵValue = null;\n\n this.valueSet.next();\n this.valueChange.next();\n\n return;\n }\n\n this.setInternalValue(this.rawValue, DateTimeValueFormat.FormattedString);\n this.ɵValue = formatDateTime(this.internalValue, this.dateTimeData.valueFormat, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n\n this.valueSet.next();\n this.valueChange.next();\n }\n\n /**\n * Handles focus event on input\n * @param event - Event that occured\n */\n @BindThis\n protected handleFocus(event: FocusEvent): void\n {\n this.focus.emit(event);\n }\n\n /**\n * Handles blur event on input\n * @param event - Event that occured\n */\n @BindThis\n protected handleBlur(event: FocusEvent): void\n {\n this.blur.emit(event);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dateTimeInput.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAoB,UAAU,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AACnH,OAAO,EAAC,QAAQ,EAAC,MAA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AC;IAC1B,CAAC;8GAhKQ,sBAAsB,4CAiFX,QAAQ;kGAjFnB,sBAAsB,6EAV/B;YAEI;gBACI,OAAO,EAAE,eAAe;gBACxB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC;aACxD;SACJ;;AA8HS;IADT,QAAQ;;;;yDAmBR;AAOS;IADT,QAAQ;;qCACoB,UAAU;;yDAGtC;AAOS;IADT,QAAQ;;qCACmB,UAAU;;wDAGrC;2FAhKQ,sBAAsB;kBAdlC,SAAS;mBACV;oBACI,QAAQ,EAAE,gCAAgC;oBAC1C,SAAS,EACT;wBAEI;4BACI,OAAO,EAAE,eAAe;4BACxB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,uBAAuB,CAAC;yBACxD;qBACJ;oBACD,UAAU,EAAE,IAAI;oBAChB,QAAQ,EAAE,UAAU;iBACvB;;0BAkFgB,MAAM;2BAAC,QAAQ;yEAyClB,WAAW,MAyBX,WAAW,MAUX,UAAU","sourcesContent":["import {Directive, ElementRef, EventEmitter, ExistingProvider, forwardRef, Inject, OnDestroy} from '@angular/core';\nimport {BindThis} from '@jscrpt/common';\n\nimport {DateTimeInput} from '../../../../interfaces';\nimport {DATE_API, DATE_TIME_INPUT} from '../../../../misc/tokens';\nimport {DateTimeInputOutputValue, DateTimeObjectValue} from '../../../../misc/types';\nimport {formatDateTime, getInternalValue} from '../../../../misc/utils';\nimport {DateApi, DateValueProvider} from '../../../../services';\nimport {DateTimeBase} from '../dateTimeBase';\nimport {DateTimeValueFormat} from '../../../../misc/enums';\n\n//TODO: range is unimplemented\n\n/**\n * Directive that is used for setting up date time input\n */\n@Directive(\n{\n selector: 'input[dateTime][dateTimeInput]',\n providers:\n [\n <ExistingProvider>\n {\n provide: DATE_TIME_INPUT,\n useExisting: forwardRef(() => DateTimeInputDirective),\n },\n ],\n standalone: true,\n exportAs: 'dateTime',\n})\nexport class DateTimeInputDirective<TDate = unknown> extends DateTimeBase<TDate> implements DateTimeInput, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Internal representation of current date time value\n */\n protected internalValue: DateTimeObjectValue<TDate>|undefined|null;\n\n //######################### public properties - implementation of DateTimeInput #########################\n\n /**\n * @inheritdoc\n */\n public get rawValue(): string|undefined|null\n {\n return this.elementRef.nativeElement.value;\n }\n public set rawValue(value: string|undefined|null)\n {\n this.elementRef.nativeElement.value = value ?? '';\n }\n\n /**\n * @inheritdoc\n */\n public override get value(): DateTimeInputOutputValue<TDate>|undefined|null\n {\n return this.ɵValue;\n }\n public override set value(value: DateTimeInputOutputValue<TDate>|undefined|null)\n {\n //accepts all available formats\n this.setInternalValue(value);\n this.ɵValue = formatDateTime(this.internalValue, this.dateTimeData.valueFormat, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n \n //not range value\n if(!Array.isArray(this.internalValue))\n {\n this.rawValue = this.internalValue?.format(this.dateTimeData.customFormat);\n }\n else\n {\n //TODO: add support for ranges\n }\n\n this.valueSet.next();\n }\n\n /**\n * @inheritdoc\n */\n public get disabled(): boolean\n {\n return this.elementRef.nativeElement.disabled;\n }\n public set disabled(value: boolean)\n {\n this.elementRef.nativeElement.disabled = value;\n }\n\n /**\n * Html element that represents input itself\n */\n public get element(): HTMLElement\n {\n return this.elementRef.nativeElement;\n }\n\n /**\n * @inheritdoc\n */\n public focus: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n\n /**\n * @inheritdoc\n */\n public blur: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n\n //######################### constructors #########################\n constructor(protected elementRef: ElementRef<HTMLInputElement>,\n @Inject(DATE_API) protected dateApi: DateApi<TDate>,\n protected valueProvider: DateValueProvider<TDate>,)\n {\n super();\n\n this.elementRef.nativeElement.addEventListener('input', this.handleInput);\n this.elementRef.nativeElement.addEventListener('focus', this.handleFocus);\n this.elementRef.nativeElement.addEventListener('blur', this.handleBlur);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public override ngOnDestroy(): void\n {\n super.ngOnDestroy();\n\n this.elementRef.nativeElement.removeEventListener('input', this.handleInput);\n this.elementRef.nativeElement.removeEventListener('focus', this.handleFocus);\n this.elementRef.nativeElement.removeEventListener('blur', this.handleBlur);\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets internal value and fix lowest time difference\n * @param value - Value to be set\n * @param dateTimeFormat - Date time format type, optional, if not specified autodetection of format will be used, used when obtaining value from users input\n */\n protected setInternalValue(value: DateTimeInputOutputValue<TDate>|undefined|null,\n dateTimeFormat: DateTimeValueFormat|undefined|null = null,): void\n {\n this.internalValue = getInternalValue(value, this.dateApi, this.dateTimeData, this.valueProvider, dateTimeFormat);\n }\n\n /**\n * Handles input event on input\n */\n @BindThis\n protected handleInput(): void\n {\n if(!this.rawValue)\n {\n this.internalValue = null;\n this.ɵValue = null;\n\n this.valueSet.next();\n this.valueChange.next();\n\n return;\n }\n\n this.setInternalValue(this.rawValue, DateTimeValueFormat.FormattedString);\n this.ɵValue = formatDateTime(this.internalValue, this.dateTimeData.valueFormat, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n\n this.valueSet.next();\n this.valueChange.next();\n }\n\n /**\n * Handles focus event on input\n * @param event - Event that occured\n */\n @BindThis\n protected handleFocus(event: FocusEvent): void\n {\n this.focus.emit(event);\n }\n\n /**\n * Handles blur event on input\n * @param event - Event that occured\n */\n @BindThis\n protected handleBlur(event: FocusEvent): void\n {\n this.blur.emit(event);\n }\n}"]}
|
|
@@ -41,16 +41,16 @@ export class DateTimeMaxValidatorDirective extends DateTimeBase {
|
|
|
41
41
|
onMaxDateTimeChange() {
|
|
42
42
|
this._validator = datetimeMaxValidator(this.dateApi, this.dateTimeData.maxDateTime, this.dateTimeData.valueFormat, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);
|
|
43
43
|
}
|
|
44
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
45
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
44
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeMaxValidatorDirective, deps: [{ token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
45
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: DateTimeMaxValidatorDirective, isStandalone: true, selector: "[dateTime][maxDateTime][validate]", providers: [
|
|
46
46
|
{
|
|
47
47
|
provide: NG_VALIDATORS,
|
|
48
48
|
useExisting: forwardRef(() => DateTimeMaxValidatorDirective),
|
|
49
|
-
multi: true
|
|
49
|
+
multi: true
|
|
50
50
|
},
|
|
51
51
|
], usesInheritance: true, ngImport: i0 }); }
|
|
52
52
|
}
|
|
53
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeMaxValidatorDirective, decorators: [{
|
|
54
54
|
type: Directive,
|
|
55
55
|
args: [{
|
|
56
56
|
selector: '[dateTime][maxDateTime][validate]',
|
|
@@ -58,9 +58,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImpor
|
|
|
58
58
|
{
|
|
59
59
|
provide: NG_VALIDATORS,
|
|
60
60
|
useExisting: forwardRef(() => DateTimeMaxValidatorDirective),
|
|
61
|
-
multi: true
|
|
61
|
+
multi: true
|
|
62
62
|
},
|
|
63
63
|
],
|
|
64
|
+
standalone: true,
|
|
64
65
|
}]
|
|
65
66
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
66
67
|
type: Inject,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeMaxValidator.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAoB,UAAU,EAAE,MAAM,EAAS,MAAM,eAAe,CAAC;AACtF,OAAO,EAAkB,aAAa,EAA2C,MAAM,gBAAgB,CAAC;AAExG,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;;AAE7C;;GAEG;
|
|
1
|
+
{"version":3,"file":"dateTimeMaxValidator.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAoB,UAAU,EAAE,MAAM,EAAS,MAAM,eAAe,CAAC;AACtF,OAAO,EAAkB,aAAa,EAA2C,MAAM,gBAAgB,CAAC;AAExG,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;;AAE7C;;GAEG;AAeH,MAAM,OAAO,6BAA+C,SAAQ,YAAmB;IASnF,iEAAiE;IACjE,YAAwC,OAAuB;QAE3D,KAAK,EAAE,CAAC;QAF4B,YAAO,GAAP,OAAO,CAAgB;QAR/D,oEAAoE;QAEpE;;WAEG;QACK,eAAU,GAAgB,GAAG,EAAE,CAAC,IAAI,CAAC;IAM7C,CAAC;IAED,+FAA+F;IAE/F;;OAEG;IACI,QAAQ;QAEX,IAAI,CAAC,UAAU,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACrL,CAAC;IAED,kGAAkG;IAElG;;;;OAIG;IACI,QAAQ,CAAC,OAAwB;QAEpC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAED,mFAAmF;IAEnF;;OAEG;IACgB,mBAAmB;QAElC,IAAI,CAAC,UAAU,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACrL,CAAC;8GA7CQ,6BAA6B,kBAUlB,QAAQ;kGAVnB,6BAA6B,gFAVtC;YAEI;gBACI,OAAO,EAAE,aAAa;gBACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,6BAA6B,CAAC;gBAC5D,KAAK,EAAE,IAAI;aACd;SACJ;;2FAGQ,6BAA6B;kBAdzC,SAAS;mBACV;oBACI,QAAQ,EAAE,mCAAmC;oBAC7C,SAAS,EACT;wBAEI;4BACI,OAAO,EAAE,aAAa;4BACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,8BAA8B,CAAC;4BAC5D,KAAK,EAAE,IAAI;yBACd;qBACJ;oBACD,UAAU,EAAE,IAAI;iBACnB;;0BAWgB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Directive, ExistingProvider, forwardRef, Inject, OnInit} from '@angular/core';\nimport {AbstractControl, NG_VALIDATORS, ValidationErrors, Validator, ValidatorFn} from '@angular/forms';\n\nimport {DATE_API} from '../../../../misc/tokens';\nimport {datetimeMaxValidator} from '../../../../misc/validators';\nimport {DateApi} from '../../../../services';\nimport {DateTimeBase} from '../dateTimeBase';\n\n/**\n * Applies validator for date time max value\n */\n@Directive(\n{\n selector: '[dateTime][maxDateTime][validate]',\n providers:\n [\n <ExistingProvider>\n {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => DateTimeMaxValidatorDirective),\n multi: true\n },\n ],\n standalone: true,\n})\nexport class DateTimeMaxValidatorDirective<TDate = unknown> extends DateTimeBase<TDate> implements Validator, OnInit\n{\n //######################### private fields #########################\n\n /**\n * Function used for validations\n */\n private _validator: ValidatorFn = () => null;\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected dateApi: DateApi<TDate>,)\n {\n super();\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this._validator = datetimeMaxValidator(this.dateApi, this.dateTimeData.maxDateTime, this.dateTimeData.valueFormat, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n }\n\n //######################### public methods - implementation of Validator #########################\n\n /**\n * Validates input and returns validation result\n * @param control - Control that is being validated\n * @returns validation results\n */\n public validate(control: AbstractControl): ValidationErrors|null\n {\n return this._validator(control);\n }\n\n //######################### protected methods - overrides #########################\n\n /**\n * @inheritdoc\n */\n protected override onMaxDateTimeChange(): void\n {\n this._validator = datetimeMaxValidator(this.dateApi, this.dateTimeData.maxDateTime, this.dateTimeData.valueFormat, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n }\n}"]}
|