@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
@@ -12,301 +12,301 @@ import * as i5 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(data) {
29
- let field = {};
30
- field.ApiName = data.ApiName;
31
- field.Value = data.controlFieldValue;
32
- field.FieldType = data.FieldType;
33
- field.Enabled = !data.ReadOnly;
34
- field.Visible = !data.Hidden;
35
- field.GroupFields = [];
36
- field.Highlighted = false;
37
- field.OptionalValues = data.OptionalValues;
38
- field.AdditionalProps = data.AdditionalProps;
39
- return field;
40
- }
41
- convertToUiControlField(field) {
42
- return {
43
- ApiName: field.ApiName,
44
- FieldType: field.FieldType,
45
- Title: field.Title,
46
- ReadOnly: field.ReadOnlyField,
47
- Mandatory: field.MandatoryField,
48
- Hidden: field.Hidden,
49
- ColumnWidth: field.ColumnWidth,
50
- ColumnWidthType: 1,
51
- MaxFieldCharacters: field.MaxCharacters,
52
- MinValue: field.MinValue,
53
- MaxValue: field.MaxValue,
54
- Layout: {
55
- X: field.Layout.X,
56
- Y: field.Layout.Y,
57
- Width: field.Layout.Width,
58
- Height: field.Layout.Field_Height,
59
- XAlignment: field.Layout.xAlignment,
60
- YAlignment: field.Layout.yAlignment,
61
- }
62
- };
63
- }
64
- }
65
- PepGenericFormService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
66
- PepGenericFormService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormService });
67
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormService, decorators: [{
68
- 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(data) {
29
+ let field = {};
30
+ field.ApiName = data.ApiName;
31
+ field.Value = data.controlFieldValue;
32
+ field.FieldType = data.FieldType;
33
+ field.Enabled = !data.ReadOnly;
34
+ field.Visible = !data.Hidden;
35
+ field.GroupFields = [];
36
+ field.Highlighted = false;
37
+ field.OptionalValues = data.OptionalValues;
38
+ field.AdditionalProps = data.AdditionalProps;
39
+ return field;
40
+ }
41
+ convertToUiControlField(field) {
42
+ return {
43
+ ApiName: field.ApiName,
44
+ FieldType: field.FieldType,
45
+ Title: field.Title,
46
+ ReadOnly: field.ReadOnlyField,
47
+ Mandatory: field.MandatoryField,
48
+ Hidden: field.Hidden,
49
+ ColumnWidth: field.ColumnWidth,
50
+ ColumnWidthType: 1,
51
+ MaxFieldCharacters: field.MaxCharacters,
52
+ MinValue: field.MinValue,
53
+ MaxValue: field.MaxValue,
54
+ Layout: {
55
+ X: field.Layout.X,
56
+ Y: field.Layout.Y,
57
+ Width: field.Layout.Width,
58
+ Height: field.Layout.Field_Height,
59
+ XAlignment: field.Layout.xAlignment,
60
+ YAlignment: field.Layout.yAlignment,
61
+ }
62
+ };
63
+ }
64
+ }
65
+ PepGenericFormService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
66
+ PepGenericFormService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormService });
67
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormService, decorators: [{
68
+ type: Injectable
69
69
  }], ctorParameters: function () { return []; } });
70
70
 
