@pepperi-addons/ngx-composite-lib 0.4.1-beta.11 → 0.4.1-beta.13

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.
Files changed (125) hide show
  1. package/color-settings/color-settings.component.d.ts +25 -25
  2. package/color-settings/color-settings.model.d.ts +6 -6
  3. package/color-settings/color-settings.module.d.ts +12 -12
  4. package/color-settings/index.d.ts +5 -5
  5. package/color-settings/public-api.d.ts +3 -3
  6. package/core/common/directives/index.d.ts +1 -1
  7. package/core/common/directives/public-api.d.ts +1 -1
  8. package/core/common/directives/reset-configuration-field.directive.d.ts +39 -39
  9. package/core/common/index.d.ts +1 -1
  10. package/core/common/public-api.d.ts +2 -2
  11. package/core/common/services/dimx.service.d.ts +46 -46
  12. package/core/common/services/index.d.ts +1 -1
  13. package/core/common/services/public-api.d.ts +2 -2
  14. package/core/common/services/utilities.service.d.ts +6 -6
  15. package/core/index.d.ts +1 -1
  16. package/core/public-api.d.ts +1 -1
  17. package/data-view-builder/data-view-builder.component.d.ts +35 -35
  18. package/data-view-builder/data-view-builder.model.d.ts +1 -1
  19. package/data-view-builder/data-view-builder.module.d.ts +23 -23
  20. package/data-view-builder/data-view-builder.service.d.ts +14 -14
  21. package/data-view-builder/index.d.ts +5 -5
  22. package/data-view-builder/menu-data-view/menu-data-view.component.d.ts +36 -36
  23. package/data-view-builder/public-api.d.ts +3 -3
  24. package/esm2020/color-settings/color-settings.component.mjs +86 -86
  25. package/esm2020/color-settings/color-settings.model.mjs +8 -8
  26. package/esm2020/color-settings/color-settings.module.mjs +37 -37
  27. package/esm2020/color-settings/pepperi-addons-ngx-composite-lib-color-settings.mjs +4 -4
  28. package/esm2020/color-settings/public-api.mjs +6 -6
  29. package/esm2020/core/common/directives/index.mjs +4 -4
  30. package/esm2020/core/common/directives/public-api.mjs +4 -4
  31. package/esm2020/core/common/directives/reset-configuration-field.directive.mjs +135 -135
  32. package/esm2020/core/common/index.mjs +4 -4
  33. package/esm2020/core/common/public-api.mjs +5 -5
  34. package/esm2020/core/common/services/dimx.service.mjs +63 -63
  35. package/esm2020/core/common/services/index.mjs +4 -4
  36. package/esm2020/core/common/services/public-api.mjs +5 -5
  37. package/esm2020/core/common/services/utilities.service.mjs +18 -18
  38. package/esm2020/core/index.mjs +4 -4
  39. package/esm2020/core/public-api.mjs +4 -4
  40. package/esm2020/data-view-builder/data-view-builder.component.mjs +116 -116
  41. package/esm2020/data-view-builder/data-view-builder.model.mjs +1 -1
  42. package/esm2020/data-view-builder/data-view-builder.module.mjs +79 -79
  43. package/esm2020/data-view-builder/data-view-builder.service.mjs +38 -38
  44. package/esm2020/data-view-builder/menu-data-view/menu-data-view.component.mjs +116 -116
  45. package/esm2020/data-view-builder/pepperi-addons-ngx-composite-lib-data-view-builder.mjs +4 -4
  46. package/esm2020/data-view-builder/public-api.mjs +6 -6
  47. package/esm2020/file-status-panel/file-status-panel.component.mjs +34 -34
  48. package/esm2020/file-status-panel/file-status-panel.model.mjs +8 -8
  49. package/esm2020/file-status-panel/file-status-panel.module.mjs +53 -53
  50. package/esm2020/file-status-panel/pepperi-addons-ngx-composite-lib-file-status-panel.mjs +4 -4
  51. package/esm2020/file-status-panel/public-api.mjs +6 -6
  52. package/esm2020/generic-form/generic-form.component.mjs +189 -189
  53. package/esm2020/generic-form/generic-form.model.mjs +1 -1
  54. package/esm2020/generic-form/generic-form.module.mjs +67 -67
  55. package/esm2020/generic-form/generic-form.service.mjs +57 -57
  56. package/esm2020/generic-form/pepperi-addons-ngx-composite-lib-generic-form.mjs +4 -4
  57. package/esm2020/generic-form/public-api.mjs +7 -7
  58. package/esm2020/generic-list/generic-list.component.mjs +458 -458
  59. package/esm2020/generic-list/generic-list.model.mjs +1 -1
  60. package/esm2020/generic-list/generic-list.module.mjs +106 -106
  61. package/esm2020/generic-list/generic-list.service.mjs +136 -136
  62. package/esm2020/generic-list/pepperi-addons-ngx-composite-lib-generic-list.mjs +4 -4
  63. package/esm2020/generic-list/public-api.mjs +7 -7
  64. package/esm2020/group-buttons-settings/group-buttons-settings.component.mjs +129 -129
  65. package/esm2020/group-buttons-settings/group-buttons-settings.model.mjs +1 -1
  66. package/esm2020/group-buttons-settings/group-buttons-settings.module.mjs +47 -47
  67. package/esm2020/group-buttons-settings/pepperi-addons-ngx-composite-lib-group-buttons-settings.mjs +4 -4
  68. package/esm2020/group-buttons-settings/public-api.mjs +6 -6
  69. package/esm2020/ngx-composite-lib.module.mjs +53 -53
  70. package/esm2020/pepperi-addons-ngx-composite-lib.mjs +4 -4
  71. package/esm2020/public-api.mjs +5 -5
  72. package/esm2020/shadow-settings/pepperi-addons-ngx-composite-lib-shadow-settings.mjs +4 -4
  73. package/esm2020/shadow-settings/public-api.mjs +6 -6
  74. package/esm2020/shadow-settings/shadow-settings.component.mjs +68 -68
  75. package/esm2020/shadow-settings/shadow-settings.model.mjs +7 -7
  76. package/esm2020/shadow-settings/shadow-settings.module.mjs +41 -41
  77. package/fesm2015/pepperi-addons-ngx-composite-lib-color-settings.mjs +116 -116
  78. package/fesm2015/pepperi-addons-ngx-composite-lib-data-view-builder.mjs +309 -309
  79. package/fesm2015/pepperi-addons-ngx-composite-lib-data-view-builder.mjs.map +1 -1
  80. package/fesm2015/pepperi-addons-ngx-composite-lib-file-status-panel.mjs +80 -80
  81. package/fesm2015/pepperi-addons-ngx-composite-lib-generic-form.mjs +285 -285
  82. package/fesm2015/pepperi-addons-ngx-composite-lib-generic-list.mjs +674 -674
  83. package/fesm2015/pepperi-addons-ngx-composite-lib-group-buttons-settings.mjs +164 -164
  84. package/fesm2015/pepperi-addons-ngx-composite-lib-shadow-settings.mjs +101 -101
  85. package/fesm2015/pepperi-addons-ngx-composite-lib.mjs +271 -271
  86. package/fesm2020/pepperi-addons-ngx-composite-lib-color-settings.mjs +116 -116
  87. package/fesm2020/pepperi-addons-ngx-composite-lib-data-view-builder.mjs +307 -307
  88. package/fesm2020/pepperi-addons-ngx-composite-lib-data-view-builder.mjs.map +1 -1
  89. package/fesm2020/pepperi-addons-ngx-composite-lib-file-status-panel.mjs +78 -78
  90. package/fesm2020/pepperi-addons-ngx-composite-lib-generic-form.mjs +287 -287
  91. package/fesm2020/pepperi-addons-ngx-composite-lib-generic-list.mjs +656 -656
  92. package/fesm2020/pepperi-addons-ngx-composite-lib-group-buttons-settings.mjs +163 -163
  93. package/fesm2020/pepperi-addons-ngx-composite-lib-shadow-settings.mjs +101 -101
  94. package/fesm2020/pepperi-addons-ngx-composite-lib.mjs +264 -264
  95. package/file-status-panel/file-status-panel.component.d.ts +14 -14
  96. package/file-status-panel/file-status-panel.model.d.ts +7 -7
  97. package/file-status-panel/file-status-panel.module.d.ts +17 -17
  98. package/file-status-panel/index.d.ts +5 -5
  99. package/file-status-panel/public-api.d.ts +3 -3
  100. package/generic-form/generic-form.component.d.ts +43 -43
  101. package/generic-form/generic-form.model.d.ts +42 -42
  102. package/generic-form/generic-form.module.d.ts +13 -13
  103. package/generic-form/generic-form.service.d.ts +15 -15
  104. package/generic-form/index.d.ts +5 -5
  105. package/generic-form/public-api.d.ts +4 -4
  106. package/generic-list/generic-list.component.d.ts +109 -109
  107. package/generic-list/generic-list.model.d.ts +66 -66
  108. package/generic-list/generic-list.module.d.ts +25 -25
  109. package/generic-list/generic-list.service.d.ts +44 -44
  110. package/generic-list/index.d.ts +5 -5
  111. package/generic-list/public-api.d.ts +4 -4
  112. package/group-buttons-settings/group-buttons-settings.component.d.ts +33 -33
  113. package/group-buttons-settings/group-buttons-settings.model.d.ts +1 -1
  114. package/group-buttons-settings/group-buttons-settings.module.d.ts +15 -15
  115. package/group-buttons-settings/index.d.ts +5 -5
  116. package/group-buttons-settings/public-api.d.ts +3 -3
  117. package/index.d.ts +5 -5
  118. package/ngx-composite-lib.module.d.ts +13 -13
  119. package/package.json +1 -1
  120. package/public-api.d.ts +2 -2
  121. package/shadow-settings/index.d.ts +5 -5
  122. package/shadow-settings/public-api.d.ts +3 -3
  123. package/shadow-settings/shadow-settings.component.d.ts +23 -23
  124. package/shadow-settings/shadow-settings.model.d.ts +8 -8
  125. package/shadow-settings/shadow-settings.module.d.ts +13 -13
