@yomotech/view-toolkit 0.0.32 → 0.0.33

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 (72) hide show
  1. package/fesm2022/yomotech-view-toolkit.mjs +3591 -0
  2. package/fesm2022/yomotech-view-toolkit.mjs.map +1 -0
  3. package/package.json +49 -38
  4. package/types/yomotech-view-toolkit.d.ts +648 -0
  5. package/ng-package.json +0 -7
  6. package/src/lib/app-version.ts +0 -2
  7. package/src/lib/components/autocomplete/autocomplete.css +0 -0
  8. package/src/lib/components/autocomplete/autocomplete.html +0 -23
  9. package/src/lib/components/autocomplete/autocomplete.ts +0 -71
  10. package/src/lib/components/button/button.css +0 -0
  11. package/src/lib/components/button/button.html +0 -1
  12. package/src/lib/components/button/button.ts +0 -11
  13. package/src/lib/components/date/date.css +0 -0
  14. package/src/lib/components/date/date.html +0 -1
  15. package/src/lib/components/date/date.ts +0 -11
  16. package/src/lib/components/dropdown/dropdown.css +0 -0
  17. package/src/lib/components/dropdown/dropdown.html +0 -1
  18. package/src/lib/components/dropdown/dropdown.ts +0 -11
  19. package/src/lib/components/error-message/error-message.css +0 -0
  20. package/src/lib/components/error-message/error-message.html +0 -1
  21. package/src/lib/components/error-message/error-message.ts +0 -11
  22. package/src/lib/components/label/label.css +0 -0
  23. package/src/lib/components/label/label.html +0 -7
  24. package/src/lib/components/label/label.ts +0 -33
  25. package/src/lib/components/string/string.css +0 -0
  26. package/src/lib/components/string/string.html +0 -4
  27. package/src/lib/components/string/string.ts +0 -22
  28. package/src/lib/components/textbox/textbox.css +0 -0
  29. package/src/lib/components/textbox/textbox.html +0 -7
  30. package/src/lib/components/textbox/textbox.ts +0 -33
  31. package/src/lib/components/time/time.css +0 -0
  32. package/src/lib/components/time/time.html +0 -1
  33. package/src/lib/components/time/time.ts +0 -11
  34. package/src/lib/containers/card/card.component.css +0 -0
  35. package/src/lib/containers/card/card.component.html +0 -450
  36. package/src/lib/containers/card/card.component.ts +0 -474
  37. package/src/lib/containers/form/form.component.css +0 -101
  38. package/src/lib/containers/form/form.component.html +0 -305
  39. package/src/lib/containers/form/form.component.ts +0 -333
  40. package/src/lib/containers/grid/grid.component.css +0 -0
  41. package/src/lib/containers/grid/grid.component.html +0 -212
  42. package/src/lib/containers/grid/grid.component.ts +0 -228
  43. package/src/lib/containers/header-menu/header-menu.component.css +0 -0
  44. package/src/lib/containers/header-menu/header-menu.component.html +0 -72
  45. package/src/lib/containers/header-menu/header-menu.component.ts +0 -105
  46. package/src/lib/containers/logs/logs.component.css +0 -160
  47. package/src/lib/containers/logs/logs.component.html +0 -89
  48. package/src/lib/containers/logs/logs.component.ts +0 -29
  49. package/src/lib/containers/model/model.component.css +0 -0
  50. package/src/lib/containers/model/model.component.html +0 -351
  51. package/src/lib/containers/model/model.component.ts +0 -436
  52. package/src/lib/containers/pagination/pagination.component.css +0 -0
  53. package/src/lib/containers/pagination/pagination.component.html +0 -41
  54. package/src/lib/containers/pagination/pagination.component.ts +0 -100
  55. package/src/lib/containers/side-menu/side-menu.component.css +0 -173
  56. package/src/lib/containers/side-menu/side-menu.component.html +0 -126
  57. package/src/lib/containers/side-menu/side-menu.component.ts +0 -458
  58. package/src/lib/services/app-version-reset.service.ts +0 -59
  59. package/src/lib/services/config.service.ts +0 -144
  60. package/src/lib/services/couchdb.ts +0 -275
  61. package/src/lib/services/mobile-keycloak.service.ts +0 -116
  62. package/src/lib/services/network-log.service.ts +0 -27
  63. package/src/lib/services/notification.service.ts +0 -26
  64. package/src/lib/services/request.service.ts +0 -125
  65. package/src/lib/services/utility.service.ts +0 -600
  66. package/src/lib/view-toolkit.module.ts +0 -57
  67. package/src/lib/view-toolkit.spec.ts +0 -23
  68. package/src/lib/view-toolkit.ts +0 -15
  69. package/src/public-api.ts +0 -25
  70. package/tsconfig.lib.json +0 -17
  71. package/tsconfig.lib.prod.json +0 -11
  72. package/tsconfig.spec.json +0 -15
