@enigmatry/entry-components 15.0.0-preview.3 → 15.0.0-preview.4
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/common/README.md +39 -0
- package/common/common.module.d.ts +3 -0
- package/common/event-plugins/abstract.plugin.d.ts +40 -0
- package/common/event-plugins/debounce.plugin.d.ts +15 -0
- package/common/event-plugins/index.d.ts +2 -0
- package/common/event-plugins/throttle.plugin.d.ts +15 -0
- package/common/public-api.d.ts +2 -1
- package/esm2020/common/common.module.mjs +20 -1
- package/esm2020/common/event-plugins/abstract.plugin.mjs +35 -0
- package/esm2020/common/event-plugins/debounce.plugin.mjs +34 -0
- package/esm2020/common/event-plugins/index.mjs +3 -0
- package/esm2020/common/event-plugins/throttle.plugin.mjs +34 -0
- package/esm2020/common/public-api.mjs +3 -2
- package/esm2020/modules/entry-components.module.mjs +6 -2
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/enigmatry-entry-components-common.mjs +114 -2
- package/fesm2015/enigmatry-entry-components-common.mjs.map +1 -1
- package/fesm2015/enigmatry-entry-components.mjs +6 -1
- package/fesm2015/enigmatry-entry-components.mjs.map +1 -1
- package/fesm2020/enigmatry-entry-components-common.mjs +114 -2
- package/fesm2020/enigmatry-entry-components-common.mjs.map +1 -1
- package/fesm2020/enigmatry-entry-components.mjs +6 -1
- package/fesm2020/enigmatry-entry-components.mjs.map +1 -1
- package/modules/entry-components.module.d.ts +8 -7
- package/package.json +3 -2
- package/public-api.d.ts +1 -0
package/common/README.md
CHANGED
|
@@ -13,6 +13,45 @@ Scrolls to first invalid form control when form is submitted.
|
|
|
13
13
|
Selector: `form[formGroup],form[ngForm]`
|
|
14
14
|
|
|
15
15
|
Directive is applied to reactive or template driven forms, no additional selectors are required. Directive will listen to form submit event and scroll to first invalid form control when form is invalid. For this to work, submit button should be enabled so users always get feedback of what is wrong.
|
|
16
|
+
|
|
17
|
+
## Event plugins
|
|
18
|
+
|
|
19
|
+
Extending Angular events binding syntax with debounce and throttle event plugins.
|
|
20
|
+
|
|
21
|
+
When binding to events in Angular we can add debounce or throttle modifier after the event name:
|
|
22
|
+
* using the event binding syntax "`(click.debounce)="onSave()`"
|
|
23
|
+
* or HostListener "`@HostListener('keyup.throttle')`".
|
|
24
|
+
|
|
25
|
+
Example: Debouncing a click event with default delay
|
|
26
|
+
```html
|
|
27
|
+
<button (click.debounce)="onClick($event)">
|
|
28
|
+
```
|
|
29
|
+
Example: Debouncing a keyup event with custom delay
|
|
30
|
+
```html
|
|
31
|
+
<input (keyup.debounce.1000)="doSomething($event)">
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Example: Throttling a click event with default delay
|
|
35
|
+
```html
|
|
36
|
+
<input (keyup.throttle)="onKeyUp($event)">
|
|
37
|
+
```
|
|
38
|
+
Example: Throttle a keyup event with custom delay
|
|
39
|
+
```html
|
|
40
|
+
<input (keyup.throttle.1000)="onKeyUp($event)">
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Modifier options `keyup.debounce.1000.leading`
|
|
44
|
+
* event name e.g. `keyup`
|
|
45
|
+
* modifier: `debounce` or `throttle`
|
|
46
|
+
* milliseconds: delay in milliseconds before the event handler is executed
|
|
47
|
+
* option: `leading` or `trailing`. If set to 'leading', the event handler is executed on the leading edge of the debounce timeout. If set to 'trailing', it's executed on the trailing edge.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
Difference between `debounce` and `throttle`
|
|
51
|
+
* Debouncing waits for a certain time before invoking the function again.
|
|
52
|
+
* Debouncing ensures that the function is called only once, even if the event is triggered multiple times.
|
|
53
|
+
* Throttling limits the number of times the function can be called over a certain period.
|
|
54
|
+
* Throttling ensures that the function is called at a regular interval, even if the event is triggered multiple times.
|
|
16
55
|
|
|
17
56
|
## Pipes
|
|
18
57
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { ModuleWithProviders, Provider } from '@angular/core';
|
|
1
2
|
import * as i0 from "@angular/core";
|
|
2
3
|
import * as i1 from "@angular/common";
|
|
3
4
|
import * as i2 from "./directives/scroll-to-invalid-control.directive";
|
|
5
|
+
export declare const NG_EVENT_PLUGINS: Provider[];
|
|
4
6
|
export declare class EntryCommonModule {
|
|
7
|
+
static forRoot(): ModuleWithProviders<EntryCommonModule>;
|
|
5
8
|
static ɵfac: i0.ɵɵFactoryDeclaration<EntryCommonModule, never>;
|
|
6
9
|
static ɵmod: i0.ɵɵNgModuleDeclaration<EntryCommonModule, never, [typeof i1.CommonModule, typeof i2.ScrollToInvalidControlDirective], [typeof i2.ScrollToInvalidControlDirective]>;
|
|
7
10
|
static ɵinj: i0.ɵɵInjectorDeclaration<EntryCommonModule>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { EventManager } from '@angular/platform-browser';
|
|
2
|
+
/**
|
|
3
|
+
* abstract class EventManagerPlugin will be exposed in the public api
|
|
4
|
+
* https://github.com/angular/angular/pull/49969
|
|
5
|
+
*
|
|
6
|
+
* Until then creating it from reference
|
|
7
|
+
* https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/event_manager.ts#L93
|
|
8
|
+
*
|
|
9
|
+
* How to create custom event modifiers
|
|
10
|
+
* https://github.com/Tinkoff/ng-event-plugins,
|
|
11
|
+
* https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/key_events.ts
|
|
12
|
+
* https://netbasal.com/lifting-the-veil-insights-into-angulars-eventmanagerplugin-ed9d14cbb31a
|
|
13
|
+
*/
|
|
14
|
+
export declare abstract class EventManagerPlugin {
|
|
15
|
+
manager: EventManager;
|
|
16
|
+
/** Should return `true` for every event name that should be supported by this plugin */
|
|
17
|
+
abstract supports(eventName: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Registers a handler for a specific element and event.
|
|
20
|
+
*
|
|
21
|
+
* @param element The HTML element to receive event notifications.
|
|
22
|
+
* @param eventName The name of the event to listen for.
|
|
23
|
+
* @param handler A function to call when the notification occurs. Receives the
|
|
24
|
+
* event object as an argument.
|
|
25
|
+
* @returns A callback function that can be used to remove the handler.
|
|
26
|
+
*/
|
|
27
|
+
abstract addEventListener(element: HTMLElement, eventName: string, handler: Function): Function;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Entry event plugin base class
|
|
31
|
+
*/
|
|
32
|
+
export declare abstract class EntryEventManagerPlugin extends EventManagerPlugin {
|
|
33
|
+
abstract modifier: string;
|
|
34
|
+
/** return `true` for every event name that has specified modifier */
|
|
35
|
+
supports(eventName: string): boolean;
|
|
36
|
+
/** unwrap params e.g. (click.debounce.500) => ['debounce', 500] */
|
|
37
|
+
unwrapParams(eventName: string): string[];
|
|
38
|
+
/** get event name e.g. (click.debounce.500) => click */
|
|
39
|
+
unwrapEventName(eventName: string): string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EntryEventManagerPlugin } from './abstract.plugin';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Provides event plugin for debouncing events.
|
|
5
|
+
*
|
|
6
|
+
* How to use:
|
|
7
|
+
* <button (click.debounce)="doSomething($event)">
|
|
8
|
+
* <input (keyup.debounce.500)="doSomething($event)">
|
|
9
|
+
*/
|
|
10
|
+
export declare class DebounceEventPlugin extends EntryEventManagerPlugin {
|
|
11
|
+
modifier: string;
|
|
12
|
+
addEventListener(element: HTMLElement, eventName: string, originalHandler: Function): Function;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DebounceEventPlugin, never>;
|
|
14
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DebounceEventPlugin>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EntryEventManagerPlugin } from './abstract.plugin';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Provides event plugin for throttling events.
|
|
5
|
+
*
|
|
6
|
+
* How to use:
|
|
7
|
+
* <button (click.throttle)="doSomething($event)">
|
|
8
|
+
* <input (keyup.throttle.500)="doSomething($event)">
|
|
9
|
+
*/
|
|
10
|
+
export declare class ThrottleEventPlugin extends EntryEventManagerPlugin {
|
|
11
|
+
modifier: string;
|
|
12
|
+
addEventListener(element: HTMLElement, eventName: string, originalHandler: Function): Function;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ThrottleEventPlugin, never>;
|
|
14
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ThrottleEventPlugin>;
|
|
15
|
+
}
|
package/common/public-api.d.ts
CHANGED
|
@@ -2,11 +2,30 @@ import { NgModule } from '@angular/core';
|
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
/** Directives */
|
|
4
4
|
import { ScrollToInvalidControlDirective } from './directives/scroll-to-invalid-control.directive';
|
|
5
|
+
/** Event plugins */
|
|
6
|
+
import { DebounceEventPlugin } from './event-plugins/debounce.plugin';
|
|
7
|
+
import { ThrottleEventPlugin } from './event-plugins/throttle.plugin';
|
|
8
|
+
import { EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';
|
|
5
9
|
import * as i0 from "@angular/core";
|
|
6
10
|
const DIRECTIVES = [
|
|
7
11
|
ScrollToInvalidControlDirective
|
|
8
12
|
];
|
|
13
|
+
const EVENT_PLUGINS = [
|
|
14
|
+
DebounceEventPlugin,
|
|
15
|
+
ThrottleEventPlugin
|
|
16
|
+
];
|
|
17
|
+
export const NG_EVENT_PLUGINS = EVENT_PLUGINS.map(useClass => ({
|
|
18
|
+
provide: EVENT_MANAGER_PLUGINS,
|
|
19
|
+
multi: true,
|
|
20
|
+
useClass
|
|
21
|
+
}));
|
|
9
22
|
export class EntryCommonModule {
|
|
23
|
+
static forRoot() {
|
|
24
|
+
return {
|
|
25
|
+
ngModule: EntryCommonModule,
|
|
26
|
+
providers: NG_EVENT_PLUGINS
|
|
27
|
+
};
|
|
28
|
+
}
|
|
10
29
|
}
|
|
11
30
|
EntryCommonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
12
31
|
EntryCommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: EntryCommonModule, imports: [CommonModule, ScrollToInvalidControlDirective], exports: [ScrollToInvalidControlDirective] });
|
|
@@ -24,4 +43,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
24
43
|
]
|
|
25
44
|
}]
|
|
26
45
|
}] });
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
46
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvZW50cnktY29tcG9uZW50cy9jb21tb24vY29tbW9uLm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQXVCLFFBQVEsRUFBWSxNQUFNLGVBQWUsQ0FBQztBQUN4RSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFFL0MsaUJBQWlCO0FBRWpCLE9BQU8sRUFBRSwrQkFBK0IsRUFBRSxNQUFNLGtEQUFrRCxDQUFDO0FBTW5HLG9CQUFvQjtBQUVwQixPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUN0RSxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUN0RSxPQUFPLEVBQUUscUJBQXFCLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQzs7QUFSbEUsTUFBTSxVQUFVLEdBQUc7SUFDakIsK0JBQStCO0NBQ2hDLENBQUM7QUFRRixNQUFNLGFBQWEs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vZHVsZTogRW50cnlDb21tb25Nb2R1bGUsXG4gICAgICBwcm92aWRlcnM6IE5HX0VWRU5UX1BMVUdJTlNcbiAgICB9O1xuICB9XG59XG4iXX0=
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* abstract class EventManagerPlugin will be exposed in the public api
|
|
3
|
+
* https://github.com/angular/angular/pull/49969
|
|
4
|
+
*
|
|
5
|
+
* Until then creating it from reference
|
|
6
|
+
* https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/event_manager.ts#L93
|
|
7
|
+
*
|
|
8
|
+
* How to create custom event modifiers
|
|
9
|
+
* https://github.com/Tinkoff/ng-event-plugins,
|
|
10
|
+
* https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/key_events.ts
|
|
11
|
+
* https://netbasal.com/lifting-the-veil-insights-into-angulars-eventmanagerplugin-ed9d14cbb31a
|
|
12
|
+
*/
|
|
13
|
+
export class EventManagerPlugin {
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Entry event plugin base class
|
|
17
|
+
*/
|
|
18
|
+
export class EntryEventManagerPlugin extends EventManagerPlugin {
|
|
19
|
+
/** return `true` for every event name that has specified modifier */
|
|
20
|
+
supports(eventName) {
|
|
21
|
+
return eventName.includes(this.modifier);
|
|
22
|
+
}
|
|
23
|
+
/** unwrap params e.g. (click.debounce.500) => ['debounce', 500] */
|
|
24
|
+
unwrapParams(eventName) {
|
|
25
|
+
return eventName
|
|
26
|
+
.substring(eventName.indexOf(this.modifier))
|
|
27
|
+
.split('.')
|
|
28
|
+
.filter(x => !!x);
|
|
29
|
+
}
|
|
30
|
+
/** get event name e.g. (click.debounce.500) => click */
|
|
31
|
+
unwrapEventName(eventName) {
|
|
32
|
+
return eventName.substring(0, eventName.indexOf(this.modifier));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWJzdHJh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WdpbiBleHRlbmRzIEV2ZW50TWFuYWdlclBsdWdpbiB7XHJcbiAgYWJzdHJhY3QgbW9kaWZpZXI6IHN0cmluZztcclxuXHJcbiAgLyoqIHJldHVybiBgdHJ1ZWAgZm9yIGV2ZXJ5IGV2ZW50IG5hbWUgdGhhdCBoYXMgc3BlY2lmaWVkIG1vZGlmaWVyICovXHJcbiAgc3VwcG9ydHMoZXZlbnROYW1lOiBzdHJpbmcpOiBib29sZWFuIHtcclxuICAgIHJldHVybiBldmVudE5hbWUuaW5jbHVkZXModGhpcy5tb2RpZmllcik7XHJcbiAgfVxyXG5cclxuICAvKiogdW53cmFwIHBhcmFtcyBlLmcuIChjbGljay5kZWJvdW5jZS41MDApID0+IFsnZGVib3VuY2UnLCA1MDBdICovXHJcbiAgdW53cmFwUGFyYW1zKGV2ZW50TmFtZTogc3RyaW5nKTogc3RyaW5nW10ge1xyXG4gICAgcmV0dXJuIGV2ZW50TmFtZVxyXG4gICAgICAuc3Vic3RyaW5nKGV2ZW50TmFtZS5pbmRleE9mKHRoaXMubW9kaWZpZXIpKVxyXG4gICAgICAuc3BsaXQoJy4nKVxyXG4gICAgICAuZmlsdGVyKHggPT4gISF4KTtcclxuICB9XHJcblxyXG4gIC8qKiBnZXQgZXZlbnQgbmFtZSBlLmcuIChjbGljay5kZWJvdW5jZS41MDApID0+IGNsaWNrICovXHJcbiAgdW53cmFwRXZlbnROYW1lKGV2ZW50TmFtZTogc3RyaW5nKTogc3RyaW5nIHtcclxuICAgIHJldHVybiBldmVudE5hbWUuc3Vic3RyaW5nKDAsIGV2ZW50TmFtZS5pbmRleE9mKHRoaXMubW9kaWZpZXIpKTtcclxuICB9XHJcbn1cclxuIl19
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
+
import { Injectable } from '@angular/core';
|
|
3
|
+
import { EntryEventManagerPlugin } from './abstract.plugin';
|
|
4
|
+
import { debounce } from 'lodash-es';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* Provides event plugin for debouncing events.
|
|
8
|
+
*
|
|
9
|
+
* How to use:
|
|
10
|
+
* <button (click.debounce)="doSomething($event)">
|
|
11
|
+
* <input (keyup.debounce.500)="doSomething($event)">
|
|
12
|
+
*/
|
|
13
|
+
export class DebounceEventPlugin extends EntryEventManagerPlugin {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.modifier = '.debounce';
|
|
17
|
+
}
|
|
18
|
+
addEventListener(element, eventName, originalHandler) {
|
|
19
|
+
// e.g. (click.debounce.500)
|
|
20
|
+
const [_modifier, milliseconds = 500, option = 'leading'] = this.unwrapParams(eventName);
|
|
21
|
+
// run original handler inside ngZone in which the event occurred
|
|
22
|
+
const innerHandler = (event) => this.manager.getZone().runGuarded(() => originalHandler(event));
|
|
23
|
+
// create debounced handler
|
|
24
|
+
const debouncedHandler = debounce(innerHandler, milliseconds, { leading: option === 'leading', trailing: option === 'trailing' });
|
|
25
|
+
// register event with debounced handler
|
|
26
|
+
return this.manager.addEventListener(element, this.unwrapEventName(eventName), debouncedHandler);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
DebounceEventPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebounceEventPlugin, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
30
|
+
DebounceEventPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebounceEventPlugin });
|
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebounceEventPlugin, decorators: [{
|
|
32
|
+
type: Injectable
|
|
33
|
+
}] });
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVib3VuY2UucGx1Z2luLmpzIiwic291cmN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ceEventPlugin } from './debounce.plugin';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2VudHJ5LWNvbXBvbmVudHMvY29tbW9uL2V2ZW50LXBsdWdpbnMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDeEQsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sbUJBQW1CLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBUaHJvdHRsZUV2ZW50UGx1Z2luIH0gZnJvbSAnLi90aHJvdHRsZS5wbHVnaW4nO1xyXG5leHBvcnQgeyBEZWJvdW5jZUV2ZW50UGx1Z2luIH0gZnJvbSAnLi9kZWJvdW5jZS5wbHVnaW4nO1xyXG4iXX0=
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
+
import { Injectable } from '@angular/core';
|
|
3
|
+
import { EntryEventManagerPlugin } from './abstract.plugin';
|
|
4
|
+
import { throttle } from 'lodash-es';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* Provides event plugin for throttling events.
|
|
8
|
+
*
|
|
9
|
+
* How to use:
|
|
10
|
+
* <button (click.throttle)="doSomething($event)">
|
|
11
|
+
* <input (keyup.throttle.500)="doSomething($event)">
|
|
12
|
+
*/
|
|
13
|
+
export class ThrottleEventPlugin extends EntryEventManagerPlugin {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.modifier = '.throttle';
|
|
17
|
+
}
|
|
18
|
+
addEventListener(element, eventName, originalHandler) {
|
|
19
|
+
// e.g. (keyup.throttle.500)
|
|
20
|
+
const [_modifier, milliseconds = 500] = this.unwrapParams(eventName);
|
|
21
|
+
// run original handler inside ngZone in which the event occurred
|
|
22
|
+
const innerHandler = (event) => this.manager.getZone().runGuarded(() => originalHandler(event));
|
|
23
|
+
// create throttled handler
|
|
24
|
+
const throttledHandler = throttle(innerHandler, milliseconds);
|
|
25
|
+
// register event with throttled handler
|
|
26
|
+
return this.manager.addEventListener(element, this.unwrapEventName(eventName), throttledHandler);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
ThrottleEventPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ThrottleEventPlugin, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
30
|
+
ThrottleEventPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ThrottleEventPlugin });
|
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ThrottleEventPlugin, decorators: [{
|
|
32
|
+
type: Injectable
|
|
33
|
+
}] });
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGhyb3R0bGUucGx1Z2luLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9lbnRyeS1jb21wb25lbnRzL2NvbW1vbi9ldmVudC1wbHVnaW5zL3Rocm90dGxlLnBsdWdpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxpREFBaUQ7QUFDakQsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUMzQyxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUM1RCxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sV0FBVyxDQUFDOztBQUVyQzs7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R0bGVkIGhhbmRsZXJcclxuICAgIGNvbnN0IHRocm90dGxlZEhhbmRsZXIgPSB0aHJvdHRsZShpbm5lckhhbmRsZXIsIG1pbGxpc2Vjb25kcyk7XHJcblxyXG4gICAgLy8gcmVnaXN0ZXIgZXZlbnQgd2l0aCB0aHJvdHRsZWQgaGFuZGxlclxyXG4gICAgcmV0dXJuIHRoaXMubWFuYWdlci5hZGRFdmVudExpc3RlbmVyKGVsZW1lbnQsIHRoaXMudW53cmFwRXZlbnROYW1lKGV2ZW50TmFtZSksIHRocm90dGxlZEhhbmRsZXIpO1xyXG4gIH1cclxufVxyXG4iXX0=
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { EntryCommonModule } from './common.module';
|
|
1
|
+
export { EntryCommonModule, NG_EVENT_PLUGINS } from './common.module';
|
|
2
2
|
export * from './utils';
|
|
3
3
|
export * from './directives';
|
|
4
|
-
|
|
4
|
+
export * from './event-plugins';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvZW50cnktY29tcG9uZW50cy9jb21tb24vcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUV0RSxjQUFjLFNBQVMsQ0FBQztBQUN4QixjQUFjLGNBQWMsQ0FBQztBQUM3QixjQUFjLGlCQUFpQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiXG5leHBvcnQgeyBFbnRyeUNvbW1vbk1vZHVsZSwgTkdfRVZFTlRfUExVR0lOUyB9IGZyb20gJy4vY29tbW9uLm1vZHVsZSc7XG5cbmV4cG9ydCAqIGZyb20gJy4vdXRpbHMnO1xuZXhwb3J0ICogZnJvbSAnLi9kaXJlY3RpdmVzJztcbmV4cG9ydCAqIGZyb20gJy4vZXZlbnQtcGx1Z2lucyc7XG4iXX0=
|
|
@@ -6,6 +6,7 @@ import { EntrySearchFilterModule } from '@enigmatry/entry-components/search-filt
|
|
|
6
6
|
import { EntryValidationModule } from '@enigmatry/entry-components/validation';
|
|
7
7
|
import { EntryFileInputModule } from '@enigmatry/entry-components/file-input';
|
|
8
8
|
import { EntryTableModule } from '@enigmatry/entry-components/table';
|
|
9
|
+
import { EntryCommonModule, NG_EVENT_PLUGINS } from '@enigmatry/entry-components/common';
|
|
9
10
|
import * as i0 from "@angular/core";
|
|
10
11
|
/**
|
|
11
12
|
* Exports all entry components.
|
|
@@ -19,7 +20,7 @@ export class EntryComponentsModule {
|
|
|
19
20
|
const permissionServiceProvider = options.permissionService
|
|
20
21
|
? [{ provide: EntryPermissionService, useClass: options.permissionService }]
|
|
21
22
|
: [];
|
|
22
|
-
const providers = [...permissionServiceProvider];
|
|
23
|
+
const providers = [...permissionServiceProvider, ...NG_EVENT_PLUGINS];
|
|
23
24
|
return {
|
|
24
25
|
ngModule: EntryComponentsModule,
|
|
25
26
|
providers
|
|
@@ -28,6 +29,7 @@ export class EntryComponentsModule {
|
|
|
28
29
|
}
|
|
29
30
|
EntryComponentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
30
31
|
EntryComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: EntryComponentsModule, exports: [EntryButtonModule,
|
|
32
|
+
EntryCommonModule,
|
|
31
33
|
EntryDialogModule,
|
|
32
34
|
EntryFileInputModule,
|
|
33
35
|
EntryValidationModule,
|
|
@@ -35,6 +37,7 @@ EntryComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
|
|
|
35
37
|
EntrySearchFilterModule,
|
|
36
38
|
EntryTableModule] });
|
|
37
39
|
EntryComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryComponentsModule, imports: [EntryButtonModule,
|
|
40
|
+
EntryCommonModule,
|
|
38
41
|
EntryDialogModule,
|
|
39
42
|
EntryFileInputModule,
|
|
40
43
|
EntryValidationModule,
|
|
@@ -47,6 +50,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
47
50
|
declarations: [],
|
|
48
51
|
exports: [
|
|
49
52
|
EntryButtonModule,
|
|
53
|
+
EntryCommonModule,
|
|
50
54
|
EntryDialogModule,
|
|
51
55
|
EntryFileInputModule,
|
|
52
56
|
EntryValidationModule,
|
|
@@ -56,4 +60,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
56
60
|
]
|
|
57
61
|
}]
|
|
58
62
|
}] });
|
|
59
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
63
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW50cnktY29tcG9uZW50cy5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL2VudHJ5LWNvbXBvbmVudHMvbW9kdWxlcy9lbnRyeS1jb21wb25lbnRzLm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQXVCLFFBQVEsRUFBa0IsTUFBTSxlQUFlLENBQUM7QUFDOUUsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sb0NBQW9DLENBQUM7QUFDdkUsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sb0NBQW9DLENBQUM7QUFDdkUsT0FBTyxFQUFFLHFCQUFxQixFQUFFLHNCQUFzQixFQUFF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J5UGVybWlzc2lvbk1vZHVsZSxcclxuICAgIEVudHJ5U2VhcmNoRmlsdGVyTW9kdWxlLFxyXG4gICAgRW50cnlUYWJsZU1vZHVsZVxyXG4gIF1cclxufSlcclxuZXhwb3J0IGNsYXNzIEVudHJ5Q29tcG9uZW50c01vZHVsZSB7XHJcbiAgc3RhdGljIGZvclJvb3Qob3B0aW9uczogRW50cnlDb21wb25lbnRzTW9kdWxlT3B0aW9ucyA9IHt9KTogTW9kdWxlV2l0aFByb3ZpZGVyczxFbnRyeUNvbXBvbmVudHNNb2R1bGU+IHtcclxuXHJcbiAgICBjb25zdCBwZXJtaXNzaW9uU2VydmljZVByb3ZpZGVyOiBQcm92aWRlcltdID0gb3B0aW9ucy5wZXJtaXNzaW9uU2VydmljZVxyXG4gICAgICA/IFt7IHByb3ZpZGU6IEVudHJ5UGVybWlzc2lvblNlcnZpY2UsIHVzZUNsYXNzOiBvcHRpb25zLnBlcm1pc3Npb25TZXJ2aWNlIH1dXHJcbiAgICAgIDogW107XHJcblxyXG4gICAgY29uc3QgcHJvdmlkZXJzOiBQcm92aWRlcltdID0gWy4uLnBlcm1pc3Npb25TZXJ2aWNlUHJvdmlkZXIsIC4uLk5HX0VWRU5UX1BMVUdJTlNdO1xyXG4gICAgcmV0dXJuIHtcclxuICAgICAgbmdNb2R1bGU6IEVudHJ5Q29tcG9uZW50c01vZHVsZSxcclxuICAgICAgcHJvdmlkZXJzXHJcbiAgICB9O1xyXG4gIH1cclxufVxyXG4iXX0=
|
package/esm2020/public-api.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Public API Surface of entry-components
|
|
3
3
|
*/
|
|
4
4
|
export * from '@enigmatry/entry-components/button';
|
|
5
|
+
export * from '@enigmatry/entry-components/common';
|
|
5
6
|
export * from '@enigmatry/entry-components/dialog';
|
|
6
7
|
export * from '@enigmatry/entry-components/file-input';
|
|
7
8
|
export * from '@enigmatry/entry-components/permissions';
|
|
@@ -9,4 +10,4 @@ export * from '@enigmatry/entry-components/search-filter';
|
|
|
9
10
|
export * from '@enigmatry/entry-components/validation';
|
|
10
11
|
export * from '@enigmatry/entry-components/table';
|
|
11
12
|
export { EntryComponentsModule } from './modules/entry-components.module';
|
|
12
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
13
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvZW50cnktY29tcG9uZW50cy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBOztHQUVHO0FBQ0gsY0FBYyxvQ0FBb0MsQ0FBQztBQUNuRCxjQUFjLG9DQUFvQyxDQUFDO0FBQ25ELGNBQWMsb0NBQW9DLENBQUM7QUFDbkQsY0FBYyx3Q0FBd0MsQ0FBQztBQUN2RCxjQUFjLHlDQUF5QyxDQUFDO0FBQ3hELGNBQWMsMkNBQTJDLENBQUM7QUFDMUQsY0FBYyx3Q0FBd0MsQ0FBQztBQUN2RCxjQUFjLG1DQUFtQyxDQUFDO0FBRWxELE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLG1DQUFtQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiXG4vKlxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIGVudHJ5LWNvbXBvbmVudHNcbiAqL1xuZXhwb3J0ICogZnJvbSAnQGVuaWdtYXRyeS9lbnRyeS1jb21wb25lbnRzL2J1dHRvbic7XG5leHBvcnQgKiBmcm9tICdAZW5pZ21hdHJ5L2VudHJ5LWNvbXBvbmVudHMvY29tbW9uJztcbmV4cG9ydCAqIGZyb20gJ0BlbmlnbWF0cnkvZW50cnktY29tcG9uZW50cy9kaWFsb2cnO1xuZXhwb3J0ICogZnJvbSAnQGVuaWdtYXRyeS9lbnRyeS1jb21wb25lbnRzL2ZpbGUtaW5wdXQnO1xuZXhwb3J0ICogZnJvbSAnQGVuaWdtYXRyeS9lbnRyeS1jb21wb25lbnRzL3Blcm1pc3Npb25zJztcbmV4cG9ydCAqIGZyb20gJ0BlbmlnbWF0cnkvZW50cnktY29tcG9uZW50cy9zZWFyY2gtZmlsdGVyJztcbmV4cG9ydCAqIGZyb20gJ0BlbmlnbWF0cnkvZW50cnktY29tcG9uZW50cy92YWxpZGF0aW9uJztcbmV4cG9ydCAqIGZyb20gJ0BlbmlnbWF0cnkvZW50cnktY29tcG9uZW50cy90YWJsZSc7XG5cbmV4cG9ydCB7IEVudHJ5Q29tcG9uZW50c01vZHVsZSB9IGZyb20gJy4vbW9kdWxlcy9lbnRyeS1jb21wb25lbnRzLm1vZHVsZSc7XG4iXX0=
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, Self, NgModule, InjectionToken } from '@angular/core';
|
|
2
|
+
import { Directive, Self, Injectable, NgModule, InjectionToken } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
import { Subject, fromEvent } from 'rxjs';
|
|
5
5
|
import { takeUntil } from 'rxjs/operators';
|
|
6
6
|
import * as i1 from '@angular/forms';
|
|
7
|
+
import { debounce, throttle } from 'lodash-es';
|
|
8
|
+
import { EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';
|
|
7
9
|
|
|
8
10
|
const NG_VALID_CLASS = '.ng-valid';
|
|
9
11
|
const NG_INVALID_CLASS = '.ng-invalid';
|
|
@@ -55,10 +57,120 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
55
57
|
}] }, { type: i0.ElementRef }];
|
|
56
58
|
} });
|
|
57
59
|
|
|
60
|
+
/**
|
|
61
|
+
* abstract class EventManagerPlugin will be exposed in the public api
|
|
62
|
+
* https://github.com/angular/angular/pull/49969
|
|
63
|
+
*
|
|
64
|
+
* Until then creating it from reference
|
|
65
|
+
* https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/event_manager.ts#L93
|
|
66
|
+
*
|
|
67
|
+
* How to create custom event modifiers
|
|
68
|
+
* https://github.com/Tinkoff/ng-event-plugins,
|
|
69
|
+
* https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/key_events.ts
|
|
70
|
+
* https://netbasal.com/lifting-the-veil-insights-into-angulars-eventmanagerplugin-ed9d14cbb31a
|
|
71
|
+
*/
|
|
72
|
+
class EventManagerPlugin {
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Entry event plugin base class
|
|
76
|
+
*/
|
|
77
|
+
class EntryEventManagerPlugin extends EventManagerPlugin {
|
|
78
|
+
/** return `true` for every event name that has specified modifier */
|
|
79
|
+
supports(eventName) {
|
|
80
|
+
return eventName.includes(this.modifier);
|
|
81
|
+
}
|
|
82
|
+
/** unwrap params e.g. (click.debounce.500) => ['debounce', 500] */
|
|
83
|
+
unwrapParams(eventName) {
|
|
84
|
+
return eventName
|
|
85
|
+
.substring(eventName.indexOf(this.modifier))
|
|
86
|
+
.split('.')
|
|
87
|
+
.filter(x => !!x);
|
|
88
|
+
}
|
|
89
|
+
/** get event name e.g. (click.debounce.500) => click */
|
|
90
|
+
unwrapEventName(eventName) {
|
|
91
|
+
return eventName.substring(0, eventName.indexOf(this.modifier));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
96
|
+
/**
|
|
97
|
+
* Provides event plugin for debouncing events.
|
|
98
|
+
*
|
|
99
|
+
* How to use:
|
|
100
|
+
* <button (click.debounce)="doSomething($event)">
|
|
101
|
+
* <input (keyup.debounce.500)="doSomething($event)">
|
|
102
|
+
*/
|
|
103
|
+
class DebounceEventPlugin extends EntryEventManagerPlugin {
|
|
104
|
+
constructor() {
|
|
105
|
+
super(...arguments);
|
|
106
|
+
this.modifier = '.debounce';
|
|
107
|
+
}
|
|
108
|
+
addEventListener(element, eventName, originalHandler) {
|
|
109
|
+
// e.g. (click.debounce.500)
|
|
110
|
+
const [_modifier, milliseconds = 500, option = 'leading'] = this.unwrapParams(eventName);
|
|
111
|
+
// run original handler inside ngZone in which the event occurred
|
|
112
|
+
const innerHandler = (event) => this.manager.getZone().runGuarded(() => originalHandler(event));
|
|
113
|
+
// create debounced handler
|
|
114
|
+
const debouncedHandler = debounce(innerHandler, milliseconds, { leading: option === 'leading', trailing: option === 'trailing' });
|
|
115
|
+
// register event with debounced handler
|
|
116
|
+
return this.manager.addEventListener(element, this.unwrapEventName(eventName), debouncedHandler);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
DebounceEventPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebounceEventPlugin, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
120
|
+
DebounceEventPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebounceEventPlugin });
|
|
121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebounceEventPlugin, decorators: [{
|
|
122
|
+
type: Injectable
|
|
123
|
+
}] });
|
|
124
|
+
|
|
125
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
126
|
+
/**
|
|
127
|
+
* Provides event plugin for throttling events.
|
|
128
|
+
*
|
|
129
|
+
* How to use:
|
|
130
|
+
* <button (click.throttle)="doSomething($event)">
|
|
131
|
+
* <input (keyup.throttle.500)="doSomething($event)">
|
|
132
|
+
*/
|
|
133
|
+
class ThrottleEventPlugin extends EntryEventManagerPlugin {
|
|
134
|
+
constructor() {
|
|
135
|
+
super(...arguments);
|
|
136
|
+
this.modifier = '.throttle';
|
|
137
|
+
}
|
|
138
|
+
addEventListener(element, eventName, originalHandler) {
|
|
139
|
+
// e.g. (keyup.throttle.500)
|
|
140
|
+
const [_modifier, milliseconds = 500] = this.unwrapParams(eventName);
|
|
141
|
+
// run original handler inside ngZone in which the event occurred
|
|
142
|
+
const innerHandler = (event) => this.manager.getZone().runGuarded(() => originalHandler(event));
|
|
143
|
+
// create throttled handler
|
|
144
|
+
const throttledHandler = throttle(innerHandler, milliseconds);
|
|
145
|
+
// register event with throttled handler
|
|
146
|
+
return this.manager.addEventListener(element, this.unwrapEventName(eventName), throttledHandler);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
ThrottleEventPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ThrottleEventPlugin, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
150
|
+
ThrottleEventPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ThrottleEventPlugin });
|
|
151
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ThrottleEventPlugin, decorators: [{
|
|
152
|
+
type: Injectable
|
|
153
|
+
}] });
|
|
154
|
+
|
|
58
155
|
const DIRECTIVES = [
|
|
59
156
|
ScrollToInvalidControlDirective
|
|
60
157
|
];
|
|
158
|
+
const EVENT_PLUGINS = [
|
|
159
|
+
DebounceEventPlugin,
|
|
160
|
+
ThrottleEventPlugin
|
|
161
|
+
];
|
|
162
|
+
const NG_EVENT_PLUGINS = EVENT_PLUGINS.map(useClass => ({
|
|
163
|
+
provide: EVENT_MANAGER_PLUGINS,
|
|
164
|
+
multi: true,
|
|
165
|
+
useClass
|
|
166
|
+
}));
|
|
61
167
|
class EntryCommonModule {
|
|
168
|
+
static forRoot() {
|
|
169
|
+
return {
|
|
170
|
+
ngModule: EntryCommonModule,
|
|
171
|
+
providers: NG_EVENT_PLUGINS
|
|
172
|
+
};
|
|
173
|
+
}
|
|
62
174
|
}
|
|
63
175
|
EntryCommonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
64
176
|
EntryCommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: EntryCommonModule, imports: [CommonModule, ScrollToInvalidControlDirective], exports: [ScrollToInvalidControlDirective] });
|
|
@@ -94,5 +206,5 @@ function provideConfig(token, factory) {
|
|
|
94
206
|
* Generated bundle index. Do not edit.
|
|
95
207
|
*/
|
|
96
208
|
|
|
97
|
-
export { EntryCommonModule, ScrollToInvalidControlDirective, createInjectionToken, provideConfig };
|
|
209
|
+
export { DebounceEventPlugin, EntryCommonModule, NG_EVENT_PLUGINS, ScrollToInvalidControlDirective, ThrottleEventPlugin, createInjectionToken, provideConfig };
|
|
98
210
|
//# sourceMappingURL=enigmatry-entry-components-common.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enigmatry-entry-components-common.mjs","sources":["../../../../libs/entry-components/common/constants.ts","../../../../libs/entry-components/common/directives/scroll-to-invalid-control.directive.ts","../../../../libs/entry-components/common/common.module.ts","../../../../libs/entry-components/common/utils/provide-config.ts","../../../../libs/entry-components/common/enigmatry-entry-components-common.ts"],"sourcesContent":["export const NG_VALID_CLASS = '.ng-valid';\r\nexport const NG_INVALID_CLASS = '.ng-invalid';\r\n","import { Directive, ElementRef, OnDestroy, OnInit, Self } from '@angular/core';\r\nimport { ControlContainer } from '@angular/forms';\r\nimport { Subject, fromEvent } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\nimport { NG_INVALID_CLASS } from '../constants';\r\n\r\n/**\r\n * Scroll to first invalid control when form is submitted.\r\n * Directive is applied to 'form[formGroup],form[ngForm]' (reactive or template driven forms)\r\n */\r\n@Directive({\r\n standalone: true,\r\n selector: 'form[formGroup],form[ngForm]'\r\n})\r\nexport class ScrollToInvalidControlDirective implements OnInit, OnDestroy {\r\n\r\n private destroy$ = new Subject<void>();\r\n\r\n constructor(\r\n @Self() private form: ControlContainer,\r\n private elementRef: ElementRef<HTMLFormElement>) { }\r\n\r\n ngOnInit(): void {\r\n fromEvent(this.elementRef.nativeElement, 'submit')\r\n .pipe(takeUntil(this.destroy$))\r\n .subscribe(_ => {\r\n if (this.form.invalid) {\r\n this.scrollToInvalidControl();\r\n }\r\n });\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.destroy$.next();\r\n this.destroy$.complete();\r\n }\r\n\r\n private scrollToInvalidControl() {\r\n const firstInvalidControl: HTMLElement =\r\n this.elementRef.nativeElement.querySelector(NG_INVALID_CLASS);\r\n\r\n if (firstInvalidControl) {\r\n firstInvalidControl.scrollIntoView({\r\n behavior: 'smooth',\r\n block: 'center' // vertical alignment\r\n });\r\n }\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\n\r\n/** Directives */\r\n\r\nimport { ScrollToInvalidControlDirective } from './directives/scroll-to-invalid-control.directive';\r\n\r\nconst DIRECTIVES = [\r\n ScrollToInvalidControlDirective\r\n];\r\n\r\n@NgModule({\r\n declarations: [\r\n ],\r\n imports: [\r\n CommonModule,\r\n ...DIRECTIVES\r\n ],\r\n exports: [\r\n ...DIRECTIVES\r\n ]\r\n})\r\nexport class EntryCommonModule {\r\n}\r\n","import { InjectionToken, Provider } from '@angular/core';\r\n\r\nexport function createInjectionToken<T>(defaultValue: T): InjectionToken<T> {\r\n return new InjectionToken<T>(defaultValue.constructor.name,\r\n {\r\n providedIn: 'root',\r\n factory: () => defaultValue\r\n }\r\n );\r\n}\r\n\r\nexport function provideConfig<T>(token: InjectionToken<T>, factory: () => T): Provider {\r\n return {\r\n provide: token,\r\n useFactory: factory\r\n };\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAAO,MAAM,cAAc,GAAG,WAAW,CAAC;AACnC,MAAM,gBAAgB,GAAG,aAAa;;AC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I,YAAY,CAAC,WAAW,CAAC,IAAI,EACxD;AACE,QAAA,UAAU,EAAE,MAAM;AAClB,QAAA,OAAO,EAAE,MAAM,YAAY;AAC5B,KAAA,CACF,CAAC;AACJ,CAAC;AAEe,SAAA,aAAa,CAAI,KAAwB,EAAE,OAAgB,EAAA;IACzE,OAAO;AACL,QAAA,OAAO,EAAE,KAAK;AACd,QAAA,UAAU,EAAE,OAAO;KACpB,CAAC;AACJ;;AChBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"enigmatry-entry-components-common.mjs","sources":["../../../../libs/entry-components/common/constants.ts","../../../../libs/entry-components/common/directives/scroll-to-invalid-control.directive.ts","../../../../libs/entry-components/common/event-plugins/abstract.plugin.ts","../../../../libs/entry-components/common/event-plugins/debounce.plugin.ts","../../../../libs/entry-components/common/event-plugins/throttle.plugin.ts","../../../../libs/entry-components/common/common.module.ts","../../../../libs/entry-components/common/utils/provide-config.ts","../../../../libs/entry-components/common/enigmatry-entry-components-common.ts"],"sourcesContent":["export const NG_VALID_CLASS = '.ng-valid';\r\nexport const NG_INVALID_CLASS = '.ng-invalid';\r\n","import { Directive, ElementRef, OnDestroy, OnInit, Self } from '@angular/core';\r\nimport { ControlContainer } from '@angular/forms';\r\nimport { Subject, fromEvent } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\nimport { NG_INVALID_CLASS } from '../constants';\r\n\r\n/**\r\n * Scroll to first invalid control when form is submitted.\r\n * Directive is applied to 'form[formGroup],form[ngForm]' (reactive or template driven forms)\r\n */\r\n@Directive({\r\n standalone: true,\r\n selector: 'form[formGroup],form[ngForm]'\r\n})\r\nexport class ScrollToInvalidControlDirective implements OnInit, OnDestroy {\r\n\r\n private destroy$ = new Subject<void>();\r\n\r\n constructor(\r\n @Self() private form: ControlContainer,\r\n private elementRef: ElementRef<HTMLFormElement>) { }\r\n\r\n ngOnInit(): void {\r\n fromEvent(this.elementRef.nativeElement, 'submit')\r\n .pipe(takeUntil(this.destroy$))\r\n .subscribe(_ => {\r\n if (this.form.invalid) {\r\n this.scrollToInvalidControl();\r\n }\r\n });\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.destroy$.next();\r\n this.destroy$.complete();\r\n }\r\n\r\n private scrollToInvalidControl() {\r\n const firstInvalidControl: HTMLElement =\r\n this.elementRef.nativeElement.querySelector(NG_INVALID_CLASS);\r\n\r\n if (firstInvalidControl) {\r\n firstInvalidControl.scrollIntoView({\r\n behavior: 'smooth',\r\n block: 'center' // vertical alignment\r\n });\r\n }\r\n }\r\n}\r\n","import { EventManager } from '@angular/platform-browser';\r\n\r\n/**\r\n * abstract class EventManagerPlugin will be exposed in the public api\r\n * https://github.com/angular/angular/pull/49969\r\n *\r\n * Until then creating it from reference\r\n * https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/event_manager.ts#L93\r\n *\r\n * How to create custom event modifiers\r\n * https://github.com/Tinkoff/ng-event-plugins,\r\n * https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/key_events.ts\r\n * https://netbasal.com/lifting-the-veil-insights-into-angulars-eventmanagerplugin-ed9d14cbb31a\r\n */\r\nexport abstract class EventManagerPlugin {\r\n\r\n // Using non-null assertion because it's set by EventManager's constructor\r\n manager!: EventManager;\r\n\r\n /** Should return `true` for every event name that should be supported by this plugin */\r\n abstract supports(eventName: string): boolean;\r\n\r\n /**\r\n * Registers a handler for a specific element and event.\r\n *\r\n * @param element The HTML element to receive event notifications.\r\n * @param eventName The name of the event to listen for.\r\n * @param handler A function to call when the notification occurs. Receives the\r\n * event object as an argument.\r\n * @returns A callback function that can be used to remove the handler.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/ban-types\r\n abstract addEventListener(element: HTMLElement, eventName: string, handler: Function): Function;\r\n}\r\n\r\n/**\r\n * Entry event plugin base class\r\n */\r\nexport abstract class EntryEventManagerPlugin extends EventManagerPlugin {\r\n abstract modifier: string;\r\n\r\n /** return `true` for every event name that has specified modifier */\r\n supports(eventName: string): boolean {\r\n return eventName.includes(this.modifier);\r\n }\r\n\r\n /** unwrap params e.g. (click.debounce.500) => ['debounce', 500] */\r\n unwrapParams(eventName: string): string[] {\r\n return eventName\r\n .substring(eventName.indexOf(this.modifier))\r\n .split('.')\r\n .filter(x => !!x);\r\n }\r\n\r\n /** get event name e.g. (click.debounce.500) => click */\r\n unwrapEventName(eventName: string): string {\r\n return eventName.substring(0, eventName.indexOf(this.modifier));\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/ban-types */\r\nimport { Injectable } from '@angular/core';\r\nimport { EntryEventManagerPlugin } from './abstract.plugin';\r\nimport { debounce } from 'lodash-es';\r\n\r\n/**\r\n * Provides event plugin for debouncing events.\r\n *\r\n * How to use:\r\n * <button (click.debounce)=\"doSomething($event)\">\r\n * <input (keyup.debounce.500)=\"doSomething($event)\">\r\n */\r\n@Injectable()\r\nexport class DebounceEventPlugin extends EntryEventManagerPlugin {\r\n\r\n modifier = '.debounce';\r\n\r\n addEventListener(element: HTMLElement, eventName: string, originalHandler: Function): Function {\r\n // e.g. (click.debounce.500)\r\n const [_modifier, milliseconds = 500, option = 'leading'] = this.unwrapParams(eventName);\r\n\r\n // run original handler inside ngZone in which the event occurred\r\n const innerHandler = (event: any) => this.manager.getZone().runGuarded(() => originalHandler(event));\r\n\r\n // create debounced handler\r\n const debouncedHandler = debounce(innerHandler, milliseconds,\r\n { leading: option === 'leading', trailing: option === 'trailing' });\r\n\r\n // register event with debounced handler\r\n return this.manager.addEventListener(element, this.unwrapEventName(eventName), debouncedHandler);\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/ban-types */\r\nimport { Injectable } from '@angular/core';\r\nimport { EntryEventManagerPlugin } from './abstract.plugin';\r\nimport { throttle } from 'lodash-es';\r\n\r\n/**\r\n * Provides event plugin for throttling events.\r\n *\r\n * How to use:\r\n * <button (click.throttle)=\"doSomething($event)\">\r\n * <input (keyup.throttle.500)=\"doSomething($event)\">\r\n */\r\n@Injectable()\r\nexport class ThrottleEventPlugin extends EntryEventManagerPlugin {\r\n\r\n modifier = '.throttle';\r\n\r\n addEventListener(element: HTMLElement, eventName: string, originalHandler: Function): Function {\r\n // e.g. (keyup.throttle.500)\r\n const [_modifier, milliseconds = 500] = this.unwrapParams(eventName);\r\n\r\n // run original handler inside ngZone in which the event occurred\r\n const innerHandler = (event: any) => this.manager.getZone().runGuarded(() => originalHandler(event));\r\n\r\n // create throttled handler\r\n const throttledHandler = throttle(innerHandler, milliseconds);\r\n\r\n // register event with throttled handler\r\n return this.manager.addEventListener(element, this.unwrapEventName(eventName), throttledHandler);\r\n }\r\n}\r\n","import { ModuleWithProviders, NgModule, Provider } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\n/** Directives */\n\nimport { ScrollToInvalidControlDirective } from './directives/scroll-to-invalid-control.directive';\n\nconst DIRECTIVES = [\n ScrollToInvalidControlDirective\n];\n\n/** Event plugins */\n\nimport { DebounceEventPlugin } from './event-plugins/debounce.plugin';\nimport { ThrottleEventPlugin } from './event-plugins/throttle.plugin';\nimport { EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';\n\nconst EVENT_PLUGINS = [\n DebounceEventPlugin,\n ThrottleEventPlugin\n];\n\nexport const NG_EVENT_PLUGINS: Provider[] = EVENT_PLUGINS.map(useClass => ({\n provide: EVENT_MANAGER_PLUGINS,\n multi: true,\n useClass\n}));\n\n\n@NgModule({\n declarations: [\n ],\n imports: [\n CommonModule,\n ...DIRECTIVES\n ],\n exports: [\n ...DIRECTIVES\n ]\n})\nexport class EntryCommonModule {\n static forRoot(): ModuleWithProviders<EntryCommonModule> {\n return {\n ngModule: EntryCommonModule,\n providers: NG_EVENT_PLUGINS\n };\n }\n}\n","import { InjectionToken, Provider } from '@angular/core';\r\n\r\nexport function createInjectionToken<T>(defaultValue: T): InjectionToken<T> {\r\n return new InjectionToken<T>(defaultValue.constructor.name,\r\n {\r\n providedIn: 'root',\r\n factory: () => defaultValue\r\n }\r\n );\r\n}\r\n\r\nexport function provideConfig<T>(token: InjectionToken<T>, factory: () => T): Provider {\r\n return {\r\n provide: token,\r\n useFactory: factory\r\n };\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAAO,MAAM,cAAc,GAAG,WAAW,CAAC;AACnC,MAAM,gBAAgB,GAAG,aAAa;;ACK7C;;;AAGG;MAKU,+BAA+B,CAAA;IAI1C,WACkB,CAAA,IAAsB,EAC9B,UAAuC,EAAA;AAD/B,QAAA,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAkB;AAC9B,QAAA,IAAU,CAAA,UAAA,GAAV,UAAU,CAA6B;AAJzC,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;KAIe;IAEtD,QAAQ,GAAA;QACN,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,QAAQ,CAAC;AAC/C,aAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC9B,SAAS,CAAC,CAAC,IAAG;AACb,YAAA,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACrB,IAAI,CAAC,sBAAsB,EAAE,CAAC;AAC/B,aAAA;AACH,SAAC,CAAC,CAAC;KACN;IAED,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AACrB,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;KAC1B;IAEO,sBAAsB,GAAA;AAC5B,QAAA,MAAM,mBAAmB,GACvB,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;AAEhE,QAAA,IAAI,mBAAmB,EAAE;YACvB,mBAAmB,CAAC,cAAc,CAAC;AACjC,gBAAA,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,QAAQ;AAChB,aAAA,CAAC,CAAC;AACJ,SAAA;KACF;;4HAjCU,+BAA+B,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,OAAA,EAAA,CAAA,YAAY,EAzBd,+BAA+B,aAA/B,+BAA+B,CAAA,EAAA,CAAA,CAAA;AAgCpB,iBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,YAP1B,YAAY,CAAA,EAAA,CAAA,CAAA;2FAOH,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAX7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EACb;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;AACZ,wBAAA,GAAG,UAAU;AACd,qBAAA;AACD,oBAAA,OAAO,EAAE;AACP,wBAAA,GAAG,UAAU;AACd,qBAAA;iBACF,CAAA;;;ACrCK,SAAU,oBAAoB,CAAI,YAAe,EAAA;IACrD,OAAO,IAAI,cAAc,CAAI,YAAY,CAAC,WAAW,CAAC,IAAI,EACxD;AACE,QAAA,UAAU,EAAE,MAAM;AAClB,QAAA,OAAO,EAAE,MAAM,YAAY;AAC5B,KAAA,CACF,CAAC;AACJ,CAAC;AAEe,SAAA,aAAa,CAAI,KAAwB,EAAE,OAAgB,EAAA;IACzE,OAAO;AACL,QAAA,OAAO,EAAE,KAAK;AACd,QAAA,UAAU,EAAE,OAAO;KACpB,CAAC;AACJ;;AChBA;;AAEG;;;;"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { EntryButtonModule } from '@enigmatry/entry-components/button';
|
|
2
2
|
export * from '@enigmatry/entry-components/button';
|
|
3
|
+
import { NG_EVENT_PLUGINS, EntryCommonModule } from '@enigmatry/entry-components/common';
|
|
4
|
+
export * from '@enigmatry/entry-components/common';
|
|
3
5
|
import { EntryDialogModule } from '@enigmatry/entry-components/dialog';
|
|
4
6
|
export * from '@enigmatry/entry-components/dialog';
|
|
5
7
|
import { EntryFileInputModule } from '@enigmatry/entry-components/file-input';
|
|
@@ -27,7 +29,7 @@ class EntryComponentsModule {
|
|
|
27
29
|
const permissionServiceProvider = options.permissionService
|
|
28
30
|
? [{ provide: EntryPermissionService, useClass: options.permissionService }]
|
|
29
31
|
: [];
|
|
30
|
-
const providers = [...permissionServiceProvider];
|
|
32
|
+
const providers = [...permissionServiceProvider, ...NG_EVENT_PLUGINS];
|
|
31
33
|
return {
|
|
32
34
|
ngModule: EntryComponentsModule,
|
|
33
35
|
providers
|
|
@@ -36,6 +38,7 @@ class EntryComponentsModule {
|
|
|
36
38
|
}
|
|
37
39
|
EntryComponentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
38
40
|
EntryComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: EntryComponentsModule, exports: [EntryButtonModule,
|
|
41
|
+
EntryCommonModule,
|
|
39
42
|
EntryDialogModule,
|
|
40
43
|
EntryFileInputModule,
|
|
41
44
|
EntryValidationModule,
|
|
@@ -43,6 +46,7 @@ EntryComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
|
|
|
43
46
|
EntrySearchFilterModule,
|
|
44
47
|
EntryTableModule] });
|
|
45
48
|
EntryComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryComponentsModule, imports: [EntryButtonModule,
|
|
49
|
+
EntryCommonModule,
|
|
46
50
|
EntryDialogModule,
|
|
47
51
|
EntryFileInputModule,
|
|
48
52
|
EntryValidationModule,
|
|
@@ -55,6 +59,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
55
59
|
declarations: [],
|
|
56
60
|
exports: [
|
|
57
61
|
EntryButtonModule,
|
|
62
|
+
EntryCommonModule,
|
|
58
63
|
EntryDialogModule,
|
|
59
64
|
EntryFileInputModule,
|
|
60
65
|
EntryValidationModule,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enigmatry-entry-components.mjs","sources":["../../../../libs/entry-components/modules/entry-components.module.ts","../../../../libs/entry-components/public-api.ts","../../../../libs/entry-components/enigmatry-entry-components.ts"],"sourcesContent":["import { ModuleWithProviders, NgModule, Provider, Type } from '@angular/core';\r\nimport { EntryButtonModule } from '@enigmatry/entry-components/button';\r\nimport { EntryDialogModule } from '@enigmatry/entry-components/dialog';\r\nimport { EntryPermissionModule, EntryPermissionService } from '@enigmatry/entry-components/permissions';\r\nimport { EntrySearchFilterModule } from '@enigmatry/entry-components/search-filter';\r\nimport { EntryValidationModule } from '@enigmatry/entry-components/validation';\r\nimport { EntryFileInputModule } from '@enigmatry/entry-components/file-input';\r\nimport { EntryTableModule } from '@enigmatry/entry-components/table';\r\n\r\ninterface EntryComponentsModuleOptions {\r\n permissionService?: Type<any>;\r\n}\r\n\r\n/**\r\n * Exports all entry components.\r\n *\r\n * Usage\r\n * import EntryComponentsModule in shared.module.ts to have access to all components, directives, pipes.\r\n * import EntryComponentsModule.forRoot() in app.module.ts to register root module providers.\r\n */\r\n@NgModule({\r\n declarations: [],\r\n exports: [\r\n EntryButtonModule,\r\n EntryDialogModule,\r\n EntryFileInputModule,\r\n EntryValidationModule,\r\n EntryPermissionModule,\r\n EntrySearchFilterModule,\r\n EntryTableModule\r\n ]\r\n})\r\nexport class EntryComponentsModule {\r\n static forRoot(options: EntryComponentsModuleOptions = {}): ModuleWithProviders<EntryComponentsModule> {\r\n\r\n const permissionServiceProvider: Provider[] = options.permissionService\r\n ? [{ provide: EntryPermissionService, useClass: options.permissionService }]\r\n : [];\r\n\r\n const providers: Provider[] = [...permissionServiceProvider];\r\n return {\r\n ngModule: EntryComponentsModule,\r\n providers\r\n };\r\n }\r\n}\r\n","\n/*\n * Public API Surface of entry-components\n */\nexport * from '@enigmatry/entry-components/button';\nexport * from '@enigmatry/entry-components/dialog';\nexport * from '@enigmatry/entry-components/file-input';\nexport * from '@enigmatry/entry-components/permissions';\nexport * from '@enigmatry/entry-components/search-filter';\nexport * from '@enigmatry/entry-components/validation';\nexport * from '@enigmatry/entry-components/table';\n\nexport { EntryComponentsModule } from './modules/entry-components.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"enigmatry-entry-components.mjs","sources":["../../../../libs/entry-components/modules/entry-components.module.ts","../../../../libs/entry-components/public-api.ts","../../../../libs/entry-components/enigmatry-entry-components.ts"],"sourcesContent":["import { ModuleWithProviders, NgModule, Provider, Type } from '@angular/core';\r\nimport { EntryButtonModule } from '@enigmatry/entry-components/button';\r\nimport { EntryDialogModule } from '@enigmatry/entry-components/dialog';\r\nimport { EntryPermissionModule, EntryPermissionService } from '@enigmatry/entry-components/permissions';\r\nimport { EntrySearchFilterModule } from '@enigmatry/entry-components/search-filter';\r\nimport { EntryValidationModule } from '@enigmatry/entry-components/validation';\r\nimport { EntryFileInputModule } from '@enigmatry/entry-components/file-input';\r\nimport { EntryTableModule } from '@enigmatry/entry-components/table';\r\nimport { EntryCommonModule, NG_EVENT_PLUGINS } from '@enigmatry/entry-components/common';\r\n\r\ninterface EntryComponentsModuleOptions {\r\n permissionService?: Type<any>;\r\n}\r\n\r\n/**\r\n * Exports all entry components.\r\n *\r\n * Usage\r\n * import EntryComponentsModule in shared.module.ts to have access to all components, directives, pipes.\r\n * import EntryComponentsModule.forRoot() in app.module.ts to register root module providers.\r\n */\r\n@NgModule({\r\n declarations: [],\r\n exports: [\r\n EntryButtonModule,\r\n EntryCommonModule,\r\n EntryDialogModule,\r\n EntryFileInputModule,\r\n EntryValidationModule,\r\n EntryPermissionModule,\r\n EntrySearchFilterModule,\r\n EntryTableModule\r\n ]\r\n})\r\nexport class EntryComponentsModule {\r\n static forRoot(options: EntryComponentsModuleOptions = {}): ModuleWithProviders<EntryComponentsModule> {\r\n\r\n const permissionServiceProvider: Provider[] = options.permissionService\r\n ? [{ provide: EntryPermissionService, useClass: options.permissionService }]\r\n : [];\r\n\r\n const providers: Provider[] = [...permissionServiceProvider, ...NG_EVENT_PLUGINS];\r\n return {\r\n ngModule: EntryComponentsModule,\r\n providers\r\n };\r\n }\r\n}\r\n","\n/*\n * Public API Surface of entry-components\n */\nexport * from '@enigmatry/entry-components/button';\nexport * from '@enigmatry/entry-components/common';\nexport * from '@enigmatry/entry-components/dialog';\nexport * from '@enigmatry/entry-components/file-input';\nexport * from '@enigmatry/entry-components/permissions';\nexport * from '@enigmatry/entry-components/search-filter';\nexport * from '@enigmatry/entry-components/validation';\nexport * from '@enigmatry/entry-components/table';\n\nexport { EntryComponentsModule } from './modules/entry-components.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAcA;;;;;;AAMG;MAcU,qBAAqB,CAAA;AAChC,IAAA,OAAO,OAAO,CAAC,OAAA,GAAwC,EAAE,EAAA;AAEvD,QAAA,MAAM,yBAAyB,GAAe,OAAO,CAAC,iBAAiB;AACrE,cAAE,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC;cAC1E,EAAE,CAAC;QAEP,MAAM,SAAS,GAAe,CAAC,GAAG,yBAAyB,EAAE,GAAG,gBAAgB,CAAC,CAAC;QAClF,OAAO;AACL,YAAA,QAAQ,EAAE,qBAAqB;YAC/B,SAAS;SACV,CAAC;KACH;;kHAZU,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAArB,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,YAV9B,iBAAiB;QACjB,iBAAiB;QACjB,iBAAiB;QACjB,oBAAoB;QACpB,qBAAqB;QACrB,qBAAqB;QACrB,uBAAuB;QACvB,gBAAgB,CAAA,EAAA,CAAA,CAAA;AAGP,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,YAV9B,iBAAiB;QACjB,iBAAiB;QACjB,iBAAiB;QACjB,oBAAoB;QACpB,qBAAqB;QACrB,qBAAqB;QACrB,uBAAuB;QACvB,gBAAgB,CAAA,EAAA,CAAA,CAAA;2FAGP,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAbjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP,iBAAiB;wBACjB,iBAAiB;wBACjB,iBAAiB;wBACjB,oBAAoB;wBACpB,qBAAqB;wBACrB,qBAAqB;wBACrB,uBAAuB;wBACvB,gBAAgB;AACjB,qBAAA;iBACF,CAAA;;;AChCD;;AAEG;;ACHH;;AAEG;;;;"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, Self, NgModule, InjectionToken } from '@angular/core';
|
|
2
|
+
import { Directive, Self, Injectable, NgModule, InjectionToken } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
import { Subject, fromEvent } from 'rxjs';
|
|
5
5
|
import { takeUntil } from 'rxjs/operators';
|
|
6
6
|
import * as i1 from '@angular/forms';
|
|
7
|
+
import { debounce, throttle } from 'lodash-es';
|
|
8
|
+
import { EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';
|
|
7
9
|
|
|
8
10
|
const NG_VALID_CLASS = '.ng-valid';
|
|
9
11
|
const NG_INVALID_CLASS = '.ng-invalid';
|
|
@@ -53,10 +55,120 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
53
55
|
type: Self
|
|
54
56
|
}] }, { type: i0.ElementRef }]; } });
|
|
55
57
|
|
|
58
|
+
/**
|
|
59
|
+
* abstract class EventManagerPlugin will be exposed in the public api
|
|
60
|
+
* https://github.com/angular/angular/pull/49969
|
|
61
|
+
*
|
|
62
|
+
* Until then creating it from reference
|
|
63
|
+
* https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/event_manager.ts#L93
|
|
64
|
+
*
|
|
65
|
+
* How to create custom event modifiers
|
|
66
|
+
* https://github.com/Tinkoff/ng-event-plugins,
|
|
67
|
+
* https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/key_events.ts
|
|
68
|
+
* https://netbasal.com/lifting-the-veil-insights-into-angulars-eventmanagerplugin-ed9d14cbb31a
|
|
69
|
+
*/
|
|
70
|
+
class EventManagerPlugin {
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Entry event plugin base class
|
|
74
|
+
*/
|
|
75
|
+
class EntryEventManagerPlugin extends EventManagerPlugin {
|
|
76
|
+
/** return `true` for every event name that has specified modifier */
|
|
77
|
+
supports(eventName) {
|
|
78
|
+
return eventName.includes(this.modifier);
|
|
79
|
+
}
|
|
80
|
+
/** unwrap params e.g. (click.debounce.500) => ['debounce', 500] */
|
|
81
|
+
unwrapParams(eventName) {
|
|
82
|
+
return eventName
|
|
83
|
+
.substring(eventName.indexOf(this.modifier))
|
|
84
|
+
.split('.')
|
|
85
|
+
.filter(x => !!x);
|
|
86
|
+
}
|
|
87
|
+
/** get event name e.g. (click.debounce.500) => click */
|
|
88
|
+
unwrapEventName(eventName) {
|
|
89
|
+
return eventName.substring(0, eventName.indexOf(this.modifier));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
94
|
+
/**
|
|
95
|
+
* Provides event plugin for debouncing events.
|
|
96
|
+
*
|
|
97
|
+
* How to use:
|
|
98
|
+
* <button (click.debounce)="doSomething($event)">
|
|
99
|
+
* <input (keyup.debounce.500)="doSomething($event)">
|
|
100
|
+
*/
|
|
101
|
+
class DebounceEventPlugin extends EntryEventManagerPlugin {
|
|
102
|
+
constructor() {
|
|
103
|
+
super(...arguments);
|
|
104
|
+
this.modifier = '.debounce';
|
|
105
|
+
}
|
|
106
|
+
addEventListener(element, eventName, originalHandler) {
|
|
107
|
+
// e.g. (click.debounce.500)
|
|
108
|
+
const [_modifier, milliseconds = 500, option = 'leading'] = this.unwrapParams(eventName);
|
|
109
|
+
// run original handler inside ngZone in which the event occurred
|
|
110
|
+
const innerHandler = (event) => this.manager.getZone().runGuarded(() => originalHandler(event));
|
|
111
|
+
// create debounced handler
|
|
112
|
+
const debouncedHandler = debounce(innerHandler, milliseconds, { leading: option === 'leading', trailing: option === 'trailing' });
|
|
113
|
+
// register event with debounced handler
|
|
114
|
+
return this.manager.addEventListener(element, this.unwrapEventName(eventName), debouncedHandler);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
DebounceEventPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebounceEventPlugin, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
118
|
+
DebounceEventPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebounceEventPlugin });
|
|
119
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebounceEventPlugin, decorators: [{
|
|
120
|
+
type: Injectable
|
|
121
|
+
}] });
|
|
122
|
+
|
|
123
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
124
|
+
/**
|
|
125
|
+
* Provides event plugin for throttling events.
|
|
126
|
+
*
|
|
127
|
+
* How to use:
|
|
128
|
+
* <button (click.throttle)="doSomething($event)">
|
|
129
|
+
* <input (keyup.throttle.500)="doSomething($event)">
|
|
130
|
+
*/
|
|
131
|
+
class ThrottleEventPlugin extends EntryEventManagerPlugin {
|
|
132
|
+
constructor() {
|
|
133
|
+
super(...arguments);
|
|
134
|
+
this.modifier = '.throttle';
|
|
135
|
+
}
|
|
136
|
+
addEventListener(element, eventName, originalHandler) {
|
|
137
|
+
// e.g. (keyup.throttle.500)
|
|
138
|
+
const [_modifier, milliseconds = 500] = this.unwrapParams(eventName);
|
|
139
|
+
// run original handler inside ngZone in which the event occurred
|
|
140
|
+
const innerHandler = (event) => this.manager.getZone().runGuarded(() => originalHandler(event));
|
|
141
|
+
// create throttled handler
|
|
142
|
+
const throttledHandler = throttle(innerHandler, milliseconds);
|
|
143
|
+
// register event with throttled handler
|
|
144
|
+
return this.manager.addEventListener(element, this.unwrapEventName(eventName), throttledHandler);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
ThrottleEventPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ThrottleEventPlugin, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
148
|
+
ThrottleEventPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ThrottleEventPlugin });
|
|
149
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ThrottleEventPlugin, decorators: [{
|
|
150
|
+
type: Injectable
|
|
151
|
+
}] });
|
|
152
|
+
|
|
56
153
|
const DIRECTIVES = [
|
|
57
154
|
ScrollToInvalidControlDirective
|
|
58
155
|
];
|
|
156
|
+
const EVENT_PLUGINS = [
|
|
157
|
+
DebounceEventPlugin,
|
|
158
|
+
ThrottleEventPlugin
|
|
159
|
+
];
|
|
160
|
+
const NG_EVENT_PLUGINS = EVENT_PLUGINS.map(useClass => ({
|
|
161
|
+
provide: EVENT_MANAGER_PLUGINS,
|
|
162
|
+
multi: true,
|
|
163
|
+
useClass
|
|
164
|
+
}));
|
|
59
165
|
class EntryCommonModule {
|
|
166
|
+
static forRoot() {
|
|
167
|
+
return {
|
|
168
|
+
ngModule: EntryCommonModule,
|
|
169
|
+
providers: NG_EVENT_PLUGINS
|
|
170
|
+
};
|
|
171
|
+
}
|
|
60
172
|
}
|
|
61
173
|
EntryCommonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
62
174
|
EntryCommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: EntryCommonModule, imports: [CommonModule, ScrollToInvalidControlDirective], exports: [ScrollToInvalidControlDirective] });
|
|
@@ -92,5 +204,5 @@ function provideConfig(token, factory) {
|
|
|
92
204
|
* Generated bundle index. Do not edit.
|
|
93
205
|
*/
|
|
94
206
|
|
|
95
|
-
export { EntryCommonModule, ScrollToInvalidControlDirective, createInjectionToken, provideConfig };
|
|
207
|
+
export { DebounceEventPlugin, EntryCommonModule, NG_EVENT_PLUGINS, ScrollToInvalidControlDirective, ThrottleEventPlugin, createInjectionToken, provideConfig };
|
|
96
208
|
//# sourceMappingURL=enigmatry-entry-components-common.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enigmatry-entry-components-common.mjs","sources":["../../../../libs/entry-components/common/constants.ts","../../../../libs/entry-components/common/directives/scroll-to-invalid-control.directive.ts","../../../../libs/entry-components/common/common.module.ts","../../../../libs/entry-components/common/utils/provide-config.ts","../../../../libs/entry-components/common/enigmatry-entry-components-common.ts"],"sourcesContent":["export const NG_VALID_CLASS = '.ng-valid';\r\nexport const NG_INVALID_CLASS = '.ng-invalid';\r\n","import { Directive, ElementRef, OnDestroy, OnInit, Self } from '@angular/core';\r\nimport { ControlContainer } from '@angular/forms';\r\nimport { Subject, fromEvent } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\nimport { NG_INVALID_CLASS } from '../constants';\r\n\r\n/**\r\n * Scroll to first invalid control when form is submitted.\r\n * Directive is applied to 'form[formGroup],form[ngForm]' (reactive or template driven forms)\r\n */\r\n@Directive({\r\n standalone: true,\r\n selector: 'form[formGroup],form[ngForm]'\r\n})\r\nexport class ScrollToInvalidControlDirective implements OnInit, OnDestroy {\r\n\r\n private destroy$ = new Subject<void>();\r\n\r\n constructor(\r\n @Self() private form: ControlContainer,\r\n private elementRef: ElementRef<HTMLFormElement>) { }\r\n\r\n ngOnInit(): void {\r\n fromEvent(this.elementRef.nativeElement, 'submit')\r\n .pipe(takeUntil(this.destroy$))\r\n .subscribe(_ => {\r\n if (this.form.invalid) {\r\n this.scrollToInvalidControl();\r\n }\r\n });\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.destroy$.next();\r\n this.destroy$.complete();\r\n }\r\n\r\n private scrollToInvalidControl() {\r\n const firstInvalidControl: HTMLElement =\r\n this.elementRef.nativeElement.querySelector(NG_INVALID_CLASS);\r\n\r\n if (firstInvalidControl) {\r\n firstInvalidControl.scrollIntoView({\r\n behavior: 'smooth',\r\n block: 'center' // vertical alignment\r\n });\r\n }\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\n\r\n/** Directives */\r\n\r\nimport { ScrollToInvalidControlDirective } from './directives/scroll-to-invalid-control.directive';\r\n\r\nconst DIRECTIVES = [\r\n ScrollToInvalidControlDirective\r\n];\r\n\r\n@NgModule({\r\n declarations: [\r\n ],\r\n imports: [\r\n CommonModule,\r\n ...DIRECTIVES\r\n ],\r\n exports: [\r\n ...DIRECTIVES\r\n ]\r\n})\r\nexport class EntryCommonModule {\r\n}\r\n","import { InjectionToken, Provider } from '@angular/core';\r\n\r\nexport function createInjectionToken<T>(defaultValue: T): InjectionToken<T> {\r\n return new InjectionToken<T>(defaultValue.constructor.name,\r\n {\r\n providedIn: 'root',\r\n factory: () => defaultValue\r\n }\r\n );\r\n}\r\n\r\nexport function provideConfig<T>(token: InjectionToken<T>, factory: () => T): Provider {\r\n return {\r\n provide: token,\r\n useFactory: factory\r\n };\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAAO,MAAM,cAAc,GAAG,WAAW,CAAC;AACnC,MAAM,gBAAgB,GAAG,aAAa;;ACK7C;;;AAGG;MAKU,+BAA+B,CAAA;IAI1C,WACkB,CAAA,IAAsB,EAC9B,UAAuC,EAAA;QAD/B,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAkB;QAC9B,IAAU,CAAA,UAAA,GAAV,UAAU,CAA6B;AAJzC,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;KAIe;IAEtD,QAAQ,GAAA;QACN,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,QAAQ,CAAC;AAC/C,aAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC9B,SAAS,CAAC,CAAC,IAAG;AACb,YAAA,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACrB,IAAI,CAAC,sBAAsB,EAAE,CAAC;AAC/B,aAAA;AACH,SAAC,CAAC,CAAC;KACN;IAED,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AACrB,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;KAC1B;IAEO,sBAAsB,GAAA;AAC5B,QAAA,MAAM,mBAAmB,GACvB,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;AAEhE,QAAA,IAAI,mBAAmB,EAAE;YACvB,mBAAmB,CAAC,cAAc,CAAC;AACjC,gBAAA,QAAQ,EAAE,QA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A,UAAA,EAAA,CAAA;kBAX7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EACb;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;AACZ,wBAAA,GAAG,UAAU;AACd,qBAAA;AACD,oBAAA,OAAO,EAAE;AACP,wBAAA,GAAG,UAAU;AACd,qBAAA;AACF,iBAAA,CAAA;;;ACnBK,SAAU,oBAAoB,CAAI,YAAe,EAAA;IACrD,OAAO,IAAI,cAAc,CAAI,YAAY,CAAC,WAAW,CAAC,IAAI,EACxD;AACE,QAAA,UAAU,EAAE,MAAM;AAClB,QAAA,OAAO,EAAE,MAAM,YAAY;AAC5B,KAAA,CACF,CAAC;AACJ,CAAC;AAEe,SAAA,aAAa,CAAI,KAAwB,EAAE,OAAgB,EAAA;IACzE,OAAO;AACL,QAAA,OAAO,EAAE,KAAK;AACd,QAAA,UAAU,EAAE,OAAO;KACpB,CAAC;AACJ;;AChBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"enigmatry-entry-components-common.mjs","sources":["../../../../libs/entry-components/common/constants.ts","../../../../libs/entry-components/common/directives/scroll-to-invalid-control.directive.ts","../../../../libs/entry-components/common/event-plugins/abstract.plugin.ts","../../../../libs/entry-components/common/event-plugins/debounce.plugin.ts","../../../../libs/entry-components/common/event-plugins/throttle.plugin.ts","../../../../libs/entry-components/common/common.module.ts","../../../../libs/entry-components/common/utils/provide-config.ts","../../../../libs/entry-components/common/enigmatry-entry-components-common.ts"],"sourcesContent":["export const NG_VALID_CLASS = '.ng-valid';\r\nexport const NG_INVALID_CLASS = '.ng-invalid';\r\n","import { Directive, ElementRef, OnDestroy, OnInit, Self } from '@angular/core';\r\nimport { ControlContainer } from '@angular/forms';\r\nimport { Subject, fromEvent } from 'rxjs';\r\nimport { takeUntil } from 'rxjs/operators';\r\nimport { NG_INVALID_CLASS } from '../constants';\r\n\r\n/**\r\n * Scroll to first invalid control when form is submitted.\r\n * Directive is applied to 'form[formGroup],form[ngForm]' (reactive or template driven forms)\r\n */\r\n@Directive({\r\n standalone: true,\r\n selector: 'form[formGroup],form[ngForm]'\r\n})\r\nexport class ScrollToInvalidControlDirective implements OnInit, OnDestroy {\r\n\r\n private destroy$ = new Subject<void>();\r\n\r\n constructor(\r\n @Self() private form: ControlContainer,\r\n private elementRef: ElementRef<HTMLFormElement>) { }\r\n\r\n ngOnInit(): void {\r\n fromEvent(this.elementRef.nativeElement, 'submit')\r\n .pipe(takeUntil(this.destroy$))\r\n .subscribe(_ => {\r\n if (this.form.invalid) {\r\n this.scrollToInvalidControl();\r\n }\r\n });\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.destroy$.next();\r\n this.destroy$.complete();\r\n }\r\n\r\n private scrollToInvalidControl() {\r\n const firstInvalidControl: HTMLElement =\r\n this.elementRef.nativeElement.querySelector(NG_INVALID_CLASS);\r\n\r\n if (firstInvalidControl) {\r\n firstInvalidControl.scrollIntoView({\r\n behavior: 'smooth',\r\n block: 'center' // vertical alignment\r\n });\r\n }\r\n }\r\n}\r\n","import { EventManager } from '@angular/platform-browser';\r\n\r\n/**\r\n * abstract class EventManagerPlugin will be exposed in the public api\r\n * https://github.com/angular/angular/pull/49969\r\n *\r\n * Until then creating it from reference\r\n * https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/event_manager.ts#L93\r\n *\r\n * How to create custom event modifiers\r\n * https://github.com/Tinkoff/ng-event-plugins,\r\n * https://github.com/angular/angular/blob/main/packages/platform-browser/src/dom/events/key_events.ts\r\n * https://netbasal.com/lifting-the-veil-insights-into-angulars-eventmanagerplugin-ed9d14cbb31a\r\n */\r\nexport abstract class EventManagerPlugin {\r\n\r\n // Using non-null assertion because it's set by EventManager's constructor\r\n manager!: EventManager;\r\n\r\n /** Should return `true` for every event name that should be supported by this plugin */\r\n abstract supports(eventName: string): boolean;\r\n\r\n /**\r\n * Registers a handler for a specific element and event.\r\n *\r\n * @param element The HTML element to receive event notifications.\r\n * @param eventName The name of the event to listen for.\r\n * @param handler A function to call when the notification occurs. Receives the\r\n * event object as an argument.\r\n * @returns A callback function that can be used to remove the handler.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/ban-types\r\n abstract addEventListener(element: HTMLElement, eventName: string, handler: Function): Function;\r\n}\r\n\r\n/**\r\n * Entry event plugin base class\r\n */\r\nexport abstract class EntryEventManagerPlugin extends EventManagerPlugin {\r\n abstract modifier: string;\r\n\r\n /** return `true` for every event name that has specified modifier */\r\n supports(eventName: string): boolean {\r\n return eventName.includes(this.modifier);\r\n }\r\n\r\n /** unwrap params e.g. (click.debounce.500) => ['debounce', 500] */\r\n unwrapParams(eventName: string): string[] {\r\n return eventName\r\n .substring(eventName.indexOf(this.modifier))\r\n .split('.')\r\n .filter(x => !!x);\r\n }\r\n\r\n /** get event name e.g. (click.debounce.500) => click */\r\n unwrapEventName(eventName: string): string {\r\n return eventName.substring(0, eventName.indexOf(this.modifier));\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/ban-types */\r\nimport { Injectable } from '@angular/core';\r\nimport { EntryEventManagerPlugin } from './abstract.plugin';\r\nimport { debounce } from 'lodash-es';\r\n\r\n/**\r\n * Provides event plugin for debouncing events.\r\n *\r\n * How to use:\r\n * <button (click.debounce)=\"doSomething($event)\">\r\n * <input (keyup.debounce.500)=\"doSomething($event)\">\r\n */\r\n@Injectable()\r\nexport class DebounceEventPlugin extends EntryEventManagerPlugin {\r\n\r\n modifier = '.debounce';\r\n\r\n addEventListener(element: HTMLElement, eventName: string, originalHandler: Function): Function {\r\n // e.g. (click.debounce.500)\r\n const [_modifier, milliseconds = 500, option = 'leading'] = this.unwrapParams(eventName);\r\n\r\n // run original handler inside ngZone in which the event occurred\r\n const innerHandler = (event: any) => this.manager.getZone().runGuarded(() => originalHandler(event));\r\n\r\n // create debounced handler\r\n const debouncedHandler = debounce(innerHandler, milliseconds,\r\n { leading: option === 'leading', trailing: option === 'trailing' });\r\n\r\n // register event with debounced handler\r\n return this.manager.addEventListener(element, this.unwrapEventName(eventName), debouncedHandler);\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/ban-types */\r\nimport { Injectable } from '@angular/core';\r\nimport { EntryEventManagerPlugin } from './abstract.plugin';\r\nimport { throttle } from 'lodash-es';\r\n\r\n/**\r\n * Provides event plugin for throttling events.\r\n *\r\n * How to use:\r\n * <button (click.throttle)=\"doSomething($event)\">\r\n * <input (keyup.throttle.500)=\"doSomething($event)\">\r\n */\r\n@Injectable()\r\nexport class ThrottleEventPlugin extends EntryEventManagerPlugin {\r\n\r\n modifier = '.throttle';\r\n\r\n addEventListener(element: HTMLElement, eventName: string, originalHandler: Function): Function {\r\n // e.g. (keyup.throttle.500)\r\n const [_modifier, milliseconds = 500] = this.unwrapParams(eventName);\r\n\r\n // run original handler inside ngZone in which the event occurred\r\n const innerHandler = (event: any) => this.manager.getZone().runGuarded(() => originalHandler(event));\r\n\r\n // create throttled handler\r\n const throttledHandler = throttle(innerHandler, milliseconds);\r\n\r\n // register event with throttled handler\r\n return this.manager.addEventListener(element, this.unwrapEventName(eventName), throttledHandler);\r\n }\r\n}\r\n","import { ModuleWithProviders, NgModule, Provider } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\n/** Directives */\n\nimport { ScrollToInvalidControlDirective } from './directives/scroll-to-invalid-control.directive';\n\nconst DIRECTIVES = [\n ScrollToInvalidControlDirective\n];\n\n/** Event plugins */\n\nimport { DebounceEventPlugin } from './event-plugins/debounce.plugin';\nimport { ThrottleEventPlugin } from './event-plugins/throttle.plugin';\nimport { EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';\n\nconst EVENT_PLUGINS = [\n DebounceEventPlugin,\n ThrottleEventPlugin\n];\n\nexport const NG_EVENT_PLUGINS: Provider[] = EVENT_PLUGINS.map(useClass => ({\n provide: EVENT_MANAGER_PLUGINS,\n multi: true,\n useClass\n}));\n\n\n@NgModule({\n declarations: [\n ],\n imports: [\n CommonModule,\n ...DIRECTIVES\n ],\n exports: [\n ...DIRECTIVES\n ]\n})\nexport class EntryCommonModule {\n static forRoot(): ModuleWithProviders<EntryCommonModule> {\n return {\n ngModule: EntryCommonModule,\n providers: NG_EVENT_PLUGINS\n };\n }\n}\n","import { InjectionToken, Provider } from '@angular/core';\r\n\r\nexport function createInjectionToken<T>(defaultValue: T): InjectionToken<T> {\r\n return new InjectionToken<T>(defaultValue.constructor.name,\r\n {\r\n providedIn: 'root',\r\n factory: () => defaultValue\r\n }\r\n );\r\n}\r\n\r\nexport function provideConfig<T>(token: InjectionToken<T>, factory: () => T): Provider {\r\n return {\r\n provide: token,\r\n useFactory: factory\r\n };\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAAO,MAAM,cAAc,GAAG,WAAW,CAAC;AACnC,MAAM,gBAAgB,GAAG,aAAa;;ACK7C;;;AAGG;MAKU,+BAA+B,CAAA;IAI1C,WACkB,CAAA,IAAsB,EAC9B,UAAuC,EAAA;QAD/B,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAkB;QAC9B,IAAU,CAAA,UAAA,GAAV,UAAU,CAA6B;AAJzC,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;KAIe;IAEtD,QAAQ,GAAA;QACN,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,QAAQ,CAAC;AAC/C,aAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC9B,SAAS,CAAC,CAAC,IAAG;AACb,YAAA,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACrB,IAAI,CAAC,sBAAsB,EAAE,CAAC;AAC/B,aAAA;AACH,SAAC,CAAC,CAAC;KACN;IAED,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AACrB,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;KAC1B;IAE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 +1,7 @@
|
|
|
1
1
|
import { EntryButtonModule } from '@enigmatry/entry-components/button';
|
|
2
2
|
export * from '@enigmatry/entry-components/button';
|
|
3
|
+
import { NG_EVENT_PLUGINS, EntryCommonModule } from '@enigmatry/entry-components/common';
|
|
4
|
+
export * from '@enigmatry/entry-components/common';
|
|
3
5
|
import { EntryDialogModule } from '@enigmatry/entry-components/dialog';
|
|
4
6
|
export * from '@enigmatry/entry-components/dialog';
|
|
5
7
|
import { EntryFileInputModule } from '@enigmatry/entry-components/file-input';
|
|
@@ -27,7 +29,7 @@ class EntryComponentsModule {
|
|
|
27
29
|
const permissionServiceProvider = options.permissionService
|
|
28
30
|
? [{ provide: EntryPermissionService, useClass: options.permissionService }]
|
|
29
31
|
: [];
|
|
30
|
-
const providers = [...permissionServiceProvider];
|
|
32
|
+
const providers = [...permissionServiceProvider, ...NG_EVENT_PLUGINS];
|
|
31
33
|
return {
|
|
32
34
|
ngModule: EntryComponentsModule,
|
|
33
35
|
providers
|
|
@@ -36,6 +38,7 @@ class EntryComponentsModule {
|
|
|
36
38
|
}
|
|
37
39
|
EntryComponentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
38
40
|
EntryComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: EntryComponentsModule, exports: [EntryButtonModule,
|
|
41
|
+
EntryCommonModule,
|
|
39
42
|
EntryDialogModule,
|
|
40
43
|
EntryFileInputModule,
|
|
41
44
|
EntryValidationModule,
|
|
@@ -43,6 +46,7 @@ EntryComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
|
|
|
43
46
|
EntrySearchFilterModule,
|
|
44
47
|
EntryTableModule] });
|
|
45
48
|
EntryComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EntryComponentsModule, imports: [EntryButtonModule,
|
|
49
|
+
EntryCommonModule,
|
|
46
50
|
EntryDialogModule,
|
|
47
51
|
EntryFileInputModule,
|
|
48
52
|
EntryValidationModule,
|
|
@@ -55,6 +59,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
55
59
|
declarations: [],
|
|
56
60
|
exports: [
|
|
57
61
|
EntryButtonModule,
|
|
62
|
+
EntryCommonModule,
|
|
58
63
|
EntryDialogModule,
|
|
59
64
|
EntryFileInputModule,
|
|
60
65
|
EntryValidationModule,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enigmatry-entry-components.mjs","sources":["../../../../libs/entry-components/modules/entry-components.module.ts","../../../../libs/entry-components/public-api.ts","../../../../libs/entry-components/enigmatry-entry-components.ts"],"sourcesContent":["import { ModuleWithProviders, NgModule, Provider, Type } from '@angular/core';\r\nimport { EntryButtonModule } from '@enigmatry/entry-components/button';\r\nimport { EntryDialogModule } from '@enigmatry/entry-components/dialog';\r\nimport { EntryPermissionModule, EntryPermissionService } from '@enigmatry/entry-components/permissions';\r\nimport { EntrySearchFilterModule } from '@enigmatry/entry-components/search-filter';\r\nimport { EntryValidationModule } from '@enigmatry/entry-components/validation';\r\nimport { EntryFileInputModule } from '@enigmatry/entry-components/file-input';\r\nimport { EntryTableModule } from '@enigmatry/entry-components/table';\r\n\r\ninterface EntryComponentsModuleOptions {\r\n permissionService?: Type<any>;\r\n}\r\n\r\n/**\r\n * Exports all entry components.\r\n *\r\n * Usage\r\n * import EntryComponentsModule in shared.module.ts to have access to all components, directives, pipes.\r\n * import EntryComponentsModule.forRoot() in app.module.ts to register root module providers.\r\n */\r\n@NgModule({\r\n declarations: [],\r\n exports: [\r\n EntryButtonModule,\r\n EntryDialogModule,\r\n EntryFileInputModule,\r\n EntryValidationModule,\r\n EntryPermissionModule,\r\n EntrySearchFilterModule,\r\n EntryTableModule\r\n ]\r\n})\r\nexport class EntryComponentsModule {\r\n static forRoot(options: EntryComponentsModuleOptions = {}): ModuleWithProviders<EntryComponentsModule> {\r\n\r\n const permissionServiceProvider: Provider[] = options.permissionService\r\n ? [{ provide: EntryPermissionService, useClass: options.permissionService }]\r\n : [];\r\n\r\n const providers: Provider[] = [...permissionServiceProvider];\r\n return {\r\n ngModule: EntryComponentsModule,\r\n providers\r\n };\r\n }\r\n}\r\n","\n/*\n * Public API Surface of entry-components\n */\nexport * from '@enigmatry/entry-components/button';\nexport * from '@enigmatry/entry-components/dialog';\nexport * from '@enigmatry/entry-components/file-input';\nexport * from '@enigmatry/entry-components/permissions';\nexport * from '@enigmatry/entry-components/search-filter';\nexport * from '@enigmatry/entry-components/validation';\nexport * from '@enigmatry/entry-components/table';\n\nexport { EntryComponentsModule } from './modules/entry-components.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"enigmatry-entry-components.mjs","sources":["../../../../libs/entry-components/modules/entry-components.module.ts","../../../../libs/entry-components/public-api.ts","../../../../libs/entry-components/enigmatry-entry-components.ts"],"sourcesContent":["import { ModuleWithProviders, NgModule, Provider, Type } from '@angular/core';\r\nimport { EntryButtonModule } from '@enigmatry/entry-components/button';\r\nimport { EntryDialogModule } from '@enigmatry/entry-components/dialog';\r\nimport { EntryPermissionModule, EntryPermissionService } from '@enigmatry/entry-components/permissions';\r\nimport { EntrySearchFilterModule } from '@enigmatry/entry-components/search-filter';\r\nimport { EntryValidationModule } from '@enigmatry/entry-components/validation';\r\nimport { EntryFileInputModule } from '@enigmatry/entry-components/file-input';\r\nimport { EntryTableModule } from '@enigmatry/entry-components/table';\r\nimport { EntryCommonModule, NG_EVENT_PLUGINS } from '@enigmatry/entry-components/common';\r\n\r\ninterface EntryComponentsModuleOptions {\r\n permissionService?: Type<any>;\r\n}\r\n\r\n/**\r\n * Exports all entry components.\r\n *\r\n * Usage\r\n * import EntryComponentsModule in shared.module.ts to have access to all components, directives, pipes.\r\n * import EntryComponentsModule.forRoot() in app.module.ts to register root module providers.\r\n */\r\n@NgModule({\r\n declarations: [],\r\n exports: [\r\n EntryButtonModule,\r\n EntryCommonModule,\r\n EntryDialogModule,\r\n EntryFileInputModule,\r\n EntryValidationModule,\r\n EntryPermissionModule,\r\n EntrySearchFilterModule,\r\n EntryTableModule\r\n ]\r\n})\r\nexport class EntryComponentsModule {\r\n static forRoot(options: EntryComponentsModuleOptions = {}): ModuleWithProviders<EntryComponentsModule> {\r\n\r\n const permissionServiceProvider: Provider[] = options.permissionService\r\n ? [{ provide: EntryPermissionService, useClass: options.permissionService }]\r\n : [];\r\n\r\n const providers: Provider[] = [...permissionServiceProvider, ...NG_EVENT_PLUGINS];\r\n return {\r\n ngModule: EntryComponentsModule,\r\n providers\r\n };\r\n }\r\n}\r\n","\n/*\n * Public API Surface of entry-components\n */\nexport * from '@enigmatry/entry-components/button';\nexport * from '@enigmatry/entry-components/common';\nexport * from '@enigmatry/entry-components/dialog';\nexport * from '@enigmatry/entry-components/file-input';\nexport * from '@enigmatry/entry-components/permissions';\nexport * from '@enigmatry/entry-components/search-filter';\nexport * from '@enigmatry/entry-components/validation';\nexport * from '@enigmatry/entry-components/table';\n\nexport { EntryComponentsModule } from './modules/entry-components.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAcA;;;;;;AAMG;MAcU,qBAAqB,CAAA;AAChC,IAAA,OAAO,OAAO,CAAC,OAAA,GAAwC,EAAE,EAAA;AAEvD,QAAA,MAAM,yBAAyB,GAAe,OAAO,CAAC,iBAAiB;AACrE,cAAE,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC;cAC1E,EAAE,CAAC;QAEP,MAAM,SAAS,GAAe,CAAC,GAAG,yBAAyB,EAAE,GAAG,gBAAgB,CA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from "@enigmatry/entry-components/button";
|
|
4
|
-
import * as i2 from "@enigmatry/entry-components/
|
|
5
|
-
import * as i3 from "@enigmatry/entry-components/
|
|
6
|
-
import * as i4 from "@enigmatry/entry-components/
|
|
7
|
-
import * as i5 from "@enigmatry/entry-components/
|
|
8
|
-
import * as i6 from "@enigmatry/entry-components/
|
|
9
|
-
import * as i7 from "@enigmatry/entry-components/
|
|
4
|
+
import * as i2 from "@enigmatry/entry-components/common";
|
|
5
|
+
import * as i3 from "@enigmatry/entry-components/dialog";
|
|
6
|
+
import * as i4 from "@enigmatry/entry-components/file-input";
|
|
7
|
+
import * as i5 from "@enigmatry/entry-components/validation";
|
|
8
|
+
import * as i6 from "@enigmatry/entry-components/permissions";
|
|
9
|
+
import * as i7 from "@enigmatry/entry-components/search-filter";
|
|
10
|
+
import * as i8 from "@enigmatry/entry-components/table";
|
|
10
11
|
interface EntryComponentsModuleOptions {
|
|
11
12
|
permissionService?: Type<any>;
|
|
12
13
|
}
|
|
@@ -20,7 +21,7 @@ interface EntryComponentsModuleOptions {
|
|
|
20
21
|
export declare class EntryComponentsModule {
|
|
21
22
|
static forRoot(options?: EntryComponentsModuleOptions): ModuleWithProviders<EntryComponentsModule>;
|
|
22
23
|
static ɵfac: i0.ɵɵFactoryDeclaration<EntryComponentsModule, never>;
|
|
23
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<EntryComponentsModule, never, never, [typeof i1.EntryButtonModule, typeof i2.
|
|
24
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<EntryComponentsModule, never, never, [typeof i1.EntryButtonModule, typeof i2.EntryCommonModule, typeof i3.EntryDialogModule, typeof i4.EntryFileInputModule, typeof i5.EntryValidationModule, typeof i6.EntryPermissionModule, typeof i7.EntrySearchFilterModule, typeof i8.EntryTableModule]>;
|
|
24
25
|
static ɵinj: i0.ɵɵInjectorDeclaration<EntryComponentsModule>;
|
|
25
26
|
}
|
|
26
27
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enigmatry/entry-components",
|
|
3
|
-
"version": "15.0.0-preview.
|
|
3
|
+
"version": "15.0.0-preview.4",
|
|
4
4
|
"author": "Enigmatry",
|
|
5
5
|
"description": "Enigmatry entry angular material components",
|
|
6
6
|
"homepage": "https://github.com/enigmatry/entry-angular-building-blocks/tree/master/libs/entry-components#readme",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"@angular/core": "^15.0.0",
|
|
17
17
|
"@angular/material": "^15.0.0",
|
|
18
18
|
"@angular/forms": "^15.0.0",
|
|
19
|
-
"@angular/platform-browser": "^15.0.0"
|
|
19
|
+
"@angular/platform-browser": "^15.0.0",
|
|
20
|
+
"lodash-es": "^4.17.21"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
23
|
"tslib": "^2.3.0"
|
package/public-api.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from '@enigmatry/entry-components/button';
|
|
2
|
+
export * from '@enigmatry/entry-components/common';
|
|
2
3
|
export * from '@enigmatry/entry-components/dialog';
|
|
3
4
|
export * from '@enigmatry/entry-components/file-input';
|
|
4
5
|
export * from '@enigmatry/entry-components/permissions';
|