@@ -13,299 +13,299 @@ import { PepTopBarModule } from '@pepperi-addons/ngx-lib/top-bar';
13
13
  import { __awaiter } from 'tslib';
14
14
  import { DataViewConverter } from '@pepperi-addons/data-views';
15
15
 
16
- class PepGenericFormService {
17
- constructor() {
18
- //
19
- }
20
- /**
21
- * checks if the object contains property
22
- * @param obj object
23
- * @param prop property name
24
- * @returns true if contains, false otherwise
25
- */
26
- hasProperty(obj, prop) {
27
- return Object.prototype.hasOwnProperty.call(obj, prop);
28
- }
29
- createFormField(data) {
30
- let field = {};
31
- field.ApiName = data.ApiName;
32
- field.Value = data.controlFieldValue;
33
- field.FieldType = data.FieldType;
34
- field.Enabled = !data.ReadOnly;
35
- field.Visible = !data.Hidden;
36
- field.GroupFields = [];
37
- field.Highlighted = false;
38
- field.OptionalValues = data.OptionalValues;
39
- field.AdditionalProps = data.AdditionalProps;
40
- return field;
41
- }
42
- convertToUiControlField(field) {
43
- return {
44
- ApiName: field.ApiName,
45
- FieldType: field.FieldType,
46
- Title: field.Title,
47
- ReadOnly: field.ReadOnlyField,
48
- Mandatory: field.MandatoryField,
49
- Hidden: field.Hidden,
50
- ColumnWidth: field.ColumnWidth,
51
- ColumnWidthType: 1,
52
- MaxFieldCharacters: field.MaxCharacters,
53
- MinValue: field.MinValue,
54
- MaxValue: field.MaxValue,
55
- Layout: {
56
- X: field.Layout.X,
57
- Y: field.Layout.Y,
58
- Width: field.Layout.Width,
59
- Height: field.Layout.Field_Height,
60
- XAlignment: field.Layout.xAlignment,
61
- YAlignment: field.Layout.yAlignment,
62
- }
63
- };
64
- }
65
- }
66
- PepGenericFormService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
67
- PepGenericFormService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormService });
68
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormService, decorators: [{
69
- type: Injectable
16
+ class PepGenericFormService {
17
+ constructor() {
18
+ //
19
+ }
20
+ /**
21
+ * checks if the object contains property
22
+ * @param obj object
23
+ * @param prop property name
24
+ * @returns true if contains, false otherwise
25
+ */
26
+ hasProperty(obj, prop) {
27
+ return Object.prototype.hasOwnProperty.call(obj, prop);
28
+ }
29
+ createFormField(data) {
30
+ let field = {};
31
+ field.ApiName = data.ApiName;
32
+ field.Value = data.controlFieldValue;
33
+ field.FieldType = data.FieldType;
34
+ field.Enabled = !data.ReadOnly;
35
+ field.Visible = !data.Hidden;
36
+ field.GroupFields = [];
37
+ field.Highlighted = false;
38
+ field.OptionalValues = data.OptionalValues;
39
+ field.AdditionalProps = data.AdditionalProps;
40
+ return field;
41
+ }
42
+ convertToUiControlField(field) {
43
+ return {
44
+ ApiName: field.ApiName,
45
+ FieldType: field.FieldType,
46
+ Title: field.Title,
47
+ ReadOnly: field.ReadOnlyField,
48
+ Mandatory: field.MandatoryField,
49
+ Hidden: field.Hidden,
50
+ ColumnWidth: field.ColumnWidth,
51
+ ColumnWidthType: 1,
52
+ MaxFieldCharacters: field.MaxCharacters,
53
+ MinValue: field.MinValue,
54
+ MaxValue: field.MaxValue,
55
+ Layout: {
56
+ X: field.Layout.X,
57
+ Y: field.Layout.Y,
58
+ Width: field.Layout.Width,
59
+ Height: field.Layout.Field_Height,
60
+ XAlignment: field.Layout.xAlignment,
61
+ YAlignment: field.Layout.yAlignment,
62
+ }
63
+ };
64
+ }
65
+ }
66
+ PepGenericFormService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
67
+ PepGenericFormService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormService });
68
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormService, decorators: [{
69
+ type: Injectable
70
70
  }], ctorParameters: function () { return []; } });