71
- class GenericFormComponent {
72
- constructor(layoutService, _genericFormService) {
73
- this.layoutService = layoutService;
74
- this._genericFormService = _genericFormService;
75
- this.isLocked = false;
76
- this.inline = false;
77
- this.showTopBar = false;
78
- this.addPadding = false;
79
- this.valueChange = new EventEmitter();
80
- this.fieldClick = new EventEmitter();
81
- this.formValidationChange = new EventEmitter();
82
- this.layoutService.onResize$.pipe().subscribe((size) => {
83
- //
84
- });
85
- this._formData = new ObjectsDataRow();
86
- this._uiControl = new UIControl();
87
- }
88
- set pepListContainer(val) {
89
- this._pepFormContainer = val;
90
- }
91
- set dataSource(val) {
92
- this._data = val;
93
- }
94
- set dataView(val) {
95
- this.initForm(val);
96
- }
97
- ngOnInit() {
98
- //
99
- }
100
- initForm(dataView) {
101
- setTimeout(async () => {
102
- if (this._pepFormContainer) {
103
- if (this._pepFormContainer.length) {
104
- this._pepFormContainer.remove();
105
- this._formData = new ObjectsDataRow();
106
- this._uiControl = new UIControl();
107
- }
108
- const { PepFormComponent } = await import('@pepperi-addons/ngx-lib/form');
109
- const componentRef = this._pepFormContainer.createComponent(PepFormComponent);
110
- this._pepForm = componentRef.instance;
111
- this._formData.IsEditable = !this.isLocked;
112
- this._formData.UID = dataView.UID || PepGuid.newGuid();
113
- const uiControlData = DataViewConverter.toUIControlData(dataView);
114
- if (uiControlData) {
115
- if (uiControlData?.ControlFields) {
116
- this._uiControl.ControlFields = uiControlData.ControlFields.map((field) => this._genericFormService.convertToUiControlField(field));
117
- }
118
- this._uiControl.Columns = uiControlData.Columns;
119
- if (this._uiControl.ControlFields?.length) {
120
- this._formData.Fields = [];
121
- this._uiControl.ControlFields.forEach((item) => {
122
- let value = '';
123
- if (this._genericFormService.hasProperty(this._data, item.ApiName)) {
124
- value = this._data[item.ApiName];
125
- }
126
- let dataViewField;
127
- if (dataView.Fields) {
128
- dataViewField = dataView.Fields.find(field => field.FieldID === item.ApiName);
129
- }
130
- const controlFieldData = {
131
- ...item,
132
- ...{
133
- controlFieldValue: value
134
- },
135
- ...{
136
- OptionalValues: dataViewField?.OptionalValues?.length ? dataViewField.OptionalValues : [],
137
- AdditionalProps: dataViewField?.AdditionalProps || null
138
- }
139
- };
140
- this._formData.Fields.push(this._genericFormService.createFormField(controlFieldData));
141
- });
142
- componentRef.instance.layoutType = 'form';
143
- componentRef.instance.layout = this._uiControl;
144
- componentRef.instance.data = this._formData;
145
- componentRef.instance.isInternal = false;
146
- componentRef.instance.lockFields = this.isLocked;
147
- componentRef.instance.valueChange.subscribe(($event) => {
148
- this.onValueChanged($event);
149
- });
150
- componentRef.instance.fieldClick.subscribe(($event) => {
151
- this.onfieldClicked($event);
152
- });
153
- componentRef.instance.formValidationChange.subscribe(($event) => {
154
- this.onFormValidationChanged($event);
155
- });
156
- }
157
- }
158
- }
159
- }, 0);
160
- }
161
- /**
162
- * updates form field's value
163
- * @param field object containing the data of the required update
164
- */
165
- updateFieldValue(fieldChanged) {
166
- this._data[fieldChanged.ApiName] = fieldChanged.Value;
167
- }
168
- getData() {
169
- return {
170
- UID: this._formData.UID,
171
- Values: this._data
172
- };
173
- }
174
- /**
175
- * updates form field(s) params
176
- * @param fields
177
- */
178
- updateFields(fields) {
179
- // update data view with current data
180
- for (const [key, value] of Object.entries(this._data)) {
181
- const index = this._formData.Fields.findIndex((item) => item.ApiName === key);
182
- if (index >= 0) {
183
- const item = this._formData.Fields[index];
184
- item.Value = value;
185
- }
186
- }
187
- fields.forEach((field) => {
188
- const index = this._formData.Fields.findIndex((item) => item.ApiName === field.FieldId);
189
- if (index >= 0) {
190
- for (const [key, value] of Object.entries(field.Params)) {
191
- if (this._genericFormService.hasProperty(this._formData.Fields[index], key)) {
192
- const item = this._formData.Fields[index];
193
- item[key] = value;
194
- }
195
- }
196
- }
197
- });
198
- this._pepForm.ReloadForm();
199
- this._pepForm.data = this._formData;
200
- }
201
- onValueChanged(event) {
202
- const field = {
203
- UID: event.id,
204
- ApiName: event.key,
205
- Value: event.value
206
- };
207
- this.updateFieldValue(field);
208
- this.valueChange.emit(field);
209
- }
210
- onfieldClicked(event) {
211
- const field = {
212
- UID: event.id,
213
- ApiName: event.key,
214
- Value: event.value
215
- };
216
- this.updateFieldValue(field);
217
- this.fieldClick.emit(field);
218
- }
219
- onFormValidationChanged(event) {
220
- this.formValidationChange.emit(event);
221
- }
222
- }
223
- 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 });
224
- 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"] }] });
225
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: GenericFormComponent, decorators: [{
226
- type: Component,
227
- 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"] }]
228
- }], ctorParameters: function () { return [{ type: i1.PepLayoutService }, { type: PepGenericFormService }]; }, propDecorators: { pepListContainer: [{
229
- type: ViewChild,
230
- args: ['pepFormContainer', { read: ViewContainerRef }]
231
- }], dataSource: [{
232
- type: Input
233
- }], dataView: [{
234
- type: Input
235
- }], isLocked: [{
236
- type: Input
237
- }], inline: [{
238
- type: Input
239
- }], showTopBar: [{
240
- type: Input
241
- }], addPadding: [{
242
- type: Input
243
- }], valueChange: [{
244
- type: Output
245
- }], fieldClick: [{
246
- type: Output
247
- }], formValidationChange: [{
248
- type: Output
71
+ class GenericFormComponent {
72
+ constructor(layoutService, _genericFormService) {
73
+ this.layoutService = layoutService;
74
+ this._genericFormService = _genericFormService;
75
+ this.isLocked = false;
76
+ this.inline = false;
77
+ this.showTopBar = false;
78
+ this.addPadding = false;
79
+ this.valueChange = new EventEmitter();
80
+ this.fieldClick = new EventEmitter();
81
+ this.formValidationChange = new EventEmitter();
82
+ this.layoutService.onResize$.pipe().subscribe((size) => {
83
+ //
84
+ });
85
+ this._formData = new ObjectsDataRow();
86
+ this._uiControl = new UIControl();
87
+ }
88
+ set pepListContainer(val) {
89
+ this._pepFormContainer = val;
90
+ }
91
+ set dataSource(val) {
92
+ this._data = val;
93
+ }
94
+ set dataView(val) {
95
+ this.initForm(val);
96
+ }
97
+ ngOnInit() {
98
+ //
99
+ }
100
+ initForm(dataView) {
101
+ setTimeout(async () => {
102
+ if (this._pepFormContainer) {
103
+ if (this._pepFormContainer.length) {
104
+ this._pepFormContainer.remove();
105
+ this._formData = new ObjectsDataRow();
106
+ this._uiControl = new UIControl();
107
+ }
108
+ const { PepFormComponent } = await import('@pepperi-addons/ngx-lib/form');
109
+ const componentRef = this._pepFormContainer.createComponent(PepFormComponent);
110
+ this._pepForm = componentRef.instance;
111
+ this._formData.IsEditable = !this.isLocked;
112
+ this._formData.UID = dataView.UID || PepGuid.newGuid();
113
+ const uiControlData = DataViewConverter.toUIControlData(dataView);
114
+ if (uiControlData) {
115
+ if (uiControlData?.ControlFields) {
116
+ this._uiControl.ControlFields = uiControlData.ControlFields.map((field) => this._genericFormService.convertToUiControlField(field));
117
+ }
118
+ this._uiControl.Columns = uiControlData.Columns;
119
+ if (this._uiControl.ControlFields?.length) {
120
+ this._formData.Fields = [];
121
+ this._uiControl.ControlFields.forEach((item) => {
122
+ let value = '';
123
+ if (this._genericFormService.hasProperty(this._data, item.ApiName)) {
124
+ value = this._data[item.ApiName];
125
+ }
126
+ let dataViewField;
127
+ if (dataView.Fields) {
128
+ dataViewField = dataView.Fields.find(field => field.FieldID === item.ApiName);
129
+ }
130
+ const controlFieldData = {
131
+ ...item,
132
+ ...{
133
+ controlFieldValue: value
134
+ },
135
+ ...{
136
+ OptionalValues: dataViewField?.OptionalValues?.length ? dataViewField.OptionalValues : [],
137
+ AdditionalProps: dataViewField?.AdditionalProps || null
138
+ }
139
+ };
140
+ this._formData.Fields.push(this._genericFormService.createFormField(controlFieldData));
141
+ });
142
+ componentRef.instance.layoutType = 'form';
143
+ componentRef.instance.layout = this._uiControl;
144
+ componentRef.instance.data = this._formData;
145
+ componentRef.instance.isInternal = false;
146
+ componentRef.instance.lockFields = this.isLocked;
147
+ componentRef.instance.valueChange.subscribe(($event) => {
148
+ this.onValueChanged($event);
149
+ });
150
+ componentRef.instance.fieldClick.subscribe(($event) => {
151
+ this.onfieldClicked($event);
152
+ });
153
+ componentRef.instance.formValidationChange.subscribe(($event) => {
154
+ this.onFormValidationChanged($event);
155
+ });
156
+ }
157
+ }
158
+ }
159
+ }, 0);
160
+ }
161
+ /**
162
+ * updates form field's value
163
+ * @param field object containing the data of the required update
164
+ */
165
+ updateFieldValue(fieldChanged) {
166
+ this._data[fieldChanged.ApiName] = fieldChanged.Value;
167
+ }
168
+ getData() {
169
+ return {
170
+ UID: this._formData.UID,
171
+ Values: this._data
172
+ };
173
+ }
174
+ /**
175
+ * updates form field(s) params
176
+ * @param fields
177
+ */
178
+ updateFields(fields) {
179
+ // update data view with current data
180
+ for (const [key, value] of Object.entries(this._data)) {
181
+ const index = this._formData.Fields.findIndex((item) => item.ApiName === key);
182
+ if (index >= 0) {
183
+ const item = this._formData.Fields[index];
184
+ item.Value = value;
185
+ }
186
+ }
187
+ fields.forEach((field) => {
188
+ const index = this._formData.Fields.findIndex((item) => item.ApiName === field.FieldId);
189
+ if (index >= 0) {
190
+ for (const [key, value] of Object.entries(field.Params)) {
191
+ if (this._genericFormService.hasProperty(this._formData.Fields[index], key)) {
192
+ const item = this._formData.Fields[index];
193
+ item[key] = value;
194
+ }
195
+ }
196
+ }
197
+ });
198
+ this._pepForm.ReloadForm();
199
+ this._pepForm.data = this._formData;
200
+ }
201
+ onValueChanged(event) {
202
+ const field = {
203
+ UID: event.id,
204
+ ApiName: event.key,
205
+ Value: event.value
206
+ };
207
+ this.updateFieldValue(field);
208
+ this.valueChange.emit(field);
209
+ }
210
+ onfieldClicked(event) {
211
+ const field = {
212
+ UID: event.id,
213
+ ApiName: event.key,
214
+ Value: event.value
215
+ };
216
+ this.updateFieldValue(field);
217
+ this.fieldClick.emit(field);
218
+ }
219
+ onFormValidationChanged(event) {
220
+ this.formValidationChange.emit(event);
221
+ }
222
+ }
223
+ 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 });
224
+ 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"] }] });
225
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: GenericFormComponent, decorators: [{
226
+ type: Component,
227
+ 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"] }]
228
+ }], ctorParameters: function () { return [{ type: i1.PepLayoutService }, { type: PepGenericFormService }]; }, propDecorators: { pepListContainer: [{
229
+ type: ViewChild,
230
+ args: ['pepFormContainer', { read: ViewContainerRef }]
231
+ }], dataSource: [{
232
+ type: Input
233
+ }], dataView: [{
234
+ type: Input
235
+ }], isLocked: [{
236
+ type: Input
237
+ }], inline: [{
238
+ type: Input
239
+ }], showTopBar: [{
240
+ type: Input
241
+ }], addPadding: [{
242
+ type: Input
243
+ }], valueChange: [{
244
+ type: Output
245
+ }], fieldClick: [{
246
+ type: Output
247
+ }], formValidationChange: [{
248
+ type: Output
249
249
  }] } });
