@anglr/datetime 6.0.0 → 6.1.0-beta.20230104111018
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 +19 -0
- package/es2015/src/directives/datePickerInput/datePickerInput.directive.js +37 -0
- package/es2015/src/directives/datePickerInput/datePickerInput.directive.js.map +1 -0
- package/es2015/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js +325 -0
- package/es2015/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js.map +1 -0
- package/es2015/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js +29 -0
- package/es2015/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js.map +1 -0
- package/es2015/src/directives/index.js +4 -0
- package/es2015/src/directives/index.js.map +1 -1
- package/es2015/src/directives/withNow/withNow.directive.js +44 -0
- package/es2015/src/directives/withNow/withNow.directive.js.map +1 -0
- package/es2015/src/directives/withToday/withToday.directive.js +6 -6
- package/es2015/src/directives/withToday/withToday.directive.js.map +1 -1
- package/es2015/src/misc/utils.js +52 -0
- package/es2015/src/misc/utils.js.map +1 -1
- package/es2015/src/modules/dateTime/directives/dateTime/dateTime.directive.js +32 -12
- package/es2015/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -1
- package/es2020/src/directives/datePickerInput/datePickerInput.directive.js +37 -0
- package/es2020/src/directives/datePickerInput/datePickerInput.directive.js.map +1 -0
- package/es2020/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js +322 -0
- package/es2020/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js.map +1 -0
- package/es2020/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js +29 -0
- package/es2020/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js.map +1 -0
- package/es2020/src/directives/index.js +4 -0
- package/es2020/src/directives/index.js.map +1 -1
- package/es2020/src/directives/withNow/withNow.directive.js +44 -0
- package/es2020/src/directives/withNow/withNow.directive.js.map +1 -0
- package/es2020/src/directives/withToday/withToday.directive.js +6 -6
- package/es2020/src/directives/withToday/withToday.directive.js.map +1 -1
- package/es2020/src/misc/utils.js +52 -0
- package/es2020/src/misc/utils.js.map +1 -1
- package/es2020/src/modules/dateTime/directives/dateTime/dateTime.directive.js +32 -12
- package/es2020/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -1
- package/package.json +1 -1
- package/src/directives/datePickerInput/datePickerInput.directive.d.ts +12 -0
- package/src/directives/datePickerInput/datePickerInput.directive.d.ts.map +1 -0
- package/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.d.ts +86 -0
- package/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.d.ts.map +1 -0
- package/src/directives/dateTimePickerInput/dateTimePickerInput.directive.d.ts +11 -0
- package/src/directives/dateTimePickerInput/dateTimePickerInput.directive.d.ts.map +1 -0
- package/src/directives/index.d.ts +4 -0
- package/src/directives/index.d.ts.map +1 -1
- package/src/directives/withNow/withNow.directive.d.ts +22 -0
- package/src/directives/withNow/withNow.directive.d.ts.map +1 -0
- package/src/directives/withToday/withToday.directive.d.ts +3 -2
- package/src/directives/withToday/withToday.directive.d.ts.map +1 -1
- package/src/misc/utils.d.ts +18 -1
- package/src/misc/utils.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts +19 -6
- package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts.map +1 -1
- package/version.bak +1 -1
- package/es2015/src/legacy/selector/components/inputDateTime/inputDateTime.component.js +0 -488
- package/es2015/src/legacy/selector/components/inputDateTime/inputDateTime.component.js.map +0 -1
- package/es2015/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +0 -367
- package/es2015/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js.map +0 -1
- package/es2020/src/legacy/selector/components/inputDateTime/inputDateTime.component.js +0 -488
- package/es2020/src/legacy/selector/components/inputDateTime/inputDateTime.component.js.map +0 -1
- package/es2020/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +0 -367
- package/es2020/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js.map +0 -1
- package/src/legacy/selector/components/inputDateTime/inputDateTime.component.css +0 -9
- package/src/legacy/selector/components/inputDateTime/inputDateTime.component.d.ts +0 -1
- package/src/legacy/selector/components/inputDateTime/inputDateTime.component.d.ts.map +0 -1
- package/src/legacy/selector/components/inputDateTime/inputDateTime.component.html +0 -10
- package/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.css +0 -9
- package/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.d.ts +0 -1
- package/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.d.ts.map +0 -1
- package/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.html +0 -9
|
@@ -1,488 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef, ElementRef, ViewChild} from '@angular/core';
|
|
3
|
-
// import {isPresent} from '@jscrpt/common';
|
|
4
|
-
// import {Observable, Subject} from 'rxjs';
|
|
5
|
-
// import {DateTimeValue} from '../../../../interfaces/dateTime/datetime.interface';
|
|
6
|
-
// import {DATE_API} from '../../../../misc/tokens';
|
|
7
|
-
// import {DateApi, DateApiObject, DatePositionParser, DatePositionParserService, DateValueProvider} from '../../../../services';
|
|
8
|
-
// import {DateTimeSelector} from '../../misc/datetimeSelector.interface';
|
|
9
|
-
// /**
|
|
10
|
-
// * Component used as datetime selector with input
|
|
11
|
-
// */
|
|
12
|
-
// @Component(
|
|
13
|
-
// {
|
|
14
|
-
// selector: 'input-date-time-selector',
|
|
15
|
-
// templateUrl: 'inputDateTime.component.html',
|
|
16
|
-
// styleUrls: ['inputDateTime.component.css'],
|
|
17
|
-
// changeDetection: ChangeDetectionStrategy.OnPush
|
|
18
|
-
// })
|
|
19
|
-
// export class InputDateTimeSelectorComponent<TDate = any> implements DateTimeSelector<TDate>
|
|
20
|
-
// {
|
|
21
|
-
// //######################### protected fields #########################
|
|
22
|
-
// /**
|
|
23
|
-
// * Occurs when value changes
|
|
24
|
-
// */
|
|
25
|
-
// protected _valueChange: Subject<void> = new Subject<void>();
|
|
26
|
-
// /**
|
|
27
|
-
// * Occurs when selector is touched by user
|
|
28
|
-
// */
|
|
29
|
-
// protected _touched: Subject<void> = new Subject<void>();
|
|
30
|
-
// /**
|
|
31
|
-
// * Occurs when selector requires picker to be displayed or hidden
|
|
32
|
-
// */
|
|
33
|
-
// protected _pickerRequest: Subject<boolean> = new Subject<boolean>();
|
|
34
|
-
// /**
|
|
35
|
-
// * Instance of parser created for specific format
|
|
36
|
-
// */
|
|
37
|
-
// protected _parser: DatePositionParser|null = null;
|
|
38
|
-
// /**
|
|
39
|
-
// * Currently used format for displaying data
|
|
40
|
-
// */
|
|
41
|
-
// protected _format: string = '';
|
|
42
|
-
// /**
|
|
43
|
-
// * Current value representation as date api wrapper
|
|
44
|
-
// */
|
|
45
|
-
// protected _dateApiValue: null|DateApiObject<TDate> = null;
|
|
46
|
-
// /**
|
|
47
|
-
// * Indication whether is current value valid value
|
|
48
|
-
// */
|
|
49
|
-
// protected _isValid: boolean = true;
|
|
50
|
-
// /**
|
|
51
|
-
// * Minimal possible value that can be picked
|
|
52
|
-
// */
|
|
53
|
-
// protected _minValue: TDate|null = null;
|
|
54
|
-
// /**
|
|
55
|
-
// * Maximal possible value that can be picked
|
|
56
|
-
// */
|
|
57
|
-
// protected _maxValue: TDate|null = null;
|
|
58
|
-
// //######################### public properties - implementation of DateTimeSelector #########################
|
|
59
|
-
// /**
|
|
60
|
-
// * Gets or sets currently used format for displaying data
|
|
61
|
-
// */
|
|
62
|
-
// public get format(): string
|
|
63
|
-
// {
|
|
64
|
-
// return this._format;
|
|
65
|
-
// }
|
|
66
|
-
// public set format(value: string)
|
|
67
|
-
// {
|
|
68
|
-
// if(isPresent(value))
|
|
69
|
-
// {
|
|
70
|
-
// value = this._dateApi.getFormat(value);
|
|
71
|
-
// }
|
|
72
|
-
// //only if format changes
|
|
73
|
-
// if(this._format != value)
|
|
74
|
-
// {
|
|
75
|
-
// this._parser = this._parserSvc.createParser(this._dateApi.getFormat(value));
|
|
76
|
-
// }
|
|
77
|
-
// this._format = value;
|
|
78
|
-
// }
|
|
79
|
-
// /**
|
|
80
|
-
// * Gets or sets placeholder that is displayed when there is no value selected
|
|
81
|
-
// */
|
|
82
|
-
// public placeholder: string|null = null;
|
|
83
|
-
// /**
|
|
84
|
-
// * Gets current value of datetime
|
|
85
|
-
// */
|
|
86
|
-
// public get value(): DateTimeValue<TDate>|null
|
|
87
|
-
// {
|
|
88
|
-
// if(!this._dateApiValue || !this._isValid)
|
|
89
|
-
// {
|
|
90
|
-
// return null;
|
|
91
|
-
// }
|
|
92
|
-
// return this._valueProvider.getValue(this._dateApiValue.value, this._format);
|
|
93
|
-
// }
|
|
94
|
-
// /**
|
|
95
|
-
// * Gets formatted value
|
|
96
|
-
// */
|
|
97
|
-
// public get formattedValue(): string|null
|
|
98
|
-
// {
|
|
99
|
-
// if(!this._isValid)
|
|
100
|
-
// {
|
|
101
|
-
// return null;
|
|
102
|
-
// }
|
|
103
|
-
// return this.currentValue;
|
|
104
|
-
// }
|
|
105
|
-
// /**
|
|
106
|
-
// * Gets indication whether is current value valid
|
|
107
|
-
// */
|
|
108
|
-
// public get valid(): boolean
|
|
109
|
-
// {
|
|
110
|
-
// return this._isValid;
|
|
111
|
-
// }
|
|
112
|
-
// /**
|
|
113
|
-
// * Occurs when value changes
|
|
114
|
-
// */
|
|
115
|
-
// public get valueChange(): Observable<void>
|
|
116
|
-
// {
|
|
117
|
-
// return this._valueChange.asObservable();
|
|
118
|
-
// }
|
|
119
|
-
// /**
|
|
120
|
-
// * Occurs when selector is touched by user
|
|
121
|
-
// */
|
|
122
|
-
// public get touched(): Observable<void>
|
|
123
|
-
// {
|
|
124
|
-
// return this._touched.asObservable();
|
|
125
|
-
// }
|
|
126
|
-
// /**
|
|
127
|
-
// * Occurs when selector requires picker to be displayed
|
|
128
|
-
// */
|
|
129
|
-
// public get pickerRequest(): Observable<boolean>
|
|
130
|
-
// {
|
|
131
|
-
// return this._pickerRequest.asObservable();
|
|
132
|
-
// }
|
|
133
|
-
// //######################### public properties - template bindings #########################
|
|
134
|
-
// /**
|
|
135
|
-
// * Indication whether is input disabled
|
|
136
|
-
// * @internal
|
|
137
|
-
// */
|
|
138
|
-
// public disabled: boolean = false;
|
|
139
|
-
// //######################### public properties - children #########################
|
|
140
|
-
// /**
|
|
141
|
-
// * Instance of html input element
|
|
142
|
-
// * @internal
|
|
143
|
-
// */
|
|
144
|
-
// @ViewChild('input', {static: true})
|
|
145
|
-
// public inputElement!: ElementRef<HTMLInputElement>;
|
|
146
|
-
// //######################### protected properties #########################
|
|
147
|
-
// /**
|
|
148
|
-
// * Gets or sets string representation current of value
|
|
149
|
-
// */
|
|
150
|
-
// protected get currentValue(): string|null
|
|
151
|
-
// {
|
|
152
|
-
// return this.input.value || null;
|
|
153
|
-
// }
|
|
154
|
-
// protected set currentValue(value: string|null)
|
|
155
|
-
// {
|
|
156
|
-
// if(this.input)
|
|
157
|
-
// {
|
|
158
|
-
// this.input.value = value ?? '';
|
|
159
|
-
// }
|
|
160
|
-
// }
|
|
161
|
-
// /**
|
|
162
|
-
// * Gets input element used for handling date time value
|
|
163
|
-
// */
|
|
164
|
-
// protected get input(): HTMLInputElement
|
|
165
|
-
// {
|
|
166
|
-
// return this.inputElement.nativeElement;
|
|
167
|
-
// }
|
|
168
|
-
// //######################### constructor #########################
|
|
169
|
-
// constructor(@Inject(DATE_API) protected _dateApi: DateApi<TDate>,
|
|
170
|
-
// protected _parserSvc: DatePositionParserService,
|
|
171
|
-
// protected _valueProvider: DateValueProvider<TDate>,
|
|
172
|
-
// protected _changeDetector: ChangeDetectorRef)
|
|
173
|
-
// {
|
|
174
|
-
// }
|
|
175
|
-
// //######################### public methods - implementation of DateTimeSelector #########################
|
|
176
|
-
// /**
|
|
177
|
-
// * Sets minimal possible value for picker, that can be picked
|
|
178
|
-
// * @param value - Minimal possible value that can be picked
|
|
179
|
-
// */
|
|
180
|
-
// public setMinValue(value: TDate|null): void
|
|
181
|
-
// {
|
|
182
|
-
// this._minValue = value;
|
|
183
|
-
// }
|
|
184
|
-
// /**
|
|
185
|
-
// * Sets maximal possible value for picker, that can be picked
|
|
186
|
-
// * @param value - Maximal possible value that can be picked
|
|
187
|
-
// */
|
|
188
|
-
// public setMaxValue(value: TDate|null): void
|
|
189
|
-
// {
|
|
190
|
-
// this._maxValue = value;
|
|
191
|
-
// }
|
|
192
|
-
// /**
|
|
193
|
-
// * Sets value of datetime selector
|
|
194
|
-
// * @param value - Value to be set to this selector
|
|
195
|
-
// */
|
|
196
|
-
// public setValue(value: DateTimeValue<TDate>|null): void
|
|
197
|
-
// {
|
|
198
|
-
// if(value?.from)
|
|
199
|
-
// {
|
|
200
|
-
// this._dateApiValue = this._dateApi.getValue(value?.from, this._format);
|
|
201
|
-
// this._isValid = this._dateApiValue.isValid();
|
|
202
|
-
// this._show();
|
|
203
|
-
// }
|
|
204
|
-
// else
|
|
205
|
-
// {
|
|
206
|
-
// this._clearValue();
|
|
207
|
-
// }
|
|
208
|
-
// }
|
|
209
|
-
// /**
|
|
210
|
-
// * Sets as 'control' disabled
|
|
211
|
-
// * @param disabled - Indication whether sets value as disabled, if omitted it is same as disabled set to true
|
|
212
|
-
// */
|
|
213
|
-
// public setDisabled(disabled: boolean = true): void
|
|
214
|
-
// {
|
|
215
|
-
// this.disabled = disabled;
|
|
216
|
-
// }
|
|
217
|
-
// /**
|
|
218
|
-
// * Explicitly runs invalidation of content (change detection)
|
|
219
|
-
// */
|
|
220
|
-
// public invalidateVisuals(): void
|
|
221
|
-
// {
|
|
222
|
-
// this._changeDetector.detectChanges();
|
|
223
|
-
// }
|
|
224
|
-
// //######################### public methods - template bindings #########################
|
|
225
|
-
// /**
|
|
226
|
-
// * Handles gaining of focus
|
|
227
|
-
// * @internal
|
|
228
|
-
// */
|
|
229
|
-
// public handleFocus(): void
|
|
230
|
-
// {
|
|
231
|
-
// this._pickerRequest.next(true);
|
|
232
|
-
// //no value
|
|
233
|
-
// if(!this._dateApiValue)
|
|
234
|
-
// {
|
|
235
|
-
// this._dateApiValue = this._dateApi.now();
|
|
236
|
-
// this._isValid = this._dateApiValue.isValid();
|
|
237
|
-
// if(this._minMaxConstraintTest())
|
|
238
|
-
// {
|
|
239
|
-
// this._clearValue();
|
|
240
|
-
// }
|
|
241
|
-
// else
|
|
242
|
-
// {
|
|
243
|
-
// this._valueChange.next();
|
|
244
|
-
// }
|
|
245
|
-
// }
|
|
246
|
-
// if(!this._isValid)
|
|
247
|
-
// {
|
|
248
|
-
// return;
|
|
249
|
-
// }
|
|
250
|
-
// this._show();
|
|
251
|
-
// const result = this._parser!.parse(this.currentValue!, this.input.selectionStart!);
|
|
252
|
-
// this.input.selectionStart = result.positionFrom;
|
|
253
|
-
// this.input.selectionEnd = result.positionTo;
|
|
254
|
-
// }
|
|
255
|
-
// /**
|
|
256
|
-
// * Handles blur on input
|
|
257
|
-
// * @internal
|
|
258
|
-
// */
|
|
259
|
-
// public handleBlur(): void
|
|
260
|
-
// {
|
|
261
|
-
// this._pickerRequest.next(false);
|
|
262
|
-
// }
|
|
263
|
-
// /**
|
|
264
|
-
// * Handles user input
|
|
265
|
-
// * @internal
|
|
266
|
-
// */
|
|
267
|
-
// public handleInput(): void
|
|
268
|
-
// {
|
|
269
|
-
// //empty value
|
|
270
|
-
// if(!this.currentValue)
|
|
271
|
-
// {
|
|
272
|
-
// this._clearValue();
|
|
273
|
-
// this._valueChange.next();
|
|
274
|
-
// return;
|
|
275
|
-
// }
|
|
276
|
-
// this._dateApiValue = this._dateApi.getValue(this.currentValue, this._format);
|
|
277
|
-
// this._isValid = this._dateApiValue.isValid();
|
|
278
|
-
// this._valueChange.next();
|
|
279
|
-
// }
|
|
280
|
-
// /**
|
|
281
|
-
// * Handles selection of text inside of input
|
|
282
|
-
// * @internal
|
|
283
|
-
// */
|
|
284
|
-
// public handleSelect(): void
|
|
285
|
-
// {
|
|
286
|
-
// //handles when all text is selected
|
|
287
|
-
// if(this.currentValue && this.input.selectionStart == 0 && this.input.selectionEnd == this.input.value.length)
|
|
288
|
-
// {
|
|
289
|
-
// const result = this._parser!.parse(this.input.value, this.input.selectionStart!);
|
|
290
|
-
// this.input.selectionStart = result.positionFrom;
|
|
291
|
-
// this.input.selectionEnd = result.positionTo;
|
|
292
|
-
// }
|
|
293
|
-
// }
|
|
294
|
-
// /**
|
|
295
|
-
// * Handles click event inside of input
|
|
296
|
-
// * @internal
|
|
297
|
-
// */
|
|
298
|
-
// public handleClick(): void
|
|
299
|
-
// {
|
|
300
|
-
// this._pickerRequest.next(true);
|
|
301
|
-
// if(!this._dateApiValue)
|
|
302
|
-
// {
|
|
303
|
-
// return;
|
|
304
|
-
// }
|
|
305
|
-
// const result = this._parser!.parse(this.input.value, this.input.selectionStart!);
|
|
306
|
-
// this.input.selectionStart = result.positionFrom;
|
|
307
|
-
// this.input.selectionEnd = result.positionTo;
|
|
308
|
-
// }
|
|
309
|
-
// /**
|
|
310
|
-
// * Handles keyboard events
|
|
311
|
-
// * @param event - Keyboard event that occured
|
|
312
|
-
// * @param input - Html input element that holds current value and selection
|
|
313
|
-
// * @internal
|
|
314
|
-
// */
|
|
315
|
-
// public handleKeyboard(event: KeyboardEvent): void
|
|
316
|
-
// {
|
|
317
|
-
// if(!this._dateApiValue?.isValid())
|
|
318
|
-
// {
|
|
319
|
-
// return;
|
|
320
|
-
// }
|
|
321
|
-
// switch(event.key)
|
|
322
|
-
// {
|
|
323
|
-
// case 'ArrowRight':
|
|
324
|
-
// case 'ArrowLeft':
|
|
325
|
-
// {
|
|
326
|
-
// event.preventDefault();
|
|
327
|
-
// event.stopPropagation();
|
|
328
|
-
// const result = event.key == 'ArrowLeft' ? this._parser!.previous(this.input.value, this.input.selectionStart!) : this._parser!.next(this.input.value, this.input.selectionStart!);
|
|
329
|
-
// if(result)
|
|
330
|
-
// {
|
|
331
|
-
// this.input.selectionStart = result.positionFrom;
|
|
332
|
-
// this.input.selectionEnd = result.positionTo;
|
|
333
|
-
// }
|
|
334
|
-
// break;
|
|
335
|
-
// }
|
|
336
|
-
// case 'ArrowUp':
|
|
337
|
-
// case 'ArrowDown':
|
|
338
|
-
// {
|
|
339
|
-
// event.preventDefault();
|
|
340
|
-
// event.stopPropagation();
|
|
341
|
-
// let result = this._parser!.parse(this.input.value, this.input.selectionStart!);
|
|
342
|
-
// const selectionStart = result.positionFrom;
|
|
343
|
-
// this._stepChangeValue(result.part, event.key == 'ArrowUp');
|
|
344
|
-
// this._show();
|
|
345
|
-
// result = this._parser!.parse(this.input.value, selectionStart);
|
|
346
|
-
// this.input.selectionStart = result.positionFrom;
|
|
347
|
-
// this.input.selectionEnd = result.positionTo;
|
|
348
|
-
// break;
|
|
349
|
-
// }
|
|
350
|
-
// case 'Tab':
|
|
351
|
-
// {
|
|
352
|
-
// const result = event.shiftKey ? this._parser!.previous(this.input.value, this.input.selectionStart!) : this._parser!.next(this.input.value, this.input.selectionStart!);
|
|
353
|
-
// if(result)
|
|
354
|
-
// {
|
|
355
|
-
// event.preventDefault();
|
|
356
|
-
// event.stopPropagation();
|
|
357
|
-
// this.input.selectionStart = result.positionFrom;
|
|
358
|
-
// this.input.selectionEnd = result.positionTo;
|
|
359
|
-
// }
|
|
360
|
-
// break;
|
|
361
|
-
// }
|
|
362
|
-
// case 'a':
|
|
363
|
-
// {
|
|
364
|
-
// if(event.ctrlKey)
|
|
365
|
-
// {
|
|
366
|
-
// event.preventDefault();
|
|
367
|
-
// event.stopPropagation();
|
|
368
|
-
// }
|
|
369
|
-
// break;
|
|
370
|
-
// }
|
|
371
|
-
// case 'Backspace':
|
|
372
|
-
// {
|
|
373
|
-
// this._clearValue();
|
|
374
|
-
// this._valueChange.next();
|
|
375
|
-
// break;
|
|
376
|
-
// }
|
|
377
|
-
// case 'Escape':
|
|
378
|
-
// {
|
|
379
|
-
// this._pickerRequest.next(false);
|
|
380
|
-
// break;
|
|
381
|
-
// }
|
|
382
|
-
// case ' ':
|
|
383
|
-
// {
|
|
384
|
-
// if(event.ctrlKey)
|
|
385
|
-
// {
|
|
386
|
-
// this._pickerRequest.next(true);
|
|
387
|
-
// }
|
|
388
|
-
// break;
|
|
389
|
-
// }
|
|
390
|
-
// }
|
|
391
|
-
// }
|
|
392
|
-
// //######################### protected methods #########################
|
|
393
|
-
// /**
|
|
394
|
-
// * Shows current value in input
|
|
395
|
-
// */
|
|
396
|
-
// protected _show(): void
|
|
397
|
-
// {
|
|
398
|
-
// if(this._isValid)
|
|
399
|
-
// {
|
|
400
|
-
// this.currentValue = this._dateApiValue?.format(this._format) ?? null;
|
|
401
|
-
// }
|
|
402
|
-
// }
|
|
403
|
-
// /**
|
|
404
|
-
// * Tests whether are min or max constraint broken, returns true if constraint is broken
|
|
405
|
-
// */
|
|
406
|
-
// protected _minMaxConstraintTest(): boolean
|
|
407
|
-
// {
|
|
408
|
-
// return (!!this._minValue && this._dateApiValue!.isBefore(this._minValue)) ||
|
|
409
|
-
// (!!this._maxValue && this._dateApiValue!.isAfter(this._maxValue));
|
|
410
|
-
// }
|
|
411
|
-
// /**
|
|
412
|
-
// * Runs code with check whether min max constrains was broken
|
|
413
|
-
// * @param code - Code that should be executed which can change current value
|
|
414
|
-
// */
|
|
415
|
-
// protected _withMinMaxConstraint(code: () => void): void
|
|
416
|
-
// {
|
|
417
|
-
// this._dateApiValue!.updateOriginal();
|
|
418
|
-
// code();
|
|
419
|
-
// //min value constraint failure
|
|
420
|
-
// if(this._minMaxConstraintTest())
|
|
421
|
-
// {
|
|
422
|
-
// this._dateApiValue?.resetOriginal();
|
|
423
|
-
// return;
|
|
424
|
-
// }
|
|
425
|
-
// this._valueChange.next();
|
|
426
|
-
// }
|
|
427
|
-
// /**
|
|
428
|
-
// * Clears current value
|
|
429
|
-
// */
|
|
430
|
-
// protected _clearValue(): void
|
|
431
|
-
// {
|
|
432
|
-
// this._dateApiValue = null;
|
|
433
|
-
// this._isValid = true;
|
|
434
|
-
// this.currentValue = null;
|
|
435
|
-
// }
|
|
436
|
-
// /**
|
|
437
|
-
// * Changes current value of date for for specified part by single step
|
|
438
|
-
// * @param part - Part of date that should be changed
|
|
439
|
-
// * @param increment - Indication whether value should be incremented or decremented
|
|
440
|
-
// */
|
|
441
|
-
// protected _stepChangeValue(part: string, increment: boolean): void
|
|
442
|
-
// {
|
|
443
|
-
// if(!this._dateApiValue?.isValid())
|
|
444
|
-
// {
|
|
445
|
-
// return;
|
|
446
|
-
// }
|
|
447
|
-
// switch(part)
|
|
448
|
-
// {
|
|
449
|
-
// case 'y':
|
|
450
|
-
// case 'Y':
|
|
451
|
-
// {
|
|
452
|
-
// this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addYears(1) : this._dateApiValue!.subtractYears(1));
|
|
453
|
-
// break;
|
|
454
|
-
// }
|
|
455
|
-
// case 'Q':
|
|
456
|
-
// {
|
|
457
|
-
// break;
|
|
458
|
-
// }
|
|
459
|
-
// case 'M':
|
|
460
|
-
// {
|
|
461
|
-
// this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addMonths(1) : this._dateApiValue!.subtractMonths(1));
|
|
462
|
-
// break;
|
|
463
|
-
// }
|
|
464
|
-
// case 'w':
|
|
465
|
-
// {
|
|
466
|
-
// this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addWeeks(1) : this._dateApiValue!.subtractWeeks(1));
|
|
467
|
-
// break;
|
|
468
|
-
// }
|
|
469
|
-
// case 'd':
|
|
470
|
-
// case 'D':
|
|
471
|
-
// {
|
|
472
|
-
// this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addDays(1) : this._dateApiValue!.subtractDays(1));
|
|
473
|
-
// break;
|
|
474
|
-
// }
|
|
475
|
-
// case 'H':
|
|
476
|
-
// {
|
|
477
|
-
// this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addHours(1) : this._dateApiValue!.subtractHours(1));
|
|
478
|
-
// break;
|
|
479
|
-
// }
|
|
480
|
-
// case 'm':
|
|
481
|
-
// {
|
|
482
|
-
// this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addMinutes(1) : this._dateApiValue!.subtractMinutes(1));
|
|
483
|
-
// break;
|
|
484
|
-
// }
|
|
485
|
-
// }
|
|
486
|
-
// }
|
|
487
|
-
// }
|
|
488
|
-
//# sourceMappingURL=inputDateTime.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inputDateTime.component.js","sourceRoot":"","sources":["../../../../../../src/legacy/selector/components/inputDateTime/inputDateTime.component.ts"],"names":[],"mappings":";AAAA,sHAAsH;AACtH,4CAA4C;AAC5C,4CAA4C;AAE5C,oFAAoF;AACpF,oDAAoD;AACpD,iIAAiI;AACjI,0EAA0E;AAE1E,MAAM;AACN,oDAAoD;AACpD,MAAM;AACN,cAAc;AACd,IAAI;AACJ,4CAA4C;AAC5C,mDAAmD;AACnD,kDAAkD;AAClD,sDAAsD;AACtD,KAAK;AACL,8FAA8F;AAC9F,IAAI;AACJ,6EAA6E;AAE7E,UAAU;AACV,mCAAmC;AACnC,UAAU;AACV,mEAAmE;AAEnE,UAAU;AACV,iDAAiD;AACjD,UAAU;AACV,+DAA+D;AAE/D,UAAU;AACV,wEAAwE;AACxE,UAAU;AACV,2EAA2E;AAE3E,UAAU;AACV,wDAAwD;AACxD,UAAU;AACV,yDAAyD;AAEzD,UAAU;AACV,mDAAmD;AACnD,UAAU;AACV,sCAAsC;AAEtC,UAAU;AACV,0DAA0D;AAC1D,UAAU;AACV,iEAAiE;AAEjE,UAAU;AACV,yDAAyD;AACzD,UAAU;AACV,0CAA0C;AAE1C,UAAU;AACV,mDAAmD;AACnD,UAAU;AACV,8CAA8C;AAE9C,UAAU;AACV,mDAAmD;AACnD,UAAU;AACV,8CAA8C;AAE9C,mHAAmH;AAEnH,UAAU;AACV,gEAAgE;AAChE,UAAU;AACV,kCAAkC;AAClC,QAAQ;AACR,+BAA+B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Z,oCAAoC;AACpC,QAAQ;AAER,UAAU;AACV,8BAA8B;AAC9B,UAAU;AACV,oCAAoC;AACpC,QAAQ;AACR,qCAAqC;AACrC,gCAAgC;AAChC,oCAAoC;AACpC,QAAQ;AAER,UAAU;AACV,6EAA6E;AAC7E,2DAA2D;AAC3D,0FAA0F;AAC1F,UAAU;AACV,yEAAyE;AACzE,QAAQ;AACR,6CAA6C;AAC7C,YAAY;AACZ,sBAAsB;AACtB,YAAY;AAEZ,uBAAuB;AACvB,YAAY;AACZ,wBAAwB;AACxB,wBAAwB;AACxB,gBAAgB;AAChB,wIAAwI;AAExI,yBAAyB;AACzB,gBAAgB;AAChB,wBAAwB;AACxB,gBAAgB;AAChB,yBAAyB;AACzB,gBAAgB;AAChB,wBAAwB;AACxB,gBAAgB;AAChB,0IAA0I;AAE1I,yBAAyB;AACzB,gBAAgB;AAChB,wBAAwB;AACxB,gBAAgB;AAChB,wIAAwI;AAExI,yBAAyB;AACzB,gBAAgB;AAChB,wBAAwB;AACxB,wBAAwB;AACxB,gBAAgB;AAChB,sIAAsI;AAEtI,yBAAyB;AACzB,gBAAgB;AAChB,wBAAwB;AACxB,gBAAgB;AAChB,wIAAwI;AAExI,yBAAyB;AACzB,gBAAgB;AAChB,wBAAwB;AACxB,gBAAgB;AAChB,4IAA4I;AAE5I,yBAAyB;AACzB,gBAAgB;AAChB,YAAY;AACZ,QAAQ;AACR,IAAI","sourcesContent":["// import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef, ElementRef, ViewChild} from '@angular/core';\n// import {isPresent} from '@jscrpt/common';\n// import {Observable, Subject} from 'rxjs';\n\n// import {DateTimeValue} from '../../../../interfaces/dateTime/datetime.interface';\n// import {DATE_API} from '../../../../misc/tokens';\n// import {DateApi, DateApiObject, DatePositionParser, DatePositionParserService, DateValueProvider} from '../../../../services';\n// import {DateTimeSelector} from '../../misc/datetimeSelector.interface';\n\n// /**\n// * Component used as datetime selector with input\n// */\n// @Component(\n// {\n// selector: 'input-date-time-selector',\n// templateUrl: 'inputDateTime.component.html',\n// styleUrls: ['inputDateTime.component.css'],\n// changeDetection: ChangeDetectionStrategy.OnPush\n// })\n// export class InputDateTimeSelectorComponent<TDate = any> implements DateTimeSelector<TDate>\n// {\n// //######################### protected fields #########################\n\n// /**\n// * Occurs when value changes\n// */\n// protected _valueChange: Subject<void> = new Subject<void>();\n\n// /**\n// * Occurs when selector is touched by user\n// */\n// protected _touched: Subject<void> = new Subject<void>();\n\n// /**\n// * Occurs when selector requires picker to be displayed or hidden\n// */\n// protected _pickerRequest: Subject<boolean> = new Subject<boolean>();\n\n// /**\n// * Instance of parser created for specific format\n// */\n// protected _parser: DatePositionParser|null = null;\n\n// /**\n// * Currently used format for displaying data\n// */\n// protected _format: string = '';\n\n// /**\n// * Current value representation as date api wrapper\n// */\n// protected _dateApiValue: null|DateApiObject<TDate> = null;\n\n// /**\n// * Indication whether is current value valid value\n// */\n// protected _isValid: boolean = true;\n\n// /**\n// * Minimal possible value that can be picked\n// */\n// protected _minValue: TDate|null = null;\n\n// /**\n// * Maximal possible value that can be picked\n// */\n// protected _maxValue: TDate|null = null;\n\n// //######################### public properties - implementation of DateTimeSelector #########################\n\n// /**\n// * Gets or sets currently used format for displaying data\n// */\n// public get format(): string\n// {\n// return this._format;\n// }\n// public set format(value: string)\n// {\n// if(isPresent(value))\n// {\n// value = this._dateApi.getFormat(value);\n// }\n\n// //only if format changes\n// if(this._format != value)\n// {\n// this._parser = this._parserSvc.createParser(this._dateApi.getFormat(value));\n// }\n\n// this._format = value;\n// }\n\n// /**\n// * Gets or sets placeholder that is displayed when there is no value selected\n// */\n// public placeholder: string|null = null;\n\n// /**\n// * Gets current value of datetime\n// */\n// public get value(): DateTimeValue<TDate>|null\n// {\n// if(!this._dateApiValue || !this._isValid)\n// {\n// return null;\n// }\n\n// return this._valueProvider.getValue(this._dateApiValue.value, this._format);\n// }\n\n// /**\n// * Gets formatted value\n// */\n// public get formattedValue(): string|null\n// {\n// if(!this._isValid)\n// {\n// return null;\n// }\n\n// return this.currentValue;\n// }\n\n// /**\n// * Gets indication whether is current value valid\n// */\n// public get valid(): boolean\n// {\n// return this._isValid;\n// }\n\n// /**\n// * Occurs when value changes\n// */\n// public get valueChange(): Observable<void>\n// {\n// return this._valueChange.asObservable();\n// }\n\n// /**\n// * Occurs when selector is touched by user\n// */\n// public get touched(): Observable<void>\n// {\n// return this._touched.asObservable();\n// }\n\n// /**\n// * Occurs when selector requires picker to be displayed\n// */\n// public get pickerRequest(): Observable<boolean>\n// {\n// return this._pickerRequest.asObservable();\n// }\n\n// //######################### public properties - template bindings #########################\n\n// /**\n// * Indication whether is input disabled\n// * @internal\n// */\n// public disabled: boolean = false;\n\n// //######################### public properties - children #########################\n\n// /**\n// * Instance of html input element\n// * @internal\n// */\n// @ViewChild('input', {static: true})\n// public inputElement!: ElementRef<HTMLInputElement>;\n\n// //######################### protected properties #########################\n\n// /**\n// * Gets or sets string representation current of value\n// */\n// protected get currentValue(): string|null\n// {\n// return this.input.value || null;\n// }\n// protected set currentValue(value: string|null)\n// {\n// if(this.input)\n// {\n// this.input.value = value ?? '';\n// }\n// }\n\n// /**\n// * Gets input element used for handling date time value\n// */\n// protected get input(): HTMLInputElement\n// {\n// return this.inputElement.nativeElement;\n// }\n\n// //######################### constructor #########################\n// constructor(@Inject(DATE_API) protected _dateApi: DateApi<TDate>,\n// protected _parserSvc: DatePositionParserService,\n// protected _valueProvider: DateValueProvider<TDate>,\n// protected _changeDetector: ChangeDetectorRef)\n// {\n// }\n\n// //######################### public methods - implementation of DateTimeSelector #########################\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// public setMinValue(value: TDate|null): void\n// {\n// this._minValue = value;\n// }\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// public setMaxValue(value: TDate|null): void\n// {\n// this._maxValue = value;\n// }\n\n// /**\n// * Sets value of datetime selector\n// * @param value - Value to be set to this selector\n// */\n// public setValue(value: DateTimeValue<TDate>|null): void\n// {\n// if(value?.from)\n// {\n// this._dateApiValue = this._dateApi.getValue(value?.from, this._format);\n// this._isValid = this._dateApiValue.isValid();\n \n// this._show();\n// }\n// else\n// {\n// this._clearValue();\n// }\n// }\n\n// /**\n// * Sets as 'control' disabled\n// * @param disabled - Indication whether sets value as disabled, if omitted it is same as disabled set to true\n// */\n// public setDisabled(disabled: boolean = true): void\n// {\n// this.disabled = disabled;\n// }\n\n// /**\n// * Explicitly runs invalidation of content (change detection)\n// */\n// public invalidateVisuals(): void\n// {\n// this._changeDetector.detectChanges();\n// }\n\n// //######################### public methods - template bindings #########################\n\n// /**\n// * Handles gaining of focus\n// * @internal\n// */\n// public handleFocus(): void\n// {\n// this._pickerRequest.next(true);\n\n// //no value\n// if(!this._dateApiValue)\n// {\n// this._dateApiValue = this._dateApi.now();\n// this._isValid = this._dateApiValue.isValid();\n\n// if(this._minMaxConstraintTest())\n// {\n// this._clearValue();\n// }\n// else\n// {\n// this._valueChange.next();\n// }\n// }\n\n// if(!this._isValid)\n// {\n// return;\n// }\n\n// this._show();\n\n// const result = this._parser!.parse(this.currentValue!, this.input.selectionStart!);\n\n// this.input.selectionStart = result.positionFrom;\n// this.input.selectionEnd = result.positionTo;\n// }\n\n// /**\n// * Handles blur on input\n// * @internal\n// */\n// public handleBlur(): void\n// {\n// this._pickerRequest.next(false);\n// }\n\n// /**\n// * Handles user input\n// * @internal\n// */\n// public handleInput(): void\n// {\n// //empty value\n// if(!this.currentValue)\n// {\n// this._clearValue();\n// this._valueChange.next();\n\n// return;\n// }\n\n// this._dateApiValue = this._dateApi.getValue(this.currentValue, this._format);\n// this._isValid = this._dateApiValue.isValid();\n// this._valueChange.next();\n// }\n\n// /**\n// * Handles selection of text inside of input\n// * @internal\n// */\n// public handleSelect(): void\n// {\n// //handles when all text is selected\n// if(this.currentValue && this.input.selectionStart == 0 && this.input.selectionEnd == this.input.value.length)\n// {\n// const result = this._parser!.parse(this.input.value, this.input.selectionStart!);\n\n// this.input.selectionStart = result.positionFrom;\n// this.input.selectionEnd = result.positionTo;\n// }\n// }\n\n// /**\n// * Handles click event inside of input\n// * @internal\n// */\n// public handleClick(): void\n// {\n// this._pickerRequest.next(true);\n\n// if(!this._dateApiValue)\n// {\n// return;\n// }\n\n// const result = this._parser!.parse(this.input.value, this.input.selectionStart!);\n\n// this.input.selectionStart = result.positionFrom;\n// this.input.selectionEnd = result.positionTo;\n// }\n\n// /**\n// * Handles keyboard events\n// * @param event - Keyboard event that occured\n// * @param input - Html input element that holds current value and selection\n// * @internal\n// */\n// public handleKeyboard(event: KeyboardEvent): void\n// {\n// if(!this._dateApiValue?.isValid())\n// {\n// return;\n// }\n\n// switch(event.key)\n// {\n// case 'ArrowRight':\n// case 'ArrowLeft':\n// {\n// event.preventDefault();\n// event.stopPropagation();\n\n// const result = event.key == 'ArrowLeft' ? this._parser!.previous(this.input.value, this.input.selectionStart!) : this._parser!.next(this.input.value, this.input.selectionStart!);\n\n// if(result)\n// {\n// this.input.selectionStart = result.positionFrom;\n// this.input.selectionEnd = result.positionTo;\n// }\n\n// break;\n// }\n// case 'ArrowUp':\n// case 'ArrowDown':\n// {\n// event.preventDefault();\n// event.stopPropagation();\n\n// let result = this._parser!.parse(this.input.value, this.input.selectionStart!);\n// const selectionStart = result.positionFrom;\n\n// this._stepChangeValue(result.part, event.key == 'ArrowUp');\n// this._show();\n\n// result = this._parser!.parse(this.input.value, selectionStart);\n\n// this.input.selectionStart = result.positionFrom;\n// this.input.selectionEnd = result.positionTo;\n\n// break;\n// }\n// case 'Tab':\n// {\n// const result = event.shiftKey ? this._parser!.previous(this.input.value, this.input.selectionStart!) : this._parser!.next(this.input.value, this.input.selectionStart!);\n\n// if(result)\n// {\n// event.preventDefault();\n// event.stopPropagation();\n\n// this.input.selectionStart = result.positionFrom;\n// this.input.selectionEnd = result.positionTo;\n// }\n\n// break;\n// }\n// case 'a':\n// {\n// if(event.ctrlKey)\n// {\n// event.preventDefault();\n// event.stopPropagation();\n// }\n\n// break;\n// }\n// case 'Backspace':\n// {\n// this._clearValue();\n// this._valueChange.next();\n\n// break;\n// }\n// case 'Escape':\n// {\n// this._pickerRequest.next(false);\n\n// break;\n// }\n// case ' ':\n// {\n// if(event.ctrlKey)\n// {\n// this._pickerRequest.next(true);\n// }\n\n// break;\n// }\n// }\n// }\n\n// //######################### protected methods #########################\n\n// /**\n// * Shows current value in input\n// */\n// protected _show(): void\n// {\n// if(this._isValid)\n// {\n// this.currentValue = this._dateApiValue?.format(this._format) ?? null;\n// }\n// }\n\n// /**\n// * Tests whether are min or max constraint broken, returns true if constraint is broken\n// */\n// protected _minMaxConstraintTest(): boolean\n// {\n// return (!!this._minValue && this._dateApiValue!.isBefore(this._minValue)) ||\n// (!!this._maxValue && this._dateApiValue!.isAfter(this._maxValue));\n// }\n\n// /**\n// * Runs code with check whether min max constrains was broken\n// * @param code - Code that should be executed which can change current value\n// */\n// protected _withMinMaxConstraint(code: () => void): void\n// {\n// this._dateApiValue!.updateOriginal();\n\n// code();\n\n// //min value constraint failure\n// if(this._minMaxConstraintTest())\n// {\n// this._dateApiValue?.resetOriginal();\n\n// return;\n// }\n\n// this._valueChange.next();\n// }\n\n// /**\n// * Clears current value\n// */\n// protected _clearValue(): void\n// {\n// this._dateApiValue = null;\n// this._isValid = true;\n// this.currentValue = null;\n// }\n\n// /**\n// * Changes current value of date for for specified part by single step\n// * @param part - Part of date that should be changed\n// * @param increment - Indication whether value should be incremented or decremented\n// */\n// protected _stepChangeValue(part: string, increment: boolean): void\n// {\n// if(!this._dateApiValue?.isValid())\n// {\n// return;\n// }\n\n// switch(part)\n// {\n// case 'y':\n// case 'Y':\n// {\n// this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addYears(1) : this._dateApiValue!.subtractYears(1));\n\n// break;\n// }\n// case 'Q':\n// {\n// break;\n// }\n// case 'M':\n// {\n// this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addMonths(1) : this._dateApiValue!.subtractMonths(1));\n\n// break;\n// }\n// case 'w':\n// {\n// this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addWeeks(1) : this._dateApiValue!.subtractWeeks(1));\n\n// break;\n// }\n// case 'd':\n// case 'D':\n// {\n// this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addDays(1) : this._dateApiValue!.subtractDays(1));\n\n// break;\n// }\n// case 'H':\n// {\n// this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addHours(1) : this._dateApiValue!.subtractHours(1));\n\n// break;\n// }\n// case 'm':\n// {\n// this._withMinMaxConstraint(() => increment ? this._dateApiValue!.addMinutes(1) : this._dateApiValue!.subtractMinutes(1));\n\n// break;\n// }\n// }\n// }\n// }"]}
|