@anglr/datetime 5.0.0-beta.20221020045240 → 5.0.0-beta.20221020124055
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 +15 -2
- package/es2015/src/legacy/picker/components/dayPicker/dayPicker.component.js +2 -1
- package/es2015/src/legacy/picker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2015/src/legacy/picker/components/monthPicker/monthPicker.component.js +2 -1
- package/es2015/src/legacy/picker/components/monthPicker/monthPicker.component.js.map +1 -1
- package/es2015/src/legacy/picker/components/yearPicker/yearPicker.component.js +2 -1
- package/es2015/src/legacy/picker/components/yearPicker/yearPicker.component.js.map +1 -1
- package/es2015/src/legacy/picker/misc/datetimePicker.interface.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js +110 -0
- package/es2015/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +141 -28
- package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +103 -29
- package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/components/index.js +1 -0
- package/es2015/src/modules/dateTimePicker/components/index.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js +120 -0
- package/es2015/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +1 -0
- package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +69 -15
- package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js.map +1 -1
- package/es2020/src/legacy/picker/components/dayPicker/dayPicker.component.js +2 -1
- package/es2020/src/legacy/picker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2020/src/legacy/picker/components/monthPicker/monthPicker.component.js +2 -1
- package/es2020/src/legacy/picker/components/monthPicker/monthPicker.component.js.map +1 -1
- package/es2020/src/legacy/picker/components/yearPicker/yearPicker.component.js +2 -1
- package/es2020/src/legacy/picker/components/yearPicker/yearPicker.component.js.map +1 -1
- package/es2020/src/legacy/picker/misc/datetimePicker.interface.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js +105 -0
- package/es2020/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +138 -27
- package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +101 -28
- package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/components/index.js +1 -0
- package/es2020/src/modules/dateTimePicker/components/index.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js +116 -0
- package/es2020/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +1 -0
- package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +65 -11
- package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js.map +1 -1
- package/package.json +1 -1
- package/src/legacy/picker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
- package/src/legacy/picker/components/monthPicker/monthPicker.component.d.ts.map +1 -1
- package/src/legacy/picker/components/yearPicker/yearPicker.component.d.ts.map +1 -1
- package/src/legacy/picker/misc/datetimePicker.interface.d.ts +4 -0
- package/src/legacy/picker/misc/datetimePicker.interface.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.d.ts +55 -8
- package/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts +38 -6
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts +26 -12
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.html +5 -5
- package/src/modules/dateTimePicker/components/index.d.ts +1 -0
- package/src/modules/dateTimePicker/components/index.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.d.ts +43 -0
- package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.d.ts.map +1 -0
- package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.html +13 -0
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts +21 -6
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.d.ts +8 -0
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.d.ts.map +1 -1
- package/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.d.ts +2 -5
- package/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.d.ts.map +1 -1
- package/styles/components/_date-time-picker.scss +137 -0
- package/version.bak +1 -1
- package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.js +0 -2
- package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.js +0 -2
- package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.js.map +0 -1
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.css +0 -27
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.d.ts +0 -11
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.interfaces.d.ts.map +0 -1
package/changelog.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## Version 5.0.0 (2022-10-
|
|
3
|
+
## Version 5.0.0 (2022-10-20)
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
6
|
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
- `DateTimePickerComponent`
|
|
92
92
|
- `DateTimePickerDirective`
|
|
93
93
|
- new `DateTimePickerDirective` directive, that is directive that is used for displaying and attaching date time picker
|
|
94
|
+
- **extends** `DateTimeBase`
|
|
94
95
|
- **implements**
|
|
95
96
|
- `OnInit`
|
|
96
97
|
- `OnDestroy`
|
|
@@ -105,15 +106,17 @@
|
|
|
105
106
|
- `DateTimeInputValue`
|
|
106
107
|
- `OnChanges`
|
|
107
108
|
- `OnDestroy`
|
|
109
|
+
- `OnInit`
|
|
108
110
|
- **inputs**
|
|
109
111
|
- `value` docs from `DateTimeInputValue`
|
|
110
112
|
- `options` options for date time picker
|
|
111
113
|
- **outputs**
|
|
112
114
|
- `valueChange` docs from `DateTimeInputValue`
|
|
113
115
|
- new `DateTimePicker` interface, which describes date time picker API for each date time period
|
|
116
|
+
- **extends**
|
|
117
|
+
- `Invalidatable`
|
|
114
118
|
- **properties**
|
|
115
119
|
- `value` value of date time picker
|
|
116
|
-
- `options` options for date time picker period
|
|
117
120
|
- `display` date that describes which date should be displayed
|
|
118
121
|
- `maxDate` max allowed date
|
|
119
122
|
- `minDate` min allowed date to be selected
|
|
@@ -125,11 +128,13 @@
|
|
|
125
128
|
- new `DateTimePickerDirectiveOptions` directive, which is defintion of date time picker directive options
|
|
126
129
|
- **properties**
|
|
127
130
|
- `closeOnValueSelect` indication whether close picker on value selection
|
|
131
|
+
- `closeOnBlur` indication whether close picker when date time input loses focus
|
|
128
132
|
- `showOnFocus` indication whether display picker when date time input gets focus
|
|
129
133
|
- `alwaysVisible` indication whether is picker always visible, mostly used for debugging
|
|
130
134
|
- `disabled` indication whether picker is disabled, if true, you cant display picker
|
|
131
135
|
- `absolute` indication whether use absolute global positioning of picker
|
|
132
136
|
- `positionOptions` position options that are used to position picker
|
|
137
|
+
- `pickerCssClass` custom css class that is being added to picker component
|
|
133
138
|
- new `DATE_TIME_PICKER_DIRECTIVE_OPTIONS` injection token for global options for date time picker directive
|
|
134
139
|
- new `DATE_TIME_PICKER_OPTIONS` injection token for global options for date time picker component
|
|
135
140
|
- new `DateTimePeriodPickerBase` class, which is base abstract class for each date time period picker
|
|
@@ -151,6 +156,14 @@
|
|
|
151
156
|
- `customFormat` custom format string representation of date
|
|
152
157
|
- `maxDateTime` gets or sets max allowed date for date time
|
|
153
158
|
- `minDateTime` gets or sets min allowed date for date time
|
|
159
|
+
- new `DayPickerSAComponent` component, which is used for displaying day picker
|
|
160
|
+
- **extends** `DateTimePeriodPickerBase`
|
|
161
|
+
- **implements**
|
|
162
|
+
- `DateTimePicker`
|
|
163
|
+
- new `MonthPickerSAComponent` component, which is used for displaying month picker
|
|
164
|
+
- **extends** `DateTimePeriodPickerBase`
|
|
165
|
+
- **implements**
|
|
166
|
+
- `DateTimePicker`
|
|
154
167
|
- updated `DateApiObject` interface
|
|
155
168
|
- new `unixTimestamp` method, that gets value of date time as unix timestamp
|
|
156
169
|
- updated `DateFormatPipe`
|
|
@@ -148,7 +148,8 @@ export class DateTimeDayPickerComponent extends PickerBaseComponent {
|
|
|
148
148
|
otherMonth: otherMonth,
|
|
149
149
|
today: this.displayDate.isSameDay(today),
|
|
150
150
|
weekend: this.displayDate.isWeekend(),
|
|
151
|
-
day: day
|
|
151
|
+
day: day,
|
|
152
|
+
dateObj: this.displayDate.clone(),
|
|
152
153
|
};
|
|
153
154
|
this.periodData.push(data);
|
|
154
155
|
if (!otherMonth) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dayPicker.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/picker/components/dayPicker/dayPicker.component.ts","../../../../../../src/legacy/picker/components/dayPicker/dayPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAGtC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;;;;;AAG5D;;GAEG;AACH,MAAM,aAAa,GACnB;IACI,eAAe,EAAE,QAAQ;IACzB,cAAc,EAAE,6BAA6B;IAC7C,UAAU,EAAE,8BAA8B;IAC1C,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,aAAa;IACzB,WAAW,EAAE,wBAAwB;IACrC,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,WAAW;CACzB,CAAC;AAEF;;GAEG;AAQH,MAAM,OAAO,0BAAwC,SAAQ,mBAA+D;IAyBxH,iEAAiE;IACjE,YAA8B,OAAuB,EACzC,cAAiC;QAEzC,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QA3BnC,sEAAsE;QAEtE;;WAEG;QACO,mBAAc,GAAqB,EAAE,CAAC;QAEhD,2FAA2F;QAE3F;;;WAGG;QACI,aAAQ,GAAa,EAAE,CAAC;QAgB3B,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;IAClD,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AAC;IAED,uEAAuE;IAEvE;;;OAGG;IACO,YAAY,CAAC,MAAyB;QAE5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC;IAChE,CAAC;IAED;;;OAGG;IACO,wBAAwB,CAAC,GAAyB;QAExD,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,WAAY,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACO,aAAa,CAAC,GAAyB,EAAE,MAAa;QAE5D,OAAO,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,GAAyB;QAE9C,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;;uHAjPQ,0BAA0B,kBA0Bf,QAAQ;2GA1BnB,0BAA0B,mFCnCvC,2wCAoBM;2FDeO,0BAA0B;kBAPtC,SAAS;+BAEI,sBAAsB,mBAGf,uBAAuB,CAAC,MAAM;;0BA4BlC,MAAM;2BAAC,QAAQ","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef} from '@angular/core';\nimport {extend} from '@jscrpt/common';\n\nimport {DateTimeValue} from '../../../../interfaces/dateTime/datetime.interface';\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject} from '../../../../services/dateApi/dateApi.interface';\nimport {DateTimeLegacyPicker, DayData, PeriodData} from '../../misc/datetimePicker.interface';\nimport {PickerBaseComponent} from '../pickerBase.component';\nimport {DayPickerCssClasses} from './dayPicker.interfaces';\n\n/**\n * Default styles for picker\n */\nconst defaultStyles: DayPickerCssClasses =\n{\n periodSelection: 'period',\n previousPeriod: 'fas fa-angle-left clickable',\n nextPeriod: 'fas fa-angle-right clickable',\n periodValue: 'period-value',\n periodData: 'period-data',\n periodDatum: 'period-datum clickable',\n weekdayName: 'weekday',\n clickable: 'clickable'\n};\n\n/**\n * Component used for displaying day picker\n */\n@Component(\n{\n selector: 'date-time-day-picker',\n templateUrl: 'dayPicker.component.html',\n styleUrls: ['dayPicker.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimeDayPickerComponent<TDate = any> extends PickerBaseComponent<TDate, DayData<TDate>, DayPickerCssClasses> implements DateTimeLegacyPicker<TDate, DayPickerCssClasses>\n{\n //######################### protected fields #########################\n\n /**\n * Stored this picker month data\n */\n protected _thisMonthData: DayData<TDate>[] = [];\n\n //######################### public properties - template bindings #########################\n\n /**\n * Names of days\n * @internal\n */\n public weekdays: string[] = [];\n\n /**\n * Value used for displaying time\n */\n public get timeValue(): DateTimeValue<TDate> | null\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) dateApi: DateApi<TDate>,\n changeDetector: ChangeDetectorRef)\n {\n super(dateApi, changeDetector);\n\n this.cssClasses = extend(true, {}, defaultStyles);\n this.weekdays = this._dateApi.weekdaysShort();\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Changes displayed period to \"lower\" period\n * @param event - Event that occured\n * @internal\n */\n public goDown(event: Event): void\n {\n event.preventDefault();\n\n if(!this.canGoDown)\n {\n return;\n }\n\n if(this.displayDate)\n {\n this._scaleDown.next(this.displayDate.value);\n }\n }\n\n /**\n * Changes displayed month to next month\n * @param event - Event that occured\n * @internal\n */\n public nextMonth(event: Event): void\n {\n event.preventDefault();\n this.displayDate!.addMonths(1);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Changes displayed month to previous month\n * @param event - Event that occured\n * @internal\n */\n public previousMonth(event: Event): void\n {\n event.preventDefault();\n this.displayDate!.subtractMonths(1);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Selects day\n * @param event - Event that occured\n * @param day - Selects day \n * @internal\n */\n public override select(event: Event, day: DayData<TDate>): void\n {\n event.preventDefault();\n\n if(day.disabled)\n {\n return;\n }\n\n this._setPeriod(day);\n\n //when time picker is enabled\n if(this.canGoDown)\n {\n const from = this._dateApi\n .getValue(day.date)\n .hour(this._originalHour)\n .minute(this._originalMinute);\n\n const to = this._dateApi\n .getValue(this._endOfPeriod(day))\n .hour(this._originalHour)\n .minute(this._originalMinute);\n\n this._value =\n {\n from: from.value,\n to: to.value\n };\n }\n //no time picker\n else\n {\n this._value =\n {\n from: day.date,\n to: this._endOfPeriod(day)\n };\n }\n \n this._valueChange.next();\n\n if(day.otherMonth)\n {\n this.display(this._dateApi.getValue(day.date));\n }\n }\n\n //######################### public methods - implementation of DateTimePicker #########################\n\n /**\n * Set displays date to be displayed\n * @param value - Value that identifies period that is going to be displayed\n */\n public display(value: DateApiObject<TDate>): void\n {\n this.displayDate = value;\n this.periodData = [];\n this._thisMonthData = [];\n const currentMonthDate = this.displayDate.value;\n const today = this._dateApi.now().value;\n\n this.displayDate\n .startOfMonth()\n .updateOriginal()\n .startOfWeek();\n\n do\n {\n for(let x = 0; x < 7; x++)\n {\n const day = this.displayDate.dayOfMonth();\n const otherMonth = !this.displayDate.isSameMonth(currentMonthDate);\n const data = \n {\n active: false,\n disabled: false,\n date: this.displayDate.value,\n otherMonth: otherMonth,\n today: this.displayDate.isSameDay(today),\n weekend: this.displayDate.isWeekend(),\n day: day\n };\n\n this.periodData.push(data);\n\n if(!otherMonth)\n {\n this._thisMonthData.push(data);\n }\n\n this.displayDate.addDays(1);\n }\n }\n while(this.displayDate.isSameMonth(currentMonthDate));\n\n this.displayDate.resetOriginal();\n\n //can go down set minutes and hours\n if(this.canGoDown)\n {\n this.displayDate\n .minute(this._originalMinute)\n .hour(this._originalHour);\n }\n\n this._updateMinMax();\n\n //set value if exists\n if(this._value && (this.displayDate.isSameMonth(this._value.from!) || this.displayDate.isSameMonth(this._value.to!)))\n {\n this.setValue(this._value);\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Obtains end of period\n * @param period - Period for which should be end obtained\n */\n protected _endOfPeriod(period: PeriodData<TDate>): TDate\n {\n return this._dateApi.getValue(period.date).endOfDay().value;\n }\n\n /**\n * Tests whether provided value is in same period as displayed picker\n * @param val - Tested value for same period as displayed picker\n */\n protected _isSamePeriodAsDisplayed(val: DateApiObject<TDate>): boolean\n {\n return val.isSameMonth(this.displayDate!.value);\n }\n\n /**\n * Tests whether provided value is in same period target value\n * @param val - Tested value\n * @param target - Target value to be tested against\n */\n protected _isSamePeriod(val: DateApiObject<TDate>, target: TDate): boolean\n {\n return val.isSameDay(target);\n }\n\n /**\n * Gets period data for specified value\n * @param val - Value for which is period data obtained\n */\n protected _getPeriodData(val: DateApiObject<TDate>): PeriodData<TDate>\n {\n return this._thisMonthData[val.dayOfMonth() - 1];\n }\n}","<div [ngClass]=\"cssClasses.periodSelection | asRequired\">\r\n <div [ngClass]=\"cssClasses.previousPeriod | asRequired\" (mousedown)=\"previousMonth($event)\"></div>\r\n <div [ngClass]=\"cssClasses.periodValue | asRequired | mergeCssClasses: [{'clickable': canGoUp}]\" (mousedown)=\"goUp($event)\">{{displayDate?.format('MMMM yyyy')}}</div>\r\n <div [ngClass]=\"cssClasses.nextPeriod | asRequired\" (mousedown)=\"nextMonth($event)\"></div>\r\n</div>\r\n\r\n<div [ngClass]=\"cssClasses.periodData | asRequired\">\r\n <div [ngClass]=\"cssClasses.weekdayName | asRequired\" *ngFor=\"let weekday of weekdays\">{{weekday}}</div>\r\n <div *ngFor=\"let day of periodData\"\r\n [ngClass]=\"cssClasses.periodDatum | asRequired\"\r\n [class.other-month]=\"day.otherMonth\"\r\n [class.today]=\"day.today\"\r\n [class.weekend]=\"day.weekend\"\r\n [class.active]=\"day.active\"\r\n [class.disabled]=\"day.disabled\"\r\n (mousedown)=\"select($event, day)\">{{day.day}}</div>\r\n</div>\r\n\r\n<div class=\"flex-row\" style=\"justify-content: center; border-top: 1px solid #FFF;\" *ngIf=\"canGoDown\">\r\n <div [class.clickable]=\"canGoDown\" (mousedown)=\"goDown($event)\">{{timeValue?.from | dateFormat: 'time'}}</div>\r\n</div>"]}
|
|
1
|
+
{"version":3,"file":"dayPicker.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/picker/components/dayPicker/dayPicker.component.ts","../../../../../../src/legacy/picker/components/dayPicker/dayPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAGtC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;;;;;AAG5D;;GAEG;AACH,MAAM,aAAa,GACnB;IACI,eAAe,EAAE,QAAQ;IACzB,cAAc,EAAE,6BAA6B;IAC7C,UAAU,EAAE,8BAA8B;IAC1C,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,aAAa;IACzB,WAAW,EAAE,wBAAwB;IACrC,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,WAAW;CACzB,CAAC;AAEF;;GAEG;AAQH,MAAM,OAAO,0BAAwC,SAAQ,mBAA+D;IAyBxH,iEAAiE;IACjE,YAA8B,OAAuB,EACzC,cAAiC;QAEzC,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QA3BnC,sEAAsE;QAEtE;;WAEG;QACO,mBAAc,GAAqB,EAAE,CAAC;QAEhD,2FAA2F;QAE3F;;;WAGG;QACI,aAAQ,GAAa,EAAE,CAAC;QAgB3B,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;IAClD,CAAC;IAhBD;;OAEG;IACH,IAAW,SAAS;QAEhB,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAYD,wFAAwF;IAExF;;;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yB;QAE5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC;IAChE,CAAC;IAED;;;OAGG;IACO,wBAAwB,CAAC,GAAyB;QAExD,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,WAAY,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACO,aAAa,CAAC,GAAyB,EAAE,MAAa;QAE5D,OAAO,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,GAAyB;QAE9C,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;;uHAlPQ,0BAA0B,kBA0Bf,QAAQ;2GA1BnB,0BAA0B,mFCnCvC,2wCAoBM;2FDeO,0BAA0B;kBAPtC,SAAS;+BAEI,sBAAsB,mBAGf,uBAAuB,CAAC,MAAM;;0BA4BlC,MAAM;2BAAC,QAAQ","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef} from '@angular/core';\nimport {extend} from '@jscrpt/common';\n\nimport {DateTimeValue} from '../../../../interfaces/dateTime/datetime.interface';\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject} from '../../../../services/dateApi/dateApi.interface';\nimport {DateTimeLegacyPicker, DayData, PeriodData} from '../../misc/datetimePicker.interface';\nimport {PickerBaseComponent} from '../pickerBase.component';\nimport {DayPickerCssClasses} from './dayPicker.interfaces';\n\n/**\n * Default styles for picker\n */\nconst defaultStyles: DayPickerCssClasses =\n{\n periodSelection: 'period',\n previousPeriod: 'fas fa-angle-left clickable',\n nextPeriod: 'fas fa-angle-right clickable',\n periodValue: 'period-value',\n periodData: 'period-data',\n periodDatum: 'period-datum clickable',\n weekdayName: 'weekday',\n clickable: 'clickable'\n};\n\n/**\n * Component used for displaying day picker\n */\n@Component(\n{\n selector: 'date-time-day-picker',\n templateUrl: 'dayPicker.component.html',\n styleUrls: ['dayPicker.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimeDayPickerComponent<TDate = any> extends PickerBaseComponent<TDate, DayData<TDate>, DayPickerCssClasses> implements DateTimeLegacyPicker<TDate, DayPickerCssClasses>\n{\n //######################### protected fields #########################\n\n /**\n * Stored this picker month data\n */\n protected _thisMonthData: DayData<TDate>[] = [];\n\n //######################### public properties - template bindings #########################\n\n /**\n * Names of days\n * @internal\n */\n public weekdays: string[] = [];\n\n /**\n * Value used for displaying time\n */\n public get timeValue(): DateTimeValue<TDate> | null\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) dateApi: DateApi<TDate>,\n changeDetector: ChangeDetectorRef)\n {\n super(dateApi, changeDetector);\n\n this.cssClasses = extend(true, {}, defaultStyles);\n this.weekdays = this._dateApi.weekdaysShort();\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Changes displayed period to \"lower\" period\n * @param event - Event that occured\n * @internal\n */\n public goDown(event: Event): void\n {\n event.preventDefault();\n\n if(!this.canGoDown)\n {\n return;\n }\n\n if(this.displayDate)\n {\n this._scaleDown.next(this.displayDate.value);\n }\n }\n\n /**\n * Changes displayed month to next month\n * @param event - Event that occured\n * @internal\n */\n public nextMonth(event: Event): void\n {\n event.preventDefault();\n this.displayDate!.addMonths(1);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Changes displayed month to previous month\n * @param event - Event that occured\n * @internal\n */\n public previousMonth(event: Event): void\n {\n event.preventDefault();\n this.displayDate!.subtractMonths(1);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Selects day\n * @param event - Event that occured\n * @param day - Selects day \n * @internal\n */\n public override select(event: Event, day: DayData<TDate>): void\n {\n event.preventDefault();\n\n if(day.disabled)\n {\n return;\n }\n\n this._setPeriod(day);\n\n //when time picker is enabled\n if(this.canGoDown)\n {\n const from = this._dateApi\n .getValue(day.date)\n .hour(this._originalHour)\n .minute(this._originalMinute);\n\n const to = this._dateApi\n .getValue(this._endOfPeriod(day))\n .hour(this._originalHour)\n .minute(this._originalMinute);\n\n this._value =\n {\n from: from.value,\n to: to.value\n };\n }\n //no time picker\n else\n {\n this._value =\n {\n from: day.date,\n to: this._endOfPeriod(day)\n };\n }\n \n this._valueChange.next();\n\n if(day.otherMonth)\n {\n this.display(this._dateApi.getValue(day.date));\n }\n }\n\n //######################### public methods - implementation of DateTimePicker #########################\n\n /**\n * Set displays date to be displayed\n * @param value - Value that identifies period that is going to be displayed\n */\n public display(value: DateApiObject<TDate>): void\n {\n this.displayDate = value;\n this.periodData = [];\n this._thisMonthData = [];\n const currentMonthDate = this.displayDate.value;\n const today = this._dateApi.now().value;\n\n this.displayDate\n .startOfMonth()\n .updateOriginal()\n .startOfWeek();\n\n do\n {\n for(let x = 0; x < 7; x++)\n {\n const day = this.displayDate.dayOfMonth();\n const otherMonth = !this.displayDate.isSameMonth(currentMonthDate);\n const data = \n {\n active: false,\n disabled: false,\n date: this.displayDate.value,\n otherMonth: otherMonth,\n today: this.displayDate.isSameDay(today),\n weekend: this.displayDate.isWeekend(),\n day: day,\n dateObj: this.displayDate.clone(),\n };\n\n this.periodData.push(data);\n\n if(!otherMonth)\n {\n this._thisMonthData.push(data);\n }\n\n this.displayDate.addDays(1);\n }\n }\n while(this.displayDate.isSameMonth(currentMonthDate));\n\n this.displayDate.resetOriginal();\n\n //can go down set minutes and hours\n if(this.canGoDown)\n {\n this.displayDate\n .minute(this._originalMinute)\n .hour(this._originalHour);\n }\n\n this._updateMinMax();\n\n //set value if exists\n if(this._value && (this.displayDate.isSameMonth(this._value.from!) || this.displayDate.isSameMonth(this._value.to!)))\n {\n this.setValue(this._value);\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Obtains end of period\n * @param period - Period for which should be end obtained\n */\n protected _endOfPeriod(period: PeriodData<TDate>): TDate\n {\n return this._dateApi.getValue(period.date).endOfDay().value;\n }\n\n /**\n * Tests whether provided value is in same period as displayed picker\n * @param val - Tested value for same period as displayed picker\n */\n protected _isSamePeriodAsDisplayed(val: DateApiObject<TDate>): boolean\n {\n return val.isSameMonth(this.displayDate!.value);\n }\n\n /**\n * Tests whether provided value is in same period target value\n * @param val - Tested value\n * @param target - Target value to be tested against\n */\n protected _isSamePeriod(val: DateApiObject<TDate>, target: TDate): boolean\n {\n return val.isSameDay(target);\n }\n\n /**\n * Gets period data for specified value\n * @param val - Value for which is period data obtained\n */\n protected _getPeriodData(val: DateApiObject<TDate>): PeriodData<TDate>\n {\n return this._thisMonthData[val.dayOfMonth() - 1];\n }\n}","<div [ngClass]=\"cssClasses.periodSelection | asRequired\">\r\n <div [ngClass]=\"cssClasses.previousPeriod | asRequired\" (mousedown)=\"previousMonth($event)\"></div>\r\n <div [ngClass]=\"cssClasses.periodValue | asRequired | mergeCssClasses: [{'clickable': canGoUp}]\" (mousedown)=\"goUp($event)\">{{displayDate?.format('MMMM yyyy')}}</div>\r\n <div [ngClass]=\"cssClasses.nextPeriod | asRequired\" (mousedown)=\"nextMonth($event)\"></div>\r\n</div>\r\n\r\n<div [ngClass]=\"cssClasses.periodData | asRequired\">\r\n <div [ngClass]=\"cssClasses.weekdayName | asRequired\" *ngFor=\"let weekday of weekdays\">{{weekday}}</div>\r\n <div *ngFor=\"let day of periodData\"\r\n [ngClass]=\"cssClasses.periodDatum | asRequired\"\r\n [class.other-month]=\"day.otherMonth\"\r\n [class.today]=\"day.today\"\r\n [class.weekend]=\"day.weekend\"\r\n [class.active]=\"day.active\"\r\n [class.disabled]=\"day.disabled\"\r\n (mousedown)=\"select($event, day)\">{{day.day}}</div>\r\n</div>\r\n\r\n<div class=\"flex-row\" style=\"justify-content: center; border-top: 1px solid #FFF;\" *ngIf=\"canGoDown\">\r\n <div [class.clickable]=\"canGoDown\" (mousedown)=\"goDown($event)\">{{timeValue?.from | dateFormat: 'time'}}</div>\r\n</div>"]}
|
|
@@ -61,7 +61,8 @@ export class DateTimeMonthPickerComponent extends PickerBaseComponent {
|
|
|
61
61
|
active: false,
|
|
62
62
|
disabled: false,
|
|
63
63
|
date: monthOfYear.value,
|
|
64
|
-
name: monthOfYear.format('MMM')
|
|
64
|
+
name: monthOfYear.format('MMM'),
|
|
65
|
+
dateObj: monthOfYear.clone(),
|
|
65
66
|
});
|
|
66
67
|
monthOfYear.addMonths(1);
|
|
67
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monthPicker.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/picker/components/monthPicker/monthPicker.component.ts","../../../../../../src/legacy/picker/components/monthPicker/monthPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;;;;AAG5D;;GAEG;AACH,MAAM,aAAa,GACnB;IACI,eAAe,EAAE,QAAQ;IACzB,cAAc,EAAE,6BAA6B;IAC7C,UAAU,EAAE,8BAA8B;IAC1C,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,aAAa;IACzB,WAAW,EAAE,wBAAwB;IACrC,SAAS,EAAE,WAAW;CACzB,CAAC;AAEF;;GAEG;AAQH,MAAM,OAAO,4BAA0C,SAAQ,mBAAmE;IAE9H,iEAAiE;IACjE,YAA8B,OAAuB,EACzC,cAAiC;QAEzC,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAE/B,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;IACtD,CAAC;IAED,wFAAwF;IAExF;;;;OAIG;IACI,QAAQ,CAAC,KAAY;QAExB,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAE9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAY,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,KAAY;QAE5B,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,CAAC,WAAY,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QAEnC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAY,CAAC,CAAC;IACpC,CAAC;IAED,uGAAuG;IAEvG;;;OAGG;IACI,OAAO,CAAC,KAA2B;QAEtC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAEzB,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,cAAc,EAAE,CAAC;QACpE,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QAErB,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAC1B;YACI,IAAI,CAAC,UAAU,CAAC,IAAI,CACpB;gBACI,MAAM,EAAE,KAAK;gBACb,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,WAAW,CAAC,KAAK;gBACvB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"monthPicker.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/picker/components/monthPicker/monthPicker.component.ts","../../../../../../src/legacy/picker/components/monthPicker/monthPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAC,mBAAm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CAAC;IACxC,CAAC;;yHAjHQ,4BAA4B,kBAGjB,QAAQ;6GAHnB,4BAA4B,qFCjCzC,gxBAYM;2FDqBO,4BAA4B;kBAPxC,SAAS;+BAEI,wBAAwB,mBAGjB,uBAAuB,CAAC,MAAM;;0BAKlC,MAAM;2BAAC,QAAQ","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef} from '@angular/core';\nimport {extend} from '@jscrpt/common';\n\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject} from '../../../../services/dateApi/dateApi.interface';\nimport {DateTimeLegacyPicker, MonthData, PeriodData} from '../../misc/datetimePicker.interface';\nimport {PickerBaseComponent} from '../pickerBase.component';\nimport {MonthPickerCssClasses} from './monthPicker.interfaces';\n\n/**\n * Default styles for picker\n */\nconst defaultStyles: MonthPickerCssClasses =\n{\n periodSelection: 'period',\n previousPeriod: 'fas fa-angle-left clickable',\n nextPeriod: 'fas fa-angle-right clickable',\n periodValue: 'period-value',\n periodData: 'period-data',\n periodDatum: 'period-datum clickable',\n clickable: 'clickable'\n};\n\n/**\n * Component used for displaying month picker\n */\n@Component(\n{\n selector: 'date-time-month-picker',\n templateUrl: 'monthPicker.component.html',\n styleUrls: ['monthPicker.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimeMonthPickerComponent<TDate = any> extends PickerBaseComponent<TDate, MonthData<TDate>, MonthPickerCssClasses> implements DateTimeLegacyPicker<TDate, MonthPickerCssClasses>\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_API) dateApi: DateApi<TDate>,\n changeDetector: ChangeDetectorRef)\n {\n super(dateApi, changeDetector);\n\n this.cssClasses = extend(true, {}, defaultStyles);\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Changes displayed year to next year\n * @param event - Event that occured\n * @internal\n */\n public nextYear(event: Event)\n {\n event.preventDefault();\n this.displayDate!.addYears(1);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Changes displayed year to previous year\n * @param event - Event that occured\n * @internal\n */\n public previousYear(event: Event)\n {\n event.preventDefault();\n this.displayDate!.subtractYears(1);\n\n this.display(this.displayDate!);\n }\n\n //######################### public methods - implementation of DateTimePicker #########################\n\n /**\n * Set displays date to be displayed\n * @param value - Value that identifies period that is going to be displayed\n */\n public display(value: DateApiObject<TDate>): void\n {\n this.displayDate = value;\n\n const monthOfYear = this.displayDate.startOfYear().updateOriginal();\n this.periodData = [];\n\n for(let x = 0; x < 12; x++)\n {\n this.periodData.push(\n {\n active: false,\n disabled: false,\n date: monthOfYear.value,\n name: monthOfYear.format('MMM'),\n dateObj: monthOfYear.clone(),\n });\n\n monthOfYear.addMonths(1);\n }\n\n this.displayDate.resetOriginal();\n this._updateMinMax();\n\n //set value if exists\n if(this._value && (this.displayDate.isSameYear(this._value.from!) || this.displayDate.isSameYear(this._value.to!)))\n {\n this.setValue(this._value);\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Obtains end of period\n * @param period - Period for which should be end obtained\n */\n protected _endOfPeriod(period: PeriodData<TDate>): TDate\n {\n return this._dateApi.getValue(period.date).endOfMonth().value;\n }\n\n /**\n * Tests whether provided value is in same period as displayed picker\n * @param val - Tested value for same period as displayed picker\n */\n protected _isSamePeriodAsDisplayed(val: DateApiObject<TDate>): boolean\n {\n return val.isSameYear(this.displayDate!.value);\n }\n\n /**\n * Tests whether provided value is in same period target value\n * @param val - Tested value\n * @param target - Target value to be tested against\n */\n protected _isSamePeriod(val: DateApiObject<TDate>, target: TDate): boolean\n {\n return val.isSameMonth(target);\n }\n\n /**\n * Gets period data for specified value\n * @param val - Value for which is period data obtained\n */\n protected _getPeriodData(val: DateApiObject<TDate>): PeriodData<TDate>\n {\n return this.periodData[val.month()];\n }\n}","<div [ngClass]=\"cssClasses.periodSelection | asRequired\">\r\n <div [ngClass]=\"cssClasses.previousPeriod | asRequired\" (mousedown)=\"previousYear($event)\"></div>\r\n <div [ngClass]=\"cssClasses.periodValue | asRequired\" [class.clickable]=\"canGoUp\" (mousedown)=\"goUp($event)\">{{displayDate?.format('yyyy')}}</div>\r\n <div [ngClass]=\"cssClasses.nextPeriod | asRequired\" (mousedown)=\"nextYear($event)\"></div>\r\n</div>\r\n\r\n<div [ngClass]=\"cssClasses.periodData | asRequired\">\r\n <div *ngFor=\"let month of periodData\"\r\n [ngClass]=\"cssClasses.periodDatum | asRequired\"\r\n [class.active]=\"month.active\"\r\n [class.disabled]=\"month.disabled\"\r\n (mousedown)=\"select($event, month)\">{{month.name}}</div>\r\n</div>"]}
|
|
@@ -71,7 +71,8 @@ export class DateTimeYearPickerComponent extends PickerBaseComponent {
|
|
|
71
71
|
active: false,
|
|
72
72
|
disabled: false,
|
|
73
73
|
date: this.displayDate.value,
|
|
74
|
-
value: year
|
|
74
|
+
value: year,
|
|
75
|
+
dateObj: this.displayDate.clone(),
|
|
75
76
|
});
|
|
76
77
|
year++;
|
|
77
78
|
this.displayDate.addYears(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yearPicker.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/picker/components/yearPicker/yearPicker.component.ts","../../../../../../src/legacy/picker/components/yearPicker/yearPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;;;;AAG5D;;GAEG;AACH,MAAM,aAAa,GACnB;IACI,eAAe,EAAE,QAAQ;IACzB,cAAc,EAAE,6BAA6B;IAC7C,UAAU,EAAE,8BAA8B;IAC1C,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,aAAa;IACzB,WAAW,EAAE,wBAAwB;IACrC,SAAS,EAAE,WAAW;CACzB,CAAC;AAE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,IAAI,CACpB;gBACI,MAAM,EAAE,KAAK;gBACb,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK;gBAC5B,KAAK,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"yearPicker.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/picker/components/yearPicker/yearPicker.component.ts","../../../../../../src/legacy/picker/components/yearPicker/yearPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;;;;AAG5D;;GAEG;AACH,MAAM,aAAa,GACnB;IACI,eAAe,EAAE,QAAQ;IACzB,cAAc,EAAE,6BAA6B;IAC7C,UAAU,EAAE,8BAA8B;IAC1C,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,aAAa;IACzB,WAAW,EAAE,wBAAwB;IACrC,SAAS,EAAE,WAAW;CACzB,CAAC;AAEF;;GAEG;AAQH,MAAM,OAAO,2BAAyC,SAAQ,mBAAiE;IAU3H,iEAAiE;IACjE,YAA8B,OAAuB,EACzC,cAAiC;QAEzC,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAZnC,2FAA2F;QAE3F;;;WAGG;QACI,WAAM,GAAW,EAAE,CAAC;QAQvB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;IACtD,CAAC;IAED,wFAAwF;IAExF;;;;OAIG;IACI,UAAU,CAAC,KAAY;QAE1B,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAE/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AI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC;QAE7E,qBAAqB;QACrB,IAAG,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAK,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAAG,CAAC,CAAC,EACtH;YACI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC9B;IACL,CAAC;IAED,uEAAuE;IAEvE;;;OAGG;IACO,YAAY,CAAC,MAAyB;QAE5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC;IACjE,CAAC;IAED;;;OAGG;IACO,wBAAwB,CAAC,GAAyB;QAExD,OAAO,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,WAAY,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACO,aAAa,CAAC,GAAyB,EAAE,MAAa;QAE5D,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,GAAyB;QAE9C,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5C,CAAC;;wHAnIQ,2BAA2B,kBAWhB,QAAQ;4GAXnB,2BAA2B,oFCjCxC,2vBAYM;2FDqBO,2BAA2B;kBAPvC,SAAS;+BAEI,uBAAuB,mBAGhB,uBAAuB,CAAC,MAAM;;0BAalC,MAAM;2BAAC,QAAQ","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef} from '@angular/core';\nimport {extend} from '@jscrpt/common';\n\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi, DateApiObject} from '../../../../services/dateApi/dateApi.interface';\nimport {DateTimeLegacyPicker, PeriodData, YearData} from '../../misc/datetimePicker.interface';\nimport {PickerBaseComponent} from '../pickerBase.component';\nimport {YearPickerCssClasses} from './yearPicker.interfaces';\n\n/**\n * Default styles for picker\n */\nconst defaultStyles: YearPickerCssClasses =\n{\n periodSelection: 'period',\n previousPeriod: 'fas fa-angle-left clickable',\n nextPeriod: 'fas fa-angle-right clickable',\n periodValue: 'period-value',\n periodData: 'period-data',\n periodDatum: 'period-datum clickable',\n clickable: 'clickable'\n};\n\n/**\n * Component used for displaying year picker\n */\n@Component(\n{\n selector: 'date-time-year-picker',\n templateUrl: 'yearPicker.component.html',\n styleUrls: ['yearPicker.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimeYearPickerComponent<TDate = any> extends PickerBaseComponent<TDate, YearData<TDate>, YearPickerCssClasses> implements DateTimeLegacyPicker<TDate, YearPickerCssClasses>\n{\n //######################### public properties - template bindings #########################\n\n /**\n * Displayed decade period\n * @internal\n */\n public period: string = '';\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) dateApi: DateApi<TDate>,\n changeDetector: ChangeDetectorRef)\n {\n super(dateApi, changeDetector);\n\n this.cssClasses = extend(true, {}, defaultStyles);\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Changes displayed decade to next decade\n * @param event - Event that occured\n * @internal\n */\n public nextDecade(event: Event)\n {\n event.preventDefault();\n this.displayDate!.addYears(10);\n\n this.display(this.displayDate!);\n }\n\n /**\n * Changes displayed decade to previous decade\n * @param event - Event that occured\n * @internal\n */\n public previousDecade(event: Event)\n {\n event.preventDefault();\n this.displayDate!.subtractYears(10);\n\n this.display(this.displayDate!);\n }\n\n //######################### public methods - implementation of DateTimePicker #########################\n\n /**\n * Set displays date to be displayed\n * @param value - Value that identifies period that is going to be displayed\n */\n public display(value: DateApiObject<TDate>): void\n {\n this.displayDate = value;\n\n let year = this.displayDate.startOfYear().year();\n\n while(year % 10 !== 0)\n {\n year--;\n }\n\n this.displayDate.year(year).updateOriginal();\n\n this.periodData = [];\n\n for(let x = 0; x < 10; x++)\n {\n this.periodData.push(\n {\n active: false,\n disabled: false,\n date: this.displayDate.value,\n value: year,\n dateObj: this.displayDate.clone(),\n });\n\n year++;\n this.displayDate.addYears(1);\n }\n\n this.displayDate.resetOriginal();\n this._updateMinMax();\n this.period = `${this.displayDate.year()} - ${this.displayDate.year() + 10}`;\n\n //set value if exists\n if(this._value && (this.displayDate.isSameDecade(this._value.from!) || this.displayDate.isSameDecade(this._value.to!)))\n {\n this.setValue(this._value);\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Obtains end of period\n * @param period - Period for which should be end obtained\n */\n protected _endOfPeriod(period: PeriodData<TDate>): TDate\n {\n return this._dateApi.getValue(period.date).endOfYear().value;\n }\n\n /**\n * Tests whether provided value is in same period as displayed picker\n * @param val - Tested value for same period as displayed picker\n */\n protected _isSamePeriodAsDisplayed(val: DateApiObject<TDate>): boolean\n {\n return val.isSameDecade(this.displayDate!.value);\n }\n\n /**\n * Tests whether provided value is in same period target value\n * @param val - Tested value\n * @param target - Target value to be tested against\n */\n protected _isSamePeriod(val: DateApiObject<TDate>, target: TDate): boolean\n {\n return val.isSameYear(target);\n }\n\n /**\n * Gets period data for specified value\n * @param val - Value for which is period data obtained\n */\n protected _getPeriodData(val: DateApiObject<TDate>): PeriodData<TDate>\n {\n return this.periodData[val.year() % 10];\n }\n}","<div [ngClass]=\"cssClasses.periodSelection | asRequired\">\r\n <div [ngClass]=\"cssClasses.previousPeriod | asRequired\" (mousedown)=\"previousDecade($event)\"></div>\r\n <div [ngClass]=\"cssClasses.periodValue | asRequired\" [class.clickable]=\"canGoUp\" (mousedown)=\"goUp($event)\">{{period}}</div>\r\n <div [ngClass]=\"cssClasses.nextPeriod | asRequired\" (mousedown)=\"nextDecade($event)\"></div>\r\n</div>\r\n\r\n<div [ngClass]=\"cssClasses.periodData | asRequired\">\r\n <div *ngFor=\"let year of periodData\"\r\n [ngClass]=\"cssClasses.periodDatum | asRequired\"\r\n [class.active]=\"year.active\"\r\n [class.disabled]=\"year.disabled\"\r\n (mousedown)=\"select($event, year)\">{{year.value}}</div>\r\n</div>"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetimePicker.interface.js","sourceRoot":"","sources":["../../../../../src/legacy/picker/misc/datetimePicker.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Type} from '@angular/core';\nimport {Dictionary} from '@jscrpt/common';\nimport {Observable} from 'rxjs';\n\nimport {DateTimeValue} from '../../../interfaces/dateTime/datetime.interface';\nimport {DateApiObject} from '../../../services/dateApi/dateApi.interface';\n\n/**\n * Shared css classes for all pickers\n */\nexport interface CommonPickerCssClasses\n{\n /**\n * Period selection element wrapping displayed period and previous, next buttons\n */\n periodSelection: string;\n\n /**\n * Element used for switching period to previous one\n */\n previousPeriod: string;\n\n /**\n * Element used for switching period to next one\n */\n nextPeriod: string;\n\n /**\n * Element representing currently displayed period\n */\n periodValue: string;\n\n /**\n * Element wrapping displayed period data\n */\n periodData: string;\n\n /**\n * Element representing single datum for period item\n */\n periodDatum: string;\n\n /**\n * Name of css class that represents clickable items in picker\n */\n clickable: string;\n}\n\n/**\n * Css classes applied to datetime picker\n */\nexport interface DateTimePickerCssClasses\n{\n /**\n * Shared css classes for all pickers\n */\n pickerShared?: CommonPickerCssClasses;\n\n /**\n * Custom css classes specific for each picker type\n */\n pickerCustom?: Dictionary<object>;\n}\n\n/**\n * Defintion of datetime picker component options\n */\nexport interface DateTimePickerLegacyOptions<TPicker = any>\n{\n /**\n * Order of pickers, it's possible use less pickers as is defined in pickerPeriodsDefinition for example 'month,year'\n */\n pickerPeriodsOrder: string[]|string|null;\n\n /**\n * Definition of types for each period type for picker\n */\n pickerPeriodsDefinition: Dictionary<Type<TPicker>>;\n\n /**\n * Name of default period for picker that is displayed\n */\n defaultPeriod: string;\n\n /**\n * Css classes for date time picker\n */\n cssClasses: DateTimePickerCssClasses;\n}\n\n/**\n * Describes datetime picker component used for displaying and selecting value\n */\nexport interface DateTimeLegacyPicker<TDate = any, TCssClasses = object>\n{\n /**\n * Gets current value of datetime\n */\n readonly value: DateTimeValue<TDate>|null;\n\n /**\n * Occurs when value changes\n */\n readonly valueChange: Observable<void>;\n\n /**\n * Occurs when user scales up\n */\n readonly scaleUp: Observable<TDate>;\n\n /**\n * Occurs when user scales down\n */\n readonly scaleDown: Observable<TDate>;\n\n /**\n * Sets css classes for picker, allowing to override defaults\n * @param cssClasses - Css classes to be set for picker\n */\n setCssClasses(cssClasses: TCssClasses): void;\n\n /**\n * Sets minimal possible value for picker, that can be picked\n * @param value - Minimal possible value that can be picked\n */\n setMinValue(value: TDate|null): void;\n\n /**\n * Sets maximal possible value for picker, that can be picked\n * @param value - Maximal possible value that can be picked\n */\n setMaxValue(value: TDate|null): void;\n\n /**\n * Sets value of datetime picker\n * @param value - Value to be set to this picker\n */\n setValue(value: DateTimeValue<TDate>|null): void;\n\n /**\n * Set displays date to be displayed\n * @param value - Value that identifies period that is going to be displayed\n */\n display(value: DateApiObject<TDate>): void;\n\n /**\n * Sets indication whether can go down\n * @param value - Indication whether can go down in period\n */\n setCanGoDown(value: boolean): void;\n\n /**\n * Sets indication whether can go up\n * @param value - Indication whether can go up in period\n */\n setCanGoUp(value: boolean): void;\n\n /**\n * Explicitly runs invalidation of content (change detection)\n */\n invalidateVisuals(): void;\n}\n\n/**\n * Data that represents data for any picker type\n */\nexport interface PeriodData<TDate = any>\n{\n /**\n * Indication that this period item is active and selected\n */\n active: boolean;\n\n /**\n * Indication that this period item is disabled\n */\n disabled: boolean;\n\n /**\n * Date for this period item\n */\n date: TDate;\n}\n\n/**\n * Data that represents day in date picker\n */\nexport interface DayData<TDate = any> extends PeriodData<TDate>\n{\n\n /**\n * Indication that this day is out of currently selected month\n */\n otherMonth: boolean;\n\n /**\n * Indication that this day is today\n */\n today: boolean;\n\n /**\n * Indication that this day is weekend day\n */\n weekend: boolean;\n\n /**\n * Day number of month\n */\n day: number;\n}\n\n/**\n * Data that represents month in date picker\n */\nexport interface MonthData<TDate = any> extends PeriodData<TDate>\n{\n /**\n * Name of month\n */\n name: string;\n}\n\n/**\n * Data that represents year in date picker\n */\nexport interface YearData<TDate = any> extends PeriodData<TDate>\n{\n /**\n * Value of year\n */\n value: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"datetimePicker.interface.js","sourceRoot":"","sources":["../../../../../src/legacy/picker/misc/datetimePicker.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Type} from '@angular/core';\nimport {Dictionary} from '@jscrpt/common';\nimport {Observable} from 'rxjs';\n\nimport {DateTimeValue} from '../../../interfaces/dateTime/datetime.interface';\nimport {DateApiObject} from '../../../services/dateApi/dateApi.interface';\n\n/**\n * Shared css classes for all pickers\n */\nexport interface CommonPickerCssClasses\n{\n /**\n * Period selection element wrapping displayed period and previous, next buttons\n */\n periodSelection: string;\n\n /**\n * Element used for switching period to previous one\n */\n previousPeriod: string;\n\n /**\n * Element used for switching period to next one\n */\n nextPeriod: string;\n\n /**\n * Element representing currently displayed period\n */\n periodValue: string;\n\n /**\n * Element wrapping displayed period data\n */\n periodData: string;\n\n /**\n * Element representing single datum for period item\n */\n periodDatum: string;\n\n /**\n * Name of css class that represents clickable items in picker\n */\n clickable: string;\n}\n\n/**\n * Css classes applied to datetime picker\n */\nexport interface DateTimePickerCssClasses\n{\n /**\n * Shared css classes for all pickers\n */\n pickerShared?: CommonPickerCssClasses;\n\n /**\n * Custom css classes specific for each picker type\n */\n pickerCustom?: Dictionary<object>;\n}\n\n/**\n * Defintion of datetime picker component options\n */\nexport interface DateTimePickerLegacyOptions<TPicker = any>\n{\n /**\n * Order of pickers, it's possible use less pickers as is defined in pickerPeriodsDefinition for example 'month,year'\n */\n pickerPeriodsOrder: string[]|string|null;\n\n /**\n * Definition of types for each period type for picker\n */\n pickerPeriodsDefinition: Dictionary<Type<TPicker>>;\n\n /**\n * Name of default period for picker that is displayed\n */\n defaultPeriod: string;\n\n /**\n * Css classes for date time picker\n */\n cssClasses: DateTimePickerCssClasses;\n}\n\n/**\n * Describes datetime picker component used for displaying and selecting value\n */\nexport interface DateTimeLegacyPicker<TDate = any, TCssClasses = object>\n{\n /**\n * Gets current value of datetime\n */\n readonly value: DateTimeValue<TDate>|null;\n\n /**\n * Occurs when value changes\n */\n readonly valueChange: Observable<void>;\n\n /**\n * Occurs when user scales up\n */\n readonly scaleUp: Observable<TDate>;\n\n /**\n * Occurs when user scales down\n */\n readonly scaleDown: Observable<TDate>;\n\n /**\n * Sets css classes for picker, allowing to override defaults\n * @param cssClasses - Css classes to be set for picker\n */\n setCssClasses(cssClasses: TCssClasses): void;\n\n /**\n * Sets minimal possible value for picker, that can be picked\n * @param value - Minimal possible value that can be picked\n */\n setMinValue(value: TDate|null): void;\n\n /**\n * Sets maximal possible value for picker, that can be picked\n * @param value - Maximal possible value that can be picked\n */\n setMaxValue(value: TDate|null): void;\n\n /**\n * Sets value of datetime picker\n * @param value - Value to be set to this picker\n */\n setValue(value: DateTimeValue<TDate>|null): void;\n\n /**\n * Set displays date to be displayed\n * @param value - Value that identifies period that is going to be displayed\n */\n display(value: DateApiObject<TDate>): void;\n\n /**\n * Sets indication whether can go down\n * @param value - Indication whether can go down in period\n */\n setCanGoDown(value: boolean): void;\n\n /**\n * Sets indication whether can go up\n * @param value - Indication whether can go up in period\n */\n setCanGoUp(value: boolean): void;\n\n /**\n * Explicitly runs invalidation of content (change detection)\n */\n invalidateVisuals(): void;\n}\n\n/**\n * Data that represents data for any picker type\n */\nexport interface PeriodData<TDate = any>\n{\n /**\n * Indication that this period item is active and selected\n */\n active: boolean;\n\n /**\n * Indication that this period item is disabled\n */\n disabled: boolean;\n\n //TODO: remove\n\n /**\n * Date for this period item\n */\n date: TDate;\n\n /**\n * Date for this period item as date api object\n */\n dateObj: DateApiObject<TDate>;\n}\n\n/**\n * Data that represents day in date picker\n */\nexport interface DayData<TDate = any> extends PeriodData<TDate>\n{\n\n /**\n * Indication that this day is out of currently selected month\n */\n otherMonth: boolean;\n\n /**\n * Indication that this day is today\n */\n today: boolean;\n\n /**\n * Indication that this day is weekend day\n */\n weekend: boolean;\n\n /**\n * Day number of month\n */\n day: number;\n}\n\n/**\n * Data that represents month in date picker\n */\nexport interface MonthData<TDate = any> extends PeriodData<TDate>\n{\n /**\n * Name of month\n */\n name: string;\n}\n\n/**\n * Data that represents year in date picker\n */\nexport interface YearData<TDate = any> extends PeriodData<TDate>\n{\n /**\n * Value of year\n */\n value: number;\n}\n"]}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import { ChangeDetectorRef, inject } from '@angular/core';
|
|
1
2
|
import { Subject } from 'rxjs';
|
|
3
|
+
import { DATE_API } from '../../../misc/tokens';
|
|
2
4
|
/**
|
|
3
5
|
* Base abstract class for each date time period picker
|
|
4
6
|
*/
|
|
5
7
|
export class DateTimePeriodPickerBase {
|
|
6
8
|
constructor() {
|
|
7
9
|
//######################### protected properties #########################
|
|
10
|
+
/**
|
|
11
|
+
* Array of period data to be displayed
|
|
12
|
+
*/
|
|
13
|
+
this.periodData = [];
|
|
8
14
|
/**
|
|
9
15
|
* Subject used for emitting of value changes
|
|
10
16
|
*/
|
|
@@ -17,6 +23,14 @@ export class DateTimePeriodPickerBase {
|
|
|
17
23
|
* Subject used for scaling down
|
|
18
24
|
*/
|
|
19
25
|
this.scaleDownSubject = new Subject();
|
|
26
|
+
/**
|
|
27
|
+
* Change detector instance
|
|
28
|
+
*/
|
|
29
|
+
this.changeDetector = inject(ChangeDetectorRef);
|
|
30
|
+
/**
|
|
31
|
+
* Instance of date api for manipulation with date time
|
|
32
|
+
*/
|
|
33
|
+
this.dateApi = inject(DATE_API);
|
|
20
34
|
/**
|
|
21
35
|
* @inheritdoc
|
|
22
36
|
*/
|
|
@@ -26,6 +40,48 @@ export class DateTimePeriodPickerBase {
|
|
|
26
40
|
*/
|
|
27
41
|
this.canScaleDown = false;
|
|
28
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* @inheritdoc
|
|
45
|
+
*/
|
|
46
|
+
get display() {
|
|
47
|
+
var _a;
|
|
48
|
+
return (_a = this.displayDate) === null || _a === void 0 ? void 0 : _a.value;
|
|
49
|
+
}
|
|
50
|
+
set display(value) {
|
|
51
|
+
if (!value) {
|
|
52
|
+
this.displayDate = null;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.displayDate = this.dateApi.getValue(value);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @inheritdoc
|
|
59
|
+
*/
|
|
60
|
+
get maxDate() {
|
|
61
|
+
var _a;
|
|
62
|
+
return (_a = this.maxDateObj) === null || _a === void 0 ? void 0 : _a.value;
|
|
63
|
+
}
|
|
64
|
+
set maxDate(value) {
|
|
65
|
+
if (!value) {
|
|
66
|
+
this.maxDateObj = null;
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
this.maxDateObj = this.dateApi.getValue(value);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @inheritdoc
|
|
73
|
+
*/
|
|
74
|
+
get minDate() {
|
|
75
|
+
var _a;
|
|
76
|
+
return (_a = this.minDateObj) === null || _a === void 0 ? void 0 : _a.value;
|
|
77
|
+
}
|
|
78
|
+
set minDate(value) {
|
|
79
|
+
if (!value) {
|
|
80
|
+
this.minDateObj = null;
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
this.minDateObj = this.dateApi.getValue(value);
|
|
84
|
+
}
|
|
29
85
|
/**
|
|
30
86
|
* @inheritdoc
|
|
31
87
|
*/
|
|
@@ -44,5 +100,59 @@ export class DateTimePeriodPickerBase {
|
|
|
44
100
|
get scaleDown() {
|
|
45
101
|
return this.scaleDownSubject.asObservable();
|
|
46
102
|
}
|
|
103
|
+
//######################### public methods - implementation of invalidatable #########################
|
|
104
|
+
/**
|
|
105
|
+
* @inheritdoc
|
|
106
|
+
*/
|
|
107
|
+
invalidateVisuals() {
|
|
108
|
+
this.onRender();
|
|
109
|
+
this.changeDetector.detectChanges();
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Updates minimal and maximal value for picker
|
|
113
|
+
*/
|
|
114
|
+
updateMinMax() {
|
|
115
|
+
var _a, _b;
|
|
116
|
+
if (!this.periodData.length) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
//no min, no max
|
|
120
|
+
if (!this.minDateObj && !this.maxDateObj) {
|
|
121
|
+
this.periodData.forEach(itm => itm.disabled = false);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
let restAfter = false;
|
|
125
|
+
for (const period of this.periodData) {
|
|
126
|
+
if (((_a = this.minDateObj) === null || _a === void 0 ? void 0 : _a.isValid()) && this.minDateObj.isAfter(period.dateObj.value) && !this.isSamePeriod(this.minDateObj, period.dateObj.value)) {
|
|
127
|
+
period.disabled = true;
|
|
128
|
+
}
|
|
129
|
+
if (restAfter || (((_b = this.maxDateObj) === null || _b === void 0 ? void 0 : _b.isValid()) && this.maxDateObj.isBefore(period.dateObj.value) && !this.isSamePeriod(this.maxDateObj, period.dateObj.value))) {
|
|
130
|
+
restAfter = true;
|
|
131
|
+
period.disabled = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Sets active date
|
|
137
|
+
*/
|
|
138
|
+
setActive() {
|
|
139
|
+
var _a;
|
|
140
|
+
this.periodData.forEach(itm => itm.active = false);
|
|
141
|
+
if (!this.value) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (!Array.isArray(this.value)) {
|
|
145
|
+
if ((_a = this.value) === null || _a === void 0 ? void 0 : _a.isValid()) {
|
|
146
|
+
const value = this.value;
|
|
147
|
+
const data = this.periodData.find(itm => this.isSamePeriod(itm.dateObj, value.value));
|
|
148
|
+
if (data) {
|
|
149
|
+
data.active = true;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
//TODO: support range
|
|
155
|
+
}
|
|
156
|
+
}
|
|
47
157
|
}
|
|
48
158
|
//# sourceMappingURL=dateTimePeriodPickerBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimePeriodPickerBase.js","sourceRoot":"","sources":["../../../../../src/modules/dateTimePicker/components/dateTimePeriodPickerBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAC,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"dateTimePeriodPickerBase.js","sourceRoot":"","sources":["../../../../../src/modules/dateTimePicker/components/dateTimePeriodPickerBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AACxD,OAAO,EAAa,OAAO,EAAC,MAAM,MAAM,CAAC;AAGzC,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAK9C;;GAEG;AACH,MAAM,OAAgB,wBAAwB;IAA9C;QAEI,0EAA0E;QAE1E;;WAEG;QACO,eAAU,GAAc,EAAE,CAAC;QAErC;;WAEG;QACO,uBAAkB,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAElE;;WAEG;QACO,mBAAc,GAAmB,IAAI,OAAO,EAAS,CAAC;QAEhE;;WAEG;QACO,qBAAgB,GAAmB,IAAI,OAAO,EAAS,CAAC;QAsBlE;;WAEG;QACO,mBAAc,GAAsB,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAExE;;WAEG;QACO,YAAO,GAAmB,MAAM,CAAC,QAAQ,CAAC,CAAC;QAkErD;;WAEG;QACI,eAAU,GAAY,KAAK,CAAC;QAEnC;;WAEG;QACI,iBAAY,GAAY,KAAK,CAAC;IAqHzC,CAAC;IAtLG;;OAEG;IACH,IAAW,OAAO;;QAEd,OAAO,MAAA,IAAI,CAAC,WAAW,0CAAE,KAAK,CAAC;IACnC,CAAC;IACD,IAAW,OAAO,CAAC,KAA2B;QAE1C,IAAG,CA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OAAO;SACV;QAED,IAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAC7B;YACI,IAAG,MAAA,IAAI,CAAC,KAAK,0CAAE,OAAO,EAAE,EACxB;gBACI,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;gBACzB,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;gBAEtF,IAAG,IAAI,EACP;oBACI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;iBACtB;aACJ;SACJ;aAED;YACI,qBAAqB;SACxB;IACL,CAAC;CACJ","sourcesContent":["import {ChangeDetectorRef, inject} from '@angular/core';\nimport {Observable, Subject} from 'rxjs';\n\nimport {PeriodData} from '../../../legacy/picker/interfaces';\nimport {DATE_API} from '../../../misc/tokens';\nimport {DateTimeObjectValue} from '../../../misc/types';\nimport {DateApi, DateApiObject} from '../../../services';\nimport {DateTimePicker} from '../interfaces';\n\n/**\n * Base abstract class for each date time period picker\n */\nexport abstract class DateTimePeriodPickerBase<TPeriod extends PeriodData<TDate>, TDate = unknown> implements DateTimePicker<TDate>\n{\n //######################### protected properties #########################\n\n /**\n * Array of period data to be displayed\n */\n protected periodData: TPeriod[] = [];\n\n /**\n * Subject used for emitting of value changes\n */\n protected valueChangeSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subject used for scaling up\n */\n protected scaleUpSubject: Subject<TDate> = new Subject<TDate>();\n\n /**\n * Subject used for scaling down\n */\n protected scaleDownSubject: Subject<TDate> = new Subject<TDate>();\n\n /**\n * Date api instance for displayed date\n */\n protected displayDate: DateApiObject<TDate>|undefined|null;\n\n /**\n * Currently displayed date\n */\n protected displayedDate: TDate|undefined|null;\n\n /**\n * Date api instance for max date\n */\n protected maxDateObj: DateApiObject<TDate>|undefined|null;\n\n /**\n * Date api instance for min date\n */\n protected minDateObj: DateApiObject<TDate>|undefined|null;\n\n /**\n * Change detector instance\n */\n protected changeDetector: ChangeDetectorRef = inject(ChangeDetectorRef);\n\n /**\n * Instance of date api for manipulation with date time\n */\n protected dateApi: DateApi<TDate> = inject(DATE_API);\n\n //######################### public properties - implementation of DateTimePicker #########################\n\n /**\n * @inheritdoc\n */\n public value: DateTimeObjectValue<TDate>|undefined|null;\n\n /**\n * @inheritdoc\n */\n public get display(): TDate|undefined|null\n {\n return this.displayDate?.value;\n }\n public set display(value: TDate|undefined|null)\n {\n if(!value)\n {\n this.displayDate = null;\n\n return;\n }\n\n this.displayDate = this.dateApi.getValue(value);\n }\n\n /**\n * @inheritdoc\n */\n public get maxDate(): TDate|undefined|null\n {\n return this.maxDateObj?.value;\n }\n public set maxDate(value: TDate|undefined|null)\n {\n if(!value)\n {\n this.maxDateObj = null;\n\n return;\n }\n\n this.maxDateObj = this.dateApi.getValue(value);\n }\n\n /**\n * @inheritdoc\n */\n public get minDate(): TDate|undefined|null\n {\n return this.minDateObj?.value;\n }\n public set minDate(value: TDate|undefined|null)\n {\n if(!value)\n {\n this.minDateObj = null;\n\n return;\n }\n\n this.minDateObj = this.dateApi.getValue(value);\n }\n\n /**\n * @inheritdoc\n */\n public canScaleUp: boolean = false;\n\n /**\n * @inheritdoc\n */\n public canScaleDown: boolean = false;\n\n /**\n * @inheritdoc\n */\n public get valueChange(): Observable<void>\n {\n return this.valueChangeSubject.asObservable();\n }\n\n /**\n * @inheritdoc\n */\n public get scaleUp(): Observable<TDate>\n {\n return this.scaleUpSubject.asObservable();\n }\n\n /**\n * @inheritdoc\n */\n public get scaleDown(): Observable<TDate>\n {\n return this.scaleDownSubject.asObservable();\n }\n\n //######################### public methods - implementation of invalidatable #########################\n\n /**\n * @inheritdoc\n */\n public invalidateVisuals(): void\n {\n this.onRender();\n\n this.changeDetector.detectChanges();\n }\n\n //######################### protected methods #########################\n\n /**\n * Method that is being called to render changes\n */\n protected abstract onRender(): void;\n\n /**\n * Tests whether provided value is in same period target value\n * @param val - Tested value\n * @param target - Target value to be tested against\n */\n protected abstract isSamePeriod(val: DateApiObject<TDate>, target: TDate): boolean;\n\n /**\n * Updates minimal and maximal value for picker\n */\n protected updateMinMax(): void\n {\n if(!this.periodData.length)\n {\n return;\n }\n\n //no min, no max\n if(!this.minDateObj && !this.maxDateObj)\n {\n this.periodData.forEach(itm => itm.disabled = false);\n\n return;\n }\n\n let restAfter = false;\n\n for(const period of this.periodData)\n {\n if(this.minDateObj?.isValid() && this.minDateObj.isAfter(period.dateObj.value) && !this.isSamePeriod(this.minDateObj, period.dateObj.value))\n {\n period.disabled = true;\n }\n\n if(restAfter || (this.maxDateObj?.isValid() && this.maxDateObj.isBefore(period.dateObj.value) && !this.isSamePeriod(this.maxDateObj, period.dateObj.value)))\n {\n restAfter = true;\n period.disabled = true;\n }\n }\n }\n\n /**\n * Sets active date\n */\n protected setActive(): void\n {\n this.periodData.forEach(itm => itm.active = false);\n\n if(!this.value)\n {\n return;\n }\n \n if(!Array.isArray(this.value))\n {\n if(this.value?.isValid())\n {\n const value = this.value;\n const data = this.periodData.find(itm => this.isSamePeriod(itm.dateObj, value.value));\n\n if(data)\n {\n data.active = true;\n }\n }\n }\n else\n {\n //TODO: support range\n }\n }\n}"]}
|