@pepperi-addons/ngx-composite-lib 0.0.16-beta.35 → 0.0.16-beta.36

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 +126 -126
  2. package/bundles/pepperi-addons-ngx-composite-lib-data-view-builder.umd.js +338 -338
  3. package/bundles/pepperi-addons-ngx-composite-lib-file-status-panel.umd.js +89 -89
  4. package/bundles/pepperi-addons-ngx-composite-lib-generic-form.umd.js +647 -647
  5. package/bundles/pepperi-addons-ngx-composite-lib-generic-list.umd.js +1005 -998
  6. package/bundles/pepperi-addons-ngx-composite-lib-generic-list.umd.js.map +1 -1
  7. package/bundles/pepperi-addons-ngx-composite-lib-group-buttons-settings.umd.js +179 -179
  8. package/bundles/pepperi-addons-ngx-composite-lib-shadow-settings.umd.js +117 -117
  9. package/bundles/pepperi-addons-ngx-composite-lib.umd.js +598 -598
  10. package/color-settings/color-settings.component.d.ts +23 -23
  11. package/color-settings/color-settings.model.d.ts +5 -5
  12. package/color-settings/color-settings.module.d.ts +12 -12
  13. package/color-settings/pepperi-addons-ngx-composite-lib-color-settings.d.ts +5 -5
  14. package/color-settings/public-api.d.ts +3 -3
  15. package/core/common/directives/index.d.ts +1 -1
  16. package/core/common/directives/public-api.d.ts +1 -1
  17. package/core/common/directives/reset-configuration-field.directive.d.ts +39 -39
  18. package/core/common/index.d.ts +1 -1
  19. package/core/common/public-api.d.ts +2 -2
  20. package/core/common/services/dimx.service.d.ts +32 -32
  21. package/core/common/services/index.d.ts +1 -1
  22. package/core/common/services/public-api.d.ts +2 -2
  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/data-view-builder/data-view-builder.component.d.ts +35 -35
  27. package/data-view-builder/data-view-builder.model.d.ts +1 -1
  28. package/data-view-builder/data-view-builder.module.d.ts +23 -23
  29. package/data-view-builder/data-view-builder.service.d.ts +14 -14
  30. package/data-view-builder/menu-data-view/menu-data-view.component.d.ts +36 -36
  31. package/data-view-builder/pepperi-addons-ngx-composite-lib-data-view-builder.d.ts +5 -5
  32. package/data-view-builder/public-api.d.ts +3 -3
  33. package/esm2015/color-settings/color-settings.component.js +84 -84
  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 +139 -139
  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/dimx.service.js +49 -49
  44. package/esm2015/core/common/services/index.js +4 -4
  45. package/esm2015/core/common/services/public-api.js +5 -5
  46. package/esm2015/core/common/services/utilities.service.js +18 -18
  47. package/esm2015/core/index.js +4 -4
  48. package/esm2015/core/public-api.js +4 -4
  49. package/esm2015/data-view-builder/data-view-builder.component.js +121 -121
  50. package/esm2015/data-view-builder/data-view-builder.model.js +1 -1
  51. package/esm2015/data-view-builder/data-view-builder.module.js +81 -81
  52. package/esm2015/data-view-builder/data-view-builder.service.js +38 -38
  53. package/esm2015/data-view-builder/menu-data-view/menu-data-view.component.js +121 -121
  54. package/esm2015/data-view-builder/pepperi-addons-ngx-composite-lib-data-view-builder.js +4 -4
  55. package/esm2015/data-view-builder/public-api.js +6 -6
  56. package/esm2015/file-status-panel/file-status-panel.component.js +38 -38
  57. package/esm2015/file-status-panel/file-status-panel.model.js +8 -8
  58. package/esm2015/file-status-panel/file-status-panel.module.js +55 -55
  59. package/esm2015/file-status-panel/pepperi-addons-ngx-composite-lib-file-status-panel.js +4 -4
  60. package/esm2015/file-status-panel/public-api.js +6 -6
  61. package/esm2015/generic-form/generic-form.component.js +189 -189
  62. package/esm2015/generic-form/generic-form.model.js +1 -1
  63. package/esm2015/generic-form/generic-form.module.js +73 -73
  64. package/esm2015/generic-form/generic-form.service.js +67 -67
  65. package/esm2015/generic-form/index.js +4 -4
  66. package/esm2015/generic-form/pepperi-addons-ngx-composite-lib-generic-form.js +4 -4
  67. package/esm2015/generic-form/public-api.js +7 -7
  68. package/esm2015/generic-list/generic-list.component.js +445 -438
  69. package/esm2015/generic-list/generic-list.model.js +1 -1
  70. package/esm2015/generic-list/generic-list.module.js +71 -71
  71. package/esm2015/generic-list/generic-list.service.js +126 -126
  72. package/esm2015/generic-list/pepperi-addons-ngx-composite-lib-generic-list.js +4 -4
  73. package/esm2015/generic-list/public-api.js +7 -7
  74. package/esm2015/group-buttons-settings/group-buttons-settings.component.js +134 -134
  75. package/esm2015/group-buttons-settings/group-buttons-settings.model.js +1 -1
  76. package/esm2015/group-buttons-settings/group-buttons-settings.module.js +49 -49
  77. package/esm2015/group-buttons-settings/pepperi-addons-ngx-composite-lib-group-buttons-settings.js +4 -4
  78. package/esm2015/group-buttons-settings/public-api.js +6 -6
  79. package/esm2015/ngx-composite-lib.module.js +55 -55
  80. package/esm2015/pepperi-addons-ngx-composite-lib.js +4 -4
  81. package/esm2015/public-api.js +5 -5
  82. package/esm2015/shadow-settings/pepperi-addons-ngx-composite-lib-shadow-settings.js +4 -4
  83. package/esm2015/shadow-settings/public-api.js +6 -6
  84. package/esm2015/shadow-settings/shadow-settings.component.js +72 -72
  85. package/esm2015/shadow-settings/shadow-settings.model.js +7 -7
  86. package/esm2015/shadow-settings/shadow-settings.module.js +43 -43
  87. package/fesm2015/pepperi-addons-ngx-composite-lib-color-settings.js +116 -116
  88. package/fesm2015/pepperi-addons-ngx-composite-lib-data-view-builder.js +319 -319
  89. package/fesm2015/pepperi-addons-ngx-composite-lib-file-status-panel.js +84 -84
  90. package/fesm2015/pepperi-addons-ngx-composite-lib-generic-form.js +301 -301
  91. package/fesm2015/pepperi-addons-ngx-composite-lib-generic-list.js +602 -595
  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 +170 -170
  94. package/fesm2015/pepperi-addons-ngx-composite-lib-shadow-settings.js +107 -107
  95. package/fesm2015/pepperi-addons-ngx-composite-lib.js +255 -255
  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 +17 -17
  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 +46 -46
  102. package/generic-form/generic-form.model.d.ts +34 -34
  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 +101 -100
  109. package/generic-list/generic-list.model.d.ts +51 -51
  110. package/generic-list/generic-list.module.d.ts +18 -18
  111. package/generic-list/generic-list.service.d.ts +43 -43
  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 +15 -15
  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 +13 -13
  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\" [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"], 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\" [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"], 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 };