ngx-histaff-alpha 5.9.1 → 5.9.3

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 (62) hide show
  1. package/fesm2022/{ngx-histaff-alpha-ai-hint-for-table.component-ClNRMk6B.mjs → ngx-histaff-alpha-ai-hint-for-table.component-BzUUTmoN.mjs} +3 -3
  2. package/fesm2022/{ngx-histaff-alpha-ai-hint-for-table.component-ClNRMk6B.mjs.map → ngx-histaff-alpha-ai-hint-for-table.component-BzUUTmoN.mjs.map} +1 -1
  3. package/fesm2022/ngx-histaff-alpha-core-form-design.component-C_yKnqtf.mjs +3256 -0
  4. package/fesm2022/ngx-histaff-alpha-core-form-design.component-C_yKnqtf.mjs.map +1 -0
  5. package/fesm2022/{ngx-histaff-alpha-core-sticker-collection.component-ZJ29hnW7.mjs → ngx-histaff-alpha-core-sticker-collection.component-Bl-aiwIo.mjs} +3 -3
  6. package/fesm2022/{ngx-histaff-alpha-core-sticker-collection.component-ZJ29hnW7.mjs.map → ngx-histaff-alpha-core-sticker-collection.component-Bl-aiwIo.mjs.map} +1 -1
  7. package/fesm2022/{ngx-histaff-alpha-core-toast-loading.component-D4lPsJ_K.mjs → ngx-histaff-alpha-core-toast-loading.component-B74LCLn2.mjs} +2 -2
  8. package/fesm2022/{ngx-histaff-alpha-core-toast-loading.component-D4lPsJ_K.mjs.map → ngx-histaff-alpha-core-toast-loading.component-B74LCLn2.mjs.map} +1 -1
  9. package/fesm2022/{ngx-histaff-alpha-core-workflow-consume.component-Dxy4PssU.mjs → ngx-histaff-alpha-core-workflow-consume.component-BDBQQUAT.mjs} +2 -2
  10. package/fesm2022/{ngx-histaff-alpha-core-workflow-consume.component-Dxy4PssU.mjs.map → ngx-histaff-alpha-core-workflow-consume.component-BDBQQUAT.mjs.map} +1 -1
  11. package/fesm2022/{ngx-histaff-alpha-db-settings.component-ovw3ShzY.mjs → ngx-histaff-alpha-db-settings.component-BVIb2eWg.mjs} +5 -5
  12. package/fesm2022/{ngx-histaff-alpha-db-settings.component-ovw3ShzY.mjs.map → ngx-histaff-alpha-db-settings.component-BVIb2eWg.mjs.map} +1 -1
  13. package/fesm2022/{ngx-histaff-alpha-design-wrapper.component-Dd5UoJX1.mjs → ngx-histaff-alpha-design-wrapper.component-KuubA0Jn.mjs} +11 -9
  14. package/fesm2022/ngx-histaff-alpha-design-wrapper.component-KuubA0Jn.mjs.map +1 -0
  15. package/fesm2022/{ngx-histaff-alpha-design-wrapper.route-DLdFwwhp.mjs → ngx-histaff-alpha-design-wrapper.route-CSmaOUHg.mjs} +5 -5
  16. package/fesm2022/{ngx-histaff-alpha-design-wrapper.route-DLdFwwhp.mjs.map → ngx-histaff-alpha-design-wrapper.route-CSmaOUHg.mjs.map} +1 -1
  17. package/fesm2022/{ngx-histaff-alpha-form-array-props.component-DkAM9Uk9.mjs → ngx-histaff-alpha-form-array-props.component-DuM5ZMkG.mjs} +5 -8
  18. package/fesm2022/ngx-histaff-alpha-form-array-props.component-DuM5ZMkG.mjs.map +1 -0
  19. package/fesm2022/{ngx-histaff-alpha-live-form.component-BMCAth2_.mjs → ngx-histaff-alpha-live-form.component-D7oAY8-L.mjs} +17 -23
  20. package/fesm2022/ngx-histaff-alpha-live-form.component-D7oAY8-L.mjs.map +1 -0
  21. package/fesm2022/{ngx-histaff-alpha-ngx-histaff-alpha-CkvGEG39.mjs → ngx-histaff-alpha-ngx-histaff-alpha-Dh4tWGKT.mjs} +1180 -391
  22. package/fesm2022/ngx-histaff-alpha-ngx-histaff-alpha-Dh4tWGKT.mjs.map +1 -0
  23. package/fesm2022/{ngx-histaff-alpha-tracker-studio.component-CeB-VuEP.mjs → ngx-histaff-alpha-tracker-studio.component-D77fag1W.mjs} +2 -2
  24. package/fesm2022/{ngx-histaff-alpha-tracker-studio.component-CeB-VuEP.mjs.map → ngx-histaff-alpha-tracker-studio.component-D77fag1W.mjs.map} +1 -1
  25. package/fesm2022/{ngx-histaff-alpha-wf-form-assign.component-CO09ZkTB.mjs → ngx-histaff-alpha-wf-form-assign.component-CixDiq8u.mjs} +2 -2
  26. package/fesm2022/{ngx-histaff-alpha-wf-form-assign.component-CO09ZkTB.mjs.map → ngx-histaff-alpha-wf-form-assign.component-CixDiq8u.mjs.map} +1 -1
  27. package/fesm2022/ngx-histaff-alpha-wf-instance-status.component-oBkeUjfP.mjs +177 -0
  28. package/fesm2022/ngx-histaff-alpha-wf-instance-status.component-oBkeUjfP.mjs.map +1 -0
  29. package/fesm2022/{ngx-histaff-alpha-wf-instance-step-react.component-DRUYdQY3.mjs → ngx-histaff-alpha-wf-instance-step-react.component-D53ZEW27.mjs} +3 -3
  30. package/fesm2022/{ngx-histaff-alpha-wf-instance-step-react.component-DRUYdQY3.mjs.map → ngx-histaff-alpha-wf-instance-step-react.component-D53ZEW27.mjs.map} +1 -1
  31. package/fesm2022/ngx-histaff-alpha.mjs +1 -1
  32. package/lib/app/directives/html-tooltip.directive.d.ts +14 -4
  33. package/lib/app/libraries/core-button-group-vns/core-button-group-vns/EnumCoreButtonVNSCode.d.ts +3 -0
  34. package/lib/app/libraries/core-control/core-control/core-control.component.d.ts +1 -0
  35. package/lib/app/libraries/core-form/core-form/core-form.component.d.ts +1 -0
  36. package/lib/app/libraries/core-form/core-form/enum-interfaces.d.ts +1 -1
  37. package/lib/app/libraries/core-form/core-form-array/core-form-array.component.d.ts +8 -9
  38. package/lib/app/libraries/core-form-design/core-form-array-layout-editor/core-form-array-layout-editor.component.d.ts +14 -13
  39. package/lib/app/libraries/core-form-design/core-form-design-monitor/core-form-design-monitor.component.d.ts +35 -0
  40. package/lib/app/libraries/core-form-design/core-form-design.component.d.ts +5 -23
  41. package/lib/app/libraries/core-form-design/core-form-design.service.d.ts +41 -14
  42. package/lib/app/libraries/core-form-design/core-form-group-editor.component.d.ts +104 -0
  43. package/lib/app/libraries/core-form-design/field-setting/base-props/base-props.component.d.ts +10 -4
  44. package/lib/app/libraries/core-form-design/field-setting/calculated-props/calculated-props.component.d.ts +0 -1
  45. package/lib/app/libraries/core-form-design/field-setting/field-setting.component.d.ts +4 -3
  46. package/lib/app/libraries/core-form-design/interfaces.d.ts +3 -1
  47. package/lib/app/libraries/core-form-design/json-safe.pipe.d.ts +11 -0
  48. package/lib/app/libraries/core-form-design/live-form/live-form.component.d.ts +1 -2
  49. package/lib/app/libraries/core-form-design/props-host/props-host.component.d.ts +2 -1
  50. package/lib/app/libraries/core-workflow-builder/core-workflow.service.d.ts +1 -0
  51. package/lib/app/libraries/core-workflow-builder/wf-instance-status/wf-instance-status.component.d.ts +3 -0
  52. package/lib/app/services/json.service.d.ts +5 -1
  53. package/lib/app/services/organization.service.d.ts +3 -1
  54. package/package.json +1 -1
  55. package/fesm2022/ngx-histaff-alpha-core-form-design.component-KQsI4L2g.mjs +0 -2437
  56. package/fesm2022/ngx-histaff-alpha-core-form-design.component-KQsI4L2g.mjs.map +0 -1
  57. package/fesm2022/ngx-histaff-alpha-design-wrapper.component-Dd5UoJX1.mjs.map +0 -1
  58. package/fesm2022/ngx-histaff-alpha-form-array-props.component-DkAM9Uk9.mjs.map +0 -1
  59. package/fesm2022/ngx-histaff-alpha-live-form.component-BMCAth2_.mjs.map +0 -1
  60. package/fesm2022/ngx-histaff-alpha-ngx-histaff-alpha-CkvGEG39.mjs.map +0 -1
  61. package/fesm2022/ngx-histaff-alpha-wf-instance-status.component-DQfVNySE.mjs +0 -153
  62. package/fesm2022/ngx-histaff-alpha-wf-instance-status.component-DQfVNySE.mjs.map +0 -1