250
250
 
251
- class PepGenericFormModule {
252
- }
253
- PepGenericFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
254
- PepGenericFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, declarations: [GenericFormComponent], imports: [CommonModule,
255
- // MatFormFieldModule,
256
- // ReactiveFormsModule,
257
- PepNgxLibModule,
258
- // PepListModule,
259
- PepFormModule,
260
- PepMenuModule,
261
- PepPageLayoutModule,
262
- PepTopBarModule], exports: [GenericFormComponent] });
263
- PepGenericFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, providers: [
264
- PepGenericFormService
265
- ], imports: [CommonModule,
266
- // MatFormFieldModule,
267
- // ReactiveFormsModule,
268
- PepNgxLibModule,
269
- // PepListModule,
270
- PepFormModule,
271
- PepMenuModule,
272
- PepPageLayoutModule,
273
- PepTopBarModule] });
274
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, decorators: [{
275
- type: NgModule,
276
- args: [{
277
- declarations: [
278
- GenericFormComponent
279
- ],
280
- imports: [
281
- CommonModule,
282
- // MatFormFieldModule,
283
- // ReactiveFormsModule,
284
- PepNgxLibModule,
285
- // PepListModule,
286
- PepFormModule,
287
- PepMenuModule,
288
- PepPageLayoutModule,
289
- PepTopBarModule,
290
- // PepTextboxModule,
291
- // PepDateModule
292
- // PepSearchModule,
293
- // PepBreadCrumbsModule
294
- ],
295
- exports: [
296
- GenericFormComponent
297
- ],
298
- providers: [
299
- PepGenericFormService
300
- ]
301
- }]
251
+ class PepGenericFormModule {
252
+ }
253
+ PepGenericFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
254
+ PepGenericFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, declarations: [GenericFormComponent], imports: [CommonModule,
255
+ // MatFormFieldModule,
256
+ // ReactiveFormsModule,
257
+ PepNgxLibModule,
258
+ // PepListModule,
259
+ PepFormModule,
260
+ PepMenuModule,
261
+ PepPageLayoutModule,
262
+ PepTopBarModule], exports: [GenericFormComponent] });
263
+ PepGenericFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, providers: [
264
+ PepGenericFormService
265
+ ], imports: [CommonModule,
266
+ // MatFormFieldModule,
267
+ // ReactiveFormsModule,
268
+ PepNgxLibModule,
269
+ // PepListModule,
270
+ PepFormModule,
271
+ PepMenuModule,
272
+ PepPageLayoutModule,
273
+ PepTopBarModule] });
274
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: PepGenericFormModule, decorators: [{
275
+ type: NgModule,
276
+ args: [{
277
+ declarations: [
278
+ GenericFormComponent
279
+ ],
280
+ imports: [
281
+ CommonModule,
282
+ // MatFormFieldModule,
283
+ // ReactiveFormsModule,
284
+ PepNgxLibModule,
285
+ // PepListModule,
286
+ PepFormModule,
287
+ PepMenuModule,
288
+ PepPageLayoutModule,
289
+ PepTopBarModule,
290
+ // PepTextboxModule,
291
+ // PepDateModule
292
+ // PepSearchModule,
293
+ // PepBreadCrumbsModule
294
+ ],
295
+ exports: [
296
+ GenericFormComponent
297
+ ],
298
+ providers: [
299
+ PepGenericFormService
300
+ ]
301
+ }]
302
302
  }] });
303
303
 
304
- /*
305
- * Public API Surface of ngx-composite-lib/generic-form
304
+ /*
305
+ * Public API Surface of ngx-composite-lib/generic-form
306
306
  */
307
307
 
308
- /**
309
- * Generated bundle index. Do not edit.
308
+ /**
309
+ * Generated bundle index. Do not edit.
310
310
  */
311
311
 
312
312
  export { GenericFormComponent, PepGenericFormModule, PepGenericFormService };