71
71
 
72
- class GenericFormComponent {
73
- constructor(layoutService, _genericFormService) {
74
- this.layoutService = layoutService;
75
- this._genericFormService = _genericFormService;
76
- this.isLocked = false;
77
- this.inline = false;
78
- this.showTopBar = false;
79
- this.addPadding = false;
80
- this.valueChange = new EventEmitter();
81
- this.fieldClick = new EventEmitter();
82
- this.formValidationChange = new EventEmitter();
83
- this.layoutService.onResize$.pipe().subscribe((size) => {
84
- //
85
- });
86
- this._formData = new ObjectsDataRow();
87
- this._uiControl = new UIControl();
88
- }
89
- set pepListContainer(val) {
90
- this._pepFormContainer = val;
91
- }
92
- set dataSource(val) {
93
- this._data = val;
94
- }
95
- set dataView(val) {
96
- this.initForm(val);
97
- }
98
- ngOnInit() {
99
- //
100
- }
101
- initForm(dataView) {
102
- setTimeout(() => __awaiter(this, void 0, void 0, function* () {
103
- var _a;
104
- if (this._pepFormContainer) {
105
- if (this._pepFormContainer.length) {
106
- this._pepFormContainer.remove();
107
- this._formData = new ObjectsDataRow();
108
- this._uiControl = new UIControl();
109
- }
110
- const { PepFormComponent } = yield import('@pepperi-addons/ngx-lib/form');
111
- const componentRef = this._pepFormContainer.createComponent(PepFormComponent);
112
- this._pepForm = componentRef.instance;
113
- this._formData.IsEditable = !this.isLocked;
114
- this._formData.UID = dataView.UID || PepGuid.newGuid();
115
- const uiControlData = DataViewConverter.toUIControlData(dataView);
116
- if (uiControlData) {
117
- if (uiControlData === null || uiControlData === void 0 ? void 0 : uiControlData.ControlFields) {
118
- this._uiControl.ControlFields = uiControlData.ControlFields.map((field) => this._genericFormService.convertToUiControlField(field));
119
- }
120
- this._uiControl.Columns = uiControlData.Columns;
121
- if ((_a = this._uiControl.ControlFields) === null || _a === void 0 ? void 0 : _a.length) {
122
- this._formData.Fields = [];
123
- this._uiControl.ControlFields.forEach((item) => {
124
- var _a;
125
- let value = '';
126
- if (this._genericFormService.hasProperty(this._data, item.ApiName)) {
127
- value = this._data[item.ApiName];
128
- }
129
- let dataViewField;
130
- if (dataView.Fields) {
131
- dataViewField = dataView.Fields.find(field => field.FieldID === item.ApiName);
132
- }
133
- const controlFieldData = Object.assign(Object.assign(Object.assign({}, item), {
134
- controlFieldValue: value
135
- }), {
136
- OptionalValues: ((_a = dataViewField === null || dataViewField === void 0 ? void 0 : dataViewField.OptionalValues) === null || _a === void 0 ? void 0 : _a.length) ? dataViewField.OptionalValues : [],
137
- AdditionalProps: (dataViewField === null || dataViewField === void 0 ? void 0 : dataViewField.AdditionalProps) || null
138
- });
139
- this._formData.Fields.push(this._genericFormService.createFormField(controlFieldData));
140
- });
141
- componentRef.instance.layoutType = 'form';
142
- componentRef.instance.layout = this._uiControl;
143
- componentRef.instance.data = this._formData;
144
- componentRef.instance.isInternal = false;
145
- componentRef.instance.lockFields = this.isLocked;
146
- componentRef.instance.valueChange.subscribe(($event) => {
147
- this.onValueChanged($event);
148
- });
149
- componentRef.instance.fieldClick.subscribe(($event) => {
150
- this.onfieldClicked($event);
151
- });
152
- componentRef.instance.formValidationChange.subscribe(($event) => {
153
- this.onFormValidationChanged($event);
154
- });
155
- }
156
- }
157
- }
158
- }), 0);
159
- }
160
- /**
161
- * updates form field's value
162
- * @param field object containing the data of the required update
163
- */
164
- updateFieldValue(fieldChanged) {
165
- this._data[fieldChanged.ApiName] = fieldChanged.Value;
166
- }
167
- getData() {
168
- return {
169
- UID: this._formData.UID,
170
- Values: this._data
171
- };
172
- }
173
- /**
174
- * updates form field(s) params
175
- * @param fields
176
- */
177
- updateFields(fields) {
178
- // update data view with current data
179
- for (const [key, value] of Object.entries(this._data)) {
180
- const index = this._formData.Fields.findIndex((item) => item.ApiName === key);
181
- if (index >= 0) {
182
- const item = this._formData.Fields[index];
183
- item.Value = value;
184
- }
185
- }
186
- fields.forEach((field) => {
187
- const index = this._formData.Fields.findIndex((item) => item.ApiName === field.FieldId);
188
- if (index >= 0) {
189
- for (const [key, value] of Object.entries(field.Params)) {
190
- if (this._genericFormService.hasProperty(this._formData.Fields[index], key)) {
191
- const item = this._formData.Fields[index];
192
- item[key] = value;
193
- }
194
- }
195
- }
196
- });
197
- this._pepForm.ReloadForm();
198
- this._pepForm.data = this._formData;
199
- }
200
- onValueChanged(event) {
201
- const field = {
202
- UID: event.id,
203
- ApiName: event.key,
204
- Value: event.value
205
- };
206
- this.updateFieldValue(field);
207
- this.valueChange.emit(field);
208
- }
209
- onfieldClicked(event) {
210
- const field = {
211
- UID: event.id,
212
- ApiName: event.key,
213
- Value: event.value
214
- };
215
- this.updateFieldValue(field);
216
- this.fieldClick.emit(field);
217
- }
218
- onFormValidationChanged(event) {
219
- this.formValidationChange.emit(event);
220
- }
221
- }
222
- GenericFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: GenericFormComponent, deps: [{ token: i1.PepLayoutService }, { token: PepGenericFormService }], target: i0.ɵɵFactoryTarget.Component });
223
- GenericFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: GenericFormComponent, selector: "pep-generic-form", inputs: { dataSource: "dataSource", dataView: "dataView", isLocked: "isLocked", inline: "inline", showTopBar: "showTopBar", addPadding: "addPadding" }, outputs: { valueChange: "valueChange", fieldClick: "fieldClick", formValidationChange: "formValidationChange" }, providers: [PepGenericFormService], viewQueries: [{ propertyName: "pepListContainer", first: true, predicate: ["pepFormContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div *ngIf=\"inline\" class=\"inline-container\" [ngClass]=\"{ 'add-padding': addPadding }\">\n <div *ngIf=\"showTopBar\" class=\"inline-top-bar-container\">\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"formTemplate\"></ng-container>\n</div>\n\n<pep-page-layout *ngIf=\"!inline\" [addPadding]=\"addPadding\">\n <ng-container *ngIf=\"showTopBar\" pep-top-area>\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </ng-container>\n <div pep-main-area class=\"main-area-container\">\n <ng-container *ngTemplateOutlet=\"formTemplate\"></ng-container>\n </div>\n</pep-page-layout>\n\n<ng-template #topBarTemplate>\n <pep-top-bar [inline]=\"inline\"> \n <div header-start-content>\n <ng-content select=\"[left-buttons]\"></ng-content>\n </div>\n <div header-end-content>\n <ng-content select=\"[right-buttons]\"></ng-content>\n </div>\n\n <!-- <div footer-start-content>\n <ng-content select=\"[bottom-left-buttons]\"></ng-content>\n </div>\n <div footer-end-content>\n <ng-content select=\"[bottom-right-buttons]\"></ng-content>\n </div> -->\n </pep-top-bar>\n</ng-template>\n\n<ng-template #formTemplate>\n <div class=\"form-view\">\n <ng-container #pepFormContainer></ng-container>\n </div>\n</ng-template>\n", styles: [":host{height:inherit;display:block}.main-area-container{display:grid;height:inherit}.inline-container{height:inherit;display:grid;grid-template-rows:auto 1fr}.inline-container.add-padding{padding-inline:var(--pep-spacing-lg, 1rem)}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i4.PepPageLayoutComponent, selector: "pep-page-layout", inputs: ["addPadding", "showShadow"] }, { kind: "component", type: i5.PepTopBarComponent, selector: "pep-top-bar", inputs: ["inline", "title"], outputs: ["footerStateChange"] }] });
224
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: GenericFormComponent, decorators: [{
225
- type: Component,
226
- args: [{ selector: 'pep-generic-form', providers: [PepGenericFormService], template: "<div *ngIf=\"inline\" class=\"inline-container\" [ngClass]=\"{ 'add-padding': addPadding }\">\n <div *ngIf=\"showTopBar\" class=\"inline-top-bar-container\">\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"formTemplate\"></ng-container>\n</div>\n\n<pep-page-layout *ngIf=\"!inline\" [addPadding]=\"addPadding\">\n <ng-container *ngIf=\"showTopBar\" pep-top-area>\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </ng-container>\n <div pep-main-area class=\"main-area-container\">\n <ng-container *ngTemplateOutlet=\"formTemplate\"></ng-container>\n </div>\n</pep-page-layout>\n\n<ng-template #topBarTemplate>\n <pep-top-bar [inline]=\"inline\"> \n <div header-start-content>\n <ng-content select=\"[left-buttons]\"></ng-content>\n </div>\n <div header-end-content>\n <ng-content select=\"[right-buttons]\"></ng-content>\n </div>\n\n <!-- <div footer-start-content>\n <ng-content select=\"[bottom-left-buttons]\"></ng-content>\n </div>\n <div footer-end-content>\n <ng-content select=\"[bottom-right-buttons]\"></ng-content>\n </div> -->\n </pep-top-bar>\n</ng-template>\n\n<ng-template #formTemplate>\n <div class=\"form-view\">\n <ng-container #pepFormContainer></ng-container>\n </div>\n</ng-template>\n", styles: [":host{height:inherit;display:block}.main-area-container{display:grid;height:inherit}.inline-container{height:inherit;display:grid;grid-template-rows:auto 1fr}.inline-container.add-padding{padding-inline:var(--pep-spacing-lg, 1rem)}\n"] }]
227
- }], ctorParameters: function () { return [{ type: i1.PepLayoutService }, { type: PepGenericFormService }]; }, propDecorators: { pepListContainer: [{
228
- type: ViewChild,
229
- args: ['pepFormContainer', { read: ViewContainerRef }]
230
- }], dataSource: [{
231
- type: Input
232
- }], dataView: [{
233
- type: Input
234
- }], isLocked: [{
235
- type: Input
236
- }], inline: [{
237
- type: Input
238
- }], showTopBar: [{
239
- type: Input
240
- }], addPadding: [{
241
- type: Input
242
- }], valueChange: [{
243
- type: Output
244
- }], fieldClick: [{
245
- type: Output
246
- }], formValidationChange: [{
247
- type: Output
72
+ class GenericFormComponent {
73
+ constructor(layoutService, _genericFormService) {
74
+ this.layoutService = layoutService;
75
+ this._genericFormService = _genericFormService;
76
+ this.isLocked = false;
77
+ this.inline = false;
78
+ this.showTopBar = false;
79
+ this.addPadding = false;
80
+ this.valueChange = new EventEmitter();
81
+ this.fieldClick = new EventEmitter();
82
+ this.formValidationChange = new EventEmitter();
83
+ this.layoutService.onResize$.pipe().subscribe((size) => {
84
+ //
85
+ });
86
+ this._formData = new ObjectsDataRow();
87
+ this._uiControl = new UIControl();
88
+ }
89
+ set pepListContainer(val) {
90
+ this._pepFormContainer = val;
91
+ }
92
+ set dataSource(val) {
93
+ this._data = val;
94
+ }
95
+ set dataView(val) {
96
+ this.initForm(val);
97
+ }
98
+ ngOnInit() {
99
+ //
100
+ }
101
+ initForm(dataView) {
102
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
103
+ var _a;
104
+ if (this._pepFormContainer) {
105
+ if (this._pepFormContainer.length) {
106
+ this._pepFormContainer.remove();
107
+ this._formData = new ObjectsDataRow();
108
+ this._uiControl = new UIControl();
109
+ }
110
+ const { PepFormComponent } = yield import('@pepperi-addons/ngx-lib/form');
111
+ const componentRef = this._pepFormContainer.createComponent(PepFormComponent);
112
+ this._pepForm = componentRef.instance;
113
+ this._formData.IsEditable = !this.isLocked;
114
+ this._formData.UID = dataView.UID || PepGuid.newGuid();
115
+ const uiControlData = DataViewConverter.toUIControlData(dataView);
116
+ if (uiControlData) {
117
+ if (uiControlData === null || uiControlData === void 0 ? void 0 : uiControlData.ControlFields) {
118
+ this._uiControl.ControlFields = uiControlData.ControlFields.map((field) => this._genericFormService.convertToUiControlField(field));
119
+ }
120
+ this._uiControl.Columns = uiControlData.Columns;
121
+ if ((_a = this._uiControl.ControlFields) === null || _a === void 0 ? void 0 : _a.length) {
122
+ this._formData.Fields = [];
123
+ this._uiControl.ControlFields.forEach((item) => {
124
+ var _a;
125
+ let value = '';
126
+ if (this._genericFormService.hasProperty(this._data, item.ApiName)) {
127
+ value = this._data[item.ApiName];
128
+ }
129
+ let dataViewField;
130
+ if (dataView.Fields) {
131
+ dataViewField = dataView.Fields.find(field => field.FieldID === item.ApiName);
132
+ }
133
+ const controlFieldData = Object.assign(Object.assign(Object.assign({}, item), {
134
+ controlFieldValue: value
135
+ }), {
136
+ OptionalValues: ((_a = dataViewField === null || dataViewField === void 0 ? void 0 : dataViewField.OptionalValues) === null || _a === void 0 ? void 0 : _a.length) ? dataViewField.OptionalValues : [],
137
+ AdditionalProps: (dataViewField === null || dataViewField === void 0 ? void 0 : dataViewField.AdditionalProps) || null
138
+ });
139
+ this._formData.Fields.push(this._genericFormService.createFormField(controlFieldData));
140
+ });
141
+ componentRef.instance.layoutType = 'form';
142
+ componentRef.instance.layout = this._uiControl;
143
+ componentRef.instance.data = this._formData;
144
+ componentRef.instance.isInternal = false;
145
+ componentRef.instance.lockFields = this.isLocked;
146
+ componentRef.instance.valueChange.subscribe(($event) => {
147
+ this.onValueChanged($event);
148
+ });
149
+ componentRef.instance.fieldClick.subscribe(($event) => {
150
+ this.onfieldClicked($event);
151
+ });
152
+ componentRef.instance.formValidationChange.subscribe(($event) => {
153
+ this.onFormValidationChanged($event);
154
+ });
155
+ }
156
+ }
157
+ }
158
+ }), 0);
159
+ }
160
+ /**
161
+ * updates form field's value
162
+ * @param field object containing the data of the required update
163
+ */
164
+ updateFieldValue(fieldChanged) {
165
+ this._data[fieldChanged.ApiName] = fieldChanged.Value;
166
+ }
167
+ getData() {
168
+ return {
169
+ UID: this._formData.UID,
170
+ Values: this._data
171
+ };
172
+ }
173
+ /**
174
+ * updates form field(s) params
175
+ * @param fields
176
+ */
177
+ updateFields(fields) {
178
+ // update data view with current data
179
+ for (const [key, value] of Object.entries(this._data)) {
180
+ const index = this._formData.Fields.findIndex((item) => item.ApiName === key);
181
+ if (index >= 0) {
182
+ const item = this._formData.Fields[index];
183
+ item.Value = value;
184
+ }
185
+ }
186
+ fields.forEach((field) => {
187
+ const index = this._formData.Fields.findIndex((item) => item.ApiName === field.FieldId);
188
+ if (index >= 0) {
189
+ for (const [key, value] of Object.entries(field.Params)) {
190
+ if (this._genericFormService.hasProperty(this._formData.Fields[index], key)) {
191
+ const item = this._formData.Fields[index];
192
+ item[key] = value;
193
+ }
194
+ }
195
+ }
196
+ });
197
+ this._pepForm.ReloadForm();
198
+ this._pepForm.data = this._formData;
199
+ }
200
+ onValueChanged(event) {
201
+ const field = {
202
+ UID: event.id,
203
+ ApiName: event.key,
204
+ Value: event.value
205
+ };
206
+ this.updateFieldValue(field);
207
+ this.valueChange.emit(field);
208
+ }
209
+ onfieldClicked(event) {
210
+ const field = {
211
+ UID: event.id,
212
+ ApiName: event.key,
213
+ Value: event.value
214
+ };
215
+ this.updateFieldValue(field);
216
+ this.fieldClick.emit(field);
217
+ }
218
+ onFormValidationChanged(event) {
219
+ this.formValidationChange.emit(event);
220
+ }
221
+ }
222
+ GenericFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: GenericFormComponent, deps: [{ token: i1.PepLayoutService }, { token: PepGenericFormService }], target: i0.ɵɵFactoryTarget.Component });
223
+ GenericFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: GenericFormComponent, selector: "pep-generic-form", inputs: { dataSource: "dataSource", dataView: "dataView", isLocked: "isLocked", inline: "inline", showTopBar: "showTopBar", addPadding: "addPadding" }, outputs: { valueChange: "valueChange", fieldClick: "fieldClick", formValidationChange: "formValidationChange" }, providers: [PepGenericFormService], viewQueries: [{ propertyName: "pepListContainer", first: true, predicate: ["pepFormContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div *ngIf=\"inline\" class=\"inline-container\" [ngClass]=\"{ 'add-padding': addPadding }\">\n <div *ngIf=\"showTopBar\" class=\"inline-top-bar-container\">\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"formTemplate\"></ng-container>\n</div>\n\n<pep-page-layout *ngIf=\"!inline\" [addPadding]=\"addPadding\">\n <ng-container *ngIf=\"showTopBar\" pep-top-area>\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </ng-container>\n <div pep-main-area class=\"main-area-container\">\n <ng-container *ngTemplateOutlet=\"formTemplate\"></ng-container>\n </div>\n</pep-page-layout>\n\n<ng-template #topBarTemplate>\n <pep-top-bar [inline]=\"inline\"> \n <div header-start-content>\n <ng-content select=\"[left-buttons]\"></ng-content>\n </div>\n <div header-end-content>\n <ng-content select=\"[right-buttons]\"></ng-content>\n </div>\n\n <!-- <div footer-start-content>\n <ng-content select=\"[bottom-left-buttons]\"></ng-content>\n </div>\n <div footer-end-content>\n <ng-content select=\"[bottom-right-buttons]\"></ng-content>\n </div> -->\n </pep-top-bar>\n</ng-template>\n\n<ng-template #formTemplate>\n <div class=\"form-view\">\n <ng-container #pepFormContainer></ng-container>\n </div>\n</ng-template>\n", styles: [":host{height:inherit;display:block}.main-area-container{display:grid;height:inherit}.inline-container{height:inherit;display:grid;grid-template-rows:auto 1fr}.inline-container.add-padding{padding-inline:var(--pep-spacing-lg, 1rem)}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i4.PepPageLayoutComponent, selector: "pep-page-layout", inputs: ["addPadding", "showShadow"] }, { kind: "component", type: i5.PepTopBarComponent, selector: "pep-top-bar", inputs: ["inline", "title"], outputs: ["footerStateChange"] }] });
224
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: GenericFormComponent, decorators: [{
225
+ type: Component,
226
+ args: [{ selector: 'pep-generic-form', providers: [PepGenericFormService], template: "<div *ngIf=\"inline\" class=\"inline-container\" [ngClass]=\"{ 'add-padding': addPadding }\">\n <div *ngIf=\"showTopBar\" class=\"inline-top-bar-container\">\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"formTemplate\"></ng-container>\n</div>\n\n<pep-page-layout *ngIf=\"!inline\" [addPadding]=\"addPadding\">\n <ng-container *ngIf=\"showTopBar\" pep-top-area>\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </ng-container>\n <div pep-main-area class=\"main-area-container\">\n <ng-container *ngTemplateOutlet=\"formTemplate\"></ng-container>\n </div>\n</pep-page-layout>\n\n<ng-template #topBarTemplate>\n <pep-top-bar [inline]=\"inline\"> \n <div header-start-content>\n <ng-content select=\"[left-buttons]\"></ng-content>\n </div>\n <div header-end-content>\n <ng-content select=\"[right-buttons]\"></ng-content>\n </div>\n\n <!-- <div footer-start-content>\n <ng-content select=\"[bottom-left-buttons]\"></ng-content>\n </div>\n <div footer-end-content>\n <ng-content select=\"[bottom-right-buttons]\"></ng-content>\n </div> -->\n </pep-top-bar>\n</ng-template>\n\n<ng-template #formTemplate>\n <div class=\"form-view\">\n <ng-container #pepFormContainer></ng-container>\n </div>\n</ng-template>\n", styles: [":host{height:inherit;display:block}.main-area-container{display:grid;height:inherit}.inline-container{height:inherit;display:grid;grid-template-rows:auto 1fr}.inline-container.add-padding{padding-inline:var(--pep-spacing-lg, 1rem)}\n"] }]
227
+ }], ctorParameters: function () { return [{ type: i1.PepLayoutService }, { type: PepGenericFormService }]; }, propDecorators: { pepListContainer: [{
228
+ type: ViewChild,
229
+ args: ['pepFormContainer', { read: ViewContainerRef }]
230
+ }], dataSource: [{
231
+ type: Input
232
+ }], dataView: [{
233
+ type: Input
234
+ }], isLocked: [{
235
+ type: Input
236
+ }], inline: [{
237
+ type: Input
238
+ }], showTopBar: [{
239
+ type: Input
240
+ }], addPadding: [{
241
+ type: Input
242
+ }], valueChange: [{
243
+ type: Output
244
+ }], fieldClick: [{
245
+ type: Output
246
+ }], formValidationChange: [{
247
+ type: Output
248
248
  }] } });
249
249
 
250
- class PepGenericFormModule {
251
- }
252
- PepGenericFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
253
- PepGenericFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, declarations: [GenericFormComponent], imports: [CommonModule,
254
- // MatFormFieldModule,
255
- // ReactiveFormsModule,
256
- PepNgxLibModule,
257
- // PepListModule,
258
- PepFormModule,
259
- PepMenuModule,
260
- PepPageLayoutModule,
261
- PepTopBarModule], exports: [GenericFormComponent] });
262
- PepGenericFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, providers: [
263
- PepGenericFormService
264
- ], imports: [CommonModule,
265
- // MatFormFieldModule,
266
- // ReactiveFormsModule,
267
- PepNgxLibModule,
268
- // PepListModule,
269
- PepFormModule,
270
- PepMenuModule,
271
- PepPageLayoutModule,
272
- PepTopBarModule] });
273
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, decorators: [{
274
- type: NgModule,
275
- args: [{
276
- declarations: [
277
- GenericFormComponent
278
- ],
279
- imports: [
280
- CommonModule,
281
- // MatFormFieldModule,
282
- // ReactiveFormsModule,
283
- PepNgxLibModule,
284
- // PepListModule,
285
- PepFormModule,
286
- PepMenuModule,
287
- PepPageLayoutModule,
288
- PepTopBarModule,
289
- // PepTextboxModule,
290
- // PepDateModule
291
- // PepSearchModule,
292
- // PepBreadCrumbsModule
293
- ],
294
- exports: [
295
- GenericFormComponent
296
- ],
297
- providers: [
298
- PepGenericFormService
299
- ]
300
- }]
250
+ class PepGenericFormModule {
251
+ }
252
+ PepGenericFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
253
+ PepGenericFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, declarations: [GenericFormComponent], imports: [CommonModule,
254
+ // MatFormFieldModule,
255
+ // ReactiveFormsModule,
256
+ PepNgxLibModule,
257
+ // PepListModule,
258
+ PepFormModule,
259
+ PepMenuModule,
260
+ PepPageLayoutModule,
261
+ PepTopBarModule], exports: [GenericFormComponent] });
262
+ PepGenericFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, providers: [
263
+ PepGenericFormService
264
+ ], imports: [CommonModule,
265
+ // MatFormFieldModule,
266
+ // ReactiveFormsModule,
267
+ PepNgxLibModule,
268
+ // PepListModule,
269
+ PepFormModule,
270
+ PepMenuModule,
271
+ PepPageLayoutModule,
272
+ PepTopBarModule] });
273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, decorators: [{
274
+ type: NgModule,
275
+ args: [{
276
+ declarations: [
277
+ GenericFormComponent
278
+ ],
279
+ imports: [
280
+ CommonModule,
281
+ // MatFormFieldModule,
282
+ // ReactiveFormsModule,
283
+ PepNgxLibModule,
284
+ // PepListModule,
285
+ PepFormModule,
286
+ PepMenuModule,
287
+ PepPageLayoutModule,
288
+ PepTopBarModule,
289
+ // PepTextboxModule,
290
+ // PepDateModule
291
+ // PepSearchModule,
292
+ // PepBreadCrumbsModule
293
+ ],
294
+ exports: [
295
+ GenericFormComponent
296
+ ],
297
+ providers: [
298
+ PepGenericFormService
299
+ ]
300
+ }]
301
301
  }] });
302
302
 
303
- /*
304
- * Public API Surface of ngx-composite-lib/generic-form
303
+ /*
304
+ * Public API Surface of ngx-composite-lib/generic-form
305
305
  */
306
306
 
307
- /**
308
- * Generated bundle index. Do not edit.
307
+ /**
308
+ * Generated bundle index. Do not edit.
309
309
  */
310
310
 
311
311
  export { GenericFormComponent, PepGenericFormModule, PepGenericFormService };