@@ -0,0 +1,3256 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ChangeDetectorRef, Component, signal, effect, HostListener, ChangeDetectionStrategy, Injectable, input, computed, viewChild, ViewContainerRef, Input, EventEmitter, Output, Renderer2, isDevMode } from '@angular/core';
3
+ import { trigger, state, transition, style, animate } from '@angular/animations';
4
+ import { n as CoreFormDesignService, b as CoreWorkflowService, B as BaseEditComponent, i as AlertService, L as AppConfigService, O as EnumCorePageEditMode, P as EnumCoreButtonVNSCode, R as READONLY_WORKFLOW_FIELDS, Q as noneAutoClosedAlertOptions, p as DialogService, M as MultiLanguageService, C as CorePageHeaderComponent, U as CoreFormComponent, V as CoreButtonGroupVnsComponent, T as TranslatePipe, E as EnumFormBaseContolType, e as BaseComponent, W as EnumCoreTablePipeType, J as CoreCheckboxComponent, r as CoreDropdownComponent, g as TooltipDirective, G as GptService, l as alertOptions, y as CoreRadioGroupComponent, X as HtmlTooltipDirective, c as EnumCoreFormControlSeekerSourceType, Y as CoreControlNoFormArrayComponent, Z as EnumFormDesignMode, q as DomService, K as JsonService, z as ApplicationHelpService, _ as CoreControlComponent, $ as JsonSafePipe, j as TableCellPipe, H as HotKeysDirective, s as CoreChecklistComponent, u as CoreFormControlSeekerComponent, a0 as CoreAttachmentComponent, t as CoreDatePickerComponent, a1 as CoreMonthSelectorComponent, v as CoreCurrencyInputComponent } from './ngx-histaff-alpha-ngx-histaff-alpha-Dh4tWGKT.mjs';
5
+ import * as i1 from '@angular/forms';
6
+ import { FormsModule, FormGroup, FormControl, FormArray, Validators, ReactiveFormsModule } from '@angular/forms';
7
+ import { NgStyle, JsonPipe, AsyncPipe, NgTemplateOutlet } from '@angular/common';
8
+ import { BehaviorSubject, catchError, of, filter, distinctUntilChanged, tap, switchMap } from 'rxjs';
9
+ import { Router, ActivatedRoute } from '@angular/router';
10
+ import { CoreStickerCollectionComponent } from './ngx-histaff-alpha-core-sticker-collection.component-Bl-aiwIo.mjs';
11
+ import { D as DbService, C as CoreToastLoadingComponent } from './ngx-histaff-alpha-core-toast-loading.component-B74LCLn2.mjs';
12
+ import { EnumTranslateKey } from 'alpha-global-constants';
13
+ import { L as LiveFormComponent } from './ngx-histaff-alpha-live-form.component-D7oAY8-L.mjs';
14
+
15
+ const slideFromTopFadeIn = trigger('slideFromTopFadeIn', [
16
+ state('in', style({ opacity: 1, transform: 'translateY(0)' })),
17
+ state('out', style({ opacity: 0, transform: 'translateY(-50vh)' })),
18
+ transition('out => in', [
19
+ animate('200ms ease-out')
20
+ ]),
21
+ transition('in => out', [
22
+ animate('150ms ease-in')
23
+ ])
24
+ ]);
25
+
26
+ class SaveLiveJsonComponent {
27
+ constructor() {
28
+ this.fds = inject(CoreFormDesignService);
29
+ this.cdr = inject(ChangeDetectorRef);
30
+ this.wfs = inject(CoreWorkflowService);
31
+ }
32
+ copyToClipboard() {
33
+ navigator.clipboard.writeText(this.fds.$saveLiveJson());
34
+ }
35
+ download() {
36
+ const blob = new Blob([this.fds.$saveLiveJson()], { type: 'application/json' });
37
+ const url = URL.createObjectURL(blob);
38
+ const link = document.createElement('a');
39
+ link.href = url;
40
+ link.download = `${this.fds.$afInstance().name || 'form'}.json`;
41
+ link.click();
42
+ }
43
+ ngAfterViewInit() {
44
+ setTimeout(() => this.cdr.markForCheck());
45
+ }
46
+ ngOnDestroy() {
47
+ this.wfs.$initialFormDesignJson.set('{}');
48
+ }
49
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: SaveLiveJsonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
50
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: SaveLiveJsonComponent, isStandalone: true, selector: "save-live-json", ngImport: i0, template: "<pre class=\"json-preview\">{{ fds.$saveLiveJson() }}</pre>", styles: [".json-preview{background-color:#fff;color:#333;padding:1rem 1.5rem;border-radius:10px;box-shadow:0 2px 6px #00000014;font-family:Fira Code,monospace;font-size:.85rem;word-break:keep-all;overflow-x:auto;line-height:1.5;width:390px;height:calc(100vh - 125px);margin:0}\n"] }); }
51
+ }
52
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: SaveLiveJsonComponent, decorators: [{
53
+ type: Component,
54
+ args: [{ selector: 'save-live-json', imports: [], template: "<pre class=\"json-preview\">{{ fds.$saveLiveJson() }}</pre>", styles: [".json-preview{background-color:#fff;color:#333;padding:1rem 1.5rem;border-radius:10px;box-shadow:0 2px 6px #00000014;font-family:Fira Code,monospace;font-size:.85rem;word-break:keep-all;overflow-x:auto;line-height:1.5;width:390px;height:calc(100vh - 125px);margin:0}\n"] }]
55
+ }] });
56
+
57
+ class FormMetadataComponent extends BaseEditComponent {
58
+ onEscape() {
59
+ this.coreFormDesignService.$showFormMetadata.set(false);
60
+ }
61
+ onWindowClick(_) {
62
+ /*
63
+ Trigger What Happens
64
+ 🖱️ First Click: Opens checklist overlay, but Angular hasn’t re-checked the DOM yet → markForCheck() is called, but view not updated yet
65
+ 🖱️ Second Click: Now DOM is updated, click is registered inside the actual rendered checklist, interaction works
66
+ */
67
+ //This lets Angular finish updating the DOM before running change detection.
68
+ setTimeout(() => this.cdr.markForCheck());
69
+ }
70
+ constructor(dialogService, mls) {
71
+ super(dialogService);
72
+ this.dialogService = dialogService;
73
+ this.mls = mls;
74
+ this.coreFormDesignService = inject(CoreFormDesignService);
75
+ this.wfs = inject(CoreWorkflowService);
76
+ this.cdr = inject(ChangeDetectorRef);
77
+ this.alertService = inject(AlertService);
78
+ this.router = inject(Router);
79
+ this.appConfigService = inject(AppConfigService);
80
+ this.form = this.coreFormDesignService.formMetadata;
81
+ this.$loading = signal(false);
82
+ this.mode$ = new BehaviorSubject(EnumCorePageEditMode.UPDATE);
83
+ this.customButtonChecklistOptions$ = this.coreFormDesignService.formMetadataCustomButtonChecklistOptions$;
84
+ this.$sections = this.coreFormDesignService.$formMetadataSections;
85
+ this.$isInWorkflowDesign = this.coreFormDesignService.$isInWorkflowDesign;
86
+ this.customButtons = [
87
+ EnumCoreButtonVNSCode.NONE_HEADER_SAVE,
88
+ ];
89
+ effect(() => {
90
+ if (this.coreFormDesignService.$shouldPatchMetadataForm()) {
91
+ this.patchFormFromInstance();
92
+ this.coreFormDesignService.$shouldPatchMetadataForm.set(false); // ✅ reset
93
+ }
94
+ });
95
+ effect(() => {
96
+ const isInWorkflowDesign = this.$isInWorkflowDesign();
97
+ if (isInWorkflowDesign) {
98
+ READONLY_WORKFLOW_FIELDS.forEach(x => {
99
+ const control = this.form.get(x);
100
+ control?.disable();
101
+ });
102
+ }
103
+ else {
104
+ }
105
+ });
106
+ }
107
+ patchFormFromInstance() {
108
+ const instance = this.coreFormDesignService.$afInstance();
109
+ this.form.patchValue({
110
+ name: instance.name,
111
+ captionCode: instance.captionCode,
112
+ entityTable: instance.entityTable ?? '',
113
+ submitApi: instance.submitApi,
114
+ postSubmitRoute: instance.postSubmitRoute ?? '',
115
+ postCancelRoute: instance.postCancelRoute ?? '',
116
+ normalMode: instance.normalMode ?? false,
117
+ autoGetByIdOff: instance.autoGetByIdOff ?? false,
118
+ hasIdOfStringType: instance.hasIdOfStringType ?? false,
119
+ customFormButtonItems: instance.customFormButtonItems ?? [],
120
+ crudCreate: instance.crud?.c ?? '',
121
+ crudRead: instance.crud?.r ?? '',
122
+ crudUpdate: instance.crud?.u ?? '',
123
+ crudDelete: instance.crud?.d ?? '',
124
+ crudReadChildren: instance.crud?.rChildren ?? '',
125
+ entityUniqueIndexesJson: JSON.stringify(instance.entityUniqueIndexes ?? [])
126
+ });
127
+ }
128
+ onButtonClick(e) {
129
+ if (e.code === EnumCoreButtonVNSCode.NONE_HEADER_SAVE) {
130
+ if (this.form.valid) {
131
+ this.$loading.set(true);
132
+ const apiObject = this.coreFormDesignService.editMode$.value === EnumCorePageEditMode.CREATE ?
133
+ this.coreFormDesignService.createFormInstance(this.coreFormDesignService.$afInstance()) :
134
+ this.coreFormDesignService.updateFormInstance(this.coreFormDesignService.$afInstance());
135
+ const apiObservable = apiObject.pipe(catchError(err => {
136
+ this.$loading.set(false);
137
+ const msg = err?.error?.message || // API-defined message
138
+ err?.message || // Native JS or HttpErrorResponse
139
+ err?.statusText || // Fallback
140
+ 'An unknown error occurred.';
141
+ this.alertService.error(msg, noneAutoClosedAlertOptions);
142
+ return of(msg);
143
+ }));
144
+ apiObservable.subscribe(x => {
145
+ this.$loading.set(false);
146
+ if (x.ok && x.status === 200 && x.body?.statusCode === 200) {
147
+ this.coreFormDesignService.$showFormMetadata.set(false);
148
+ }
149
+ });
150
+ }
151
+ else {
152
+ this.coreFormDesignService.formMetadataCheckError$.next(true);
153
+ setTimeout(() => this.cdr.markForCheck());
154
+ setTimeout(() => this.coreFormDesignService.formMetadataCheckError$.next(false), 5000);
155
+ }
156
+ }
157
+ }
158
+ onClose() {
159
+ this.coreFormDesignService.$showFormMetadata.set(false);
160
+ }
161
+ onSave(e) {
162
+ }
163
+ onFormCreated(event) {
164
+ const form = event.formGroup;
165
+ form.get('normalMode')?.valueChanges.subscribe(x => {
166
+ this.coreFormDesignService.$liveFormNormalMode.set(!!x);
167
+ });
168
+ form.get('customFormButtonItems')?.valueChanges.subscribe(x => {
169
+ if (Array.isArray(x)) {
170
+ this.coreFormDesignService.$customFormButtonItems.set(x);
171
+ }
172
+ else {
173
+ this.coreFormDesignService.$customFormButtonItems.set(undefined);
174
+ }
175
+ });
176
+ const widthField = form.get('width');
177
+ if (!!widthField) {
178
+ widthField.valueChanges.subscribe(width => {
179
+ console.warn(`WAR [width$] changed explicitly:`, width);
180
+ });
181
+ }
182
+ else {
183
+ console.warn(`WAR [widthField] not found`);
184
+ }
185
+ form.valueChanges.subscribe(value => {
186
+ console.warn('[width] from form.valueChanges', value?.width);
187
+ const current = this.coreFormDesignService.$afInstance();
188
+ const { crudCreate, crudRead, crudUpdate, crudDelete, crudReadChildren,
189
+ // ES6 destructuring: Pull id out of the object and throw it away under the name _ignored — don’t include it in rest
190
+ id: _ignored, ...rest } = value;
191
+ const updatedCrud = {
192
+ ...current.crud,
193
+ ...(crudCreate !== undefined ? { c: crudCreate } : {}),
194
+ ...(crudRead !== undefined ? { r: crudRead } : {}),
195
+ ...(crudUpdate !== undefined ? { u: crudUpdate } : {}),
196
+ ...(crudDelete !== undefined ? { d: crudDelete } : {}),
197
+ ...(crudReadChildren !== undefined ? { rChildren: crudReadChildren } : {})
198
+ };
199
+ const next = {
200
+ ...current,
201
+ ...rest,
202
+ width: rest.width ?? current.width, // That way, rogue undefined values can’t silently override valid ones.
203
+ crud: updatedCrud
204
+ };
205
+ console.log("[FormMetadataComponent][onFormCreated]: $afInstance is being set on form.valueChanges");
206
+ this.coreFormDesignService.$afInstance.set(next);
207
+ });
208
+ form.statusChanges.subscribe(status => {
209
+ // Optional: Save status if you want to show error summary, disable save button, etc.
210
+ this.formStatus = status; // string: 'VALID' | 'INVALID' | 'PENDING' | 'DISABLED'
211
+ });
212
+ this.form = form;
213
+ }
214
+ ngAfterViewInit() {
215
+ // Defer to next tick to avoid ExpressionChangedAfterItHasBeenCheckedError
216
+ this.$isInWorkflowDesign.set(this.router.url.includes('/workflow/design'));
217
+ setTimeout(() => {
218
+ const allButtons = Object.values(EnumCoreButtonVNSCode);
219
+ const noneHeaderOptions = allButtons
220
+ .filter(value => value.startsWith('NONE_HEADER_') && value !== 'NONE_HEADER_IMPORT_OPTION')
221
+ .map(value => ({
222
+ value,
223
+ text: this.mls.trans(value),
224
+ checked: false
225
+ }));
226
+ this.customButtonChecklistOptions$.next(noneHeaderOptions);
227
+ const sections = this.coreFormDesignService.$placeholderSections();
228
+ // 🔥 DO NOT READ this.$afInstance()
229
+ console.log("[FormMetadataComponent][ngAfterViewInit]: $afInstance is being updated");
230
+ this.coreFormDesignService.$afInstance.update(instance => ({
231
+ ...instance,
232
+ formDesignSections: sections
233
+ }));
234
+ // Inform Angular to re-check since values arrived late
235
+ this.cdr.markForCheck();
236
+ });
237
+ }
238
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: FormMetadataComponent, deps: [{ token: DialogService }, { token: MultiLanguageService }], target: i0.ɵɵFactoryTarget.Component }); }
239
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.5", type: FormMetadataComponent, isStandalone: true, selector: "form-metadata", host: { listeners: { "document:keydown.escape": "onEscape($event)", "window:click": "onWindowClick($event)" } }, usesInheritance: true, ngImport: i0, template: "<div class=\"form-metadata-container\">\r\n\r\n <div class=\"metadata-body\">\r\n\r\n <div class=\"header-n-form\">\r\n\r\n @if (!$isInWorkflowDesign()) {\r\n\r\n <div class=\"h15\"></div>\r\n\r\n <div class=\"d-flex d-flex-start w-100 pr1rem\">\r\n <core-button-group-vns [showCaption]=\"true\" [forHeader]=\"false\" (buttonClick)=\"onButtonClick($event)\"\r\n [shownItems]=\"customButtons\" class=\"buttonGroupCustom\"></core-button-group-vns>\r\n </div>\r\n <div class=\"h15\"></div>\r\n\r\n <div class=\"header-wrapper\">\r\n <core-page-header [title]=\"'FORM OVERVIEW'\" [hideButtonGroup]=\"true\"></core-page-header>\r\n <div class=\"close-wrapper\" (click)=\"onClose()\">\r\n <i class=\"feather-x\"></i>\r\n </div>\r\n </div>\r\n\r\n } \r\n\r\n\r\n\r\n <div class=\"af-instance\">\r\n\r\n <div class=\"af-instance-left\">\r\n <core-form \r\n [inputSections]=\"$sections()\" \r\n [width]=\"800\" \r\n [mode$]=\"mode$\" \r\n [checkError$]=\"coreFormDesignService.formMetadataCheckError$\"\r\n [hideButtons]=\"true\" \r\n [forceCreateNewForm]=\"true\"\r\n [hideDevSector]=\"!!$isInWorkflowDesign()\"\r\n (onFormCreated)=\"onFormCreated($event)\" />\r\n </div>\r\n\r\n </div>\r\n </div>\r\n\r\n @if (!$isInWorkflowDesign()) {\r\n <div class=\"af-instance-right\">\r\n <save-live-json></save-live-json>\r\n </div>\r\n }\r\n\r\n\r\n </div>\r\n\r\n</div>", styles: [".form-metadata-container .header-wrapper{padding:0 15px}.form-metadata-container .header-wrapper .close-wrapper{display:flex;position:absolute;right:7px;top:8px;width:24px;height:24px;color:#848484;cursor:pointer}.form-metadata-container .header-wrapper .close-wrapper i{font-size:24px}.form-metadata-container .af-instance{display:flex}.form-metadata-container .h15{height:15px!important}.form-metadata-container .pr1rem{padding-right:1rem}.form-metadata-container .metadata-body{display:flex;align-items:flex-start;justify-content:space-between}.form-metadata-container .af-instance-right{margin-top:45px;margin-right:15px}\n"], dependencies: [{ kind: "component", type: CorePageHeaderComponent, selector: "core-page-header", inputs: ["instanceNumber", "shownItems", "title", "hideButtonGroup", "htmlTooltipRef"], outputs: ["buttonClick"] }, { kind: "component", type: CoreFormComponent, selector: "core-form", inputs: ["formName", "width", "submitText", "leftInputSections", "leftInputSectionsFlexSize", "inputSections", "mode$", "bottomTemplateRef", "customFormButtonItems", "showCaptionButton", "disableSaveButton", "disableCancelButton", "checkError$", "hideButtons", "forceCreateNewForm", "secondBottomTemplateRef", "hideDevSector", "hideCalculatedSection", "buttonGroupTemplateRef"], outputs: ["onFormCreated", "onFormRefCreated", "onSubmit", "onSave", "onCancal", "buttonClick"] }, { kind: "component", type: SaveLiveJsonComponent, selector: "save-live-json" }, { kind: "component", type: CoreButtonGroupVnsComponent, selector: "core-button-group-vns", inputs: ["height", "instanceNumber", "forHeader", "fixedShow", "shownItems", "showCaption", "lastChildEffectOff"], outputs: ["buttonClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
240
+ }
241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: FormMetadataComponent, decorators: [{
242
+ type: Component,
243
+ args: [{ selector: 'form-metadata', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
244
+ TranslatePipe,
245
+ CorePageHeaderComponent,
246
+ CoreFormComponent,
247
+ SaveLiveJsonComponent,
248
+ CoreButtonGroupVnsComponent
249
+ ], template: "<div class=\"form-metadata-container\">\r\n\r\n <div class=\"metadata-body\">\r\n\r\n <div class=\"header-n-form\">\r\n\r\n @if (!$isInWorkflowDesign()) {\r\n\r\n <div class=\"h15\"></div>\r\n\r\n <div class=\"d-flex d-flex-start w-100 pr1rem\">\r\n <core-button-group-vns [showCaption]=\"true\" [forHeader]=\"false\" (buttonClick)=\"onButtonClick($event)\"\r\n [shownItems]=\"customButtons\" class=\"buttonGroupCustom\"></core-button-group-vns>\r\n </div>\r\n <div class=\"h15\"></div>\r\n\r\n <div class=\"header-wrapper\">\r\n <core-page-header [title]=\"'FORM OVERVIEW'\" [hideButtonGroup]=\"true\"></core-page-header>\r\n <div class=\"close-wrapper\" (click)=\"onClose()\">\r\n <i class=\"feather-x\"></i>\r\n </div>\r\n </div>\r\n\r\n } \r\n\r\n\r\n\r\n <div class=\"af-instance\">\r\n\r\n <div class=\"af-instance-left\">\r\n <core-form \r\n [inputSections]=\"$sections()\" \r\n [width]=\"800\" \r\n [mode$]=\"mode$\" \r\n [checkError$]=\"coreFormDesignService.formMetadataCheckError$\"\r\n [hideButtons]=\"true\" \r\n [forceCreateNewForm]=\"true\"\r\n [hideDevSector]=\"!!$isInWorkflowDesign()\"\r\n (onFormCreated)=\"onFormCreated($event)\" />\r\n </div>\r\n\r\n </div>\r\n </div>\r\n\r\n @if (!$isInWorkflowDesign()) {\r\n <div class=\"af-instance-right\">\r\n <save-live-json></save-live-json>\r\n </div>\r\n }\r\n\r\n\r\n </div>\r\n\r\n</div>", styles: [".form-metadata-container .header-wrapper{padding:0 15px}.form-metadata-container .header-wrapper .close-wrapper{display:flex;position:absolute;right:7px;top:8px;width:24px;height:24px;color:#848484;cursor:pointer}.form-metadata-container .header-wrapper .close-wrapper i{font-size:24px}.form-metadata-container .af-instance{display:flex}.form-metadata-container .h15{height:15px!important}.form-metadata-container .pr1rem{padding-right:1rem}.form-metadata-container .metadata-body{display:flex;align-items:flex-start;justify-content:space-between}.form-metadata-container .af-instance-right{margin-top:45px;margin-right:15px}\n"] }]
250
+ }], ctorParameters: () => [{ type: DialogService }, { type: MultiLanguageService }], propDecorators: { onEscape: [{
251
+ type: HostListener,
252
+ args: ['document:keydown.escape', ['$event']]
253
+ }], onWindowClick: [{
254
+ type: HostListener,
255
+ args: ['window:click', ['$event']]
256
+ }] } });
257
+
258
+ class AttachmentFieldHelperService {
259
+ static isAttachment(control) {
260
+ return control.controlType === 'ATTACHMENT';
261
+ }
262
+ static autoGenerateAttachmentNames(baseName) {
263
+ return {
264
+ field: baseName + 'Buffer',
265
+ assignTo: baseName
266
+ };
267
+ }
268
+ static buildHiddenAssignToField(baseFieldName) {
269
+ return {
270
+ field: baseFieldName,
271
+ controlType: EnumFormBaseContolType.TEXTBOX,
272
+ type: 'string',
273
+ label: '',
274
+ value: '',
275
+ hidden: true,
276
+ flexSize: 0
277
+ };
278
+ }
279
+ static injectAssignToFieldIntoRow(row, assignToField) {
280
+ row.cells.push({ runtimeId: crypto.randomUUID(), flexSize: assignToField.flexSize ?? 12, control: assignToField });
281
+ }
282
+ /**
283
+ * Called when user edits the "field" of an ATTACHMENT control
284
+ */
285
+ static handleFieldNameChangeForAttachment(control, form, typedFieldName) {
286
+ const { field, assignTo } = this.autoGenerateAttachmentNames(typedFieldName);
287
+ control.field = field;
288
+ control.assignTo = assignTo;
289
+ }
290
+ /**
291
+ * Called in drop handler when user drops a new ATTACHMENT
292
+ */
293
+ static setupAttachmentOnDrop(newControl, form) {
294
+ if (this.isAttachment(newControl)) {
295
+ const baseName = newControl.field.replace(/Buffer$/, '');
296
+ const { field, assignTo } = this.autoGenerateAttachmentNames(baseName);
297
+ newControl.field = field;
298
+ newControl.assignTo = assignTo;
299
+ }
300
+ }
301
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AttachmentFieldHelperService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
302
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AttachmentFieldHelperService, providedIn: 'root' }); }
303
+ }
304
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AttachmentFieldHelperService, decorators: [{
305
+ type: Injectable,
306
+ args: [{
307
+ providedIn: 'root'
308
+ }]
309
+ }] });
310
+
311
+ class BasePropsComponent extends BaseComponent {
312
+ constructor() {
313
+ super(...arguments);
314
+ this.$isNested = input(false);
315
+ this.coreFormDesignService = inject(CoreFormDesignService);
316
+ this.$selectedCell = computed(() => {
317
+ if (this.$isNested()) {
318
+ return this.coreFormDesignService.$nestedSelectedCell();
319
+ }
320
+ else {
321
+ return this.coreFormDesignService.$selectedCell();
322
+ }
323
+ });
324
+ this.$formContext = computed(() => {
325
+ if (this.$isNested()) {
326
+ return this.coreFormDesignService.$nestedFormContext();
327
+ }
328
+ else {
329
+ return this.coreFormDesignService.$formContext();
330
+ }
331
+ });
332
+ this.form = this.$isNested() ? this.coreFormDesignService.nestedFormDesign : this.coreFormDesignService.formDesign;
333
+ this.patchControl = this.coreFormDesignService.patchControl.bind(this.coreFormDesignService);
334
+ this.normalize = this.coreFormDesignService.normalize.bind(this.coreFormDesignService);
335
+ this.cdr = inject(ChangeDetectorRef);
336
+ this.setControlProp = this.coreFormDesignService.setControlProp.bind(this.coreFormDesignService);
337
+ /*
338
+ $control = computed<IFormBaseControl>(() => {
339
+ console.log("🔴🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 BasePropsComponent.$control")
340
+ let _cell: IFormDesignCell | null;
341
+ if (this.$isNested()) {
342
+ _cell = this.coreFormDesignService.$nestedSelectedCell();
343
+ if (!_cell?.control) throw new Error('No control selected!');
344
+ if (_cell?.runtimeId === this.nestedSelectedCellRuntimeId) {
345
+ return this.nestedControl;
346
+ } else {
347
+ this.nestedSelectedCellRuntimeId = _cell.runtimeId;
348
+ this.nestedControl = this.normalize(_cell.control);
349
+ return this.nestedControl;
350
+ }
351
+ } else {
352
+ _cell = this.coreFormDesignService.$selectedCell();
353
+ if (!_cell?.control) throw new Error('No control selected!');
354
+ if (_cell?.runtimeId === this.selectedCellRuntimeId) {
355
+ return this.control;
356
+ } else {
357
+ this.selectedCellRuntimeId = _cell.runtimeId;
358
+ this.control = this.normalize(_cell.control);
359
+ return this.control;
360
+ }
361
+ }
362
+ });
363
+ */
364
+ this.$control = computed(() => {
365
+ const isNested = this.$isNested();
366
+ let control = isNested ? this.coreFormDesignService.$nestedControl() : this.coreFormDesignService.$control();
367
+ if (!control) {
368
+ control = this.coreFormDesignService.normalize({});
369
+ }
370
+ console.log("🔴 BasePropsComponent computed $control value", control);
371
+ return control;
372
+ });
373
+ }
374
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: BasePropsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
375
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.5", type: BasePropsComponent, isStandalone: true, selector: "base-props", inputs: { $isNested: { classPropertyName: "$isNested", publicName: "$isNested", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: './base-props.component.html', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
376
+ }
377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: BasePropsComponent, decorators: [{
378
+ type: Component,
379
+ args: [{
380
+ selector: 'base-props',
381
+ changeDetection: ChangeDetectionStrategy.OnPush,
382
+ template: './base-props.component.html'
383
+ }]
384
+ }] });
385
+
386
+ class MandatoryPropsComponent extends BasePropsComponent {
387
+ constructor() {
388
+ super(...arguments);
389
+ this.$fieldInputRef = viewChild('fieldInput');
390
+ this.afs = inject(CoreFormDesignService);
391
+ this.$isNormalField = computed(() => {
392
+ if (this.$isNested()) {
393
+ return this.afs.$nestedControl()?.type !== 'calculated';
394
+ }
395
+ else {
396
+ return this.afs.$control()?.type !== 'calculated';
397
+ }
398
+ });
399
+ this.$typedField = computed(() => {
400
+ const control = this.$control();
401
+ const field = AttachmentFieldHelperService.isAttachment(control)
402
+ ? control.assignTo || ''
403
+ : control.field;
404
+ return field;
405
+ });
406
+ }
407
+ onFieldChange(val) {
408
+ this.setControlProp('field', val, this.$isNested());
409
+ const expected = this.$typedField();
410
+ const actual = this.$fieldInputRef()?.nativeElement.value;
411
+ if (!!actual && actual !== expected) {
412
+ console.warn('Manual fix: input mismatch detected. Forcing value reset.');
413
+ this.$fieldInputRef().nativeElement.value = expected;
414
+ }
415
+ }
416
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: MandatoryPropsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
417
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.5", type: MandatoryPropsComponent, isStandalone: true, selector: "mandatory-props", viewQueries: [{ propertyName: "$fieldInputRef", first: true, predicate: ["fieldInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"setting-group mandatory-group\" [ngStyle]=\"{ padding: '15px', maxWidth: '352px' }\">\r\n\r\n <div class=\"setting-row\">\r\n <label>Field</label>\r\n <input #fieldInput class=\"form-control\" type=\"text\" \r\n [ngModel]=\"$typedField()\" \r\n (ngModelChange)=\"onFieldChange($event)\" />\r\n </div>\r\n\r\n <div class=\"setting-row\">\r\n <label>Label</label>\r\n <input class=\"form-control\" type=\"text\" [ngModel]=\"$control()?.label\" (ngModelChange)=\"setControlProp('label', $event, $isNested())\" />\r\n </div>\r\n\r\n @if ($isNormalField()) {\r\n\r\n <div class=\"setting-row\">\r\n <label>Flex Size</label>\r\n <input class=\"form-control\" type=\"number\" [ngModel]=\"$control()?.flexSize\" (ngModelChange)=\"setControlProp('flexSize', $event, $isNested())\" />\r\n </div>\r\n\r\n @if ($control()?.controlType !== 'FORM_ARRAY') {\r\n <div class=\"setting-row\">\r\n <label>Default</label>\r\n <input class=\"form-control\" type=\"text\" [ngModel]=\"$control()?.value\" (ngModelChange)=\"setControlProp('value', $event, $isNested())\" />\r\n </div>\r\n }\r\n }\r\n\r\n</div>", styles: [".setting-group{display:flex;flex-direction:column}.setting-row{display:flex;justify-content:flex-start;align-items:center;height:50px}.setting-row label{width:30%}.setting-row .control-wrapper,.setting-row input,.setting-row .readonly-field{width:65%}.setting-row .readonly-field{font-style:italic;color:#666}.setting-row input.validator-value{text-align:right}.setting-row input.validator-value.pattern{text-align:left}.setting-row .control-wrapper{display:flex;align-items:center;justify-content:flex-start}.validator-group .setting-row{justify-content:flex-start}.validator-group .setting-row input{margin-left:15px;width:100%}.tiny-lock{margin-left:6px;font-size:12px;color:#888}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
418
+ }
419
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: MandatoryPropsComponent, decorators: [{
420
+ type: Component,
421
+ args: [{ selector: 'mandatory-props', changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgStyle, FormsModule], template: "<div class=\"setting-group mandatory-group\" [ngStyle]=\"{ padding: '15px', maxWidth: '352px' }\">\r\n\r\n <div class=\"setting-row\">\r\n <label>Field</label>\r\n <input #fieldInput class=\"form-control\" type=\"text\" \r\n [ngModel]=\"$typedField()\" \r\n (ngModelChange)=\"onFieldChange($event)\" />\r\n </div>\r\n\r\n <div class=\"setting-row\">\r\n <label>Label</label>\r\n <input class=\"form-control\" type=\"text\" [ngModel]=\"$control()?.label\" (ngModelChange)=\"setControlProp('label', $event, $isNested())\" />\r\n </div>\r\n\r\n @if ($isNormalField()) {\r\n\r\n <div class=\"setting-row\">\r\n <label>Flex Size</label>\r\n <input class=\"form-control\" type=\"number\" [ngModel]=\"$control()?.flexSize\" (ngModelChange)=\"setControlProp('flexSize', $event, $isNested())\" />\r\n </div>\r\n\r\n @if ($control()?.controlType !== 'FORM_ARRAY') {\r\n <div class=\"setting-row\">\r\n <label>Default</label>\r\n <input class=\"form-control\" type=\"text\" [ngModel]=\"$control()?.value\" (ngModelChange)=\"setControlProp('value', $event, $isNested())\" />\r\n </div>\r\n }\r\n }\r\n\r\n</div>", styles: [".setting-group{display:flex;flex-direction:column}.setting-row{display:flex;justify-content:flex-start;align-items:center;height:50px}.setting-row label{width:30%}.setting-row .control-wrapper,.setting-row input,.setting-row .readonly-field{width:65%}.setting-row .readonly-field{font-style:italic;color:#666}.setting-row input.validator-value{text-align:right}.setting-row input.validator-value.pattern{text-align:left}.setting-row .control-wrapper{display:flex;align-items:center;justify-content:flex-start}.validator-group .setting-row{justify-content:flex-start}.validator-group .setting-row input{margin-left:15px;width:100%}.tiny-lock{margin-left:6px;font-size:12px;color:#888}\n"] }]
422
+ }] });
423
+
424
+ class OptionalPropsComponent extends BasePropsComponent {
425
+ constructor() {
426
+ super(...arguments);
427
+ this.pipeOptions = Object.values(EnumCoreTablePipeType);
428
+ this.pipeOptions$ = new BehaviorSubject(Object.values(EnumCoreTablePipeType).map(x => ({ value: x, text: x })));
429
+ }
430
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: OptionalPropsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
431
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: OptionalPropsComponent, isStandalone: true, selector: "optional-props", usesInheritance: true, ngImport: i0, template: "<div class=\"setting-group optional-group\" [ngStyle]=\"{ padding: '15px' }\">\r\n\r\n <div class=\"setting-row optional-bool\">\r\n <label>Readonly</label>\r\n <core-checkbox ngModel ngDefaultControl [ngModel]=\"$control().readonly\" (ngModelChange)=\"setControlProp('readonly', $event, $isNested())\" />\r\n </div>\r\n\r\n <div class=\"setting-row optional-bool\">\r\n <label>Hidden</label>\r\n <core-checkbox [ngModel]=\"$control().hidden\" (ngModelChange)=\"setControlProp('hidden', $event, $isNested())\" />\r\n </div>\r\n\r\n <div class=\"setting-row optional-bool\">\r\n <label>Disabled</label>\r\n <core-checkbox [ngModel]=\"$control().disabled\" (ngModelChange)=\"setControlProp('disabled', $event, $isNested())\" /> \r\n </div>\r\n\r\n <div class=\"setting-row\">\r\n <label>Hint</label>\r\n <input class=\"form-control\" type=\"text\" [ngModel]=\"$control().hint\" (ngModelChange)=\"setControlProp('hint', $event, $isNested())\" />\r\n </div>\r\n\r\n <div class=\"setting-row\">\r\n <label>Pipe</label>\r\n <div class=\"control-wrapper\">\r\n <core-dropdown [ngModel]=\"$control().pipe\" (ngModelChange)=\"setControlProp('pipe', $event, $isNested())\"\r\n [paramMode]=\"true\"\r\n [options$]=\"pipeOptions$\"\r\n >\r\n </core-dropdown>\r\n </div>\r\n </div>\r\n\r\n</div>", styles: [".setting-group{display:flex;flex-direction:column}.setting-row{display:flex;justify-content:flex-start;align-items:center;height:50px}.setting-row label{width:30%}.setting-row .control-wrapper,.setting-row input,.setting-row .readonly-field{width:65%}.setting-row .readonly-field{font-style:italic;color:#666}.setting-row input.validator-value{text-align:right}.setting-row input.validator-value.pattern{text-align:left}.setting-row .control-wrapper{display:flex;align-items:center;justify-content:flex-start}.validator-group .setting-row{justify-content:flex-start}.validator-group .setting-row input{margin-left:15px;width:100%}.tiny-lock{margin-left:6px;font-size:12px;color:#888}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CoreCheckboxComponent, selector: "core-checkbox", inputs: ["text", "tooltipPosition", "tooltip", "inputValue", "disabled"], outputs: ["onClick"] }, { kind: "component", type: CoreDropdownComponent, selector: "core-dropdown", inputs: ["getByIdObject$", "paramMode", "shownFrom", "options$", "height", "placeholder", "loading", "warningDisable", "clearDisable", "fitHeightWithItemCount", "itemHeight", "optionApiDriven", "optionApi", "optionHttpVerb", "optionHttpPayload", "optionValueFrom", "optionTextFrom"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
432
+ }
433
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: OptionalPropsComponent, decorators: [{
434
+ type: Component,
435
+ args: [{ selector: 'optional-props', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
436
+ NgStyle,
437
+ FormsModule,
438
+ CoreCheckboxComponent,
439
+ CoreDropdownComponent
440
+ ], template: "<div class=\"setting-group optional-group\" [ngStyle]=\"{ padding: '15px' }\">\r\n\r\n <div class=\"setting-row optional-bool\">\r\n <label>Readonly</label>\r\n <core-checkbox ngModel ngDefaultControl [ngModel]=\"$control().readonly\" (ngModelChange)=\"setControlProp('readonly', $event, $isNested())\" />\r\n </div>\r\n\r\n <div class=\"setting-row optional-bool\">\r\n <label>Hidden</label>\r\n <core-checkbox [ngModel]=\"$control().hidden\" (ngModelChange)=\"setControlProp('hidden', $event, $isNested())\" />\r\n </div>\r\n\r\n <div class=\"setting-row optional-bool\">\r\n <label>Disabled</label>\r\n <core-checkbox [ngModel]=\"$control().disabled\" (ngModelChange)=\"setControlProp('disabled', $event, $isNested())\" /> \r\n </div>\r\n\r\n <div class=\"setting-row\">\r\n <label>Hint</label>\r\n <input class=\"form-control\" type=\"text\" [ngModel]=\"$control().hint\" (ngModelChange)=\"setControlProp('hint', $event, $isNested())\" />\r\n </div>\r\n\r\n <div class=\"setting-row\">\r\n <label>Pipe</label>\r\n <div class=\"control-wrapper\">\r\n <core-dropdown [ngModel]=\"$control().pipe\" (ngModelChange)=\"setControlProp('pipe', $event, $isNested())\"\r\n [paramMode]=\"true\"\r\n [options$]=\"pipeOptions$\"\r\n >\r\n </core-dropdown>\r\n </div>\r\n </div>\r\n\r\n</div>", styles: [".setting-group{display:flex;flex-direction:column}.setting-row{display:flex;justify-content:flex-start;align-items:center;height:50px}.setting-row label{width:30%}.setting-row .control-wrapper,.setting-row input,.setting-row .readonly-field{width:65%}.setting-row .readonly-field{font-style:italic;color:#666}.setting-row input.validator-value{text-align:right}.setting-row input.validator-value.pattern{text-align:left}.setting-row .control-wrapper{display:flex;align-items:center;justify-content:flex-start}.validator-group .setting-row{justify-content:flex-start}.validator-group .setting-row input{margin-left:15px;width:100%}.tiny-lock{margin-left:6px;font-size:12px;color:#888}\n"] }]
441
+ }] });
442
+
443
+ class PropsHostComponent {
444
+ constructor() {
445
+ this.$isNested = input(false);
446
+ this.vcRef = inject(ViewContainerRef);
447
+ }
448
+ set props(value) {
449
+ this._props = value;
450
+ this.assignInputs();
451
+ }
452
+ async ngOnInit() {
453
+ if (this.loadComponent) {
454
+ const componentType = await this.loadComponent();
455
+ this.componentRef = this.vcRef.createComponent(componentType);
456
+ this.assignInputs();
457
+ }
458
+ }
459
+ assignInputs() {
460
+ if (this.componentRef && this._props) {
461
+ Object.assign(this.componentRef.instance, this._props);
462
+ this.componentRef.changeDetectorRef.markForCheck();
463
+ }
464
+ }
465
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: PropsHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
466
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.5", type: PropsHostComponent, isStandalone: true, selector: "props-host", inputs: { loadComponent: { classPropertyName: "loadComponent", publicName: "loadComponent", isSignal: false, isRequired: false, transformFunction: null }, $isNested: { classPropertyName: "$isNested", publicName: "$isNested", isSignal: true, isRequired: false, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: false, isRequired: false, transformFunction: null } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
467
+ }
468
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: PropsHostComponent, decorators: [{
469
+ type: Component,
470
+ args: [{
471
+ selector: 'props-host',
472
+ template: '',
473
+ changeDetection: ChangeDetectionStrategy.OnPush
474
+ }]
475
+ }], propDecorators: { loadComponent: [{
476
+ type: Input
477
+ }], props: [{
478
+ type: Input
479
+ }] } });
480
+
481
+ class AttachmentPropsComponent extends BasePropsComponent {
482
+ constructor() {
483
+ super(...arguments);
484
+ this.$typedField = computed(() => {
485
+ const control = this.$control();
486
+ return AttachmentFieldHelperService.isAttachment(control)
487
+ ? control.assignTo || ''
488
+ : control.field;
489
+ });
490
+ }
491
+ setTypedField(val) {
492
+ const control = this.$control();
493
+ const context = this.$formContext();
494
+ if (AttachmentFieldHelperService.isAttachment(control)) {
495
+ AttachmentFieldHelperService.handleFieldNameChangeForAttachment(control, context, val);
496
+ }
497
+ else {
498
+ control.field = val;
499
+ }
500
+ this.patchControl(control, this.$isNested());
501
+ }
502
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AttachmentPropsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
503
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: AttachmentPropsComponent, isStandalone: true, selector: "attachment-props", usesInheritance: true, ngImport: i0, template: "<p>attachment-props works!</p>\r\n", styles: [".setting-group{display:flex;flex-direction:column}.setting-row{display:flex;justify-content:flex-start;align-items:center;height:50px}.setting-row label{width:30%}.setting-row .control-wrapper,.setting-row input,.setting-row .readonly-field{width:65%}.setting-row .readonly-field{font-style:italic;color:#666}.setting-row input.validator-value{text-align:right}.setting-row input.validator-value.pattern{text-align:left}.setting-row .control-wrapper{display:flex;align-items:center;justify-content:flex-start}.validator-group .setting-row{justify-content:flex-start}.validator-group .setting-row input{margin-left:15px;width:100%}.tiny-lock{margin-left:6px;font-size:12px;color:#888}\n"] }); }
504
+ }
505
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: AttachmentPropsComponent, decorators: [{
506
+ type: Component,
507
+ args: [{ selector: 'attachment-props', imports: [], template: "<p>attachment-props works!</p>\r\n", styles: [".setting-group{display:flex;flex-direction:column}.setting-row{display:flex;justify-content:flex-start;align-items:center;height:50px}.setting-row label{width:30%}.setting-row .control-wrapper,.setting-row input,.setting-row .readonly-field{width:65%}.setting-row .readonly-field{font-style:italic;color:#666}.setting-row input.validator-value{text-align:right}.setting-row input.validator-value.pattern{text-align:left}.setting-row .control-wrapper{display:flex;align-items:center;justify-content:flex-start}.validator-group .setting-row{justify-content:flex-start}.validator-group .setting-row input{margin-left:15px;width:100%}.tiny-lock{margin-left:6px;font-size:12px;color:#888}\n"] }]
508
+ }] });
509
+
510
+ class ChecklistPropsComponent {
511
+ constructor() {
512
+ this.controlChange = new EventEmitter();
513
+ }
514
+ update() {
515
+ this.controlChange.emit(this.control);
516
+ }
517
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ChecklistPropsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
518
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: ChecklistPropsComponent, isStandalone: true, selector: "checklist-props", inputs: { control: "control" }, outputs: { controlChange: "controlChange" }, ngImport: i0, template: "<p>checklist-props works!</p>\r\n", styles: [""] }); }
519
+ }
520
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ChecklistPropsComponent, decorators: [{
521
+ type: Component,
522
+ args: [{ selector: 'checklist-props', imports: [], template: "<p>checklist-props works!</p>\r\n" }]
523
+ }], propDecorators: { control: [{
524
+ type: Input
525
+ }], controlChange: [{
526
+ type: Output
527
+ }] } });
528
+
529
+ class DatepickerPropsComponent {
530
+ constructor() {
531
+ this.controlChange = new EventEmitter();
532
+ }
533
+ update() {
534
+ this.controlChange.emit(this.control);
535
+ }
536
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DatepickerPropsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
537
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: DatepickerPropsComponent, isStandalone: true, selector: "datepicker-props", inputs: { control: "control" }, outputs: { controlChange: "controlChange" }, ngImport: i0, template: "<p>datepicker-props works!</p>\r\n", styles: [""] }); }
538
+ }
539
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DatepickerPropsComponent, decorators: [{
540
+ type: Component,
541
+ args: [{ selector: 'datepicker-props', imports: [], template: "<p>datepicker-props works!</p>\r\n" }]
542
+ }], propDecorators: { control: [{
543
+ type: Input
544
+ }], controlChange: [{
545
+ type: Output
546
+ }] } });
547
+
548
+ class DropdownPropsComponent extends BasePropsComponent {
549
+ constructor() {
550
+ super(...arguments);
551
+ this.jsonPayload = '';
552
+ this.httpVerbOptions$ = new BehaviorSubject([
553
+ {
554
+ value: 'HttpGet',
555
+ text: 'GET'
556
+ },
557
+ {
558
+ value: 'HttpPost',
559
+ text: 'POST'
560
+ }
561
+ ]);
562
+ }
563
+ onPayloadJsonBlur() {
564
+ try {
565
+ const optionHttpPayload = JSON.parse(this.jsonPayload);
566
+ this.setControlProp('optionHttpPayload', optionHttpPayload, this.$isNested());
567
+ }
568
+ catch (e) {
569
+ console.warn('⚠️ Invalid JSON payload');
570
+ }
571
+ }
572
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DropdownPropsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
573
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.5", type: DropdownPropsComponent, isStandalone: true, selector: "dropdown-props", usesInheritance: true, ngImport: i0, template: "<div class=\"setting-group dropdown-group\" [ngStyle]=\"{ padding: '15px' }\">\r\n\r\n <div class=\"setting-row optional-bool\">\r\n <label>Use API</label>\r\n <core-checkbox [ngModel]=\"$control().optionApiDriven\" (ngModelChange)=\"setControlProp('optionApiDriven', $event, $isNested())\" />\r\n </div>\r\n\r\n @if (!!$control().optionApiDriven) {\r\n <div class=\"setting-row\">\r\n <label>API Endpoint</label>\r\n <input class=\"form-control\" type=\"text\" [ngModel]=\"$control().optionApi\" (ngModelChange)=\"setControlProp('optionApi', $event, $isNested())\" />\r\n </div>\r\n\r\n <div class=\"setting-row\">\r\n <label>HTTP Verb</label>\r\n <div class=\"control-wrapper\">\r\n <core-dropdown [ngModel]=\"$control().optionHttpVerb\" (ngModelChange)=\"setControlProp('optionHttpVerb', $event, $isNested())\" [paramMode]=\"true\"\r\n [options$]=\"httpVerbOptions$\">\r\n </core-dropdown>\r\n </div>\r\n </div>\r\n\r\n @if ($control().optionHttpVerb === 'HttpPost') {\r\n <div class=\"setting-row\">\r\n <label>Payload (JSON)</label>\r\n <div class=\"control-wrapper\">\r\n <textarea class=\"form-control\" rows=\"3\" [(ngModel)]=\"jsonPayload\" (ngModelChange)=\"onPayloadJsonBlur()\"></textarea>\r\n </div>\r\n </div>\r\n }\r\n\r\n <div class=\"setting-row\">\r\n <label>Value Field</label>\r\n <input class=\"form-control\" type=\"text\" [ngModel]=\"$control().optionValueFrom\" (ngModelChange)=\"setControlProp('optionValueFrom', $event, $isNested())\" />\r\n </div>\r\n\r\n <div class=\"setting-row\">\r\n <label>Text Field</label>\r\n <input class=\"form-control\" type=\"text\" [ngModel]=\"$control().optionTextFrom\" (ngModelChange)=\"setControlProp('optionTextFrom', $event, $isNested())\" />\r\n </div>\r\n }\r\n</div>", styles: [".setting-group{display:flex;flex-direction:column}.setting-row{display:flex;justify-content:flex-start;align-items:center;height:50px}.setting-row label{width:30%}.setting-row .control-wrapper,.setting-row input,.setting-row .readonly-field{width:65%}.setting-row .readonly-field{font-style:italic;color:#666}.setting-row input.validator-value{text-align:right}.setting-row input.validator-value.pattern{text-align:left}.setting-row .control-wrapper{display:flex;align-items:center;justify-content:flex-start}.validator-group .setting-row{justify-content:flex-start}.validator-group .setting-row input{margin-left:15px;width:100%}.tiny-lock{margin-left:6px;font-size:12px;color:#888}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CoreCheckboxComponent, selector: "core-checkbox", inputs: ["text", "tooltipPosition", "tooltip", "inputValue", "disabled"], outputs: ["onClick"] }, { kind: "component", type: CoreDropdownComponent, selector: "core-dropdown", inputs: ["getByIdObject$", "paramMode", "shownFrom", "options$", "height", "placeholder", "loading", "warningDisable", "clearDisable", "fitHeightWithItemCount", "itemHeight", "optionApiDriven", "optionApi", "optionHttpVerb", "optionHttpPayload", "optionValueFrom", "optionTextFrom"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
574
+ }
575
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DropdownPropsComponent, decorators: [{
576
+ type: Component,
577
+ args: [{ selector: 'dropdown-props', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
578
+ NgStyle,
579
+ FormsModule,
580
+ CoreCheckboxComponent,
581
+ CoreDropdownComponent,
582
+ ], template: "<div class=\"setting-group dropdown-group\" [ngStyle]=\"{ padding: '15px' }\">\r\n\r\n <div class=\"setting-row optional-bool\">\r\n <label>Use API</label>\r\n <core-checkbox [ngModel]=\"$control().optionApiDriven\" (ngModelChange)=\"setControlProp('optionApiDriven', $event, $isNested())\" />\r\n </div>\r\n\r\n @if (!!$control().optionApiDriven) {\r\n <div class=\"setting-row\">\r\n <label>API Endpoint</label>\r\n <input class=\"form-control\" type=\"text\" [ngModel]=\"$control().optionApi\" (ngModelChange)=\"setControlProp('optionApi', $event, $isNested())\" />\r\n </div>\r\n\r\n <div class=\"setting-row\">\r\n <label>HTTP Verb</label>\r\n <div class=\"control-wrapper\">\r\n <core-dropdown [ngModel]=\"$control().optionHttpVerb\" (ngModelChange)=\"setControlProp('optionHttpVerb', $event, $isNested())\" [paramMode]=\"true\"\r\n [options$]=\"httpVerbOptions$\">\r\n </core-dropdown>\r\n </div>\r\n </div>\r\n\r\n @if ($control().optionHttpVerb === 'HttpPost') {\r\n <div class=\"setting-row\">\r\n <label>Payload (JSON)</label>\r\n <div class=\"control-wrapper\">\r\n <textarea class=\"form-control\" rows=\"3\" [(ngModel)]=\"jsonPayload\" (ngModelChange)=\"onPayloadJsonBlur()\"></textarea>\r\n </div>\r\n </div>\r\n }\r\n\r\n <div class=\"setting-row\">\r\n <label>Value Field</label>\r\n <input class=\"form-control\" type=\"text\" [ngModel]=\"$control().optionValueFrom\" (ngModelChange)=\"setControlProp('optionValueFrom', $event, $isNested())\" />\r\n </div>\r\n\r\n <div class=\"setting-row\">\r\n <label>Text Field</label>\r\n <input class=\"form-control\" type=\"text\" [ngModel]=\"$control().optionTextFrom\" (ngModelChange)=\"setControlProp('optionTextFrom', $event, $isNested())\" />\r\n </div>\r\n }\r\n</div>", styles: [".setting-group{display:flex;flex-direction:column}.setting-row{display:flex;justify-content:flex-start;align-items:center;height:50px}.setting-row label{width:30%}.setting-row .control-wrapper,.setting-row input,.setting-row .readonly-field{width:65%}.setting-row .readonly-field{font-style:italic;color:#666}.setting-row input.validator-value{text-align:right}.setting-row input.validator-value.pattern{text-align:left}.setting-row .control-wrapper{display:flex;align-items:center;justify-content:flex-start}.validator-group .setting-row{justify-content:flex-start}.validator-group .setting-row input{margin-left:15px;width:100%}.tiny-lock{margin-left:6px;font-size:12px;color:#888}\n"] }]
583
+ }] });
584
+
585
+ var dropdownProps_component = /*#__PURE__*/Object.freeze({
586
+ __proto__: null,
587
+ DropdownPropsComponent: DropdownPropsComponent
588
+ });
589
+
590
+ class GridBufferPropsComponent {
591
+ constructor() {
592
+ this.controlChange = new EventEmitter();
593
+ }
594
+ update() {
595
+ this.controlChange.emit(this.control);
596
+ }
597
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: GridBufferPropsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
598
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: GridBufferPropsComponent, isStandalone: true, selector: "grid-buffer-props", inputs: { control: "control" }, outputs: { controlChange: "controlChange" }, ngImport: i0, template: "<p>grid-buffer-props works!</p>\r\n", styles: [""] }); }
599
+ }
600
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: GridBufferPropsComponent, decorators: [{
601
+ type: Component,
602
+ args: [{ selector: 'grid-buffer-props', imports: [], template: "<p>grid-buffer-props works!</p>\r\n" }]
603
+ }], propDecorators: { control: [{
604
+ type: Input
605
+ }], controlChange: [{
606
+ type: Output
607
+ }] } });
608
+
609
+ class ListPropsComponent {
610
+ constructor() {
611
+ this.controlChange = new EventEmitter();
612
+ }
613
+ update() {
614
+ this.controlChange.emit(this.control);
615
+ }
616
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ListPropsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
617
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: ListPropsComponent, isStandalone: true, selector: "list-props", inputs: { control: "control" }, outputs: { controlChange: "controlChange" }, ngImport: i0, template: "<p>list-props works!</p>\r\n", styles: [""] }); }
618
+ }
619
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ListPropsComponent, decorators: [{
620
+ type: Component,
621
+ args: [{ selector: 'list-props', imports: [], template: "<p>list-props works!</p>\r\n" }]
622
+ }], propDecorators: { control: [{
623
+ type: Input
624
+ }], controlChange: [{
625
+ type: Output
626
+ }] } });
627
+
628
+ class MccPropsComponent {
629
+ constructor() {
630
+ this.controlChange = new EventEmitter();
631
+ }
632
+ update() {
633
+ this.controlChange.emit(this.control);
634
+ }
635
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: MccPropsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
636
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: MccPropsComponent, isStandalone: true, selector: "mcc-props", inputs: { control: "control" }, outputs: { controlChange: "controlChange" }, ngImport: i0, template: "<p>mcc-props works!</p>\r\n", styles: [""] }); }
637
+ }
638
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: MccPropsComponent, decorators: [{
639
+ type: Component,
640
+ args: [{ selector: 'mcc-props', imports: [], template: "<p>mcc-props works!</p>\r\n" }]
641
+ }], propDecorators: { control: [{
642
+ type: Input
643
+ }], controlChange: [{
644
+ type: Output
645
+ }] } });
646
+
647
+ class NumberPropsComponent {
648
+ constructor() {
649
+ this.controlChange = new EventEmitter();
650
+ }
651
+ update() {
652
+ this.controlChange.emit(this.control);
653
+ }
654
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: NumberPropsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
655
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: NumberPropsComponent, isStandalone: true, selector: "number-props", inputs: { control: "control" }, outputs: { controlChange: "controlChange" }, ngImport: i0, template: "<div class=\"number-props-container\" [ngStyle]=\"{ padding: '15px' }\">\r\n\r\n</div>", styles: [""], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
656
+ }
657
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: NumberPropsComponent, decorators: [{
658
+ type: Component,
659
+ args: [{ selector: 'number-props', imports: [NgStyle], template: "<div class=\"number-props-container\" [ngStyle]=\"{ padding: '15px' }\">\r\n\r\n</div>" }]
660
+ }], propDecorators: { control: [{
661
+ type: Input
662
+ }], controlChange: [{
663
+ type: Output
664
+ }] } });
665
+
666
+ var numberProps_component = /*#__PURE__*/Object.freeze({
667
+ __proto__: null,
668
+ NumberPropsComponent: NumberPropsComponent
669
+ });
670
+
671
+ class RadioGroupPropsComponent {
672
+ constructor() {
673
+ this.controlChange = new EventEmitter();
674
+ }
675
+ update() {
676
+ this.controlChange.emit(this.control);
677
+ }
678
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: RadioGroupPropsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
679
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: RadioGroupPropsComponent, isStandalone: true, selector: "radio-group-props", inputs: { control: "control" }, outputs: { controlChange: "controlChange" }, ngImport: i0, template: "<p>radio-group-props works!</p>\r\n", styles: [""] }); }
680
+ }
681
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: RadioGroupPropsComponent, decorators: [{
682
+ type: Component,
683
+ args: [{ selector: 'radio-group-props', imports: [], template: "<p>radio-group-props works!</p>\r\n" }]
684
+ }], propDecorators: { control: [{
685
+ type: Input
686
+ }], controlChange: [{
687
+ type: Output
688
+ }] } });
689
+
690
+ class SeekerPropsComponent {
691
+ constructor() {
692
+ this.controlChange = new EventEmitter();
693
+ }
694
+ update() {
695
+ this.controlChange.emit(this.control);
696
+ }
697
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: SeekerPropsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
698
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: SeekerPropsComponent, isStandalone: true, selector: "seeker-props", inputs: { control: "control" }, outputs: { controlChange: "controlChange" }, ngImport: i0, template: "<p>seeker-props works!</p>\r\n", styles: [""] }); }
699
+ }
700
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: SeekerPropsComponent, decorators: [{
701
+ type: Component,
702
+ args: [{ selector: 'seeker-props', imports: [], template: "<p>seeker-props works!</p>\r\n" }]
703
+ }], propDecorators: { control: [{
704
+ type: Input
705
+ }], controlChange: [{
706
+ type: Output
707
+ }] } });
708
+
709
+ class TextareaPropsComponent {
710
+ constructor() {
711
+ this.controlChange = new EventEmitter();
712
+ }
713
+ update() {
714
+ this.controlChange.emit(this.control);
715
+ }
716
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TextareaPropsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
717
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: TextareaPropsComponent, isStandalone: true, selector: "textarea-props", inputs: { control: "control" }, outputs: { controlChange: "controlChange" }, ngImport: i0, template: "<p>textarea-props works!</p>\r\n", styles: [""] }); }
718
+ }
719
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TextareaPropsComponent, decorators: [{
720
+ type: Component,
721
+ args: [{ selector: 'textarea-props', imports: [], template: "<p>textarea-props works!</p>\r\n" }]
722
+ }], propDecorators: { control: [{
723
+ type: Input
724
+ }], controlChange: [{
725
+ type: Output
726
+ }] } });
727
+
728
+ class UploaderPropsComponent {
729
+ constructor() {
730
+ this.controlChange = new EventEmitter();
731
+ }
732
+ update() {
733
+ this.controlChange.emit(this.control);
734
+ }
735
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: UploaderPropsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
736
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: UploaderPropsComponent, isStandalone: true, selector: "uploader-props", inputs: { control: "control" }, outputs: { controlChange: "controlChange" }, ngImport: i0, template: "<p>uploader-props works!</p>\r\n", styles: [""] }); }
737
+ }
738
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: UploaderPropsComponent, decorators: [{
739
+ type: Component,
740
+ args: [{ selector: 'uploader-props', imports: [], template: "<p>uploader-props works!</p>\r\n" }]
741
+ }], propDecorators: { control: [{
742
+ type: Input
743
+ }], controlChange: [{
744
+ type: Output
745
+ }] } });
746
+
747
+ class ValidatorEditorComponent extends BasePropsComponent {
748
+ constructor(mls) {
749
+ super(mls);
750
+ this.mls = mls;
751
+ // 🔹 Computed list based on controlType
752
+ this.$availableValidators = computed(() => this.coreFormDesignService.getSupportedValidators(this.$control()));
753
+ // 🔹 Signal for selected validators with their values
754
+ this.$selectedValidators = signal({});
755
+ effect(() => {
756
+ const c = this.$control(); // will re-run when selection changes
757
+ this.syncFromControl();
758
+ });
759
+ }
760
+ // ✅ Check if a validator is enabled
761
+ isChecked(v) {
762
+ return this.$selectedValidators()[v] !== undefined;
763
+ }
764
+ syncFromControl() {
765
+ const control = this.$control();
766
+ const validators = control.validators ?? [];
767
+ const validatorMap = {};
768
+ for (const v of validators) {
769
+ validatorMap[v.name] = v;
770
+ }
771
+ this.$selectedValidators.set(validatorMap);
772
+ }
773
+ toggleValidator(v) {
774
+ const current = { ...this.$selectedValidators() };
775
+ const requiresValue = ['minLength', 'maxLength', 'min', 'max', 'pattern'];
776
+ const isAlreadyChecked = !!current[v];
777
+ if (isAlreadyChecked) {
778
+ delete current[v]; // ❌ Remove validator
779
+ }
780
+ else {
781
+ const validator = {
782
+ name: v,
783
+ errorMessage: this.coreFormDesignService.getErrorMessageFor(v),
784
+ validator: this.coreFormDesignService.getValidatorFn(v, null), // stub until value is filled
785
+ value: requiresValue.includes(v) ? '' : true
786
+ };
787
+ current[v] = validator;
788
+ }
789
+ this.$selectedValidators.set(current);
790
+ // ✅ Skip update if validator requires value but it's still empty
791
+ const shouldSkip = !isAlreadyChecked &&
792
+ requiresValue.includes(v) &&
793
+ current[v]?.value === '';
794
+ if (shouldSkip)
795
+ return;
796
+ const validatorArray = this.coreFormDesignService.toIValidatorArray(current);
797
+ this.setControlProp('validators', validatorArray, this.$isNested());
798
+ }
799
+ updateValidatorValue(v, raw) {
800
+ const value = raw?.toString().trim();
801
+ const updated = { ...this.$selectedValidators() };
802
+ if (value === '') {
803
+ // 👇 Remove the validator if it was cleared
804
+ delete updated[v];
805
+ }
806
+ else {
807
+ if (updated[v]) {
808
+ updated[v].value = value;
809
+ }
810
+ }
811
+ this.$selectedValidators.set(updated);
812
+ // ✅ Only update the control if it's valid or fully removed
813
+ const validatorArray = this.coreFormDesignService.toIValidatorArray(updated);
814
+ this.setControlProp('validators', validatorArray, this.$isNested());
815
+ }
816
+ isReadOnlyValidator(v) {
817
+ return this.$selectedValidators()[v]?.readOnly === true;
818
+ }
819
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ValidatorEditorComponent, deps: [{ token: MultiLanguageService }], target: i0.ɵɵFactoryTarget.Component }); }
820
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.5", type: ValidatorEditorComponent, isStandalone: true, selector: "validator-editor", usesInheritance: true, ngImport: i0, template: "<div class=\"setting-group validator-group\" [ngStyle]=\"{ padding: '15px' }\">\r\n @for (v of $availableValidators(); track v) {\r\n <div class=\"setting-row\">\r\n\r\n <label>\r\n {{ v }}\r\n @if (isReadOnlyValidator(v)) {\r\n <i class=\"feather-lock tiny-lock\" title=\"Read-only system validator\"></i>\r\n }\r\n </label>\r\n\r\n <div class=\"control-wrapper\">\r\n <core-checkbox ngModel ngDefaultControl [ngModel]=\"isChecked(v)\" [disabled]=\"isReadOnlyValidator(v)\"\r\n [appTooltip]=\"isReadOnlyValidator(v) ? 'System validator' : ''\" (ngModelChange)=\"toggleValidator(v)\" />\r\n\r\n @if (isChecked(v) && ['minLength', 'maxLength', 'min', 'max'].includes(v)) {\r\n <input class=\"form-control validator-value\" [type]=\"'number'\"\r\n [value]=\"$selectedValidators()[v]?.value || ''\"\r\n (input)=\"updateValidatorValue(v, $any($event.target).value)\"\r\n [placeholder]=\"'Enter value' | translate: lang\" [disabled]=\"isReadOnlyValidator(v)\"\r\n [appTooltip]=\"isReadOnlyValidator(v) ? 'Default validator \u2014 cannot be modified' : ''\" />\r\n }\r\n\r\n @else if (isChecked(v) && v === 'pattern') {\r\n <input class=\"form-control validator-value\" type=\"text\" [value]=\"$selectedValidators()[v]?.value || ''\"\r\n (input)=\"updateValidatorValue(v, $any($event.target).value)\" [placeholder]=\"'Enter regex'\"\r\n [disabled]=\"isReadOnlyValidator(v)\"\r\n [appTooltip]=\"isReadOnlyValidator(v) ? 'Default validator \u2014 cannot be modified' : ''\" />\r\n }\r\n </div>\r\n </div>\r\n }\r\n</div>\r\n", styles: [".setting-group{display:flex;flex-direction:column}.setting-row{display:flex;justify-content:flex-start;align-items:center;height:50px}.setting-row label{width:30%}.setting-row .control-wrapper,.setting-row input,.setting-row .readonly-field{width:65%}.setting-row .readonly-field{font-style:italic;color:#666}.setting-row input.validator-value{text-align:right}.setting-row input.validator-value.pattern{text-align:left}.setting-row .control-wrapper{display:flex;align-items:center;justify-content:flex-start}.validator-group .setting-row{justify-content:flex-start}.validator-group .setting-row input{margin-left:15px;width:100%}.tiny-lock{margin-left:6px;font-size:12px;color:#888}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "directive", type: TooltipDirective, selector: "[appTooltip]", inputs: ["color", "backgroundColor", "appTooltip", "showAnyway", "position"] }, { kind: "component", type: CoreCheckboxComponent, selector: "core-checkbox", inputs: ["text", "tooltipPosition", "tooltip", "inputValue", "disabled"], outputs: ["onClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
821
+ }
822
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ValidatorEditorComponent, decorators: [{
823
+ type: Component,
824
+ args: [{ selector: 'validator-editor', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
825
+ NgStyle,
826
+ FormsModule,
827
+ TranslatePipe,
828
+ TooltipDirective,
829
+ CoreCheckboxComponent
830
+ ], template: "<div class=\"setting-group validator-group\" [ngStyle]=\"{ padding: '15px' }\">\r\n @for (v of $availableValidators(); track v) {\r\n <div class=\"setting-row\">\r\n\r\n <label>\r\n {{ v }}\r\n @if (isReadOnlyValidator(v)) {\r\n <i class=\"feather-lock tiny-lock\" title=\"Read-only system validator\"></i>\r\n }\r\n </label>\r\n\r\n <div class=\"control-wrapper\">\r\n <core-checkbox ngModel ngDefaultControl [ngModel]=\"isChecked(v)\" [disabled]=\"isReadOnlyValidator(v)\"\r\n [appTooltip]=\"isReadOnlyValidator(v) ? 'System validator' : ''\" (ngModelChange)=\"toggleValidator(v)\" />\r\n\r\n @if (isChecked(v) && ['minLength', 'maxLength', 'min', 'max'].includes(v)) {\r\n <input class=\"form-control validator-value\" [type]=\"'number'\"\r\n [value]=\"$selectedValidators()[v]?.value || ''\"\r\n (input)=\"updateValidatorValue(v, $any($event.target).value)\"\r\n [placeholder]=\"'Enter value' | translate: lang\" [disabled]=\"isReadOnlyValidator(v)\"\r\n [appTooltip]=\"isReadOnlyValidator(v) ? 'Default validator \u2014 cannot be modified' : ''\" />\r\n }\r\n\r\n @else if (isChecked(v) && v === 'pattern') {\r\n <input class=\"form-control validator-value\" type=\"text\" [value]=\"$selectedValidators()[v]?.value || ''\"\r\n (input)=\"updateValidatorValue(v, $any($event.target).value)\" [placeholder]=\"'Enter regex'\"\r\n [disabled]=\"isReadOnlyValidator(v)\"\r\n [appTooltip]=\"isReadOnlyValidator(v) ? 'Default validator \u2014 cannot be modified' : ''\" />\r\n }\r\n </div>\r\n </div>\r\n }\r\n</div>\r\n", styles: [".setting-group{display:flex;flex-direction:column}.setting-row{display:flex;justify-content:flex-start;align-items:center;height:50px}.setting-row label{width:30%}.setting-row .control-wrapper,.setting-row input,.setting-row .readonly-field{width:65%}.setting-row .readonly-field{font-style:italic;color:#666}.setting-row input.validator-value{text-align:right}.setting-row input.validator-value.pattern{text-align:left}.setting-row .control-wrapper{display:flex;align-items:center;justify-content:flex-start}.validator-group .setting-row{justify-content:flex-start}.validator-group .setting-row input{margin-left:15px;width:100%}.tiny-lock{margin-left:6px;font-size:12px;color:#888}\n"] }]
831
+ }], ctorParameters: () => [{ type: MultiLanguageService }] });
832
+
833
+ class CalculatedPropsComponent extends BasePropsComponent {
834
+ constructor(mls) {
835
+ super(mls);
836
+ this.mls = mls;
837
+ this.$shortHtmlHintForCSharpSyntax = viewChild('shortHtmlHintForCSharpSyntax');
838
+ this.$shortHtmlHintForSqlSyntax = viewChild('shortHtmlHintForSqlSyntax');
839
+ this.$loading = signal(false);
840
+ this.$beingValidated = signal(false);
841
+ this.wfs = inject(CoreWorkflowService);
842
+ this.fds = inject(CoreFormDesignService);
843
+ this.dbs = inject(DbService);
844
+ this.gpt = inject(GptService);
845
+ this.alertService = inject(AlertService);
846
+ //$control = this.fds.$control;
847
+ this.$sqlScriptError = signal(null);
848
+ this.$aiGeneratorOn = signal(false);
849
+ this.$selectedTables = signal([]);
850
+ this.$generatedScript = signal('');
851
+ this.$sqlPrompt = signal('');
852
+ this.$selectedTablesForAi = computed(() => {
853
+ const selectedTables = this.$selectedTables();
854
+ if (!selectedTables.length)
855
+ return 'No tables selected.';
856
+ let result = 'Consider the following database tables and columns:\n\n';
857
+ for (const table of selectedTables) {
858
+ result += `Table: ${table.table}\n`;
859
+ const activeColumns = table.columns.filter(c => c.isActive);
860
+ for (const col of activeColumns) {
861
+ const hint = col.hintForAi?.trim();
862
+ result += ` - ${col.column}` + (hint ? ` (${hint})` : '') + `\n`;
863
+ }
864
+ result += '\n';
865
+ }
866
+ return result.trim();
867
+ });
868
+ this.radioOptions$ = new BehaviorSubject([
869
+ {
870
+ value: 'in-memory',
871
+ text: 'In Memory',
872
+ htmlTooltip: this.$shortHtmlHintForCSharpSyntax()
873
+ },
874
+ {
875
+ value: 'sql-query',
876
+ text: 'SQL Query',
877
+ htmlTooltip: this.$shortHtmlHintForSqlSyntax()
878
+ },
879
+ ]);
880
+ this.$fields = computed(() => {
881
+ const currentField = this.fds.$control()?.field;
882
+ return this.wfs.$availableCols().filter(c => c.field !== currentField).map(c => ({ field: c.field }));
883
+ });
884
+ this.$placeholderForScriptInput = computed(() => {
885
+ switch (this.fds.$control()?.evaluationMode) {
886
+ case 'in-memory':
887
+ return 'Enter expression formula';
888
+ case 'sql-query':
889
+ return 'Enter SQL script';
890
+ default:
891
+ return 'Please select Evaluation Mode';
892
+ }
893
+ });
894
+ effect(() => {
895
+ const shortHtmlHintForCSharpSyntax = this.$shortHtmlHintForCSharpSyntax();
896
+ const shortHtmlHintForSqlSyntax = this.$shortHtmlHintForSqlSyntax();
897
+ if (!!shortHtmlHintForCSharpSyntax && !!shortHtmlHintForSqlSyntax) {
898
+ this.radioOptions$.next([
899
+ {
900
+ value: 'in-memory',
901
+ text: 'In Memory',
902
+ htmlTooltip: shortHtmlHintForCSharpSyntax
903
+ },
904
+ {
905
+ value: 'sql-query',
906
+ text: 'SQL Query',
907
+ htmlTooltip: shortHtmlHintForSqlSyntax
908
+ },
909
+ ]);
910
+ }
911
+ });
912
+ }
913
+ loadDbSchema() {
914
+ const fullRequest = {};
915
+ this.subscriptions.push(this.dbs.syncAndGetWorkflowSchemaMetadata(fullRequest).pipe(catchError(() => of({ ok: false, status: 500 })))
916
+ .subscribe(x => {
917
+ if (x.ok && x.status === 200 && x.body?.statusCode === 200) {
918
+ this.wfs.$workflowDbSchema.set(x.body.innerBody.items);
919
+ }
920
+ }));
921
+ }
922
+ toTables(names) {
923
+ const allTables = this.wfs.$workflowDbSchema(); // All available tables
924
+ return allTables.filter(table => names.includes(table.table));
925
+ }
926
+ validateScript(e) {
927
+ e.stopPropagation();
928
+ const control = this.fds.$control();
929
+ if (!control) {
930
+ this.alertService.info(`No current control detected`);
931
+ return;
932
+ }
933
+ if (!control.script) {
934
+ this.alertService.info(`There is no script to validate for ${control.field}`);
935
+ return;
936
+ }
937
+ if (!control.returnType) {
938
+ this.alertService.info(`You should set return type for ${control.field}`);
939
+ return;
940
+ }
941
+ const evalMode = this.fds.$control()?.evaluationMode;
942
+ if (!evalMode) {
943
+ this.alertService.error('Please select avaluation mode', alertOptions);
944
+ return;
945
+ }
946
+ const request = {
947
+ input: control.script,
948
+ context: this.getValidationContextByMode(evalMode),
949
+ purpose: 'validate-calculated-field',
950
+ isSystemPrompt: true
951
+ };
952
+ this.$beingValidated.set(true);
953
+ this.subscriptions.push(this.gpt.askGpt(request).pipe(catchError(err => {
954
+ this.$beingValidated.set(false);
955
+ this.alertService.error('Validation failed.');
956
+ return of({ ok: false, status: 500 });
957
+ })).subscribe(x => {
958
+ this.$beingValidated.set(false);
959
+ if (x.ok && x.status === 200 && x.body?.statusCode === 200) {
960
+ const reply = x.body.innerBody?.trim();
961
+ this.alertService.success(`GPT: ${reply}`);
962
+ }
963
+ else {
964
+ this.alertService.error('Could not validate script.');
965
+ }
966
+ }));
967
+ }
968
+ generateScript() {
969
+ this.$aiGeneratorOn.update(current => !current);
970
+ }
971
+ applyGeneratedSql() {
972
+ const generated = this.$generatedScript();
973
+ if (!generated)
974
+ return;
975
+ this.setControlProp('script', generated, false);
976
+ this.alertService.success('Script applied from AI.');
977
+ this.$aiGeneratorOn.set(false);
978
+ }
979
+ submitScriptPrompt() {
980
+ const control = this.fds.$control();
981
+ const evalMode = control?.evaluationMode;
982
+ const prompt = this.$sqlPrompt().trim();
983
+ const dependsOn = control?.dependsOn ?? [];
984
+ const selectedTables = this.$selectedTables();
985
+ if (!evalMode) {
986
+ this.alertService.warn('Please select an evaluation mode.');
987
+ return;
988
+ }
989
+ if (!prompt) {
990
+ this.alertService.warn('Please enter a description for the AI to generate your script.');
991
+ return;
992
+ }
993
+ if (dependsOn.length === 0) {
994
+ this.alertService.warn('Please select at least one field that the script depends on.');
995
+ return;
996
+ }
997
+ if (evalMode === 'sql-query') {
998
+ if (!selectedTables.length) {
999
+ this.alertService.warn('Please select at least one table.');
1000
+ return;
1001
+ }
1002
+ const tablesWithNoHint = selectedTables
1003
+ .filter(t => !t.hintForAi?.trim())
1004
+ .map(t => t.table);
1005
+ if (tablesWithNoHint.length > 0) {
1006
+ this.alertService.warn(`Please provide a hint for the following table(s): ${tablesWithNoHint.join(', ')}`);
1007
+ return;
1008
+ }
1009
+ }
1010
+ // 🧠 Construct prompt
1011
+ const dependsOnLine = `The script should depend on: ${dependsOn.join(', ')}.`;
1012
+ const contextIntro = this.getContextByMode(evalMode);
1013
+ const tableContext = this.$selectedTablesForAi(); // nicely formatted
1014
+ const fullPrompt = `${prompt}\n\n${dependsOnLine}\n\n${tableContext}`;
1015
+ const request = {
1016
+ input: fullPrompt,
1017
+ context: contextIntro,
1018
+ purpose: 'generate-calculated-field',
1019
+ isSystemPrompt: true
1020
+ };
1021
+ this.$loading.set(true);
1022
+ this.subscriptions.push(this.gpt.askGpt(request).pipe(catchError(err => {
1023
+ this.$loading.set(false);
1024
+ this.alertService.error('AI generation failed.');
1025
+ return of({ ok: false, status: 500 });
1026
+ })).subscribe(res => {
1027
+ this.$loading.set(false);
1028
+ if (res.ok && res.status === 200 && res.body?.statusCode === 200) {
1029
+ const reply = res.body.innerBody?.trim();
1030
+ if (reply) {
1031
+ this.$generatedScript.set(reply);
1032
+ }
1033
+ else {
1034
+ this.alertService.warn('AI returned an empty result.');
1035
+ }
1036
+ }
1037
+ else {
1038
+ this.alertService.error('AI could not generate a valid script.');
1039
+ }
1040
+ }));
1041
+ }
1042
+ tableCheckedChange(selected) {
1043
+ this.$selectedTables.set(this.toTables(selected));
1044
+ }
1045
+ getContextByMode(mode) {
1046
+ if (mode === 'sql-query') {
1047
+ return [
1048
+ `You use ${this.mls.lang$.value.toUpperCase() === 'VI' ? 'Vietnamese' : 'English'} for answer`,
1049
+ "You are a SQL validator for a workflow engine.",
1050
+ "User input must be a full SQL SELECT statement compatible with Dapper.",
1051
+ "User input must not modify database schema",
1052
+ "It must contain a FROM clause with a real table name.",
1053
+ "It must contain a UPDATE, DELETE or DROP clause.",
1054
+ "It must contain a WHERE clause.",
1055
+ "It must return exactly one value",
1056
+ "Examples of valid patterns include:",
1057
+ " SELECT CASE WHEN EXISTS (SELECT 1 FROM Users WHERE IsActive = 1) THEN 1 ELSE 0 END",
1058
+ " SELECT CASE WHEN @Amount > 1000 THEN @Amount ELSE 0 END -- when Amount is a parameter",
1059
+ "The query must be syntactically complete, no partial expressions or clauses.",
1060
+ `The query must return a type of ${this.fds.$control()?.returnType} JavaScript equivalent.`,
1061
+ "Do not wrap your output in triple backticks or markdown.",
1062
+ "Respond with only the raw SQL script.",
1063
+ ];
1064
+ }
1065
+ return [
1066
+ `You use ${this.mls.lang$.value.toUpperCase() === 'VI' ? 'Vietnamese' : 'English'} for answer`,
1067
+ 'You are a C# expression validator.',
1068
+ `Validate whether the expression returns a type of ${this.fds.$control()?.returnType} JavaScript equivalent result using C# syntax.`,
1069
+ 'The result will be used inside an if-statement or condition tree.'
1070
+ ];
1071
+ }
1072
+ getValidationContextByMode(mode) {
1073
+ if (mode === 'sql-query') {
1074
+ return [
1075
+ `You use ${this.mls.lang$.value.toUpperCase() === 'VI' ? 'Vietnamese' : 'English'} for answer`,
1076
+ "You're a SQL validator for a business rule engine.",
1077
+ "The input is a full SQL SELECT statement written by a human.",
1078
+ "Analyze if it meets these criteria:",
1079
+ "- Compatible with SQL Server and Dapper parameter style.",
1080
+ "- Has FROM clause with table name.",
1081
+ "- Has WHERE clause.",
1082
+ "- Uses @param style inputs.",
1083
+ "Return only a short answer like 'Valid ✅' or explain what's wrong in plain terms.",
1084
+ ];
1085
+ }
1086
+ return [
1087
+ `You use ${this.mls.lang$.value.toUpperCase() === 'VI' ? 'Vietnamese' : 'English'} for answer`,
1088
+ "You're a validator for C# expressions and the result should be compatible with DynamicExpresso",
1089
+ `Analyze whether this expression is valid syntax and returns a type = ${this.$control().returnType}`,
1090
+ "If valid, say 'Valid ✅'. If not, explain the syntax issue.",
1091
+ ];
1092
+ }
1093
+ validateSqlScript(input) {
1094
+ const trimmed = input.trim();
1095
+ if (!/^SELECT\b/i.test(trimmed)) {
1096
+ return 'Only SELECT queries are allowed.';
1097
+ }
1098
+ const destructivePattern = /^\s*(DELETE|DROP|UPDATE|INSERT|ALTER|TRUNCATE|EXEC|MERGE)\b/gi;
1099
+ if (destructivePattern.test(trimmed)) {
1100
+ return 'Dangerous SQL operations (DELETE, DROP, etc.) are not allowed.';
1101
+ }
1102
+ return null;
1103
+ }
1104
+ onScriptChange(script) {
1105
+ if (this.$control().evaluationMode === 'sql-query') {
1106
+ const error = this.validateSqlScript(script);
1107
+ this.setControlProp('isUnsafe', !!error, false);
1108
+ this.$sqlScriptError.set(error);
1109
+ this.setControlProp('script', script, false);
1110
+ }
1111
+ else {
1112
+ this.setControlProp('script', script, false);
1113
+ this.setControlProp('isUnsafe', false, false);
1114
+ }
1115
+ }
1116
+ ngAfterViewInit() {
1117
+ setTimeout(() => this.loadDbSchema());
1118
+ }
1119
+ openHintEditor(table, e) {
1120
+ }
1121
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: CalculatedPropsComponent, deps: [{ token: MultiLanguageService }], target: i0.ɵɵFactoryTarget.Component }); }
1122
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.5", type: CalculatedPropsComponent, isStandalone: true, selector: "calculated-props", viewQueries: [{ propertyName: "$shortHtmlHintForCSharpSyntax", first: true, predicate: ["shortHtmlHintForCSharpSyntax"], descendants: true, isSignal: true }, { propertyName: "$shortHtmlHintForSqlSyntax", first: true, predicate: ["shortHtmlHintForSqlSyntax"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"setting-group calculated-group\" [ngStyle]=\"{ padding: '15px' }\">\r\n\r\n <div class=\"setting-row evaluation-mode-row\">\r\n <label class=\"setting-label\">Evaluation Mode</label>\r\n <core-radio-group [options$]=\"radioOptions$\" [vertical]=\"true\" [gapY]=\"8\"\r\n [ngModel]=\"fds.$control()?.evaluationMode\" (ngModelChange)=\"setControlProp('evaluationMode', $event, false)\">\r\n </core-radio-group>\r\n </div>\r\n\r\n <div class=\"setting-row depends-on-row\">\r\n <label class=\"setting-label\">Depends On</label>\r\n <core-sticker-collection [$items]=\"$fields()\" [$shownFrom]=\"'field'\"\r\n [$initialChecked]=\"fds.$control()?.dependsOn || []\" ($checkedChange)=\"setControlProp('dependsOn', $event, false)\" />\r\n </div>\r\n\r\n <div class=\"setting-row return-type-row\">\r\n <label class=\"setting-label\">Return Type</label>\r\n <select class=\"form-control setting-input\" [ngModel]=\"fds.$control()?.returnType || 'number'\"\r\n (ngModelChange)=\"setControlProp('returnType', $event, false)\">\r\n <option value=\"boolean\">Boolean</option>\r\n <option value=\"number\">Number</option>\r\n <option value=\"string\">String</option>\r\n <option value=\"number[]\">Number[]</option>\r\n <option value=\"string[]\">String[]</option>\r\n <!-- Omitting 'Date' and 'object' -->\r\n </select>\r\n </div>\r\n\r\n @if (!!fds.$control()?.dependsOn && !!fds.$control()?.dependsOn!.length) {\r\n\r\n\r\n <div class=\"setting-row script-row\">\r\n <label class=\"setting-label\">Script {{ $beingValidated() ? 'is being validated...' : '' }}</label>\r\n <textarea [ngStyle]=\"{ minHeight: '150px', borderRadius: '8px' }\" [readonly]=\"!fds.$control()?.evaluationMode\"\r\n [disabled]=\"!fds.$control()?.evaluationMode\" class=\"form-control\"\r\n [class.form-control-disabled]=\"!fds.$control()?.evaluationMode\" rows=\"20\" [ngModel]=\"fds.$control()?.script\"\r\n (ngModelChange)=\"onScriptChange($event)\" [placeholder]=\"$placeholderForScriptInput()\">\r\n </textarea>\r\n @if (!!$sqlScriptError()) {\r\n <small class=\"text-danger\">{{ $sqlScriptError() }}</small>\r\n }\r\n\r\n\r\n @if (!!fds.$control()?.evaluationMode) {\r\n <div class=\"button-group\">\r\n <button class=\"btn btn-secondary validate-btn\" (click)=\"validateScript($event)\">Validate with AI</button>\r\n <button class=\"btn btn-primary validate-btn\" (click)=\"generateScript()\">\r\n {{ $aiGeneratorOn() ? 'Hide AI Prompt Editor' : 'Show AI Prompt Editor' }}\r\n </button>\r\n </div>\r\n }\r\n\r\n @if ($aiGeneratorOn()) {\r\n <div class=\"sql-generator-panel\">\r\n <div class=\"alert alert-info\" style=\"margin-top: 1rem;\">\r\n <strong>SQL Generator:</strong> Describe what you want the script to do, and AI will generate SQL for you.\r\n </div>\r\n\r\n @if (fds.$control()?.evaluationMode==='sql-query') {\r\n <div class=\"sql-generator-panel mt-4\">\r\n <label class=\"fw-bold mb-2\">Select Related Tables</label>\r\n\r\n <core-sticker-collection [$enableFilter]=\"true\" [$items]=\"wfs.$workflowDbSchema()\" [$shownFrom]=\"'table'\"\r\n [$tooltipFrom]=\"'hintForAi'\" [$initialChecked]=\"[]\" ($checkedChange)=\"tableCheckedChange($event)\">\r\n </core-sticker-collection>\r\n\r\n </div>\r\n }\r\n\r\n @if (!!fds.$control()?.evaluationMode) {\r\n <textarea class=\"form-control\" style=\"min-height: 100px; margin-top: 0.5rem; border-radius: 8px;\"\r\n [(ngModel)]=\"$sqlPrompt\" placeholder=\"e.g., Calculate leave days between FROM_DATE and TO_DATE\">\r\n </textarea>\r\n\r\n <div class=\"mt-2 d-flex gap-2 justify-content-end\">\r\n <button class=\"btn btn-success\" (click)=\"submitScriptPrompt()\">\r\n Generate Script\r\n </button>\r\n </div>\r\n }\r\n\r\n @if ($generatedScript()) {\r\n <div class=\"generated-sql-box mt-3\">\r\n <label class=\"fw-bold\">Generated by AI:</label>\r\n <pre class=\"bg-light p-3 rounded\" style=\"white-space: pre-wrap;\">{{$generatedScript()}}</pre>\r\n <button class=\"btn btn-sm btn-primary mt-2\" (click)=\"applyGeneratedSql()\">Apply to Script</button>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n </div>\r\n\r\n\r\n\r\n }\r\n\r\n<ng-template #shortHtmlHintForCSharpSyntax>\r\n <div class=\"syntax-hint\">\r\n <strong>Example (C# Expression):</strong>\r\n <pre><code>FullName.ToUpper() + \" #\" + EmployeeCode</code></pre>\r\n <div class=\"note\">\r\n This expression will be evaluated dynamically using <code>DynamicExpresso</code>.<br>\r\n You can return any value from context.\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #shortHtmlHintForSqlSyntax>\r\n <div class=\"syntax-hint\">\r\n <strong>Example (SQL Query):</strong>\r\n <pre><code>SELECT EMPLOYEE_CODE FROM HU_EMPLOYEE WHERE ORG_ID = 123</code></pre>\r\n <div class=\"note\">\r\n Your SQL can return either a single value <em>or</em> a list.<br>\r\n The system will extract data from the <strong>first column of all rows</strong>.<br>\r\n Use standard SQL compatible with your database.\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n</div>", styles: [".setting-row{margin:30px 0}.button-group{margin-top:15px}.button-group button{height:35px;font-size:13px;border-radius:17.5px;margin-right:8px}.setting-divider{margin:1.5rem 0 .75rem;color:#555;border-top:1px dashed #ccc;padding-top:.5rem}.evaluation-mode-row{background-color:#ffecb3;border-radius:8px;width:180px;height:110px;padding:15px}.evaluation-mode-row label{margin-bottom:8px}.script-row{margin:30px 0}.syntax-hint{color:#666;background:#fff;border:1px solid #ccc;border-radius:6px;padding:12px;font-size:13px;max-width:320px;box-shadow:0 2px 6px #0000000d}.syntax-hint pre{margin:8px 0;background-color:#f8f8f8;padding:8px;border-radius:4px;font-family:monospace;white-space:pre-wrap;word-break:break-word}.syntax-hint .note{margin-top:6px;font-size:12px}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CoreStickerCollectionComponent, selector: "core-sticker-collection", inputs: ["$items", "$shownFrom", "$tooltipFrom", "$initialChecked", "$showMore", "$showMoreTooltip", "$hideShowMoreIfNotSelected", "$enableFilter"], outputs: ["$checkedChange", "$onShowMore"] }, { kind: "component", type: CoreRadioGroupComponent, selector: "core-radio-group", inputs: ["options$", "vertical", "columnCount", "gapY", "defaultValue"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1123
+ }
1124
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: CalculatedPropsComponent, decorators: [{
1125
+ type: Component,
1126
+ args: [{ selector: 'calculated-props', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
1127
+ NgStyle,
1128
+ FormsModule,
1129
+ CoreStickerCollectionComponent,
1130
+ CoreRadioGroupComponent,
1131
+ ], template: "<div class=\"setting-group calculated-group\" [ngStyle]=\"{ padding: '15px' }\">\r\n\r\n <div class=\"setting-row evaluation-mode-row\">\r\n <label class=\"setting-label\">Evaluation Mode</label>\r\n <core-radio-group [options$]=\"radioOptions$\" [vertical]=\"true\" [gapY]=\"8\"\r\n [ngModel]=\"fds.$control()?.evaluationMode\" (ngModelChange)=\"setControlProp('evaluationMode', $event, false)\">\r\n </core-radio-group>\r\n </div>\r\n\r\n <div class=\"setting-row depends-on-row\">\r\n <label class=\"setting-label\">Depends On</label>\r\n <core-sticker-collection [$items]=\"$fields()\" [$shownFrom]=\"'field'\"\r\n [$initialChecked]=\"fds.$control()?.dependsOn || []\" ($checkedChange)=\"setControlProp('dependsOn', $event, false)\" />\r\n </div>\r\n\r\n <div class=\"setting-row return-type-row\">\r\n <label class=\"setting-label\">Return Type</label>\r\n <select class=\"form-control setting-input\" [ngModel]=\"fds.$control()?.returnType || 'number'\"\r\n (ngModelChange)=\"setControlProp('returnType', $event, false)\">\r\n <option value=\"boolean\">Boolean</option>\r\n <option value=\"number\">Number</option>\r\n <option value=\"string\">String</option>\r\n <option value=\"number[]\">Number[]</option>\r\n <option value=\"string[]\">String[]</option>\r\n <!-- Omitting 'Date' and 'object' -->\r\n </select>\r\n </div>\r\n\r\n @if (!!fds.$control()?.dependsOn && !!fds.$control()?.dependsOn!.length) {\r\n\r\n\r\n <div class=\"setting-row script-row\">\r\n <label class=\"setting-label\">Script {{ $beingValidated() ? 'is being validated...' : '' }}</label>\r\n <textarea [ngStyle]=\"{ minHeight: '150px', borderRadius: '8px' }\" [readonly]=\"!fds.$control()?.evaluationMode\"\r\n [disabled]=\"!fds.$control()?.evaluationMode\" class=\"form-control\"\r\n [class.form-control-disabled]=\"!fds.$control()?.evaluationMode\" rows=\"20\" [ngModel]=\"fds.$control()?.script\"\r\n (ngModelChange)=\"onScriptChange($event)\" [placeholder]=\"$placeholderForScriptInput()\">\r\n </textarea>\r\n @if (!!$sqlScriptError()) {\r\n <small class=\"text-danger\">{{ $sqlScriptError() }}</small>\r\n }\r\n\r\n\r\n @if (!!fds.$control()?.evaluationMode) {\r\n <div class=\"button-group\">\r\n <button class=\"btn btn-secondary validate-btn\" (click)=\"validateScript($event)\">Validate with AI</button>\r\n <button class=\"btn btn-primary validate-btn\" (click)=\"generateScript()\">\r\n {{ $aiGeneratorOn() ? 'Hide AI Prompt Editor' : 'Show AI Prompt Editor' }}\r\n </button>\r\n </div>\r\n }\r\n\r\n @if ($aiGeneratorOn()) {\r\n <div class=\"sql-generator-panel\">\r\n <div class=\"alert alert-info\" style=\"margin-top: 1rem;\">\r\n <strong>SQL Generator:</strong> Describe what you want the script to do, and AI will generate SQL for you.\r\n </div>\r\n\r\n @if (fds.$control()?.evaluationMode==='sql-query') {\r\n <div class=\"sql-generator-panel mt-4\">\r\n <label class=\"fw-bold mb-2\">Select Related Tables</label>\r\n\r\n <core-sticker-collection [$enableFilter]=\"true\" [$items]=\"wfs.$workflowDbSchema()\" [$shownFrom]=\"'table'\"\r\n [$tooltipFrom]=\"'hintForAi'\" [$initialChecked]=\"[]\" ($checkedChange)=\"tableCheckedChange($event)\">\r\n </core-sticker-collection>\r\n\r\n </div>\r\n }\r\n\r\n @if (!!fds.$control()?.evaluationMode) {\r\n <textarea class=\"form-control\" style=\"min-height: 100px; margin-top: 0.5rem; border-radius: 8px;\"\r\n [(ngModel)]=\"$sqlPrompt\" placeholder=\"e.g., Calculate leave days between FROM_DATE and TO_DATE\">\r\n </textarea>\r\n\r\n <div class=\"mt-2 d-flex gap-2 justify-content-end\">\r\n <button class=\"btn btn-success\" (click)=\"submitScriptPrompt()\">\r\n Generate Script\r\n </button>\r\n </div>\r\n }\r\n\r\n @if ($generatedScript()) {\r\n <div class=\"generated-sql-box mt-3\">\r\n <label class=\"fw-bold\">Generated by AI:</label>\r\n <pre class=\"bg-light p-3 rounded\" style=\"white-space: pre-wrap;\">{{$generatedScript()}}</pre>\r\n <button class=\"btn btn-sm btn-primary mt-2\" (click)=\"applyGeneratedSql()\">Apply to Script</button>\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n </div>\r\n\r\n\r\n\r\n }\r\n\r\n<ng-template #shortHtmlHintForCSharpSyntax>\r\n <div class=\"syntax-hint\">\r\n <strong>Example (C# Expression):</strong>\r\n <pre><code>FullName.ToUpper() + \" #\" + EmployeeCode</code></pre>\r\n <div class=\"note\">\r\n This expression will be evaluated dynamically using <code>DynamicExpresso</code>.<br>\r\n You can return any value from context.\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #shortHtmlHintForSqlSyntax>\r\n <div class=\"syntax-hint\">\r\n <strong>Example (SQL Query):</strong>\r\n <pre><code>SELECT EMPLOYEE_CODE FROM HU_EMPLOYEE WHERE ORG_ID = 123</code></pre>\r\n <div class=\"note\">\r\n Your SQL can return either a single value <em>or</em> a list.<br>\r\n The system will extract data from the <strong>first column of all rows</strong>.<br>\r\n Use standard SQL compatible with your database.\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n</div>", styles: [".setting-row{margin:30px 0}.button-group{margin-top:15px}.button-group button{height:35px;font-size:13px;border-radius:17.5px;margin-right:8px}.setting-divider{margin:1.5rem 0 .75rem;color:#555;border-top:1px dashed #ccc;padding-top:.5rem}.evaluation-mode-row{background-color:#ffecb3;border-radius:8px;width:180px;height:110px;padding:15px}.evaluation-mode-row label{margin-bottom:8px}.script-row{margin:30px 0}.syntax-hint{color:#666;background:#fff;border:1px solid #ccc;border-radius:6px;padding:12px;font-size:13px;max-width:320px;box-shadow:0 2px 6px #0000000d}.syntax-hint pre{margin:8px 0;background-color:#f8f8f8;padding:8px;border-radius:4px;font-family:monospace;white-space:pre-wrap;word-break:break-word}.syntax-hint .note{margin-top:6px;font-size:12px}\n"] }]
1132
+ }], ctorParameters: () => [{ type: MultiLanguageService }] });
1133
+
1134
+ class FieldSettingComponent extends BaseComponent {
1135
+ constructor() {
1136
+ super(...arguments);
1137
+ this.$isNested = input(false);
1138
+ this.coreFormDesignService = inject(CoreFormDesignService);
1139
+ this.enumControlType = EnumFormBaseContolType;
1140
+ this.renderer = inject(Renderer2);
1141
+ this.cdr = inject(ChangeDetectorRef);
1142
+ // 🔹 Reactive normalized control (always derived from selected cell)
1143
+ this.$control = computed(() => {
1144
+ const cell = this.$isNested() ? this.coreFormDesignService.$nestedSelectedCell() : this.coreFormDesignService.$selectedCell();
1145
+ if (!cell?.control)
1146
+ return null;
1147
+ return this.coreFormDesignService.normalize(cell.control);
1148
+ });
1149
+ // 🔹 Context (flat control list)
1150
+ this.$formContext = computed(() => this.coreFormDesignService.$formContext());
1151
+ this.componentLoaderMap = {
1152
+ 'number-props': () => Promise.resolve().then(function () { return numberProps_component; }).then(m => m.NumberPropsComponent),
1153
+ 'email-props': () => import('./ngx-histaff-alpha-email-props.component-Cf35Pexq.mjs').then(m => m.EmailPropsComponent),
1154
+ 'dropdown-props': () => Promise.resolve().then(function () { return dropdownProps_component; }).then(m => m.DropdownPropsComponent),
1155
+ 'form-array-props': () => import('./ngx-histaff-alpha-form-array-props.component-DuM5ZMkG.mjs').then(m => m.FormArrayPropsComponent),
1156
+ // etc...
1157
+ };
1158
+ }
1159
+ // 🔹 Optional trigger for downstream side-effects (no longer emits)
1160
+ onControlParamsChange() {
1161
+ const updated = this.$control();
1162
+ if (!updated)
1163
+ return;
1164
+ this.coreFormDesignService.patchControl(updated, this.$isNested());
1165
+ }
1166
+ closeFieldSettingPanel() {
1167
+ this.coreFormDesignService.$fieldSettingPanelOpen.set(false);
1168
+ }
1169
+ getFriendlyControlLabel(control) {
1170
+ if (!control)
1171
+ return 'Control';
1172
+ // 🧠 Detailed mapping: "controlType:type" → Friendly Name
1173
+ const fullTypeMap = {
1174
+ 'TEXTBOX:string': 'String Box',
1175
+ 'TEXTBOX:number': 'Number Box',
1176
+ 'TEXTBOX:email': 'Email Field',
1177
+ 'DROPDOWN': 'Dropdown',
1178
+ 'CHECKLIST': 'Checklist',
1179
+ 'SEEKER': 'Seeker',
1180
+ 'DATEPICKER': 'Date Picker',
1181
+ 'TEXTAREA': 'Text Area',
1182
+ 'CHECKBOX': 'Checkbox'
1183
+ // Add more mappings as needed
1184
+ };
1185
+ const controlType = control.controlType?.toUpperCase() ?? '';
1186
+ const inputType = control.type?.toLowerCase();
1187
+ const fullKey = inputType ? `${controlType}:${inputType}` : controlType;
1188
+ return fullTypeMap[fullKey] ?? this.camelToTitle(control.controlType ?? 'Control');
1189
+ }
1190
+ camelToTitle(input) {
1191
+ return input
1192
+ .replace(/([a-z])([A-Z])/g, '$1 $2')
1193
+ .replace(/^./, str => str.toUpperCase());
1194
+ }
1195
+ ngAfterViewInit() {
1196
+ this.listenerFn = this.renderer.listen('window', 'click', (e) => {
1197
+ this.cdr.markForCheck();
1198
+ });
1199
+ }
1200
+ ngOnDestroy() {
1201
+ this.subscriptions.forEach(x => x?.unsubscribe());
1202
+ if (this.listenerFn)
1203
+ this.listenerFn();
1204
+ }
1205
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: FieldSettingComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1206
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.5", type: FieldSettingComponent, isStandalone: true, selector: "field-setting", inputs: { $isNested: { classPropertyName: "$isNested", publicName: "$isNested", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "<div class=\"field-setting-container\">\r\n\r\n @if (!!$control()) {\r\n <div class=\"panel-caption-header\">\r\n <div class=\"panel-caption\">\r\n Editing: {{ (!!$control() && $control()!.type !== 'calculated') ? $control()?.controlType + ' - ' : '' }}{{ $control()?.field ||\r\n 'Unnamed' }}\r\n </div>\r\n @if (!$isNested()) {\r\n <div class=\"close-wrapper pointer\" (click)=\"closeFieldSettingPanel()\">\r\n <i class=\"feather-x\"></i>\r\n </div>\r\n }\r\n </div>\r\n\r\n\r\n <div class=\"field-setting-content\">\r\n\r\n\r\n @if (!!$control() && $control()!.type === 'calculated') {\r\n\r\n <div class=\"group-title mandatory\">\r\n <div class=\"icon-wrapper\">\r\n <i class=\"feather-lock\"></i>\r\n </div>\r\n <div class=\"group-name\">Mandatory</div>\r\n </div>\r\n <mandatory-props [$isNested]=\"$isNested()\"></mandatory-props>\r\n\r\n <div class=\"group-title calculated\">\r\n <div class=\"icon-wrapper\">\r\n <i class=\"feather-lock\"></i>\r\n </div>\r\n <div class=\"group-name\">Calculated Rule<i class=\"feather-help-circle\" [htmlTooltip]=\"aboutCalculatedField\"\r\n [maxWidthUnset]=\"true\"></i></div>\r\n </div>\r\n <calculated-props [$isNested]=\"$isNested()\"></calculated-props>\r\n\r\n\r\n } @else {\r\n\r\n <div class=\"group-title mandatory\">\r\n <div class=\"icon-wrapper\">\r\n <i class=\"feather-lock\"></i>\r\n </div>\r\n <div class=\"group-name\">Mandatory</div>\r\n </div>\r\n <mandatory-props [$isNested]=\"$isNested()\"></mandatory-props>\r\n\r\n <!-- <div class=\"setting-divider\"></div> -->\r\n\r\n @if (!!$control() && $control()!.controlType !== 'FORM_ARRAY') {\r\n <div class=\"group-title optional\">\r\n <div class=\"icon-wrapper\">\r\n <i class=\"feather-sliders\"></i>\r\n </div>\r\n <div class=\"group-name\">Optional</div>\r\n </div>\r\n <optional-props [$isNested]=\"$isNested()\"></optional-props>\r\n\r\n <!-- <div class=\"setting-divider\"></div> -->\r\n\r\n <div class=\"group-title validators\">\r\n <div class=\"icon-wrapper\">\r\n <i class=\"feather-check-square\"></i>\r\n </div>\r\n <div class=\"group-name\">Validators</div>\r\n </div>\r\n <validator-editor [$isNested]=\"$isNested()\"></validator-editor>\r\n }\r\n\r\n @if (!!$control() && !($control()!.controlType === 'TEXTBOX' && ['string', 'text', 'email'].includes(($control()!.type ||\r\n '').toLowerCase()))) {\r\n\r\n <div class=\"group-title\">\r\n <div class=\"icon-wrapper\">\r\n <i class=\"feather-check-square\"></i>\r\n </div>\r\n <div class=\"group-name\">{{ getFriendlyControlLabel($control()) }} Settings</div>\r\n </div>\r\n\r\n @if ($isNested()) {\r\n <props-host [loadComponent]=\"componentLoaderMap[coreFormDesignService.$nestedCurrentPropsComponent()]\"\r\n [$isNested]=\"true\"\r\n [props]=\"{ control: $control(), controlChange: onControlParamsChange.bind(this) }\">\r\n </props-host>\r\n } @else {\r\n <props-host [loadComponent]=\"componentLoaderMap[coreFormDesignService.$currentPropsComponent()]\"\r\n [$isNested]=\"false\"\r\n [props]=\"{ control: $control(), controlChange: onControlParamsChange.bind(this) }\">\r\n </props-host>\r\n }\r\n\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n\r\n\r\n</div>\r\n\r\n<ng-template #aboutCalculatedField>\r\n\r\n <div class=\"calculated-field-rule\" style=\"padding: 1rem; border-radius: 8px; background: #000; width: 800px;\">\r\n <h4 style=\"margin-top: 0; color: #fff;\">Calculated Field Rule</h4>\r\n <p><strong>Calculated fields</strong> are invisible boolean fields evaluated based on form inputs and logic. They\r\n help drive dynamic workflow behavior, such as conditional routing or validation triggers.</p>\r\n\r\n <h5 style=\"margin-bottom: 0.5rem; color: #fff;\">Key Properties</h5>\r\n <ul style=\"margin-top: 0;\">\r\n <li><strong>script:</strong> Expression to evaluate (e.g.,\r\n <code>leaveDays &gt; 3 &amp;&amp; status == 'Approved'</code>)</li>\r\n <li><strong>evaluationMode:</strong> <code>\"in-memory\"</code> or <code>\"sql-query\"</code></li>\r\n <li><strong>dependsOn[]:</strong> List of field names the script depends on</li>\r\n <li><strong>filterMode:</strong> <code>\"HardBlock\"</code> or <code>\"SoftWarn\"</code></li>\r\n </ul>\r\n\r\n <h5 style=\"margin-bottom: 0.5rem; color: #fff;\">Evaluation Modes</h5>\r\n <ul style=\"margin-top: 0;\">\r\n <li>\r\n <strong>in-memory:</strong> Uses <code>DynamicExpresso</code> to evaluate C#-like logic at runtime<br />\r\n <small>Example: <code>leaveType == \"ANNUAL\" &amp;&amp; leaveDays &lt; 5</code></small>\r\n </li>\r\n <li>\r\n <strong>sql-query:</strong> Runs backend SQL to evaluate conditions via\r\n <code>SELECT CASE WHEN ... THEN 1 ELSE 0 END</code><br />\r\n <small>Example:\r\n <code>SELECT CASE WHEN QUOTA &gt; 0 THEN 1 ELSE 0 END FROM LEAVE_QUOTA WHERE EMPLOYEE_ID = {{ '@' }}employeeId</code></small>\r\n </li>\r\n </ul>\r\n\r\n <h5 style=\"margin-bottom: 0.5rem; color: #fff;\">Use Cases</h5>\r\n <ul style=\"margin-top: 0;\">\r\n <li>Validate complex logic without showing the field</li>\r\n <li>Route to a different workflow branch based on hidden logic</li>\r\n <li>Trigger warning or block submission based on business rules</li>\r\n </ul>\r\n\r\n <h5 style=\"margin-bottom: 0.5rem; color: #fff;\">Example</h5>\r\n <pre style=\"color: #eee; padding: 0.5rem 1rem; border-radius: 4px; overflow-x: auto;\">\r\n {{ '{' }}\r\n \"script\": \"leaveDays > 3 && status == 'APPROVED'\",\r\n \"evaluationMode\": \"in-memory\",\r\n \"dependsOn\": [\"leaveDays\", \"status\"],\r\n \"filterMode\": \"HardBlock\"\r\n {{ '}' }}\r\n </pre>\r\n </div>\r\n\r\n\r\n</ng-template>", styles: [".field-setting-container{max-height:100%;overflow-x:hidden;overflow-y:auto}.field-setting-container .field-setting-content{padding:15px}.field-setting-container .panel-caption-header{display:flex;align-items:center;justify-content:space-between;padding:15px;height:60px;background-color:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1f2937}.field-setting-container .panel-caption-header .panel-caption{flex-grow:1}.field-setting-container .panel-caption-header .close-wrapper{display:flex;align-items:center;justify-content:center;background-color:#f1f5f9;width:32px;height:32px;border-radius:50%;cursor:pointer;transition:background-color .2s}.field-setting-container .panel-caption-header .close-wrapper:hover{background-color:#e2e8f0}.field-setting-container .setting-divider{margin:1.5rem 0 .75rem;color:#555;border-top:1px dashed #ccc;padding-top:.5rem}.field-setting-container .group-title{display:flex;height:35px;align-items:center;gap:8px;background-color:#87ceeb;padding:6px 12px;font-weight:600;color:#1f2937;font-size:13px;margin:12px 0 4px;box-shadow:0 1px 2px #0000000d}.field-setting-container .group-title .icon-wrapper{display:flex;align-items:center;justify-content:center;width:18px;height:18px;color:#1f2937}.field-setting-container .group-title .icon-wrapper i{width:16px;height:16px;stroke-width:2}.field-setting-container .group-title.mandatory{background-color:#ffecb3}.field-setting-container .group-title.optional{background-color:#d0f0fd}.field-setting-container .group-title.validators{background-color:#e8f5e9}.field-setting-container .group-title .group-name{flex:1}.field-setting-container .group-title .group-name .feather-help-circle{display:inline-block;margin-left:8px}.field-setting-container .calculated-field-rule{font-family:system-ui,sans-serif;border:1px solid #ccc;padding:1rem;border-radius:8px}.field-setting-container .calculated-field-rule h2{margin-top:0;color:#2b3e50}.field-setting-container .calculated-field-rule pre{background:#eee;padding:.5rem 1rem;border-radius:4px;overflow-x:auto}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "component", type: MandatoryPropsComponent, selector: "mandatory-props" }, { kind: "component", type: OptionalPropsComponent, selector: "optional-props" }, { kind: "component", type: ValidatorEditorComponent, selector: "validator-editor" }, { kind: "component", type: PropsHostComponent, selector: "props-host", inputs: ["loadComponent", "$isNested", "props"] }, { kind: "component", type: CalculatedPropsComponent, selector: "calculated-props" }, { kind: "directive", type: HtmlTooltipDirective, selector: "[htmlTooltip]", inputs: ["htmlTooltip", "tooltipContext", "maxWidthUnset", "backgroundColor", "hold$"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1207
+ }
1208
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: FieldSettingComponent, decorators: [{
1209
+ type: Component,
1210
+ args: [{ selector: 'field-setting', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
1211
+ FormsModule,
1212
+ NgStyle,
1213
+ MandatoryPropsComponent,
1214
+ OptionalPropsComponent,
1215
+ ValidatorEditorComponent,
1216
+ PropsHostComponent,
1217
+ AttachmentPropsComponent,
1218
+ ChecklistPropsComponent,
1219
+ DatepickerPropsComponent,
1220
+ DropdownPropsComponent,
1221
+ GridBufferPropsComponent,
1222
+ ListPropsComponent,
1223
+ MccPropsComponent,
1224
+ NumberPropsComponent,
1225
+ RadioGroupPropsComponent,
1226
+ SeekerPropsComponent,
1227
+ TextareaPropsComponent,
1228
+ UploaderPropsComponent,
1229
+ CalculatedPropsComponent,
1230
+ HtmlTooltipDirective
1231
+ ], template: "<div class=\"field-setting-container\">\r\n\r\n @if (!!$control()) {\r\n <div class=\"panel-caption-header\">\r\n <div class=\"panel-caption\">\r\n Editing: {{ (!!$control() && $control()!.type !== 'calculated') ? $control()?.controlType + ' - ' : '' }}{{ $control()?.field ||\r\n 'Unnamed' }}\r\n </div>\r\n @if (!$isNested()) {\r\n <div class=\"close-wrapper pointer\" (click)=\"closeFieldSettingPanel()\">\r\n <i class=\"feather-x\"></i>\r\n </div>\r\n }\r\n </div>\r\n\r\n\r\n <div class=\"field-setting-content\">\r\n\r\n\r\n @if (!!$control() && $control()!.type === 'calculated') {\r\n\r\n <div class=\"group-title mandatory\">\r\n <div class=\"icon-wrapper\">\r\n <i class=\"feather-lock\"></i>\r\n </div>\r\n <div class=\"group-name\">Mandatory</div>\r\n </div>\r\n <mandatory-props [$isNested]=\"$isNested()\"></mandatory-props>\r\n\r\n <div class=\"group-title calculated\">\r\n <div class=\"icon-wrapper\">\r\n <i class=\"feather-lock\"></i>\r\n </div>\r\n <div class=\"group-name\">Calculated Rule<i class=\"feather-help-circle\" [htmlTooltip]=\"aboutCalculatedField\"\r\n [maxWidthUnset]=\"true\"></i></div>\r\n </div>\r\n <calculated-props [$isNested]=\"$isNested()\"></calculated-props>\r\n\r\n\r\n } @else {\r\n\r\n <div class=\"group-title mandatory\">\r\n <div class=\"icon-wrapper\">\r\n <i class=\"feather-lock\"></i>\r\n </div>\r\n <div class=\"group-name\">Mandatory</div>\r\n </div>\r\n <mandatory-props [$isNested]=\"$isNested()\"></mandatory-props>\r\n\r\n <!-- <div class=\"setting-divider\"></div> -->\r\n\r\n @if (!!$control() && $control()!.controlType !== 'FORM_ARRAY') {\r\n <div class=\"group-title optional\">\r\n <div class=\"icon-wrapper\">\r\n <i class=\"feather-sliders\"></i>\r\n </div>\r\n <div class=\"group-name\">Optional</div>\r\n </div>\r\n <optional-props [$isNested]=\"$isNested()\"></optional-props>\r\n\r\n <!-- <div class=\"setting-divider\"></div> -->\r\n\r\n <div class=\"group-title validators\">\r\n <div class=\"icon-wrapper\">\r\n <i class=\"feather-check-square\"></i>\r\n </div>\r\n <div class=\"group-name\">Validators</div>\r\n </div>\r\n <validator-editor [$isNested]=\"$isNested()\"></validator-editor>\r\n }\r\n\r\n @if (!!$control() && !($control()!.controlType === 'TEXTBOX' && ['string', 'text', 'email'].includes(($control()!.type ||\r\n '').toLowerCase()))) {\r\n\r\n <div class=\"group-title\">\r\n <div class=\"icon-wrapper\">\r\n <i class=\"feather-check-square\"></i>\r\n </div>\r\n <div class=\"group-name\">{{ getFriendlyControlLabel($control()) }} Settings</div>\r\n </div>\r\n\r\n @if ($isNested()) {\r\n <props-host [loadComponent]=\"componentLoaderMap[coreFormDesignService.$nestedCurrentPropsComponent()]\"\r\n [$isNested]=\"true\"\r\n [props]=\"{ control: $control(), controlChange: onControlParamsChange.bind(this) }\">\r\n </props-host>\r\n } @else {\r\n <props-host [loadComponent]=\"componentLoaderMap[coreFormDesignService.$currentPropsComponent()]\"\r\n [$isNested]=\"false\"\r\n [props]=\"{ control: $control(), controlChange: onControlParamsChange.bind(this) }\">\r\n </props-host>\r\n }\r\n\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n\r\n\r\n</div>\r\n\r\n<ng-template #aboutCalculatedField>\r\n\r\n <div class=\"calculated-field-rule\" style=\"padding: 1rem; border-radius: 8px; background: #000; width: 800px;\">\r\n <h4 style=\"margin-top: 0; color: #fff;\">Calculated Field Rule</h4>\r\n <p><strong>Calculated fields</strong> are invisible boolean fields evaluated based on form inputs and logic. They\r\n help drive dynamic workflow behavior, such as conditional routing or validation triggers.</p>\r\n\r\n <h5 style=\"margin-bottom: 0.5rem; color: #fff;\">Key Properties</h5>\r\n <ul style=\"margin-top: 0;\">\r\n <li><strong>script:</strong> Expression to evaluate (e.g.,\r\n <code>leaveDays &gt; 3 &amp;&amp; status == 'Approved'</code>)</li>\r\n <li><strong>evaluationMode:</strong> <code>\"in-memory\"</code> or <code>\"sql-query\"</code></li>\r\n <li><strong>dependsOn[]:</strong> List of field names the script depends on</li>\r\n <li><strong>filterMode:</strong> <code>\"HardBlock\"</code> or <code>\"SoftWarn\"</code></li>\r\n </ul>\r\n\r\n <h5 style=\"margin-bottom: 0.5rem; color: #fff;\">Evaluation Modes</h5>\r\n <ul style=\"margin-top: 0;\">\r\n <li>\r\n <strong>in-memory:</strong> Uses <code>DynamicExpresso</code> to evaluate C#-like logic at runtime<br />\r\n <small>Example: <code>leaveType == \"ANNUAL\" &amp;&amp; leaveDays &lt; 5</code></small>\r\n </li>\r\n <li>\r\n <strong>sql-query:</strong> Runs backend SQL to evaluate conditions via\r\n <code>SELECT CASE WHEN ... THEN 1 ELSE 0 END</code><br />\r\n <small>Example:\r\n <code>SELECT CASE WHEN QUOTA &gt; 0 THEN 1 ELSE 0 END FROM LEAVE_QUOTA WHERE EMPLOYEE_ID = {{ '@' }}employeeId</code></small>\r\n </li>\r\n </ul>\r\n\r\n <h5 style=\"margin-bottom: 0.5rem; color: #fff;\">Use Cases</h5>\r\n <ul style=\"margin-top: 0;\">\r\n <li>Validate complex logic without showing the field</li>\r\n <li>Route to a different workflow branch based on hidden logic</li>\r\n <li>Trigger warning or block submission based on business rules</li>\r\n </ul>\r\n\r\n <h5 style=\"margin-bottom: 0.5rem; color: #fff;\">Example</h5>\r\n <pre style=\"color: #eee; padding: 0.5rem 1rem; border-radius: 4px; overflow-x: auto;\">\r\n {{ '{' }}\r\n \"script\": \"leaveDays > 3 && status == 'APPROVED'\",\r\n \"evaluationMode\": \"in-memory\",\r\n \"dependsOn\": [\"leaveDays\", \"status\"],\r\n \"filterMode\": \"HardBlock\"\r\n {{ '}' }}\r\n </pre>\r\n </div>\r\n\r\n\r\n</ng-template>", styles: [".field-setting-container{max-height:100%;overflow-x:hidden;overflow-y:auto}.field-setting-container .field-setting-content{padding:15px}.field-setting-container .panel-caption-header{display:flex;align-items:center;justify-content:space-between;padding:15px;height:60px;background-color:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1f2937}.field-setting-container .panel-caption-header .panel-caption{flex-grow:1}.field-setting-container .panel-caption-header .close-wrapper{display:flex;align-items:center;justify-content:center;background-color:#f1f5f9;width:32px;height:32px;border-radius:50%;cursor:pointer;transition:background-color .2s}.field-setting-container .panel-caption-header .close-wrapper:hover{background-color:#e2e8f0}.field-setting-container .setting-divider{margin:1.5rem 0 .75rem;color:#555;border-top:1px dashed #ccc;padding-top:.5rem}.field-setting-container .group-title{display:flex;height:35px;align-items:center;gap:8px;background-color:#87ceeb;padding:6px 12px;font-weight:600;color:#1f2937;font-size:13px;margin:12px 0 4px;box-shadow:0 1px 2px #0000000d}.field-setting-container .group-title .icon-wrapper{display:flex;align-items:center;justify-content:center;width:18px;height:18px;color:#1f2937}.field-setting-container .group-title .icon-wrapper i{width:16px;height:16px;stroke-width:2}.field-setting-container .group-title.mandatory{background-color:#ffecb3}.field-setting-container .group-title.optional{background-color:#d0f0fd}.field-setting-container .group-title.validators{background-color:#e8f5e9}.field-setting-container .group-title .group-name{flex:1}.field-setting-container .group-title .group-name .feather-help-circle{display:inline-block;margin-left:8px}.field-setting-container .calculated-field-rule{font-family:system-ui,sans-serif;border:1px solid #ccc;padding:1rem;border-radius:8px}.field-setting-container .calculated-field-rule h2{margin-top:0;color:#2b3e50}.field-setting-container .calculated-field-rule pre{background:#eee;padding:.5rem 1rem;border-radius:4px;overflow-x:auto}\n"] }]
1232
+ }] });
1233
+
1234
+ var EnumLeftPanelMode;
1235
+ (function (EnumLeftPanelMode) {
1236
+ EnumLeftPanelMode["FieldCollection"] = "FieldCollection";
1237
+ EnumLeftPanelMode["Json"] = "Json";
1238
+ })(EnumLeftPanelMode || (EnumLeftPanelMode = {}));
1239
+
1240
+ class CoreFormArrayControlPaletteComponent {
1241
+ constructor() {
1242
+ this.coreFormDesignService = inject(CoreFormDesignService);
1243
+ this.controlOptions = [
1244
+ {
1245
+ flexSize: 12,
1246
+ controlType: EnumFormBaseContolType.TEXTBOX,
1247
+ type: 'string',
1248
+ field: 'stringBox',
1249
+ label: '',
1250
+ value: '',
1251
+ //readonly: true,
1252
+ placeholder: 'String box',
1253
+ headless: true,
1254
+ },
1255
+ {
1256
+ flexSize: 12,
1257
+ controlType: EnumFormBaseContolType.TEXTBOX,
1258
+ type: 'email',
1259
+ field: 'email',
1260
+ label: '',
1261
+ value: '',
1262
+ //readonly: true,
1263
+ placeholder: 'Email',
1264
+ headless: true,
1265
+ },
1266
+ {
1267
+ flexSize: 12,
1268
+ controlType: EnumFormBaseContolType.TEXTAREA,
1269
+ type: 'string',
1270
+ field: 'textarea',
1271
+ label: '',
1272
+ value: '',
1273
+ //readonly: true,
1274
+ textareaRows: 2,
1275
+ placeholder: 'Text area',
1276
+ headless: true,
1277
+ },
1278
+ {
1279
+ flexSize: 12,
1280
+ controlType: EnumFormBaseContolType.TEXTBOX,
1281
+ type: 'number',
1282
+ field: 'number',
1283
+ label: '',
1284
+ value: 100,
1285
+ //readonly: true,
1286
+ placeholder: 'Number',
1287
+ headless: true,
1288
+ },
1289
+ {
1290
+ flexSize: 12,
1291
+ controlType: EnumFormBaseContolType.CURRENCY,
1292
+ type: 'number',
1293
+ field: 'currency',
1294
+ label: '',
1295
+ value: '',
1296
+ //readonly: true,
1297
+ placeholder: 'Currency',
1298
+ headless: true,
1299
+ },
1300
+ {
1301
+ flexSize: 12,
1302
+ controlType: EnumFormBaseContolType.DROPDOWN,
1303
+ type: 'any',
1304
+ field: 'dropdown',
1305
+ label: '',
1306
+ value: '',
1307
+ //readonly: true,
1308
+ dropdownOptions$: new BehaviorSubject([]),
1309
+ shownFrom: 'name',
1310
+ getByIdObject$: new BehaviorSubject({}),
1311
+ placeholder: 'Dropdown',
1312
+ headless: true,
1313
+ },
1314
+ {
1315
+ flexSize: 12,
1316
+ controlType: EnumFormBaseContolType.SEEKER,
1317
+ seekerSourceType: EnumCoreFormControlSeekerSourceType.EMPLOYEE_SEEK,
1318
+ type: 'any[]',
1319
+ field: 'employeeSeeker',
1320
+ label: '',
1321
+ value: ['Nguyễn A'],
1322
+ //readonly: true,
1323
+ boundFrom: 'id',
1324
+ shownFrom: 'fullname',
1325
+ getByIdObject$: new BehaviorSubject({}),
1326
+ placeholder: 'Employee seeker',
1327
+ headless: true,
1328
+ },
1329
+ {
1330
+ flexSize: 12,
1331
+ controlType: EnumFormBaseContolType.CHECKLIST,
1332
+ type: 'any[]',
1333
+ field: 'checklist',
1334
+ label: '',
1335
+ value: [],
1336
+ //readonly: true,
1337
+ checklistOptions$: new BehaviorSubject([]),
1338
+ shownFrom: 'name',
1339
+ getByIdObject$: new BehaviorSubject({}),
1340
+ placeholder: 'Check list',
1341
+ headless: true,
1342
+ },
1343
+ {
1344
+ flexSize: 12,
1345
+ controlType: EnumFormBaseContolType.SEEKER,
1346
+ seekerSourceType: EnumCoreFormControlSeekerSourceType.EMPLOYEE_SEEK,
1347
+ multiMode: true,
1348
+ type: 'any[]',
1349
+ field: 'employeeSeekerMultiple',
1350
+ label: '',
1351
+ value: [],
1352
+ //readonly: true,
1353
+ objectList$: new BehaviorSubject([]),
1354
+ boundFrom: 'id',
1355
+ shownFrom: 'fullname',
1356
+ getByIdObject$: new BehaviorSubject({}),
1357
+ multiModeTableHeight: 100,
1358
+ placeholder: 'Employee seeker (multi mode)',
1359
+ headless: true,
1360
+ },
1361
+ {
1362
+ flexSize: 12,
1363
+ controlType: EnumFormBaseContolType.DATEPICKER,
1364
+ type: 'date',
1365
+ field: 'datePicker',
1366
+ label: '',
1367
+ value: '',
1368
+ //readonly: true,
1369
+ placeholder: 'Date picker',
1370
+ showPlaceholder: true,
1371
+ headless: true,
1372
+ },
1373
+ {
1374
+ flexSize: 12,
1375
+ controlType: EnumFormBaseContolType.TEXTBOX,
1376
+ type: 'time',
1377
+ field: 'timeBox',
1378
+ label: '',
1379
+ value: null,
1380
+ //readonly: true,
1381
+ placeholder: 'Time box',
1382
+ headless: true,
1383
+ },
1384
+ {
1385
+ flexSize: 12,
1386
+ controlType: EnumFormBaseContolType.MONTHSELECTOR,
1387
+ type: 'string',
1388
+ field: 'monthSelector',
1389
+ label: '',
1390
+ value: '',
1391
+ //readonly: true,
1392
+ placeholder: 'Month selector',
1393
+ headless: true,
1394
+ },
1395
+ {
1396
+ flexSize: 12,
1397
+ controlType: EnumFormBaseContolType.ATTACHMENT,
1398
+ type: 'string',
1399
+ field: 'attachment',
1400
+ label: '',
1401
+ value: '',
1402
+ //readonly: true,
1403
+ assignTo: 'unknown',
1404
+ placeholder: 'Attachment',
1405
+ headless: true,
1406
+ },
1407
+ {
1408
+ flexSize: 12,
1409
+ controlType: EnumFormBaseContolType.CHECKBOX,
1410
+ type: 'boolean',
1411
+ field: 'checkbox',
1412
+ label: '',
1413
+ value: '',
1414
+ //readonly: true,
1415
+ placeholder: 'Checkbox',
1416
+ headless: true,
1417
+ }
1418
+ ];
1419
+ this.form = new FormGroup({
1420
+ stringBox: new FormControl(),
1421
+ timeBox: new FormControl(),
1422
+ email: new FormControl(),
1423
+ textarea: new FormControl(),
1424
+ number: new FormControl(),
1425
+ currency: new FormControl(),
1426
+ dropdown: new FormControl(),
1427
+ employeeSeeker: new FormControl(),
1428
+ checklist: new FormControl(),
1429
+ employeeSeekerMultiple: new FormControl(),
1430
+ datePicker: new FormControl(),
1431
+ monthSelector: new FormControl(),
1432
+ attachment: new FormControl(),
1433
+ attachmentBuffer: new FormControl(),
1434
+ checkbox: new FormControl(),
1435
+ });
1436
+ this.checkError$ = new BehaviorSubject(false);
1437
+ }
1438
+ onDragStart(event, control) {
1439
+ this.coreFormDesignService.beginDragTemplate(control, true);
1440
+ }
1441
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: CoreFormArrayControlPaletteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1442
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.5", type: CoreFormArrayControlPaletteComponent, isStandalone: true, selector: "core-form-array-control-palette", ngImport: i0, template: "<ul>\r\n <!-- <div class=\"palette-debug\">\r\n <div>controlOptions length: {{ controlOptions.length }}</div>\r\n <pre>{{ controlOptions | json }}</pre>\r\n </div> -->\r\n @for (control of controlOptions; track $index) {\r\n <li class=\"palette-item\" draggable=\"true\" (dragstart)=\"onDragStart($event, control)\">\r\n <core-control-no-form-array [control]=\"control\" [form]=\"form\" [checkError$]=\"checkError$\" />\r\n </li>\r\n }\r\n</ul>", styles: [".palette-debug{font-size:12px;background:#f9f9f9;border:1px solid #ddd;padding:8px;border-radius:4px;color:#333;margin-bottom:8px;white-space:pre-wrap}ul{padding:0}ul li{margin-top:8px;margin-bottom:8px;margin-right:15px}\n"], dependencies: [{ kind: "component", type: CoreControlNoFormArrayComponent, selector: "core-control-no-form-array", inputs: ["control", "form", "checkError$", "rangeLimit"] }] }); }
1443
+ }
1444
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: CoreFormArrayControlPaletteComponent, decorators: [{
1445
+ type: Component,
1446
+ args: [{ selector: 'core-form-array-control-palette', imports: [
1447
+ JsonPipe,
1448
+ CoreControlNoFormArrayComponent
1449
+ ], template: "<ul>\r\n <!-- <div class=\"palette-debug\">\r\n <div>controlOptions length: {{ controlOptions.length }}</div>\r\n <pre>{{ controlOptions | json }}</pre>\r\n </div> -->\r\n @for (control of controlOptions; track $index) {\r\n <li class=\"palette-item\" draggable=\"true\" (dragstart)=\"onDragStart($event, control)\">\r\n <core-control-no-form-array [control]=\"control\" [form]=\"form\" [checkError$]=\"checkError$\" />\r\n </li>\r\n }\r\n</ul>", styles: [".palette-debug{font-size:12px;background:#f9f9f9;border:1px solid #ddd;padding:8px;border-radius:4px;color:#333;margin-bottom:8px;white-space:pre-wrap}ul{padding:0}ul li{margin-top:8px;margin-bottom:8px;margin-right:15px}\n"] }]
1450
+ }] });
1451
+
1452
+ class CoreFormGroupEditorComponent extends BaseComponent {
1453
+ constructor(mls) {
1454
+ super(mls);
1455
+ this.mls = mls;
1456
+ this.$isNested = input(false);
1457
+ this.$idAsInput = input();
1458
+ this.$id = input();
1459
+ this.$settingPanel = viewChild('settingPanel');
1460
+ this.$jsonMode = signal('selectedField');
1461
+ this.injectedFields$ = new BehaviorSubject([]);
1462
+ this.$sections = computed(() => {
1463
+ if (this.$isNested()) {
1464
+ return this.coreFormDesignService.$nestedSimplifiedSections();
1465
+ }
1466
+ else {
1467
+ return this.coreFormDesignService.$sections();
1468
+ }
1469
+ });
1470
+ this.enumType = EnumFormDesignMode;
1471
+ this.enumLeftPanelMode = EnumLeftPanelMode;
1472
+ this.$leftPanelMode = computed(() => {
1473
+ if (this.coreFormDesignService.$fieldSettingPanelOpen()) {
1474
+ return this.enumLeftPanelMode.Json;
1475
+ }
1476
+ else {
1477
+ return this.enumLeftPanelMode.FieldCollection;
1478
+ }
1479
+ });
1480
+ this.ds = inject(DomService);
1481
+ this.js = inject(JsonService);
1482
+ this.$zIndex = computed(() => {
1483
+ if (this.coreFormDesignService.$fieldSettingPanelOpen()) {
1484
+ return this.ds.getMaxZIndex() + 1;
1485
+ }
1486
+ else {
1487
+ return 0;
1488
+ }
1489
+ });
1490
+ this.previewMode$ = new BehaviorSubject(EnumCorePageEditMode.CREATE);
1491
+ this.$loading = signal(false);
1492
+ this.coreFormDesignService = inject(CoreFormDesignService);
1493
+ this.$selectedCell = computed(() => {
1494
+ if (this.$isNested()) {
1495
+ return this.coreFormDesignService.$nestedSelectedCell();
1496
+ }
1497
+ else {
1498
+ return this.coreFormDesignService.$selectedCell();
1499
+ }
1500
+ });
1501
+ this.$control = computed(() => {
1502
+ if (this.$isNested()) {
1503
+ return this.coreFormDesignService.$nestedControl();
1504
+ }
1505
+ else {
1506
+ return this.coreFormDesignService.$control();
1507
+ }
1508
+ });
1509
+ this.$isInWorkflowDesign = this.coreFormDesignService.$isInWorkflowDesign;
1510
+ this.$placeholderSections = computed(() => {
1511
+ if (this.$isNested()) {
1512
+ return this.coreFormDesignService.$nestedPlaceholderSections();
1513
+ }
1514
+ else {
1515
+ return this.coreFormDesignService.$placeholderSections();
1516
+ }
1517
+ });
1518
+ this.$mode = this.coreFormDesignService.$mode;
1519
+ this.$afInstance = this.coreFormDesignService.$afInstance;
1520
+ this.renderer = inject(Renderer2);
1521
+ this.cdr = inject(ChangeDetectorRef);
1522
+ this.router = inject(Router);
1523
+ this.route = inject(ActivatedRoute);
1524
+ this.alertService = inject(AlertService);
1525
+ this.applicationHelpService = inject(ApplicationHelpService);
1526
+ this.wfs = inject(CoreWorkflowService);
1527
+ this.dbs = inject(DbService);
1528
+ this.appConfigService = inject(AppConfigService);
1529
+ this.$hasCalculatedSection = computed(() => {
1530
+ return this.$placeholderSections().some(s => !!s.forCalculatedFields);
1531
+ });
1532
+ this.setControlProp = this.coreFormDesignService.setControlProp.bind(this.coreFormDesignService);
1533
+ this.isDragOverMap = {};
1534
+ this.idStream$ = new BehaviorSubject(undefined);
1535
+ this.getByIdStream$ = this.idStream$.pipe(filter(id => !!id && id !== '0'), distinctUntilChanged(), tap(() => {
1536
+ this.$loading.set(true);
1537
+ this.coreFormDesignService.editMode$.next(EnumCorePageEditMode.UPDATE);
1538
+ this.coreFormDesignService.$submitText.set(EnumTranslateKey.UI_EDIT_FORM_BUTTON_SAVE);
1539
+ }), switchMap(id => {
1540
+ return this.coreFormDesignService.getById(id)
1541
+ .pipe(catchError(err => {
1542
+ this.$loading.set(false);
1543
+ return of(err);
1544
+ }));
1545
+ }));
1546
+ this.form = new FormGroup({
1547
+ stringBox: new FormControl(),
1548
+ timeBox: new FormControl(),
1549
+ email: new FormControl(),
1550
+ textarea: new FormControl(),
1551
+ number: new FormControl(),
1552
+ currency: new FormControl(),
1553
+ dropdown: new FormControl(),
1554
+ employeeSeeker: new FormControl(),
1555
+ checklist: new FormControl(),
1556
+ employeeSeekerMultiple: new FormControl(),
1557
+ datePicker: new FormControl(),
1558
+ monthSelector: new FormControl(),
1559
+ attachment: new FormControl(),
1560
+ attachmentBuffer: new FormControl(),
1561
+ checkbox: new FormControl(),
1562
+ calculated: new FormControl(),
1563
+ formArray: new FormArray([
1564
+ new FormControl('')
1565
+ ])
1566
+ });
1567
+ this.checkError$ = new BehaviorSubject(false);
1568
+ this.controlCategories = [
1569
+ {
1570
+ name: 'Calculated fields',
1571
+ controls: [
1572
+ {
1573
+ flexSize: 12,
1574
+ controlType: EnumFormBaseContolType.CALCULATED,
1575
+ type: 'calculated',
1576
+ field: 'calculated',
1577
+ label: '',
1578
+ value: '',
1579
+ placeholder: 'Calculated',
1580
+ headless: true,
1581
+ }
1582
+ ]
1583
+ },
1584
+ {
1585
+ name: 'Text',
1586
+ controls: [
1587
+ {
1588
+ flexSize: 12,
1589
+ controlType: EnumFormBaseContolType.TEXTBOX,
1590
+ type: 'string',
1591
+ field: 'stringBox',
1592
+ label: '',
1593
+ value: '',
1594
+ placeholder: 'String box',
1595
+ headless: true,
1596
+ },
1597
+ {
1598
+ flexSize: 12,
1599
+ controlType: EnumFormBaseContolType.TEXTBOX,
1600
+ type: 'email',
1601
+ field: 'email',
1602
+ label: '',
1603
+ value: '',
1604
+ placeholder: 'Email',
1605
+ headless: true,
1606
+ },
1607
+ {
1608
+ flexSize: 12,
1609
+ controlType: EnumFormBaseContolType.TEXTAREA,
1610
+ type: 'string',
1611
+ field: 'textarea',
1612
+ label: '',
1613
+ value: '',
1614
+ textareaRows: 2,
1615
+ placeholder: 'Text area',
1616
+ headless: true,
1617
+ }
1618
+ ]
1619
+ },
1620
+ {
1621
+ name: 'Numerical',
1622
+ controls: [
1623
+ {
1624
+ flexSize: 12,
1625
+ controlType: EnumFormBaseContolType.TEXTBOX,
1626
+ type: 'number',
1627
+ field: 'number',
1628
+ label: '',
1629
+ value: 100,
1630
+ placeholder: 'Number',
1631
+ headless: true,
1632
+ },
1633
+ {
1634
+ flexSize: 12,
1635
+ controlType: EnumFormBaseContolType.CURRENCY,
1636
+ type: 'number',
1637
+ field: 'currency',
1638
+ label: '',
1639
+ value: '',
1640
+ placeholder: 'Currency',
1641
+ headless: true,
1642
+ },
1643
+ ]
1644
+ },
1645
+ {
1646
+ name: 'Single selection',
1647
+ controls: [
1648
+ {
1649
+ flexSize: 12,
1650
+ controlType: EnumFormBaseContolType.DROPDOWN,
1651
+ type: 'any',
1652
+ field: 'dropdown',
1653
+ label: '',
1654
+ value: '',
1655
+ dropdownOptions$: new BehaviorSubject([]),
1656
+ shownFrom: 'name',
1657
+ getByIdObject$: new BehaviorSubject({}),
1658
+ placeholder: 'Dropdown',
1659
+ headless: true,
1660
+ },
1661
+ {
1662
+ flexSize: 12,
1663
+ controlType: EnumFormBaseContolType.SEEKER,
1664
+ seekerSourceType: EnumCoreFormControlSeekerSourceType.EMPLOYEE_SEEK,
1665
+ type: 'any[]',
1666
+ field: 'employeeSeeker',
1667
+ label: '',
1668
+ value: ['Nguyễn A'],
1669
+ boundFrom: 'id',
1670
+ shownFrom: 'fullname',
1671
+ getByIdObject$: new BehaviorSubject({}),
1672
+ placeholder: 'Employee seeker',
1673
+ headless: true,
1674
+ }
1675
+ ]
1676
+ },
1677
+ {
1678
+ name: 'Multiple Selection',
1679
+ controls: [
1680
+ // {
1681
+ // flexSize: 12,
1682
+ // controlType: EnumFormBaseContolType.GRIDBUFFER,
1683
+ // type: 'children',
1684
+ // field: 'gridbuffer',
1685
+ // label: '',
1686
+ // value: [],
1687
+ // placeholder: 'Grid buffer',
1688
+ // gridBufferFormSections: [
1689
+ // {
1690
+ // rows: [
1691
+ // [
1692
+ // {
1693
+ // flexSize: 6,
1694
+ // field: 'field1',
1695
+ // type: 'date',
1696
+ // value: '',
1697
+ // controlType: EnumFormBaseContolType.DATEPICKER,
1698
+ // label: 'field 1'
1699
+ // },
1700
+ // {
1701
+ // flexSize: 6,
1702
+ // field: 'field2',
1703
+ // type: 'number',
1704
+ // value: null,
1705
+ // controlType: EnumFormBaseContolType.TEXTBOX,
1706
+ // label: 'field 2'
1707
+ // },
1708
+ // ]
1709
+ // ]
1710
+ // }
1711
+ // ],
1712
+ // gridBufferTableColumns: [
1713
+ // {
1714
+ // caption: 'id',
1715
+ // field: 'id',
1716
+ // hidden: true,
1717
+ // type: 'string',
1718
+ // align: 'left',
1719
+ // width: 0,
1720
+ // },
1721
+ // {
1722
+ // field: 'field1',
1723
+ // width: 200,
1724
+ // caption: 'field 1',
1725
+ // type: 'date',
1726
+ // pipe: EnumCoreTablePipeType.DATE,
1727
+ // align: 'center'
1728
+ // },
1729
+ // {
1730
+ // field: 'field2',
1731
+ // width: 100,
1732
+ // caption: 'field 2',
1733
+ // type: 'number',
1734
+ // align: 'right'
1735
+ // },
1736
+ // ],
1737
+ // headless: true,
1738
+ // tableHeight: 100,
1739
+ // liteMode: true,
1740
+ // },
1741
+ {
1742
+ flexSize: 12,
1743
+ controlType: EnumFormBaseContolType.CHECKLIST,
1744
+ type: 'any[]',
1745
+ field: 'checklist',
1746
+ label: '',
1747
+ value: [],
1748
+ checklistOptions$: new BehaviorSubject([]),
1749
+ shownFrom: 'name',
1750
+ getByIdObject$: new BehaviorSubject({}),
1751
+ placeholder: 'Check list',
1752
+ headless: true,
1753
+ },
1754
+ {
1755
+ flexSize: 12,
1756
+ controlType: EnumFormBaseContolType.SEEKER,
1757
+ seekerSourceType: EnumCoreFormControlSeekerSourceType.EMPLOYEE_SEEK,
1758
+ multiMode: true,
1759
+ type: 'any[]',
1760
+ field: 'employeeSeekerMultiple',
1761
+ label: '',
1762
+ value: [],
1763
+ objectList$: new BehaviorSubject([]),
1764
+ boundFrom: 'id',
1765
+ shownFrom: 'fullname',
1766
+ getByIdObject$: new BehaviorSubject({}),
1767
+ multiModeTableHeight: 100,
1768
+ placeholder: 'Employee seeker (multi mode)',
1769
+ headless: true,
1770
+ }
1771
+ ]
1772
+ },
1773
+ {
1774
+ name: 'Date',
1775
+ controls: [
1776
+ {
1777
+ flexSize: 12,
1778
+ controlType: EnumFormBaseContolType.DATEPICKER,
1779
+ type: 'date',
1780
+ field: 'datePicker',
1781
+ label: '',
1782
+ value: '',
1783
+ placeholder: 'Date picker',
1784
+ showPlaceholder: true,
1785
+ headless: true,
1786
+ },
1787
+ {
1788
+ flexSize: 12,
1789
+ controlType: EnumFormBaseContolType.TEXTBOX,
1790
+ type: 'time',
1791
+ field: 'timeBox',
1792
+ label: '',
1793
+ value: null,
1794
+ placeholder: 'Time box',
1795
+ headless: true,
1796
+ },
1797
+ {
1798
+ flexSize: 12,
1799
+ controlType: EnumFormBaseContolType.MONTHSELECTOR,
1800
+ type: 'string',
1801
+ field: 'monthSelector',
1802
+ label: '',
1803
+ value: '',
1804
+ placeholder: 'Month selector',
1805
+ headless: true,
1806
+ },
1807
+ ]
1808
+ },
1809
+ {
1810
+ name: 'Other',
1811
+ controls: [
1812
+ {
1813
+ flexSize: 12,
1814
+ controlType: EnumFormBaseContolType.ATTACHMENT,
1815
+ type: 'string',
1816
+ field: 'attachment',
1817
+ label: '',
1818
+ value: '',
1819
+ assignTo: 'unknown',
1820
+ placeholder: 'Attachment',
1821
+ headless: true,
1822
+ },
1823
+ {
1824
+ flexSize: 12,
1825
+ controlType: EnumFormBaseContolType.CHECKBOX,
1826
+ type: 'boolean',
1827
+ field: 'checkbox',
1828
+ label: '',
1829
+ value: '',
1830
+ placeholder: 'Checkbox',
1831
+ headless: true,
1832
+ },
1833
+ ]
1834
+ },
1835
+ {
1836
+ name: 'Form Array',
1837
+ controls: [
1838
+ {
1839
+ flexSize: 12,
1840
+ controlType: EnumFormBaseContolType.FORM_ARRAY,
1841
+ type: 'children',
1842
+ field: 'formArray',
1843
+ label: '',
1844
+ value: '',
1845
+ placeholder: 'FormArray',
1846
+ headless: true,
1847
+ formArraySections: [
1848
+ {
1849
+ rows: [
1850
+ [
1851
+ {
1852
+ field: 'placeholder',
1853
+ flexSize: 12,
1854
+ controlType: EnumFormBaseContolType.PLACEHOLDER,
1855
+ type: 'text',
1856
+ value: '',
1857
+ label: ''
1858
+ }
1859
+ ]
1860
+ ]
1861
+ }
1862
+ ]
1863
+ },
1864
+ ]
1865
+ },
1866
+ ];
1867
+ this.generateFieldNameFor = this.coreFormDesignService.generateFieldNameFor.bind(this.coreFormDesignService);
1868
+ this.generateLabelNameFor = this.coreFormDesignService.generateLabelNameFor.bind(this.coreFormDesignService);
1869
+ this.getAllControlsFromSections = this.coreFormDesignService.getAllControlsFromSections.bind(this.coreFormDesignService);
1870
+ this.getControl = this.coreFormDesignService.getControl.bind(this.coreFormDesignService);
1871
+ this.filteredCells = this.coreFormDesignService.filteredCells;
1872
+ effect(() => {
1873
+ if (this.$isNested()) {
1874
+ this.formDesign = this.coreFormDesignService.nestedFormDesign;
1875
+ }
1876
+ else {
1877
+ this.formDesign = this.coreFormDesignService.formDesign;
1878
+ }
1879
+ });
1880
+ effect(() => {
1881
+ if (this.$isNested()) {
1882
+ this.coreFormDesignService.resetNestedFormDesignState();
1883
+ }
1884
+ else {
1885
+ this.coreFormDesignService.resetFormDesignState();
1886
+ }
1887
+ });
1888
+ // effect(() => {
1889
+ // const _ = this.coreFormDesignService.$placeholderSections();
1890
+ // this.syncFormDesignWithSections();
1891
+ // });
1892
+ effect(() => {
1893
+ this.idStream$.next(this.$id());
1894
+ });
1895
+ this.applicationHelpService.activeKey$.pipe(distinctUntilChanged()).subscribe(x => {
1896
+ switch (x) {
1897
+ case 'F3':
1898
+ this.coreFormDesignService.$fieldSettingPanelOpen.set(true);
1899
+ break;
1900
+ case 'F6':
1901
+ this.coreFormDesignService.$mode.set(EnumFormDesignMode.Preview);
1902
+ break;
1903
+ case 'Escape':
1904
+ this.coreFormDesignService.$fieldSettingPanelOpen.set(false);
1905
+ this.coreFormDesignService.$mode.set(EnumFormDesignMode.Default);
1906
+ break;
1907
+ }
1908
+ });
1909
+ }
1910
+ ngOnInit() {
1911
+ this.subscriptions.push(this.mls.lang$.subscribe(x => this.lang = x));
1912
+ if (this.appConfigService.WORKFLOW_ENABLE_DEBUG_MODE) {
1913
+ this.injectedFields$.next([
1914
+ {
1915
+ field: '___submitterEmployeeId',
1916
+ flexSize: 12,
1917
+ type: 'number',
1918
+ controlType: EnumFormBaseContolType.SEEKER,
1919
+ seekerSourceType: EnumCoreFormControlSeekerSourceType.EMPLOYEE_SEEK,
1920
+ getByIdApi: '',
1921
+ getByIdObject$: new BehaviorSubject({}),
1922
+ label: 'Simulated Requester',
1923
+ boundFrom: 'id',
1924
+ shownFrom: 'fullname',
1925
+ value: null,
1926
+ },
1927
+ {
1928
+ field: "___reason",
1929
+ type: "text",
1930
+ value: '',
1931
+ label: "UI_FORM_CONTROL_LABEL.REASON",
1932
+ flexSize: 12,
1933
+ controlType: EnumFormBaseContolType.TEXTAREA,
1934
+ textareaRows: 5,
1935
+ validators: [
1936
+ {
1937
+ name: 'required',
1938
+ validator: Validators.required,
1939
+ errorMessage: EnumTranslateKey.UI_FORM_CONTROL_ERROR_REQUIRED
1940
+ }
1941
+ ],
1942
+ }
1943
+ ]);
1944
+ }
1945
+ else {
1946
+ this.injectedFields$.next([
1947
+ {
1948
+ field: "___reason",
1949
+ type: "text",
1950
+ value: '',
1951
+ label: "UI_FORM_CONTROL_LABEL.REASON",
1952
+ flexSize: 12,
1953
+ controlType: EnumFormBaseContolType.TEXTAREA,
1954
+ textareaRows: 5,
1955
+ validators: [
1956
+ {
1957
+ name: 'required',
1958
+ validator: Validators.required,
1959
+ errorMessage: EnumTranslateKey.UI_FORM_CONTROL_ERROR_REQUIRED
1960
+ }
1961
+ ],
1962
+ }
1963
+ ]);
1964
+ }
1965
+ }
1966
+ switchJson() {
1967
+ if (this.$jsonMode() === 'full') {
1968
+ this.$jsonMode.set('selectedField');
1969
+ }
1970
+ else {
1971
+ this.$jsonMode.set('full');
1972
+ }
1973
+ }
1974
+ onDragStart(event, control) {
1975
+ this.coreFormDesignService.beginDragTemplate(control, this.$isNested());
1976
+ }
1977
+ onDragOver(event, section, control) {
1978
+ event.preventDefault(); // necessary to allow drop
1979
+ if ((!!section.forCalculatedFields && this.coreFormDesignService.$draggingControl()?.type === 'calculated') ||
1980
+ (!section.forCalculatedFields && this.coreFormDesignService.$draggingControl()?.type !== 'calculated')) {
1981
+ event.dataTransfer.dropEffect = 'copy';
1982
+ }
1983
+ else {
1984
+ event.dataTransfer.dropEffect = 'none';
1985
+ }
1986
+ }
1987
+ onDragEnter(placeholderId) {
1988
+ this.isDragOverMap[placeholderId] = true;
1989
+ }
1990
+ onDragLeave(placeholderId) {
1991
+ this.isDragOverMap[placeholderId] = false;
1992
+ }
1993
+ onDropIntoCell(event, sectionIndex, rowIndex, colIndex) {
1994
+ event.preventDefault();
1995
+ // In case of parent context
1996
+ if (!this.$isNested()) {
1997
+ const template = this.coreFormDesignService.$controlTemplate();
1998
+ if (!template)
1999
+ return;
2000
+ if (template.controlType === EnumFormBaseContolType.FORM_ARRAY && !!template.formArraySections) {
2001
+ this.alertService.info("Bạn vừa thả một con FORM_ARRAY vào đấy", alertOptions);
2002
+ }
2003
+ const fas = structuredClone(template.formArraySections);
2004
+ console.log("🔴🟠🟡🟢🔵🟣 Bạn vừa thả một con FORM_ARRAY vào đấy fas", fas);
2005
+ const section = this.coreFormDesignService.$placeholderSections()[sectionIndex];
2006
+ if (!section.forCalculatedFields && template.type === 'calculated')
2007
+ return;
2008
+ if (!!section.forCalculatedFields && template.type !== 'calculated')
2009
+ return;
2010
+ const normalized = this.coreFormDesignService.normalize({
2011
+ ...template,
2012
+ field: this.generateFieldNameFor(template),
2013
+ label: this.generateLabelNameFor(template),
2014
+ formArraySections: fas,
2015
+ value: null
2016
+ });
2017
+ console.log("🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴 normalized:", normalized);
2018
+ const row = section.rows[rowIndex];
2019
+ if (row) {
2020
+ row.cells[colIndex] = { ...row.cells[colIndex], control: normalized };
2021
+ }
2022
+ const $placeholderSections = this.coreFormDesignService.$placeholderSections;
2023
+ const $selectedCell = this.coreFormDesignService.$selectedCell;
2024
+ if (row) {
2025
+ $selectedCell.set({ ...row.cells[colIndex] });
2026
+ }
2027
+ $placeholderSections.update(sections => {
2028
+ const section = sections[sectionIndex];
2029
+ const row = section?.rows[rowIndex];
2030
+ if (!row || row.cells.length <= colIndex)
2031
+ return sections;
2032
+ normalized.flexSize = row.cells[colIndex].flexSize;
2033
+ const previousField = row.cells[colIndex]?.control?.field ?? null;
2034
+ this.coreFormDesignService.replaceControl(previousField, normalized, false);
2035
+ // 🔹 INSERT FIRST
2036
+ row.cells[colIndex] = { ...row.cells[colIndex], control: normalized };
2037
+ row.cells[colIndex].childrenSections = this.coreFormDesignService.$nestedPlaceholderSections();
2038
+ // 🔹 THEN CALL setup
2039
+ if (AttachmentFieldHelperService.isAttachment(normalized)) {
2040
+ const assignToField = AttachmentFieldHelperService.buildHiddenAssignToField(normalized.field);
2041
+ normalized.field = `${normalized.field}Buffer`;
2042
+ normalized.assignTo = assignToField.field;
2043
+ AttachmentFieldHelperService.injectAssignToFieldIntoRow(row, assignToField);
2044
+ }
2045
+ setTimeout(() => {
2046
+ this.coreFormDesignService.setControlPropDirectly('validators', normalized.validators ?? [], false, normalized);
2047
+ });
2048
+ return sections;
2049
+ });
2050
+ this.triggerUpdateSections();
2051
+ this.isDragOverMap[sectionIndex + '_' + rowIndex + '_' + colIndex] = false;
2052
+ this.coreFormDesignService.endDrag(this.$isNested());
2053
+ this.openSettingsForCell(this.coreFormDesignService.$selectedCell(), sectionIndex, rowIndex, colIndex);
2054
+ // In case of nested context
2055
+ }
2056
+ else {
2057
+ const template = this.coreFormDesignService.$nestedControlTemplate();
2058
+ if (!template)
2059
+ return;
2060
+ const section = this.coreFormDesignService.$nestedPlaceholderSections()[sectionIndex];
2061
+ if (!section.forCalculatedFields && template.type === 'calculated')
2062
+ return;
2063
+ if (!!section.forCalculatedFields && template.type !== 'calculated')
2064
+ return;
2065
+ const normalized = this.coreFormDesignService.normalize({
2066
+ ...template,
2067
+ field: this.generateFieldNameFor(template),
2068
+ label: this.generateLabelNameFor(template),
2069
+ value: null
2070
+ });
2071
+ const row = section.rows[rowIndex];
2072
+ console.group('$afInstance 💥 DROP DEBUG');
2073
+ console.log('$afInstance Template from Service:', template);
2074
+ console.log('$afInstance Normalized Control:', normalized);
2075
+ console.log('$afInstance Target Cell BEFORE insert:', row?.cells[colIndex]);
2076
+ if (row) {
2077
+ row.cells[colIndex] = { ...row.cells[colIndex], control: normalized };
2078
+ }
2079
+ else {
2080
+ console.log('$afInstance No row detected');
2081
+ }
2082
+ console.log('$afInstance ✅ Target Cell AFTER insert:', row?.cells[colIndex]);
2083
+ console.groupEnd();
2084
+ const $nestedPlaceholderSections = this.coreFormDesignService.$nestedPlaceholderSections;
2085
+ const $nestedSelectedCell = this.coreFormDesignService.$nestedSelectedCell;
2086
+ if (!!row) {
2087
+ $nestedSelectedCell.set({ ...row.cells[colIndex] });
2088
+ }
2089
+ $nestedPlaceholderSections.update(sections => {
2090
+ const section = sections[sectionIndex];
2091
+ const row = section?.rows[rowIndex];
2092
+ if (!row || row.cells.length <= colIndex)
2093
+ return sections;
2094
+ normalized.flexSize = row.cells[colIndex].flexSize;
2095
+ const previousField = row.cells[colIndex]?.control?.field ?? null;
2096
+ console.log('$afInstance Before replaceControl:', row.cells[colIndex]);
2097
+ this.coreFormDesignService.replaceControl(previousField, normalized, true);
2098
+ console.log('$afInstance After replaceControl:', row.cells[colIndex]);
2099
+ // 🔹 INSERT FIRST
2100
+ row.cells[colIndex] = { ...row.cells[colIndex], control: normalized };
2101
+ // 🔹 THEN CALL setup
2102
+ if (AttachmentFieldHelperService.isAttachment(normalized)) {
2103
+ const assignToField = AttachmentFieldHelperService.buildHiddenAssignToField(normalized.field);
2104
+ normalized.field = `${normalized.field}Buffer`;
2105
+ normalized.assignTo = assignToField.field;
2106
+ AttachmentFieldHelperService.injectAssignToFieldIntoRow(row, assignToField);
2107
+ }
2108
+ setTimeout(() => {
2109
+ this.coreFormDesignService.setControlPropDirectly('validators', normalized.validators ?? [], true, normalized);
2110
+ });
2111
+ return sections;
2112
+ });
2113
+ const parentId = this.$selectedCell()?.runtimeId;
2114
+ if (!!parentId) {
2115
+ this.coreFormDesignService.updatePlaceholderSectionsPerNestedChanges();
2116
+ }
2117
+ else {
2118
+ this.alertService.error("No $selectedCell value found", alertOptions);
2119
+ }
2120
+ this.triggerUpdateSections();
2121
+ this.isDragOverMap[sectionIndex + '_' + rowIndex + '_' + colIndex] = false;
2122
+ this.coreFormDesignService.endDrag(this.$isNested());
2123
+ }
2124
+ }
2125
+ addCalculatedSection() {
2126
+ this.coreFormDesignService.$placeholderSections.update(sections => [
2127
+ {
2128
+ caption: `Calculated Section`,
2129
+ forCalculatedFields: true,
2130
+ hidden: true,
2131
+ rows: [{ cells: [{ runtimeId: crypto.randomUUID(), flexSize: 12 }] }]
2132
+ },
2133
+ ...sections,
2134
+ ]);
2135
+ }
2136
+ addSection() {
2137
+ const $signalPlaceholderSections = this.$isNested() ? this.coreFormDesignService.$nestedPlaceholderSections : this.coreFormDesignService.$placeholderSections;
2138
+ $signalPlaceholderSections.update(sections => [
2139
+ ...sections,
2140
+ {
2141
+ caption: `Section ${sections.length + 1}`,
2142
+ rows: [{ cells: [{ runtimeId: crypto.randomUUID(), flexSize: 12 }] }]
2143
+ }
2144
+ ]);
2145
+ }
2146
+ deleteSection(sectionIndex) {
2147
+ const $signalPlaceholderSections = this.$isNested() ? this.coreFormDesignService.$nestedPlaceholderSections : this.coreFormDesignService.$placeholderSections;
2148
+ const sections = $signalPlaceholderSections();
2149
+ const section = sections[sectionIndex];
2150
+ const hasControls = section?.rows?.some(row => row?.cells?.some(cell => !!cell?.control));
2151
+ if (hasControls) {
2152
+ const confirmed = confirm('This section contains controls. Are you sure you want to delete it?');
2153
+ if (!confirmed)
2154
+ return;
2155
+ }
2156
+ $signalPlaceholderSections.update(prev => prev.filter((_, idx) => idx !== sectionIndex));
2157
+ }
2158
+ deleteRow(sectionIndex, rowIndex) {
2159
+ const sections = this.coreFormDesignService.$placeholderSections();
2160
+ const section = sections[sectionIndex];
2161
+ const row = section?.rows?.[rowIndex];
2162
+ if (!row)
2163
+ return; // safety check
2164
+ const hasControls = row.cells?.some(cell => !!cell?.control);
2165
+ if (hasControls) {
2166
+ const confirmed = confirm('This row contains controls. Are you sure you want to delete it?');
2167
+ if (!confirmed)
2168
+ return; // user canceled
2169
+ }
2170
+ this.coreFormDesignService.$placeholderSections.update(sections => {
2171
+ return sections.map((section, sIdx) => {
2172
+ if (sIdx !== sectionIndex)
2173
+ return section;
2174
+ return {
2175
+ ...section,
2176
+ rows: (section.rows ?? []).filter((_, rIdx) => rIdx !== rowIndex)
2177
+ };
2178
+ });
2179
+ });
2180
+ }
2181
+ addRow(sectionIndex) {
2182
+ this.coreFormDesignService.$placeholderSections.update(sections => {
2183
+ const section = sections[sectionIndex];
2184
+ if (section) {
2185
+ section.rows.push({ cells: [{ runtimeId: crypto.randomUUID(), flexSize: 12 }] });
2186
+ }
2187
+ return sections;
2188
+ });
2189
+ }
2190
+ addColumn(row, sectionIndex, rowIndex) {
2191
+ const normalizeControlFlexSize = () => {
2192
+ if (this.$isNested()) {
2193
+ this.coreFormDesignService.$nestedPlaceholderSections.update(sections => {
2194
+ if (!!sections) {
2195
+ const _section = sections[sectionIndex];
2196
+ const _row = _section.rows[rowIndex];
2197
+ if (!!_row) {
2198
+ _row.cells.forEach(cell => {
2199
+ if (!!cell.control) {
2200
+ cell.control.flexSize = cell.flexSize;
2201
+ if (this.coreFormDesignService.$nestedSelectedCell()?.control?.field === cell.control.field) {
2202
+ this.coreFormDesignService.$nestedSelectedCell.update(c => {
2203
+ if (!!c && !!c.control)
2204
+ c.control.flexSize = cell.flexSize;
2205
+ return c;
2206
+ });
2207
+ }
2208
+ if (this.coreFormDesignService.$nestedControl()?.field === cell.control.field) {
2209
+ this.coreFormDesignService.$nestedControl.update(c => {
2210
+ if (!!c)
2211
+ c.flexSize = cell.flexSize;
2212
+ return c;
2213
+ });
2214
+ }
2215
+ }
2216
+ });
2217
+ }
2218
+ }
2219
+ return sections;
2220
+ });
2221
+ }
2222
+ else {
2223
+ this.coreFormDesignService.$placeholderSections.update(sections => {
2224
+ if (!!sections) {
2225
+ const _section = sections[sectionIndex];
2226
+ const _row = _section.rows[rowIndex];
2227
+ if (!!_row) {
2228
+ _row.cells.forEach(cell => {
2229
+ if (!!cell.control) {
2230
+ cell.control.flexSize = cell.flexSize;
2231
+ if (this.coreFormDesignService.$selectedCell()?.control?.field === cell.control.field) {
2232
+ this.coreFormDesignService.$nestedSelectedCell.update(c => {
2233
+ if (!!c && !!c.control)
2234
+ c.control.flexSize = cell.flexSize;
2235
+ return c;
2236
+ });
2237
+ }
2238
+ if (this.coreFormDesignService.$control()?.field === cell.control.field) {
2239
+ this.coreFormDesignService.$nestedControl.update(c => {
2240
+ if (!!c)
2241
+ c.flexSize = cell.flexSize;
2242
+ return c;
2243
+ });
2244
+ }
2245
+ }
2246
+ });
2247
+ }
2248
+ }
2249
+ return sections;
2250
+ });
2251
+ }
2252
+ };
2253
+ if (!row || row.cells.length >= 4)
2254
+ return;
2255
+ const usedFlex = row.cells.reduce((sum, c) => sum + (c.flexSize ?? 0), 0);
2256
+ // ✅ Case 1: Normal case – still space available
2257
+ if (usedFlex < 12) {
2258
+ const remaining = 12 - usedFlex;
2259
+ row.cells.push({ runtimeId: crypto.randomUUID(), flexSize: Math.min(3, remaining) });
2260
+ normalizeControlFlexSize();
2261
+ return;
2262
+ }
2263
+ // 💥 Case 2: Full row — try to rebalance
2264
+ if (usedFlex === 12) {
2265
+ const count = row.cells.length;
2266
+ if (count === 1) {
2267
+ // 12 → 6 + 6
2268
+ row.cells[0].flexSize = 6;
2269
+ row.cells.push({ runtimeId: crypto.randomUUID(), flexSize: 6 });
2270
+ normalizeControlFlexSize();
2271
+ return;
2272
+ }
2273
+ if (count === 2) {
2274
+ // 6 + 6 → 4 + 4 + 4
2275
+ row.cells.forEach(c => (c.flexSize = 4));
2276
+ row.cells.push({ runtimeId: crypto.randomUUID(), flexSize: 4 });
2277
+ normalizeControlFlexSize();
2278
+ return;
2279
+ }
2280
+ if (count === 3) {
2281
+ // 4 + 4 + 4 → 3 + 3 + 3 + 3
2282
+ row.cells.forEach(c => (c.flexSize = 3));
2283
+ row.cells.push({ runtimeId: crypto.randomUUID(), flexSize: 3 });
2284
+ normalizeControlFlexSize();
2285
+ return;
2286
+ }
2287
+ // ❌ Already 4 cells, each 3 — can’t split further
2288
+ return;
2289
+ }
2290
+ // 🔧 Optional fallback logic for unknown edge cases
2291
+ const maxIndex = row.cells.reduce((maxI, c, i, arr) => (c.flexSize ?? 0) > (arr[maxI]?.flexSize ?? 0) ? i : maxI, 0);
2292
+ const maxCell = row.cells[maxIndex];
2293
+ if ((maxCell?.flexSize ?? 0) <= 3)
2294
+ return; // nothing to shrink
2295
+ maxCell.flexSize -= 3;
2296
+ row.cells.push({ runtimeId: crypto.randomUUID(), flexSize: 3 });
2297
+ }
2298
+ onCorePageHeaderButtonClicked(e) {
2299
+ if (e.code === EnumCoreButtonVNSCode.HEADER_SWITCH_VIEW) {
2300
+ if (this.coreFormDesignService.$mode() === EnumFormDesignMode.Default) {
2301
+ const sections = this.coreFormDesignService.toCoreFormSections(this.coreFormDesignService.$placeholderSections());
2302
+ this.coreFormDesignService.$liveFormSections.set(sections);
2303
+ }
2304
+ setTimeout(() => this.coreFormDesignService.$mode.set(this.coreFormDesignService.$mode() === EnumFormDesignMode.Preview ? EnumFormDesignMode.Default : EnumFormDesignMode.Preview));
2305
+ }
2306
+ else if (e.code === EnumCoreButtonVNSCode.HEADER_SAVE) {
2307
+ }
2308
+ }
2309
+ closePreview() {
2310
+ this.coreFormDesignService.$mode.set(EnumFormDesignMode.Default);
2311
+ }
2312
+ onPreviewSubmit(e) {
2313
+ alert(JSON.stringify(e, null, 2));
2314
+ }
2315
+ onCellClicked(sectionIndex, rowIndex, colIndex) {
2316
+ const row = this.coreFormDesignService.$placeholderSections()[sectionIndex].rows[rowIndex];
2317
+ if (!!row) {
2318
+ // Toggle selection
2319
+ if (!!row.cells && row.cells.length > colIndex) {
2320
+ row.cells[colIndex].selected = !row.cells[colIndex].selected;
2321
+ }
2322
+ // Only allow max 2 selections
2323
+ const selected = row.cells.filter(c => c?.selected);
2324
+ if (selected.length > 2) {
2325
+ row.cells.forEach(c => c && (c.selected = false));
2326
+ row[colIndex].selected = true;
2327
+ }
2328
+ }
2329
+ }
2330
+ canMergeCells(sectionIndex, rowIndex) {
2331
+ const row = this.coreFormDesignService.$placeholderSections()[sectionIndex].rows[rowIndex];
2332
+ const selected = row?.cells.map((c, i) => ({ c, i })).filter(x => x.c?.selected);
2333
+ if (selected?.length !== 2)
2334
+ return false;
2335
+ const [a, b] = selected;
2336
+ if (a.c.control || b.c.control)
2337
+ return false;
2338
+ return Math.abs(a.i - b.i) === 1; // Must be neighbors
2339
+ }
2340
+ mergeCells(sectionIndex, rowIndex) {
2341
+ const row = this.coreFormDesignService.$placeholderSections()[sectionIndex].rows[rowIndex];
2342
+ if (!row)
2343
+ return;
2344
+ this.coreFormDesignService.$placeholderSections.update(sections => {
2345
+ const selected = row.cells
2346
+ .map((c, i) => ({ c, i }))
2347
+ .filter(x => x.c?.selected);
2348
+ if (selected.length !== 2)
2349
+ return sections;
2350
+ const [a, b] = selected.sort((a, b) => a.i - b.i);
2351
+ const mergedFlex = (typeof a.c.flexSize === 'number' ? a.c.flexSize : 3) +
2352
+ (typeof b.c.flexSize === 'number' ? b.c.flexSize : 3);
2353
+ const mergedCell = {
2354
+ //control: { ...a.c.control, flexSize: mergedFlex }, // keep control data
2355
+ runtimeId: crypto.randomUUID(),
2356
+ flexSize: mergedFlex,
2357
+ selected: false
2358
+ };
2359
+ row.cells.splice(a.i, 2, mergedCell); // replace both cells with one
2360
+ return sections;
2361
+ });
2362
+ }
2363
+ openSettingsForCell(cell, sectionIndex, rowIndex, colIndex) {
2364
+ if (this.$isNested()) {
2365
+ this.coreFormDesignService.$nestedSectionIndex.set(sectionIndex);
2366
+ this.coreFormDesignService.$nestedRowIndex.set(rowIndex);
2367
+ this.coreFormDesignService.$nestedColIndex.set(colIndex);
2368
+ this.coreFormDesignService.$nestedSelectedCell.set({ ...cell });
2369
+ this.coreFormDesignService.$fieldSettingPanelOpen.set(false);
2370
+ }
2371
+ else {
2372
+ // this.coreFormDesignService.$sectionIndex.set(sectionIndex);
2373
+ // this.coreFormDesignService.$rowIndex.set(rowIndex);
2374
+ // this.coreFormDesignService.$colIndex.set(colIndex);
2375
+ // this.coreFormDesignService.$selectedCell.set({ ...cell });
2376
+ // this.coreFormDesignService.$fieldSettingPanelOpen.set(true);
2377
+ console.log('Non-nested mode triggered');
2378
+ this.coreFormDesignService.$sectionIndex.set(sectionIndex);
2379
+ console.log('Set sectionIndex');
2380
+ this.coreFormDesignService.$rowIndex.set(rowIndex);
2381
+ console.log('Set rowIndex');
2382
+ this.coreFormDesignService.$colIndex.set(colIndex);
2383
+ console.log('Set colIndex');
2384
+ this.coreFormDesignService.$selectedCell.set({ ...cell });
2385
+ console.log('Set selectedCell');
2386
+ this.coreFormDesignService.$fieldSettingPanelOpen.set(true);
2387
+ console.log('Set fieldSettingPanelOpen to true');
2388
+ }
2389
+ }
2390
+ deleteField(row, sectionIndex, rowIndex, colIndex) {
2391
+ if (!row)
2392
+ return;
2393
+ const dCell = row.cells[colIndex];
2394
+ const currentControl = dCell.control;
2395
+ if (!currentControl)
2396
+ return;
2397
+ const $placeholderSections = this.$isNested() ? this.coreFormDesignService.$nestedPlaceholderSections : this.coreFormDesignService.$placeholderSections;
2398
+ const $selectedCell = this.$isNested() ? this.coreFormDesignService.$nestedSelectedCell : this.coreFormDesignService.$selectedCell;
2399
+ if (!$placeholderSections()[sectionIndex].rows[rowIndex])
2400
+ return;
2401
+ $placeholderSections()[sectionIndex].rows[rowIndex].cells[colIndex].control = undefined;
2402
+ $selectedCell.set(null);
2403
+ $placeholderSections.set([...$placeholderSections()]);
2404
+ this.coreFormDesignService.updatePlaceholderSectionsPerNestedChanges();
2405
+ }
2406
+ onCaptionEditEnd(index, event) {
2407
+ const newCaption = event.target.innerText.trim();
2408
+ if (this.$isNested()) {
2409
+ this.coreFormDesignService.$nestedPlaceholderSections.update(sections => {
2410
+ sections[index].caption = newCaption;
2411
+ return sections;
2412
+ });
2413
+ }
2414
+ else {
2415
+ this.coreFormDesignService.$placeholderSections.update(sections => {
2416
+ sections[index].caption = newCaption;
2417
+ return sections;
2418
+ });
2419
+ }
2420
+ }
2421
+ onFieldCaptionEditEnd(cell, event) {
2422
+ const element = event.target;
2423
+ const newLabel = element.innerText.trim();
2424
+ // Fallback if empty
2425
+ cell.control.label = newLabel || 'Unnamed Field';
2426
+ this.triggerUpdateSections();
2427
+ }
2428
+ insertRow(sectionIndex, rowIndex) {
2429
+ const sections = this.$isNested() ? this.coreFormDesignService.$nestedPlaceholderSections() : this.coreFormDesignService.$placeholderSections();
2430
+ const section = sections[sectionIndex];
2431
+ if (!section)
2432
+ return;
2433
+ const newRow = {
2434
+ cells: [
2435
+ { runtimeId: crypto.randomUUID(), flexSize: 12 },
2436
+ ]
2437
+ };
2438
+ section.rows.splice(rowIndex + 1, 0, newRow);
2439
+ if (this.$isNested()) {
2440
+ this.coreFormDesignService.$nestedPlaceholderSections.set([...sections]);
2441
+ }
2442
+ else {
2443
+ this.coreFormDesignService.$placeholderSections.set([...sections]);
2444
+ }
2445
+ }
2446
+ triggerUpdateSections() {
2447
+ if (this.$isNested()) {
2448
+ const newValue = this.coreFormDesignService.$nestedPlaceholderSections();
2449
+ console.log("OMG $nestedPlaceholderSections being set to a new value");
2450
+ this.coreFormDesignService.$nestedPlaceholderSections.set([...newValue]);
2451
+ const newParenValue = this.coreFormDesignService.$placeholderSections();
2452
+ this.coreFormDesignService.$placeholderSections.set([...newParenValue]);
2453
+ }
2454
+ else {
2455
+ const newValue = this.coreFormDesignService.$placeholderSections();
2456
+ this.coreFormDesignService.$placeholderSections.set([...newValue]);
2457
+ }
2458
+ }
2459
+ isRequired(control) {
2460
+ if (!control || !control.validators)
2461
+ return false;
2462
+ return control.validators.some((v) => v.name === 'required' || v.name === 'requiredTrue');
2463
+ }
2464
+ onFormDesignCreated(e) {
2465
+ console.log("onFormDesignCreated", e);
2466
+ }
2467
+ onLiveFormCreated(e) {
2468
+ console.log("onLiveFormCreated", e);
2469
+ }
2470
+ showMetadata() {
2471
+ this.coreFormDesignService.$showFormMetadata.set(true);
2472
+ }
2473
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: CoreFormGroupEditorComponent, deps: [{ token: MultiLanguageService }], target: i0.ɵɵFactoryTarget.Component }); }
2474
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.5", type: CoreFormGroupEditorComponent, isStandalone: true, selector: "core-form-group-editor", inputs: { $isNested: { classPropertyName: "$isNested", publicName: "$isNested", isSignal: true, isRequired: false, transformFunction: null }, $idAsInput: { classPropertyName: "$idAsInput", publicName: "$idAsInput", isSignal: true, isRequired: false, transformFunction: null }, $id: { classPropertyName: "$id", publicName: "$id", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "$settingPanel", first: true, predicate: ["settingPanel"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"core-form-group-editor-container\">\r\n\r\n <div class=\"form-design-right\">\r\n\r\n @if ($mode() === enumType.Default) {\r\n <div class=\"form-wrapper\">\r\n\r\n @if (!$isNested() && !!$isInWorkflowDesign()) {\r\n <form-metadata></form-metadata>\r\n }\r\n\r\n <form [formGroup]=\"formDesign\" autocomplete=\"off\">\r\n <div class=\"form-cells\"> \r\n\r\n <div class=\"form-tool-bar\">\r\n @if (!$isNested() && !$hasCalculatedSection()) {\r\n <button class=\"core-button-vns-container\" (click)=\"addCalculatedSection()\">+ Calculated fields</button>\r\n }\r\n <button class=\"core-button-vns-container\" (click)=\"addSection()\">+ Add Section</button>\r\n </div>\r\n \r\n @for (section of $placeholderSections(); track $index; let sectionIndex = $index) {\r\n <div class=\"form-section-placeholder\">\r\n\r\n <div class=\"section-header\">\r\n\r\n <div class=\"section-img-wrapper\">\r\n <div class=\"section-img\" [class.calculated]=\"section.forCalculatedFields\"></div>\r\n </div>\r\n\r\n <label [attr.contenteditable]=\"!section.forCalculatedFields\"\r\n [htmlTooltip]=\"!!section.forCalculatedFields ? calculatedFieldsTooltip : null\"\r\n (blur)=\"onCaptionEditEnd(sectionIndex, $event)\"\r\n (keydown.enter)=\"onCaptionEditEnd(sectionIndex, $event); $event.preventDefault()\"\r\n >{{ section.caption }}</label>\r\n\r\n <div class=\"section-tool pointer\" (click)=\"deleteSection(sectionIndex)\" [appTooltip]=\"'Delete section'\" [showAnyway]=\"true\">\r\n <i class=\"feather-x\"></i>\r\n </div>\r\n \r\n </div>\r\n \r\n @for (row of section.rows; track $index; let rowIndex = $index) {\r\n\r\n <div class=\"form-row-wrapper\">\r\n <div class=\"form-row\">\r\n @for (cell of filteredCells(row); track $index; let colIndex = $index) {\r\n <div class=\"form-cell drop-target\" \r\n [ngStyle]=\"{ flex: (cell.flexSize ?? 0) + ' 1 0%' }\"\r\n [attr.data-flex]=\"cell.flexSize ?? 0\"\r\n (drop)=\"onDropIntoCell($event, sectionIndex, rowIndex, colIndex)\"\r\n (dragover)=\"onDragOver($event, section, cell.control!)\"\r\n (dragenter)=\"onDragEnter(sectionIndex + '_' + rowIndex + '_' + colIndex)\"\r\n (dragleave)=\"onDragLeave(sectionIndex + '_' + rowIndex + '_' + colIndex)\"\r\n [class.selected]=\"cell?.runtimeId === $selectedCell()?.runtimeId\"\r\n [class.dragging-over]=\"isDragOverMap[sectionIndex + '_' + rowIndex + '_' + colIndex]\"\r\n [class.has-control]=\"!!cell && !!cell.control && !!getControl(cell)\"\r\n (click)=\"onCellClicked(sectionIndex, rowIndex, colIndex)\"\r\n >\r\n\r\n\r\n @if (!isDragOverMap[sectionIndex + '_' + rowIndex + '_' + colIndex]) {\r\n\r\n @if (!!cell && !!cell.control && !!getControl(cell)) {\r\n <label contenteditable=\"true\"\r\n (blur)=\"onFieldCaptionEditEnd(cell, $event)\"\r\n (keydown.enter)=\"onFieldCaptionEditEnd(cell, $event); $event.preventDefault()\"\r\n [class.d-none]=\"!!getControl(cell)?.hidden\"\r\n [class.required]=\"!!cell && !!cell.control && !!getControl(cell) && isRequired(getControl(cell))\"\r\n >{{ cell.control.label || 'label' }}</label>\r\n\r\n @if (cell.control.controlType==='CALCULATED') {\r\n <div class=\"control-wrapper\" (click)=\"openSettingsForCell(cell, sectionIndex, rowIndex, colIndex)\">\r\n <core-control \r\n [control]=\"getControl(cell)!\" \r\n [form]=\"formDesign\"\r\n [checkError$]=\"checkError$\" />\r\n </div>\r\n } @else {\r\n <core-control \r\n [control]=\"getControl(cell)!\" \r\n [form]=\"formDesign\"\r\n [checkError$]=\"checkError$\" />\r\n }\r\n \r\n <div class=\"field-toolbar\">\r\n <ul>\r\n <!-- @if (!$isNested()) { -->\r\n <li>\r\n <div class=\"field-tool pointer\" (click)=\"openSettingsForCell(cell, sectionIndex, rowIndex, colIndex)\" [appTooltip]=\"'Show settings'\" [showAnyway]=\"true\">\r\n <i class=\"feather-settings\"></i>\r\n </div>\r\n </li>\r\n <!-- } -->\r\n <li>\r\n <div class=\"field-tool pointer\" (click)=\"deleteField(row, sectionIndex, rowIndex, colIndex)\" [appTooltip]=\"'Remove field from cell'\" [showAnyway]=\"true\">\r\n <i class=\"feather-x\"></i>\r\n </div>\r\n </li>\r\n </ul>\r\n </div>\r\n \r\n } @else {\r\n <div class=\"calculated-placeholder\" [class.calculated]=\"!!section.forCalculatedFields\">\r\n {{ !!section.forCalculatedFields ? 'Drop calculated field here' : 'Drop here'}}\r\n </div>\r\n }\r\n\r\n @if (cell?.selected && canMergeCells(sectionIndex, rowIndex)) {\r\n <div class=\"merge-toolbar\">\r\n <button (click)=\"mergeCells(sectionIndex, rowIndex)\">\uD83D\uDD17 Merge</button>\r\n </div>\r\n }\r\n \r\n }\r\n\r\n </div>\r\n }\r\n </div>\r\n <div class=\"row-tool-bar\">\r\n <div class=\"icon-wrapper\" (click)=\"deleteRow(sectionIndex, rowIndex)\" [appTooltip]=\"'Delete row'\" [showAnyway]=\"true\"><i class=\"feather-x\"></i></div>\r\n <div class=\"icon-wrapper\" (click)=\"addRow(sectionIndex)\" [appTooltip]=\"'Add row'\" [showAnyway]=\"true\"><i class=\"feather-arrow-down\"></i></div>\r\n <div class=\"icon-wrapper\" (click)=\"insertRow(sectionIndex, rowIndex)\" [appTooltip]=\"'Insert row'\" [showAnyway]=\"true\"><i class=\"feather-corner-right-down\"></i></div>\r\n <div class=\"icon-wrapper\" (click)=\"addColumn(row, sectionIndex, rowIndex)\" [appTooltip]=\"'Add column'\" [showAnyway]=\"true\"><i class=\"feather-arrow-right\"></i></div>\r\n </div>\r\n </div>\r\n\r\n }\r\n </div>\r\n }\r\n \r\n \r\n </div>\r\n </form>\r\n </div>\r\n } @else if (!!$sections()) {\r\n\r\n @if(!!(injectedFields$ | async) && !!(injectedFields$ | async)!.length) {\r\n\r\n @if (!!$afInstance().normalMode) {\r\n <live-form [$designMode]=\"true\" [$forKickOff]=\"true\" />\r\n } @else {\r\n <live-form [$designMode]=\"true\" [$forKickOff]=\"true\" ($onClose)=\"closePreview()\" />\r\n }\r\n\r\n } @else {\r\n <h2>COULD NOT UPDATE injectedFields$</h2>\r\n }\r\n\r\n } @else {\r\n <h2>$sections() empty / null / undefined</h2>\r\n }\r\n </div>\r\n</div>\r\n\r\n<ng-template #calculatedFieldsTooltip>\r\n <div style=\"max-width: 280px;\">\r\n <strong>Calculated Fields</strong><br />\r\n <p></p>\r\n These fields are hidden from the form and cannot be edited directly.<br /><br />\r\n - They are computed automatically during workflow execution.<br />\r\n - Each field depends on one or more standard input fields.<br />\r\n - The calculation is evaluated using either an SQL query engine (like <strong>Dapper</strong>) or an in-memory expression engine (like <strong>Dynamic Expresso</strong>).<br /><br />\r\n These results can be used to influence workflow logic, rule trees, or approval paths.\r\n </div>\r\n</ng-template>\r\n\r\n\r\n ", styles: ["@charset \"UTF-8\";.core-form-group-editor-container{position:relative;height:calc(100vh - var(--size-header-height) - var(--size-layout-block-cell-spacing));width:100%;overflow:hidden;background-color:#eff0f1;font-size:13px}.core-form-group-editor-container .core-button-vns-container{margin-right:8px!important}.core-form-group-editor-container .core-button-vns-container:last-child{background-color:#000;color:#fff;margin-right:0}.core-form-group-editor-container .af-metadata-overlay{position:fixed;top:60px;left:66px;background:#fff;box-shadow:.4rem 0 2rem #0000002e;z-index:1000;width:1214px;height:calc(100vh - 75px);overflow-y:auto;pointer-events:none}.core-form-group-editor-container .af-metadata-overlay.shown{pointer-events:auto}.core-form-group-editor-container *{border-radius:0}.core-form-group-editor-container ul,.core-form-group-editor-container li{padding:0}.core-form-group-editor-container li{max-width:200px}.core-form-group-editor-container ul div.space{display:block;height:15px}.core-form-group-editor-container li.full-width{max-width:100%}.core-form-group-editor-container .field-setting-panel{display:block;position:fixed;width:360px;height:100vh;top:0;right:-360px;background-color:#fff;box-shadow:.4rem 0 2rem #0000002e;transition:right .5s ease-out}.core-form-group-editor-container .field-setting-panel .close-wrapper{width:32px;height:32px;position:absolute;top:15px;right:15px;display:flex;background-color:#848484;border-radius:50%}.core-form-group-editor-container .field-setting-panel .close-wrapper i{width:16px;height:16px;font-size:18px;color:#848484}.core-form-group-editor-container .field-setting-panel .panel-caption{margin-bottom:1rem;padding-bottom:.5rem;border-bottom:1px solid #ddd;width:100%;overflow:hidden;text-wrap:nowrap;text-overflow:ellipsis}.core-form-group-editor-container .field-setting-panel.calculated-type{width:500px;right:-500px}.core-form-group-editor-container .field-setting-panel.calculated-type textarea{border-radius:8px;height:150px}.core-form-group-editor-container .field-setting-panel.open{right:0}.core-form-group-editor-container .form-design-left{position:absolute;top:var(--size-core-page-header-height);bottom:0;left:0;z-index:1;width:360px;height:calc(100vh - var(--size-header-height) - var(--size-layout-block-cell-spacing));padding:15px;padding-right:calc(15px + var(--size-scrollbar-width));background-color:#87ceeb;overflow-y:hidden}.core-form-group-editor-container .form-design-left .category-name{color:#fff}.core-form-group-editor-container .form-design-left .grid-buffer-wrapper{background-color:#fff;padding:15px}.core-form-group-editor-container .form-design-left ul:last-child{padding-bottom:400px}.core-form-group-editor-container .form-design-left .category-name{margin-bottom:15px}.core-form-group-editor-container .form-design-left .json-preview{background-color:#fff;color:#333;padding:1rem 1.5rem;box-shadow:0 2px 6px #00000014;font-family:Fira Code,monospace;font-size:.85rem;word-break:keep-all;overflow-x:auto;line-height:1.5;width:330px;height:calc(100vh - 205px)}.core-form-group-editor-container .form-design-left button{height:35px;border-radius:0;margin-bottom:15px;color:#fff;border:none;font-size:13px;background-color:transparent}.core-form-group-editor-container .form-design-left:hover{overflow-y:auto;padding-right:15px}.core-form-group-editor-container .form-design-right{width:100%;height:calc(100vh - var(--size-header-height) - var(--size-layout-block-cell-spacing));overflow-y:auto}.core-form-group-editor-container .form-design-right .form-wrapper{width:100%;overflow-y:visible;background-color:#fff}.core-form-group-editor-container .form-design-right .form-wrapper button{margin-left:12px;padding:4px 10px;border:1px solid #ccc;cursor:pointer;transition:all .2s;width:110px}.core-form-group-editor-container .form-design-right .form-wrapper button:hover{background-color:#e4f0ff;border-color:#007bff;color:#007bff}.core-form-group-editor-container .form-design-right .form-wrapper .form-tool-bar{display:flex;align-items:center;justify-content:flex-end}.core-form-group-editor-container .form-design-right .form-wrapper .form-tool-bar>button{width:150px;margin:0}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells{display:flex;flex-direction:column;gap:32px;padding:20px 15px 15px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder{padding:12px 15px;border:1px dashed #ccc;background-color:#fff;box-shadow:0 2px 6px #0000000a}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header{display:flex;position:relative;align-items:center;justify-content:flex-start;font-weight:600;margin-bottom:12px;color:#333}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-img{width:34px;height:34px;border-radius:50%;background-color:#d3d3d3;float:left;background-image:url(/assets/images/info.svg);background-repeat:no-repeat;background-position:center;margin-right:8px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-img.calculated{background-image:url(/assets/images/sql-icon.svg);background-color:transparent;border-radius:0}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-tool{position:absolute;right:5px;top:6px;display:none;z-index:2;color:gray}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-tool i{font-size:24px;color:#848484}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header:hover .section-tool{display:block}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .row-tool-bar{display:flex;align-items:center;justify-content:flex-end;margin-bottom:8px;height:24px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-row{display:flex;gap:15px;margin-bottom:15px;min-height:50px;background-color:#d3d3d3;padding:8px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell{flex:1;min-height:90px;background-color:#fcfcfc;border:1px dashed #ccc;position:relative;padding:20px 10px 10px;transition:border .2s ease-in-out}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell:before{content:attr(data-flex);position:absolute;top:2px;left:4px;font-size:10px;color:#999}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell label.required:after{content:\" *\";color:#ff040b}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar{position:absolute;right:7px;top:6px;display:none;z-index:2;color:gray}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar ul{display:flex}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar ul li div{display:flex;width:24px;height:24px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar ul li div i{font-size:18px;width:18px;height:18px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell.has-control:hover .field-toolbar{display:flex}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell.active-drop{border-color:#007bff;background-color:#eef6ff;transition:.2s}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .calculated-placeholder{display:flex;align-items:center;justify-content:center;background-color:#fff;color:#007bff;padding:15px 0;width:100%;cursor:default}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .calculated-placeholder.calculated{color:#ff4500}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .icon-wrapper{width:24px;height:24px;border-radius:50%;padding:0;cursor:pointer;display:none;color:gray;border:1px solid gray;margin-left:8px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .icon-wrapper i{font-size:18px;width:18px;height:18px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper:hover .icon-wrapper{display:flex}.core-form-group-editor-container .form-design-right .form-wrapper .form-cell.selected{background-color:#dff6dd!important;border:1px red dashed!important}.core-form-group-editor-container .form-design-right .form-wrapper .merge-toolbar{text-align:center;margin-top:4px}.core-form-group-editor-container .form-design-right .pre-holder{padding:15px;background-color:#fff}.core-form-group-editor-container .form-design-right .pre-holder p{position:relative;cursor:pointer}.core-form-group-editor-container .form-design-right .pre-holder p i{position:absolute;top:0;right:0;height:18px;width:18px;font-size:18px;transform:rotate(0);color:#848484;transition:transform .25s ease-in-out}.core-form-group-editor-container .form-design-right .pre-holder p i:hover{opacity:1}.core-form-group-editor-container .form-design-right .pre-holder p i.rotated{transform:rotate(90deg)}.core-form-group-editor-container .form-design-right .form-wrapper.live-form{padding-bottom:15px}.core-form-group-editor-container .form-design-right .form-wrapper.live-form .live-form-header{padding:0 15px}.core-form-group-editor-container .form-design-right .form-wrapper.live-form .live-form-header .preview-close-icon{position:absolute;right:7px;top:6px;z-index:2;color:gray;cursor:pointer}.core-form-group-editor-container .form-design-right .form-wrapper.live-form .live-form-header .preview-close-icon i{font-size:18px}.core-form-group-editor-container .drop-target{min-height:50px;min-width:50px;border:2px dashed transparent;transition:border .2s ease}.core-form-group-editor-container .drop-target.active-drop{border-color:#007bff;background-color:#eaf4ff}.core-form-group-editor-container .no-padding{padding:0!important}.core-form-group-editor-container .modal-content-root{overflow:visible}\n", ".core-form-container{overflow-x:visible}.core-form-container>form .section{margin-top:var(--size-layout-block-cell-spacing)}.core-form-container>form .section:not(:first-child){margin-top:calc(var(--size-layout-block-cell-spacing) * 2)}.core-form-container>form .section .section-header-label{display:block;height:34px;line-height:34px;margin-bottom:15px;margin-left:12px}.core-form-container>form .section .section-header-label .section-img-wrapper{position:relative}.core-form-container>form .section .section-header-label .section-img-wrapper .section-img{position:absolute;width:34px;height:34px;border-radius:50%;background-color:#d3d3d3;float:left;background-image:url(/assets/images/info.svg);background-repeat:no-repeat;background-position:center}.core-form-container>form .section .section-header-label .section-img-wrapper .section-img.calculated{background-image:url(/assets/images/sql-icon.svg);border-radius:0;background-color:transparent}.core-form-container>form .section .section-header-label .section-calc-wrapper{width:34px;height:34px;display:flex;align-items:center;justify-content:center;background-color:#d3d3d3;border-radius:50%}.core-form-container>form .section .section-header-label .section-calc-wrapper i{width:24px;height:24px;font-size:24px;color:#1b4332}.core-form-container>form .section .section-header-label .section-caption{padding-left:40px;font-weight:700;color:#696969}.core-form-container .row{margin-left:var(--size-layout-block-cell-spacing) 0px;margin-right:var(--size-layout-block-cell-spacing) 0px}.core-form-container .row .grid-buffer{border:dotted 2px darkgray}.core-form-container .row .button-control{display:flex;align-items:flex-end}.core-form-container .form-row{margin:var(--size-layout-block-cell-spacing) 0px;display:flex;align-items:center;justify-content:center}.core-form-container .form-row>button{cursor:pointer;border-radius:0}.core-form-container .form-row>button:not(:first-child){margin-left:var(--size-layout-block-cell-spacing)}.core-form-container .dev-button{cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:13px;padding:8px;width:120px;border-radius:18px;box-shadow:.4rem 0 2rem #0000002e}.core-form-container .dev-button:not(:last-child){margin-right:15px}.core-form-container .dev-button:first-child{background-color:#dff6dd;border:1px #9fdc9d solid}.core-form-container .dev-button:last-child{background-color:#fff4ce;border:1px #ffda6a solid}.core-form-container .payload-preview{display:block;width:calc(100% - 48px);height:200px;white-space:pre-wrap;overflow-x:hidden;overflow-y:auto;background-color:#dff6dd;padding:24px;margin:24px;text-indent:-58px;color:#333!important;font-family:Fira Code,monospace;font-size:.85rem;word-break:keep-all;line-height:1.5}.core-form-container .payload-preview.validator-preview{background-color:#fff4ce}.core-form-container .bottom-template-wrapper{padding-left:12px;padding-right:12px}.core-form-container .w-100{width:100%}.core-form-container .pr18{padding-right:18px}\n", ".core-button-vns-container{height:30px;display:flex;align-items:center;justify-content:center;min-width:30px}.core-button-vns-container .action-wrapper{height:30px!important;width:30px!important;display:flex;align-items:center;justify-content:center}.core-button-vns-container .action-wrapper:has(i:hover){background-color:#e7e7e7;border-radius:50%}.core-button-vns-container .btn-for-form{border:none;border-radius:0;background-color:transparent;color:#000;min-width:120px}.core-button-vns-container button.last-child{background-color:#000;color:#fff}.core-button-vns-container .action-wrapper.last-child{background-color:var(--color-basic-orange);color:#fff;border-radius:50%}.core-button-vns-container .action-wrapper.last-child:hover{background-color:var(--color-basic-orange);box-shadow:0 1rem 3rem #0000002e}.core-button-vns-container .temporary-unavailable{user-select:none;-moz-user-select:none;-webkit-user-select:none;cursor:not-allowed!important;opacity:.5}.core-button-vns-container .temporary-unavailable:hover{background-color:transparent!important}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: FormMetadataComponent, selector: "form-metadata" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: TooltipDirective, selector: "[appTooltip]", inputs: ["color", "backgroundColor", "appTooltip", "showAnyway", "position"] }, { kind: "component", type: CoreControlComponent, selector: "core-control", inputs: ["control", "form", "checkError$", "rangeLimit"] }, { kind: "component", type: LiveFormComponent, selector: "live-form", inputs: ["$designMode", "$forKickOff", "$workflowReactContext"], outputs: ["$onClose"] }, { kind: "directive", type: HtmlTooltipDirective, selector: "[htmlTooltip]", inputs: ["htmlTooltip", "tooltipContext", "maxWidthUnset", "backgroundColor", "hold$"] }], animations: [slideFromTopFadeIn], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2475
+ }
2476
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: CoreFormGroupEditorComponent, decorators: [{
2477
+ type: Component,
2478
+ args: [{ selector: 'core-form-group-editor', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
2479
+ NgStyle,
2480
+ AsyncPipe,
2481
+ JsonSafePipe,
2482
+ NgTemplateOutlet,
2483
+ CoreFormArrayLayoutEditorComponent,
2484
+ CoreToastLoadingComponent,
2485
+ CorePageHeaderComponent,
2486
+ FormMetadataComponent,
2487
+ ReactiveFormsModule,
2488
+ TranslatePipe,
2489
+ TableCellPipe,
2490
+ TooltipDirective,
2491
+ HotKeysDirective,
2492
+ CoreFormComponent,
2493
+ CoreControlComponent,
2494
+ CoreDropdownComponent,
2495
+ CoreChecklistComponent,
2496
+ CoreFormControlSeekerComponent,
2497
+ CoreCheckboxComponent,
2498
+ CoreAttachmentComponent,
2499
+ CoreDatePickerComponent,
2500
+ CoreRadioGroupComponent,
2501
+ CoreMonthSelectorComponent,
2502
+ TooltipDirective,
2503
+ CoreCurrencyInputComponent,
2504
+ FieldSettingComponent,
2505
+ LiveFormComponent,
2506
+ HtmlTooltipDirective,
2507
+ ], animations: [slideFromTopFadeIn], template: "<div class=\"core-form-group-editor-container\">\r\n\r\n <div class=\"form-design-right\">\r\n\r\n @if ($mode() === enumType.Default) {\r\n <div class=\"form-wrapper\">\r\n\r\n @if (!$isNested() && !!$isInWorkflowDesign()) {\r\n <form-metadata></form-metadata>\r\n }\r\n\r\n <form [formGroup]=\"formDesign\" autocomplete=\"off\">\r\n <div class=\"form-cells\"> \r\n\r\n <div class=\"form-tool-bar\">\r\n @if (!$isNested() && !$hasCalculatedSection()) {\r\n <button class=\"core-button-vns-container\" (click)=\"addCalculatedSection()\">+ Calculated fields</button>\r\n }\r\n <button class=\"core-button-vns-container\" (click)=\"addSection()\">+ Add Section</button>\r\n </div>\r\n \r\n @for (section of $placeholderSections(); track $index; let sectionIndex = $index) {\r\n <div class=\"form-section-placeholder\">\r\n\r\n <div class=\"section-header\">\r\n\r\n <div class=\"section-img-wrapper\">\r\n <div class=\"section-img\" [class.calculated]=\"section.forCalculatedFields\"></div>\r\n </div>\r\n\r\n <label [attr.contenteditable]=\"!section.forCalculatedFields\"\r\n [htmlTooltip]=\"!!section.forCalculatedFields ? calculatedFieldsTooltip : null\"\r\n (blur)=\"onCaptionEditEnd(sectionIndex, $event)\"\r\n (keydown.enter)=\"onCaptionEditEnd(sectionIndex, $event); $event.preventDefault()\"\r\n >{{ section.caption }}</label>\r\n\r\n <div class=\"section-tool pointer\" (click)=\"deleteSection(sectionIndex)\" [appTooltip]=\"'Delete section'\" [showAnyway]=\"true\">\r\n <i class=\"feather-x\"></i>\r\n </div>\r\n \r\n </div>\r\n \r\n @for (row of section.rows; track $index; let rowIndex = $index) {\r\n\r\n <div class=\"form-row-wrapper\">\r\n <div class=\"form-row\">\r\n @for (cell of filteredCells(row); track $index; let colIndex = $index) {\r\n <div class=\"form-cell drop-target\" \r\n [ngStyle]=\"{ flex: (cell.flexSize ?? 0) + ' 1 0%' }\"\r\n [attr.data-flex]=\"cell.flexSize ?? 0\"\r\n (drop)=\"onDropIntoCell($event, sectionIndex, rowIndex, colIndex)\"\r\n (dragover)=\"onDragOver($event, section, cell.control!)\"\r\n (dragenter)=\"onDragEnter(sectionIndex + '_' + rowIndex + '_' + colIndex)\"\r\n (dragleave)=\"onDragLeave(sectionIndex + '_' + rowIndex + '_' + colIndex)\"\r\n [class.selected]=\"cell?.runtimeId === $selectedCell()?.runtimeId\"\r\n [class.dragging-over]=\"isDragOverMap[sectionIndex + '_' + rowIndex + '_' + colIndex]\"\r\n [class.has-control]=\"!!cell && !!cell.control && !!getControl(cell)\"\r\n (click)=\"onCellClicked(sectionIndex, rowIndex, colIndex)\"\r\n >\r\n\r\n\r\n @if (!isDragOverMap[sectionIndex + '_' + rowIndex + '_' + colIndex]) {\r\n\r\n @if (!!cell && !!cell.control && !!getControl(cell)) {\r\n <label contenteditable=\"true\"\r\n (blur)=\"onFieldCaptionEditEnd(cell, $event)\"\r\n (keydown.enter)=\"onFieldCaptionEditEnd(cell, $event); $event.preventDefault()\"\r\n [class.d-none]=\"!!getControl(cell)?.hidden\"\r\n [class.required]=\"!!cell && !!cell.control && !!getControl(cell) && isRequired(getControl(cell))\"\r\n >{{ cell.control.label || 'label' }}</label>\r\n\r\n @if (cell.control.controlType==='CALCULATED') {\r\n <div class=\"control-wrapper\" (click)=\"openSettingsForCell(cell, sectionIndex, rowIndex, colIndex)\">\r\n <core-control \r\n [control]=\"getControl(cell)!\" \r\n [form]=\"formDesign\"\r\n [checkError$]=\"checkError$\" />\r\n </div>\r\n } @else {\r\n <core-control \r\n [control]=\"getControl(cell)!\" \r\n [form]=\"formDesign\"\r\n [checkError$]=\"checkError$\" />\r\n }\r\n \r\n <div class=\"field-toolbar\">\r\n <ul>\r\n <!-- @if (!$isNested()) { -->\r\n <li>\r\n <div class=\"field-tool pointer\" (click)=\"openSettingsForCell(cell, sectionIndex, rowIndex, colIndex)\" [appTooltip]=\"'Show settings'\" [showAnyway]=\"true\">\r\n <i class=\"feather-settings\"></i>\r\n </div>\r\n </li>\r\n <!-- } -->\r\n <li>\r\n <div class=\"field-tool pointer\" (click)=\"deleteField(row, sectionIndex, rowIndex, colIndex)\" [appTooltip]=\"'Remove field from cell'\" [showAnyway]=\"true\">\r\n <i class=\"feather-x\"></i>\r\n </div>\r\n </li>\r\n </ul>\r\n </div>\r\n \r\n } @else {\r\n <div class=\"calculated-placeholder\" [class.calculated]=\"!!section.forCalculatedFields\">\r\n {{ !!section.forCalculatedFields ? 'Drop calculated field here' : 'Drop here'}}\r\n </div>\r\n }\r\n\r\n @if (cell?.selected && canMergeCells(sectionIndex, rowIndex)) {\r\n <div class=\"merge-toolbar\">\r\n <button (click)=\"mergeCells(sectionIndex, rowIndex)\">\uD83D\uDD17 Merge</button>\r\n </div>\r\n }\r\n \r\n }\r\n\r\n </div>\r\n }\r\n </div>\r\n <div class=\"row-tool-bar\">\r\n <div class=\"icon-wrapper\" (click)=\"deleteRow(sectionIndex, rowIndex)\" [appTooltip]=\"'Delete row'\" [showAnyway]=\"true\"><i class=\"feather-x\"></i></div>\r\n <div class=\"icon-wrapper\" (click)=\"addRow(sectionIndex)\" [appTooltip]=\"'Add row'\" [showAnyway]=\"true\"><i class=\"feather-arrow-down\"></i></div>\r\n <div class=\"icon-wrapper\" (click)=\"insertRow(sectionIndex, rowIndex)\" [appTooltip]=\"'Insert row'\" [showAnyway]=\"true\"><i class=\"feather-corner-right-down\"></i></div>\r\n <div class=\"icon-wrapper\" (click)=\"addColumn(row, sectionIndex, rowIndex)\" [appTooltip]=\"'Add column'\" [showAnyway]=\"true\"><i class=\"feather-arrow-right\"></i></div>\r\n </div>\r\n </div>\r\n\r\n }\r\n </div>\r\n }\r\n \r\n \r\n </div>\r\n </form>\r\n </div>\r\n } @else if (!!$sections()) {\r\n\r\n @if(!!(injectedFields$ | async) && !!(injectedFields$ | async)!.length) {\r\n\r\n @if (!!$afInstance().normalMode) {\r\n <live-form [$designMode]=\"true\" [$forKickOff]=\"true\" />\r\n } @else {\r\n <live-form [$designMode]=\"true\" [$forKickOff]=\"true\" ($onClose)=\"closePreview()\" />\r\n }\r\n\r\n } @else {\r\n <h2>COULD NOT UPDATE injectedFields$</h2>\r\n }\r\n\r\n } @else {\r\n <h2>$sections() empty / null / undefined</h2>\r\n }\r\n </div>\r\n</div>\r\n\r\n<ng-template #calculatedFieldsTooltip>\r\n <div style=\"max-width: 280px;\">\r\n <strong>Calculated Fields</strong><br />\r\n <p></p>\r\n These fields are hidden from the form and cannot be edited directly.<br /><br />\r\n - They are computed automatically during workflow execution.<br />\r\n - Each field depends on one or more standard input fields.<br />\r\n - The calculation is evaluated using either an SQL query engine (like <strong>Dapper</strong>) or an in-memory expression engine (like <strong>Dynamic Expresso</strong>).<br /><br />\r\n These results can be used to influence workflow logic, rule trees, or approval paths.\r\n </div>\r\n</ng-template>\r\n\r\n\r\n ", styles: ["@charset \"UTF-8\";.core-form-group-editor-container{position:relative;height:calc(100vh - var(--size-header-height) - var(--size-layout-block-cell-spacing));width:100%;overflow:hidden;background-color:#eff0f1;font-size:13px}.core-form-group-editor-container .core-button-vns-container{margin-right:8px!important}.core-form-group-editor-container .core-button-vns-container:last-child{background-color:#000;color:#fff;margin-right:0}.core-form-group-editor-container .af-metadata-overlay{position:fixed;top:60px;left:66px;background:#fff;box-shadow:.4rem 0 2rem #0000002e;z-index:1000;width:1214px;height:calc(100vh - 75px);overflow-y:auto;pointer-events:none}.core-form-group-editor-container .af-metadata-overlay.shown{pointer-events:auto}.core-form-group-editor-container *{border-radius:0}.core-form-group-editor-container ul,.core-form-group-editor-container li{padding:0}.core-form-group-editor-container li{max-width:200px}.core-form-group-editor-container ul div.space{display:block;height:15px}.core-form-group-editor-container li.full-width{max-width:100%}.core-form-group-editor-container .field-setting-panel{display:block;position:fixed;width:360px;height:100vh;top:0;right:-360px;background-color:#fff;box-shadow:.4rem 0 2rem #0000002e;transition:right .5s ease-out}.core-form-group-editor-container .field-setting-panel .close-wrapper{width:32px;height:32px;position:absolute;top:15px;right:15px;display:flex;background-color:#848484;border-radius:50%}.core-form-group-editor-container .field-setting-panel .close-wrapper i{width:16px;height:16px;font-size:18px;color:#848484}.core-form-group-editor-container .field-setting-panel .panel-caption{margin-bottom:1rem;padding-bottom:.5rem;border-bottom:1px solid #ddd;width:100%;overflow:hidden;text-wrap:nowrap;text-overflow:ellipsis}.core-form-group-editor-container .field-setting-panel.calculated-type{width:500px;right:-500px}.core-form-group-editor-container .field-setting-panel.calculated-type textarea{border-radius:8px;height:150px}.core-form-group-editor-container .field-setting-panel.open{right:0}.core-form-group-editor-container .form-design-left{position:absolute;top:var(--size-core-page-header-height);bottom:0;left:0;z-index:1;width:360px;height:calc(100vh - var(--size-header-height) - var(--size-layout-block-cell-spacing));padding:15px;padding-right:calc(15px + var(--size-scrollbar-width));background-color:#87ceeb;overflow-y:hidden}.core-form-group-editor-container .form-design-left .category-name{color:#fff}.core-form-group-editor-container .form-design-left .grid-buffer-wrapper{background-color:#fff;padding:15px}.core-form-group-editor-container .form-design-left ul:last-child{padding-bottom:400px}.core-form-group-editor-container .form-design-left .category-name{margin-bottom:15px}.core-form-group-editor-container .form-design-left .json-preview{background-color:#fff;color:#333;padding:1rem 1.5rem;box-shadow:0 2px 6px #00000014;font-family:Fira Code,monospace;font-size:.85rem;word-break:keep-all;overflow-x:auto;line-height:1.5;width:330px;height:calc(100vh - 205px)}.core-form-group-editor-container .form-design-left button{height:35px;border-radius:0;margin-bottom:15px;color:#fff;border:none;font-size:13px;background-color:transparent}.core-form-group-editor-container .form-design-left:hover{overflow-y:auto;padding-right:15px}.core-form-group-editor-container .form-design-right{width:100%;height:calc(100vh - var(--size-header-height) - var(--size-layout-block-cell-spacing));overflow-y:auto}.core-form-group-editor-container .form-design-right .form-wrapper{width:100%;overflow-y:visible;background-color:#fff}.core-form-group-editor-container .form-design-right .form-wrapper button{margin-left:12px;padding:4px 10px;border:1px solid #ccc;cursor:pointer;transition:all .2s;width:110px}.core-form-group-editor-container .form-design-right .form-wrapper button:hover{background-color:#e4f0ff;border-color:#007bff;color:#007bff}.core-form-group-editor-container .form-design-right .form-wrapper .form-tool-bar{display:flex;align-items:center;justify-content:flex-end}.core-form-group-editor-container .form-design-right .form-wrapper .form-tool-bar>button{width:150px;margin:0}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells{display:flex;flex-direction:column;gap:32px;padding:20px 15px 15px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder{padding:12px 15px;border:1px dashed #ccc;background-color:#fff;box-shadow:0 2px 6px #0000000a}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header{display:flex;position:relative;align-items:center;justify-content:flex-start;font-weight:600;margin-bottom:12px;color:#333}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-img{width:34px;height:34px;border-radius:50%;background-color:#d3d3d3;float:left;background-image:url(/assets/images/info.svg);background-repeat:no-repeat;background-position:center;margin-right:8px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-img.calculated{background-image:url(/assets/images/sql-icon.svg);background-color:transparent;border-radius:0}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-tool{position:absolute;right:5px;top:6px;display:none;z-index:2;color:gray}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-tool i{font-size:24px;color:#848484}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header:hover .section-tool{display:block}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .row-tool-bar{display:flex;align-items:center;justify-content:flex-end;margin-bottom:8px;height:24px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-row{display:flex;gap:15px;margin-bottom:15px;min-height:50px;background-color:#d3d3d3;padding:8px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell{flex:1;min-height:90px;background-color:#fcfcfc;border:1px dashed #ccc;position:relative;padding:20px 10px 10px;transition:border .2s ease-in-out}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell:before{content:attr(data-flex);position:absolute;top:2px;left:4px;font-size:10px;color:#999}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell label.required:after{content:\" *\";color:#ff040b}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar{position:absolute;right:7px;top:6px;display:none;z-index:2;color:gray}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar ul{display:flex}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar ul li div{display:flex;width:24px;height:24px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar ul li div i{font-size:18px;width:18px;height:18px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell.has-control:hover .field-toolbar{display:flex}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell.active-drop{border-color:#007bff;background-color:#eef6ff;transition:.2s}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .calculated-placeholder{display:flex;align-items:center;justify-content:center;background-color:#fff;color:#007bff;padding:15px 0;width:100%;cursor:default}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .calculated-placeholder.calculated{color:#ff4500}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .icon-wrapper{width:24px;height:24px;border-radius:50%;padding:0;cursor:pointer;display:none;color:gray;border:1px solid gray;margin-left:8px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .icon-wrapper i{font-size:18px;width:18px;height:18px}.core-form-group-editor-container .form-design-right .form-wrapper .form-cells .form-row-wrapper:hover .icon-wrapper{display:flex}.core-form-group-editor-container .form-design-right .form-wrapper .form-cell.selected{background-color:#dff6dd!important;border:1px red dashed!important}.core-form-group-editor-container .form-design-right .form-wrapper .merge-toolbar{text-align:center;margin-top:4px}.core-form-group-editor-container .form-design-right .pre-holder{padding:15px;background-color:#fff}.core-form-group-editor-container .form-design-right .pre-holder p{position:relative;cursor:pointer}.core-form-group-editor-container .form-design-right .pre-holder p i{position:absolute;top:0;right:0;height:18px;width:18px;font-size:18px;transform:rotate(0);color:#848484;transition:transform .25s ease-in-out}.core-form-group-editor-container .form-design-right .pre-holder p i:hover{opacity:1}.core-form-group-editor-container .form-design-right .pre-holder p i.rotated{transform:rotate(90deg)}.core-form-group-editor-container .form-design-right .form-wrapper.live-form{padding-bottom:15px}.core-form-group-editor-container .form-design-right .form-wrapper.live-form .live-form-header{padding:0 15px}.core-form-group-editor-container .form-design-right .form-wrapper.live-form .live-form-header .preview-close-icon{position:absolute;right:7px;top:6px;z-index:2;color:gray;cursor:pointer}.core-form-group-editor-container .form-design-right .form-wrapper.live-form .live-form-header .preview-close-icon i{font-size:18px}.core-form-group-editor-container .drop-target{min-height:50px;min-width:50px;border:2px dashed transparent;transition:border .2s ease}.core-form-group-editor-container .drop-target.active-drop{border-color:#007bff;background-color:#eaf4ff}.core-form-group-editor-container .no-padding{padding:0!important}.core-form-group-editor-container .modal-content-root{overflow:visible}\n", ".core-form-container{overflow-x:visible}.core-form-container>form .section{margin-top:var(--size-layout-block-cell-spacing)}.core-form-container>form .section:not(:first-child){margin-top:calc(var(--size-layout-block-cell-spacing) * 2)}.core-form-container>form .section .section-header-label{display:block;height:34px;line-height:34px;margin-bottom:15px;margin-left:12px}.core-form-container>form .section .section-header-label .section-img-wrapper{position:relative}.core-form-container>form .section .section-header-label .section-img-wrapper .section-img{position:absolute;width:34px;height:34px;border-radius:50%;background-color:#d3d3d3;float:left;background-image:url(/assets/images/info.svg);background-repeat:no-repeat;background-position:center}.core-form-container>form .section .section-header-label .section-img-wrapper .section-img.calculated{background-image:url(/assets/images/sql-icon.svg);border-radius:0;background-color:transparent}.core-form-container>form .section .section-header-label .section-calc-wrapper{width:34px;height:34px;display:flex;align-items:center;justify-content:center;background-color:#d3d3d3;border-radius:50%}.core-form-container>form .section .section-header-label .section-calc-wrapper i{width:24px;height:24px;font-size:24px;color:#1b4332}.core-form-container>form .section .section-header-label .section-caption{padding-left:40px;font-weight:700;color:#696969}.core-form-container .row{margin-left:var(--size-layout-block-cell-spacing) 0px;margin-right:var(--size-layout-block-cell-spacing) 0px}.core-form-container .row .grid-buffer{border:dotted 2px darkgray}.core-form-container .row .button-control{display:flex;align-items:flex-end}.core-form-container .form-row{margin:var(--size-layout-block-cell-spacing) 0px;display:flex;align-items:center;justify-content:center}.core-form-container .form-row>button{cursor:pointer;border-radius:0}.core-form-container .form-row>button:not(:first-child){margin-left:var(--size-layout-block-cell-spacing)}.core-form-container .dev-button{cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:13px;padding:8px;width:120px;border-radius:18px;box-shadow:.4rem 0 2rem #0000002e}.core-form-container .dev-button:not(:last-child){margin-right:15px}.core-form-container .dev-button:first-child{background-color:#dff6dd;border:1px #9fdc9d solid}.core-form-container .dev-button:last-child{background-color:#fff4ce;border:1px #ffda6a solid}.core-form-container .payload-preview{display:block;width:calc(100% - 48px);height:200px;white-space:pre-wrap;overflow-x:hidden;overflow-y:auto;background-color:#dff6dd;padding:24px;margin:24px;text-indent:-58px;color:#333!important;font-family:Fira Code,monospace;font-size:.85rem;word-break:keep-all;line-height:1.5}.core-form-container .payload-preview.validator-preview{background-color:#fff4ce}.core-form-container .bottom-template-wrapper{padding-left:12px;padding-right:12px}.core-form-container .w-100{width:100%}.core-form-container .pr18{padding-right:18px}\n", ".core-button-vns-container{height:30px;display:flex;align-items:center;justify-content:center;min-width:30px}.core-button-vns-container .action-wrapper{height:30px!important;width:30px!important;display:flex;align-items:center;justify-content:center}.core-button-vns-container .action-wrapper:has(i:hover){background-color:#e7e7e7;border-radius:50%}.core-button-vns-container .btn-for-form{border:none;border-radius:0;background-color:transparent;color:#000;min-width:120px}.core-button-vns-container button.last-child{background-color:#000;color:#fff}.core-button-vns-container .action-wrapper.last-child{background-color:var(--color-basic-orange);color:#fff;border-radius:50%}.core-button-vns-container .action-wrapper.last-child:hover{background-color:var(--color-basic-orange);box-shadow:0 1rem 3rem #0000002e}.core-button-vns-container .temporary-unavailable{user-select:none;-moz-user-select:none;-webkit-user-select:none;cursor:not-allowed!important;opacity:.5}.core-button-vns-container .temporary-unavailable:hover{background-color:transparent!important}\n"] }]
2508
+ }], ctorParameters: () => [{ type: MultiLanguageService }] });
2509
+
2510
+ const HOLD_KEYS = [
2511
+ 'controlTemplate',
2512
+ 'nestedControlTemplate',
2513
+ 'selectedCell',
2514
+ 'nestedSelectedCell',
2515
+ 'control',
2516
+ 'nestedControl',
2517
+ 'placeholderSections',
2518
+ 'nestedPlaceholderSections',
2519
+ ];
2520
+ class CoreFormDesignMonitorComponent {
2521
+ constructor() {
2522
+ this.$mode = input();
2523
+ this.domService = inject(DomService);
2524
+ this.fds = inject(CoreFormDesignService);
2525
+ // Signals
2526
+ this.$controlTemplate = this.fds.$controlTemplate;
2527
+ this.$nestedControlTemplate = this.fds.$nestedControlTemplate;
2528
+ this.$selectedCell = this.fds.$selectedCell;
2529
+ this.$nestedSelectedCell = this.fds.$nestedSelectedCell;
2530
+ this.$control = this.fds.$control;
2531
+ this.$nestedControl = this.fds.$nestedControl;
2532
+ this.$placeholderSections = this.fds.$placeholderSections;
2533
+ this.$nestedPlaceholderSections = this.fds.$nestedPlaceholderSections;
2534
+ this.normalizeCalledCount$ = this.fds.normalizeCalledCount$;
2535
+ // Holds
2536
+ this.holdControlTemplate$ = new BehaviorSubject(false);
2537
+ this.holdNestedControlTemplate$ = new BehaviorSubject(false);
2538
+ this.holdSelectedCell$ = new BehaviorSubject(false);
2539
+ this.holdNestedSelectedCell$ = new BehaviorSubject(false);
2540
+ this.holdControl$ = new BehaviorSubject(false);
2541
+ this.holdNestedControl$ = new BehaviorSubject(false);
2542
+ this.holdPlaceholderSections$ = new BehaviorSubject(false);
2543
+ this.holdNestedPlaceholderSections$ = new BehaviorSubject(false);
2544
+ this.holdMap = {
2545
+ controlTemplate: this.holdControlTemplate$,
2546
+ nestedControlTemplate: this.holdNestedControlTemplate$,
2547
+ selectedCell: this.holdSelectedCell$,
2548
+ nestedSelectedCell: this.holdNestedSelectedCell$,
2549
+ control: this.holdControl$,
2550
+ nestedControl: this.holdNestedControl$,
2551
+ placeholderSections: this.holdPlaceholderSections$,
2552
+ nestedPlaceholderSections: this.holdNestedPlaceholderSections$,
2553
+ };
2554
+ }
2555
+ toggleHold(code) {
2556
+ const subject = this.holdMap[code];
2557
+ if (!subject) {
2558
+ console.warn(`[toggleHold] Unknown key: ${code}`);
2559
+ return;
2560
+ }
2561
+ subject.next(!subject.value);
2562
+ }
2563
+ viewFormInConsole() {
2564
+ console.log('🔴', this.$mode() === 'main'
2565
+ ? this.fds.formDesign
2566
+ : this.fds.nestedFormDesign);
2567
+ }
2568
+ ngAfterViewInit() { }
2569
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: CoreFormDesignMonitorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2570
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.5", type: CoreFormDesignMonitorComponent, isStandalone: true, selector: "core-form-design-monitor", inputs: { $mode: { classPropertyName: "$mode", publicName: "$mode", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"core-form-design-monitor-container\">\r\n <div class=\"list-wrapper\">\r\n <ul>\r\n <li [appTooltip]=\"'Click to view form in the Console'\" [showAnyway]=\"true\" (click)=\"viewFormInConsole()\">\uD83D\uDCE6</li>\r\n <li [appTooltip]=\"'The normalize function called count'\" [showAnyway]=\"true\">{{ normalizeCalledCount$ | async }}</li>\r\n <li [htmlTooltip]=\"controlTemplate\" [hold$]=\"holdControlTemplate$\"\r\n [class.hold]=\"holdControlTemplate$ | async\" (click)=\"toggleHold('controlTemplate')\">CT\r\n </li>\r\n <li [htmlTooltip]=\"nestedControlTemplate\" [hold$]=\"holdNestedControlTemplate$\"\r\n [class.hold]=\"holdNestedControlTemplate$ | async\"\r\n (click)=\"toggleHold('nestedControlTemplate')\">NCT</li>\r\n <li [htmlTooltip]=\"selectedCell\" [hold$]=\"holdSelectedCell$\" [class.hold]=\"holdSelectedCell$ | async\"\r\n (click)=\"toggleHold('selectedCell')\">SC</li>\r\n <li [htmlTooltip]=\"nestedSelectedCell\" [hold$]=\"holdNestedSelectedCell$\"\r\n [class.hold]=\"holdNestedSelectedCell$ | async\" (click)=\"toggleHold('nestedSelectedCell')\">NSC</li>\r\n <li [htmlTooltip]=\"control\" [hold$]=\"holdControl$\" [class.hold]=\"holdControl$ | async\"\r\n (click)=\"toggleHold('control')\">CC</li>\r\n <li [htmlTooltip]=\"nestedControl\" [hold$]=\"holdNestedControl$\"\r\n [class.hold]=\"holdNestedControl$ | async\" (click)=\"toggleHold('nestedControl')\">NCC</li>\r\n <li [htmlTooltip]=\"placeholderSections\" [hold$]=\"holdPlaceholderSections$\"\r\n [class.hold]=\"holdPlaceholderSections$ | async\" (click)=\"toggleHold('placeholderSections')\">PHS</li>\r\n <li [htmlTooltip]=\"nestedPlaceholderSections\" [hold$]=\"holdNestedPlaceholderSections$\"\r\n [class.hold]=\"holdNestedPlaceholderSections$ | async\" (click)=\"toggleHold('nestedPlaceholderSections')\">\r\n NPHS</li>\r\n </ul>\r\n </div>\r\n\r\n <ng-template #controlTemplate>\r\n <div class=\"pre-holder\">\r\n <p>$controlTemplate</p>\r\n <pre>{{ $controlTemplate() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #nestedControlTemplate>\r\n <div class=\"pre-holder\">\r\n <p>$nestedControlTemplate</p>\r\n <pre>{{ $nestedControlTemplate() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #selectedCell>\r\n <div class=\"pre-holder\">\r\n <p>$selectedCell</p>\r\n <pre>{{ $selectedCell() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #nestedSelectedCell>\r\n <div class=\"pre-holder\">\r\n <p>$nestedSelectedCell</p>\r\n <pre>{{ $nestedSelectedCell() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #control>\r\n <div class=\"pre-holder\">\r\n <p>$control</p>\r\n <pre>{{ $control() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #nestedControl>\r\n <div class=\"pre-holder\">\r\n <p>$nestedControl</p>\r\n <pre>{{ $nestedControl() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #placeholderSections>\r\n <div class=\"pre-holder\">\r\n <p>$placeholderSections</p>\r\n <pre>{{ $placeholderSections() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #nestedPlaceholderSections>\r\n <div class=\"pre-holder\">\r\n <p>$nestedPlaceholderSections</p>\r\n <pre>{{ $nestedPlaceholderSections() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n\r\n\r\n</div>", styles: [".core-form-design-monitor-container .list-wrapper{position:relative}.core-form-design-monitor-container .list-wrapper ul{display:flex;flex:auto;padding:0;margin:0}.core-form-design-monitor-container .list-wrapper ul li{height:34px;width:34px;display:flex;align-items:center;justify-content:center;border:1px solid #848484;cursor:pointer;margin-right:8px;font-size:10px}.core-form-design-monitor-container .list-wrapper ul li.hold{background-color:bisque}.core-form-design-monitor-container .pre-holder{max-height:60%;overflow:auto}\n"], dependencies: [{ kind: "directive", type: TooltipDirective, selector: "[appTooltip]", inputs: ["color", "backgroundColor", "appTooltip", "showAnyway", "position"] }, { kind: "pipe", type: JsonSafePipe, name: "jsonSafe" }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: HtmlTooltipDirective, selector: "[htmlTooltip]", inputs: ["htmlTooltip", "tooltipContext", "maxWidthUnset", "backgroundColor", "hold$"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2571
+ }
2572
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: CoreFormDesignMonitorComponent, decorators: [{
2573
+ type: Component,
2574
+ args: [{ selector: 'core-form-design-monitor', imports: [
2575
+ JsonPipe,
2576
+ TooltipDirective,
2577
+ JsonSafePipe,
2578
+ AsyncPipe,
2579
+ HtmlTooltipDirective,
2580
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"core-form-design-monitor-container\">\r\n <div class=\"list-wrapper\">\r\n <ul>\r\n <li [appTooltip]=\"'Click to view form in the Console'\" [showAnyway]=\"true\" (click)=\"viewFormInConsole()\">\uD83D\uDCE6</li>\r\n <li [appTooltip]=\"'The normalize function called count'\" [showAnyway]=\"true\">{{ normalizeCalledCount$ | async }}</li>\r\n <li [htmlTooltip]=\"controlTemplate\" [hold$]=\"holdControlTemplate$\"\r\n [class.hold]=\"holdControlTemplate$ | async\" (click)=\"toggleHold('controlTemplate')\">CT\r\n </li>\r\n <li [htmlTooltip]=\"nestedControlTemplate\" [hold$]=\"holdNestedControlTemplate$\"\r\n [class.hold]=\"holdNestedControlTemplate$ | async\"\r\n (click)=\"toggleHold('nestedControlTemplate')\">NCT</li>\r\n <li [htmlTooltip]=\"selectedCell\" [hold$]=\"holdSelectedCell$\" [class.hold]=\"holdSelectedCell$ | async\"\r\n (click)=\"toggleHold('selectedCell')\">SC</li>\r\n <li [htmlTooltip]=\"nestedSelectedCell\" [hold$]=\"holdNestedSelectedCell$\"\r\n [class.hold]=\"holdNestedSelectedCell$ | async\" (click)=\"toggleHold('nestedSelectedCell')\">NSC</li>\r\n <li [htmlTooltip]=\"control\" [hold$]=\"holdControl$\" [class.hold]=\"holdControl$ | async\"\r\n (click)=\"toggleHold('control')\">CC</li>\r\n <li [htmlTooltip]=\"nestedControl\" [hold$]=\"holdNestedControl$\"\r\n [class.hold]=\"holdNestedControl$ | async\" (click)=\"toggleHold('nestedControl')\">NCC</li>\r\n <li [htmlTooltip]=\"placeholderSections\" [hold$]=\"holdPlaceholderSections$\"\r\n [class.hold]=\"holdPlaceholderSections$ | async\" (click)=\"toggleHold('placeholderSections')\">PHS</li>\r\n <li [htmlTooltip]=\"nestedPlaceholderSections\" [hold$]=\"holdNestedPlaceholderSections$\"\r\n [class.hold]=\"holdNestedPlaceholderSections$ | async\" (click)=\"toggleHold('nestedPlaceholderSections')\">\r\n NPHS</li>\r\n </ul>\r\n </div>\r\n\r\n <ng-template #controlTemplate>\r\n <div class=\"pre-holder\">\r\n <p>$controlTemplate</p>\r\n <pre>{{ $controlTemplate() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #nestedControlTemplate>\r\n <div class=\"pre-holder\">\r\n <p>$nestedControlTemplate</p>\r\n <pre>{{ $nestedControlTemplate() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #selectedCell>\r\n <div class=\"pre-holder\">\r\n <p>$selectedCell</p>\r\n <pre>{{ $selectedCell() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #nestedSelectedCell>\r\n <div class=\"pre-holder\">\r\n <p>$nestedSelectedCell</p>\r\n <pre>{{ $nestedSelectedCell() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #control>\r\n <div class=\"pre-holder\">\r\n <p>$control</p>\r\n <pre>{{ $control() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #nestedControl>\r\n <div class=\"pre-holder\">\r\n <p>$nestedControl</p>\r\n <pre>{{ $nestedControl() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #placeholderSections>\r\n <div class=\"pre-holder\">\r\n <p>$placeholderSections</p>\r\n <pre>{{ $placeholderSections() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n <ng-template #nestedPlaceholderSections>\r\n <div class=\"pre-holder\">\r\n <p>$nestedPlaceholderSections</p>\r\n <pre>{{ $nestedPlaceholderSections() | jsonSafe }}</pre>\r\n </div>\r\n </ng-template>\r\n\r\n\r\n</div>", styles: [".core-form-design-monitor-container .list-wrapper{position:relative}.core-form-design-monitor-container .list-wrapper ul{display:flex;flex:auto;padding:0;margin:0}.core-form-design-monitor-container .list-wrapper ul li{height:34px;width:34px;display:flex;align-items:center;justify-content:center;border:1px solid #848484;cursor:pointer;margin-right:8px;font-size:10px}.core-form-design-monitor-container .list-wrapper ul li.hold{background-color:bisque}.core-form-design-monitor-container .pre-holder{max-height:60%;overflow:auto}\n"] }]
2581
+ }] });
2582
+
2583
+ class CoreFormArrayLayoutEditorComponent {
2584
+ //placeholderSectionsJson: string = '';
2585
+ constructor() {
2586
+ this.fds = inject(CoreFormDesignService);
2587
+ this.js = inject(JsonService);
2588
+ this.as = inject(AlertService);
2589
+ this.$placeholderSections = this.fds.$placeholderSections;
2590
+ this.$control = this.fds.$control;
2591
+ this.$nestedControl = this.fds.$nestedControl;
2592
+ this.$nestedSimplifiedSections = this.fds.$nestedSimplifiedSections;
2593
+ this.ignoredKeys = [];
2594
+ this.droppedKeys = [];
2595
+ console.log("CoreFormArrayLayoutEditorComponent constructor");
2596
+ /*
2597
+ effect(() => {
2598
+ const placeholderSections = this.coreFormDesignService.$placeholderSections();
2599
+ console.log("🔴 OMG before safeTransform", placeholderSections)
2600
+ const { obj, ignoredKeys, droppedKeys } = this.js.safeTransform(placeholderSections);
2601
+ console.log("🔴 OMG obj in output", obj)
2602
+ this.ignoredKeys = ignoredKeys;
2603
+ this.droppedKeys = droppedKeys;
2604
+ if (droppedKeys.some(x => x.endsWith("validator"))) {
2605
+ if (isDevMode()) {
2606
+ this.as.info("The safeTransform function correctly drops 'validator' key!", alertOptions);
2607
+ }
2608
+ }
2609
+ //this.placeholderSectionsJson = JSON.stringify(obj, null, 2)
2610
+ })
2611
+ */
2612
+ }
2613
+ onClose() {
2614
+ this.fds.$showFormArrayDesign.set(false);
2615
+ }
2616
+ showPlaceholderSectionsInConsole() {
2617
+ console.log("$placeholderSections()", this.fds.$placeholderSections());
2618
+ }
2619
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: CoreFormArrayLayoutEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2620
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: CoreFormArrayLayoutEditorComponent, isStandalone: true, selector: "core-form-array-layout-editor", ngImport: i0, template: "<div class=\"core-form-array-layout-editor-container\">\r\n\r\n <!-- <div class=\"modal-container\">\r\n <div class=\"modal-content-root\"> -->\r\n\r\n <div class=\"layout-header\">\r\n DESIGN FORM ARRAY LAYOUT: {{ $control()?.field }}\r\n <core-form-design-monitor [$mode]=\"'nested'\"></core-form-design-monitor>\r\n <button class=\"btn btn-sm btn-outline-secondary\" (click)=\"onClose()\">\u2716</button>\r\n </div>\r\n\r\n <div class=\"layout-body\">\r\n <div class=\"json-holder\">\r\n <button type=\"button\" class=\"btn btn-sm btn-success\" (click)=\"showPlaceholderSectionsInConsole()\">Show $placeholderSections() in console</button>\r\n <pre>{{ $placeholderSections() | jsonSafe }}</pre>\r\n Ignored keys:\r\n <pre>{{ ignoredKeys | json }}</pre>\r\n DroppedKeys:\r\n <pre>{{ droppedKeys | json }}</pre>\r\n </div>\r\n <div class=\"palete\">\r\n <core-form-array-control-palette />\r\n </div>\r\n <div class=\"sections-holder\">\r\n <core-form-group-editor [$idAsInput]=\"true\" [$isNested]=\"true\"/>\r\n </div>\r\n <div class=\"field-setting-holder\">\r\n <field-setting [$isNested]=\"true\">{{ $nestedControl()?.field }}</field-setting>\r\n </div>\r\n </div>\r\n\r\n <!-- </div>\r\n </div> -->\r\n\r\n</div>", styles: [".core-form-array-layout-editor-container{width:100%;display:flex;flex-direction:column;background-color:#ffebcd}.layout-header{display:flex;justify-content:space-between;align-items:center;padding:15px;height:50px;background:#f7f7f7;border:1px solid #ddd;transform:translate(-15px,-15px);width:calc(100% + 30px);font-size:20px}.layout-body{display:flex;vertical-align:top}.layout-body .json-holder{width:360px;display:inline-block}.layout-body .palete{width:240px;display:inline-block}.layout-body .sections-holder{width:480px;display:inline-block}.layout-body .field-setting-holder{width:360px;display:inline-block}.layout-footer{padding:1rem;border-top:1px solid #ddd;text-align:right}\n"], dependencies: [{ kind: "pipe", type: JsonPipe, name: "json" }, { kind: "pipe", type: JsonSafePipe, name: "jsonSafe" }, { kind: "component", type: CoreFormArrayControlPaletteComponent, selector: "core-form-array-control-palette" }, { kind: "component", type: CoreFormGroupEditorComponent, selector: "core-form-group-editor", inputs: ["$isNested", "$idAsInput", "$id"] }, { kind: "component", type: FieldSettingComponent, selector: "field-setting", inputs: ["$isNested"] }, { kind: "component", type: CoreFormDesignMonitorComponent, selector: "core-form-design-monitor", inputs: ["$mode"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2621
+ }
2622
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: CoreFormArrayLayoutEditorComponent, decorators: [{
2623
+ type: Component,
2624
+ args: [{ selector: 'core-form-array-layout-editor', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
2625
+ JsonPipe,
2626
+ JsonSafePipe,
2627
+ CoreControlNoFormArrayComponent,
2628
+ CoreFormArrayControlPaletteComponent,
2629
+ CoreFormGroupEditorComponent,
2630
+ FieldSettingComponent,
2631
+ CoreFormDesignMonitorComponent
2632
+ ], template: "<div class=\"core-form-array-layout-editor-container\">\r\n\r\n <!-- <div class=\"modal-container\">\r\n <div class=\"modal-content-root\"> -->\r\n\r\n <div class=\"layout-header\">\r\n DESIGN FORM ARRAY LAYOUT: {{ $control()?.field }}\r\n <core-form-design-monitor [$mode]=\"'nested'\"></core-form-design-monitor>\r\n <button class=\"btn btn-sm btn-outline-secondary\" (click)=\"onClose()\">\u2716</button>\r\n </div>\r\n\r\n <div class=\"layout-body\">\r\n <div class=\"json-holder\">\r\n <button type=\"button\" class=\"btn btn-sm btn-success\" (click)=\"showPlaceholderSectionsInConsole()\">Show $placeholderSections() in console</button>\r\n <pre>{{ $placeholderSections() | jsonSafe }}</pre>\r\n Ignored keys:\r\n <pre>{{ ignoredKeys | json }}</pre>\r\n DroppedKeys:\r\n <pre>{{ droppedKeys | json }}</pre>\r\n </div>\r\n <div class=\"palete\">\r\n <core-form-array-control-palette />\r\n </div>\r\n <div class=\"sections-holder\">\r\n <core-form-group-editor [$idAsInput]=\"true\" [$isNested]=\"true\"/>\r\n </div>\r\n <div class=\"field-setting-holder\">\r\n <field-setting [$isNested]=\"true\">{{ $nestedControl()?.field }}</field-setting>\r\n </div>\r\n </div>\r\n\r\n <!-- </div>\r\n </div> -->\r\n\r\n</div>", styles: [".core-form-array-layout-editor-container{width:100%;display:flex;flex-direction:column;background-color:#ffebcd}.layout-header{display:flex;justify-content:space-between;align-items:center;padding:15px;height:50px;background:#f7f7f7;border:1px solid #ddd;transform:translate(-15px,-15px);width:calc(100% + 30px);font-size:20px}.layout-body{display:flex;vertical-align:top}.layout-body .json-holder{width:360px;display:inline-block}.layout-body .palete{width:240px;display:inline-block}.layout-body .sections-holder{width:480px;display:inline-block}.layout-body .field-setting-holder{width:360px;display:inline-block}.layout-footer{padding:1rem;border-top:1px solid #ddd;text-align:right}\n"] }]
2633
+ }], ctorParameters: () => [] });
2634
+
2635
+ class CoreFormDesignComponent extends BaseComponent {
2636
+ constructor(mls) {
2637
+ super(mls);
2638
+ this.mls = mls;
2639
+ this.$idAsInput = input();
2640
+ this.$id = input();
2641
+ this.$settingPanel = viewChild('settingPanel');
2642
+ this.$jsonMode = signal('selectedField');
2643
+ this.injectedFields$ = new BehaviorSubject([]);
2644
+ this.enumType = EnumFormDesignMode;
2645
+ this.enumLeftPanelMode = EnumLeftPanelMode;
2646
+ this.$leftPanelMode = computed(() => {
2647
+ if (this.coreFormDesignService.$fieldSettingPanelOpen()) {
2648
+ return this.enumLeftPanelMode.Json;
2649
+ }
2650
+ else {
2651
+ return this.enumLeftPanelMode.FieldCollection;
2652
+ }
2653
+ });
2654
+ this.ds = inject(DomService);
2655
+ this.js = inject(JsonService);
2656
+ this.$zIndex = computed(() => {
2657
+ if (this.coreFormDesignService.$fieldSettingPanelOpen()) {
2658
+ return this.ds.getMaxZIndex() + 1;
2659
+ }
2660
+ else {
2661
+ return 0;
2662
+ }
2663
+ });
2664
+ this.previewMode$ = new BehaviorSubject(EnumCorePageEditMode.CREATE);
2665
+ this.$loading = signal(false);
2666
+ this.coreFormDesignService = inject(CoreFormDesignService);
2667
+ this.renderer = inject(Renderer2);
2668
+ this.cdr = inject(ChangeDetectorRef);
2669
+ this.router = inject(Router);
2670
+ this.route = inject(ActivatedRoute);
2671
+ this.alertService = inject(AlertService);
2672
+ this.applicationHelpService = inject(ApplicationHelpService);
2673
+ this.wfs = inject(CoreWorkflowService);
2674
+ this.dbs = inject(DbService);
2675
+ this.appConfigService = inject(AppConfigService);
2676
+ this.$hasCalculatedSection = computed(() => {
2677
+ return this.coreFormDesignService.$placeholderSections().some(s => !!s.forCalculatedFields);
2678
+ });
2679
+ this.formDesign = this.coreFormDesignService.formDesign;
2680
+ this.nestedFormDesign = this.coreFormDesignService.nestedFormDesign;
2681
+ this.setControlProp = this.coreFormDesignService.setControlProp.bind(this.coreFormDesignService);
2682
+ this.isDragOverMap = {};
2683
+ this.idStream$ = new BehaviorSubject(undefined);
2684
+ this.getByIdStream$ = this.idStream$.pipe(filter(id => !!id && id !== '0'), distinctUntilChanged(), tap(() => {
2685
+ this.$loading.set(true);
2686
+ this.coreFormDesignService.editMode$.next(EnumCorePageEditMode.UPDATE);
2687
+ this.coreFormDesignService.$submitText.set(EnumTranslateKey.UI_EDIT_FORM_BUTTON_SAVE);
2688
+ }), switchMap(id => {
2689
+ return this.coreFormDesignService.getById(id)
2690
+ .pipe(catchError(err => {
2691
+ this.$loading.set(false);
2692
+ return of(err);
2693
+ }));
2694
+ }));
2695
+ this.form = new FormGroup({
2696
+ stringBox: new FormControl(),
2697
+ timeBox: new FormControl(),
2698
+ email: new FormControl(),
2699
+ textarea: new FormControl(),
2700
+ number: new FormControl(),
2701
+ currency: new FormControl(),
2702
+ dropdown: new FormControl(),
2703
+ employeeSeeker: new FormControl(),
2704
+ checklist: new FormControl(),
2705
+ employeeSeekerMultiple: new FormControl(),
2706
+ datePicker: new FormControl(),
2707
+ monthSelector: new FormControl(),
2708
+ attachment: new FormControl(),
2709
+ attachmentBuffer: new FormControl(),
2710
+ checkbox: new FormControl(),
2711
+ calculated: new FormControl(),
2712
+ formArray: new FormArray([
2713
+ new FormGroup({
2714
+ stringBox: new FormControl('', { nonNullable: true }),
2715
+ }),
2716
+ ])
2717
+ });
2718
+ this.checkError$ = new BehaviorSubject(false);
2719
+ this.controlCategories = [
2720
+ {
2721
+ name: 'Calculated fields',
2722
+ controls: [
2723
+ {
2724
+ flexSize: 12,
2725
+ controlType: EnumFormBaseContolType.CALCULATED,
2726
+ type: 'calculated',
2727
+ field: 'calculated',
2728
+ label: '',
2729
+ value: '',
2730
+ placeholder: 'Calculated',
2731
+ headless: true,
2732
+ }
2733
+ ]
2734
+ },
2735
+ {
2736
+ name: 'Text',
2737
+ controls: [
2738
+ {
2739
+ flexSize: 12,
2740
+ controlType: EnumFormBaseContolType.TEXTBOX,
2741
+ type: 'string',
2742
+ field: 'stringBox',
2743
+ label: '',
2744
+ value: '',
2745
+ placeholder: 'String box',
2746
+ headless: true,
2747
+ },
2748
+ {
2749
+ flexSize: 12,
2750
+ controlType: EnumFormBaseContolType.TEXTBOX,
2751
+ type: 'email',
2752
+ field: 'email',
2753
+ label: '',
2754
+ value: '',
2755
+ placeholder: 'Email',
2756
+ headless: true,
2757
+ },
2758
+ {
2759
+ flexSize: 12,
2760
+ controlType: EnumFormBaseContolType.TEXTAREA,
2761
+ type: 'string',
2762
+ field: 'textarea',
2763
+ label: '',
2764
+ value: '',
2765
+ textareaRows: 2,
2766
+ placeholder: 'Text area',
2767
+ headless: true,
2768
+ }
2769
+ ]
2770
+ },
2771
+ {
2772
+ name: 'Numerical',
2773
+ controls: [
2774
+ {
2775
+ flexSize: 12,
2776
+ controlType: EnumFormBaseContolType.TEXTBOX,
2777
+ type: 'number',
2778
+ field: 'number',
2779
+ label: '',
2780
+ value: 100,
2781
+ placeholder: 'Number',
2782
+ headless: true,
2783
+ },
2784
+ {
2785
+ flexSize: 12,
2786
+ controlType: EnumFormBaseContolType.CURRENCY,
2787
+ type: 'number',
2788
+ field: 'currency',
2789
+ label: '',
2790
+ value: '',
2791
+ placeholder: 'Currency',
2792
+ headless: true,
2793
+ },
2794
+ ]
2795
+ },
2796
+ {
2797
+ name: 'Single selection',
2798
+ controls: [
2799
+ {
2800
+ flexSize: 12,
2801
+ controlType: EnumFormBaseContolType.DROPDOWN,
2802
+ type: 'any',
2803
+ field: 'dropdown',
2804
+ label: '',
2805
+ value: '',
2806
+ dropdownOptions$: new BehaviorSubject([]),
2807
+ shownFrom: 'name',
2808
+ getByIdObject$: new BehaviorSubject({}),
2809
+ placeholder: 'Dropdown',
2810
+ headless: true,
2811
+ },
2812
+ {
2813
+ flexSize: 12,
2814
+ controlType: EnumFormBaseContolType.SEEKER,
2815
+ seekerSourceType: EnumCoreFormControlSeekerSourceType.EMPLOYEE_SEEK,
2816
+ type: 'any[]',
2817
+ field: 'employeeSeeker',
2818
+ label: '',
2819
+ value: ['Nguyễn A'],
2820
+ boundFrom: 'id',
2821
+ shownFrom: 'fullname',
2822
+ getByIdObject$: new BehaviorSubject({}),
2823
+ placeholder: 'Employee seeker',
2824
+ headless: true,
2825
+ }
2826
+ ]
2827
+ },
2828
+ {
2829
+ name: 'Multiple Selection',
2830
+ controls: [
2831
+ // {
2832
+ // flexSize: 12,
2833
+ // controlType: EnumFormBaseContolType.GRIDBUFFER,
2834
+ // type: 'children',
2835
+ // field: 'gridbuffer',
2836
+ // label: '',
2837
+ // value: [],
2838
+ // placeholder: 'Grid buffer',
2839
+ // gridBufferFormSections: [
2840
+ // {
2841
+ // rows: [
2842
+ // [
2843
+ // {
2844
+ // flexSize: 6,
2845
+ // field: 'field1',
2846
+ // type: 'date',
2847
+ // value: '',
2848
+ // controlType: EnumFormBaseContolType.DATEPICKER,
2849
+ // label: 'field 1'
2850
+ // },
2851
+ // {
2852
+ // flexSize: 6,
2853
+ // field: 'field2',
2854
+ // type: 'number',
2855
+ // value: null,
2856
+ // controlType: EnumFormBaseContolType.TEXTBOX,
2857
+ // label: 'field 2'
2858
+ // },
2859
+ // ]
2860
+ // ]
2861
+ // }
2862
+ // ],
2863
+ // gridBufferTableColumns: [
2864
+ // {
2865
+ // caption: 'id',
2866
+ // field: 'id',
2867
+ // hidden: true,
2868
+ // type: 'string',
2869
+ // align: 'left',
2870
+ // width: 0,
2871
+ // },
2872
+ // {
2873
+ // field: 'field1',
2874
+ // width: 200,
2875
+ // caption: 'field 1',
2876
+ // type: 'date',
2877
+ // pipe: EnumCoreTablePipeType.DATE,
2878
+ // align: 'center'
2879
+ // },
2880
+ // {
2881
+ // field: 'field2',
2882
+ // width: 100,
2883
+ // caption: 'field 2',
2884
+ // type: 'number',
2885
+ // align: 'right'
2886
+ // },
2887
+ // ],
2888
+ // headless: true,
2889
+ // tableHeight: 100,
2890
+ // liteMode: true,
2891
+ // },
2892
+ {
2893
+ flexSize: 12,
2894
+ controlType: EnumFormBaseContolType.CHECKLIST,
2895
+ type: 'any[]',
2896
+ field: 'checklist',
2897
+ label: '',
2898
+ value: [],
2899
+ checklistOptions$: new BehaviorSubject([]),
2900
+ shownFrom: 'name',
2901
+ getByIdObject$: new BehaviorSubject({}),
2902
+ placeholder: 'Check list',
2903
+ headless: true,
2904
+ },
2905
+ {
2906
+ flexSize: 12,
2907
+ controlType: EnumFormBaseContolType.SEEKER,
2908
+ seekerSourceType: EnumCoreFormControlSeekerSourceType.EMPLOYEE_SEEK,
2909
+ multiMode: true,
2910
+ type: 'any[]',
2911
+ field: 'employeeSeekerMultiple',
2912
+ label: '',
2913
+ value: [],
2914
+ objectList$: new BehaviorSubject([]),
2915
+ boundFrom: 'id',
2916
+ shownFrom: 'fullname',
2917
+ getByIdObject$: new BehaviorSubject({}),
2918
+ multiModeTableHeight: 100,
2919
+ placeholder: 'Employee seeker (multi mode)',
2920
+ headless: true,
2921
+ }
2922
+ ]
2923
+ },
2924
+ {
2925
+ name: 'Date',
2926
+ controls: [
2927
+ {
2928
+ flexSize: 12,
2929
+ controlType: EnumFormBaseContolType.DATEPICKER,
2930
+ type: 'date',
2931
+ field: 'datePicker',
2932
+ label: '',
2933
+ value: '',
2934
+ placeholder: 'Date picker',
2935
+ showPlaceholder: true,
2936
+ headless: true,
2937
+ },
2938
+ {
2939
+ flexSize: 12,
2940
+ controlType: EnumFormBaseContolType.TEXTBOX,
2941
+ type: 'time',
2942
+ field: 'timeBox',
2943
+ label: '',
2944
+ value: null,
2945
+ placeholder: 'Time box',
2946
+ headless: true,
2947
+ },
2948
+ {
2949
+ flexSize: 12,
2950
+ controlType: EnumFormBaseContolType.MONTHSELECTOR,
2951
+ type: 'string',
2952
+ field: 'monthSelector',
2953
+ label: '',
2954
+ value: '',
2955
+ placeholder: 'Month selector',
2956
+ headless: true,
2957
+ },
2958
+ ]
2959
+ },
2960
+ {
2961
+ name: 'Other',
2962
+ controls: [
2963
+ {
2964
+ flexSize: 12,
2965
+ controlType: EnumFormBaseContolType.ATTACHMENT,
2966
+ type: 'string',
2967
+ field: 'attachment',
2968
+ label: '',
2969
+ value: '',
2970
+ assignTo: 'unknown',
2971
+ placeholder: 'Attachment',
2972
+ headless: true,
2973
+ },
2974
+ {
2975
+ flexSize: 12,
2976
+ controlType: EnumFormBaseContolType.CHECKBOX,
2977
+ type: 'boolean',
2978
+ field: 'checkbox',
2979
+ label: '',
2980
+ value: '',
2981
+ placeholder: 'Checkbox',
2982
+ headless: true,
2983
+ },
2984
+ ]
2985
+ },
2986
+ {
2987
+ name: 'Form Array',
2988
+ controls: [
2989
+ {
2990
+ flexSize: 12,
2991
+ controlType: EnumFormBaseContolType.FORM_ARRAY,
2992
+ type: 'children',
2993
+ field: 'formArray',
2994
+ label: '',
2995
+ value: '',
2996
+ placeholder: 'FormArray',
2997
+ headless: true,
2998
+ formArraySections: [
2999
+ {
3000
+ rows: [
3001
+ [
3002
+ {
3003
+ field: 'stringBox',
3004
+ flexSize: 12,
3005
+ controlType: EnumFormBaseContolType.TEXTBOX,
3006
+ type: 'text',
3007
+ value: '',
3008
+ label: ''
3009
+ }
3010
+ ]
3011
+ ]
3012
+ }
3013
+ ]
3014
+ },
3015
+ ]
3016
+ },
3017
+ ];
3018
+ this.generateFieldNameFor = this.coreFormDesignService.generateFieldNameFor.bind(this.coreFormDesignService);
3019
+ this.generateLabelNameFor = this.coreFormDesignService.generateLabelNameFor.bind(this.coreFormDesignService);
3020
+ this.getAllControlsFromSections = this.coreFormDesignService.getAllControlsFromSections.bind(this.coreFormDesignService);
3021
+ this.getControl = this.coreFormDesignService.getControl.bind(this.coreFormDesignService);
3022
+ this.filteredCells = this.coreFormDesignService.filteredCells;
3023
+ effect(() => {
3024
+ this.idStream$.next(this.$id());
3025
+ });
3026
+ this.applicationHelpService.activeKey$.pipe(distinctUntilChanged()).subscribe(x => {
3027
+ switch (x) {
3028
+ case 'F3':
3029
+ this.coreFormDesignService.$fieldSettingPanelOpen.set(true);
3030
+ break;
3031
+ case 'F6':
3032
+ this.coreFormDesignService.$mode.set(EnumFormDesignMode.Preview);
3033
+ break;
3034
+ case 'Escape':
3035
+ this.coreFormDesignService.$fieldSettingPanelOpen.set(false);
3036
+ this.coreFormDesignService.$mode.set(EnumFormDesignMode.Default);
3037
+ break;
3038
+ }
3039
+ });
3040
+ }
3041
+ ngOnInit() {
3042
+ this.subscriptions.push(this.mls.lang$.subscribe(x => this.lang = x));
3043
+ if (this.appConfigService.WORKFLOW_ENABLE_DEBUG_MODE) {
3044
+ this.injectedFields$.next([
3045
+ {
3046
+ field: '___submitterEmployeeId',
3047
+ flexSize: 12,
3048
+ type: 'number',
3049
+ controlType: EnumFormBaseContolType.SEEKER,
3050
+ seekerSourceType: EnumCoreFormControlSeekerSourceType.EMPLOYEE_SEEK,
3051
+ getByIdApi: '',
3052
+ getByIdObject$: new BehaviorSubject({}),
3053
+ label: 'Simulated Requester',
3054
+ boundFrom: 'id',
3055
+ shownFrom: 'fullname',
3056
+ value: null,
3057
+ },
3058
+ {
3059
+ field: "___reason",
3060
+ type: "text",
3061
+ value: '',
3062
+ label: "UI_FORM_CONTROL_LABEL.REASON",
3063
+ flexSize: 12,
3064
+ controlType: EnumFormBaseContolType.TEXTAREA,
3065
+ textareaRows: 5,
3066
+ validators: [
3067
+ {
3068
+ name: 'required',
3069
+ validator: Validators.required,
3070
+ errorMessage: EnumTranslateKey.UI_FORM_CONTROL_ERROR_REQUIRED
3071
+ }
3072
+ ],
3073
+ }
3074
+ ]);
3075
+ }
3076
+ else {
3077
+ this.injectedFields$.next([
3078
+ {
3079
+ field: "___reason",
3080
+ type: "text",
3081
+ value: '',
3082
+ label: "UI_FORM_CONTROL_LABEL.REASON",
3083
+ flexSize: 12,
3084
+ controlType: EnumFormBaseContolType.TEXTAREA,
3085
+ textareaRows: 5,
3086
+ validators: [
3087
+ {
3088
+ name: 'required',
3089
+ validator: Validators.required,
3090
+ errorMessage: EnumTranslateKey.UI_FORM_CONTROL_ERROR_REQUIRED
3091
+ }
3092
+ ],
3093
+ }
3094
+ ]);
3095
+ }
3096
+ }
3097
+ switchJson() {
3098
+ if (this.$jsonMode() === 'full') {
3099
+ this.$jsonMode.set('selectedField');
3100
+ }
3101
+ else {
3102
+ this.$jsonMode.set('full');
3103
+ }
3104
+ }
3105
+ onDragStart(event, control, isNested) {
3106
+ this.coreFormDesignService.beginDragTemplate(control, isNested);
3107
+ }
3108
+ onDragOver(event, section, control) {
3109
+ event.preventDefault(); // necessary to allow drop
3110
+ if ((!!section.forCalculatedFields && this.coreFormDesignService.$draggingControl()?.type === 'calculated') ||
3111
+ (!section.forCalculatedFields && this.coreFormDesignService.$draggingControl()?.type !== 'calculated')) {
3112
+ event.dataTransfer.dropEffect = 'copy';
3113
+ }
3114
+ else {
3115
+ event.dataTransfer.dropEffect = 'none';
3116
+ }
3117
+ }
3118
+ onDragEnter(placeholderId) {
3119
+ this.isDragOverMap[placeholderId] = true;
3120
+ }
3121
+ onDragLeave(placeholderId) {
3122
+ this.isDragOverMap[placeholderId] = false;
3123
+ }
3124
+ onCorePageHeaderButtonClicked(e) {
3125
+ if (e.code === EnumCoreButtonVNSCode.HEADER_SWITCH_VIEW) {
3126
+ if (this.coreFormDesignService.$mode() === EnumFormDesignMode.Default) {
3127
+ const sections = this.coreFormDesignService.toCoreFormSections(this.coreFormDesignService.$placeholderSections());
3128
+ this.coreFormDesignService.$liveFormSections.set(sections);
3129
+ }
3130
+ setTimeout(() => this.coreFormDesignService.$mode.set(this.coreFormDesignService.$mode() === EnumFormDesignMode.Preview ? EnumFormDesignMode.Default : EnumFormDesignMode.Preview));
3131
+ }
3132
+ else if (e.code === EnumCoreButtonVNSCode.HEADER_SAVE) {
3133
+ }
3134
+ }
3135
+ closePreview() {
3136
+ this.coreFormDesignService.$mode.set(EnumFormDesignMode.Default);
3137
+ }
3138
+ onPreviewSubmit(e) {
3139
+ alert(JSON.stringify(e, null, 2));
3140
+ }
3141
+ ngAfterViewInit() {
3142
+ setTimeout(() => {
3143
+ this.subscriptions.push(this.getByIdStream$.subscribe(x => {
3144
+ this.$loading.set(false);
3145
+ if (x.ok && x.status === 200 && x.body?.statusCode === 200) {
3146
+ console.log("[CoreFormDesignComponent][ngAfterViewInit]: $afInstance is being set inside getByIdStream$ subscription");
3147
+ this.coreFormDesignService.$afInstance.set(this.coreFormDesignService.mapFromAfInstanceDTO(x.body.innerBody));
3148
+ this.coreFormDesignService.syncPlaceholderSectionsFromInstance();
3149
+ this.coreFormDesignService.$shouldPatchMetadataForm.set(true);
3150
+ const saveLiveJson = this.coreFormDesignService.$saveLiveJson();
3151
+ setTimeout(() => this.wfs.$initialFormDesignJson.set(saveLiveJson));
3152
+ }
3153
+ }));
3154
+ if (!this.$idAsInput()) {
3155
+ this.subscriptions.push(this.route.params.subscribe(x => {
3156
+ let id = '0';
3157
+ try {
3158
+ id = atob(x['id']);
3159
+ console.log("[CoreFormDesignComponent][ngAfterViewInit]: $afInstance is being updated inside this.route.params subscription");
3160
+ this.coreFormDesignService.$afInstance.update(instance => ({
3161
+ ...instance,
3162
+ id
3163
+ }));
3164
+ }
3165
+ catch (err) {
3166
+ if (isDevMode()) {
3167
+ this.alertService.error(err.toString(), noneAutoClosedAlertOptions);
3168
+ }
3169
+ return;
3170
+ }
3171
+ this.idStream$.next(id);
3172
+ }));
3173
+ }
3174
+ console.warn('InitialFormDesignJson on load', this.wfs.$initialFormDesignJson());
3175
+ });
3176
+ }
3177
+ onControlParamsChange(updated) {
3178
+ this.coreFormDesignService.$placeholderSections.update(sections => {
3179
+ const cell = this.coreFormDesignService.$selectedCell();
3180
+ if (!cell)
3181
+ return sections;
3182
+ // Patch the selected cell
3183
+ Object.assign(cell.control, updated);
3184
+ return sections;
3185
+ });
3186
+ }
3187
+ get normalizedSelectedControl() {
3188
+ const cell = this.coreFormDesignService.$selectedCell();
3189
+ if (!cell?.control) {
3190
+ throw new Error('No control is currently selected.');
3191
+ }
3192
+ return this.coreFormDesignService.normalize(cell.control);
3193
+ }
3194
+ triggerUpdateSections() {
3195
+ const newValue = this.coreFormDesignService.$placeholderSections();
3196
+ this.coreFormDesignService.$placeholderSections.set([...newValue]);
3197
+ }
3198
+ isRequired(control) {
3199
+ if (!control || !control.validators)
3200
+ return false;
3201
+ return control.validators.some((v) => v.name === 'required' || v.name === 'requiredTrue');
3202
+ }
3203
+ onFormDesignCreated(e) {
3204
+ console.log("onFormDesignCreated", e);
3205
+ }
3206
+ onLiveFormCreated(e) {
3207
+ console.log("onLiveFormCreated", e);
3208
+ }
3209
+ showMetadata() {
3210
+ this.coreFormDesignService.$showFormMetadata.set(true);
3211
+ }
3212
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: CoreFormDesignComponent, deps: [{ token: MultiLanguageService }], target: i0.ɵɵFactoryTarget.Component }); }
3213
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.5", type: CoreFormDesignComponent, isStandalone: true, selector: "core-form-design", inputs: { $idAsInput: { classPropertyName: "$idAsInput", publicName: "$idAsInput", isSignal: true, isRequired: false, transformFunction: null }, $id: { classPropertyName: "$id", publicName: "$id", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "$settingPanel", first: true, predicate: ["settingPanel"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"core-form-design-container fs-13\" [hotKeys]=\"['F3', 'F6', 'Escape']\">\r\n\r\n <core-page-header title=\"UI.COMPONENT_TITLE.WORKFLOW_FORM_DESIGN\" (buttonClick)=\"onCorePageHeaderButtonClicked($event)\"></core-page-header>\r\n \r\n <ng-template #formMetadata>\r\n <form-metadata></form-metadata>\r\n </ng-template>\r\n\r\n <!-- @if (coreFormDesignService.$showFormArrayDesign()) { -->\r\n <div class=\"form-array-layout-editor-wrapper\" [class.open]=\"coreFormDesignService.$showFormArrayDesign()\">\r\n <core-form-array-layout-editor />\r\n </div>\r\n <!-- } -->\r\n\r\n @if (!coreFormDesignService.$isInWorkflowDesign()) {\r\n <aside class=\"af-metadata-overlay\" [@slideFromTopFadeIn]=\"coreFormDesignService.$showFormMetadata() ? 'in' : 'out'\"\r\n [class.shown]=\"coreFormDesignService.$showFormMetadata()\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"formMetadata\"></ng-container>\r\n </aside>\r\n }\r\n\r\n <div \r\n class=\"field-setting-panel\" \r\n [class.open]=\"coreFormDesignService.$fieldSettingPanelOpen()\" \r\n [class.calculated-type]=\"coreFormDesignService.$selectedCell()?.control?.type==='calculated'\"\r\n [ngStyle]=\"{ zIndex: $zIndex() }\"\r\n #settingPanel\r\n >\r\n @if (!!(this.coreFormDesignService.$selectedCell())) {\r\n <field-setting [$isNested]=\"false\"></field-setting>\r\n }\r\n </div>\r\n\r\n <div class=\"form-design-left\">\r\n\r\n @switch ($leftPanelMode()) {\r\n @case (enumLeftPanelMode.FieldCollection) {\r\n @for (category of controlCategories; track $index) {\r\n <div class=\"category-name\">\r\n {{ category.name }}\r\n </div>\r\n <ul>\r\n @for (control of category.controls; track $index) {\r\n <li draggable=\"true\" (dragstart)=\"onDragStart($event, control, false)\" [class.full-width]=\"control.controlType === 'SEEKER' || control.controlType === 'ATTACHMENT' || control.controlType === 'GRIDBUFFER'\">\r\n @if (control.controlType === 'GRIDBUFFER') {\r\n <div class=\"grid-buffer-wrapper\">\r\n <core-control [control]=\"control\" [form]=\"form\" [checkError$]=\"checkError$\"></core-control>\r\n </div>\r\n } @else {\r\n <core-control [control]=\"control\" [form]=\"form\" [checkError$]=\"checkError$\"></core-control>\r\n }\r\n </li>\r\n <div class=\"space\"></div>\r\n }\r\n </ul>\r\n }\r\n }\r\n @case (enumLeftPanelMode.Json) {\r\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"switchJson()\">{{ $jsonMode() }}</button>\r\n @if ($jsonMode()==='selectedField') {\r\n <pre class=\"json-preview\">{{ coreFormDesignService.$controlJson() }}</pre>\r\n } @else {\r\n <pre class=\"json-preview\">{{ coreFormDesignService.$saveLiveJson() }}</pre>\r\n }\r\n \r\n }\r\n }\r\n\r\n </div>\r\n\r\n <div class=\"form-design-right\">\r\n <core-form-design-monitor [$mode]=\"'main'\"></core-form-design-monitor>\r\n <div class=\"h10\"></div>\r\n <core-form-group-editor [$idAsInput]=\"true\" />\r\n </div>\r\n @if ($loading()) {\r\n <core-toast-loading></core-toast-loading>\r\n }\r\n\r\n <ng-template #calculatedFieldsTooltip>\r\n <div style=\"max-width: 280px;\">\r\n <strong>Calculated Fields</strong><br />\r\n <p></p>\r\n These fields are hidden from the form and cannot be edited directly.<br /><br />\r\n - They are computed automatically during workflow execution.<br />\r\n - Each field depends on one or more standard input fields.<br />\r\n - The calculation is evaluated using either an SQL query engine (like <strong>Dapper</strong>) or an in-memory expression engine (like <strong>Dynamic Expresso</strong>).<br /><br />\r\n In both cases, the result is a <code>0</code> or <code>1</code>, representing <strong>false</strong> or <strong>true</strong>.<br /><br />\r\n These results can be used to influence workflow logic, rule trees, or approval paths.\r\n </div>\r\n </ng-template>\r\n \r\n</div>", styles: ["@charset \"UTF-8\";.core-form-design-container{position:relative;height:calc(100vh - var(--size-header-height) - var(--size-layout-block-cell-spacing));width:100%;overflow:hidden;background-color:#eff0f1;font-size:13px}.core-form-design-container .form-array-layout-editor-wrapper{position:fixed;top:10vh;right:-100%;width:1420px;height:80vh;z-index:99;transition:right .25s ease-out;background-color:#ffebcd;overflow:auto;padding:15px;box-shadow:.4rem 0 2rem #0000002e}.core-form-design-container .form-array-layout-editor-wrapper.open{right:calc((100% - 1420px)/2)}.core-form-design-container .core-button-vns-container{margin-right:8px!important}.core-form-design-container .core-button-vns-container:last-child{background-color:#000;color:#fff;margin-right:0}.core-form-design-container .af-metadata-overlay{position:fixed;top:60px;left:66px;background:#fff;box-shadow:.4rem 0 2rem #0000002e;z-index:1000;width:1214px;height:calc(100vh - 75px);overflow-y:auto;pointer-events:none}.core-form-design-container .af-metadata-overlay.shown{pointer-events:auto}.core-form-design-container *{border-radius:0}.core-form-design-container ul,.core-form-design-container li{padding:0}.core-form-design-container li{max-width:200px}.core-form-design-container ul div.space{display:block;height:15px}.core-form-design-container li.full-width{max-width:100%}.core-form-design-container .field-setting-panel{display:block;position:fixed;width:360px;height:100vh;top:0;right:-360px;background-color:#fff;box-shadow:.4rem 0 2rem #0000002e;transition:right .5s ease-out}.core-form-design-container .field-setting-panel .close-wrapper{width:32px;height:32px;position:absolute;top:15px;right:15px;display:flex;background-color:#848484;border-radius:50%}.core-form-design-container .field-setting-panel .close-wrapper i{width:16px;height:16px;font-size:18px;color:#848484}.core-form-design-container .field-setting-panel .panel-caption{margin-bottom:1rem;padding-bottom:.5rem;border-bottom:1px solid #ddd;width:100%;overflow:hidden;text-wrap:nowrap;text-overflow:ellipsis}.core-form-design-container .field-setting-panel.calculated-type{width:500px;right:-500px}.core-form-design-container .field-setting-panel.calculated-type textarea{border-radius:8px;height:150px}.core-form-design-container .field-setting-panel.open{right:0}.core-form-design-container .form-design-left{position:absolute;top:var(--size-core-page-header-height);bottom:0;left:0;z-index:1;width:360px;height:calc(100vh - var(--size-header-height) - var(--size-layout-block-cell-spacing));padding:15px;padding-right:calc(15px + var(--size-scrollbar-width));background-color:#87ceeb;overflow-y:hidden}.core-form-design-container .form-design-left .category-name{color:#fff}.core-form-design-container .form-design-left .grid-buffer-wrapper{background-color:#fff;padding:15px}.core-form-design-container .form-design-left ul:last-child{padding-bottom:400px}.core-form-design-container .form-design-left .category-name{margin-bottom:15px}.core-form-design-container .form-design-left .json-preview{background-color:#fff;color:#333;padding:1rem 1.5rem;box-shadow:0 2px 6px #00000014;font-family:Fira Code,monospace;font-size:.85rem;word-break:keep-all;overflow-x:auto;line-height:1.5;width:330px;height:calc(100vh - 205px)}.core-form-design-container .form-design-left button{height:35px;border-radius:0;margin-bottom:15px;color:#fff;border:none;font-size:13px;background-color:transparent}.core-form-design-container .form-design-left:hover{overflow-y:auto;padding-right:15px}.core-form-design-container .form-design-right{width:100%;height:calc(100vh - var(--size-header-height) - var(--size-layout-block-cell-spacing));padding:15px 15px 15px 375px;overflow-y:auto}.core-form-design-container .form-design-right .h10{height:10px}.core-form-design-container .form-design-right .form-wrapper{width:100%;overflow-y:visible;background-color:#fff}.core-form-design-container .form-design-right .form-wrapper button{margin-left:12px;padding:4px 10px;border:1px solid #ccc;cursor:pointer;transition:all .2s;width:110px}.core-form-design-container .form-design-right .form-wrapper button:hover{background-color:#e4f0ff;border-color:#007bff;color:#007bff}.core-form-design-container .form-design-right .form-wrapper .form-tool-bar{display:flex;align-items:center;justify-content:flex-end}.core-form-design-container .form-design-right .form-wrapper .form-tool-bar>button{width:150px;margin:0}.core-form-design-container .form-design-right .form-wrapper .form-cells{display:flex;flex-direction:column;gap:32px;padding:20px 15px 15px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder{padding:12px 15px;border:1px dashed #ccc;background-color:#fff;box-shadow:0 2px 6px #0000000a}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header{display:flex;position:relative;align-items:center;justify-content:flex-start;font-weight:600;margin-bottom:12px;color:#333}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-img{width:34px;height:34px;border-radius:50%;background-color:#d3d3d3;float:left;background-image:url(/assets/images/info.svg);background-repeat:no-repeat;background-position:center;margin-right:8px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-img.calculated{background-image:url(/assets/images/sql-icon.svg);background-color:transparent;border-radius:0}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-tool{position:absolute;right:5px;top:6px;display:none;z-index:2;color:gray}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-tool i{font-size:24px;color:#848484}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header:hover .section-tool{display:block}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .row-tool-bar{display:flex;align-items:center;justify-content:flex-end;margin-bottom:8px;height:24px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-row{display:flex;gap:15px;margin-bottom:15px;min-height:50px;background-color:#d3d3d3;padding:8px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell{flex:1;min-height:90px;background-color:#fcfcfc;border:1px dashed #ccc;position:relative;padding:20px 10px 10px;transition:border .2s ease-in-out}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell:before{content:attr(data-flex);position:absolute;top:2px;left:4px;font-size:10px;color:#999}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell label.required:after{content:\" *\";color:#ff040b}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar{position:absolute;right:7px;top:6px;display:none;z-index:2;color:gray}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar ul{display:flex}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar ul li div{display:flex;width:24px;height:24px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar ul li div i{font-size:18px;width:18px;height:18px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell.has-control:hover .field-toolbar{display:flex}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell.active-drop{border-color:#007bff;background-color:#eef6ff;transition:.2s}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .placeholder{display:flex;align-items:center;justify-content:center;background-color:#fff;color:#007bff;padding:15px 0;width:100%;cursor:default}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .placeholder.calculated{color:#ff4500}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .icon-wrapper{width:24px;height:24px;border-radius:50%;padding:0;cursor:pointer;display:none;color:gray;border:1px solid gray;margin-left:8px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .icon-wrapper i{font-size:18px;width:18px;height:18px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper:hover .icon-wrapper{display:flex}.core-form-design-container .form-design-right .form-wrapper .form-cell.selected{background-color:#dff6dd}.core-form-design-container .form-design-right .form-wrapper .merge-toolbar{text-align:center;margin-top:4px}.core-form-design-container .form-design-right .form-wrapper.live-form{padding-bottom:15px}.core-form-design-container .form-design-right .form-wrapper.live-form .live-form-header{padding:0 15px}.core-form-design-container .form-design-right .form-wrapper.live-form .live-form-header .preview-close-icon{position:absolute;right:7px;top:6px;z-index:2;color:gray;cursor:pointer}.core-form-design-container .form-design-right .form-wrapper.live-form .live-form-header .preview-close-icon i{font-size:18px}.core-form-design-container .drop-target{min-height:50px;min-width:50px;border:2px dashed transparent;transition:border .2s ease}.core-form-design-container .drop-target.active-drop{border-color:#007bff;background-color:#eaf4ff}.core-form-design-container .no-padding{padding:0!important}.core-form-design-container .modal-content-root{overflow:visible}\n", ".core-form-container{overflow-x:visible}.core-form-container>form .section{margin-top:var(--size-layout-block-cell-spacing)}.core-form-container>form .section:not(:first-child){margin-top:calc(var(--size-layout-block-cell-spacing) * 2)}.core-form-container>form .section .section-header-label{display:block;height:34px;line-height:34px;margin-bottom:15px;margin-left:12px}.core-form-container>form .section .section-header-label .section-img-wrapper{position:relative}.core-form-container>form .section .section-header-label .section-img-wrapper .section-img{position:absolute;width:34px;height:34px;border-radius:50%;background-color:#d3d3d3;float:left;background-image:url(/assets/images/info.svg);background-repeat:no-repeat;background-position:center}.core-form-container>form .section .section-header-label .section-img-wrapper .section-img.calculated{background-image:url(/assets/images/sql-icon.svg);border-radius:0;background-color:transparent}.core-form-container>form .section .section-header-label .section-calc-wrapper{width:34px;height:34px;display:flex;align-items:center;justify-content:center;background-color:#d3d3d3;border-radius:50%}.core-form-container>form .section .section-header-label .section-calc-wrapper i{width:24px;height:24px;font-size:24px;color:#1b4332}.core-form-container>form .section .section-header-label .section-caption{padding-left:40px;font-weight:700;color:#696969}.core-form-container .row{margin-left:var(--size-layout-block-cell-spacing) 0px;margin-right:var(--size-layout-block-cell-spacing) 0px}.core-form-container .row .grid-buffer{border:dotted 2px darkgray}.core-form-container .row .button-control{display:flex;align-items:flex-end}.core-form-container .form-row{margin:var(--size-layout-block-cell-spacing) 0px;display:flex;align-items:center;justify-content:center}.core-form-container .form-row>button{cursor:pointer;border-radius:0}.core-form-container .form-row>button:not(:first-child){margin-left:var(--size-layout-block-cell-spacing)}.core-form-container .dev-button{cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:13px;padding:8px;width:120px;border-radius:18px;box-shadow:.4rem 0 2rem #0000002e}.core-form-container .dev-button:not(:last-child){margin-right:15px}.core-form-container .dev-button:first-child{background-color:#dff6dd;border:1px #9fdc9d solid}.core-form-container .dev-button:last-child{background-color:#fff4ce;border:1px #ffda6a solid}.core-form-container .payload-preview{display:block;width:calc(100% - 48px);height:200px;white-space:pre-wrap;overflow-x:hidden;overflow-y:auto;background-color:#dff6dd;padding:24px;margin:24px;text-indent:-58px;color:#333!important;font-family:Fira Code,monospace;font-size:.85rem;word-break:keep-all;line-height:1.5}.core-form-container .payload-preview.validator-preview{background-color:#fff4ce}.core-form-container .bottom-template-wrapper{padding-left:12px;padding-right:12px}.core-form-container .w-100{width:100%}.core-form-container .pr18{padding-right:18px}\n", ".core-button-vns-container{height:30px;display:flex;align-items:center;justify-content:center;min-width:30px}.core-button-vns-container .action-wrapper{height:30px!important;width:30px!important;display:flex;align-items:center;justify-content:center}.core-button-vns-container .action-wrapper:has(i:hover){background-color:#e7e7e7;border-radius:50%}.core-button-vns-container .btn-for-form{border:none;border-radius:0;background-color:transparent;color:#000;min-width:120px}.core-button-vns-container button.last-child{background-color:#000;color:#fff}.core-button-vns-container .action-wrapper.last-child{background-color:var(--color-basic-orange);color:#fff;border-radius:50%}.core-button-vns-container .action-wrapper.last-child:hover{background-color:var(--color-basic-orange);box-shadow:0 1rem 3rem #0000002e}.core-button-vns-container .temporary-unavailable{user-select:none;-moz-user-select:none;-webkit-user-select:none;cursor:not-allowed!important;opacity:.5}.core-button-vns-container .temporary-unavailable:hover{background-color:transparent!important}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CoreFormDesignMonitorComponent, selector: "core-form-design-monitor", inputs: ["$mode"] }, { kind: "component", type: CoreFormGroupEditorComponent, selector: "core-form-group-editor", inputs: ["$isNested", "$idAsInput", "$id"] }, { kind: "component", type: CoreFormArrayLayoutEditorComponent, selector: "core-form-array-layout-editor" }, { kind: "component", type: CoreToastLoadingComponent, selector: "core-toast-loading" }, { kind: "component", type: CorePageHeaderComponent, selector: "core-page-header", inputs: ["instanceNumber", "shownItems", "title", "hideButtonGroup", "htmlTooltipRef"], outputs: ["buttonClick"] }, { kind: "component", type: FormMetadataComponent, selector: "form-metadata" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: HotKeysDirective, selector: "[hotKeys]", inputs: ["hotKeys"] }, { kind: "component", type: CoreControlComponent, selector: "core-control", inputs: ["control", "form", "checkError$", "rangeLimit"] }, { kind: "component", type: FieldSettingComponent, selector: "field-setting", inputs: ["$isNested"] }], animations: [slideFromTopFadeIn], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3214
+ }
3215
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: CoreFormDesignComponent, decorators: [{
3216
+ type: Component,
3217
+ args: [{ selector: 'core-form-design', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
3218
+ NgStyle,
3219
+ AsyncPipe,
3220
+ NgTemplateOutlet,
3221
+ CoreFormDesignMonitorComponent,
3222
+ CoreFormGroupEditorComponent,
3223
+ CoreFormArrayLayoutEditorComponent,
3224
+ CoreToastLoadingComponent,
3225
+ CorePageHeaderComponent,
3226
+ FormMetadataComponent,
3227
+ ReactiveFormsModule,
3228
+ TranslatePipe,
3229
+ TableCellPipe,
3230
+ TooltipDirective,
3231
+ HotKeysDirective,
3232
+ CoreFormComponent,
3233
+ CoreControlComponent,
3234
+ CoreDropdownComponent,
3235
+ CoreChecklistComponent,
3236
+ CoreFormControlSeekerComponent,
3237
+ CoreCheckboxComponent,
3238
+ CoreAttachmentComponent,
3239
+ CoreDatePickerComponent,
3240
+ CoreRadioGroupComponent,
3241
+ CoreMonthSelectorComponent,
3242
+ TooltipDirective,
3243
+ CoreCurrencyInputComponent,
3244
+ FieldSettingComponent,
3245
+ LiveFormComponent,
3246
+ HtmlTooltipDirective,
3247
+ ], animations: [slideFromTopFadeIn], template: "<div class=\"core-form-design-container fs-13\" [hotKeys]=\"['F3', 'F6', 'Escape']\">\r\n\r\n <core-page-header title=\"UI.COMPONENT_TITLE.WORKFLOW_FORM_DESIGN\" (buttonClick)=\"onCorePageHeaderButtonClicked($event)\"></core-page-header>\r\n \r\n <ng-template #formMetadata>\r\n <form-metadata></form-metadata>\r\n </ng-template>\r\n\r\n <!-- @if (coreFormDesignService.$showFormArrayDesign()) { -->\r\n <div class=\"form-array-layout-editor-wrapper\" [class.open]=\"coreFormDesignService.$showFormArrayDesign()\">\r\n <core-form-array-layout-editor />\r\n </div>\r\n <!-- } -->\r\n\r\n @if (!coreFormDesignService.$isInWorkflowDesign()) {\r\n <aside class=\"af-metadata-overlay\" [@slideFromTopFadeIn]=\"coreFormDesignService.$showFormMetadata() ? 'in' : 'out'\"\r\n [class.shown]=\"coreFormDesignService.$showFormMetadata()\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"formMetadata\"></ng-container>\r\n </aside>\r\n }\r\n\r\n <div \r\n class=\"field-setting-panel\" \r\n [class.open]=\"coreFormDesignService.$fieldSettingPanelOpen()\" \r\n [class.calculated-type]=\"coreFormDesignService.$selectedCell()?.control?.type==='calculated'\"\r\n [ngStyle]=\"{ zIndex: $zIndex() }\"\r\n #settingPanel\r\n >\r\n @if (!!(this.coreFormDesignService.$selectedCell())) {\r\n <field-setting [$isNested]=\"false\"></field-setting>\r\n }\r\n </div>\r\n\r\n <div class=\"form-design-left\">\r\n\r\n @switch ($leftPanelMode()) {\r\n @case (enumLeftPanelMode.FieldCollection) {\r\n @for (category of controlCategories; track $index) {\r\n <div class=\"category-name\">\r\n {{ category.name }}\r\n </div>\r\n <ul>\r\n @for (control of category.controls; track $index) {\r\n <li draggable=\"true\" (dragstart)=\"onDragStart($event, control, false)\" [class.full-width]=\"control.controlType === 'SEEKER' || control.controlType === 'ATTACHMENT' || control.controlType === 'GRIDBUFFER'\">\r\n @if (control.controlType === 'GRIDBUFFER') {\r\n <div class=\"grid-buffer-wrapper\">\r\n <core-control [control]=\"control\" [form]=\"form\" [checkError$]=\"checkError$\"></core-control>\r\n </div>\r\n } @else {\r\n <core-control [control]=\"control\" [form]=\"form\" [checkError$]=\"checkError$\"></core-control>\r\n }\r\n </li>\r\n <div class=\"space\"></div>\r\n }\r\n </ul>\r\n }\r\n }\r\n @case (enumLeftPanelMode.Json) {\r\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"switchJson()\">{{ $jsonMode() }}</button>\r\n @if ($jsonMode()==='selectedField') {\r\n <pre class=\"json-preview\">{{ coreFormDesignService.$controlJson() }}</pre>\r\n } @else {\r\n <pre class=\"json-preview\">{{ coreFormDesignService.$saveLiveJson() }}</pre>\r\n }\r\n \r\n }\r\n }\r\n\r\n </div>\r\n\r\n <div class=\"form-design-right\">\r\n <core-form-design-monitor [$mode]=\"'main'\"></core-form-design-monitor>\r\n <div class=\"h10\"></div>\r\n <core-form-group-editor [$idAsInput]=\"true\" />\r\n </div>\r\n @if ($loading()) {\r\n <core-toast-loading></core-toast-loading>\r\n }\r\n\r\n <ng-template #calculatedFieldsTooltip>\r\n <div style=\"max-width: 280px;\">\r\n <strong>Calculated Fields</strong><br />\r\n <p></p>\r\n These fields are hidden from the form and cannot be edited directly.<br /><br />\r\n - They are computed automatically during workflow execution.<br />\r\n - Each field depends on one or more standard input fields.<br />\r\n - The calculation is evaluated using either an SQL query engine (like <strong>Dapper</strong>) or an in-memory expression engine (like <strong>Dynamic Expresso</strong>).<br /><br />\r\n In both cases, the result is a <code>0</code> or <code>1</code>, representing <strong>false</strong> or <strong>true</strong>.<br /><br />\r\n These results can be used to influence workflow logic, rule trees, or approval paths.\r\n </div>\r\n </ng-template>\r\n \r\n</div>", styles: ["@charset \"UTF-8\";.core-form-design-container{position:relative;height:calc(100vh - var(--size-header-height) - var(--size-layout-block-cell-spacing));width:100%;overflow:hidden;background-color:#eff0f1;font-size:13px}.core-form-design-container .form-array-layout-editor-wrapper{position:fixed;top:10vh;right:-100%;width:1420px;height:80vh;z-index:99;transition:right .25s ease-out;background-color:#ffebcd;overflow:auto;padding:15px;box-shadow:.4rem 0 2rem #0000002e}.core-form-design-container .form-array-layout-editor-wrapper.open{right:calc((100% - 1420px)/2)}.core-form-design-container .core-button-vns-container{margin-right:8px!important}.core-form-design-container .core-button-vns-container:last-child{background-color:#000;color:#fff;margin-right:0}.core-form-design-container .af-metadata-overlay{position:fixed;top:60px;left:66px;background:#fff;box-shadow:.4rem 0 2rem #0000002e;z-index:1000;width:1214px;height:calc(100vh - 75px);overflow-y:auto;pointer-events:none}.core-form-design-container .af-metadata-overlay.shown{pointer-events:auto}.core-form-design-container *{border-radius:0}.core-form-design-container ul,.core-form-design-container li{padding:0}.core-form-design-container li{max-width:200px}.core-form-design-container ul div.space{display:block;height:15px}.core-form-design-container li.full-width{max-width:100%}.core-form-design-container .field-setting-panel{display:block;position:fixed;width:360px;height:100vh;top:0;right:-360px;background-color:#fff;box-shadow:.4rem 0 2rem #0000002e;transition:right .5s ease-out}.core-form-design-container .field-setting-panel .close-wrapper{width:32px;height:32px;position:absolute;top:15px;right:15px;display:flex;background-color:#848484;border-radius:50%}.core-form-design-container .field-setting-panel .close-wrapper i{width:16px;height:16px;font-size:18px;color:#848484}.core-form-design-container .field-setting-panel .panel-caption{margin-bottom:1rem;padding-bottom:.5rem;border-bottom:1px solid #ddd;width:100%;overflow:hidden;text-wrap:nowrap;text-overflow:ellipsis}.core-form-design-container .field-setting-panel.calculated-type{width:500px;right:-500px}.core-form-design-container .field-setting-panel.calculated-type textarea{border-radius:8px;height:150px}.core-form-design-container .field-setting-panel.open{right:0}.core-form-design-container .form-design-left{position:absolute;top:var(--size-core-page-header-height);bottom:0;left:0;z-index:1;width:360px;height:calc(100vh - var(--size-header-height) - var(--size-layout-block-cell-spacing));padding:15px;padding-right:calc(15px + var(--size-scrollbar-width));background-color:#87ceeb;overflow-y:hidden}.core-form-design-container .form-design-left .category-name{color:#fff}.core-form-design-container .form-design-left .grid-buffer-wrapper{background-color:#fff;padding:15px}.core-form-design-container .form-design-left ul:last-child{padding-bottom:400px}.core-form-design-container .form-design-left .category-name{margin-bottom:15px}.core-form-design-container .form-design-left .json-preview{background-color:#fff;color:#333;padding:1rem 1.5rem;box-shadow:0 2px 6px #00000014;font-family:Fira Code,monospace;font-size:.85rem;word-break:keep-all;overflow-x:auto;line-height:1.5;width:330px;height:calc(100vh - 205px)}.core-form-design-container .form-design-left button{height:35px;border-radius:0;margin-bottom:15px;color:#fff;border:none;font-size:13px;background-color:transparent}.core-form-design-container .form-design-left:hover{overflow-y:auto;padding-right:15px}.core-form-design-container .form-design-right{width:100%;height:calc(100vh - var(--size-header-height) - var(--size-layout-block-cell-spacing));padding:15px 15px 15px 375px;overflow-y:auto}.core-form-design-container .form-design-right .h10{height:10px}.core-form-design-container .form-design-right .form-wrapper{width:100%;overflow-y:visible;background-color:#fff}.core-form-design-container .form-design-right .form-wrapper button{margin-left:12px;padding:4px 10px;border:1px solid #ccc;cursor:pointer;transition:all .2s;width:110px}.core-form-design-container .form-design-right .form-wrapper button:hover{background-color:#e4f0ff;border-color:#007bff;color:#007bff}.core-form-design-container .form-design-right .form-wrapper .form-tool-bar{display:flex;align-items:center;justify-content:flex-end}.core-form-design-container .form-design-right .form-wrapper .form-tool-bar>button{width:150px;margin:0}.core-form-design-container .form-design-right .form-wrapper .form-cells{display:flex;flex-direction:column;gap:32px;padding:20px 15px 15px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder{padding:12px 15px;border:1px dashed #ccc;background-color:#fff;box-shadow:0 2px 6px #0000000a}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header{display:flex;position:relative;align-items:center;justify-content:flex-start;font-weight:600;margin-bottom:12px;color:#333}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-img{width:34px;height:34px;border-radius:50%;background-color:#d3d3d3;float:left;background-image:url(/assets/images/info.svg);background-repeat:no-repeat;background-position:center;margin-right:8px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-img.calculated{background-image:url(/assets/images/sql-icon.svg);background-color:transparent;border-radius:0}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-tool{position:absolute;right:5px;top:6px;display:none;z-index:2;color:gray}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header .section-tool i{font-size:24px;color:#848484}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-section-placeholder .section-header:hover .section-tool{display:block}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .row-tool-bar{display:flex;align-items:center;justify-content:flex-end;margin-bottom:8px;height:24px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-row{display:flex;gap:15px;margin-bottom:15px;min-height:50px;background-color:#d3d3d3;padding:8px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell{flex:1;min-height:90px;background-color:#fcfcfc;border:1px dashed #ccc;position:relative;padding:20px 10px 10px;transition:border .2s ease-in-out}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell:before{content:attr(data-flex);position:absolute;top:2px;left:4px;font-size:10px;color:#999}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell label.required:after{content:\" *\";color:#ff040b}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar{position:absolute;right:7px;top:6px;display:none;z-index:2;color:gray}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar ul{display:flex}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar ul li div{display:flex;width:24px;height:24px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell .field-toolbar ul li div i{font-size:18px;width:18px;height:18px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell.has-control:hover .field-toolbar{display:flex}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .form-cell.active-drop{border-color:#007bff;background-color:#eef6ff;transition:.2s}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .placeholder{display:flex;align-items:center;justify-content:center;background-color:#fff;color:#007bff;padding:15px 0;width:100%;cursor:default}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .placeholder.calculated{color:#ff4500}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .icon-wrapper{width:24px;height:24px;border-radius:50%;padding:0;cursor:pointer;display:none;color:gray;border:1px solid gray;margin-left:8px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper .icon-wrapper i{font-size:18px;width:18px;height:18px}.core-form-design-container .form-design-right .form-wrapper .form-cells .form-row-wrapper:hover .icon-wrapper{display:flex}.core-form-design-container .form-design-right .form-wrapper .form-cell.selected{background-color:#dff6dd}.core-form-design-container .form-design-right .form-wrapper .merge-toolbar{text-align:center;margin-top:4px}.core-form-design-container .form-design-right .form-wrapper.live-form{padding-bottom:15px}.core-form-design-container .form-design-right .form-wrapper.live-form .live-form-header{padding:0 15px}.core-form-design-container .form-design-right .form-wrapper.live-form .live-form-header .preview-close-icon{position:absolute;right:7px;top:6px;z-index:2;color:gray;cursor:pointer}.core-form-design-container .form-design-right .form-wrapper.live-form .live-form-header .preview-close-icon i{font-size:18px}.core-form-design-container .drop-target{min-height:50px;min-width:50px;border:2px dashed transparent;transition:border .2s ease}.core-form-design-container .drop-target.active-drop{border-color:#007bff;background-color:#eaf4ff}.core-form-design-container .no-padding{padding:0!important}.core-form-design-container .modal-content-root{overflow:visible}\n", ".core-form-container{overflow-x:visible}.core-form-container>form .section{margin-top:var(--size-layout-block-cell-spacing)}.core-form-container>form .section:not(:first-child){margin-top:calc(var(--size-layout-block-cell-spacing) * 2)}.core-form-container>form .section .section-header-label{display:block;height:34px;line-height:34px;margin-bottom:15px;margin-left:12px}.core-form-container>form .section .section-header-label .section-img-wrapper{position:relative}.core-form-container>form .section .section-header-label .section-img-wrapper .section-img{position:absolute;width:34px;height:34px;border-radius:50%;background-color:#d3d3d3;float:left;background-image:url(/assets/images/info.svg);background-repeat:no-repeat;background-position:center}.core-form-container>form .section .section-header-label .section-img-wrapper .section-img.calculated{background-image:url(/assets/images/sql-icon.svg);border-radius:0;background-color:transparent}.core-form-container>form .section .section-header-label .section-calc-wrapper{width:34px;height:34px;display:flex;align-items:center;justify-content:center;background-color:#d3d3d3;border-radius:50%}.core-form-container>form .section .section-header-label .section-calc-wrapper i{width:24px;height:24px;font-size:24px;color:#1b4332}.core-form-container>form .section .section-header-label .section-caption{padding-left:40px;font-weight:700;color:#696969}.core-form-container .row{margin-left:var(--size-layout-block-cell-spacing) 0px;margin-right:var(--size-layout-block-cell-spacing) 0px}.core-form-container .row .grid-buffer{border:dotted 2px darkgray}.core-form-container .row .button-control{display:flex;align-items:flex-end}.core-form-container .form-row{margin:var(--size-layout-block-cell-spacing) 0px;display:flex;align-items:center;justify-content:center}.core-form-container .form-row>button{cursor:pointer;border-radius:0}.core-form-container .form-row>button:not(:first-child){margin-left:var(--size-layout-block-cell-spacing)}.core-form-container .dev-button{cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:13px;padding:8px;width:120px;border-radius:18px;box-shadow:.4rem 0 2rem #0000002e}.core-form-container .dev-button:not(:last-child){margin-right:15px}.core-form-container .dev-button:first-child{background-color:#dff6dd;border:1px #9fdc9d solid}.core-form-container .dev-button:last-child{background-color:#fff4ce;border:1px #ffda6a solid}.core-form-container .payload-preview{display:block;width:calc(100% - 48px);height:200px;white-space:pre-wrap;overflow-x:hidden;overflow-y:auto;background-color:#dff6dd;padding:24px;margin:24px;text-indent:-58px;color:#333!important;font-family:Fira Code,monospace;font-size:.85rem;word-break:keep-all;line-height:1.5}.core-form-container .payload-preview.validator-preview{background-color:#fff4ce}.core-form-container .bottom-template-wrapper{padding-left:12px;padding-right:12px}.core-form-container .w-100{width:100%}.core-form-container .pr18{padding-right:18px}\n", ".core-button-vns-container{height:30px;display:flex;align-items:center;justify-content:center;min-width:30px}.core-button-vns-container .action-wrapper{height:30px!important;width:30px!important;display:flex;align-items:center;justify-content:center}.core-button-vns-container .action-wrapper:has(i:hover){background-color:#e7e7e7;border-radius:50%}.core-button-vns-container .btn-for-form{border:none;border-radius:0;background-color:transparent;color:#000;min-width:120px}.core-button-vns-container button.last-child{background-color:#000;color:#fff}.core-button-vns-container .action-wrapper.last-child{background-color:var(--color-basic-orange);color:#fff;border-radius:50%}.core-button-vns-container .action-wrapper.last-child:hover{background-color:var(--color-basic-orange);box-shadow:0 1rem 3rem #0000002e}.core-button-vns-container .temporary-unavailable{user-select:none;-moz-user-select:none;-webkit-user-select:none;cursor:not-allowed!important;opacity:.5}.core-button-vns-container .temporary-unavailable:hover{background-color:transparent!important}\n"] }]
3248
+ }], ctorParameters: () => [{ type: MultiLanguageService }] });
3249
+
3250
+ var coreFormDesign_component = /*#__PURE__*/Object.freeze({
3251
+ __proto__: null,
3252
+ CoreFormDesignComponent: CoreFormDesignComponent
3253
+ });
3254
+
3255
+ export { BasePropsComponent as B, CoreFormDesignComponent as C, coreFormDesign_component as c };
3256
+ //# sourceMappingURL=ngx-histaff-alpha-core-form-design.component-C_yKnqtf.mjs.map