@pepperi-addons/ngx-composite-lib 0.0.16-beta.5 → 0.0.16-beta.9

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