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