imng-kendo-data-entry 4.200.4 → 5.224.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/esm2020/lib/base-data-entry.component.mjs +23 -15
- package/esm2020/lib/data-entry-dialog.component.mjs +15 -14
- package/esm2020/lib/dialog-buttons.directive.mjs +3 -3
- package/esm2020/lib/form-group-patcher.mjs +2 -2
- package/esm2020/lib/imng-kendo-data-entry.module.mjs +4 -4
- package/esm2020/lib/reducer-collection-logic.mjs +13 -7
- package/esm2020/testing/mock-data-entry-dialog.component.mjs +5 -1
- package/fesm2015/imng-kendo-data-entry-testing.mjs +4 -0
- package/fesm2015/imng-kendo-data-entry-testing.mjs.map +1 -1
- package/fesm2015/imng-kendo-data-entry.mjs +56 -42
- package/fesm2015/imng-kendo-data-entry.mjs.map +1 -1
- package/fesm2020/imng-kendo-data-entry-testing.mjs +4 -0
- package/fesm2020/imng-kendo-data-entry-testing.mjs.map +1 -1
- package/fesm2020/imng-kendo-data-entry.mjs +56 -41
- package/fesm2020/imng-kendo-data-entry.mjs.map +1 -1
- package/lib/base-data-entry.component.d.ts +13 -7
- package/lib/data-entry-dialog.component.d.ts +2 -2
- package/lib/form-group-patcher.d.ts +2 -2
- package/package.json +1 -1
- package/testing/mock-data-entry-dialog.component.d.ts +4 -0
|
@@ -3,7 +3,6 @@ import { InjectionToken, Directive, Inject, Input, TemplateRef, Component, Chang
|
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import { BehaviorSubject } from 'rxjs';
|
|
6
|
-
import { UntypedFormGroup } from '@angular/forms';
|
|
7
6
|
import { Subscriptions } from 'imng-ngrx-utils';
|
|
8
7
|
import * as i2 from '@progress/kendo-angular-dialog';
|
|
9
8
|
import { DialogModule } from '@progress/kendo-angular-dialog';
|
|
@@ -32,7 +31,6 @@ class BaseDataEntryComponent {
|
|
|
32
31
|
this.ENUM_DISPLAY_TEXT = 'displayText';
|
|
33
32
|
this.ENUM_NAME = 'name';
|
|
34
33
|
this.allSubscriptions = new Subscriptions();
|
|
35
|
-
this.addEditForm = new UntypedFormGroup({});
|
|
36
34
|
this._submitted$ = new BehaviorSubject(false);
|
|
37
35
|
this.loading$ = this.facade.loading$;
|
|
38
36
|
this.initForm();
|
|
@@ -57,38 +55,48 @@ class BaseDataEntryComponent {
|
|
|
57
55
|
if (!this.addEditForm.valid) {
|
|
58
56
|
console.error('form validation errors.'); //NOSONAR
|
|
59
57
|
console.error(JSON.stringify(this.getFormErrors())); //NOSONAR
|
|
60
|
-
return;
|
|
58
|
+
return false;
|
|
61
59
|
}
|
|
62
60
|
this.save();
|
|
63
61
|
this.closeForm();
|
|
62
|
+
return true;
|
|
64
63
|
}
|
|
65
64
|
isDataInvalid() {
|
|
66
65
|
return this.addEditForm.invalid;
|
|
67
66
|
}
|
|
68
67
|
// convenience getter for easy access to form fields
|
|
69
|
-
formControl(controlName) {
|
|
70
|
-
return
|
|
68
|
+
formControl(controlName, controls = this.addEditForm.controls) {
|
|
69
|
+
return controls[controlName];
|
|
71
70
|
}
|
|
72
|
-
formControlErrors(
|
|
73
|
-
|
|
71
|
+
formControlErrors(control, controls = this.addEditForm.controls) {
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
+
const tempControl = typeof control === 'string' ? controls[control] : control;
|
|
74
|
+
if (tempControl?.valid && !tempControl?.errors) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return tempControl?.errors;
|
|
74
78
|
}
|
|
75
79
|
formMinLengthError(controlName) {
|
|
76
80
|
return this.formControlErrors(controlName)?.[this.MinLengthError];
|
|
77
81
|
}
|
|
78
|
-
getFormErrors() {
|
|
82
|
+
getFormErrors(controls = this.addEditForm.controls, parentControlName) {
|
|
79
83
|
const errors = [];
|
|
80
|
-
for (const
|
|
81
|
-
const
|
|
84
|
+
for (const controlName of Object.keys(controls)) {
|
|
85
|
+
const control = controls[controlName];
|
|
86
|
+
const error = this.formControlErrors(control, controls);
|
|
82
87
|
if (error) {
|
|
83
|
-
errors.push({
|
|
88
|
+
errors.push({ controlName: parentControlName ? `${parentControlName}.${controlName}` : controlName, error });
|
|
89
|
+
}
|
|
90
|
+
if (control?.controls) {
|
|
91
|
+
errors.push(...this.getFormErrors(control.controls, parentControlName ? `${parentControlName}.${controlName}` : controlName));
|
|
84
92
|
}
|
|
85
93
|
}
|
|
86
94
|
return errors;
|
|
87
95
|
}
|
|
88
96
|
}
|
|
89
|
-
BaseDataEntryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
90
|
-
BaseDataEntryComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.
|
|
91
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
97
|
+
BaseDataEntryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: BaseDataEntryComponent, deps: [{ token: FACADE }], target: i0.ɵɵFactoryTarget.Directive });
|
|
98
|
+
BaseDataEntryComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", type: BaseDataEntryComponent, inputs: { width: "width", height: "height" }, ngImport: i0 });
|
|
99
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: BaseDataEntryComponent, decorators: [{
|
|
92
100
|
type: Directive
|
|
93
101
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
94
102
|
type: Inject,
|
|
@@ -104,9 +112,9 @@ class DialogButtonsDirective {
|
|
|
104
112
|
this.tpl = tpl;
|
|
105
113
|
}
|
|
106
114
|
}
|
|
107
|
-
DialogButtonsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
108
|
-
DialogButtonsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.
|
|
109
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
115
|
+
DialogButtonsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DialogButtonsDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
116
|
+
DialogButtonsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", type: DialogButtonsDirective, selector: "[imngDialogBtns]", ngImport: i0 });
|
|
117
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DialogButtonsDirective, decorators: [{
|
|
110
118
|
type: Directive,
|
|
111
119
|
args: [{ selector: '[imngDialogBtns]' }]
|
|
112
120
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
@@ -136,19 +144,19 @@ class DataEntryDialogComponent {
|
|
|
136
144
|
this.parentComponent?.onSubmit();
|
|
137
145
|
}
|
|
138
146
|
get dialogActionBtnsCtx() {
|
|
147
|
+
//NOSONAR
|
|
139
148
|
return {
|
|
140
149
|
$implicit: { cancel: () => this.cancel(), submit: () => this.submit() },
|
|
141
150
|
};
|
|
142
151
|
}
|
|
143
152
|
}
|
|
144
|
-
DataEntryDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
145
|
-
DataEntryDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.
|
|
153
|
+
DataEntryDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DataEntryDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
154
|
+
DataEntryDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: DataEntryDialogComponent, selector: "imng-data-entry-dialog[parentComponent]", inputs: { minWidth: "minWidth", width: "width", height: "height", autoFocusedElement: "autoFocusedElement", parentComponent: "parentComponent", saveButtonText: "saveButtonText" }, queries: [{ propertyName: "dialogBtnsTemplate", first: true, predicate: DialogButtonsDirective, descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: `<kendo-dialog
|
|
146
155
|
[width]="width"
|
|
147
156
|
[minWidth]="minWidth ?? width"
|
|
148
157
|
[height]="height"
|
|
149
158
|
(close)="close()"
|
|
150
|
-
[autoFocusedElement]="autoFocusedElement || ''"
|
|
151
|
-
>
|
|
159
|
+
[autoFocusedElement]="autoFocusedElement || ''">
|
|
152
160
|
<kendo-dialog-titlebar class="bg-primary">{{
|
|
153
161
|
dialogTitle
|
|
154
162
|
}}</kendo-dialog-titlebar>
|
|
@@ -158,19 +166,20 @@ DataEntryDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0
|
|
|
158
166
|
*ngTemplateOutlet="
|
|
159
167
|
dialogBtnsTemplate || defaultDialogActionsTpl;
|
|
160
168
|
context: dialogActionBtnsCtx
|
|
161
|
-
"
|
|
162
|
-
>
|
|
169
|
+
">
|
|
163
170
|
</ng-container>
|
|
164
171
|
</kendo-dialog-actions>
|
|
165
172
|
</kendo-dialog>
|
|
166
173
|
|
|
167
174
|
<ng-template #defaultDialogActionsTpl>
|
|
168
|
-
<button kendoButton (click)="cancel()" class="btn btn-secondary btn-sm">
|
|
175
|
+
<button kendoButton (click)="cancel()" class="btn btn-secondary btn-sm">
|
|
176
|
+
Cancel
|
|
177
|
+
</button>
|
|
169
178
|
<button kendoButton (click)="submit()" class="btn btn-primary btn-sm">
|
|
170
179
|
{{ saveButtonText }}
|
|
171
180
|
</button>
|
|
172
181
|
</ng-template>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.DialogComponent, selector: "kendo-dialog", inputs: ["actions", "actionsLayout", "autoFocusedElement", "title", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "animation"], outputs: ["action", "close"], exportAs: ["kendoDialog"] }, { kind: "component", type: i2.DialogTitleBarComponent, selector: "kendo-dialog-titlebar", inputs: ["id", "closeTitle"], outputs: ["close"] }, { kind: "component", type: i2.DialogActionsComponent, selector: "kendo-dialog-actions", inputs: ["actions", "layout"], outputs: ["action"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
173
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DataEntryDialogComponent, decorators: [{
|
|
174
183
|
type: Component,
|
|
175
184
|
args: [{
|
|
176
185
|
selector: 'imng-data-entry-dialog[parentComponent]',
|
|
@@ -179,8 +188,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
|
|
|
179
188
|
[minWidth]="minWidth ?? width"
|
|
180
189
|
[height]="height"
|
|
181
190
|
(close)="close()"
|
|
182
|
-
[autoFocusedElement]="autoFocusedElement || ''"
|
|
183
|
-
>
|
|
191
|
+
[autoFocusedElement]="autoFocusedElement || ''">
|
|
184
192
|
<kendo-dialog-titlebar class="bg-primary">{{
|
|
185
193
|
dialogTitle
|
|
186
194
|
}}</kendo-dialog-titlebar>
|
|
@@ -190,14 +198,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
|
|
|
190
198
|
*ngTemplateOutlet="
|
|
191
199
|
dialogBtnsTemplate || defaultDialogActionsTpl;
|
|
192
200
|
context: dialogActionBtnsCtx
|
|
193
|
-
"
|
|
194
|
-
>
|
|
201
|
+
">
|
|
195
202
|
</ng-container>
|
|
196
203
|
</kendo-dialog-actions>
|
|
197
204
|
</kendo-dialog>
|
|
198
205
|
|
|
199
206
|
<ng-template #defaultDialogActionsTpl>
|
|
200
|
-
<button kendoButton (click)="cancel()" class="btn btn-secondary btn-sm">
|
|
207
|
+
<button kendoButton (click)="cancel()" class="btn btn-secondary btn-sm">
|
|
208
|
+
Cancel
|
|
209
|
+
</button>
|
|
201
210
|
<button kendoButton (click)="submit()" class="btn btn-primary btn-sm">
|
|
202
211
|
{{ saveButtonText }}
|
|
203
212
|
</button>
|
|
@@ -223,10 +232,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
|
|
|
223
232
|
|
|
224
233
|
class ImngDataEntryDialogModule {
|
|
225
234
|
}
|
|
226
|
-
ImngDataEntryDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.
|
|
227
|
-
ImngDataEntryDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
|
|
228
|
-
ImngDataEntryDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.
|
|
229
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.
|
|
235
|
+
ImngDataEntryDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ImngDataEntryDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
236
|
+
ImngDataEntryDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: ImngDataEntryDialogModule, declarations: [DataEntryDialogComponent, DialogButtonsDirective], imports: [CommonModule, DialogModule], exports: [DataEntryDialogComponent, DialogButtonsDirective] });
|
|
237
|
+
ImngDataEntryDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ImngDataEntryDialogModule, imports: [CommonModule, DialogModule] });
|
|
238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ImngDataEntryDialogModule, decorators: [{
|
|
230
239
|
type: NgModule,
|
|
231
240
|
args: [{
|
|
232
241
|
imports: [CommonModule, DialogModule],
|
|
@@ -236,16 +245,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
|
|
|
236
245
|
}] });
|
|
237
246
|
|
|
238
247
|
function updateStateCollectionItem(collection, item) {
|
|
239
|
-
const items = [...collection];
|
|
240
248
|
const index = collection.findIndex((val) => val.id === item.id);
|
|
241
|
-
|
|
242
|
-
|
|
249
|
+
if (index > -1) {
|
|
250
|
+
const items = [...collection];
|
|
251
|
+
items.splice(index, 1, item);
|
|
252
|
+
return items;
|
|
253
|
+
}
|
|
254
|
+
return collection;
|
|
243
255
|
}
|
|
244
256
|
function removeStateCollectionItem(collection, item) {
|
|
245
|
-
const items = [...collection];
|
|
246
257
|
const index = collection.findIndex((val) => val.id === item.id);
|
|
247
|
-
|
|
248
|
-
|
|
258
|
+
if (index > -1) {
|
|
259
|
+
const items = [...collection];
|
|
260
|
+
items.splice(index, 1);
|
|
261
|
+
return items;
|
|
262
|
+
}
|
|
263
|
+
return collection;
|
|
249
264
|
}
|
|
250
265
|
function addStateCollectionItem(collection, item) {
|
|
251
266
|
const items = [...collection];
|
|
@@ -253,7 +268,7 @@ function addStateCollectionItem(collection, item) {
|
|
|
253
268
|
return items;
|
|
254
269
|
}
|
|
255
270
|
|
|
256
|
-
const formGroupPatcher = (addEditForm) => (source) => source.pipe(filter(t => !!t), take(1), tap(t => addEditForm.patchValue(t)));
|
|
271
|
+
const formGroupPatcher = (addEditForm) => (source) => source.pipe(filter((t) => !!t), take(1), tap((t) => addEditForm.patchValue(t)));
|
|
257
272
|
|
|
258
273
|
/**
|
|
259
274
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imng-kendo-data-entry.mjs","sources":["../../../../libs/imng-kendo-data-entry/src/lib/base-data-entry.component.ts","../../../../libs/imng-kendo-data-entry/src/lib/dialog-buttons.directive.ts","../../../../libs/imng-kendo-data-entry/src/lib/data-entry-dialog.component.ts","../../../../libs/imng-kendo-data-entry/src/lib/imng-kendo-data-entry.module.ts","../../../../libs/imng-kendo-data-entry/src/lib/reducer-collection-logic.ts","../../../../libs/imng-kendo-data-entry/src/lib/form-group-patcher.ts","../../../../libs/imng-kendo-data-entry/src/imng-kendo-data-entry.ts"],"sourcesContent":["import {\n Directive,\n Inject,\n InjectionToken,\n Input,\n OnDestroy,\n} from '@angular/core';\nimport { Observable, BehaviorSubject } from 'rxjs';\nimport { UntypedFormGroup, AbstractControl, ValidationErrors } from '@angular/forms';\nimport { IBaseDataEntryFacade } from './data-entry-facade';\nimport { Subscribable, Subscriptions } from 'imng-ngrx-utils';\n\nconst FACADE = new InjectionToken<IBaseDataEntryFacade>(\n 'imng-data-entry-facade',\n);\n\n/**\n * The extending class has to implement the following properties on ngInit\n * dialogTitle: string - This will be the text displayed at the top of the modal title bar\n * props: enum - This is a helper property to make the html markup type safe\n *\n * Along with the requirements above, the extending class has to set values to the\n * following properties on ngInit\n * active$: Observable<boolean> - This typically would be assigned to the isNewActive$ or isEditActive on the facade\n * addEditForm: FormGroup - This will be created by your component\n *\n * @class BaseDataEntryComponent>\n */\n@Directive()\nexport abstract class BaseDataEntryComponent<\n FACADE extends IBaseDataEntryFacade,\n> implements OnDestroy, Subscribable\n{\n @Input() public width: string | number = 800; //NOSONAR\n @Input() public height: string | number = 600; //NOSONAR\n public readonly MinLengthError = 'minlength';\n public readonly RequiredError = 'required';\n public readonly ENUM_DISPLAY_TEXT = 'displayText';\n public readonly ENUM_NAME = 'name';\n public allSubscriptions = new Subscriptions();\n public abstract dialogTitle: string;\n public abstract props: unknown;\n public addEditForm: UntypedFormGroup = new UntypedFormGroup({});\n public loading$: Observable<boolean>;\n private readonly _submitted$: BehaviorSubject<boolean> = new BehaviorSubject(\n false as boolean,\n );\n\n public get submitted$(): Observable<boolean> {\n return this._submitted$.asObservable();\n }\n constructor(@Inject(FACADE) public readonly facade: FACADE) {\n this.loading$ = this.facade.loading$;\n this.initForm();\n }\n\n public ngOnDestroy(): void {\n this.allSubscriptions.unsubscribeAll();\n }\n\n public closeForm(): void {\n this.initForm();\n this.facade.clearCurrentEntity();\n this._submitted$.next(false);\n }\n\n public onCancel(): void {\n this.closeForm();\n }\n\n public onSubmit(): void {\n this._submitted$.next(true);\n\n // stop here if form is invalid\n if (!this.addEditForm.valid) {\n console.error('form validation errors.'); //NOSONAR\n console.error(JSON.stringify(this.getFormErrors())); //NOSONAR\n return;\n }\n this.save();\n this.closeForm();\n }\n\n public isDataInvalid(): boolean {\n return this.addEditForm.invalid;\n }\n\n // convenience getter for easy access to form fields\n public formControl(controlName: string): AbstractControl {\n return this.addEditForm.controls[controlName];\n }\n public formControlErrors(controlName: string): ValidationErrors | null {\n return this.formControl(controlName)?.errors;\n }\n public formMinLengthError(\n controlName: string,\n ): { requiredLength: number; actualLength: number } | null {\n return this.formControlErrors(controlName)?.[this.MinLengthError];\n }\n public getFormErrors(): { control: string; error: ValidationErrors }[] {\n const errors: { control: string; error: ValidationErrors }[] = [];\n for (const control of Object.keys(this.addEditForm.controls)) {\n const error = this.formControlErrors(control);\n if (error) {\n errors.push({ control, error });\n }\n }\n return errors;\n }\n\n public abstract initForm(): void;\n public abstract save(): void;\n}\n","import { Directive, TemplateRef } from '@angular/core';\n\n@Directive({ selector: '[imngDialogBtns]' })\nexport class DialogButtonsDirective {\n constructor(public tpl: TemplateRef<unknown>) { }\n}\n","import {\n Component,\n OnInit,\n Input,\n ChangeDetectionStrategy,\n TemplateRef,\n ContentChild,\n} from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { UntypedFormGroup } from '@angular/forms';\nimport { BaseDataEntryComponent } from './base-data-entry.component';\nimport { DialogButtonsDirective } from './dialog-buttons.directive';\n\n@Component({\n selector: 'imng-data-entry-dialog[parentComponent]',\n template: `<kendo-dialog\n [width]=\"width\"\n [minWidth]=\"minWidth ?? width\"\n [height]=\"height\"\n (close)=\"close()\"\n [autoFocusedElement]=\"autoFocusedElement || ''\"\n >\n <kendo-dialog-titlebar class=\"bg-primary\">{{\n dialogTitle\n }}</kendo-dialog-titlebar>\n <ng-content></ng-content>\n <kendo-dialog-actions>\n <ng-container\n *ngTemplateOutlet=\"\n dialogBtnsTemplate || defaultDialogActionsTpl;\n context: dialogActionBtnsCtx\n \"\n >\n </ng-container>\n </kendo-dialog-actions>\n </kendo-dialog>\n\n <ng-template #defaultDialogActionsTpl>\n <button kendoButton (click)=\"cancel()\" class=\"btn btn-secondary btn-sm\">Cancel</button>\n <button kendoButton (click)=\"submit()\" class=\"btn btn-primary btn-sm\">\n {{ saveButtonText }}\n </button>\n </ng-template>`,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DataEntryDialogComponent implements OnInit {\n @Input() public minWidth?: number; //NOSONAR\n @Input() public width = 800; //NOSONAR\n @Input() public height = 600; //NOSONAR\n /**\n * https://www.telerik.com/kendo-angular-ui/components/dialogs/dialog/initial-focus/\n */\n @Input() public autoFocusedElement?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() public parentComponent?: BaseDataEntryComponent<any>; //NOSONAR\n @Input() public saveButtonText = 'Save';\n @ContentChild(DialogButtonsDirective, { static: true, read: TemplateRef })\n /**\n * Example Usage:\n * <imng-data-entry-dialog>\n * ......\n * <ng-template [imngDialogBtns] let-coreButtons>\n * <button id=\"btnCustom1\" class=\"k-button\" (click)=\"cancel()\">Close</button>\n * </ng-template>\n * </imng-data-entry-dialog>\n */\n public dialogBtnsTemplate?: TemplateRef<unknown>;\n public loading$?: Observable<boolean>;\n public addEditForm?: UntypedFormGroup;\n public submitted = false;\n public dialogTitle?: string;\n // eslint-disable-next-line @typescript-eslint/ban-types\n public component?: {};\n\n public ngOnInit(): void {\n if (!this.parentComponent) {\n throw new TypeError(`The input 'parentComponent' is required`);\n }\n this.dialogTitle = this.parentComponent.dialogTitle;\n this.loading$ = this.parentComponent.loading$;\n this.addEditForm = this.parentComponent.addEditForm;\n }\n\n public close(): void {\n this.parentComponent?.closeForm();\n }\n public cancel(): void {\n this.parentComponent?.onCancel();\n }\n public submit(): void {\n this.parentComponent?.onSubmit();\n }\n get dialogActionBtnsCtx(): object | null { //NOSONAR\n return {\n $implicit: { cancel: () => this.cancel(), submit: () => this.submit() },\n };\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { DataEntryDialogComponent } from './data-entry-dialog.component';\nimport { DialogButtonsDirective } from './dialog-buttons.directive';\nimport { DialogModule } from '@progress/kendo-angular-dialog';\n\n@NgModule({\n imports: [CommonModule, DialogModule],\n declarations: [DataEntryDialogComponent, DialogButtonsDirective],\n exports: [DataEntryDialogComponent, DialogButtonsDirective],\n})\nexport class ImngDataEntryDialogModule {}\n","import { ValueType } from 'imng-nrsrx-client-utils';\nexport function updateStateCollectionItem<Entity extends { id?: ValueType }>(\n collection: Entity[],\n item: Entity\n): Entity[] {\n const items = [...collection];\n const index = collection.findIndex((val) => val.id === item.id);\n items.splice(index, 1, item);\n return items;\n}\n\nexport function removeStateCollectionItem<Entity extends { id?: ValueType }>(\n collection: Entity[],\n item: Entity\n): Entity[] {\n const items = [...collection];\n const index = collection.findIndex((val) => val.id === item.id);\n items.splice(index, 1);\n return items;\n}\n\nexport function addStateCollectionItem<Entity extends { id?: ValueType }>(\n collection: Entity[],\n item: Entity\n): Entity[] {\n const items = [...collection];\n items.unshift(item);\n return items;\n}\n","import { UntypedFormGroup } from '@angular/forms';\nimport { take, tap, filter } from 'rxjs/operators';\nimport { Observable } from 'rxjs';\n\nexport const formGroupPatcher = <TEntity>(addEditForm: UntypedFormGroup) => (source: Observable<TEntity>) =>\n source.pipe(\n filter(t => !!t),\n take(1),\n tap(t => addEditForm.patchValue(t)),\n );\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAYA,MAAM,MA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AC;;ACRvC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"imng-kendo-data-entry.mjs","sources":["../../../../libs/imng-kendo-data-entry/src/lib/base-data-entry.component.ts","../../../../libs/imng-kendo-data-entry/src/lib/dialog-buttons.directive.ts","../../../../libs/imng-kendo-data-entry/src/lib/data-entry-dialog.component.ts","../../../../libs/imng-kendo-data-entry/src/lib/imng-kendo-data-entry.module.ts","../../../../libs/imng-kendo-data-entry/src/lib/reducer-collection-logic.ts","../../../../libs/imng-kendo-data-entry/src/lib/form-group-patcher.ts","../../../../libs/imng-kendo-data-entry/src/imng-kendo-data-entry.ts"],"sourcesContent":["import {\n Directive,\n Inject,\n InjectionToken,\n Input,\n OnDestroy,\n} from '@angular/core';\nimport { Observable, BehaviorSubject } from 'rxjs';\nimport { AbstractControl, ValidationErrors, FormGroup, FormArray } from '@angular/forms';\nimport { IBaseDataEntryFacade } from './data-entry-facade';\nimport { Subscribable, Subscriptions } from 'imng-ngrx-utils';\n\nconst FACADE = new InjectionToken<IBaseDataEntryFacade>(\n 'imng-data-entry-facade',\n);\n\n/**\n * The extending class has to implement the following properties on ngInit\n * dialogTitle: string - This will be the text displayed at the top of the modal title bar\n * props: enum - This is a helper property to make the html markup type safe\n *\n * Along with the requirements above, the extending class has to set values to the\n * following properties on ngInit\n * active$: Observable<boolean> - This typically would be assigned to the isNewActive$ or isEditActive on the facade\n * addEditForm: FormGroup - This will be created by your component\n *\n * @class BaseDataEntryComponent>\n */\n@Directive()\nexport abstract class BaseDataEntryComponent<\n FACADE extends IBaseDataEntryFacade,\n > implements OnDestroy, Subscribable {\n @Input() public width: string | number = 800; //NOSONAR\n @Input() public height: string | number = 600; //NOSONAR\n public readonly MinLengthError = 'minlength';\n public readonly RequiredError = 'required';\n public readonly ENUM_DISPLAY_TEXT = 'displayText';\n public readonly ENUM_NAME = 'name';\n public allSubscriptions = new Subscriptions();\n public abstract dialogTitle: string;\n public abstract props: unknown;\n public abstract addEditForm: FormGroup;\n public loading$: Observable<boolean>;\n private readonly _submitted$: BehaviorSubject<boolean> = new BehaviorSubject(\n false as boolean,\n );\n\n public get submitted$(): Observable<boolean> {\n return this._submitted$.asObservable();\n }\n constructor(@Inject(FACADE) public readonly facade: FACADE) {\n this.loading$ = this.facade.loading$;\n this.initForm();\n }\n\n public ngOnDestroy(): void {\n this.allSubscriptions.unsubscribeAll();\n }\n\n public closeForm(): void {\n this.initForm();\n this.facade.clearCurrentEntity();\n this._submitted$.next(false);\n }\n\n public onCancel(): void {\n this.closeForm();\n }\n\n public onSubmit(): boolean {\n this._submitted$.next(true);\n\n // stop here if form is invalid\n if (!this.addEditForm.valid) {\n console.error('form validation errors.'); //NOSONAR\n console.error(JSON.stringify(this.getFormErrors())); //NOSONAR\n return false;\n }\n this.save();\n this.closeForm();\n return true;\n }\n\n public isDataInvalid(): boolean {\n return this.addEditForm.invalid;\n }\n\n // convenience getter for easy access to form fields\n public formControl(controlName: string, controls: { [key: string]: AbstractControl; } = this.addEditForm.controls): AbstractControl {\n return controls[controlName];\n }\n\n public formControlErrors(control: string | AbstractControl, controls: { [key: string]: AbstractControl; } | AbstractControl[] = this.addEditForm.controls): ValidationErrors | null {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const tempControl = typeof control === 'string' ? (controls as any)[control] : control;\n if (tempControl?.valid && !tempControl?.errors) {\n return null;\n }\n return tempControl?.errors;\n }\n public formMinLengthError(\n controlName: string,\n ): { requiredLength: number; actualLength: number; } | null {\n return this.formControlErrors(controlName)?.[this.MinLengthError];\n }\n public getFormErrors(controls: { [key: string]: AbstractControl; } | AbstractControl[] = this.addEditForm.controls, parentControlName?: string): { controlName: string; error: ValidationErrors; }[] {\n const errors: { controlName: string; error: ValidationErrors; }[] = [];\n for (const controlName of Object.keys(controls)) {\n const control = (controls as never)[controlName];\n const error = this.formControlErrors(control, controls);\n if (error) {\n errors.push({ controlName: parentControlName ? `${parentControlName}.${controlName}` : controlName, error });\n }\n if ((control as FormArray)?.controls) {\n\n errors.push(...this.getFormErrors((control as FormArray).controls, parentControlName ? `${parentControlName}.${controlName}` : controlName));\n }\n }\n return errors;\n }\n\n public abstract initForm(): void;\n public abstract save(): void;\n}\n","import { Directive, TemplateRef } from '@angular/core';\n\n@Directive({ selector: '[imngDialogBtns]' })\nexport class DialogButtonsDirective {\n constructor(public tpl: TemplateRef<unknown>) { }\n}\n","import {\n Component,\n OnInit,\n Input,\n ChangeDetectionStrategy,\n TemplateRef,\n ContentChild,\n} from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { FormGroup } from '@angular/forms';\nimport { BaseDataEntryComponent } from './base-data-entry.component';\nimport { DialogButtonsDirective } from './dialog-buttons.directive';\n\n@Component({\n selector: 'imng-data-entry-dialog[parentComponent]',\n template: `<kendo-dialog\n [width]=\"width\"\n [minWidth]=\"minWidth ?? width\"\n [height]=\"height\"\n (close)=\"close()\"\n [autoFocusedElement]=\"autoFocusedElement || ''\">\n <kendo-dialog-titlebar class=\"bg-primary\">{{\n dialogTitle\n }}</kendo-dialog-titlebar>\n <ng-content></ng-content>\n <kendo-dialog-actions>\n <ng-container\n *ngTemplateOutlet=\"\n dialogBtnsTemplate || defaultDialogActionsTpl;\n context: dialogActionBtnsCtx\n \">\n </ng-container>\n </kendo-dialog-actions>\n </kendo-dialog>\n\n <ng-template #defaultDialogActionsTpl>\n <button kendoButton (click)=\"cancel()\" class=\"btn btn-secondary btn-sm\">\n Cancel\n </button>\n <button kendoButton (click)=\"submit()\" class=\"btn btn-primary btn-sm\">\n {{ saveButtonText }}\n </button>\n </ng-template>`,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DataEntryDialogComponent implements OnInit {\n @Input() public minWidth?: number; //NOSONAR\n @Input() public width = 800; //NOSONAR\n @Input() public height = 600; //NOSONAR\n /**\n * https://www.telerik.com/kendo-angular-ui/components/dialogs/dialog/initial-focus/\n */\n @Input() public autoFocusedElement?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() public parentComponent?: BaseDataEntryComponent<any>; //NOSONAR\n @Input() public saveButtonText = 'Save';\n @ContentChild(DialogButtonsDirective, { static: true, read: TemplateRef })\n /**\n * Example Usage:\n * <imng-data-entry-dialog>\n * ......\n * <ng-template [imngDialogBtns] let-coreButtons>\n * <button id=\"btnCustom1\" class=\"k-button\" (click)=\"cancel()\">Close</button>\n * </ng-template>\n * </imng-data-entry-dialog>\n */\n public dialogBtnsTemplate?: TemplateRef<unknown>;\n public loading$?: Observable<boolean>;\n public addEditForm?: FormGroup;\n public submitted = false;\n public dialogTitle?: string;\n // eslint-disable-next-line @typescript-eslint/ban-types\n public component?: {};\n\n public ngOnInit(): void {\n if (!this.parentComponent) {\n throw new TypeError(`The input 'parentComponent' is required`);\n }\n this.dialogTitle = this.parentComponent.dialogTitle;\n this.loading$ = this.parentComponent.loading$;\n this.addEditForm = this.parentComponent.addEditForm;\n }\n\n public close(): void {\n this.parentComponent?.closeForm();\n }\n public cancel(): void {\n this.parentComponent?.onCancel();\n }\n public submit(): void {\n this.parentComponent?.onSubmit();\n }\n get dialogActionBtnsCtx(): object | null {\n //NOSONAR\n return {\n $implicit: { cancel: () => this.cancel(), submit: () => this.submit() },\n };\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { DataEntryDialogComponent } from './data-entry-dialog.component';\nimport { DialogButtonsDirective } from './dialog-buttons.directive';\nimport { DialogModule } from '@progress/kendo-angular-dialog';\n\n@NgModule({\n imports: [CommonModule, DialogModule],\n declarations: [DataEntryDialogComponent, DialogButtonsDirective],\n exports: [DataEntryDialogComponent, DialogButtonsDirective],\n})\nexport class ImngDataEntryDialogModule {}\n","import { ValueType } from 'imng-nrsrx-client-utils';\nexport function updateStateCollectionItem<Entity extends { id?: ValueType; }>(\n collection: Entity[],\n item: Entity\n): Entity[] {\n const index = collection.findIndex((val) => val.id === item.id);\n if (index > -1) {\n const items = [...collection];\n items.splice(index, 1, item);\n return items;\n }\n return collection;\n}\n\nexport function removeStateCollectionItem<Entity extends { id?: ValueType; }>(\n collection: Entity[],\n item: Entity\n): Entity[] {\n const index = collection.findIndex((val) => val.id === item.id);\n if (index > -1) {\n const items = [...collection];\n items.splice(index, 1);\n return items;\n }\n return collection;\n}\n\nexport function addStateCollectionItem<Entity extends { id?: ValueType; }>(\n collection: Entity[],\n item: Entity\n): Entity[] {\n const items = [...collection];\n items.unshift(item);\n return items;\n}\n","import { FormGroup } from '@angular/forms';\nimport { take, tap, filter } from 'rxjs/operators';\nimport { Observable } from 'rxjs';\n\nexport const formGroupPatcher =\n <TEntity>(addEditForm: FormGroup) =>\n (source: Observable<TEntity>) =>\n source.pipe(\n filter((t) => !!t),\n take(1),\n tap((t) => addEditForm.patchValue(t)),\n );\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAYA,MAAM,MAAM,GAAG,IAAI,cAAc,CAC/B,wBAAwB,CACzB,CAAC;AAEF;;;;;;;;;;;AAWG;MAEmB,sBAAsB,CAAA;AAqB1C,IAAA,WAAA,CAA4C,MAAc,EAAA;QAAd,IAAM,CAAA,MAAA,GAAN,MAAM,CAAQ;AAlB1C,QAAA,IAAA,CAAA,KAAK,GAAoB,GAAG,CAAC;AAC7B,QAAA,IAAA,CAAA,MAAM,GAAoB,GAAG,CAAC;QAC9B,IAAc,CAAA,cAAA,GAAG,WAAW,CAAC;QAC7B,IAAa,CAAA,aAAA,GAAG,UAAU,CAAC;QAC3B,IAAiB,CAAA,iBAAA,GAAG,aAAa,CAAC;QAClC,IAAS,CAAA,SAAA,GAAG,MAAM,CAAC;AAC5B,QAAA,IAAA,CAAA,gBAAgB,GAAG,IAAI,aAAa,EAAE,CAAC;AAK7B,QAAA,IAAA,CAAA,WAAW,GAA6B,IAAI,eAAe,CAC1E,KAAgB,CACjB,CAAC;QAMA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QACrC,IAAI,CAAC,QAAQ,EA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T,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAClB,IAAI,CAAC,CAAC,CAAC,EACP,GAAG,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;;ACV3C;;AAEG;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OnDestroy } from '@angular/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import {
|
|
3
|
+
import { AbstractControl, ValidationErrors, FormGroup } from '@angular/forms';
|
|
4
4
|
import { IBaseDataEntryFacade } from './data-entry-facade';
|
|
5
5
|
import { Subscribable, Subscriptions } from 'imng-ngrx-utils';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
@@ -27,7 +27,7 @@ export declare abstract class BaseDataEntryComponent<FACADE extends IBaseDataEnt
|
|
|
27
27
|
allSubscriptions: Subscriptions;
|
|
28
28
|
abstract dialogTitle: string;
|
|
29
29
|
abstract props: unknown;
|
|
30
|
-
addEditForm:
|
|
30
|
+
abstract addEditForm: FormGroup;
|
|
31
31
|
loading$: Observable<boolean>;
|
|
32
32
|
private readonly _submitted$;
|
|
33
33
|
get submitted$(): Observable<boolean>;
|
|
@@ -35,16 +35,22 @@ export declare abstract class BaseDataEntryComponent<FACADE extends IBaseDataEnt
|
|
|
35
35
|
ngOnDestroy(): void;
|
|
36
36
|
closeForm(): void;
|
|
37
37
|
onCancel(): void;
|
|
38
|
-
onSubmit():
|
|
38
|
+
onSubmit(): boolean;
|
|
39
39
|
isDataInvalid(): boolean;
|
|
40
|
-
formControl(controlName: string
|
|
41
|
-
|
|
40
|
+
formControl(controlName: string, controls?: {
|
|
41
|
+
[key: string]: AbstractControl;
|
|
42
|
+
}): AbstractControl;
|
|
43
|
+
formControlErrors(control: string | AbstractControl, controls?: {
|
|
44
|
+
[key: string]: AbstractControl;
|
|
45
|
+
} | AbstractControl[]): ValidationErrors | null;
|
|
42
46
|
formMinLengthError(controlName: string): {
|
|
43
47
|
requiredLength: number;
|
|
44
48
|
actualLength: number;
|
|
45
49
|
} | null;
|
|
46
|
-
getFormErrors(
|
|
47
|
-
|
|
50
|
+
getFormErrors(controls?: {
|
|
51
|
+
[key: string]: AbstractControl;
|
|
52
|
+
} | AbstractControl[], parentControlName?: string): {
|
|
53
|
+
controlName: string;
|
|
48
54
|
error: ValidationErrors;
|
|
49
55
|
}[];
|
|
50
56
|
abstract initForm(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OnInit, TemplateRef } from '@angular/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import {
|
|
3
|
+
import { FormGroup } from '@angular/forms';
|
|
4
4
|
import { BaseDataEntryComponent } from './base-data-entry.component';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class DataEntryDialogComponent implements OnInit {
|
|
@@ -15,7 +15,7 @@ export declare class DataEntryDialogComponent implements OnInit {
|
|
|
15
15
|
saveButtonText: string;
|
|
16
16
|
dialogBtnsTemplate?: TemplateRef<unknown>;
|
|
17
17
|
loading$?: Observable<boolean>;
|
|
18
|
-
addEditForm?:
|
|
18
|
+
addEditForm?: FormGroup;
|
|
19
19
|
submitted: boolean;
|
|
20
20
|
dialogTitle?: string;
|
|
21
21
|
component?: {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormGroup } from '@angular/forms';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
export declare const formGroupPatcher: <TEntity>(addEditForm:
|
|
3
|
+
export declare const formGroupPatcher: <TEntity>(addEditForm: FormGroup) => (source: Observable<TEntity>) => Observable<TEntity>;
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/// <reference types="jest" />
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
2
3
|
import { BaseDataEntryComponent } from 'imng-kendo-data-entry';
|
|
3
4
|
import { DataEntryMockFacade } from './data-entry-mock.facade';
|
|
4
5
|
export declare class MockDataEntryComponent extends BaseDataEntryComponent<DataEntryMockFacade> {
|
|
5
6
|
dialogTitle: string;
|
|
7
|
+
addEditForm: FormGroup<{
|
|
8
|
+
id: FormControl<string | null>;
|
|
9
|
+
}>;
|
|
6
10
|
props: {};
|
|
7
11
|
initForm: jest.Mock<any, any>;
|
|
8
12
|
save: () => jest.Mock<any, any>;
|