imng-kendo-data-entry 2.330.3 → 3.4.2
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/bundles/imng-kendo-data-entry-testing.umd.js +79 -89
- package/bundles/imng-kendo-data-entry-testing.umd.js.map +1 -1
- package/bundles/imng-kendo-data-entry.umd.js +132 -52
- package/bundles/imng-kendo-data-entry.umd.js.map +1 -1
- package/esm2015/imng-kendo-data-entry.js +1 -1
- package/esm2015/index.js +2 -1
- package/esm2015/lib/base-data-entry.component.js +20 -14
- package/esm2015/lib/data-delete-facade.js +1 -1
- package/esm2015/lib/data-entry-dialog.component.js +57 -16
- package/esm2015/lib/data-entry-facade.js +1 -1
- package/esm2015/lib/data-entry.module.js +15 -9
- package/esm2015/lib/dialog-buttons.directive.js +14 -0
- package/esm2015/lib/form-group-patcher.js +1 -1
- package/esm2015/lib/reducer-collection-logic.js +1 -1
- package/esm2015/testing/data-delete-facade-http-tests.js +11 -16
- package/esm2015/testing/data-delete-mock.facade.js +3 -1
- package/esm2015/testing/data-entry-facade-http-tests.js +21 -31
- package/esm2015/testing/data-entry-facade-tests.js +28 -40
- package/esm2015/testing/data-entry-mock.facade.js +4 -1
- package/esm2015/testing/imng-kendo-data-entry-testing.js +1 -1
- package/esm2015/testing/index.js +1 -1
- package/esm2015/testing/mock-data-entry-dialog.component.js +4 -3
- package/esm2015/testing/public_api.js +1 -1
- package/esm2015/testing/test-trigger-event-helpers.js +1 -1
- package/fesm2015/imng-kendo-data-entry-testing.js +65 -86
- package/fesm2015/imng-kendo-data-entry-testing.js.map +1 -1
- package/fesm2015/imng-kendo-data-entry.js +97 -36
- package/fesm2015/imng-kendo-data-entry.js.map +1 -1
- package/imng-kendo-data-entry.d.ts +2 -0
- package/imng-kendo-data-entry.d.ts.map +1 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -0
- package/lib/base-data-entry.component.d.ts +14 -11
- package/lib/base-data-entry.component.d.ts.map +1 -0
- package/lib/data-delete-facade.d.ts +1 -0
- package/lib/data-delete-facade.d.ts.map +1 -0
- package/lib/data-entry-dialog.component.d.ts +9 -3
- package/lib/data-entry-dialog.component.d.ts.map +1 -0
- package/lib/data-entry-facade.d.ts +8 -5
- package/lib/data-entry-facade.d.ts.map +1 -0
- package/lib/data-entry.module.d.ts +9 -0
- package/lib/data-entry.module.d.ts.map +1 -0
- package/lib/dialog-buttons.directive.d.ts +9 -0
- package/lib/dialog-buttons.directive.d.ts.map +1 -0
- package/lib/form-group-patcher.d.ts +1 -0
- package/lib/form-group-patcher.d.ts.map +1 -0
- package/lib/reducer-collection-logic.d.ts +5 -3
- package/lib/reducer-collection-logic.d.ts.map +1 -0
- package/package.json +24 -15
- package/testing/data-delete-facade-http-tests.d.ts +2 -2
- package/testing/data-delete-facade-http-tests.d.ts.map +1 -0
- package/testing/data-delete-mock.facade.d.ts +1 -0
- package/testing/data-delete-mock.facade.d.ts.map +1 -0
- package/testing/data-entry-facade-http-tests.d.ts +3 -3
- package/testing/data-entry-facade-http-tests.d.ts.map +1 -0
- package/testing/data-entry-facade-tests.d.ts +3 -3
- package/testing/data-entry-facade-tests.d.ts.map +1 -0
- package/testing/data-entry-mock.facade.d.ts +1 -0
- package/testing/data-entry-mock.facade.d.ts.map +1 -0
- package/testing/imng-kendo-data-entry-testing.d.ts +2 -0
- package/testing/imng-kendo-data-entry-testing.d.ts.map +1 -0
- package/testing/index.d.ts +1 -0
- package/testing/index.d.ts.map +1 -0
- package/testing/mock-data-entry-dialog.component.d.ts +4 -3
- package/testing/mock-data-entry-dialog.component.d.ts.map +1 -0
- package/testing/package.json +1 -2
- package/testing/public_api.d.ts +1 -0
- package/testing/public_api.d.ts.map +1 -0
- package/testing/test-trigger-event-helpers.d.ts +1 -0
- package/testing/test-trigger-event-helpers.d.ts.map +1 -0
- package/bundles/imng-kendo-data-entry-testing.umd.min.js +0 -17
- package/bundles/imng-kendo-data-entry-testing.umd.min.js.map +0 -1
- package/bundles/imng-kendo-data-entry.umd.min.js +0 -2
- package/bundles/imng-kendo-data-entry.umd.min.js.map +0 -1
- package/esm2015/imng-kendo-data-entry.js.map +0 -1
- package/esm2015/imng-kendo-data-entry.metadata.json +0 -1
- package/esm2015/index.js.map +0 -1
- package/esm2015/index.metadata.json +0 -1
- package/esm2015/lib/base-data-entry.component.js.map +0 -1
- package/esm2015/lib/base-data-entry.component.metadata.json +0 -1
- package/esm2015/lib/data-delete-facade.js.map +0 -1
- package/esm2015/lib/data-delete-facade.metadata.json +0 -1
- package/esm2015/lib/data-entry-dialog.component.js.map +0 -1
- package/esm2015/lib/data-entry-dialog.component.metadata.json +0 -1
- package/esm2015/lib/data-entry-facade.js.map +0 -1
- package/esm2015/lib/data-entry-facade.metadata.json +0 -1
- package/esm2015/lib/data-entry.module.js.map +0 -1
- package/esm2015/lib/data-entry.module.metadata.json +0 -1
- package/esm2015/lib/form-group-patcher.js.map +0 -1
- package/esm2015/lib/form-group-patcher.metadata.json +0 -1
- package/esm2015/lib/reducer-collection-logic.js.map +0 -1
- package/esm2015/lib/reducer-collection-logic.metadata.json +0 -1
- package/esm2015/testing/data-delete-facade-http-tests.js.map +0 -1
- package/esm2015/testing/data-delete-facade-http-tests.metadata.json +0 -1
- package/esm2015/testing/data-delete-mock.facade.js.map +0 -1
- package/esm2015/testing/data-delete-mock.facade.metadata.json +0 -1
- package/esm2015/testing/data-entry-facade-http-tests.js.map +0 -1
- package/esm2015/testing/data-entry-facade-http-tests.metadata.json +0 -1
- package/esm2015/testing/data-entry-facade-tests.js.map +0 -1
- package/esm2015/testing/data-entry-facade-tests.metadata.json +0 -1
- package/esm2015/testing/data-entry-mock.facade.js.map +0 -1
- package/esm2015/testing/data-entry-mock.facade.metadata.json +0 -1
- package/esm2015/testing/imng-kendo-data-entry-testing.js.map +0 -1
- package/esm2015/testing/imng-kendo-data-entry-testing.metadata.json +0 -1
- package/esm2015/testing/index.js.map +0 -1
- package/esm2015/testing/index.metadata.json +0 -1
- package/esm2015/testing/mock-data-entry-dialog.component.js.map +0 -1
- package/esm2015/testing/mock-data-entry-dialog.component.metadata.json +0 -1
- package/esm2015/testing/public_api.js.map +0 -1
- package/esm2015/testing/public_api.metadata.json +0 -1
- package/esm2015/testing/test-trigger-event-helpers.js.map +0 -1
- package/esm2015/testing/test-trigger-event-helpers.metadata.json +0 -1
- package/imng-kendo-data-entry.metadata.json +0 -1
- package/testing/imng-kendo-data-entry-testing.metadata.json +0 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
2
|
import { __awaiter } from 'tslib';
|
|
3
|
-
import { readFirst } from '
|
|
3
|
+
import { readFirst } from 'imng-ngrx-utils/testing';
|
|
4
4
|
import { By } from '@angular/platform-browser';
|
|
5
5
|
import { BaseDataEntryComponent } from 'imng-kendo-data-entry';
|
|
6
6
|
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
7
8
|
class DataEntryMockFacade {
|
|
8
9
|
constructor() {
|
|
9
10
|
this.loading$ = of(false);
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
10
12
|
this.currentEntity$ = of(null);
|
|
11
13
|
this.isEditActive$ = of(false);
|
|
12
14
|
this.isNewActive$ = of(false);
|
|
@@ -16,6 +18,7 @@ class DataEntryMockFacade {
|
|
|
16
18
|
this.updateExistingEntity = jest.fn();
|
|
17
19
|
}
|
|
18
20
|
}
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/ban-types,@typescript-eslint/no-explicit-any
|
|
19
22
|
function createDataEntryMockFacade(mockFacade) {
|
|
20
23
|
const localFacade = new DataEntryMockFacade();
|
|
21
24
|
if (!mockFacade) {
|
|
@@ -32,48 +35,36 @@ function createDataEntryMockFacade(mockFacade) {
|
|
|
32
35
|
return mockFacade;
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
function testAddSetAndClearCurrentEntity(
|
|
38
|
+
function testAddSetAndClearCurrentEntity(facade) {
|
|
36
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
expect(status.isNewActive).toBeFalsy();
|
|
50
|
-
done();
|
|
51
|
-
}
|
|
52
|
-
catch (err) {
|
|
53
|
-
done.fail(err);
|
|
54
|
-
}
|
|
40
|
+
const entity = { name: '🆕' };
|
|
41
|
+
yield validateInitialState(facade);
|
|
42
|
+
facade.setCurrentEntity(entity, { name: 'parentEntity' });
|
|
43
|
+
let status = yield getEntityStatus(facade);
|
|
44
|
+
expect(status.currentEntity).toStrictEqual(entity);
|
|
45
|
+
expect(status.isEditActive).toBeFalsy();
|
|
46
|
+
expect(status.isNewActive).toBeTruthy();
|
|
47
|
+
facade.clearCurrentEntity();
|
|
48
|
+
status = yield getEntityStatus(facade);
|
|
49
|
+
expect(status.currentEntity).toBeFalsy();
|
|
50
|
+
expect(status.isEditActive).toBeFalsy();
|
|
51
|
+
expect(status.isNewActive).toBeFalsy();
|
|
55
52
|
});
|
|
56
53
|
}
|
|
57
|
-
function testEditSetAndClearCurrentEntity(
|
|
54
|
+
function testEditSetAndClearCurrentEntity(facade) {
|
|
58
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
expect(status.isNewActive).toBeFalsy();
|
|
72
|
-
done();
|
|
73
|
-
}
|
|
74
|
-
catch (err) {
|
|
75
|
-
done.fail(err);
|
|
76
|
-
}
|
|
56
|
+
const entity = { id: '💃', name: '🧓👴👵' };
|
|
57
|
+
yield validateInitialState(facade);
|
|
58
|
+
facade.setCurrentEntity(entity, { name: 'parentEntity' });
|
|
59
|
+
let status = yield getEntityStatus(facade);
|
|
60
|
+
expect(status.currentEntity).toStrictEqual(entity);
|
|
61
|
+
expect(status.isEditActive).toBeTruthy();
|
|
62
|
+
expect(status.isNewActive).toBeFalsy();
|
|
63
|
+
facade.clearCurrentEntity();
|
|
64
|
+
status = yield getEntityStatus(facade);
|
|
65
|
+
expect(status.currentEntity).toBeFalsy();
|
|
66
|
+
expect(status.isEditActive).toBeFalsy();
|
|
67
|
+
expect(status.isNewActive).toBeFalsy();
|
|
77
68
|
});
|
|
78
69
|
}
|
|
79
70
|
function validateInitialState(facade) {
|
|
@@ -94,67 +85,54 @@ function getEntityStatus(facade) {
|
|
|
94
85
|
});
|
|
95
86
|
}
|
|
96
87
|
|
|
97
|
-
function testSaveCurrentEntity(
|
|
88
|
+
function testSaveCurrentEntity(facade, httpClient) {
|
|
98
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
done();
|
|
109
|
-
}
|
|
110
|
-
catch (err) {
|
|
111
|
-
done.fail(err);
|
|
112
|
-
}
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
91
|
+
const entity = { name: '🆕' };
|
|
92
|
+
httpClient.post = jest.fn(() => of(entity));
|
|
93
|
+
httpClient.put = jest.fn(() => of(entity));
|
|
94
|
+
httpClient.delete = jest.fn(() => of(entity));
|
|
95
|
+
facade.saveNewEntity(entity);
|
|
96
|
+
expect(httpClient.post).toBeCalledTimes(1);
|
|
97
|
+
expect(httpClient.put).toBeCalledTimes(0);
|
|
98
|
+
expect(httpClient.delete).toBeCalledTimes(0);
|
|
113
99
|
});
|
|
114
100
|
}
|
|
115
|
-
function testUpdateCurrentEntity(
|
|
101
|
+
function testUpdateCurrentEntity(facade, httpClient) {
|
|
116
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
done();
|
|
127
|
-
}
|
|
128
|
-
catch (err) {
|
|
129
|
-
done.fail(err);
|
|
130
|
-
}
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
104
|
+
const entity = { id: '💃', name: '🧓👴👵' };
|
|
105
|
+
httpClient.post = jest.fn(() => of(entity));
|
|
106
|
+
httpClient.put = jest.fn(() => of(entity));
|
|
107
|
+
httpClient.delete = jest.fn(() => of(entity));
|
|
108
|
+
facade.updateExistingEntity(entity);
|
|
109
|
+
expect(httpClient.put).toBeCalledTimes(1);
|
|
110
|
+
expect(httpClient.post).toBeCalledTimes(0);
|
|
111
|
+
expect(httpClient.delete).toBeCalledTimes(0);
|
|
131
112
|
});
|
|
132
113
|
}
|
|
133
114
|
|
|
134
|
-
function testDeleteCurrentEntity(
|
|
115
|
+
function testDeleteCurrentEntity(facade, httpClient) {
|
|
135
116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
done();
|
|
146
|
-
}
|
|
147
|
-
catch (err) {
|
|
148
|
-
done.fail(err);
|
|
149
|
-
}
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
118
|
+
const entity = { id: '💃', name: '🧓👴👵' };
|
|
119
|
+
httpClient.post = jest.fn();
|
|
120
|
+
httpClient.put = jest.fn();
|
|
121
|
+
httpClient.delete = jest.fn(() => of(entity));
|
|
122
|
+
facade.deleteExistingEntity(entity);
|
|
123
|
+
expect(httpClient.put).toBeCalledTimes(0);
|
|
124
|
+
expect(httpClient.post).toBeCalledTimes(0);
|
|
125
|
+
expect(httpClient.delete).toBeCalledTimes(1);
|
|
150
126
|
});
|
|
151
127
|
}
|
|
152
128
|
|
|
129
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
153
130
|
class DataDeleteMockFacade {
|
|
154
131
|
constructor() {
|
|
155
132
|
this.deleteExistingEntity = jest.fn();
|
|
156
133
|
}
|
|
157
134
|
}
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/ban-types,@typescript-eslint/no-explicit-any
|
|
158
136
|
function createDataDeleteMockFacade(mockFacade) {
|
|
159
137
|
const localFacade = new DataDeleteMockFacade();
|
|
160
138
|
if (!mockFacade) {
|
|
@@ -173,14 +151,15 @@ function triggerCancelClickEvent(fixture) {
|
|
|
173
151
|
typeAhead.triggerEventHandler('click', {});
|
|
174
152
|
}
|
|
175
153
|
|
|
154
|
+
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
|
|
176
155
|
class MockDataEntryComponent extends BaseDataEntryComponent {
|
|
177
156
|
constructor() {
|
|
178
157
|
super(...arguments);
|
|
179
158
|
this.dialogTitle = 'MockDataEntryComponent';
|
|
180
159
|
this.props = {};
|
|
181
|
-
this.
|
|
160
|
+
this.initForm = jest.fn();
|
|
161
|
+
this.save = () => jest.fn();
|
|
182
162
|
}
|
|
183
|
-
initForm() { }
|
|
184
163
|
}
|
|
185
164
|
|
|
186
165
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imng-kendo-data-entry-testing.js","sources":["../../../../libs/imng-kendo-data-entry/testing/src/data-entry-mock.facade.ts","../../../../libs/imng-kendo-data-entry/testing/src/data-entry-facade-tests.ts","../../../../libs/imng-kendo-data-entry/testing/src/data-entry-facade-http-tests.ts","../../../../libs/imng-kendo-data-entry/testing/src/data-delete-facade-http-tests.ts","../../../../libs/imng-kendo-data-entry/testing/src/data-delete-mock.facade.ts","../../../../libs/imng-kendo-data-entry/testing/src/test-trigger-event-helpers.ts","../../../../libs/imng-kendo-data-entry/testing/src/mock-data-entry-dialog.component.ts","../../../../libs/imng-kendo-data-entry/testing/src/imng-kendo-data-entry-testing.ts"],"sourcesContent":["import { Observable, of } from 'rxjs';\nimport { IDataEntryFacade } from 'imng-kendo-data-entry';\n\nexport class DataEntryMockFacade implements IDataEntryFacade<object> {\n public loading$: Observable<boolean> = of(false);\n public currentEntity$: Observable<object> = of(null);\n public isEditActive$: Observable<boolean> = of(false);\n public isNewActive$: Observable<boolean> = of(false);\n public setCurrentEntity = jest.fn();\n public clearCurrentEntity = jest.fn();\n public saveNewEntity = jest.fn();\n public updateExistingEntity = jest.fn();\n}\n\nexport function createDataEntryMockFacade(mockFacade?: IDataEntryFacade<object> | any): IDataEntryFacade<object> {\n const localFacade = new DataEntryMockFacade();\n if (!mockFacade) {\n return localFacade;\n }\n mockFacade.loading$ = mockFacade.loading$ || localFacade.loading$;\n mockFacade.currentEntity$ = mockFacade.currentEntity$ || localFacade.currentEntity$;\n mockFacade.isEditActive$ = mockFacade.isEditActive$ || localFacade.isEditActive$;\n mockFacade.isNewActive$ = mockFacade.isNewActive$ || localFacade.isNewActive$;\n mockFacade.setCurrentEntity = mockFacade.setCurrentEntity || jest.fn();\n mockFacade.clearCurrentEntity = mockFacade.clearCurrentEntity || jest.fn();\n mockFacade.saveNewEntity = mockFacade.saveNewEntity || jest.fn();\n mockFacade.updateExistingEntity = mockFacade.updateExistingEntity || jest.fn();\n return mockFacade;\n}\n","import { readFirst } from '@nrwl/angular/testing';\nimport { Observable } from 'rxjs';\n\nexport async function testAddSetAndClearCurrentEntity\n <TFacade extends TestableFacade>(done: jest.DoneCallback, facade: TFacade): Promise<void> {\n try {\n const entity = { name: '🆕' };\n await validateInitialState(facade);\n\n facade.setCurrentEntity(entity, { name: 'parentEntity' });\n let status = await getEntityStatus(facade);\n expect(status.currentEntity).toStrictEqual(entity);\n expect(status.isEditActive).toBeFalsy();\n expect(status.isNewActive).toBeTruthy();\n\n facade.clearCurrentEntity();\n status = await getEntityStatus(facade);\n expect(status.currentEntity).toBeFalsy();\n expect(status.isEditActive).toBeFalsy();\n expect(status.isNewActive).toBeFalsy();\n\n done();\n } catch (err) {\n done.fail(err);\n }\n}\n\nexport async function testEditSetAndClearCurrentEntity<TFacade extends TestableFacade>(\n done: jest.DoneCallback,\n facade: TFacade,\n): Promise<void> {\n try {\n const entity = { id: '💃', name: '🧓👴👵' };\n await validateInitialState(facade);\n\n facade.setCurrentEntity(entity, { name: 'parentEntity' });\n let status = await getEntityStatus(facade);\n expect(status.currentEntity).toStrictEqual(entity);\n expect(status.isEditActive).toBeTruthy();\n expect(status.isNewActive).toBeFalsy();\n\n facade.clearCurrentEntity();\n status = await getEntityStatus(facade);\n expect(status.currentEntity).toBeFalsy();\n expect(status.isEditActive).toBeFalsy();\n expect(status.isNewActive).toBeFalsy();\n\n done();\n } catch (err) {\n done.fail(err);\n }\n}\nasync function validateInitialState(facade: TestableFacade): Promise<void> {\n const status = await getEntityStatus(facade);\n expect(status.currentEntity).toBeFalsy();\n expect(status.isEditActive).toBeFalsy();\n expect(status.isNewActive).toBeFalsy();\n}\n\nasync function getEntityStatus<TFacade extends TestableFacade>(facade: TFacade): Promise<{\n currentEntity: unknown,\n isEditActive: unknown,\n isNewActive: unknown;\n}> {\n return {\n currentEntity: await readFirst(facade.currentEntity$),\n isEditActive: await readFirst(facade.isEditActive$),\n isNewActive: await readFirst(facade.isNewActive$),\n };\n}\n\nexport interface TestableFacade {\n currentEntity$: Observable<unknown>;\n isEditActive$: Observable<boolean>;\n isNewActive$: Observable<boolean>;\n setCurrentEntity(entity: unknown, parentEntity?: unknown): void;\n clearCurrentEntity(): void;\n}\n","import { HttpClient } from '@angular/common/http';\nimport { of } from 'rxjs';\n\nexport async function testSaveCurrentEntity<TFacade extends { saveNewEntity(entity: unknown): void; }>(\n done: jest.DoneCallback,\n facade: TFacade,\n httpClient: HttpClient,\n): Promise<void> {\n try {\n const entity: any = { name: '🆕' };\n httpClient.post = jest.fn(() => of(entity));\n httpClient.put = jest.fn(() => of(entity));\n httpClient.delete = jest.fn(() => of(entity));\n\n facade.saveNewEntity(entity);\n expect(httpClient.post).toBeCalledTimes(1);\n expect(httpClient.put).toBeCalledTimes(0);\n expect(httpClient.delete).toBeCalledTimes(0);\n done();\n } catch (err) {\n done.fail(err);\n }\n}\n\nexport async function testUpdateCurrentEntity<TFacade extends { updateExistingEntity(entity: unknown): void; }>(\n done: jest.DoneCallback,\n facade: TFacade,\n httpClient: HttpClient,\n): Promise<void> {\n try {\n const entity: any = { id: '💃', name: '🧓👴👵' };\n\n httpClient.post = jest.fn(() => of(entity));\n httpClient.put = jest.fn(() => of(entity));\n httpClient.delete = jest.fn(() => of(entity));\n\n facade.updateExistingEntity(entity);\n expect(httpClient.put).toBeCalledTimes(1);\n expect(httpClient.post).toBeCalledTimes(0);\n expect(httpClient.delete).toBeCalledTimes(0);\n done();\n } catch (err) {\n done.fail(err);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { of } from 'rxjs';\n\nexport async function testDeleteCurrentEntity<TFacade extends { deleteExistingEntity(entity: unknown): void; }>(\n done: jest.DoneCallback,\n facade: TFacade,\n httpClient: HttpClient,\n): Promise<void> {\n try {\n const entity: any = { id: '💃', name: '🧓👴👵' };\n\n httpClient.post = jest.fn();\n httpClient.put = jest.fn();\n httpClient.delete = jest.fn(() => of(entity));\n\n facade.deleteExistingEntity(entity);\n expect(httpClient.put).toBeCalledTimes(0);\n expect(httpClient.post).toBeCalledTimes(0);\n expect(httpClient.delete).toBeCalledTimes(1);\n done();\n } catch (err) {\n done.fail(err);\n }\n}\n","import { IDataDeleteFacade } from 'imng-kendo-data-entry';\n\nexport class DataDeleteMockFacade implements IDataDeleteFacade<any> {\n deleteExistingEntity = jest.fn();\n}\n\nexport function createDataDeleteMockFacade(mockFacade?: IDataDeleteFacade<object> | any): IDataDeleteFacade<object> {\n const localFacade = new DataDeleteMockFacade();\n if (!mockFacade) {\n return localFacade;\n }\n mockFacade.deleteExistingEntity = mockFacade.deleteExistingEntity || jest.fn();\n return mockFacade;\n}\n","import { ComponentFixture } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\n\nexport function triggerSaveClickEvent<TComponent>(fixture: ComponentFixture<TComponent>): void {\n const typeAhead = fixture.debugElement.query(By.css('#btnSave'));\n typeAhead.triggerEventHandler('click', {});\n}\nexport function triggerCancelClickEvent<TComponent>(fixture: ComponentFixture<TComponent>): void {\n const typeAhead = fixture.debugElement.query(By.css('#btnCancel'));\n typeAhead.triggerEventHandler('click', {});\n}\n","import { BaseDataEntryComponent } from 'imng-kendo-data-entry';\nimport { DataEntryMockFacade } from './data-entry-mock.facade';\n\nexport class MockDataEntryComponent extends BaseDataEntryComponent<object, DataEntryMockFacade> {\n public dialogTitle = 'MockDataEntryComponent';\n public props = {};\n public initForm(): void { }\n public save = () => jest.fn(() => { });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;MAGa,mBAAmB;IAAhC;QACS,aAAQ,GAAwB,EAAE,CAAC,KAAK,CAAC,CAAC;QAC1C,mBAAc,GAAuB,EAAE,CAAC,IAAI,CAAC,CAAC;QAC9C,kBAAa,GAAwB,EAAE,CAAC,KAAK,CAAC,CAAC;QAC/C,iBAAY,GAAwB,EAAE,CAAC,KAAK,CAAC,CAAC;QAC9C,qBAAgB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC7B,uBAAkB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC/B,kBAAa,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC1B,yBAAoB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;KACzC;CAAA;SAEe,yBAAyB,CAAC,UAA2C;IACnF,MAAM,WAAW,GAAG,IAAI,mBAAmB,EAAE,CAAC;IAC9C,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,WAAW,CAAC;KACpB;IACD,UAAU,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC;IAClE,UAAU,CAAC,cAAc,GAAG,UA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,CAAC,CAAC;IACnE,SAAS,CAAC,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC7C;;MCPa,sBAAuB,SAAQ,sBAAmD;IAA/F;;QACS,gBAAW,GAAG,wBAAwB,CAAC;QACvC,UAAK,GAAG,EAAE,CAAC;QAEX,SAAI,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;KACxC;IAFQ,QAAQ,MAAY;;;ACN7B;;;;;;"}
|
|
1
|
+
{"version":3,"file":"imng-kendo-data-entry-testing.js","sources":["../../../../libs/imng-kendo-data-entry/testing/src/data-entry-mock.facade.ts","../../../../libs/imng-kendo-data-entry/testing/src/data-entry-facade-tests.ts","../../../../libs/imng-kendo-data-entry/testing/src/data-entry-facade-http-tests.ts","../../../../libs/imng-kendo-data-entry/testing/src/data-delete-facade-http-tests.ts","../../../../libs/imng-kendo-data-entry/testing/src/data-delete-mock.facade.ts","../../../../libs/imng-kendo-data-entry/testing/src/test-trigger-event-helpers.ts","../../../../libs/imng-kendo-data-entry/testing/src/mock-data-entry-dialog.component.ts","../../../../libs/imng-kendo-data-entry/testing/src/imng-kendo-data-entry-testing.ts"],"sourcesContent":["import { Observable, of } from 'rxjs';\n// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries\nimport { IDataEntryFacade } from 'imng-kendo-data-entry';\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport class DataEntryMockFacade implements IDataEntryFacade<object> {\n public loading$: Observable<boolean> = of(false);\n // eslint-disable-next-line @typescript-eslint/ban-types\n public currentEntity$: Observable<object> = of(null);\n public isEditActive$: Observable<boolean> = of(false);\n public isNewActive$: Observable<boolean> = of(false);\n public setCurrentEntity = jest.fn();\n public clearCurrentEntity = jest.fn();\n public saveNewEntity = jest.fn();\n public updateExistingEntity = jest.fn();\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types,@typescript-eslint/no-explicit-any\nexport function createDataEntryMockFacade(mockFacade?: IDataEntryFacade<object> | any): IDataEntryFacade<object> {\n const localFacade = new DataEntryMockFacade();\n if (!mockFacade) {\n return localFacade;\n }\n mockFacade.loading$ = mockFacade.loading$ || localFacade.loading$;\n mockFacade.currentEntity$ = mockFacade.currentEntity$ || localFacade.currentEntity$;\n mockFacade.isEditActive$ = mockFacade.isEditActive$ || localFacade.isEditActive$;\n mockFacade.isNewActive$ = mockFacade.isNewActive$ || localFacade.isNewActive$;\n mockFacade.setCurrentEntity = mockFacade.setCurrentEntity || jest.fn();\n mockFacade.clearCurrentEntity = mockFacade.clearCurrentEntity || jest.fn();\n mockFacade.saveNewEntity = mockFacade.saveNewEntity || jest.fn();\n mockFacade.updateExistingEntity = mockFacade.updateExistingEntity || jest.fn();\n return mockFacade;\n}\n","import { readFirst } from 'imng-ngrx-utils/testing';\nimport { Observable } from 'rxjs';\n\nexport async function testAddSetAndClearCurrentEntity\n <TFacade extends TestableFacade>(facade: TFacade): Promise<void> {\n const entity = { name: '🆕' };\n await validateInitialState(facade);\n\n facade.setCurrentEntity(entity, { name: 'parentEntity' });\n let status = await getEntityStatus(facade);\n expect(status.currentEntity).toStrictEqual(entity);\n expect(status.isEditActive).toBeFalsy();\n expect(status.isNewActive).toBeTruthy();\n\n facade.clearCurrentEntity();\n status = await getEntityStatus(facade);\n expect(status.currentEntity).toBeFalsy();\n expect(status.isEditActive).toBeFalsy();\n expect(status.isNewActive).toBeFalsy();\n}\n\nexport async function testEditSetAndClearCurrentEntity<TFacade extends TestableFacade>(\n facade: TFacade,\n): Promise<void> {\n const entity = { id: '💃', name: '🧓👴👵' };\n await validateInitialState(facade);\n\n facade.setCurrentEntity(entity, { name: 'parentEntity' });\n let status = await getEntityStatus(facade);\n expect(status.currentEntity).toStrictEqual(entity);\n expect(status.isEditActive).toBeTruthy();\n expect(status.isNewActive).toBeFalsy();\n\n facade.clearCurrentEntity();\n status = await getEntityStatus(facade);\n expect(status.currentEntity).toBeFalsy();\n expect(status.isEditActive).toBeFalsy();\n expect(status.isNewActive).toBeFalsy();\n}\nasync function validateInitialState(facade: TestableFacade): Promise<void> {\n const status = await getEntityStatus(facade);\n expect(status.currentEntity).toBeFalsy();\n expect(status.isEditActive).toBeFalsy();\n expect(status.isNewActive).toBeFalsy();\n}\n\nasync function getEntityStatus<TFacade extends TestableFacade>(facade: TFacade): Promise<{\n currentEntity: unknown,\n isEditActive: unknown,\n isNewActive: unknown;\n}> {\n return {\n currentEntity: await readFirst(facade.currentEntity$),\n isEditActive: await readFirst(facade.isEditActive$),\n isNewActive: await readFirst(facade.isNewActive$),\n };\n}\n\nexport interface TestableFacade {\n currentEntity$: Observable<unknown>;\n isEditActive$: Observable<boolean>;\n isNewActive$: Observable<boolean>;\n setCurrentEntity(entity: unknown, parentEntity?: unknown): void;\n clearCurrentEntity(): void;\n}\n","import { HttpClient } from '@angular/common/http';\nimport { of } from 'rxjs';\n\nexport async function testSaveCurrentEntity<TFacade extends { saveNewEntity(entity: unknown): void; }>(\n facade: TFacade,\n httpClient: HttpClient,\n): Promise<void> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const entity: any = { name: '🆕' };\n httpClient.post = jest.fn(() => of(entity));\n httpClient.put = jest.fn(() => of(entity));\n httpClient.delete = jest.fn(() => of(entity));\n\n facade.saveNewEntity(entity);\n expect(httpClient.post).toBeCalledTimes(1);\n expect(httpClient.put).toBeCalledTimes(0);\n expect(httpClient.delete).toBeCalledTimes(0);\n}\n\nexport async function testUpdateCurrentEntity<TFacade extends { updateExistingEntity(entity: unknown): void; }>(\n facade: TFacade,\n httpClient: HttpClient,\n): Promise<void> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const entity: any = { id: '💃', name: '🧓👴👵' };\n\n httpClient.post = jest.fn(() => of(entity));\n httpClient.put = jest.fn(() => of(entity));\n httpClient.delete = jest.fn(() => of(entity));\n\n facade.updateExistingEntity(entity);\n expect(httpClient.put).toBeCalledTimes(1);\n expect(httpClient.post).toBeCalledTimes(0);\n expect(httpClient.delete).toBeCalledTimes(0);\n\n}\n","import { HttpClient } from '@angular/common/http';\nimport { of } from 'rxjs';\n\nexport async function testDeleteCurrentEntity<TFacade extends { deleteExistingEntity(entity: unknown): void; }>(\n facade: TFacade,\n httpClient: HttpClient,\n): Promise<void> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const entity: any = { id: '💃', name: '🧓👴👵' };\n\n httpClient.post = jest.fn();\n httpClient.put = jest.fn();\n httpClient.delete = jest.fn(() => of(entity));\n\n facade.deleteExistingEntity(entity);\n expect(httpClient.put).toBeCalledTimes(0);\n expect(httpClient.post).toBeCalledTimes(0);\n expect(httpClient.delete).toBeCalledTimes(1);\n\n}\n","// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries\nimport { IDataDeleteFacade } from 'imng-kendo-data-entry';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class DataDeleteMockFacade implements IDataDeleteFacade<any> {\n deleteExistingEntity = jest.fn();\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types,@typescript-eslint/no-explicit-any\nexport function createDataDeleteMockFacade(mockFacade?: IDataDeleteFacade<object> | any): IDataDeleteFacade<object> {\n const localFacade = new DataDeleteMockFacade();\n if (!mockFacade) {\n return localFacade;\n }\n mockFacade.deleteExistingEntity = mockFacade.deleteExistingEntity || jest.fn();\n return mockFacade;\n}\n","import { ComponentFixture } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\n\nexport function triggerSaveClickEvent<TComponent>(fixture: ComponentFixture<TComponent>): void {\n const typeAhead = fixture.debugElement.query(By.css('#btnSave'));\n typeAhead.triggerEventHandler('click', {});\n}\nexport function triggerCancelClickEvent<TComponent>(fixture: ComponentFixture<TComponent>): void {\n const typeAhead = fixture.debugElement.query(By.css('#btnCancel'));\n typeAhead.triggerEventHandler('click', {});\n}\n","// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries\nimport { BaseDataEntryComponent } from 'imng-kendo-data-entry';\nimport { DataEntryMockFacade } from './data-entry-mock.facade';\n\nexport class MockDataEntryComponent extends BaseDataEntryComponent<DataEntryMockFacade> {\n public dialogTitle = 'MockDataEntryComponent';\n public props = {};\n public initForm = jest.fn();\n public save = () => jest.fn();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;AAIA;MACa,mBAAmB;IAAhC;QACS,aAAQ,GAAwB,EAAE,CAAC,KAAK,CAAC,CAAC;;QAE1C,mBAAc,GAAuB,EAAE,CAAC,IAAI,CAAC,CAAC;QAC9C,kBAAa,GAAwB,EAAE,CAAC,KAAK,CAAC,CAAC;QAC/C,iBAAY,GAAwB,EAAE,CAAC,KAAK,CAAC,CAAC;QAC9C,qBAAgB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC7B,uBAAkB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC/B,kBAAa,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC1B,yBAAoB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;KACzC;CAAA;AAED;SACgB,yBAAyB,CAAC,UAA2C;IACnF,MAAM,WAAW,GAAG,IAAI,mBAAmB,EAAE,CAAC;IAC9C,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,WAAW,CAAC;KACpB;IACD,UAAU,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC;IAClE,UAAU,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,IAAI,WAAW,CAAC,cAAc,CAAC;IACpF,UAAU,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,IAAI,WAAW,CAAC,aAAa,CAAC;IACjF,UAAU,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,IAAI,WAAW,CAAC,YAAY,CAAC;IAC9E,UAAU,CAAC,gBAAgB,GAAG,UAAU,CAAC,gBAAgB,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;IACvE,UAAU,CAAC,kBAAkB,GAAG,UAAU,CAAC,kBAAkB,IAAI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E,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IACjE,SAAS,CAAC,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC;SACe,uBAAuB,CAAa,OAAqC;IACvF,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;IACnE,SAAS,CAAC,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC7C;;ACVA;MAIa,sBAAuB,SAAQ,sBAA2C;IAAvF;;QACS,gBAAW,GAAG,wBAAwB,CAAC;QACvC,UAAK,GAAG,EAAE,CAAC;QACX,aAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACrB,SAAI,GAAG,MAAM,IAAI,CAAC,EAAE,EAAE,CAAC;KAC/B;;;ACTD;;;;;;"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Directive, Inject, Input, TemplateRef, Component, ChangeDetectionStrategy, ContentChild, NgModule } from '@angular/core';
|
|
3
|
+
import * as i2 from '@angular/common';
|
|
2
4
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { DialogModule } from '@progress/kendo-angular-dialog';
|
|
4
5
|
import { BehaviorSubject } from 'rxjs';
|
|
6
|
+
import { Subscriptions } from 'imng-ngrx-utils';
|
|
7
|
+
import * as i1 from '@progress/kendo-angular-dialog';
|
|
8
|
+
import { DialogModule } from '@progress/kendo-angular-dialog';
|
|
5
9
|
import { filter, take, tap } from 'rxjs/operators';
|
|
6
10
|
|
|
11
|
+
const FACADE = new InjectionToken('imng-data-entry-facade');
|
|
7
12
|
/**
|
|
8
13
|
* The extending class has to implement the following properties on ngInit
|
|
9
14
|
* dialogTitle: string - This will be the text displayed at the top of the modal title bar
|
|
@@ -14,12 +19,12 @@ import { filter, take, tap } from 'rxjs/operators';
|
|
|
14
19
|
* active$: Observable<boolean> - This typically would be assigned to the isNewActive$ or isEditActive on the facade
|
|
15
20
|
* addEditForm: FormGroup - This will be created by your component
|
|
16
21
|
*
|
|
17
|
-
* @class BaseDataEntryComponent
|
|
22
|
+
* @class BaseDataEntryComponent>
|
|
18
23
|
*/
|
|
19
24
|
class BaseDataEntryComponent {
|
|
20
25
|
constructor(facade) {
|
|
21
26
|
this.facade = facade;
|
|
22
|
-
this.allSubscriptions =
|
|
27
|
+
this.allSubscriptions = new Subscriptions();
|
|
23
28
|
this._submitted$ = new BehaviorSubject(false);
|
|
24
29
|
this.loading$ = this.facade.loading$;
|
|
25
30
|
this.initForm();
|
|
@@ -35,12 +40,7 @@ class BaseDataEntryComponent {
|
|
|
35
40
|
return this.addEditForm.controls[controlName].errors;
|
|
36
41
|
}
|
|
37
42
|
ngOnDestroy() {
|
|
38
|
-
this.allSubscriptions.
|
|
39
|
-
if (val !== null) {
|
|
40
|
-
val.unsubscribe();
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
this.allSubscriptions = [];
|
|
43
|
+
this.allSubscriptions.unsubscribeAll();
|
|
44
44
|
}
|
|
45
45
|
closeForm() {
|
|
46
46
|
this.initForm();
|
|
@@ -64,13 +64,35 @@ class BaseDataEntryComponent {
|
|
|
64
64
|
return this.addEditForm.invalid;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
BaseDataEntryComponent
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
BaseDataEntryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: BaseDataEntryComponent, deps: [{ token: FACADE }], target: i0.ɵɵFactoryTarget.Directive });
|
|
68
|
+
BaseDataEntryComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.11", type: BaseDataEntryComponent, inputs: { width: "width", height: "height" }, ngImport: i0 });
|
|
69
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: BaseDataEntryComponent, decorators: [{
|
|
70
|
+
type: Directive
|
|
71
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
72
|
+
type: Inject,
|
|
73
|
+
args: [FACADE]
|
|
74
|
+
}] }]; }, propDecorators: { width: [{
|
|
75
|
+
type: Input
|
|
76
|
+
}], height: [{
|
|
77
|
+
type: Input
|
|
78
|
+
}] } });
|
|
79
|
+
|
|
80
|
+
class DialogButtonsDirective {
|
|
81
|
+
constructor(tpl) {
|
|
82
|
+
this.tpl = tpl;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
DialogButtonsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: DialogButtonsDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
86
|
+
DialogButtonsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.11", type: DialogButtonsDirective, selector: "[imngDialogBtns]", ngImport: i0 });
|
|
87
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: DialogButtonsDirective, decorators: [{
|
|
88
|
+
type: Directive,
|
|
89
|
+
args: [{ selector: '[imngDialogBtns]' }]
|
|
90
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
71
91
|
|
|
72
92
|
class DataEntryDialogComponent {
|
|
73
|
-
constructor() {
|
|
93
|
+
constructor() {
|
|
94
|
+
this.saveButtonText = 'Save';
|
|
95
|
+
}
|
|
74
96
|
ngOnInit() {
|
|
75
97
|
if (!this.parentComponent) {
|
|
76
98
|
throw new TypeError(`The input 'parentComponent' is required`);
|
|
@@ -88,30 +110,69 @@ class DataEntryDialogComponent {
|
|
|
88
110
|
submit() {
|
|
89
111
|
this.parentComponent.onSubmit();
|
|
90
112
|
}
|
|
113
|
+
get dialogActionBtnsCtx() {
|
|
114
|
+
return { $implicit: { cancel: () => this.cancel(), submit: () => this.submit() } };
|
|
115
|
+
}
|
|
91
116
|
}
|
|
92
|
-
DataEntryDialogComponent
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
117
|
+
DataEntryDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: DataEntryDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
118
|
+
DataEntryDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: DataEntryDialogComponent, selector: "imng-data-entry-dialog[parentComponent]", inputs: { width: "width", height: "height", parentComponent: "parentComponent", saveButtonText: "saveButtonText" }, queries: [{ propertyName: "dialogBtnsTemplate", first: true, predicate: DialogButtonsDirective, descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: `<kendo-dialog [width]="width" [height]="height" (close)="close()">
|
|
119
|
+
<kendo-dialog-titlebar class="bg-primary">{{ dialogTitle }}</kendo-dialog-titlebar>
|
|
120
|
+
<ng-content></ng-content>
|
|
121
|
+
<kendo-dialog-actions>
|
|
122
|
+
<ng-container *ngTemplateOutlet="dialogBtnsTemplate || defaultDialogActionsTpl; context: dialogActionBtnsCtx">
|
|
123
|
+
</ng-container>
|
|
124
|
+
</kendo-dialog-actions>
|
|
125
|
+
</kendo-dialog>
|
|
126
|
+
|
|
127
|
+
<ng-template #defaultDialogActionsTpl>
|
|
128
|
+
<button id="btnCancel" class="k-button" (click)="cancel()">Cancel</button>
|
|
129
|
+
<button id="btnSave" class="k-button k-primary" (click)="submit()">{{ saveButtonText }}</button>
|
|
130
|
+
</ng-template>`, isInline: true, components: [{ type: i1.DialogComponent, selector: "kendo-dialog", inputs: ["actionsLayout", "actions", "autoFocusedElement", "title", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight"], outputs: ["action", "close"], exportAs: ["kendoDialog"] }, { type: i1.DialogTitleBarComponent, selector: "kendo-dialog-titlebar", inputs: ["id", "closeTitle"], outputs: ["close"] }, { type: i1.DialogActionsComponent, selector: "kendo-dialog-actions", inputs: ["layout", "actions"], outputs: ["action"] }], directives: [{ type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: DataEntryDialogComponent, decorators: [{
|
|
132
|
+
type: Component,
|
|
133
|
+
args: [{
|
|
134
|
+
selector: 'imng-data-entry-dialog[parentComponent]',
|
|
135
|
+
template: `<kendo-dialog [width]="width" [height]="height" (close)="close()">
|
|
136
|
+
<kendo-dialog-titlebar class="bg-primary">{{ dialogTitle }}</kendo-dialog-titlebar>
|
|
137
|
+
<ng-content></ng-content>
|
|
138
|
+
<kendo-dialog-actions>
|
|
139
|
+
<ng-container *ngTemplateOutlet="dialogBtnsTemplate || defaultDialogActionsTpl; context: dialogActionBtnsCtx">
|
|
140
|
+
</ng-container>
|
|
141
|
+
</kendo-dialog-actions>
|
|
142
|
+
</kendo-dialog>
|
|
143
|
+
|
|
144
|
+
<ng-template #defaultDialogActionsTpl>
|
|
145
|
+
<button id="btnCancel" class="k-button" (click)="cancel()">Cancel</button>
|
|
146
|
+
<button id="btnSave" class="k-button k-primary" (click)="submit()">{{ saveButtonText }}</button>
|
|
147
|
+
</ng-template>`,
|
|
148
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
149
|
+
}]
|
|
150
|
+
}], propDecorators: { width: [{
|
|
151
|
+
type: Input
|
|
152
|
+
}], height: [{
|
|
153
|
+
type: Input
|
|
154
|
+
}], parentComponent: [{
|
|
155
|
+
type: Input
|
|
156
|
+
}], saveButtonText: [{
|
|
157
|
+
type: Input
|
|
158
|
+
}], dialogBtnsTemplate: [{
|
|
159
|
+
type: ContentChild,
|
|
160
|
+
args: [DialogButtonsDirective, { static: true, read: TemplateRef }]
|
|
161
|
+
}] } });
|
|
105
162
|
|
|
106
163
|
class ImngDataEntryDialogModule {
|
|
107
164
|
}
|
|
108
|
-
ImngDataEntryDialogModule
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
]
|
|
165
|
+
ImngDataEntryDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ImngDataEntryDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
166
|
+
ImngDataEntryDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ImngDataEntryDialogModule, declarations: [DataEntryDialogComponent, DialogButtonsDirective], imports: [CommonModule, DialogModule], exports: [DataEntryDialogComponent, DialogButtonsDirective] });
|
|
167
|
+
ImngDataEntryDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ImngDataEntryDialogModule, imports: [[CommonModule, DialogModule]] });
|
|
168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: ImngDataEntryDialogModule, decorators: [{
|
|
169
|
+
type: NgModule,
|
|
170
|
+
args: [{
|
|
171
|
+
imports: [CommonModule, DialogModule],
|
|
172
|
+
declarations: [DataEntryDialogComponent, DialogButtonsDirective],
|
|
173
|
+
exports: [DataEntryDialogComponent, DialogButtonsDirective],
|
|
174
|
+
}]
|
|
175
|
+
}] });
|
|
115
176
|
|
|
116
177
|
function updateStateCollectionItem(collection, item) {
|
|
117
178
|
const items = [...collection];
|
|
@@ -137,5 +198,5 @@ const formGroupPatcher = (addEditForm) => (source) => source.pipe(filter(t => !!
|
|
|
137
198
|
* Generated bundle index. Do not edit.
|
|
138
199
|
*/
|
|
139
200
|
|
|
140
|
-
export { BaseDataEntryComponent, DataEntryDialogComponent, ImngDataEntryDialogModule, addStateCollectionItem, formGroupPatcher, removeStateCollectionItem, updateStateCollectionItem };
|
|
201
|
+
export { BaseDataEntryComponent, DataEntryDialogComponent, DialogButtonsDirective, ImngDataEntryDialogModule, addStateCollectionItem, formGroupPatcher, removeStateCollectionItem, updateStateCollectionItem };
|
|
141
202
|
//# sourceMappingURL=imng-kendo-data-entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imng-kendo-data-entry.js","sources":["../src/lib/base-data-entry.component.ts","../src/lib/data-entry-dialog.component.ts","../src/lib/data-entry.module.ts","../src/lib/reducer-collection-logic.ts","../src/lib/form-group-patcher.ts","../../../../libs/imng-kendo-data-entry/src/imng-kendo-data-entry.ts"],"sourcesContent":["import { OnDestroy, Input } from '@angular/core';\nimport { Observable, Subscription, BehaviorSubject } from 'rxjs';\nimport { FormGroup, AbstractControl } from '@angular/forms';\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<ENTITY, FACADE extends DataEntryFacade<ENTITY>>\n */\n\nexport abstract class BaseDataEntryComponent<\n ENTITY,\n FACADE extends {\n loading$: Observable<boolean>;\n clearCurrentEntity(): void;\n }\n > implements OnDestroy {\n @Input() public width: string | number;\n @Input() public height: string | number;\n public allSubscriptions: Subscription[] = [];\n public abstract dialogTitle: string;\n public abstract props: any;\n public addEditForm: FormGroup;\n public loading$: Observable<boolean>;\n private readonly _submitted$: BehaviorSubject<boolean> = new BehaviorSubject(false);\n\n public get submitted$(): Observable<boolean> {\n return this._submitted$.asObservable();\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): any {\n return this.addEditForm.controls[controlName].errors;\n }\n\n constructor(protected facade: FACADE) {\n this.loading$ = this.facade.loading$;\n this.initForm();\n }\n\n public ngOnDestroy(): void {\n this.allSubscriptions.forEach(val => {\n if (val !== null) {\n val.unsubscribe();\n }\n });\n this.allSubscriptions = [];\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.isDataInvalid()) {\n console.log('form validation errors.');\n return;\n }\n this.save();\n this.closeForm();\n }\n\n protected isDataInvalid(): boolean {\n return this.addEditForm.invalid;\n }\n\n public abstract initForm(): void;\n public abstract save(): void;\n}\n","import { Component, OnInit, Input, ChangeDetectionStrategy } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { FormGroup } from '@angular/forms';\nimport { BaseDataEntryComponent } from './base-data-entry.component';\n\n@Component({\n selector: 'imng-data-entry-dialog[parentComponent]',\n templateUrl: './data-entry-dialog.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DataEntryDialogComponent implements OnInit {\n @Input() public width: string | number;\n @Input() public height: string | number;\n @Input() public parentComponent: BaseDataEntryComponent<any, any>;\n public loading$: Observable<boolean>;\n public addEditForm: FormGroup;\n public submitted: boolean;\n public dialogTitle: string;\n component: {};\n\n constructor() { }\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}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { DialogModule } from '@progress/kendo-angular-dialog';\nimport { DataEntryDialogComponent } from './data-entry-dialog.component';\n\n@NgModule({\n imports: [CommonModule, DialogModule],\n declarations: [DataEntryDialogComponent],\n exports: [DataEntryDialogComponent],\n})\nexport class ImngDataEntryDialogModule {}\n","export function updateStateCollectionItem<Entity extends { id?: string | number | Date; }>(\n collection: Entity[],\n item: Entity,\n): Entity[] {\n const items = [...collection];\n const index = collection.indexOf(collection.find(val => val.id === item.id));\n items.splice(index, 1, item);\n return items;\n}\n\nexport function removeStateCollectionItem<Entity extends { id?: string | number | Date; }>(\n collection: Entity[],\n item: Entity,\n): Entity[] {\n const items = [...collection];\n const index = collection.indexOf(collection.find(val => val.id === item.id));\n items.splice(index, 1);\n return items;\n}\n\nexport function addStateCollectionItem<Entity extends { id?: string | number | Date; }>(collection: Entity[], item: Entity): 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 = <TEntity>(addEditForm: FormGroup) => (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":";;;;;;AAIA;;;;;;;;;;;;MAasB,sBAAsB;IA2B1C,YAAsB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAlB7B,qBAAgB,GAAmB,EAAE,CAAC;QAK5B,gBAAW,GAA6B,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;QAclF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QACrC,IAAI,CAAC,QAAQ,EAAE,CAAC;KACjB;IAdD,IAAW,UAAU;QACnB,OAAO,IAA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KAAK,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7E,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACvB,OAAO,KAAK,CAAC;AACf,CAAC;SAEe,sBAAsB,CAAkD,UAAoB,EAAE,IAAY;IACxH,MAAM,KAAK,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC;IAC9B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf;;MCpBa,gBAAgB,GAAG,CAAU,WAAsB,KAAK,CAAC,MAA2B,KAC/F,MAAM,CAAC,IAAI,CACT,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAChB,IAAI,CAAC,CAAC,CAAC,EACP,GAAG,CAAC,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;;ACRvC;;;;;;"}
|
|
1
|
+
{"version":3,"file":"imng-kendo-data-entry.js","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/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 { Directive, Inject, InjectionToken, Input, OnDestroy } from '@angular/core';\nimport { Observable, BehaviorSubject } from 'rxjs';\nimport { FormGroup, AbstractControl, ValidationErrors } from '@angular/forms';\nimport { IBaseDataEntryFacade } from './data-entry-facade';\nimport { Subscribable, Subscriptions } from 'imng-ngrx-utils';\n\nconst FACADE = new InjectionToken<IBaseDataEntryFacade>('imng-data-entry-facade');\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<FACADE extends IBaseDataEntryFacade> implements OnDestroy, Subscribable {\n @Input() public width: string | number;\n @Input() public height: string | number;\n\n public allSubscriptions = new Subscriptions();\n public abstract dialogTitle: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public abstract props: any;\n public addEditForm: FormGroup;\n public loading$: Observable<boolean>;\n private readonly _submitted$: BehaviorSubject<boolean> = new BehaviorSubject(false);\n\n public get submitted$(): Observable<boolean> {\n return this._submitted$.asObservable();\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 {\n return this.addEditForm.controls[controlName].errors;\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.isDataInvalid()) {\n console.log('form validation errors.');\n return;\n }\n this.save();\n this.closeForm();\n }\n\n public isDataInvalid(): boolean {\n return this.addEditForm.invalid;\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 { Component, OnInit, Input, ChangeDetectionStrategy, TemplateRef, ContentChild } 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 [width]=\"width\" [height]=\"height\" (close)=\"close()\">\n <kendo-dialog-titlebar class=\"bg-primary\">{{ dialogTitle }}</kendo-dialog-titlebar>\n <ng-content></ng-content>\n <kendo-dialog-actions>\n <ng-container *ngTemplateOutlet=\"dialogBtnsTemplate || defaultDialogActionsTpl; context: dialogActionBtnsCtx\">\n </ng-container>\n </kendo-dialog-actions>\n </kendo-dialog>\n\n <ng-template #defaultDialogActionsTpl>\n <button id=\"btnCancel\" class=\"k-button\" (click)=\"cancel()\">Cancel</button>\n <button id=\"btnSave\" class=\"k-button k-primary\" (click)=\"submit()\">{{ saveButtonText }}</button>\n </ng-template>`,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DataEntryDialogComponent implements OnInit {\n @Input() public width: string | number;\n @Input() public height: string | number;\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 public dialogBtnsTemplate: TemplateRef<unknown>;\n public loading$: Observable<boolean>;\n public addEditForm: FormGroup;\n public submitted: boolean;\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(): unknown {\n return { $implicit: { cancel: () => this.cancel(), submit: () => this.submit() } };\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.indexOf(collection.find(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.indexOf(collection.find(val => val.id === item.id));\n items.splice(index, 1);\n return items;\n}\n\nexport function addStateCollectionItem<Entity extends { id?: ValueType; }>(collection: Entity[], item: Entity): 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 = <TEntity>(addEditForm: FormGroup) => (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":";;;;;;;;;;AAMA,MAAM,MAAM,GAAG,IAAI,cAAc,CAAuB,wBAAwB,CAAC,CAAC;AAElF;;;;;;;;;;;;MAasB,sBAAsB;IAsB1C,YAA4C,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAlBnD,qBAAgB,GAAG,IAAI,aAAa,EAAE,CAAC;QAM7B,gBAAW,GAA6B,IAAI,eAAe,CAAC,KAAK,CAAC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AAoB,EAAE,IAAY;IAC3G,MAAM,KAAK,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC;IAC9B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf;;MCrBa,gBAAgB,GAAG,CAAU,WAAsB,KAAK,CAAC,MAA2B,KAC/F,MAAM,CAAC,IAAI,CACT,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAChB,IAAI,CAAC,CAAC,CAAC,EACP,GAAG,CAAC,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;;ACRvC;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imng-kendo-data-entry.d.ts","sourceRoot":"","sources":["../../../libs/imng-kendo-data-entry/src/imng-kendo-data-entry.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,SAAS,CAAC"}
|
package/index.d.ts
CHANGED
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../libs/imng-kendo-data-entry/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { OnDestroy } from '@angular/core';
|
|
2
|
-
import { Observable
|
|
3
|
-
import { FormGroup, AbstractControl } from '@angular/forms';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { FormGroup, AbstractControl, ValidationErrors } from '@angular/forms';
|
|
4
|
+
import { IBaseDataEntryFacade } from './data-entry-facade';
|
|
5
|
+
import { Subscribable, Subscriptions } from 'imng-ngrx-utils';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
4
7
|
/**
|
|
5
8
|
* The extending class has to implement the following properties on ngInit
|
|
6
9
|
* dialogTitle: string - This will be the text displayed at the top of the modal title bar
|
|
@@ -11,16 +14,13 @@ import { FormGroup, AbstractControl } from '@angular/forms';
|
|
|
11
14
|
* active$: Observable<boolean> - This typically would be assigned to the isNewActive$ or isEditActive on the facade
|
|
12
15
|
* addEditForm: FormGroup - This will be created by your component
|
|
13
16
|
*
|
|
14
|
-
* @class BaseDataEntryComponent
|
|
17
|
+
* @class BaseDataEntryComponent>
|
|
15
18
|
*/
|
|
16
|
-
export declare abstract class BaseDataEntryComponent<
|
|
17
|
-
|
|
18
|
-
clearCurrentEntity(): void;
|
|
19
|
-
}> implements OnDestroy {
|
|
20
|
-
protected facade: FACADE;
|
|
19
|
+
export declare abstract class BaseDataEntryComponent<FACADE extends IBaseDataEntryFacade> implements OnDestroy, Subscribable {
|
|
20
|
+
readonly facade: FACADE;
|
|
21
21
|
width: string | number;
|
|
22
22
|
height: string | number;
|
|
23
|
-
allSubscriptions:
|
|
23
|
+
allSubscriptions: Subscriptions;
|
|
24
24
|
abstract dialogTitle: string;
|
|
25
25
|
abstract props: any;
|
|
26
26
|
addEditForm: FormGroup;
|
|
@@ -28,13 +28,16 @@ export declare abstract class BaseDataEntryComponent<ENTITY, FACADE extends {
|
|
|
28
28
|
private readonly _submitted$;
|
|
29
29
|
get submitted$(): Observable<boolean>;
|
|
30
30
|
formControl(controlName: string): AbstractControl;
|
|
31
|
-
formControlErrors(controlName: string):
|
|
31
|
+
formControlErrors(controlName: string): ValidationErrors;
|
|
32
32
|
constructor(facade: FACADE);
|
|
33
33
|
ngOnDestroy(): void;
|
|
34
34
|
closeForm(): void;
|
|
35
35
|
onCancel(): void;
|
|
36
36
|
onSubmit(): void;
|
|
37
|
-
|
|
37
|
+
isDataInvalid(): boolean;
|
|
38
38
|
abstract initForm(): void;
|
|
39
39
|
abstract save(): void;
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseDataEntryComponent<any>, never>;
|
|
41
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseDataEntryComponent<any>, never, never, { "width": "width"; "height": "height"; }, {}, never>;
|
|
40
42
|
}
|
|
43
|
+
//# sourceMappingURL=base-data-entry.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-data-entry.component.d.ts","sourceRoot":"","sources":["../../../../libs/imng-kendo-data-entry/src/lib/base-data-entry.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,SAAS,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,UAAU,EAAmB,MAAM,MAAM,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;;AAI9D;;;;;;;;;;;GAWG;AACH,8BACsB,sBAAsB,CAAC,MAAM,SAAS,oBAAoB,CAAE,YAAW,SAAS,EAAE,YAAY;aAsBtE,MAAM,EAAE,MAAM;IArB1C,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAEjC,gBAAgB,gBAAuB;IAC9C,SAAgB,WAAW,EAAE,MAAM,CAAC;IAEpC,SAAgB,KAAK,EAAE,GAAG,CAAC;IACpB,WAAW,EAAE,SAAS,CAAC;IACvB,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAwD;IAEpF,IAAW,UAAU,IAAI,UAAU,CAAC,OAAO,CAAC,CAE3C;IAEM,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe;IAGjD,iBAAiB,CAAC,WAAW,EAAE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