@anglr/datetime 3.0.0-beta.20220504084811 → 3.0.1-beta.20220525100833
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 -2
- package/date-fns/src/misc/tokens.d.ts +6 -2
- package/date-fns/src/misc/tokens.d.ts.map +1 -1
- package/date-fns/src/services/dateFnsDateApi.service.d.ts +303 -2
- package/date-fns/src/services/dateFnsDateApi.service.d.ts.map +1 -1
- package/es2015/date-fns/src/misc/tokens.js +10 -2
- package/es2015/date-fns/src/misc/tokens.js.map +1 -1
- package/es2015/date-fns/src/services/dateFnsDateApi.service.js +17 -9
- package/es2015/date-fns/src/services/dateFnsDateApi.service.js.map +1 -1
- package/es2015/moment/src/misc/tokens.js +9 -1
- package/es2015/moment/src/misc/tokens.js.map +1 -1
- package/es2015/moment/src/services/momentDateApi.service.js +15 -7
- package/es2015/moment/src/services/momentDateApi.service.js.map +1 -1
- package/es2015/src/misc/tokens.js +4 -0
- package/es2015/src/misc/tokens.js.map +1 -1
- package/es2015/src/picker/directives/loopScroll/loopScroll.directive.js +21 -3
- package/es2015/src/picker/directives/loopScroll/loopScroll.directive.js.map +1 -1
- package/es2015/src/services/dateApi.interface.js.map +1 -1
- package/es2020/date-fns/src/misc/tokens.js +10 -2
- package/es2020/date-fns/src/misc/tokens.js.map +1 -1
- package/es2020/date-fns/src/services/dateFnsDateApi.service.js +17 -9
- package/es2020/date-fns/src/services/dateFnsDateApi.service.js.map +1 -1
- package/es2020/moment/src/misc/tokens.js +9 -1
- package/es2020/moment/src/misc/tokens.js.map +1 -1
- package/es2020/moment/src/services/momentDateApi.service.js +15 -7
- package/es2020/moment/src/services/momentDateApi.service.js.map +1 -1
- package/es2020/src/misc/tokens.js +4 -0
- package/es2020/src/misc/tokens.js.map +1 -1
- package/es2020/src/picker/directives/loopScroll/loopScroll.directive.js +21 -3
- package/es2020/src/picker/directives/loopScroll/loopScroll.directive.js.map +1 -1
- package/es2020/src/services/dateApi.interface.js.map +1 -1
- package/moment/src/misc/tokens.d.ts +5 -1
- package/moment/src/misc/tokens.d.ts.map +1 -1
- package/moment/src/services/momentDateApi.service.d.ts +302 -2
- package/moment/src/services/momentDateApi.service.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/misc/tokens.d.ts +5 -1
- package/src/misc/tokens.d.ts.map +1 -1
- package/src/picker/directives/loopScroll/loopScroll.directive.d.ts +10 -1
- package/src/picker/directives/loopScroll/loopScroll.directive.d.ts.map +1 -1
- package/src/services/dateApi.interface.d.ts +6 -0
- package/src/services/dateApi.interface.d.ts.map +1 -1
- package/version.bak +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/misc/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAI7C;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA4B,IAAI,cAAc,CAAU,UAAU,CAAC,CAAC;AAEzF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmC,IAAI,cAAc,CAAiB,iBAAiB,EACjB;IACI,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,GAAG,EAAE;QAEV,OAAO;YACH,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,kBAAkB;YAC5B,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,QAAQ;YACtB,SAAS,EAAE,MAAM;YACjB,cAAc,EAAE,KAAK;SACxB,CAAC;IACN,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import {InjectionToken} from '@angular/core';\n\nimport {DateApi, FormatProvider} from '../services';\n\n/**\n * Injection token used for obtaining DateApi implementation\n */\nexport const DATE_API: InjectionToken<DateApi> = new InjectionToken<DateApi>('DATE_API');\n\n/**\n * Injection token used for obtaining FormatProvider implementation\n */\nexport const FORMAT_PROVIDER: InjectionToken<FormatProvider> = new InjectionToken<FormatProvider>('FORMAT_PROVIDER',\n {\n providedIn: 'root',\n factory: () =>\n {\n return {\n date: 'yyyy-MM-dd',\n dateTime: 'yyyy-MM-dd HH:mm',\n time: 'HH:mm',\n year: 'yyyy',\n month: 'MM',\n week: 'ww',\n day: 'dd',\n hour: 'HH',\n minute: 'mm',\n second: 'ss',\n dayName: 'cccc',\n dayNameShort: 'cccccc',\n monthName: 'LLLL',\n monthNameShort: 'LLL'\n };\n }\n });"]}
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/misc/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAI7C;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsC,IAAI,cAAc,CAAoB,sBAAsB,CAAC,CAAC;AAErI;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA4B,IAAI,cAAc,CAAU,UAAU,CAAC,CAAC;AAEzF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmC,IAAI,cAAc,CAAiB,iBAAiB,EACjB;IACI,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,GAAG,EAAE;QAEV,OAAO;YACH,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,kBAAkB;YAC5B,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,QAAQ;YACtB,SAAS,EAAE,MAAM;YACjB,cAAc,EAAE,KAAK;SACxB,CAAC;IACN,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import {InjectionToken} from '@angular/core';\n\nimport {DateApi, DateApiObjectCtor, FormatProvider} from '../services';\n\n/**\n * Injection token used for injecting type that creates instance of DateApiObject\n */\nexport const DATE_API_OBJECT_TYPE: InjectionToken<DateApiObjectCtor> = new InjectionToken<DateApiObjectCtor>('DATE_API_OBJECT_TYPE');\n\n/**\n * Injection token used for obtaining DateApi implementation\n */\nexport const DATE_API: InjectionToken<DateApi> = new InjectionToken<DateApi>('DATE_API');\n\n/**\n * Injection token used for obtaining FormatProvider implementation\n */\nexport const FORMAT_PROVIDER: InjectionToken<FormatProvider> = new InjectionToken<FormatProvider>('FORMAT_PROVIDER',\n {\n providedIn: 'root',\n factory: () =>\n {\n return {\n date: 'yyyy-MM-dd',\n dateTime: 'yyyy-MM-dd HH:mm',\n time: 'HH:mm',\n year: 'yyyy',\n month: 'MM',\n week: 'ww',\n day: 'dd',\n hour: 'HH',\n minute: 'mm',\n second: 'ss',\n dayName: 'cccc',\n dayNameShort: 'cccccc',\n monthName: 'LLLL',\n monthNameShort: 'LLL'\n };\n }\n });"]}
|
|
@@ -22,6 +22,10 @@ export class LoopScrollDirective {
|
|
|
22
22
|
* Indication whether ignore scroll handle
|
|
23
23
|
*/
|
|
24
24
|
this._ignoreScrollHandle = false;
|
|
25
|
+
/**
|
|
26
|
+
* Indication whether skip value change
|
|
27
|
+
*/
|
|
28
|
+
this._skipValueChange = false;
|
|
25
29
|
/**
|
|
26
30
|
* Indication whether is currently selection scroll open
|
|
27
31
|
*/
|
|
@@ -32,6 +36,17 @@ export class LoopScrollDirective {
|
|
|
32
36
|
*/
|
|
33
37
|
this.valueChange = new EventEmitter();
|
|
34
38
|
}
|
|
39
|
+
//######################### public properties - inputs #########################
|
|
40
|
+
/**
|
|
41
|
+
* Gets or sets value that is being set in loop scroll
|
|
42
|
+
*/
|
|
43
|
+
get value() {
|
|
44
|
+
return this._value;
|
|
45
|
+
}
|
|
46
|
+
set value(value) {
|
|
47
|
+
this._skipValueChange = this._value == value;
|
|
48
|
+
this._value = value;
|
|
49
|
+
}
|
|
35
50
|
//######################### public methods - implementation of OnChanges #########################
|
|
36
51
|
/**
|
|
37
52
|
* Called when input value changes
|
|
@@ -59,10 +74,13 @@ export class LoopScrollDirective {
|
|
|
59
74
|
}
|
|
60
75
|
}
|
|
61
76
|
else if (nameof('value') in changes) {
|
|
62
|
-
this.
|
|
63
|
-
|
|
64
|
-
|
|
77
|
+
if (!this._skipValueChange) {
|
|
78
|
+
this._ignoreScrollHandle = true;
|
|
79
|
+
this._scrollElement.nativeElement.scrollTo({ top: this._itemHeight * (this._clonedCount + this._dataItems.findIndex(itm => itm.data == this.value) + (this.open ? -2 : 0)), behavior: 'auto' });
|
|
80
|
+
this._ignoreScrollHandle = false;
|
|
81
|
+
}
|
|
65
82
|
}
|
|
83
|
+
this._skipValueChange = false;
|
|
66
84
|
}
|
|
67
85
|
//######################### public methods - implementation of AfterContentInit #########################
|
|
68
86
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loopScroll.directive.js","sourceRoot":"","sources":["../../../../../src/picker/directives/loopScroll/loopScroll.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAmB,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAa,MAAM,EAAE,SAAS,EAAgB,MAAM,eAAe,CAAC;AACvK,OAAO,EAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAC,uBAAuB,EAAC,MAAM,4CAA4C,CAAC;;AAEnF;;GAEG;AAKH,MAAM,OAAO,mBAAmB;IAgE5B,iEAAiE;IACjE,YAAsB,cAAuC;QAAvC,mBAAc,GAAd,cAAc,CAAyB;QA9C7D;;WAEG;QACO,iBAAY,GAAY,KAAK,CAAC;QAExC;;WAEG;QACO,iBAAY,GAAW,CAAC,CAAC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B,SAAS;mBACV;oBACI,QAAQ,EAAE,cAAc;iBAC3B;iGAyCU,KAAK;sBADX,KAAK;uBAAC,YAAY;gBAOZ,IAAI;sBADV,KAAK;gBASC,WAAW;sBADjB,MAAM;uBAAC,kBAAkB;gBAShB,KAAK;sBADd,eAAe;uBAAC,uBAAuB;gBAyH9B,aAAa;sBADtB,YAAY;uBAAC,QAAQ;gBA+CZ,aAAa","sourcesContent":["import {AfterContentInit, ContentChildren, Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output, QueryList, SimpleChanges} from '@angular/core';\nimport {DebounceCall, isBlank, nameof} from '@jscrpt/common';\n\nimport {LoopScrollDataDirective} from '../loopScrollData/loopScrollData.directive';\n\n/**\n * Renders loop scroll for array of elements\n */\n@Directive(\n{\n selector: '[loopScroll]'\n})\nexport class LoopScrollDirective<TData = any> implements OnChanges, AfterContentInit\n{\n //######################### protected fields #########################\n\n /**\n * Item height that obtained\n */\n protected _itemHeight?: number;\n\n /**\n * Array of elements for scrolled stuff\n */\n protected _items?: LoopScrollDataDirective[];\n\n /**\n * Array of elements and data for scrolled stuff\n */ \n protected _dataItems?: LoopScrollDataDirective[];\n\n /**\n * Indication whether is loop scroll initialized\n */\n protected _initialized: boolean = false;\n\n /**\n * Count of cloned elements before or after\n */\n protected _clonedCount: number = 0;\n\n /**\n * Indication whether ignore scroll handle\n */\n protected _ignoreScrollHandle: boolean = false;\n\n //######################### public properties - inputs #########################\n\n /**\n * Value that is being set in loop scroll\n */\n @Input('loopScroll')\n public value?: TData;\n\n /**\n * Indication whether is currently selection scroll open\n */\n @Input()\n public open: boolean = false;\n\n //######################### public properties - outputs #########################\n\n /**\n * Occurs when current value of loop scroll changes\n */\n @Output('loopScrollChange')\n public valueChange: EventEmitter<TData> = new EventEmitter<TData>();\n\n //######################### protected properties - children #########################\n\n /**\n * Array of items that are loop scrolled\n */\n @ContentChildren(LoopScrollDataDirective)\n protected items?: QueryList<LoopScrollDataDirective>;\n\n //######################### constructor #########################\n constructor(protected _scrollElement: ElementRef<HTMLElement>)\n {\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(!this._initialized)\n {\n return;\n }\n\n const itemHeight = this._itemHeight ?? 1;\n\n if(nameof<LoopScrollDirective>('open') in changes)\n {\n if(this.open)\n {\n this._scrollElement.nativeElement.scrollTo({top: this._scrollElement.nativeElement.scrollTop - (2 * itemHeight), behavior: 'auto'});\n\n return;\n }\n\n if(nameof<LoopScrollDirective>('value') in changes)\n {\n const selectedItem = this._dataItems?.find(itm => itm.data == this.value);\n\n if(!selectedItem)\n {\n throw new Error('No item selected in loop scroll');\n }\n\n const selectedIndex = this._dataItems!.indexOf(selectedItem);\n\n this._scrollElement.nativeElement.scrollTo({top: (selectedIndex + this._clonedCount) * itemHeight, behavior: 'auto'});\n }\n else\n {\n this._scrollElement.nativeElement.scrollTo({top: this._scrollElement.nativeElement.scrollTop + (2 * itemHeight), behavior: 'auto'});\n }\n }\n else if(nameof<LoopScrollDirective>('value') in changes)\n {\n this._ignoreScrollHandle = true;\n this._scrollElement.nativeElement.scrollTo({top: this._itemHeight! * (this._clonedCount + this._dataItems!.findIndex(itm => itm.data == this.value) + (this.open ? -2 : 0)), behavior: 'auto'});\n this._ignoreScrollHandle = false;\n }\n }\n\n //######################### public methods - implementation of AfterContentInit #########################\n \n /**\n * Called when content was initialized\n */\n public ngAfterContentInit(): void\n {\n this._items = this.items?.toArray();\n this._dataItems = this._items?.filter(itm => !itm.clone);\n\n if(!this._dataItems?.length)\n {\n this.items?.changes.subscribe(() =>\n {\n this._items = this.items?.toArray();\n this._dataItems = this._items?.filter(itm => !itm.clone);\n\n this._initialize();\n });\n\n return;\n }\n\n this._initialize();\n }\n\n //######################### protected methods #########################\n\n /**\n * Intialize default value\n */\n protected _initialize(): void\n {\n const cloned = this._items?.filter(itm => itm.clone) ?? [];\n this._clonedCount = cloned.length / 2;\n\n if(!this._dataItems?.length)\n {\n return;\n }\n\n this._dataItems.forEach(itm =>\n {\n if(isBlank(this._itemHeight))\n {\n this._itemHeight = itm.element.nativeElement.offsetHeight;\n\n return;\n }\n\n if(this._itemHeight != itm.element.nativeElement.offsetHeight)\n {\n throw new Error('All items inside of loop scroll should have same height');\n }\n });\n\n this._scrollElement.nativeElement.scrollTo({top: this._itemHeight! * (this._clonedCount + this._dataItems!.findIndex(itm => itm.data == this.value)), behavior: 'auto'});\n this._initialized = true;\n }\n\n /**\n * Handles scroll event\n */\n @HostListener('scroll')\n protected _handleScroll(): void\n {\n if(this._ignoreScrollHandle)\n {\n return;\n }\n\n requestAnimationFrame(() =>\n {\n if(!this._dataItems)\n {\n return;\n }\n\n const index = this._scrollElement.nativeElement.scrollTop / (this._itemHeight ?? 1);\n const dataIndex = index + (this.open ? 2 : 0) - this._clonedCount;\n const dataLength = (this._itemHeight ?? 1) * this._dataItems.length;\n\n if(index % 1 <= .2 || index % 1 >= .8)\n {\n this._scrollElement.nativeElement.querySelector('.selected')?.classList?.remove('selected');\n\n const roundIndex = Math.round(index);\n this._items![roundIndex + (this.open ? 2 : 0)].element.nativeElement.classList.add('selected');\n this._emitValue(dataIndex);\n }\n\n if(dataIndex <= -1)\n {\n this._updateScroll(dataLength, true, index, dataIndex);\n }\n else if(dataIndex >= (this._dataItems.length ?? 0))\n {\n this._updateScroll(dataLength, false, index, dataIndex);\n }\n });\n }\n\n /**\n * Updates scroll to be at full value of item\n * @param dataLength - Length of all data\n * @param add - Indication whether add or subtract length\n * @param index - Current index\n * @param dataIndex - Current index of data \n */\n @DebounceCall(18)\n protected _updateScroll(dataLength: number, add: boolean, index: number, dataIndex: number): void\n {\n this._scrollElement.nativeElement.scrollTo({top: (Math.round(index) * (this._itemHeight ?? 1)) + (add ? dataLength : (dataLength * -1)), behavior: 'auto'});\n\n this._emitValue(dataIndex);\n }\n\n /**\n * Emits value after scroll\n * @param index - Index of currently selected data item\n */\n protected _emitValue(index: number): void\n {\n index = Math.round(index) % this._dataItems!.length;\n \n if(index < 0)\n {\n index = this._dataItems!.length + index;\n }\n\n const item = this._dataItems![index];\n\n if(this.value != item.data)\n {\n this.value = item.data;\n this.valueChange.next(this.value);\n }\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"loopScroll.directive.js","sourceRoot":"","sources":["../../../../../src/picker/directives/loopScroll/loopScroll.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAmB,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAa,MAAM,EAAE,SAAS,EAAgB,MAAM,eAAe,CAAC;AACvK,OAAO,EAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAC,uBAAuB,EAAC,MAAM,4CAA4C,CAAC;;AAEnF;;GAEG;AAKH,MAAM,OAAO,mBAAmB;IAkF5B,iEAAiE;IACjE,YAAsB,cAAuC;QAAvC,mBAAc,GAAd,cAAc,CAAyB;QAhE7D;;WAEG;QACO,iBAAY,GAAY,KAAK,CAAC;QAExC;;WAEG;QACO,iBAAY,GAAW,CAAC,CAAC;QAEnC;;WAEG;QACO,wBAAmB,GAAY,KAAK,CAAC;QAE/C;;WAEG;QACO,qBAAgB,GAAY,KAAK,CAAC;QAuB5C;;WAEG;QAEI,SAAI,GAAY,KAAK,CAAC;QAE7B,iFAAiF;QAEjF;;WAEG;QAEI,gBAAW,GAAwB,IAAI,YAAY,EAAS,CAAC;IAapE,CAAC;IAzCD,gFAAgF;IAEhF;;OAEG;IACH,IACW,KAAK;QAEZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACD,IAAW,KAAK,CAAC,KAAY;QAEzB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IA6BD,kGAAkG;IAElG;;OAEG;IACI,WAAW,CAAC,OAA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BADjB,MAAM;uBAAC,kBAAkB;gBAShB,KAAK;sBADd,eAAe;uBAAC,uBAAuB;gBA8H9B,aAAa;sBADtB,YAAY;uBAAC,QAAQ;gBA+CZ,aAAa","sourcesContent":["import {AfterContentInit, ContentChildren, Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output, QueryList, SimpleChanges} from '@angular/core';\nimport {DebounceCall, isBlank, nameof} from '@jscrpt/common';\n\nimport {LoopScrollDataDirective} from '../loopScrollData/loopScrollData.directive';\n\n/**\n * Renders loop scroll for array of elements\n */\n@Directive(\n{\n selector: '[loopScroll]'\n})\nexport class LoopScrollDirective<TData = any> implements OnChanges, AfterContentInit\n{\n //######################### protected fields #########################\n\n /**\n * Item height that obtained\n */\n protected _itemHeight?: number;\n\n /**\n * Array of elements for scrolled stuff\n */\n protected _items?: LoopScrollDataDirective[];\n\n /**\n * Array of elements and data for scrolled stuff\n */ \n protected _dataItems?: LoopScrollDataDirective[];\n\n /**\n * Indication whether is loop scroll initialized\n */\n protected _initialized: boolean = false;\n\n /**\n * Count of cloned elements before or after\n */\n protected _clonedCount: number = 0;\n\n /**\n * Indication whether ignore scroll handle\n */\n protected _ignoreScrollHandle: boolean = false;\n\n /**\n * Indication whether skip value change\n */\n protected _skipValueChange: boolean = false;\n\n /**\n * Value that is being set in loop scroll\n */\n protected _value?: TData;\n\n //######################### public properties - inputs #########################\n\n /**\n * Gets or sets value that is being set in loop scroll\n */\n @Input('loopScroll')\n public get value(): TData\n {\n return this._value;\n }\n public set value(value: TData)\n {\n this._skipValueChange = this._value == value;\n this._value = value;\n }\n\n /**\n * Indication whether is currently selection scroll open\n */\n @Input()\n public open: boolean = false;\n\n //######################### public properties - outputs #########################\n\n /**\n * Occurs when current value of loop scroll changes\n */\n @Output('loopScrollChange')\n public valueChange: EventEmitter<TData> = new EventEmitter<TData>();\n\n //######################### protected properties - children #########################\n\n /**\n * Array of items that are loop scrolled\n */\n @ContentChildren(LoopScrollDataDirective)\n protected items?: QueryList<LoopScrollDataDirective>;\n\n //######################### constructor #########################\n constructor(protected _scrollElement: ElementRef<HTMLElement>)\n {\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(!this._initialized)\n {\n return;\n }\n\n const itemHeight = this._itemHeight ?? 1;\n\n if(nameof<LoopScrollDirective>('open') in changes)\n {\n if(this.open)\n {\n this._scrollElement.nativeElement.scrollTo({top: this._scrollElement.nativeElement.scrollTop - (2 * itemHeight), behavior: 'auto'});\n\n return;\n }\n\n if(nameof<LoopScrollDirective>('value') in changes)\n {\n const selectedItem = this._dataItems?.find(itm => itm.data == this.value);\n\n if(!selectedItem)\n {\n throw new Error('No item selected in loop scroll');\n }\n\n const selectedIndex = this._dataItems!.indexOf(selectedItem);\n\n this._scrollElement.nativeElement.scrollTo({top: (selectedIndex + this._clonedCount) * itemHeight, behavior: 'auto'});\n }\n else\n {\n this._scrollElement.nativeElement.scrollTo({top: this._scrollElement.nativeElement.scrollTop + (2 * itemHeight), behavior: 'auto'});\n }\n }\n else if(nameof<LoopScrollDirective>('value') in changes)\n {\n if(!this._skipValueChange)\n {\n this._ignoreScrollHandle = true;\n this._scrollElement.nativeElement.scrollTo({top: this._itemHeight! * (this._clonedCount + this._dataItems!.findIndex(itm => itm.data == this.value) + (this.open ? -2 : 0)), behavior: 'auto'});\n this._ignoreScrollHandle = false;\n }\n }\n\n this._skipValueChange = false;\n }\n\n //######################### public methods - implementation of AfterContentInit #########################\n \n /**\n * Called when content was initialized\n */\n public ngAfterContentInit(): void\n {\n this._items = this.items?.toArray();\n this._dataItems = this._items?.filter(itm => !itm.clone);\n\n if(!this._dataItems?.length)\n {\n this.items?.changes.subscribe(() =>\n {\n this._items = this.items?.toArray();\n this._dataItems = this._items?.filter(itm => !itm.clone);\n\n this._initialize();\n });\n\n return;\n }\n\n this._initialize();\n }\n\n //######################### protected methods #########################\n\n /**\n * Intialize default value\n */\n protected _initialize(): void\n {\n const cloned = this._items?.filter(itm => itm.clone) ?? [];\n this._clonedCount = cloned.length / 2;\n\n if(!this._dataItems?.length)\n {\n return;\n }\n\n this._dataItems.forEach(itm =>\n {\n if(isBlank(this._itemHeight))\n {\n this._itemHeight = itm.element.nativeElement.offsetHeight;\n\n return;\n }\n\n if(this._itemHeight != itm.element.nativeElement.offsetHeight)\n {\n throw new Error('All items inside of loop scroll should have same height');\n }\n });\n\n this._scrollElement.nativeElement.scrollTo({top: this._itemHeight! * (this._clonedCount + this._dataItems!.findIndex(itm => itm.data == this.value)), behavior: 'auto'});\n this._initialized = true;\n }\n\n /**\n * Handles scroll event\n */\n @HostListener('scroll')\n protected _handleScroll(): void\n {\n if(this._ignoreScrollHandle)\n {\n return;\n }\n\n requestAnimationFrame(() =>\n {\n if(!this._dataItems)\n {\n return;\n }\n\n const index = this._scrollElement.nativeElement.scrollTop / (this._itemHeight ?? 1);\n const dataIndex = index + (this.open ? 2 : 0) - this._clonedCount;\n const dataLength = (this._itemHeight ?? 1) * this._dataItems.length;\n\n if(index % 1 <= .2 || index % 1 >= .8)\n {\n this._scrollElement.nativeElement.querySelector('.selected')?.classList?.remove('selected');\n\n const roundIndex = Math.round(index);\n this._items![roundIndex + (this.open ? 2 : 0)].element.nativeElement.classList.add('selected');\n this._emitValue(dataIndex);\n }\n\n if(dataIndex <= -1)\n {\n this._updateScroll(dataLength, true, index, dataIndex);\n }\n else if(dataIndex >= (this._dataItems.length ?? 0))\n {\n this._updateScroll(dataLength, false, index, dataIndex);\n }\n });\n }\n\n /**\n * Updates scroll to be at full value of item\n * @param dataLength - Length of all data\n * @param add - Indication whether add or subtract length\n * @param index - Current index\n * @param dataIndex - Current index of data \n */\n @DebounceCall(18)\n protected _updateScroll(dataLength: number, add: boolean, index: number, dataIndex: number): void\n {\n this._scrollElement.nativeElement.scrollTo({top: (Math.round(index) * (this._itemHeight ?? 1)) + (add ? dataLength : (dataLength * -1)), behavior: 'auto'});\n\n this._emitValue(dataIndex);\n }\n\n /**\n * Emits value after scroll\n * @param index - Index of currently selected data item\n */\n protected _emitValue(index: number): void\n {\n index = Math.round(index) % this._dataItems!.length;\n \n if(index < 0)\n {\n index = this._dataItems!.length + index;\n }\n\n const item = this._dataItems![index];\n\n if(this.value != item.data)\n {\n this.value = item.data;\n this.valueChange.next(this.value);\n }\n }\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateApi.interface.js","sourceRoot":"","sources":["../../../src/services/dateApi.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Date can be represented as formatted string, timestamp or javascript Date object\n */\nexport type DateValue = Date|string|number;\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nexport interface DateApiObject<TDate = any>\n{\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n readonly originalValue: TDate;\n\n /**\n * Instance of date\n */\n readonly value: TDate;\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n isValid(): boolean;\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n isWeekend(): boolean;\n\n /**\n * Formats date value\n * @param format - Format token used for creating formatted string\n */\n format(format: string): string;\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n startOfDecade(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n endOfDecade(): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n startOfYear(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n endOfYear(): DateApiObject<TDate>;\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n addYears(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n subtractYears(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n startOfMonth(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n endOfMonth(): DateApiObject<TDate>;\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n addMonths(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n subtractMonths(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n startOfWeek(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n endOfWeek(): DateApiObject<TDate>;\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n addWeeks(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n subtractWeeks(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n startOfDay(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n endOfDay(): DateApiObject<TDate>;\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n addDays(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n subtractDays(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current hour\n * @returns Itself for fluent API\n */\n startOfHour(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current hour\n * @returns Itself for fluent API\n */\n endOfHour(): DateApiObject<TDate>;\n\n /**\n * Add hours, if count not specified adds 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n addHours(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract hours, if count not specified subtract 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n subtractHours(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current minute\n * @returns Itself for fluent API\n */\n startOfMinute(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n endOfMinute(): DateApiObject<TDate>;\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n addMinutes(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n subtractMinutes(count?: number): DateApiObject<TDate>;\n\n /**\n * Gets number of days in month\n */\n daysInMonth(): number;\n\n /**\n * Gets year\n */\n year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n year(year: number): DateApiObject<TDate>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n year(year?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets month\n */\n month(): number;\n /**\n * Sets month\n * @param month - Month to be set\n */\n month(month: number): DateApiObject<TDate>;\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n month(month?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets day of month one based\n */\n dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n dayOfMonth(day: number): DateApiObject<TDate>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n dayOfMonth(day?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets day of week zero based, first is monday\n */\n dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n dayOfWeek(day: number): DateApiObject<TDate>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n dayOfWeek(day?: number): number|DateApiObject<TDate>;\n\n /**\n * Gets hours zero based\n */\n hour(): number;\n /**\n * Sets hours zero\n * @param hour - hour to be set\n */\n hour(hour: number): DateApiObject<TDate>;\n /**\n * Gets or sets hours zero\n * @param hour - If specified, sets hour\n */\n hour(hour?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets minutes zero based\n */\n minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n minute(minute: number): DateApiObject<TDate>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n minute(minute?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n isBefore(date: TDate): boolean;\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n isAfter(date: TDate): boolean;\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n diffDays(date: TDate): number;\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n isSameWeek(date: TDate): boolean;\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n isSameDecade(date: TDate): boolean;\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n isSameYear(date: TDate): boolean;\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n isSameMonth(date: TDate): boolean;\n\n /**\n * Compares whether this date is same day as provided date\n * @param date - Date which is used for comparison of same day\n */\n isSameDay(date: TDate): boolean;\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n clone(): DateApiObject<TDate>;\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n cloneOriginal(): DateApiObject<TDate>;\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n updateOriginal(value?: TDate): DateApiObject<TDate>;\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n resetOriginal(): DateApiObject<TDate>;\n}\n\n/**\n * Date api abstraction, used for obtaining DateApi wrapper object\n */\nexport interface DateApi<TDate = any>\n{\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n getValue(value: DateValue|TDate, format?: string): DateApiObject<TDate>;\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n now(): DateApiObject<TDate>;\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n getFormat(pseudoFormat: string): string;\n\n /**\n * Gets information\n */\n weekStartsOnMonday(): boolean;\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n weekdaysShort(): string[];\n\n /**\n * Tests whether is value TDate\n * @param value - Value to be tested whether is TDate\n */\n isDate(value: unknown): value is TDate;\n}"]}
|
|
1
|
+
{"version":3,"file":"dateApi.interface.js","sourceRoot":"","sources":["../../../src/services/dateApi.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Date can be represented as formatted string, timestamp or javascript Date object\n */\nexport type DateValue = Date|string|number;\n\n/**\n * Definition of type, that is used for creating instance of DateApiObject\n */\nexport interface DateApiObjectCtor<TObject extends DateApiObject<TDate> = any, TDate = any>\n{\n new (value: TDate|DateValue, format?: string, ...additionalParams: any[]): TObject;\n}\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nexport interface DateApiObject<TDate = any>\n{\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n readonly originalValue: TDate;\n\n /**\n * Instance of date\n */\n readonly value: TDate;\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n isValid(): boolean;\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n isWeekend(): boolean;\n\n /**\n * Formats date value\n * @param format - Format token used for creating formatted string\n */\n format(format: string): string;\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n startOfDecade(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n endOfDecade(): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n startOfYear(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n endOfYear(): DateApiObject<TDate>;\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n addYears(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n subtractYears(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n startOfMonth(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n endOfMonth(): DateApiObject<TDate>;\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n addMonths(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n subtractMonths(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n startOfWeek(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n endOfWeek(): DateApiObject<TDate>;\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n addWeeks(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n subtractWeeks(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n startOfDay(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n endOfDay(): DateApiObject<TDate>;\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n addDays(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n subtractDays(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current hour\n * @returns Itself for fluent API\n */\n startOfHour(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current hour\n * @returns Itself for fluent API\n */\n endOfHour(): DateApiObject<TDate>;\n\n /**\n * Add hours, if count not specified adds 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n addHours(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract hours, if count not specified subtract 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n subtractHours(count?: number): DateApiObject<TDate>;\n\n /**\n * Updates value to start date and time of current minute\n * @returns Itself for fluent API\n */\n startOfMinute(): DateApiObject<TDate>;\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n endOfMinute(): DateApiObject<TDate>;\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n addMinutes(count?: number): DateApiObject<TDate>;\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n subtractMinutes(count?: number): DateApiObject<TDate>;\n\n /**\n * Gets number of days in month\n */\n daysInMonth(): number;\n\n /**\n * Gets year\n */\n year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n year(year: number): DateApiObject<TDate>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n year(year?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets month\n */\n month(): number;\n /**\n * Sets month\n * @param month - Month to be set\n */\n month(month: number): DateApiObject<TDate>;\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n month(month?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets day of month one based\n */\n dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n dayOfMonth(day: number): DateApiObject<TDate>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n dayOfMonth(day?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets day of week zero based, first is monday\n */\n dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n dayOfWeek(day: number): DateApiObject<TDate>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n dayOfWeek(day?: number): number|DateApiObject<TDate>;\n\n /**\n * Gets hours zero based\n */\n hour(): number;\n /**\n * Sets hours zero\n * @param hour - hour to be set\n */\n hour(hour: number): DateApiObject<TDate>;\n /**\n * Gets or sets hours zero\n * @param hour - If specified, sets hour\n */\n hour(hour?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets minutes zero based\n */\n minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n minute(minute: number): DateApiObject<TDate>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n minute(minute?: number): DateApiObject<TDate>|number;\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n isBefore(date: TDate): boolean;\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n isAfter(date: TDate): boolean;\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n diffDays(date: TDate): number;\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n isSameWeek(date: TDate): boolean;\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n isSameDecade(date: TDate): boolean;\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n isSameYear(date: TDate): boolean;\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n isSameMonth(date: TDate): boolean;\n\n /**\n * Compares whether this date is same day as provided date\n * @param date - Date which is used for comparison of same day\n */\n isSameDay(date: TDate): boolean;\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n clone(): DateApiObject<TDate>;\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n cloneOriginal(): DateApiObject<TDate>;\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n updateOriginal(value?: TDate): DateApiObject<TDate>;\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n resetOriginal(): DateApiObject<TDate>;\n}\n\n/**\n * Date api abstraction, used for obtaining DateApi wrapper object\n */\nexport interface DateApi<TDate = any>\n{\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n getValue(value: DateValue|TDate, format?: string): DateApiObject<TDate>;\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n now(): DateApiObject<TDate>;\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n getFormat(pseudoFormat: string): string;\n\n /**\n * Gets information\n */\n weekStartsOnMonday(): boolean;\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n weekdaysShort(): string[];\n\n /**\n * Tests whether is value TDate\n * @param value - Value to be tested whether is TDate\n */\n isDate(value: unknown): value is TDate;\n}"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { FactoryProvider } from '@angular/core';
|
|
1
|
+
import { ClassProvider, FactoryProvider } from '@angular/core';
|
|
2
2
|
/**
|
|
3
3
|
* Injection token used for obtaining moment FormatProvider implementation
|
|
4
4
|
*/
|
|
5
5
|
export declare const MOMENT_FORMAT_PROVIDER: FactoryProvider;
|
|
6
|
+
/**
|
|
7
|
+
* Injection token used for injecting type that creates instance of DateApiObject for moment
|
|
8
|
+
*/
|
|
9
|
+
export declare const MOMENT_DATE_API_OBJECT_TYPE: ClassProvider;
|
|
6
10
|
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAK7D;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,eAsBpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,aAIzC,CAAC"}
|
|
@@ -1,12 +1,307 @@
|
|
|
1
|
-
import { DateApi, DateValue, DateApiObject, DateTimeRelativeParser } from '@anglr/datetime';
|
|
1
|
+
import { DateApi, DateValue, DateApiObject, DateTimeRelativeParser, DateApiObjectCtor } from '@anglr/datetime';
|
|
2
2
|
import moment from 'moment';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Instance of object wrapping TDate, allowing manipulation with it
|
|
6
|
+
*/
|
|
7
|
+
declare class MomentDateApiObject implements DateApiObject<moment.Moment> {
|
|
8
|
+
/**
|
|
9
|
+
* Original value that is not changed unless 'updateOriginal' is called
|
|
10
|
+
*/
|
|
11
|
+
protected _originalValue: moment.Moment;
|
|
12
|
+
/**
|
|
13
|
+
* Instance of date
|
|
14
|
+
*/
|
|
15
|
+
protected _value: moment.Moment;
|
|
16
|
+
/**
|
|
17
|
+
* Original value that is not changed unless 'updateOriginal' is called
|
|
18
|
+
*/
|
|
19
|
+
get originalValue(): moment.Moment;
|
|
20
|
+
/**
|
|
21
|
+
* Instance of date
|
|
22
|
+
*/
|
|
23
|
+
get value(): moment.Moment;
|
|
24
|
+
constructor(value: DateValue | moment.Moment, format?: string);
|
|
25
|
+
/**
|
|
26
|
+
* Gets indication whether provided instance of date is valid
|
|
27
|
+
*/
|
|
28
|
+
isValid(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Gets indication whether provided instance of date is weekend day
|
|
31
|
+
*/
|
|
32
|
+
isWeekend(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Formats date value
|
|
35
|
+
* @param format - Format token used for creating formatted string
|
|
36
|
+
*/
|
|
37
|
+
format(format: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Updates value to start date and time of current decade
|
|
40
|
+
* @returns Itself for fluent API
|
|
41
|
+
*/
|
|
42
|
+
startOfDecade(): DateApiObject<moment.Moment>;
|
|
43
|
+
/**
|
|
44
|
+
* Updates value to end date and time of current decade
|
|
45
|
+
* @returns Itself for fluent API
|
|
46
|
+
*/
|
|
47
|
+
endOfDecade(): DateApiObject<moment.Moment>;
|
|
48
|
+
/**
|
|
49
|
+
* Updates value to start date and time of current year
|
|
50
|
+
* @returns Itself for fluent API
|
|
51
|
+
*/
|
|
52
|
+
startOfYear(): DateApiObject<moment.Moment>;
|
|
53
|
+
/**
|
|
54
|
+
* Updates value to end date and time of current year
|
|
55
|
+
* @returns Itself for fluent API
|
|
56
|
+
*/
|
|
57
|
+
endOfYear(): DateApiObject<moment.Moment>;
|
|
58
|
+
/**
|
|
59
|
+
* Add years, if count not specified adds 1 year
|
|
60
|
+
* @param count - Number of years count
|
|
61
|
+
* @returns Itself for fluent API
|
|
62
|
+
*/
|
|
63
|
+
addYears(count?: number): DateApiObject<moment.Moment>;
|
|
64
|
+
/**
|
|
65
|
+
* Subtract years, if count not specified subtract 1 year
|
|
66
|
+
* @param count - Number of years count
|
|
67
|
+
* @returns Itself for fluent API
|
|
68
|
+
*/
|
|
69
|
+
subtractYears(count?: number): DateApiObject<moment.Moment>;
|
|
70
|
+
/**
|
|
71
|
+
* Updates value to start date and time of current month
|
|
72
|
+
* @returns Itself for fluent API
|
|
73
|
+
*/
|
|
74
|
+
startOfMonth(): DateApiObject<moment.Moment>;
|
|
75
|
+
/**
|
|
76
|
+
* Updates value to end date and time of current month
|
|
77
|
+
* @returns Itself for fluent API
|
|
78
|
+
*/
|
|
79
|
+
endOfMonth(): DateApiObject<moment.Moment>;
|
|
80
|
+
/**
|
|
81
|
+
* Add months, if count not specified adds 1 month
|
|
82
|
+
* @param count - Number of months count
|
|
83
|
+
* @returns Itself for fluent API
|
|
84
|
+
*/
|
|
85
|
+
addMonths(count?: number): DateApiObject<moment.Moment>;
|
|
86
|
+
/**
|
|
87
|
+
* Subtract months, if count not specified subtract 1 month
|
|
88
|
+
* @param count - Number of months count
|
|
89
|
+
* @returns Itself for fluent API
|
|
90
|
+
*/
|
|
91
|
+
subtractMonths(count?: number): DateApiObject<moment.Moment>;
|
|
92
|
+
/**
|
|
93
|
+
* Updates value to start date and time of current week
|
|
94
|
+
* @returns Itself for fluent API
|
|
95
|
+
*/
|
|
96
|
+
startOfWeek(): DateApiObject<moment.Moment>;
|
|
97
|
+
/**
|
|
98
|
+
* Updates value to end date and time of current week
|
|
99
|
+
* @returns Itself for fluent API
|
|
100
|
+
*/
|
|
101
|
+
endOfWeek(): DateApiObject<moment.Moment>;
|
|
102
|
+
/**
|
|
103
|
+
* Add weeks, if count not specified adds 1 week
|
|
104
|
+
* @param count - Number of weeks count
|
|
105
|
+
* @returns Itself for fluent API
|
|
106
|
+
*/
|
|
107
|
+
addWeeks(count?: number): DateApiObject<moment.Moment>;
|
|
108
|
+
/**
|
|
109
|
+
* Subtract weeks, if count not specified subtract 1 week
|
|
110
|
+
* @param count - Number of weeks count
|
|
111
|
+
* @returns Itself for fluent API
|
|
112
|
+
*/
|
|
113
|
+
subtractWeeks(count?: number): DateApiObject<moment.Moment>;
|
|
114
|
+
/**
|
|
115
|
+
* Updates value to start date and time of current day
|
|
116
|
+
* @returns Itself for fluent API
|
|
117
|
+
*/
|
|
118
|
+
startOfDay(): DateApiObject<moment.Moment>;
|
|
119
|
+
/**
|
|
120
|
+
* Updates value to end date and time of current day
|
|
121
|
+
* @returns Itself for fluent API
|
|
122
|
+
*/
|
|
123
|
+
endOfDay(): DateApiObject<moment.Moment>;
|
|
124
|
+
/**
|
|
125
|
+
* Add days, if count not specified adds 1 day
|
|
126
|
+
* @param count - Number of days count
|
|
127
|
+
* @returns Itself for fluent API
|
|
128
|
+
*/
|
|
129
|
+
addDays(count?: number): DateApiObject<moment.Moment>;
|
|
130
|
+
/**
|
|
131
|
+
* Subtract days, if count not specified subtract 1 day
|
|
132
|
+
* @param count - Number of days count
|
|
133
|
+
* @returns Itself for fluent API
|
|
134
|
+
*/
|
|
135
|
+
subtractDays(count?: number): DateApiObject<moment.Moment>;
|
|
136
|
+
/**
|
|
137
|
+
* Updates value to start date and time of current hour
|
|
138
|
+
* @returns Itself for fluent API
|
|
139
|
+
*/
|
|
140
|
+
startOfHour(): DateApiObject<moment.Moment>;
|
|
141
|
+
/**
|
|
142
|
+
* Updates value to end date and time of current hour
|
|
143
|
+
* @returns Itself for fluent API
|
|
144
|
+
*/
|
|
145
|
+
endOfHour(): DateApiObject<moment.Moment>;
|
|
146
|
+
/**
|
|
147
|
+
* Add hours, if count not specified adds 1 hour
|
|
148
|
+
* @param count - Number of hours count
|
|
149
|
+
* @returns Itself for fluent API
|
|
150
|
+
*/
|
|
151
|
+
addHours(count?: number): DateApiObject<moment.Moment>;
|
|
152
|
+
/**
|
|
153
|
+
* Subtract hours, if count not specified subtract 1 hour
|
|
154
|
+
* @param count - Number of hours count
|
|
155
|
+
* @returns Itself for fluent API
|
|
156
|
+
*/
|
|
157
|
+
subtractHours(count?: number): DateApiObject<moment.Moment>;
|
|
158
|
+
/**
|
|
159
|
+
* Updates value to start date and time of current minute
|
|
160
|
+
* @returns Itself for fluent API
|
|
161
|
+
*/
|
|
162
|
+
startOfMinute(): DateApiObject<moment.Moment>;
|
|
163
|
+
/**
|
|
164
|
+
* Updates value to end date and time of current minute
|
|
165
|
+
* @returns Itself for fluent API
|
|
166
|
+
*/
|
|
167
|
+
endOfMinute(): DateApiObject<moment.Moment>;
|
|
168
|
+
/**
|
|
169
|
+
* Add minutes, if count not specified adds 1 minute
|
|
170
|
+
* @param count - Number of minutes count
|
|
171
|
+
* @returns Itself for fluent API
|
|
172
|
+
*/
|
|
173
|
+
addMinutes(count?: number): DateApiObject<moment.Moment>;
|
|
174
|
+
/**
|
|
175
|
+
* Subtract minutes, if count not specified subtract 1 minute
|
|
176
|
+
* @param count - Number of minutes count
|
|
177
|
+
* @returns Itself for fluent API
|
|
178
|
+
*/
|
|
179
|
+
subtractMinutes(count?: number): DateApiObject<moment.Moment>;
|
|
180
|
+
/**
|
|
181
|
+
* Gets number of days in month
|
|
182
|
+
*/
|
|
183
|
+
daysInMonth(): number;
|
|
184
|
+
/**
|
|
185
|
+
* Gets year
|
|
186
|
+
*/
|
|
187
|
+
year(): number;
|
|
188
|
+
/**
|
|
189
|
+
* Sets year
|
|
190
|
+
* @param year - Year to be set
|
|
191
|
+
*/
|
|
192
|
+
year(year: number): DateApiObject<moment.Moment>;
|
|
193
|
+
/**
|
|
194
|
+
* Gets month
|
|
195
|
+
*/
|
|
196
|
+
month(): number;
|
|
197
|
+
/**
|
|
198
|
+
* Sets month
|
|
199
|
+
* @param month - Month to be set
|
|
200
|
+
*/
|
|
201
|
+
month(month: number): DateApiObject<moment.Moment>;
|
|
202
|
+
/**
|
|
203
|
+
* Gets day of month one based
|
|
204
|
+
*/
|
|
205
|
+
dayOfMonth(): number;
|
|
206
|
+
/**
|
|
207
|
+
* Sets day of month one based
|
|
208
|
+
* @param day - Day of month to be set
|
|
209
|
+
*/
|
|
210
|
+
dayOfMonth(day: number): DateApiObject<moment.Moment>;
|
|
211
|
+
/**
|
|
212
|
+
* Gets day of week zero based, first is monday
|
|
213
|
+
*/
|
|
214
|
+
dayOfWeek(): number;
|
|
215
|
+
/**
|
|
216
|
+
* Sets day of week zero based, first is monday
|
|
217
|
+
* @param day - Day of week to be set
|
|
218
|
+
*/
|
|
219
|
+
dayOfWeek(day: number): DateApiObject<moment.Moment>;
|
|
220
|
+
/**
|
|
221
|
+
* Gets hours zero based
|
|
222
|
+
*/
|
|
223
|
+
hour(): number;
|
|
224
|
+
/**
|
|
225
|
+
* Sets hours zero
|
|
226
|
+
* @param hour - hour to be set
|
|
227
|
+
*/
|
|
228
|
+
hour(hour: number): DateApiObject<moment.Moment>;
|
|
229
|
+
/**
|
|
230
|
+
* Gets minutes zero based
|
|
231
|
+
*/
|
|
232
|
+
minute(): number;
|
|
233
|
+
/**
|
|
234
|
+
* Sets minutes zero based
|
|
235
|
+
* @param minute - minutes to be set
|
|
236
|
+
*/
|
|
237
|
+
minute(minute: number): DateApiObject<moment.Moment>;
|
|
238
|
+
/**
|
|
239
|
+
* Gets indication whether current value is before 'date'
|
|
240
|
+
* @param date - Date which is this date compared to
|
|
241
|
+
*/
|
|
242
|
+
isBefore(date: moment.Moment): boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Gets indication whether current value is after 'date'
|
|
245
|
+
* @param date - Date which is this date compared to
|
|
246
|
+
*/
|
|
247
|
+
isAfter(date: moment.Moment): boolean;
|
|
248
|
+
/**
|
|
249
|
+
* Gets number of days between this and provided date
|
|
250
|
+
* @param date - Date which is used for computation of diff against
|
|
251
|
+
*/
|
|
252
|
+
diffDays(date: moment.Moment): number;
|
|
253
|
+
/**
|
|
254
|
+
* Compares whether this date is same week as provided date
|
|
255
|
+
* @param date - Date which is used for comparison of same week
|
|
256
|
+
*/
|
|
257
|
+
isSameWeek(date: moment.Moment): boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Compares whether this date is same decade as provided date
|
|
260
|
+
* @param date - Date which is used for comparison of same decade
|
|
261
|
+
*/
|
|
262
|
+
isSameDecade(date: moment.Moment): boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Compares whether this date is same year as provided date
|
|
265
|
+
* @param date - Date which is used for comparison of same year
|
|
266
|
+
*/
|
|
267
|
+
isSameYear(date: moment.Moment): boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Compares whether this date is same month as provided date
|
|
270
|
+
* @param date - Date which is used for comparison of same month
|
|
271
|
+
*/
|
|
272
|
+
isSameMonth(date: moment.Moment): boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Compares whether this date is same day as provided date
|
|
275
|
+
* @param date - Date which is used for comparison of same day
|
|
276
|
+
*/
|
|
277
|
+
isSameDay(date: moment.Moment): boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Creates clone of this instance, value and originalValue have same value and are cloned from value
|
|
280
|
+
*/
|
|
281
|
+
clone(): DateApiObject<moment.Moment>;
|
|
282
|
+
/**
|
|
283
|
+
* Creates clone of this instance, value and originalValue have same value and are cloned from originalValue
|
|
284
|
+
*/
|
|
285
|
+
cloneOriginal(): DateApiObject<moment.Moment>;
|
|
286
|
+
/**
|
|
287
|
+
* Updates originalValue, if value is not provided originalValue is set to value
|
|
288
|
+
* @param value - Value to be set as original, or null (value will be used as value)
|
|
289
|
+
* @returns Itself for fluent API
|
|
290
|
+
*/
|
|
291
|
+
updateOriginal(value?: moment.Moment): DateApiObject<moment.Moment>;
|
|
292
|
+
/**
|
|
293
|
+
* Changes value to same value as originalValue
|
|
294
|
+
* @returns Itself for fluent API
|
|
295
|
+
*/
|
|
296
|
+
resetOriginal(): DateApiObject<moment.Moment>;
|
|
297
|
+
}
|
|
4
298
|
/**
|
|
5
299
|
* Date api using MomentJS, used for obtaining DateApi wrapper object
|
|
6
300
|
*/
|
|
7
301
|
export declare class MomentDateApi implements DateApi<moment.Moment> {
|
|
8
302
|
protected _relativeParser: DateTimeRelativeParser<moment.Moment>;
|
|
9
|
-
|
|
303
|
+
protected _dateApiObjecType: DateApiObjectCtor<MomentDateApiObject, moment.Moment>;
|
|
304
|
+
constructor(_relativeParser: DateTimeRelativeParser<moment.Moment>, _dateApiObjecType: DateApiObjectCtor<MomentDateApiObject, moment.Moment>);
|
|
10
305
|
/**
|
|
11
306
|
* Gets wrapping object used for manipulation
|
|
12
307
|
* @param value - Value to be converted (parsed) and used for manipulation
|
|
@@ -37,4 +332,9 @@ export declare class MomentDateApi implements DateApi<moment.Moment> {
|
|
|
37
332
|
static ɵfac: i0.ɵɵFactoryDeclaration<MomentDateApi, never>;
|
|
38
333
|
static ɵprov: i0.ɵɵInjectableDeclaration<MomentDateApi>;
|
|
39
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* Type that represents creation of DateApiObject for moment
|
|
337
|
+
*/
|
|
338
|
+
export declare const momentDateApiObjectType: DateApiObjectCtor<MomentDateApiObject, moment.Moment>;
|
|
339
|
+
export {};
|
|
40
340
|
//# sourceMappingURL=momentDateApi.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"momentDateApi.service.d.ts","sourceRoot":"","sources":["momentDateApi.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"momentDateApi.service.d.ts","sourceRoot":"","sources":["momentDateApi.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,sBAAsB,EAAE,iBAAiB,EAAuB,MAAM,iBAAiB,CAAC;AAEnI,OAAO,MAA2B,MAAM,QAAQ,CAAC;;AAEjD;;GAEG;AACH,cAAM,mBAAoB,YAAW,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IAI7D;;OAEG;IACH,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC;IAExC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;IAIhC;;OAEG;IACH,IAAW,aAAa,IAAI,MAAM,CAAC,MAAM,CAGxC;IAED;;OAEG;IACH,IAAW,KAAK,IAAI,MAAM,CAAC,MAAM,CAGhC;gBAGW,KAAK,EAAE,SAAS,GAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAO3D;;OAEG;IACI,OAAO,IAAI,OAAO;I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AM,CAAuB,CAAC"}
|
package/package.json
CHANGED
package/src/misc/tokens.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
|
-
import { DateApi, FormatProvider } from '../services';
|
|
2
|
+
import { DateApi, DateApiObjectCtor, FormatProvider } from '../services';
|
|
3
|
+
/**
|
|
4
|
+
* Injection token used for injecting type that creates instance of DateApiObject
|
|
5
|
+
*/
|
|
6
|
+
export declare const DATE_API_OBJECT_TYPE: InjectionToken<DateApiObjectCtor>;
|
|
3
7
|
/**
|
|
4
8
|
* Injection token used for obtaining DateApi implementation
|
|
5
9
|
*/
|
package/src/misc/tokens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAC,OAAO,EAAE,cAAc,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAC,MAAM,aAAa,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,cAAc,CAAC,iBAAiB,CAAiE,CAAC;AAErI;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,cAAc,CAAC,OAAO,CAA2C,CAAC;AAEzF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CAsByC,CAAC"}
|
|
@@ -30,10 +30,19 @@ export declare class LoopScrollDirective<TData = any> implements OnChanges, Afte
|
|
|
30
30
|
* Indication whether ignore scroll handle
|
|
31
31
|
*/
|
|
32
32
|
protected _ignoreScrollHandle: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Indication whether skip value change
|
|
35
|
+
*/
|
|
36
|
+
protected _skipValueChange: boolean;
|
|
33
37
|
/**
|
|
34
38
|
* Value that is being set in loop scroll
|
|
35
39
|
*/
|
|
36
|
-
|
|
40
|
+
protected _value?: TData;
|
|
41
|
+
/**
|
|
42
|
+
* Gets or sets value that is being set in loop scroll
|
|
43
|
+
*/
|
|
44
|
+
get value(): TData;
|
|
45
|
+
set value(value: TData);
|
|
37
46
|
/**
|
|
38
47
|
* Indication whether is currently selection scroll open
|
|
39
48
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loopScroll.directive.d.ts","sourceRoot":"","sources":["loopScroll.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAA8B,UAAU,EAAE,YAAY,EAAuB,SAAS,EAAU,SAAS,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AAGvK,OAAO,EAAC,uBAAuB,EAAC,MAAM,4CAA4C,CAAC;;AAEnF;;GAEG;AACH,qBAIa,mBAAmB,CAAC,KAAK,GAAG,GAAG,CAAE,YAAW,SAAS,EAAE,gBAAgB;
|
|
1
|
+
{"version":3,"file":"loopScroll.directive.d.ts","sourceRoot":"","sources":["loopScroll.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAA8B,UAAU,EAAE,YAAY,EAAuB,SAAS,EAAU,SAAS,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AAGvK,OAAO,EAAC,uBAAuB,EAAC,MAAM,4CAA4C,CAAC;;AAEnF;;GAEG;AACH,qBAIa,mBAAmB,CAAC,KAAK,GAAG,GAAG,CAAE,YAAW,SAAS,EAAE,gBAAgB;IAmFpE,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,WAAW,CAAC;IA/E7D;;OAEG;IACH,SAAS,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,SAAS,CAAC,MAAM,CAAC,EAAE,uBAAuB,EAAE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javascript Date object
|
|
3
3
|
*/
|
|
4
4
|
export declare type DateValue = Date | string | number;
|
|
5
|
+
/**
|
|
6
|
+
* Definition of type, that is used for creating instance of DateApiObject
|
|
7
|
+
*/
|
|
8
|
+
export interface DateApiObjectCtor<TObject extends DateApiObject<TDate> = any, TDate = any> {
|
|
9
|
+
new (value: TDate | DateValue, format?: string, ...additionalParams: any[]): TObject;
|
|
10
|
+
}
|
|
5
11
|
/**
|
|
6
12
|
* Instance of object wrapping TDate, allowing manipulation with it
|
|
7
13
|
*/
|