@@ -1,305 +0,0 @@
1
- <div class="form-renderer" [ngClass]="getStyleWithoutClasses(form?.layoutSchema?.style)?.classes"
2
- [ngStyle]="getStyleWithoutClasses(form?.layoutSchema?.style)?.style">
3
- <form *ngIf="form?.layoutSchema?.formSections?.length > 0">
4
- <div *ngFor="let formSection of form?.layoutSchema?.formSections; let i = index" class="section-card">
5
- <div *ngIf="formSection?.label?.caption" class="section-header">
6
- <div class="section-title" [ngClass]="getStyleWithoutClasses(formSection?.label?.style)?.classes"
7
- [ngStyle]="getStyleWithoutClasses(formSection?.label?.style)?.style">
8
- {{ formSection.label.caption }}
9
- </div>
10
- </div>
11
-
12
- <div *ngIf="formSection?.formFields?.length > 0" class="section-body"
13
- [ngClass]="getStyleWithoutClasses(formSection?.style)?.classes" [ngStyle]="getSectionBodyStyle(formSection)">
14
- <div *ngFor="let formField of formSection.formFields" class="field-row"
15
- [ngClass]="getStyleWithoutClasses(formField?.style)?.classes" [ngStyle]="getFieldWrapperStyle(formField)">
16
- <div [ngSwitch]="
17
- formField?.scope?.reference &&
18
- form?.propertySchema?.[getScope(formField.scope?.reference)]
19
- ? form.propertySchema[getScope(formField.scope?.reference)]?.[
20
- formField.scope?.reference.split('/').pop()
21
- ]?.type
22
- : 'default'
23
- ">
24
- <!-- image control -->
25
- <div *ngSwitchCase="'image'" [ngClass]="getStyleWithoutClasses(formField?.scope?.style)?.classes"
26
- [ngStyle]="getStyleWithoutClasses(formField?.scope?.style)?.style">
27
- <img [src]="formField?.option?.src" [alt]="'img'" />
28
- </div>
29
-
30
- <!-- credit card control -->
31
- <div *ngSwitchCase="'carditCard'" [ngClass]="getStyleWithoutClasses(formField?.scope?.style)?.classes"
32
- [ngStyle]="getStyleWithoutClasses(formField?.scope?.style)?.style">
33
- <div id="card-element"></div>
34
- <div id="card-errors" [class]="creditCardError?.textContent !== '' ? 'text-red-400 m-0' : ''"></div>
35
- </div>
36
-
37
- <!-- string control -->
38
- <span *ngSwitchCase="'string'" class="form-group">
39
- <span *ngIf="formField?.option?.protected">
40
- <h5 style="display: flex; justify-content: space-between">
41
- <span [ngClass]="getStyleWithoutClasses(formField?.label?.style)?.classes"
42
- [ngStyle]="getStyleWithoutClasses(formField?.label?.style)?.style">
43
- {{
44
- form.propertySchema[getScope(formField.scope?.reference)]?.[
45
- formField.scope?.reference.split('/').pop()
46
- ]?.caption
47
- }}
48
- </span>
49
-
50
- <span>
51
- {{
52
- form.propertySchema[getScope(formField.scope?.reference)]?.[
53
- formField.scope?.reference.split('/').pop()
54
- ]?.value
55
- }}
56
- </span>
57
- </h5>
58
- </span>
59
-
60
- <span *ngIf="!formField?.option?.protected">
61
- <div [ngStyle]="getFieldInnerLayoutStyle(formField)">
62
- <label [ngClass]="getStyleWithoutClasses(formField?.label?.style)?.classes"
63
- [ngStyle]="getStyleWithoutClasses(formField?.label?.style)?.style">
64
- {{
65
- formField?.label?.value
66
- ? formField.label.value
67
- : formField?.label?.caption
68
- ? formField.label.caption
69
- : form.propertySchema[getScope(formField.scope?.reference)]?.[
70
- formField.scope?.reference.split('/').pop()
71
- ]?.caption
72
- }}
73
- </label>
74
-
75
- <div [ngStyle]="
76
- formField?.option?.password
77
- ? {
78
- position: 'relative',
79
- display: 'flex',
80
- alignItems: 'center'
81
- }
82
- : {}
83
- ">
84
- <input [type]="
85
- formField?.option?.password
86
- ? !showPassword
87
- ? 'password'
88
- : 'text'
89
- : 'text'
90
- " #inputField="ngModel" [required]="formField?.required" [attr.inputmode]="
91
- formField?.option?.email
92
- ? 'email'
93
- : formField?.option?.password
94
- ? 'numeric'
95
- : 'text'
96
- " [pattern]="formField?.email ? customEmailPattern : ''" [email]="formField?.email"
97
- [minlength]="formField?.minlength" [maxlength]="formField?.maxlength"
98
- [ngClass]="getStyleWithoutClasses(formField?.scope?.style)?.classes"
99
- [ngStyle]="getStyleWithoutClasses(formField?.scope?.style)?.style" [(ngModel)]="
100
- form.propertySchema[getScope(formField.scope?.reference)][
101
- formField.scope?.reference.split('/').pop()
102
- ].value
103
- " [name]="formField.scope?.reference" [placeholder]="
104
- form.propertySchema[getScope(formField.scope?.reference)]?.[
105
- formField.scope?.reference.split('/').pop()
106
- ]?.placeholder
107
- " />
108
-
109
- <i *ngIf="formField?.option?.password" class="fa"
110
- [ngClass]="showPassword ? 'fa-eye' : 'fa-eye-slash'" (click)="togglePasswordVisibility()"
111
- style="position: absolute; right: 10px; cursor: pointer"></i>
112
- </div>
113
- </div>
114
-
115
- <div *ngIf="inputField?.touched && inputField?.invalid"
116
- [ngClass]="getStyleWithoutClasses(formField?.validation?.style)?.classes"
117
- [ngStyle]="getStyleWithoutClasses(formField?.validation?.style)?.style">
118
- <p [class]="
119
- formField?.layout === 'horizontal'
120
- ? 'text-red-400 m-0 horizontal-error'
121
- : 'text-red-400 m-0'
122
- " *ngIf="inputField?.errors">
123
- {{ setErroMessage(formField, errorMessages, inputField) }}
124
- </p>
125
- </div>
126
- </span>
127
- </span>
128
-
129
- <!-- number control -->
130
- <div *ngSwitchCase="'number'" class="form-group">
131
- <span *ngIf="formField?.option?.protected"
132
- [ngClass]="getStyleWithoutClasses(formField?.label?.style)?.classes"
133
- [ngStyle]="getStyleWithoutClasses(formField?.label?.style)?.style">
134
- <h5>
135
- {{
136
- form.propertySchema[getScope(formField.scope?.reference)]?.[
137
- formField.scope?.reference.split('/').pop()
138
- ]?.caption
139
- }}
140
-
141
- {{
142
- form.propertySchema[getScope(formField.scope?.reference)]?.[
143
- formField.scope?.reference.split('/').pop()
144
- ]?.value
145
- | currency
146
- : formField?.option?.currency
147
- : true
148
- : formField?.option?.decimalPoint
149
- }}
150
- </h5>
151
- </span>
152
-
153
- <span *ngIf="!formField?.option?.protected">
154
- <div [ngStyle]="getFieldInnerLayoutStyle(formField)">
155
- <label [ngClass]="getStyleWithoutClasses(formField?.label?.style)?.classes"
156
- [ngStyle]="getStyleWithoutClasses(formField?.label?.style)?.style">
157
- {{
158
- formField?.label?.value
159
- ? formField.label.value
160
- : form.propertySchema[getScope(formField.scope?.reference)]?.[
161
- formField.scope?.reference.split('/').pop()
162
- ]?.caption
163
- }}
164
- </label>
165
-
166
- <input type="number" [ngClass]="getStyleWithoutClasses(formField?.scope?.style)?.classes"
167
- [ngStyle]="getStyleWithoutClasses(formField?.scope?.style)?.style" [(ngModel)]="
168
- form.propertySchema[getScope(formField.scope?.reference)][
169
- formField.scope?.reference.split('/').pop()
170
- ].value
171
- " [name]="formField.scope?.reference" [placeholder]="
172
- form.propertySchema[getScope(formField.scope?.reference)]?.[
173
- formField.scope?.reference.split('/').pop()
174
- ]?.placeholder
175
- " />
176
- </div>
177
- </span>
178
- </div>
179
-
180
- <!-- checkbox control -->
181
- <div *ngSwitchCase="'checkbox'" class="form-group"
182
- [ngClass]="getStyleWithoutClasses(formField?.scope?.style)?.classes"
183
- [ngStyle]="getStyleWithoutClasses(formField?.scope?.style)?.style">
184
- <span *ngIf="formField?.option?.postfixCaption">
185
- <label class="form-check-label">
186
- <input type="checkbox" class="form-check-input mr-2" [(ngModel)]="
187
- form.propertySchema[getScope(formField.scope?.reference)][
188
- formField.scope?.reference.split('/').pop()
189
- ].value
190
- " [name]="formField.scope?.reference" (ngModelChange)="setformData()" />
191
-
192
- {{
193
- form.propertySchema[getScope(formField.scope?.reference)]?.[
194
- formField.scope?.reference.split('/').pop()
195
- ]?.caption
196
- }}
197
- </label>
198
- </span>
199
-
200
- <div *ngIf="!formField?.option?.postfixCaption" [ngStyle]="getFieldInnerLayoutStyle(formField)">
201
- <label class="form-check-label">
202
- {{
203
- form.propertySchema[getScope(formField.scope?.reference)]?.[
204
- formField.scope?.reference.split('/').pop()
205
- ]?.caption
206
- }}
207
-
208
- <input type="checkbox" class="form-check-input" [(ngModel)]="
209
- form.propertySchema[getScope(formField.scope?.reference)][
210
- formField.scope?.reference.split('/').pop()
211
- ].value
212
- " [name]="formField.scope?.reference" (ngModelChange)="setformData()" />
213
- </label>
214
- </div>
215
- </div>
216
-
217
- <!-- dropdown control -->
218
- <div *ngSwitchCase="'dropdown'" class="form-group"
219
- [ngClass]="getStyleWithoutClasses(formField?.scope?.style)?.classes"
220
- [ngStyle]="getStyleWithoutClasses(formField?.scope?.style)?.style">
221
- <span *ngIf="formField?.option?.postfixCaption">
222
- <select id="dynamic-dropdown" #dropdownField="ngModel"
223
- [ngClass]="getStyleWithoutClasses(formField?.scope?.style)?.classes"
224
- [ngStyle]="getStyleWithoutClasses(formField?.scope?.style)?.style" [name]="formField.scope?.reference"
225
- [(ngModel)]="
226
- form.propertySchema[getScope(formField.scope?.reference)][
227
- formField.scope?.reference.split('/').pop()
228
- ].value
229
- ">
230
- <option *ngFor="
231
- let item of form.propertySchema[getScope(formField.scope?.reference)]?.[
232
- formField.scope?.reference.split('/').pop()
233
- ]?.data
234
- " [value]="item[formField?.option?.optionValue]">
235
- {{ item[formField?.option?.optionLabel] }}
236
- </option>
237
- </select>
238
-
239
- <label [ngClass]="getStyleWithoutClasses(formField?.label?.style)?.classes"
240
- [ngStyle]="getStyleWithoutClasses(formField?.label?.style)?.style">
241
- {{
242
- form.propertySchema[getScope(formField.scope?.reference)]?.[
243
- formField.scope?.reference.split('/').pop()
244
- ]?.caption
245
- }}
246
- </label>
247
- </span>
248
-
249
- <div *ngIf="!formField?.option?.postfixCaption">
250
- <div [ngStyle]="getFieldInnerLayoutStyle(formField)">
251
- <label [ngClass]="getStyleWithoutClasses(formField?.label?.style)?.classes"
252
- [ngStyle]="getStyleWithoutClasses(formField?.label?.style)?.style">
253
- {{
254
- form.propertySchema[getScope(formField.scope?.reference)]?.[
255
- formField.scope?.reference.split('/').pop()
256
- ]?.caption
257
- }}
258
- </label>
259
-
260
- <nz-select nzShowSearch nzAllowClear nzPlaceHolder="Select" #dropdownField="ngModel"
261
- [required]="formField?.required"
262
- [ngClass]="getStyleWithoutClasses(formField?.scope?.style)?.classes"
263
- [ngStyle]="getStyleWithoutClasses(formField?.scope?.style)?.style"
264
- [name]="formField.scope?.reference" [(ngModel)]="
265
- form.propertySchema[getScope(formField.scope?.reference)][
266
- formField.scope?.reference.split('/').pop()
267
- ].value
268
- ">
269
- <nz-option *ngFor="
270
- let item of form.propertySchema[getScope(formField.scope?.reference)]?.[
271
- formField.scope?.reference.split('/').pop()
272
- ]?.data
273
- " [nzLabel]="item[formField?.option?.optionLabel]"
274
- [nzValue]="item[formField?.option?.optionValue]"></nz-option>
275
- </nz-select>
276
- </div>
277
-
278
- <div *ngIf="dropdownField?.touched && dropdownField?.invalid"
279
- [ngClass]="getStyleWithoutClasses(formField?.validation?.style)?.classes"
280
- [ngStyle]="getStyleWithoutClasses(formField?.validation?.style)?.style">
281
- <p [class]="
282
- formField?.layout === 'horizontal'
283
- ? 'text-red-400 m-0 horizontal-error'
284
- : 'text-red-400 m-0'
285
- " *ngIf="dropdownField?.errors">
286
- {{ setErroMessage(formField, errorMessages, dropdownField) }}
287
- </p>
288
- </div>
289
- </div>
290
- </div>
291
-
292
- <!-- button/default control -->
293
- <div *ngSwitchCase="'default'">
294
- <button type="submit" [ngClass]="getStyleWithoutClasses(formField?.style)?.classes"
295
- [ngStyle]="getStyleWithoutClasses(formField?.style)?.style"
296
- (click)="invokeFormBtnClick(formField?.option, form.propertySchema)">
297
- {{ formField?.label?.caption }}
298
- </button>
299
- </div>
300
- </div>
301
- </div>
302
- </div>
303
- </div>
304
- </form>
305
- </div>
@@ -1,333 +0,0 @@
1
- import {
2
- AfterViewInit,
3
- Component,
4
- EventEmitter,
5
- Input,
6
- Output,
7
- SimpleChanges,
8
- OnChanges,
9
- OnInit,
10
- } from '@angular/core';
11
- import { CommonModule } from '@angular/common';
12
- import { FormsModule } from '@angular/forms';
13
- import { NzSelectModule } from 'ng-zorro-antd/select';
14
-
15
- @Component({
16
- standalone: true,
17
- imports: [CommonModule, FormsModule, NzSelectModule],
18
- selector: 'vl-form',
19
- templateUrl: './form.component.html',
20
- styleUrl: './form.component.css',
21
- })
22
- export class FormComponent implements OnInit, OnChanges, AfterViewInit {
23
- customEmailPattern = '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$';
24
-
25
- showPassword = false;
26
- formCopy: any = {};
27
-
28
- @Input() errorMessages: any = {};
29
- @Input() creditCardError: any = {};
30
- @Input() form: any = {};
31
- @Input() selectedLanguageInfo: any = {};
32
-
33
- @Output() formButtonClick: EventEmitter<any> = new EventEmitter();
34
- @Output() checkBoxChangeEvent: EventEmitter<any> = new EventEmitter();
35
-
36
- ngOnInit(): void { }
37
-
38
- ngOnChanges(changes: SimpleChanges): void {
39
- if (changes['form'] && this.form) {
40
- this.formCopy = this.safeClone(this.form);
41
- this.setValidations();
42
- }
43
-
44
- if (
45
- (changes['selectedLanguageInfo'] || this.selectedLanguageInfo) &&
46
- this.selectedLanguageInfo?.selectedLanguage
47
- ) {
48
- this.applySelectedLanguage();
49
- this.setValidations();
50
- }
51
- }
52
-
53
- ngAfterViewInit(): void {
54
- setTimeout(() => {
55
- this.setValidations();
56
- });
57
- }
58
-
59
- private safeClone(value: any): any {
60
- try {
61
- return JSON.parse(JSON.stringify(value || {}));
62
- } catch {
63
- return {};
64
- }
65
- }
66
-
67
- private applySelectedLanguage(): void {
68
- if (this.selectedLanguageInfo?.errorMessages) {
69
- this.errorMessages = this.selectedLanguageInfo.errorMessages;
70
- }
71
-
72
- if (!this.formCopy || !this.form) {
73
- return;
74
- }
75
-
76
- const selectedLanguage = this.selectedLanguageInfo.selectedLanguage;
77
-
78
- this.form.propertySchema = this.formCopy.propertySchema
79
- ? this.safeClone(this.formCopy.propertySchema)
80
- : {};
81
-
82
- this.form.propertySchema = this.translateSchema(
83
- this.form.propertySchema,
84
- selectedLanguage
85
- );
86
-
87
- if (this.formCopy?.layoutSchema?.formSections?.length) {
88
- this.formCopy.layoutSchema.formSections.forEach(
89
- (formSection: any, sectionIndex: number) => {
90
- if (
91
- formSection?.label?.caption &&
92
- selectedLanguage[formSection.label.caption]
93
- ) {
94
- this.form.layoutSchema.formSections[sectionIndex].label.caption =
95
- selectedLanguage[formSection.label.caption];
96
- }
97
-
98
- if (formSection?.formFields?.length) {
99
- formSection.formFields.forEach(
100
- (formField: any, fieldIndex: number) => {
101
- if (
102
- formField?.label?.caption &&
103
- selectedLanguage[formField.label.caption]
104
- ) {
105
- this.form.layoutSchema.formSections[sectionIndex].formFields[
106
- fieldIndex
107
- ].label.caption = selectedLanguage[formField.label.caption];
108
- }
109
- }
110
- );
111
- }
112
- }
113
- );
114
- }
115
- }
116
-
117
- translateSchema(schema: any, selectedLanguage: any): any {
118
- if (!schema || typeof schema !== 'object' || !selectedLanguage) {
119
- return schema;
120
- }
121
-
122
- Object.keys(schema).forEach((key) => {
123
- const value = schema[key];
124
-
125
- if (value && typeof value === 'object' && !Array.isArray(value)) {
126
- this.translateSchema(value, selectedLanguage);
127
- }
128
-
129
- if (Array.isArray(value)) {
130
- value.forEach((item) => {
131
- if (item && typeof item === 'object') {
132
- this.translateSchema(item, selectedLanguage);
133
- }
134
- });
135
- }
136
-
137
- if (
138
- value &&
139
- typeof value === 'object' &&
140
- typeof value.caption === 'string' &&
141
- value.caption.trim()
142
- ) {
143
- const original = value.caption.trim();
144
-
145
- if (selectedLanguage[original]) {
146
- value.caption = selectedLanguage[original];
147
- }
148
- }
149
-
150
- if (
151
- value &&
152
- typeof value === 'object' &&
153
- typeof value.placeholder === 'string' &&
154
- value.placeholder.trim()
155
- ) {
156
- const original = value.placeholder.trim();
157
-
158
- if (selectedLanguage[original]) {
159
- value.placeholder = selectedLanguage[original];
160
- }
161
- }
162
- });
163
-
164
- return schema;
165
- }
166
-
167
- getStyleWithoutClasses(styleObject: any): { classes: string; style: any } {
168
- if (!styleObject || typeof styleObject !== 'object') {
169
- return { classes: '', style: {} };
170
- }
171
-
172
- const { classes, ...styleWithoutClasses } = styleObject;
173
-
174
- return {
175
- classes: Array.isArray(classes) ? classes.join(' ') : classes || '',
176
- style: styleWithoutClasses || {},
177
- };
178
- }
179
-
180
- getSectionBodyStyle(formSection: any): any {
181
- const layout = formSection?.layout || {};
182
- const schemaStyle = this.getStyleWithoutClasses(formSection?.style).style;
183
-
184
- return {
185
- display: schemaStyle?.display || 'grid',
186
- gridTemplateColumns:
187
- schemaStyle?.gridTemplateColumns ||
188
- `repeat(${layout?.desktopColumns || 12}, minmax(0, 1fr))`,
189
- gap: schemaStyle?.gap || layout?.gap || '10px',
190
- alignItems: schemaStyle?.alignItems || 'start',
191
- width: '100%',
192
- boxSizing: 'border-box',
193
- ...schemaStyle,
194
- };
195
- }
196
-
197
- getFieldWrapperStyle(formField: any): any {
198
- const schemaStyle = this.getStyleWithoutClasses(formField?.style).style;
199
-
200
- return {
201
- minWidth: 0,
202
- width: '100%',
203
- boxSizing: 'border-box',
204
- ...schemaStyle,
205
- };
206
- }
207
-
208
- getFieldInnerLayoutStyle(formField: any): any {
209
- if (formField?.layout === 'horizontal') {
210
- return {
211
- display: 'grid',
212
- gridTemplateColumns: 'minmax(110px, 30%) 1fr',
213
- alignItems: 'center',
214
- gap: '10px',
215
- };
216
- }
217
-
218
- return {
219
- display: 'block',
220
- };
221
- }
222
-
223
- getScope(scope: any): string {
224
- if (!scope || typeof scope !== 'string') {
225
- return '';
226
- }
227
-
228
- const start = scope.indexOf('#/') + 2;
229
- const end = scope.indexOf('/', start);
230
-
231
- if (start >= 2 && end > start) {
232
- return scope.substring(start, end);
233
- }
234
-
235
- return '';
236
- }
237
-
238
- togglePasswordVisibility(): void {
239
- this.showPassword = !this.showPassword;
240
- }
241
-
242
- invokeFormBtnClick(option: any, propertySchema: any): void {
243
- this.formButtonClick.emit({
244
- option,
245
- propertySchema,
246
- });
247
- }
248
-
249
- setformData(): void {
250
- this.checkBoxChangeEvent.emit(this.form?.propertySchema);
251
- }
252
-
253
- setErroMessage(formField: any, errorMessages: any, field: any): string {
254
- let error = '';
255
- let fieldName = '';
256
-
257
- if (field?.errors?.required) {
258
- error = errorMessages?.required || '';
259
- } else if (field?.errors?.email || field?.errors?.pattern) {
260
- error = errorMessages?.pattern || '';
261
- } else if (field?.errors?.minlength) {
262
- error = errorMessages?.minlength || '';
263
- } else if (field?.errors?.maxlength) {
264
- error = errorMessages?.maxlength || '';
265
- }
266
-
267
- if (formField?.label?.value) {
268
- fieldName = formField.label.value;
269
- } else {
270
- const scope = this.getScope(formField?.scope?.reference);
271
- const key = formField?.scope?.reference?.split('/').pop();
272
- const propertySchema = this.form?.propertySchema?.[scope]?.[key];
273
-
274
- fieldName = propertySchema?.caption || propertySchema?.placeholder || '';
275
- }
276
-
277
- if (error && error.toString().includes('{{requiredLength}}')) {
278
- error = error.replace(
279
- /{{\s*requiredLength\s*}}/g,
280
- formField?.minlength?.toString() || ''
281
- );
282
- }
283
-
284
- return error.replace(/{{\s*field\s*}}/g, fieldName);
285
- }
286
-
287
- setValidations(): void {
288
- if (!this.form?.layoutSchema?.formSections?.length) {
289
- return;
290
- }
291
-
292
- this.form.layoutSchema.formSections.forEach((formSection: any) => {
293
- if (!formSection?.formFields?.length) {
294
- return;
295
- }
296
-
297
- formSection.formFields.forEach((formField: any) => {
298
- const reference = formField?.scope?.reference;
299
-
300
- if (!reference || !this.form?.propertySchema) {
301
- return;
302
- }
303
-
304
- const scope = this.getScope(reference);
305
- const key = reference.split('/').pop();
306
-
307
- const property = this.form.propertySchema?.[scope]?.[key];
308
-
309
- if (!property?.validation?.length) {
310
- return;
311
- }
312
-
313
- property.validation.forEach((validation: any) => {
314
- if (validation.required) {
315
- formField.required = true;
316
- }
317
-
318
- if (validation.email) {
319
- formField.email = true;
320
- }
321
-
322
- if (validation.minlength) {
323
- formField.minlength = validation.minlength;
324
- }
325
-
326
- if (validation.maxlength) {
327
- formField.maxlength = validation.maxlength;
328
- }
329
- });
330
- });
331
- });
332
- }
333
- }
File without changes