@enigmatry/entry-components 15.2.1-preview.1 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -10
- package/common/directives/auto-disable-button.directive.d.ts +1 -1
- package/dialog/dialogs/entry-dialog.component.d.ts +1 -1
- package/{esm2020 → esm2022}/button/entry-button.directive.mjs +4 -4
- package/{esm2020 → esm2022}/button/entry-button.module.mjs +7 -7
- package/{esm2020 → esm2022}/common/common.module.mjs +7 -7
- package/{esm2020 → esm2022}/common/date-time/entry-date-time-adapter.mjs +4 -4
- package/{esm2020 → esm2022}/common/directives/auto-disable-button.directive.mjs +4 -4
- package/{esm2020 → esm2022}/common/directives/scroll-to-invalid-control.directive.mjs +4 -4
- package/{esm2020 → esm2022}/common/event-plugins/debounce.plugin.mjs +4 -4
- package/{esm2020 → esm2022}/common/event-plugins/throttle.plugin.mjs +4 -4
- package/{esm2020 → esm2022}/common/interceptors/accept-language.interceptor.mjs +4 -4
- package/{esm2020 → esm2022}/dialog/dialogs/alert/entry-alert-dialog.component.mjs +4 -4
- package/{esm2020 → esm2022}/dialog/dialogs/confirm/entry-confirm-dialog.component.mjs +4 -4
- package/{esm2020 → esm2022}/dialog/dialogs/entry-dialog.component.mjs +4 -4
- package/{esm2020 → esm2022}/dialog/dialogs/error/entry-error-dialog.component.mjs +4 -4
- package/{esm2020 → esm2022}/dialog/entry-dialog.module.mjs +19 -19
- package/esm2022/dialog/entry-dialog.service.mjs +86 -0
- package/esm2022/file-input/entry-file-input.component.mjs +201 -0
- package/{esm2020 → esm2022}/file-input/entry-file-input.module.mjs +13 -13
- package/{esm2020 → esm2022}/modules/entry-components.module.mjs +21 -21
- package/{esm2020 → esm2022}/permissions/permission.directive.mjs +4 -4
- package/{esm2020 → esm2022}/permissions/permission.module.mjs +7 -7
- package/{esm2020 → esm2022}/permissions/permission.pipe.mjs +4 -4
- package/{esm2020 → esm2022}/search-filter/autocomplete/autocomplete-search-filter.component.mjs +4 -4
- package/esm2022/search-filter/date/date-search-filter.component.mjs +19 -0
- package/{esm2020 → esm2022}/search-filter/date-time/date-time-search-filter.component.mjs +7 -7
- package/{esm2020 → esm2022}/search-filter/entry-search-filter.component.mjs +4 -4
- package/{esm2020 → esm2022}/search-filter/entry-search-filter.module.mjs +28 -28
- package/{esm2020 → esm2022}/search-filter/select/select-search-filter.component.mjs +4 -4
- package/{esm2020 → esm2022}/search-filter/text/text-search-filter.component.mjs +4 -4
- package/{esm2020 → esm2022}/spinner/entry-spinner/spinner.component.mjs +10 -10
- package/{esm2020 → esm2022}/spinner/spinner-overlay-container.mjs +4 -4
- package/{esm2020 → esm2022}/spinner/spinner.module.mjs +9 -9
- package/{esm2020 → esm2022}/table/components/entry-cell/entry-cell.component.mjs +4 -4
- package/{esm2020 → esm2022}/table/components/entry-cell-context-menu/entry-cell-context-menu.component.mjs +4 -4
- package/{esm2020 → esm2022}/table/components/entry-cell-formatted-value/entry-cell-formatted-value.component.mjs +4 -4
- package/esm2022/table/components/entry-table/entry-table.component.mjs +248 -0
- package/{esm2020 → esm2022}/table/entry-table.module.mjs +33 -33
- package/{esm2020 → esm2022}/table/interfaces/entry-table-config.mjs +1 -2
- package/{esm2020 → esm2022}/validation/entry-display-control-validation.directive.mjs +4 -4
- package/{esm2020 → esm2022}/validation/entry-form-errors.component.mjs +6 -6
- package/{esm2020 → esm2022}/validation/entry-validation.module.mjs +13 -13
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-button.mjs +9 -9
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-button.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-common.mjs +24 -24
- package/{fesm2015 → fesm2022}/enigmatry-entry-components-common.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-dialog.mjs +33 -33
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-dialog.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-file-input.mjs +21 -17
- package/fesm2022/enigmatry-entry-components-file-input.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-permissions.mjs +12 -12
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-permissions.mjs.map +1 -1
- package/fesm2022/enigmatry-entry-components-search-filter.mjs +387 -0
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-search-filter.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-spinner.mjs +20 -20
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-spinner.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-table.mjs +44 -45
- package/fesm2022/enigmatry-entry-components-table.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-validation.mjs +20 -20
- package/{fesm2020 → fesm2022}/enigmatry-entry-components-validation.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/enigmatry-entry-components.mjs +20 -20
- package/{fesm2020 → fesm2022}/enigmatry-entry-components.mjs.map +1 -1
- package/file-input/entry-file-input.component.d.ts +1 -1
- package/package.json +39 -63
- package/permissions/permission.directive.d.ts +1 -1
- package/search-filter/autocomplete/autocomplete-search-filter.component.d.ts +1 -1
- package/search-filter/date/date-search-filter.component.d.ts +1 -1
- package/search-filter/date-time/date-time-search-filter.component.d.ts +1 -1
- package/search-filter/entry-search-filter.component.d.ts +1 -1
- package/search-filter/select/select-search-filter.component.d.ts +1 -1
- package/search-filter/text/text-search-filter.component.d.ts +1 -1
- package/spinner/entry-spinner/spinner.component.d.ts +1 -1
- package/table/components/entry-cell/entry-cell.component.d.ts +1 -1
- package/table/components/entry-cell-context-menu/entry-cell-context-menu.component.d.ts +1 -1
- package/table/components/entry-cell-formatted-value/entry-cell-formatted-value.component.d.ts +1 -1
- package/table/components/entry-table/entry-table.component.d.ts +1 -1
- package/validation/entry-display-control-validation.directive.d.ts +1 -1
- package/validation/entry-form-errors.component.d.ts +1 -1
- package/esm2020/dialog/entry-dialog.service.mjs +0 -86
- package/esm2020/file-input/entry-file-input.component.mjs +0 -197
- package/esm2020/search-filter/date/date-search-filter.component.mjs +0 -19
- package/esm2020/table/components/entry-table/entry-table.component.mjs +0 -248
- package/fesm2015/enigmatry-entry-components-button.mjs +0 -114
- package/fesm2015/enigmatry-entry-components-button.mjs.map +0 -1
- package/fesm2015/enigmatry-entry-components-common.mjs +0 -405
- package/fesm2015/enigmatry-entry-components-dialog.mjs +0 -333
- package/fesm2015/enigmatry-entry-components-dialog.mjs.map +0 -1
- package/fesm2015/enigmatry-entry-components-file-input.mjs +0 -237
- package/fesm2015/enigmatry-entry-components-file-input.mjs.map +0 -1
- package/fesm2015/enigmatry-entry-components-permissions.mjs +0 -98
- package/fesm2015/enigmatry-entry-components-permissions.mjs.map +0 -1
- package/fesm2015/enigmatry-entry-components-search-filter.mjs +0 -394
- package/fesm2015/enigmatry-entry-components-search-filter.mjs.map +0 -1
- package/fesm2015/enigmatry-entry-components-spinner.mjs +0 -156
- package/fesm2015/enigmatry-entry-components-spinner.mjs.map +0 -1
- package/fesm2015/enigmatry-entry-components-table.mjs +0 -462
- package/fesm2015/enigmatry-entry-components-table.mjs.map +0 -1
- package/fesm2015/enigmatry-entry-components-validation.mjs +0 -219
- package/fesm2015/enigmatry-entry-components-validation.mjs.map +0 -1
- package/fesm2015/enigmatry-entry-components.mjs +0 -87
- package/fesm2015/enigmatry-entry-components.mjs.map +0 -1
- package/fesm2020/enigmatry-entry-components-common.mjs.map +0 -1
- package/fesm2020/enigmatry-entry-components-file-input.mjs.map +0 -1
- package/fesm2020/enigmatry-entry-components-search-filter.mjs +0 -387
- package/fesm2020/enigmatry-entry-components-table.mjs.map +0 -1
- /package/{esm2020 → esm2022}/button/enigmatry-entry-components-button.mjs +0 -0
- /package/{esm2020 → esm2022}/button/entry-button-config.mjs +0 -0
- /package/{esm2020 → esm2022}/button/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/common/constants.mjs +0 -0
- /package/{esm2020 → esm2022}/common/date-time/entry-date-time.mjs +0 -0
- /package/{esm2020 → esm2022}/common/date-time/index.mjs +0 -0
- /package/{esm2020 → esm2022}/common/directives/index.mjs +0 -0
- /package/{esm2020 → esm2022}/common/enigmatry-entry-components-common.mjs +0 -0
- /package/{esm2020 → esm2022}/common/event-plugins/abstract.plugin.mjs +0 -0
- /package/{esm2020 → esm2022}/common/event-plugins/index.mjs +0 -0
- /package/{esm2020 → esm2022}/common/interceptors/index.mjs +0 -0
- /package/{esm2020 → esm2022}/common/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/common/utils/index.mjs +0 -0
- /package/{esm2020 → esm2022}/common/utils/provide-config.mjs +0 -0
- /package/{esm2020 → esm2022}/dialog/dialogs/alert/entry-alert-dialog-data.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/dialog/dialogs/confirm/entry-confirm-dialog-data.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/dialog/dialogs/error/entry-error-dialog-data.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/dialog/enigmatry-entry-components-dialog.mjs +0 -0
- /package/{esm2020 → esm2022}/dialog/entry-dialog-buttons-alignment.type.mjs +0 -0
- /package/{esm2020 → esm2022}/dialog/entry-dialog-config.model.mjs +0 -0
- /package/{esm2020 → esm2022}/dialog/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/enigmatry-entry-components.mjs +0 -0
- /package/{esm2020 → esm2022}/file-input/enigmatry-entry-components-file-input.mjs +0 -0
- /package/{esm2020 → esm2022}/file-input/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/permissions/enigmatry-entry-components-permissions.mjs +0 -0
- /package/{esm2020 → esm2022}/permissions/permission-type.mjs +0 -0
- /package/{esm2020 → esm2022}/permissions/permission.guard.mjs +0 -0
- /package/{esm2020 → esm2022}/permissions/permission.service.mjs +0 -0
- /package/{esm2020 → esm2022}/permissions/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/search-filter/autocomplete/autocomplete-search-filter.model.mjs +0 -0
- /package/{esm2020 → esm2022}/search-filter/control-type.mjs +0 -0
- /package/{esm2020 → esm2022}/search-filter/date/date-search-filter.model.mjs +0 -0
- /package/{esm2020 → esm2022}/search-filter/date-time/date-time-search-filter.model.mjs +0 -0
- /package/{esm2020 → esm2022}/search-filter/enigmatry-entry-components-search-filter.mjs +0 -0
- /package/{esm2020 → esm2022}/search-filter/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/search-filter/search-filter-base.model.mjs +0 -0
- /package/{esm2020 → esm2022}/search-filter/search-filter-config.model.mjs +0 -0
- /package/{esm2020 → esm2022}/search-filter/search-filter-params.type.mjs +0 -0
- /package/{esm2020 → esm2022}/search-filter/select/select-search-filter.model.mjs +0 -0
- /package/{esm2020 → esm2022}/search-filter/select-option.model.mjs +0 -0
- /package/{esm2020 → esm2022}/search-filter/text/text-search-filter.model.mjs +0 -0
- /package/{esm2020 → esm2022}/spinner/enigmatry-entry-components-spinner.mjs +0 -0
- /package/{esm2020 → esm2022}/spinner/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/table/components/index.mjs +0 -0
- /package/{esm2020 → esm2022}/table/enigmatry-entry-components-table.mjs +0 -0
- /package/{esm2020 → esm2022}/table/interfaces/cell-template.mjs +0 -0
- /package/{esm2020 → esm2022}/table/interfaces/column-def.mjs +0 -0
- /package/{esm2020 → esm2022}/table/interfaces/column-sort-prop.mjs +0 -0
- /package/{esm2020 → esm2022}/table/interfaces/column-type-parameter.mjs +0 -0
- /package/{esm2020 → esm2022}/table/interfaces/column-type.mjs +0 -0
- /package/{esm2020 → esm2022}/table/interfaces/context-menu-item.mjs +0 -0
- /package/{esm2020 → esm2022}/table/interfaces/index.mjs +0 -0
- /package/{esm2020 → esm2022}/table/interfaces/paged-query.mjs +0 -0
- /package/{esm2020 → esm2022}/table/interfaces/pagination.mjs +0 -0
- /package/{esm2020 → esm2022}/table/interfaces/row-class-formatter.mjs +0 -0
- /package/{esm2020 → esm2022}/table/interfaces/row-context-menu-formatter.mjs +0 -0
- /package/{esm2020 → esm2022}/table/interfaces/row-selection-formatter.mjs +0 -0
- /package/{esm2020 → esm2022}/table/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/validation/enigmatry-entry-components-validation.mjs +0 -0
- /package/{esm2020 → esm2022}/validation/entry-validation-config.model.mjs +0 -0
- /package/{esm2020 → esm2022}/validation/entry-validation.mjs +0 -0
- /package/{esm2020 → esm2022}/validation/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/validation/validation-problem-details.interface.mjs +0 -0
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, Input, Self, Injectable, NgModule, InjectionToken, inject, LOCALE_ID, Optional, Inject, SkipSelf } from '@angular/core';
|
|
3
|
-
import { CommonModule } from '@angular/common';
|
|
4
|
-
import { Subject, fromEvent, timer } from 'rxjs';
|
|
5
|
-
import { takeUntil } from 'rxjs/operators';
|
|
6
|
-
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
7
|
-
import * as i1 from '@angular/forms';
|
|
8
|
-
import { debounce, throttle } from 'lodash-es';
|
|
9
|
-
import { EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';
|
|
10
|
-
import * as i1$1 from '@angular/material/core';
|
|
11
|
-
import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core';
|
|
12
|
-
|
|
13
|
-
const NG_VALID_CLASS = '.ng-valid';
|
|
14
|
-
const NG_INVALID_CLASS = '.ng-invalid';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Auto disable button after click or submit with entry-auto-disable directive.
|
|
18
|
-
* Directive is applied to 'button[entry-auto-disable]:not([disabled])'
|
|
19
|
-
* Default auto disable interval is 2000ms (2sec)
|
|
20
|
-
*
|
|
21
|
-
* Usage
|
|
22
|
-
* <button mat-button entry-submit-button entry-auto-disable type="submit">Submit</button>
|
|
23
|
-
* or with auto disabled interval in milliseconds
|
|
24
|
-
* <button mat-button entry-submit-button entry-auto-disable="5000" type="submit">Submit</button>
|
|
25
|
-
*/
|
|
26
|
-
class AutoDisableButtonDirective {
|
|
27
|
-
constructor(elementRef) {
|
|
28
|
-
this.elementRef = elementRef;
|
|
29
|
-
this._destroy$ = new Subject();
|
|
30
|
-
this._disableIntervalInMs = 2000;
|
|
31
|
-
}
|
|
32
|
-
get disableIntervalInMs() {
|
|
33
|
-
return this._disableIntervalInMs;
|
|
34
|
-
}
|
|
35
|
-
set disableIntervalInMs(value) {
|
|
36
|
-
this._disableIntervalInMs = coerceNumberProperty(value, 2000);
|
|
37
|
-
}
|
|
38
|
-
ngOnInit() {
|
|
39
|
-
const button = this.elementRef.nativeElement;
|
|
40
|
-
const isTypeSubmit = button.getAttribute('type') === 'submit';
|
|
41
|
-
const form = button.closest('form');
|
|
42
|
-
if (isTypeSubmit && form) {
|
|
43
|
-
// listen to form submit event
|
|
44
|
-
fromEvent(form, 'submit')
|
|
45
|
-
.pipe(takeUntil(this._destroy$))
|
|
46
|
-
.subscribe(_ => {
|
|
47
|
-
if (form.matches(NG_VALID_CLASS)) {
|
|
48
|
-
this.disableButton(this._disableIntervalInMs);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
// otherwise listen to click event
|
|
54
|
-
fromEvent(button, 'click')
|
|
55
|
-
.pipe(takeUntil(this._destroy$))
|
|
56
|
-
.subscribe(_ => this.disableButton(this._disableIntervalInMs));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
ngOnDestroy() {
|
|
60
|
-
this._destroy$.next();
|
|
61
|
-
this._destroy$.complete();
|
|
62
|
-
}
|
|
63
|
-
disableButton(disablePeriodInMs) {
|
|
64
|
-
const button = this.elementRef.nativeElement;
|
|
65
|
-
button.disabled = true;
|
|
66
|
-
timer(disablePeriodInMs)
|
|
67
|
-
.pipe(takeUntil(this._destroy$))
|
|
68
|
-
.subscribe(() => button.disabled = false);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
AutoDisableButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AutoDisableButtonDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
72
|
-
AutoDisableButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: AutoDisableButtonDirective, isStandalone: true, selector: "button[entry-auto-disable]:not([disabled])", inputs: { disableIntervalInMs: ["entry-auto-disable", "disableIntervalInMs"] }, ngImport: i0 });
|
|
73
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AutoDisableButtonDirective, decorators: [{
|
|
74
|
-
type: Directive,
|
|
75
|
-
args: [{
|
|
76
|
-
standalone: true,
|
|
77
|
-
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
78
|
-
selector: 'button[entry-auto-disable]:not([disabled])'
|
|
79
|
-
}]
|
|
80
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { disableIntervalInMs: [{
|
|
81
|
-
type: Input,
|
|
82
|
-
args: ['entry-auto-disable']
|
|
83
|
-
}] } });
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Scroll to first invalid control when form is submitted.
|
|
87
|
-
* Directive is applied to 'form[formGroup],form[ngForm]' (reactive or template driven forms)
|
|
88
|
-
*/
|
|
89
|
-
class ScrollToInvalidControlDirective {
|
|
90
|
-
constructor(form, elementRef) {
|
|
91
|
-
this.form = form;
|
|
92
|
-
this.elementRef = elementRef;
|
|
93
|
-
this.destroy$ = new Subject();
|
|
94
|
-
}
|
|
95
|
-
ngOnInit() {
|
|
96
|
-
fromEvent(this.elementRef.nativeElement, 'submit')
|
|
97
|
-
.pipe(takeUntil(this.destroy$))
|
|
98
|
-
.subscribe(_ => {
|
|
99
|
-
if (this.form.invalid) {
|
|
100
|
-
this.scrollToInvalidControl();
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
ngOnDestroy() {
|
|
105
|
-
this.destroy$.next();
|
|
106
|
-
this.destroy$.complete();
|
|
107
|
-
}
|
|
108
|
-
scrollToInvalidControl() {
|
|
109
|
-
const firstInvalidControl = this.elementRef.nativeElement.querySelector(NG_INVALID_CLASS);
|
|
110
|
-
if (firstInvalidControl) {
|
|
111
|
-
firstInvalidControl.scrollIntoView({
|
|
112
|
-
behavior: 'smooth',
|
|
113
|
-
block: 'center' // vertical alignment
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
ScrollToInvalidControlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ScrollToInvalidControlDirective, deps: [{ token: i1.ControlContainer, self: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
119
|
-
ScrollToInvalidControlDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: ScrollToInvalidControlDirective, isStandalone: true, selector: "form[formGroup],form[ngForm]", ngImport: i0 });
|
|
120
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ScrollToInvalidControlDirective, decorators: [{
|
|
121
|
-
type: Directive,
|
|
122
|
-
args: [{
|
|
123
|
-
standalone: true,
|
|
124
|
-
selector: 'form[formGroup],form[ngForm]'
|
|
125
|
-
}]
|
|
126
|
-
}], ctorParameters: function () {
|
|
127
|
-
return [{ type: i1.ControlContainer, decorators: [{
|
|
128
|
-
type: Self
|
|
129
|
-
}] }, { type: i0.ElementRef }];
|
|
130
|
-
} });
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* abstract class EventManagerPlugin will be exposed in the public api
|
|
134
|
-
* https://github.com/angular/angular/pull/49969
|
|
135
|
-
*
|
|
136
|
-
* Until then creating it from reference
|
|
137
|
-
* https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/event_manager.ts#L93
|
|
138
|
-
*
|
|
139
|
-
* How to create custom event modifiers
|
|
140
|
-
* https://github.com/Tinkoff/ng-event-plugins,
|
|
141
|
-
* https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/key_events.ts
|
|
142
|
-
* https://netbasal.com/lifting-the-veil-insights-into-angulars-eventmanagerplugin-ed9d14cbb31a
|
|
143
|
-
*/
|
|
144
|
-
class EventManagerPlugin {
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Entry event plugin base class
|
|
148
|
-
*/
|
|
149
|
-
class EntryEventManagerPlugin extends EventManagerPlugin {
|
|
150
|
-
/** return `true` for every event name that has specified modifier */
|
|
151
|
-
supports(eventName) {
|
|
152
|
-
return eventName.includes(this.modifier);
|
|
153
|
-
}
|
|
154
|
-
/** unwrap params e.g. (click.debounce.500) => ['debounce', 500] */
|
|
155
|
-
unwrapParams(eventName) {
|
|
156
|
-
return eventName
|
|
157
|
-
.substring(eventName.indexOf(this.modifier))
|
|
158
|
-
.split('.')
|
|
159
|
-
.filter(x => !!x);
|
|
160
|
-
}
|
|
161
|
-
/** get event name e.g. (click.debounce.500) => click */
|
|
162
|
-
unwrapEventName(eventName) {
|
|
163
|
-
return eventName.substring(0, eventName.indexOf(this.modifier));
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
|
168
|
-
/**
|
|
169
|
-
* Provides event plugin for debouncing events.
|
|
170
|
-
*
|
|
171
|
-
* How to use:
|
|
172
|
-
* <button (click.debounce)="doSomething($event)">
|
|
173
|
-
* <input (keyup.debounce.500)="doSomething($event)">
|
|
174
|
-
*/
|
|
175
|
-
class DebounceEventPlugin extends EntryEventManagerPlugin {
|
|
176
|
-
constructor() {
|
|
177
|
-
super(...arguments);
|
|
178
|
-
this.modifier = '.debounce';
|
|
179
|
-
}
|
|
180
|
-
addEventListener(element, eventName, originalHandler) {
|
|
181
|
-
// e.g. (click.debounce.500)
|
|
182
|
-
const [_modifier, milliseconds = 500, option = 'leading'] = this.unwrapParams(eventName);
|
|
183
|
-
// run original handler inside ngZone in which the event occurred
|
|
184
|
-
const innerHandler = (event) => this.manager.getZone().runGuarded(() => originalHandler(event));
|
|
185
|
-
// create debounced handler
|
|
186
|
-
const debouncedHandler = debounce(innerHandler, milliseconds, { leading: option === 'leading', trailing: option === 'trailing' });
|
|
187
|
-
// register event with debounced handler
|
|
188
|
-
return this.manager.addEventListener(element, this.unwrapEventName(eventName), debouncedHandler);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
DebounceEventPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DebounceEventPlugin, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
192
|
-
DebounceEventPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DebounceEventPlugin });
|
|
193
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DebounceEventPlugin, decorators: [{
|
|
194
|
-
type: Injectable
|
|
195
|
-
}] });
|
|
196
|
-
|
|
197
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
|
198
|
-
/**
|
|
199
|
-
* Provides event plugin for throttling events.
|
|
200
|
-
*
|
|
201
|
-
* How to use:
|
|
202
|
-
* <button (click.throttle)="doSomething($event)">
|
|
203
|
-
* <input (keyup.throttle.500)="doSomething($event)">
|
|
204
|
-
*/
|
|
205
|
-
class ThrottleEventPlugin extends EntryEventManagerPlugin {
|
|
206
|
-
constructor() {
|
|
207
|
-
super(...arguments);
|
|
208
|
-
this.modifier = '.throttle';
|
|
209
|
-
}
|
|
210
|
-
addEventListener(element, eventName, originalHandler) {
|
|
211
|
-
// e.g. (keyup.throttle.500)
|
|
212
|
-
const [_modifier, milliseconds = 500] = this.unwrapParams(eventName);
|
|
213
|
-
// run original handler inside ngZone in which the event occurred
|
|
214
|
-
const innerHandler = (event) => this.manager.getZone().runGuarded(() => originalHandler(event));
|
|
215
|
-
// create throttled handler
|
|
216
|
-
const throttledHandler = throttle(innerHandler, milliseconds);
|
|
217
|
-
// register event with throttled handler
|
|
218
|
-
return this.manager.addEventListener(element, this.unwrapEventName(eventName), throttledHandler);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
ThrottleEventPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ThrottleEventPlugin, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
222
|
-
ThrottleEventPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ThrottleEventPlugin });
|
|
223
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ThrottleEventPlugin, decorators: [{
|
|
224
|
-
type: Injectable
|
|
225
|
-
}] });
|
|
226
|
-
|
|
227
|
-
const DIRECTIVES = [
|
|
228
|
-
AutoDisableButtonDirective,
|
|
229
|
-
ScrollToInvalidControlDirective,
|
|
230
|
-
];
|
|
231
|
-
const EVENT_PLUGINS = [
|
|
232
|
-
DebounceEventPlugin,
|
|
233
|
-
ThrottleEventPlugin
|
|
234
|
-
];
|
|
235
|
-
const NG_EVENT_PLUGINS = EVENT_PLUGINS.map(useClass => ({
|
|
236
|
-
provide: EVENT_MANAGER_PLUGINS,
|
|
237
|
-
multi: true,
|
|
238
|
-
useClass
|
|
239
|
-
}));
|
|
240
|
-
class EntryCommonModule {
|
|
241
|
-
static forRoot() {
|
|
242
|
-
return {
|
|
243
|
-
ngModule: EntryCommonModule,
|
|
244
|
-
providers: NG_EVENT_PLUGINS
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
EntryCommonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EntryCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
249
|
-
EntryCommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: EntryCommonModule, imports: [CommonModule, AutoDisableButtonDirective,
|
|
250
|
-
ScrollToInvalidControlDirective], exports: [AutoDisableButtonDirective,
|
|
251
|
-
ScrollToInvalidControlDirective] });
|
|
252
|
-
EntryCommonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EntryCommonModule, imports: [CommonModule] });
|
|
253
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EntryCommonModule, decorators: [{
|
|
254
|
-
type: NgModule,
|
|
255
|
-
args: [{
|
|
256
|
-
declarations: [],
|
|
257
|
-
imports: [
|
|
258
|
-
CommonModule,
|
|
259
|
-
DIRECTIVES
|
|
260
|
-
],
|
|
261
|
-
exports: [
|
|
262
|
-
DIRECTIVES
|
|
263
|
-
]
|
|
264
|
-
}]
|
|
265
|
-
}] });
|
|
266
|
-
|
|
267
|
-
function createInjectionToken(defaultValue) {
|
|
268
|
-
return new InjectionToken(defaultValue.constructor.name, {
|
|
269
|
-
providedIn: 'root',
|
|
270
|
-
factory: () => defaultValue
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
function provideConfig(token, factory) {
|
|
274
|
-
return {
|
|
275
|
-
provide: token,
|
|
276
|
-
useFactory: factory
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Sets the Accept-Language HTTP request header using the value from LOCALE_ID.
|
|
282
|
-
*/
|
|
283
|
-
class AcceptLanguageInterceptor {
|
|
284
|
-
constructor() {
|
|
285
|
-
this.localeId = inject(LOCALE_ID);
|
|
286
|
-
}
|
|
287
|
-
intercept(request, next) {
|
|
288
|
-
const newRequest = request.clone({
|
|
289
|
-
headers: request.headers.set('Accept-Language', this.localeId)
|
|
290
|
-
});
|
|
291
|
-
return next.handle(newRequest);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
AcceptLanguageInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AcceptLanguageInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
295
|
-
AcceptLanguageInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AcceptLanguageInterceptor });
|
|
296
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AcceptLanguageInterceptor, decorators: [{
|
|
297
|
-
type: Injectable
|
|
298
|
-
}] });
|
|
299
|
-
|
|
300
|
-
const ENTRY_MAT_DATE_TIME = new InjectionToken('');
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Extends provided DateAdapter with date time support
|
|
304
|
-
*/
|
|
305
|
-
class EntryDateTimeAdapter extends DateAdapter {
|
|
306
|
-
constructor(matDateLocale, entryMatDateTime, dateAdapter) {
|
|
307
|
-
super();
|
|
308
|
-
this.dateAdapter = dateAdapter;
|
|
309
|
-
this.compareFunction = entryMatDateTime.compareDate;
|
|
310
|
-
this.dateAdapter.setLocale(matDateLocale);
|
|
311
|
-
}
|
|
312
|
-
getYear(date) {
|
|
313
|
-
return this.dateAdapter.getYear(date);
|
|
314
|
-
}
|
|
315
|
-
getMonth(date) {
|
|
316
|
-
return this.dateAdapter.getMonth(date);
|
|
317
|
-
}
|
|
318
|
-
getDate(date) {
|
|
319
|
-
return this.dateAdapter.getDate(date);
|
|
320
|
-
}
|
|
321
|
-
getDayOfWeek(date) {
|
|
322
|
-
return this.dateAdapter.getDayOfWeek(date);
|
|
323
|
-
}
|
|
324
|
-
getMonthNames(style) {
|
|
325
|
-
return this.dateAdapter.getMonthNames(style);
|
|
326
|
-
}
|
|
327
|
-
getDateNames() {
|
|
328
|
-
return this.dateAdapter.getDateNames();
|
|
329
|
-
}
|
|
330
|
-
getDayOfWeekNames(style) {
|
|
331
|
-
return this.dateAdapter.getDayOfWeekNames(style);
|
|
332
|
-
}
|
|
333
|
-
getYearName(date) {
|
|
334
|
-
return this.dateAdapter.getYearName(date);
|
|
335
|
-
}
|
|
336
|
-
getFirstDayOfWeek() {
|
|
337
|
-
return this.dateAdapter.getFirstDayOfWeek();
|
|
338
|
-
}
|
|
339
|
-
getNumDaysInMonth(date) {
|
|
340
|
-
return this.dateAdapter.getNumDaysInMonth(date);
|
|
341
|
-
}
|
|
342
|
-
clone(date) {
|
|
343
|
-
return this.dateAdapter.clone(date);
|
|
344
|
-
}
|
|
345
|
-
createDate(year, month, date) {
|
|
346
|
-
return this.dateAdapter.createDate(year, month, date);
|
|
347
|
-
}
|
|
348
|
-
today() {
|
|
349
|
-
return this.dateAdapter.today();
|
|
350
|
-
}
|
|
351
|
-
parse(value, parseFormat) {
|
|
352
|
-
return this.dateAdapter.parse(value, parseFormat);
|
|
353
|
-
}
|
|
354
|
-
format(date, displayFormat) {
|
|
355
|
-
return this.dateAdapter.format(date, displayFormat);
|
|
356
|
-
}
|
|
357
|
-
addCalendarYears(date, years) {
|
|
358
|
-
return this.dateAdapter.addCalendarYears(date, years);
|
|
359
|
-
}
|
|
360
|
-
addCalendarMonths(date, months) {
|
|
361
|
-
return this.dateAdapter.addCalendarMonths(date, months);
|
|
362
|
-
}
|
|
363
|
-
addCalendarDays(date, days) {
|
|
364
|
-
return this.dateAdapter.addCalendarDays(date, days);
|
|
365
|
-
}
|
|
366
|
-
toIso8601(date) {
|
|
367
|
-
return this.dateAdapter.toIso8601(date);
|
|
368
|
-
}
|
|
369
|
-
isDateInstance(obj) {
|
|
370
|
-
return this.dateAdapter.isDateInstance(obj);
|
|
371
|
-
}
|
|
372
|
-
isValid(date) {
|
|
373
|
-
return this.dateAdapter.isValid(date);
|
|
374
|
-
}
|
|
375
|
-
invalid() {
|
|
376
|
-
return this.dateAdapter.invalid();
|
|
377
|
-
}
|
|
378
|
-
compareDate(first, second) {
|
|
379
|
-
return this.compareFunction(first, second);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
EntryDateTimeAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EntryDateTimeAdapter, deps: [{ token: MAT_DATE_LOCALE, optional: true }, { token: ENTRY_MAT_DATE_TIME }, { token: i1$1.DateAdapter, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
383
|
-
EntryDateTimeAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EntryDateTimeAdapter });
|
|
384
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EntryDateTimeAdapter, decorators: [{
|
|
385
|
-
type: Injectable
|
|
386
|
-
}], ctorParameters: function () {
|
|
387
|
-
return [{ type: undefined, decorators: [{
|
|
388
|
-
type: Optional
|
|
389
|
-
}, {
|
|
390
|
-
type: Inject,
|
|
391
|
-
args: [MAT_DATE_LOCALE]
|
|
392
|
-
}] }, { type: undefined, decorators: [{
|
|
393
|
-
type: Inject,
|
|
394
|
-
args: [ENTRY_MAT_DATE_TIME]
|
|
395
|
-
}] }, { type: i1$1.DateAdapter, decorators: [{
|
|
396
|
-
type: SkipSelf
|
|
397
|
-
}] }];
|
|
398
|
-
} });
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Generated bundle index. Do not edit.
|
|
402
|
-
*/
|
|
403
|
-
|
|
404
|
-
export { AcceptLanguageInterceptor, AutoDisableButtonDirective, DebounceEventPlugin, ENTRY_MAT_DATE_TIME, EntryCommonModule, EntryDateTimeAdapter, NG_EVENT_PLUGINS, ScrollToInvalidControlDirective, ThrottleEventPlugin, createInjectionToken, provideConfig };
|
|
405
|
-
//# sourceMappingURL=enigmatry-entry-components-common.mjs.map
|