@one-paragon/angular-utilities 2.8.4 → 2.8.5
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/fesm2022/one-paragon-angular-utilities.mjs +7350 -0
- package/fesm2022/one-paragon-angular-utilities.mjs.map +1 -0
- package/package.json +27 -15
- package/types/one-paragon-angular-utilities.d.ts +2211 -0
- package/karma.conf.js +0 -43
- package/ng-package.json +0 -7
- package/src/action-state/action-state-spinner/action-state-spinner.component.css +0 -16
- package/src/action-state/action-state-spinner/action-state-spinner.component.html +0 -7
- package/src/action-state/action-state-spinner/action-state-spinner.component.spec.ts +0 -25
- package/src/action-state/action-state-spinner/action-state-spinner.component.ts +0 -26
- package/src/action-state/action-state-ui/action-state-ui.module.ts +0 -13
- package/src/action-state/index.ts +0 -8
- package/src/action-state/ngrx-ext/ngrx-ext.module.ts +0 -14
- package/src/action-state/ngrx.ts +0 -69
- package/src/http-request-state/RequestStateFactory.ts +0 -56
- package/src/http-request-state/RequestStateStore.ts +0 -360
- package/src/http-request-state/deprecated.ts +0 -20
- package/src/http-request-state/directives/HttpStateDirectiveBase.ts +0 -29
- package/src/http-request-state/directives/http-error-state-directive.ts +0 -21
- package/src/http-request-state/directives/http-inProgress-state-directive.ts +0 -19
- package/src/http-request-state/directives/http-notStarted-state-directive.ts +0 -19
- package/src/http-request-state/directives/http-success-state-directive.ts +0 -29
- package/src/http-request-state/directives/index.ts +0 -5
- package/src/http-request-state/directives/request-state-directive.spec.ts +0 -73
- package/src/http-request-state/directives/request-state-directive.ts +0 -78
- package/src/http-request-state/documentation/CREATE-REQUESTOR.md +0 -667
- package/src/http-request-state/documentation/README.md +0 -191
- package/src/http-request-state/documentation/REQUEST-STATE-STORE-CONFIG.md +0 -648
- package/src/http-request-state/documentation/REQUESTOR.md +0 -616
- package/src/http-request-state/helpers.ts +0 -30
- package/src/http-request-state/http-state-module.ts +0 -23
- package/src/http-request-state/index.ts +0 -7
- package/src/http-request-state/models/view-context.ts +0 -18
- package/src/http-request-state/observable.spec.ts +0 -43
- package/src/http-request-state/request-state.ts +0 -66
- package/src/http-request-state/rxjs/getRequestorBody.ts +0 -10
- package/src/http-request-state/rxjs/getRequestorState.ts +0 -8
- package/src/http-request-state/rxjs/index.ts +0 -4
- package/src/http-request-state/rxjs/tapError.ts +0 -16
- package/src/http-request-state/rxjs/tapSuccess.ts +0 -16
- package/src/http-request-state/strategies.spec.ts +0 -42
- package/src/http-request-state/types.ts +0 -54
- package/src/ngrx/actionable-selector.ts +0 -189
- package/src/ngrx/index.ts +0 -1
- package/src/public-api.ts +0 -40
- package/src/rxjs/defaultShareReplay.ts +0 -8
- package/src/rxjs/index.ts +0 -5
- package/src/rxjs/mapError.ts +0 -8
- package/src/rxjs/rxjs-operators.ts +0 -130
- package/src/rxjs/subjectifier.ts +0 -17
- package/src/rxjs/subscriber.directive.ts +0 -57
- package/src/specs/clickSubject.spec.ts +0 -99
- package/src/specs/dialog.spec.ts +0 -101
- package/src/specs/toggleGroupDirective.spec.ts +0 -229
- package/src/table-builder/classes/DefaultSettings.ts +0 -11
- package/src/table-builder/classes/MatTableObservableDataSource.ts +0 -23
- package/src/table-builder/classes/TableBuilderConfig.ts +0 -49
- package/src/table-builder/classes/TableBuilderDataSource.ts +0 -64
- package/src/table-builder/classes/TableState.ts +0 -96
- package/src/table-builder/classes/data-store.ts +0 -10
- package/src/table-builder/classes/display-col.ts +0 -5
- package/src/table-builder/classes/filter-info.ts +0 -129
- package/src/table-builder/classes/table-builder-general-settings.ts +0 -233
- package/src/table-builder/classes/table-builder.ts +0 -105
- package/src/table-builder/classes/table-store.helpers.ts +0 -109
- package/src/table-builder/classes/table-store.ts +0 -540
- package/src/table-builder/components/array-column.component.ts +0 -34
- package/src/table-builder/components/column-builder/column-builder.component.html +0 -109
- package/src/table-builder/components/column-builder/column-builder.component.scss +0 -43
- package/src/table-builder/components/column-builder/column-builder.component.spec.ts +0 -49
- package/src/table-builder/components/column-builder/column-builder.component.ts +0 -130
- package/src/table-builder/components/column-builder/column-helpers.ts +0 -54
- package/src/table-builder/components/column-header-menu/column-header-menu.component.html +0 -128
- package/src/table-builder/components/column-header-menu/column-header-menu.component.scss +0 -97
- package/src/table-builder/components/column-header-menu/column-header-menu.component.ts +0 -113
- package/src/table-builder/components/date-filter/date-filter.component.html +0 -39
- package/src/table-builder/components/date-filter/date-filter.component.ts +0 -33
- package/src/table-builder/components/date-time-filter/date-time-filter.component.html +0 -25
- package/src/table-builder/components/date-time-filter/date-time-filter.component.ts +0 -33
- package/src/table-builder/components/filter/filter.component.html +0 -120
- package/src/table-builder/components/filter/filter.component.scss +0 -60
- package/src/table-builder/components/filter/filter.component.spec.ts +0 -86
- package/src/table-builder/components/filter/filter.component.ts +0 -73
- package/src/table-builder/components/filter/in-list/in-list-filter.component.ts +0 -171
- package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.html +0 -60
- package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.scss +0 -57
- package/src/table-builder/components/gen-col-displayer/gen-col-displayer.component.ts +0 -44
- package/src/table-builder/components/generic-table/generic-table.component.html +0 -140
- package/src/table-builder/components/generic-table/generic-table.component.scss +0 -45
- package/src/table-builder/components/generic-table/generic-table.component.ts +0 -531
- package/src/table-builder/components/generic-table/paginator.component.ts +0 -125
- package/src/table-builder/components/group-by-list/group-by-list.component.css +0 -24
- package/src/table-builder/components/group-by-list/group-by-list.component.html +0 -21
- package/src/table-builder/components/group-by-list/group-by-list.component.spec.ts +0 -23
- package/src/table-builder/components/group-by-list/group-by-list.component.ts +0 -26
- package/src/table-builder/components/in-filter/in-filter.component.css +0 -22
- package/src/table-builder/components/in-filter/in-filter.component.html +0 -38
- package/src/table-builder/components/in-filter/in-filter.component.ts +0 -66
- package/src/table-builder/components/index.ts +0 -9
- package/src/table-builder/components/initialization-component/initialization.component.html +0 -78
- package/src/table-builder/components/initialization-component/initialization.component.ts +0 -28
- package/src/table-builder/components/link-column.component.ts +0 -42
- package/src/table-builder/components/number-filter/number-filter.component.css +0 -10
- package/src/table-builder/components/number-filter/number-filter.component.html +0 -32
- package/src/table-builder/components/number-filter/number-filter.component.spec.ts +0 -30
- package/src/table-builder/components/number-filter/number-filter.component.ts +0 -34
- package/src/table-builder/components/profiles-menu/profiles-menu.component.html +0 -77
- package/src/table-builder/components/profiles-menu/profiles-menu.component.scss +0 -126
- package/src/table-builder/components/profiles-menu/profiles-menu.component.spec.ts +0 -23
- package/src/table-builder/components/profiles-menu/profiles-menu.component.ts +0 -64
- package/src/table-builder/components/reset-menu/reset-menu.component.css +0 -3
- package/src/table-builder/components/reset-menu/reset-menu.component.html +0 -10
- package/src/table-builder/components/reset-menu/reset-menu.component.ts +0 -87
- package/src/table-builder/components/scroll-strategy.ts +0 -139
- package/src/table-builder/components/sort-menu/sort-menu.component-store.ts +0 -57
- package/src/table-builder/components/sort-menu/sort-menu.component.html +0 -115
- package/src/table-builder/components/sort-menu/sort-menu.component.scss +0 -119
- package/src/table-builder/components/sort-menu/sort-menu.component.ts +0 -88
- package/src/table-builder/components/table-container/table-container.component.html +0 -94
- package/src/table-builder/components/table-container/table-container.component.scss +0 -60
- package/src/table-builder/components/table-container/table-container.component.ts +0 -467
- package/src/table-builder/components/table-container/table-container.helpers/data-state.helpers.ts +0 -113
- package/src/table-builder/components/table-container/table-container.helpers/filter-state.helpers.ts +0 -125
- package/src/table-builder/components/table-container/table-container.helpers/groupBy.helpers.ts +0 -172
- package/src/table-builder/components/table-container/table-container.helpers/meta-data.helpers.ts +0 -19
- package/src/table-builder/components/table-container/table-container.helpers/sort-state.helpers.ts +0 -47
- package/src/table-builder/components/table-container/tableProps.ts +0 -21
- package/src/table-builder/components/table-container/virtual-scroll-container.ts +0 -216
- package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.html +0 -42
- package/src/table-builder/components/table-container-filter/filter-list/filter-list.component.ts +0 -47
- package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.css +0 -40
- package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.html +0 -11
- package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.spec.ts +0 -85
- package/src/table-builder/components/table-container-filter/gen-filter-displayer/gen-filter-displayer.component.ts +0 -35
- package/src/table-builder/components/table-container-filter/table-wrapper-filter-store.ts +0 -13
- package/src/table-builder/components/table-header-menu/table-header-menu.component.css +0 -21
- package/src/table-builder/components/table-header-menu/table-header-menu.component.html +0 -48
- package/src/table-builder/components/table-header-menu/table-header-menu.component.ts +0 -36
- package/src/table-builder/directives/custom-cell-directive.ts +0 -63
- package/src/table-builder/directives/custom-header-directive.ts +0 -16
- package/src/table-builder/directives/group-row-directive.ts +0 -91
- package/src/table-builder/directives/index.ts +0 -8
- package/src/table-builder/directives/multi-sort.directive.spec.ts +0 -124
- package/src/table-builder/directives/multi-sort.directive.ts +0 -58
- package/src/table-builder/directives/resize-column.directive.ts +0 -107
- package/src/table-builder/directives/table-wrapper.directive.ts +0 -13
- package/src/table-builder/directives/tb-filter.directive.ts +0 -376
- package/src/table-builder/documentation/table-builder/CUSTOM-CELL.md +0 -568
- package/src/table-builder/documentation/table-builder/CUSTOM-GROUP-ROW.md +0 -356
- package/src/table-builder/documentation/table-builder/METADATA-DOCUMENTATION.md +0 -517
- package/src/table-builder/documentation/table-builder/STYLER-STYLE.md +0 -228
- package/src/table-builder/documentation/table-builder/TABLE-BUILDER-CONFIG.md +0 -325
- package/src/table-builder/documentation/table-builder/TABLE-BUILDER-SETTINGS.md +0 -515
- package/src/table-builder/documentation/table-builder/TABLE-BUILDER.md +0 -430
- package/src/table-builder/documentation/table-builder/TABLE-CONTAINER.md +0 -628
- package/src/table-builder/enums/filterTypes.ts +0 -39
- package/src/table-builder/functions/boolean-filter-function.ts +0 -12
- package/src/table-builder/functions/date-filter-function.ts +0 -85
- package/src/table-builder/functions/download-data.ts +0 -11
- package/src/table-builder/functions/null-filter-function.ts +0 -9
- package/src/table-builder/functions/number-filter-function.ts +0 -47
- package/src/table-builder/functions/sort-data-function.ts +0 -80
- package/src/table-builder/functions/string-filter-function.ts +0 -59
- package/src/table-builder/interfaces/ColumnInfo.ts +0 -9
- package/src/table-builder/interfaces/dictionary.ts +0 -3
- package/src/table-builder/interfaces/meta-data.ts +0 -279
- package/src/table-builder/ngrx/tableBuilderStateStore.ts +0 -203
- package/src/table-builder/pipes/column-total.pipe.ts +0 -16
- package/src/table-builder/pipes/format-filter-type.pipe.ts +0 -12
- package/src/table-builder/pipes/format-filter-value.pipe.ts +0 -71
- package/src/table-builder/pipes/key-display.ts +0 -13
- package/src/table-builder/services/all-values-filter-creator.service.ts +0 -92
- package/src/table-builder/services/export-to-csv.service.ts +0 -117
- package/src/table-builder/services/link-creator.service.ts +0 -98
- package/src/table-builder/services/table-template-service.ts +0 -47
- package/src/table-builder/services/transform-creator.ts +0 -90
- package/src/table-builder/specs/table-custom-filters.spec.ts +0 -262
- package/src/table-builder/styles/collapser.styles.scss +0 -16
- package/src/table-builder/table-builder.module.ts +0 -42
- package/src/table-builder/types/group-types.ts +0 -42
- package/src/table-builder/types/index.ts +0 -1
- package/src/test.ts +0 -17
- package/src/utilities/array-helpers.ts +0 -13
- package/src/utilities/directives/auto-focus.directive.ts +0 -20
- package/src/utilities/directives/clickEmitterDirective.ts +0 -15
- package/src/utilities/directives/clickSubject.ts +0 -19
- package/src/utilities/directives/conditional-classes.directive.ts +0 -36
- package/src/utilities/directives/dialog-service.ts +0 -19
- package/src/utilities/directives/dialog.ts +0 -174
- package/src/utilities/directives/mat-toggle-group-directive.ts +0 -60
- package/src/utilities/directives/prevent-enter.directive.ts +0 -12
- package/src/utilities/directives/stop-propagation.directive.ts +0 -19
- package/src/utilities/directives/styler.ts +0 -45
- package/src/utilities/directives/trim-whitespace.directive.ts +0 -20
- package/src/utilities/index.ts +0 -22
- package/src/utilities/module.ts +0 -53
- package/src/utilities/pipes/function.pipe.ts +0 -21
- package/src/utilities/pipes/phone.pipe.ts +0 -20
- package/src/utilities/pipes/space-case.pipes.spec.ts +0 -47
- package/src/utilities/pipes/space-case.pipes.ts +0 -29
- package/tsconfig.lib.json +0 -20
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { Directive, TemplateRef, Input, Component, Output, EventEmitter, ViewContainerRef, Injector, ChangeDetectionStrategy, inject, untracked, Signal, isSignal, input } from '@angular/core';
|
|
2
|
-
import { MatDialog, MatDialogRef, MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, DialogPosition } from '@angular/material/dialog';
|
|
3
|
-
import { Observable, Subject } from 'rxjs';
|
|
4
|
-
import { DialogService } from './dialog-service';
|
|
5
|
-
import { subscriber } from '../../rxjs';
|
|
6
|
-
import { toObservable } from '@angular/core/rxjs-interop';
|
|
7
|
-
|
|
8
|
-
interface DialogViewContext<T> {
|
|
9
|
-
$implicit: T,
|
|
10
|
-
opDialog: T,
|
|
11
|
-
close: () => void,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@Component({
|
|
15
|
-
selector: 'dialog-wrapper',
|
|
16
|
-
template: ``,
|
|
17
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
18
|
-
})
|
|
19
|
-
export class DialogWrapper<T = any> {
|
|
20
|
-
private vcr = inject(ViewContainerRef);
|
|
21
|
-
|
|
22
|
-
viewEmbedded = false;
|
|
23
|
-
viewContext = {
|
|
24
|
-
close: () => {},
|
|
25
|
-
} as DialogViewContext<T>;
|
|
26
|
-
set template(tmpl: TemplateRef<DialogViewContext<T>>) {
|
|
27
|
-
if(this.viewEmbedded) {
|
|
28
|
-
this.vcr.clear();
|
|
29
|
-
}
|
|
30
|
-
this.viewEmbedded = true;
|
|
31
|
-
this.vcr.createEmbeddedView(tmpl, this.viewContext);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
set close(closeMethod: () => void ) {
|
|
35
|
-
this.viewContext.close = closeMethod;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
set data(value: T) {
|
|
39
|
-
this.viewContext.$implicit = value;
|
|
40
|
-
this.viewContext.opDialog = value;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const defaultDialogConfig: MatDialogConfig = {
|
|
47
|
-
maxHeight: '95vh',
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
@Directive(
|
|
52
|
-
{ selector: '[opDialog]', }
|
|
53
|
-
) export class DialogDirective<T> {
|
|
54
|
-
private templateRef = inject<TemplateRef<DialogViewContext<T>>>(TemplateRef);
|
|
55
|
-
private dialog = inject(MatDialog);
|
|
56
|
-
private dialogConfig = inject(MAT_DIALOG_DEFAULT_OPTIONS, { optional: true }) || {};
|
|
57
|
-
private service = inject(DialogService);
|
|
58
|
-
|
|
59
|
-
@Output() opDialogClosed: EventEmitter<boolean> = new EventEmitter();
|
|
60
|
-
_dialogConfig: MatDialogConfig<T> = { ...this.dialogConfig, ...defaultDialogConfig };
|
|
61
|
-
@Input() opDialogAddDialogClass = true;
|
|
62
|
-
@Input() set opDialogConfig(config: MatDialogConfig<T>) {
|
|
63
|
-
|
|
64
|
-
this._dialogConfig = { ...this.dialogConfig, ...defaultDialogConfig, ...config };
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
get opDialogConfig() : MatDialogConfig<T> {
|
|
68
|
-
return this._dialogConfig;
|
|
69
|
-
}
|
|
70
|
-
injector = inject(Injector);
|
|
71
|
-
subscriber = subscriber(this.injector);
|
|
72
|
-
@Input('opDialog') set setControl(i: Observable<T> | Signal<T>){
|
|
73
|
-
let o: Observable<T>;
|
|
74
|
-
if(isSignal(i)){
|
|
75
|
-
o = toObservable<T>(i, { injector: this.injector })
|
|
76
|
-
} else {
|
|
77
|
-
o = i;
|
|
78
|
-
}
|
|
79
|
-
untracked(() => {
|
|
80
|
-
this.subscriber.on(o, this.setDataAndState);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
@Input('opDialogOrigin') nativeElement? : HTMLElement;
|
|
85
|
-
/**
|
|
86
|
-
* For use with origin element to keep dialog on screen.
|
|
87
|
-
* If true, will position based on width and height provided IF it was provide as a number.
|
|
88
|
-
* If no width provided or/and height, provide a default in number (of pixels) of the not provided values.
|
|
89
|
-
* If no width/height provided at all, will default to 600x400.
|
|
90
|
-
*/
|
|
91
|
-
$positionOnScreen = input<boolean | { height?: number, width?: number }>(false, { alias: 'opDialogPositionOnScreen' });
|
|
92
|
-
dialogRef?: MatDialogRef<any, boolean>;
|
|
93
|
-
componentWrapper?: DialogWrapper<T>;
|
|
94
|
-
|
|
95
|
-
_data = new Subject<Observable<T>>();
|
|
96
|
-
|
|
97
|
-
close() {
|
|
98
|
-
this.dialogRef?.close();
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
initDialog() {
|
|
102
|
-
if(this.nativeElement){
|
|
103
|
-
const rect = this.nativeElement.getBoundingClientRect();
|
|
104
|
-
const position = { } as DialogPosition;
|
|
105
|
-
if(this.$positionOnScreen()) {
|
|
106
|
-
const viewportWidth = window.innerWidth;
|
|
107
|
-
const viewportHeight = window.innerHeight;
|
|
108
|
-
const p = this.$positionOnScreen();
|
|
109
|
-
const width = typeof p === 'object' && p.width ? p.width : typeof this.dialogConfig.width === 'number' ? this.dialogConfig.width : 600;
|
|
110
|
-
const height = typeof p === 'object' && p.height ? p.height : typeof this.dialogConfig.height === 'number' ? this.dialogConfig.height : 400;
|
|
111
|
-
|
|
112
|
-
// Check horizontal positioning
|
|
113
|
-
if(rect.left + width > viewportWidth) {
|
|
114
|
-
position.right = `${viewportWidth - rect.right}px`;
|
|
115
|
-
} else {
|
|
116
|
-
position.left = `${rect.left}px`;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Check vertical positioning
|
|
120
|
-
if(rect.bottom + height > viewportHeight) {
|
|
121
|
-
position.bottom = `${viewportHeight - rect.top}px`;
|
|
122
|
-
} else {
|
|
123
|
-
position.top = `${rect.bottom - 20}px`;
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
position.top = `${rect.bottom}px`;
|
|
127
|
-
position.left = `${rect.left}px`;
|
|
128
|
-
}
|
|
129
|
-
this.opDialogConfig = { ...this.opDialogConfig, position };
|
|
130
|
-
}
|
|
131
|
-
if(this.opDialogAddDialogClass) {
|
|
132
|
-
this.opDialogConfig.panelClass = [...(Array.isArray(this.opDialogConfig.panelClass) ? this.opDialogConfig.panelClass : this.opDialogConfig.panelClass ? [this.opDialogConfig.panelClass] : []), 'opDialog'];
|
|
133
|
-
}
|
|
134
|
-
this.dialogRef = this.dialog.open(DialogWrapper, this.opDialogConfig);
|
|
135
|
-
this.componentWrapper = this.dialogRef.componentInstance;
|
|
136
|
-
this.componentWrapper!.close = () => this.dialogRef?.close();
|
|
137
|
-
this.componentWrapper!.data = this.opDialogConfig.data as T;
|
|
138
|
-
this.componentWrapper!.template = this.templateRef;
|
|
139
|
-
if(!this.opDialogConfig.disableClose) {
|
|
140
|
-
this.service.addDialogRef(this.dialogRef);
|
|
141
|
-
}
|
|
142
|
-
const sub = this.dialogRef.afterClosed().subscribe(() => {
|
|
143
|
-
this.opDialogClosed.emit(true);
|
|
144
|
-
this.service.removeDialogRef(this.dialogRef!);
|
|
145
|
-
this.dialogRef = undefined;
|
|
146
|
-
sub.unsubscribe();
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
setDataAndState = (data: T) => {
|
|
150
|
-
if(data){
|
|
151
|
-
this.opDialogConfig.data = data;
|
|
152
|
-
this.setDialogState(true);
|
|
153
|
-
} else {
|
|
154
|
-
this.setDialogState(false);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
setDialogState(open: boolean) {
|
|
159
|
-
if(open) {
|
|
160
|
-
if(!this.dialogRef) {
|
|
161
|
-
this.initDialog();
|
|
162
|
-
} else {
|
|
163
|
-
this.componentWrapper!.data = this.opDialogConfig.data as T;
|
|
164
|
-
}
|
|
165
|
-
} else if(!open && this.dialogRef) {
|
|
166
|
-
this.dialogRef.close();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
static ngTemplateContextGuard<T>(dir: DialogDirective<T>, ctx: any): ctx is DialogViewContext<Exclude<T, false | 0 | '' | null | undefined>> {
|
|
171
|
-
return true;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { ContentChildren, Directive, Input, Output, QueryList } from "@angular/core";
|
|
2
|
-
import { MatSlideToggle } from "@angular/material/slide-toggle";
|
|
3
|
-
import { merge, Observable, ReplaySubject, scan, startWith, switchMap } from "rxjs";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@Directive(
|
|
7
|
-
{ selector: '[opMatSlideToggleGroup]',
|
|
8
|
-
}
|
|
9
|
-
) export class MatSlideToggleGroupDirective {
|
|
10
|
-
@Input() allowMultiple = false;
|
|
11
|
-
|
|
12
|
-
_toggles!: QueryList<MatSlideToggle>;
|
|
13
|
-
@ContentChildren(MatSlideToggle) set toggles(val: QueryList<MatSlideToggle>) {
|
|
14
|
-
this._toggles = val;
|
|
15
|
-
this._ready.next(true);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
private _ready = new ReplaySubject<boolean>(1);
|
|
19
|
-
|
|
20
|
-
@Output() get valueEmitter() : Observable<{[key:string]: boolean}> {
|
|
21
|
-
return this._ready.pipe( switchMap( _ => this.getObs()));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
getInitValue() {
|
|
26
|
-
const startValue = this._toggles.reduce( (prev, cur) => {
|
|
27
|
-
if(!cur.name) {
|
|
28
|
-
throw new Error('toggle must have the name attribute set');
|
|
29
|
-
}
|
|
30
|
-
prev[cur.name] = cur.checked
|
|
31
|
-
return prev;
|
|
32
|
-
}, {} as {[k:string]: boolean});
|
|
33
|
-
return startValue;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
getObs() {
|
|
37
|
-
var toggleChanges = merge(...this._toggles.map( toggle => toggle.change ));
|
|
38
|
-
|
|
39
|
-
const startValue = this.getInitValue();
|
|
40
|
-
|
|
41
|
-
return toggleChanges.pipe(
|
|
42
|
-
scan( (prev, cur) => {
|
|
43
|
-
const toggleName = cur.source.name!;
|
|
44
|
-
const newVal = { ...prev, [toggleName]: cur.checked };
|
|
45
|
-
if(cur.checked && !this.allowMultiple) {
|
|
46
|
-
Object.keys(prev)
|
|
47
|
-
.filter( key => key !== toggleName && prev[key])
|
|
48
|
-
.forEach( key => {
|
|
49
|
-
newVal[key] = false;
|
|
50
|
-
this._toggles.find( toggle => toggle.name === key)!.toggle();
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return newVal;
|
|
54
|
-
}, startValue),
|
|
55
|
-
startWith(startValue),
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Directive, HostListener } from "@angular/core";
|
|
2
|
-
|
|
3
|
-
@Directive({
|
|
4
|
-
selector: "[stop-propagation]",
|
|
5
|
-
})
|
|
6
|
-
export class StopPropagationDirective
|
|
7
|
-
{
|
|
8
|
-
@HostListener("click", ["$event"])
|
|
9
|
-
public onClick(event: any): void
|
|
10
|
-
{
|
|
11
|
-
event.stopPropagation();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@HostListener("mousedown", ["$event"])
|
|
15
|
-
public onMousedown(event: any): void
|
|
16
|
-
{
|
|
17
|
-
event.stopPropagation();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, Renderer2, inject, input, effect, signal, untracked } from '@angular/core';
|
|
2
|
-
import { Dictionary } from '@ngrx/entity';
|
|
3
|
-
|
|
4
|
-
@Directive({ selector: '[styler]' })
|
|
5
|
-
export class StylerDirective {
|
|
6
|
-
private el = inject(ElementRef);
|
|
7
|
-
private renderer = inject(Renderer2);
|
|
8
|
-
|
|
9
|
-
$stylesApplied = signal<Dictionary<string>>({});
|
|
10
|
-
$element = input.required<any>({ alias: 'element' });
|
|
11
|
-
$styler = input.required<StylerStyle>({ alias: 'styler' });
|
|
12
|
-
#stylerEffect = effect(() => {
|
|
13
|
-
const styles = this.$styler();
|
|
14
|
-
const element = this.$element();
|
|
15
|
-
|
|
16
|
-
untracked(() => {
|
|
17
|
-
|
|
18
|
-
const toApply = Object.entries(styles ?? {}).reduce((acc, [key, val]) => {
|
|
19
|
-
if(!val) return acc;
|
|
20
|
-
if(typeof (val) === 'string'){
|
|
21
|
-
acc[key] = val;
|
|
22
|
-
this.el.nativeElement.style[key] = val;
|
|
23
|
-
} else if(!val?.condition || val?.condition === true || val?.condition(element)){
|
|
24
|
-
const value = typeof (val.value) === 'string' ? val.value : val?.value(element);
|
|
25
|
-
acc[key] = value;
|
|
26
|
-
this.el.nativeElement.style[key] = value;
|
|
27
|
-
}
|
|
28
|
-
return acc;
|
|
29
|
-
}, {} as Dictionary<string>);
|
|
30
|
-
|
|
31
|
-
Object.keys(this.$stylesApplied()).filter(key => !Object.keys(toApply).includes(key)).forEach(key => {
|
|
32
|
-
this.renderer.removeStyle(this.el.nativeElement, key);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
this.$stylesApplied.set(toApply);
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type StylerStyle<T = any> = Dictionary<
|
|
42
|
-
string | {
|
|
43
|
-
condition?: ((t: T) => boolean) | true,
|
|
44
|
-
value: ((t: T) => string) | string
|
|
45
|
-
}>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, HostListener, inject } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Directive({
|
|
4
|
-
selector: 'input[trimWhitespace]',
|
|
5
|
-
})
|
|
6
|
-
export class TrimWhitespaceDirective {
|
|
7
|
-
private elem = inject(ElementRef);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@HostListener('blur') onBlur() {
|
|
11
|
-
const inputString = this.elem.nativeElement.value;
|
|
12
|
-
if(inputString) {
|
|
13
|
-
const newValue = inputString.trim().replace(/\t/g, '');
|
|
14
|
-
if(inputString !== newValue) {
|
|
15
|
-
this.elem.nativeElement.value = newValue;
|
|
16
|
-
this.elem.nativeElement.dispatchEvent(new Event('input', { bubbles: true }));
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
package/src/utilities/index.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export * from './directives/prevent-enter.directive';
|
|
2
|
-
export * from './directives/stop-propagation.directive';
|
|
3
|
-
export * from './directives/auto-focus.directive';
|
|
4
|
-
export * from './directives/clickSubject';
|
|
5
|
-
export * from './directives/clickEmitterDirective';
|
|
6
|
-
export * from './directives/dialog';
|
|
7
|
-
export * from './directives/styler';
|
|
8
|
-
export * from './directives/mat-toggle-group-directive';
|
|
9
|
-
export * from './directives/trim-whitespace.directive';
|
|
10
|
-
|
|
11
|
-
export * from './pipes/function.pipe';
|
|
12
|
-
export * from './pipes/phone.pipe';
|
|
13
|
-
export * from './pipes/space-case.pipes';
|
|
14
|
-
|
|
15
|
-
export * from './directives/dialog-service';
|
|
16
|
-
|
|
17
|
-
export * from './directives/conditional-classes.directive'
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export * from './module';
|
|
21
|
-
|
|
22
|
-
|
package/src/utilities/module.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { NgModule } from "@angular/core";
|
|
2
|
-
import { AutoFocusDirective } from "./directives/auto-focus.directive";
|
|
3
|
-
import { ClickEmitterDirective } from "./directives/clickEmitterDirective";
|
|
4
|
-
import { ClickSubjectDirective } from "./directives/clickSubject";
|
|
5
|
-
import { ConditionalClassesDirective } from "./directives/conditional-classes.directive";
|
|
6
|
-
import { DialogDirective } from "./directives/dialog";
|
|
7
|
-
import { DialogService } from "./directives/dialog-service";
|
|
8
|
-
import { MatSlideToggleGroupDirective } from "./directives/mat-toggle-group-directive";
|
|
9
|
-
import { PreventEnterDirective } from "./directives/prevent-enter.directive";
|
|
10
|
-
import { StopPropagationDirective } from "./directives/stop-propagation.directive";
|
|
11
|
-
import { TrimWhitespaceDirective } from "./directives/trim-whitespace.directive";
|
|
12
|
-
import { StylerDirective } from "./directives/styler";
|
|
13
|
-
import { FunctionPipe } from "./pipes/function.pipe";
|
|
14
|
-
import { PhoneNumberPipe } from "./pipes/phone.pipe";
|
|
15
|
-
import { SpaceCasePipe } from "./pipes/space-case.pipes";
|
|
16
|
-
|
|
17
|
-
@NgModule({
|
|
18
|
-
exports: [
|
|
19
|
-
StopPropagationDirective,
|
|
20
|
-
PreventEnterDirective,
|
|
21
|
-
SpaceCasePipe,
|
|
22
|
-
PhoneNumberPipe,
|
|
23
|
-
FunctionPipe,
|
|
24
|
-
TrimWhitespaceDirective,
|
|
25
|
-
StylerDirective,
|
|
26
|
-
AutoFocusDirective,
|
|
27
|
-
ClickSubjectDirective,
|
|
28
|
-
ClickEmitterDirective,
|
|
29
|
-
DialogDirective,
|
|
30
|
-
MatSlideToggleGroupDirective,
|
|
31
|
-
ConditionalClassesDirective,
|
|
32
|
-
],
|
|
33
|
-
imports: [
|
|
34
|
-
SpaceCasePipe,
|
|
35
|
-
PhoneNumberPipe,
|
|
36
|
-
FunctionPipe,
|
|
37
|
-
StopPropagationDirective,
|
|
38
|
-
StylerDirective,
|
|
39
|
-
PreventEnterDirective,
|
|
40
|
-
AutoFocusDirective,
|
|
41
|
-
TrimWhitespaceDirective,
|
|
42
|
-
ClickSubjectDirective,
|
|
43
|
-
ClickEmitterDirective,
|
|
44
|
-
DialogDirective,
|
|
45
|
-
MatSlideToggleGroupDirective,
|
|
46
|
-
ConditionalClassesDirective,
|
|
47
|
-
],
|
|
48
|
-
providers: [
|
|
49
|
-
DialogService
|
|
50
|
-
]
|
|
51
|
-
})
|
|
52
|
-
export class UtilitiesModule {
|
|
53
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
type Args<S extends object, O extends keyof S> = S[O] extends (...args: infer Params) => any ? Params : never;
|
|
4
|
-
type Return<S extends object, O extends keyof S> = S[O] extends (...args: any[]) => infer R ? R : never;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@Pipe({
|
|
8
|
-
name: 'func',
|
|
9
|
-
})
|
|
10
|
-
export class FunctionPipe implements PipeTransform {
|
|
11
|
-
transform<T, TParam extends any []>(func: (...args: TParam) => T, ...args: TParam): T;
|
|
12
|
-
transform<O extends object, S extends keyof O>(s: S, obj: O, ...args: Args<O, S>): Return<O, S>;
|
|
13
|
-
transform(func: any, ...args: any[]) {
|
|
14
|
-
if(typeof func === 'string') {
|
|
15
|
-
const [instance, ...tail] = args;
|
|
16
|
-
const method = (instance[func] as Function).bind(instance);
|
|
17
|
-
return method(...tail);
|
|
18
|
-
}
|
|
19
|
-
return func(...args);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Pipe({ name: 'phone' })
|
|
4
|
-
export class PhoneNumberPipe implements PipeTransform {
|
|
5
|
-
|
|
6
|
-
transform(phoneNum: string): any {
|
|
7
|
-
return phoneFormatter(phoneNum);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function phoneFormatter(phoneNum: string): string {
|
|
12
|
-
if(phoneNum) {
|
|
13
|
-
phoneNum = phoneNum.replace(/\D/g, '');
|
|
14
|
-
if(phoneNum[0] === '1') {
|
|
15
|
-
phoneNum = phoneNum.substring(1);
|
|
16
|
-
}
|
|
17
|
-
return '(' + phoneNum.slice(0, 3) + ') ' + phoneNum.slice(3, 6) + '-' + phoneNum.slice(6, 10) + ' ' + phoneNum.slice(10);
|
|
18
|
-
}
|
|
19
|
-
return '';
|
|
20
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { SpaceCasePipe } from './space-case.pipes';
|
|
2
|
-
|
|
3
|
-
const pipe = new SpaceCasePipe();
|
|
4
|
-
|
|
5
|
-
describe('Space Case Pipe', () => {
|
|
6
|
-
|
|
7
|
-
it('one word camel case', () => {
|
|
8
|
-
const result = pipe.transform('promissory');
|
|
9
|
-
expect(result).toEqual('Promissory');
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('one word pascal case', () => {
|
|
13
|
-
const result = pipe.transform('Promissory');
|
|
14
|
-
expect(result).toEqual('Promissory');
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('two words camel case', () => {
|
|
18
|
-
const result = pipe.transform('promissoryNote');
|
|
19
|
-
expect(result).toEqual('Promissory Note');
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('two words pascal case', () => {
|
|
23
|
-
const result = pipe.transform('PromissoryNote');
|
|
24
|
-
expect(result).toEqual('Promissory Note');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('bunch of capital letters in a row', () => {
|
|
28
|
-
const result = pipe.transform('IRALLCSingleMember');
|
|
29
|
-
expect(result).toEqual('IRALLC Single Member');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('underscores', () => {
|
|
33
|
-
const result = pipe.transform('Secured_promissory_Note_more');
|
|
34
|
-
expect(result).toEqual('Secured Promissory Note More');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('underscores', () => {
|
|
38
|
-
const result = pipe.transform('IRA_LLCSingleMember');
|
|
39
|
-
expect(result).toEqual('IRA LLC Single Member');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('blank', () => {
|
|
43
|
-
const result = pipe.transform('');
|
|
44
|
-
expect(result).toEqual('');
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { inject, InjectionToken, Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Pipe({ name: 'spaceCase' })
|
|
4
|
-
export class SpaceCasePipe implements PipeTransform {
|
|
5
|
-
spaceCase = inject(SpaceCaseMapping, { optional: true }) || spaceCase;
|
|
6
|
-
transform = (value: string): string => {
|
|
7
|
-
return this.spaceCase(value);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Adds a space before uppercase letters that either
|
|
13
|
-
* 1. follows a lowercase letter or digit
|
|
14
|
-
* 2. or precedes a lowercase letter and follows an alpha-numeric character
|
|
15
|
-
*
|
|
16
|
-
* Uppercases the first digit
|
|
17
|
-
*
|
|
18
|
-
* Turns underscores into spaces
|
|
19
|
-
*/
|
|
20
|
-
export function spaceCase(value: string){
|
|
21
|
-
const phrase = value?.replace(regex1, '$1$3 $2$4')
|
|
22
|
-
// uppercase the first character of every word
|
|
23
|
-
return phrase?.replace(regex2, x => x.toUpperCase());
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const regex1 = /([a-z0-9])([A-Z])|([a-zA-Z0-9])([A-Z])(?=[a-z])|_/g;
|
|
27
|
-
const regex2 = /(^| )(\w)/g;
|
|
28
|
-
|
|
29
|
-
export const SpaceCaseMapping = new InjectionToken<(arg: string) => string>('SpaceCaseMapping');
|
package/tsconfig.lib.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../out-tsc/lib",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"inlineSources": true,
|
|
9
|
-
"types": [],
|
|
10
|
-
"lib": [
|
|
11
|
-
"dom",
|
|
12
|
-
"ES2023",
|
|
13
|
-
"ES2024.Object"
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"exclude": [
|
|
17
|
-
"src/test.ts",
|
|
18
|
-
"**/*.spec.ts"
|
|
19
|
-
]
|
|
20
|
-
}
|
package/tsconfig.lib.prod.json
DELETED
package/tsconfig.spec.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../out-tsc/spec",
|
|
6
|
-
"types": [
|
|
7
|
-
"jasmine"
|
|
8
|
-
]
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"src/test.ts"
|
|
12
|
-
],
|
|
13
|
-
"include": [
|
|
14
|
-
"**/*.spec.ts",
|
|
15
|
-
"**/*.d.ts"
|
|
16
|
-
]
|
|
17
|
-
}
|