fx-form-builder-wrapper 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/fx-form-builder-wrapper.mjs +5 -0
- package/esm2022/lib/components/dynamic-table/dynamic-table.component.mjs +184 -0
- package/esm2022/lib/components/fx-form-component/fx-form-component.component.mjs +85 -0
- package/esm2022/lib/components/toggle/toggle.component.mjs +33 -0
- package/esm2022/lib/components/toggle-button/toggle-button.component.mjs +38 -0
- package/esm2022/lib/components/uploader/uploader.component.mjs +58 -0
- package/esm2022/lib/custom-controls/dispatch-to-clinic/dispatch-to-clinic.component.mjs +42 -0
- package/esm2022/lib/fx-builder-wrapper.component.mjs +76 -0
- package/esm2022/lib/fx-builder-wrapper.service.mjs +40 -0
- package/esm2022/lib/panel/configuration-panel/configuration-panel.component.mjs +89 -0
- package/esm2022/lib/panel/settings-panel/settings-panel.component.mjs +24 -0
- package/esm2022/public-api.mjs +7 -0
- package/fesm2022/fx-form-builder-wrapper.mjs +615 -0
- package/fesm2022/fx-form-builder-wrapper.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/dynamic-table/dynamic-table.component.d.ts +51 -0
- package/lib/components/fx-form-component/fx-form-component.component.d.ts +18 -0
- package/lib/components/toggle/toggle.component.d.ts +13 -0
- package/lib/components/toggle-button/toggle-button.component.d.ts +15 -0
- package/lib/components/uploader/uploader.component.d.ts +16 -0
- package/lib/custom-controls/dispatch-to-clinic/dispatch-to-clinic.component.d.ts +17 -0
- package/lib/fx-builder-wrapper.component.d.ts +18 -0
- package/lib/fx-builder-wrapper.service.d.ts +13 -0
- package/lib/panel/configuration-panel/configuration-panel.component.d.ts +25 -0
- package/lib/panel/settings-panel/settings-panel.component.d.ts +10 -0
- package/package.json +18 -5
- package/public-api.d.ts +3 -0
- package/ng-package.json +0 -7
- package/src/lib/components/button/button.component.css +0 -0
- package/src/lib/components/button/button.component.html +0 -1
- package/src/lib/components/button/button.component.ts +0 -24
- package/src/lib/components/dynamic-table/dynamic-table.component.css +0 -0
- package/src/lib/components/dynamic-table/dynamic-table.component.html +0 -69
- package/src/lib/components/dynamic-table/dynamic-table.component.ts +0 -201
- package/src/lib/components/fx-form-component/fx-form-component.component.ts +0 -64
- package/src/lib/components/toggle/toggle.component.css +0 -51
- package/src/lib/components/toggle/toggle.component.html +0 -12
- package/src/lib/components/toggle/toggle.component.ts +0 -33
- package/src/lib/components/toggle-button/toggle-button.component.css +0 -22
- package/src/lib/components/toggle-button/toggle-button.component.html +0 -10
- package/src/lib/components/toggle-button/toggle-button.component.ts +0 -40
- package/src/lib/components/uploader/uploader.component.css +0 -49
- package/src/lib/components/uploader/uploader.component.html +0 -23
- package/src/lib/components/uploader/uploader.component.ts +0 -59
- package/src/lib/custom-controls/dispatch-to-clinic/dispatch-to-clinic.component.html +0 -78
- package/src/lib/custom-controls/dispatch-to-clinic/dispatch-to-clinic.component.ts +0 -44
- package/src/lib/fx-builder-wrapper.component.ts +0 -64
- package/src/lib/fx-builder-wrapper.service.ts +0 -34
- package/src/lib/panel/configuration-panel/configuration-panel.component.css +0 -65
- package/src/lib/panel/configuration-panel/configuration-panel.component.html +0 -96
- package/src/lib/panel/configuration-panel/configuration-panel.component.ts +0 -90
- package/src/lib/panel/settings-panel/settings-panel.component.css +0 -30
- package/src/lib/panel/settings-panel/settings-panel.component.html +0 -28
- package/src/lib/panel/settings-panel/settings-panel.component.ts +0 -23
- package/src/public-api.ts +0 -7
- package/src/styles/styles.css +0 -22
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, inject, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
|
3
|
+
import { BehaviorSubject, Subject, takeUntil } from 'rxjs';
|
|
4
|
+
import * as i1 from '@instantsys-labs/fx';
|
|
5
|
+
import { FxBaseComponent, FxStringSetting, FxValidatorService, FxComponent, FxMode, FxSelectSetting, FxUtils, FxScope, FxComponentBuilder, FxFormComponent } from '@instantsys-labs/fx';
|
|
6
|
+
import * as i2 from '@angular/common';
|
|
7
|
+
import { CommonModule } from '@angular/common';
|
|
8
|
+
import * as i1$1 from '@angular/forms';
|
|
9
|
+
import { FormBuilder, Validators, ReactiveFormsModule, FormsModule, FormControl, UntypedFormControl } from '@angular/forms';
|
|
10
|
+
import { HttpClient } from '@angular/common/http';
|
|
11
|
+
import * as i3 from 'primeng/button';
|
|
12
|
+
import { ButtonModule } from 'primeng/button';
|
|
13
|
+
import { InputTextModule } from 'primeng/inputtext';
|
|
14
|
+
import * as i5 from 'primeng/dialog';
|
|
15
|
+
import { DialogModule } from 'primeng/dialog';
|
|
16
|
+
import * as i4 from 'primeng/api';
|
|
17
|
+
import { v4 } from 'uuid';
|
|
18
|
+
|
|
19
|
+
class FxBuilderWrapperService {
|
|
20
|
+
fxComponentRegistry;
|
|
21
|
+
variables$ = new BehaviorSubject(null);
|
|
22
|
+
constructor(fxComponentRegistry) {
|
|
23
|
+
this.fxComponentRegistry = fxComponentRegistry;
|
|
24
|
+
}
|
|
25
|
+
registerCustomComponent(title, selector, component) {
|
|
26
|
+
this.fxComponentRegistry.registerComponent(selector, component, {
|
|
27
|
+
registeringAs: "CUSTOM",
|
|
28
|
+
libraryItem: {
|
|
29
|
+
title,
|
|
30
|
+
icon: 'fa-eye',
|
|
31
|
+
fxData: {
|
|
32
|
+
id: null,
|
|
33
|
+
name: selector,
|
|
34
|
+
value: "",
|
|
35
|
+
selector: selector,
|
|
36
|
+
elements: [],
|
|
37
|
+
events: []
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
getComponent(selector) {
|
|
43
|
+
return this.fxComponentRegistry.getComponent(selector);
|
|
44
|
+
}
|
|
45
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FxBuilderWrapperService, deps: [{ token: i1.FxComponentRegistryService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
46
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FxBuilderWrapperService, providedIn: 'root' });
|
|
47
|
+
}
|
|
48
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FxBuilderWrapperService, decorators: [{
|
|
49
|
+
type: Injectable,
|
|
50
|
+
args: [{
|
|
51
|
+
providedIn: 'root'
|
|
52
|
+
}]
|
|
53
|
+
}], ctorParameters: () => [{ type: i1.FxComponentRegistryService }] });
|
|
54
|
+
|
|
55
|
+
class DispatchToClinicComponent extends FxBaseComponent {
|
|
56
|
+
cdr;
|
|
57
|
+
fb = inject(FormBuilder);
|
|
58
|
+
clinicAddress$ = new BehaviorSubject({});
|
|
59
|
+
dispatchForm = this.fb.group({
|
|
60
|
+
courierName: ['', Validators.required],
|
|
61
|
+
trackingNumber: ['', Validators.required],
|
|
62
|
+
trackingUrl: ['', [Validators.required, Validators.pattern('https?://.+')]],
|
|
63
|
+
notes: ['', Validators.required]
|
|
64
|
+
});
|
|
65
|
+
constructor(cdr) {
|
|
66
|
+
super(cdr);
|
|
67
|
+
this.cdr = cdr;
|
|
68
|
+
this.onInit.subscribe(() => {
|
|
69
|
+
this._register(this.dispatchForm);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
settings() {
|
|
73
|
+
return [new FxStringSetting({ key: 'heading-text', $title: 'Heading Text', value: 'My Default Value' })];
|
|
74
|
+
}
|
|
75
|
+
validations() {
|
|
76
|
+
return [FxValidatorService.required];
|
|
77
|
+
}
|
|
78
|
+
copyToClipboard(address) {
|
|
79
|
+
navigator.clipboard.writeText(address);
|
|
80
|
+
}
|
|
81
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DispatchToClinicComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
82
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: DispatchToClinicComponent, isStandalone: true, selector: "lib-dispatch-to-clinic", usesInheritance: true, ngImport: i0, template: "<fx-component [fxData]=\"fxData\">\r\n <section\r\n class=\"justify-content-around lg:justify-content-between w-full white-color border-1 border-solid stroke_light_grey p-3 mb-3 mt-3\">\r\n <form [formGroup]=\"dispatchForm\">\r\n <div class=\"grid\">\r\n <!-- Courier Name -->\r\n <div class=\"col-12 sm:col-6 md:col-3 input-container\">\r\n <label for=\"courierName\" class=\"input-title\">Courier Name</label>\r\n <input autocomplete=\"off\" formControlName=\"courierName\" type=\"text\" id=\"courierName\"\r\n name=\"courierName\" class=\"p-inputtext p-component p-element input-field border-1 w-full\"\r\n placeholder=\"enter courier name\" />\r\n\r\n <!-- validation -->\r\n <small *ngIf=\"dispatchForm.get('courierName')?.invalid && dispatchForm.get('courierName')?.touched\"\r\n class=\"text-danger-color block mt-1\">\r\n Courier Name is required.\r\n </small>\r\n <!-- validation -->\r\n </div>\r\n <!-- Courier Name -->\r\n\r\n <!-- Tracking Number -->\r\n <div class=\"col-12 sm:col-6 md:col-3 input-container\">\r\n <label for=\"trackingNumber\" class=\"input-title\">Tracking Number</label>\r\n <input autocomplete=\"off\" formControlName=\"trackingNumber\" type=\"text\" id=\"trackingNumber\"\r\n name=\"trackingNumber\" class=\"p-inputtext p-component p-element input-field border-1 w-full\"\r\n placeholder=\"enter tracking number\" />\r\n <small\r\n *ngIf=\"dispatchForm.get('trackingNumber')?.invalid && dispatchForm.get('trackingNumber')?.touched\"\r\n class=\"text-danger-color block mt-1\">\r\n Tracking Number is required.\r\n </small>\r\n </div>\r\n <!-- Tracking Number -->\r\n\r\n <!-- Tracking URL -->\r\n <div class=\"col-12 sm:col-6 md:col-3 input-container\">\r\n <label for=\"trackingUrl\" class=\"input-title\">Tracking URL</label>\r\n <input autocomplete=\"off\" formControlName=\"trackingUrl\" type=\"text\" id=\"trackingUrl\"\r\n name=\"trackingUrl\" class=\"p-inputtext p-component p-element input-field border-1 w-full\"\r\n placeholder=\"enter tracking url\" />\r\n <small *ngIf=\"dispatchForm.get('trackingUrl')?.invalid && dispatchForm.get('trackingUrl')?.touched\"\r\n class=\"text-danger-color block mt-1\">\r\n <span *ngIf=\"dispatchForm.get('trackingUrl')?.errors?.['required']\">Tracking URL is\r\n required.</span>\r\n <span *ngIf=\"dispatchForm.get('trackingUrl')?.errors?.['pattern']\">Invalid URL format.</span>\r\n </small>\r\n </div>\r\n <!-- Tracking URL -->\r\n\r\n <!-- Notes -->\r\n <div class=\"col-12 md:col-6 input-container\">\r\n <label for=\"notes\" class=\"input-title\">Notes</label>\r\n <textarea autocomplete=\"off\" formControlName=\"notes\" rows=\"5\" id=\"notes\" name=\"notes\"\r\n class=\"p-inputtext p-component p-element input-field border-1 w-full\"\r\n placeholder=\"enter notes\"></textarea>\r\n <small *ngIf=\"dispatchForm.get('notes')?.invalid && dispatchForm.get('notes')?.touched\"\r\n class=\"text-danger-color block mt-1\">\r\n Notes are required.\r\n </small>\r\n </div>\r\n <!-- Notes -->\r\n\r\n <!-- Address with Copy Icon -->\r\n <div class=\"col-12 md:col-6 pt-0\">\r\n <div class=\"mb-1\">Address</div>\r\n <ng-container *ngIf=\"(clinicAddress$ | async) as address\">\r\n <address #completeAddress>{{address?.street}}, {{address?.state}}, {{address?.postalCode}}\r\n <i class=\"pi pi-copy cursor-pointer text-xl text-secondary-color\"\r\n (click)=\"copyToClipboard(completeAddress.textContent)\"></i>\r\n </address>\r\n </ng-container>\r\n </div>\r\n <!-- Address with Copy Icon -->\r\n </div>\r\n </form>\r\n </section>\r\n</fx-component>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: FxComponent, selector: "fx-component", inputs: ["fxData"] }] });
|
|
83
|
+
}
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DispatchToClinicComponent, decorators: [{
|
|
85
|
+
type: Component,
|
|
86
|
+
args: [{ selector: 'lib-dispatch-to-clinic', standalone: true, imports: [CommonModule, ReactiveFormsModule, FormsModule, FxComponent], template: "<fx-component [fxData]=\"fxData\">\r\n <section\r\n class=\"justify-content-around lg:justify-content-between w-full white-color border-1 border-solid stroke_light_grey p-3 mb-3 mt-3\">\r\n <form [formGroup]=\"dispatchForm\">\r\n <div class=\"grid\">\r\n <!-- Courier Name -->\r\n <div class=\"col-12 sm:col-6 md:col-3 input-container\">\r\n <label for=\"courierName\" class=\"input-title\">Courier Name</label>\r\n <input autocomplete=\"off\" formControlName=\"courierName\" type=\"text\" id=\"courierName\"\r\n name=\"courierName\" class=\"p-inputtext p-component p-element input-field border-1 w-full\"\r\n placeholder=\"enter courier name\" />\r\n\r\n <!-- validation -->\r\n <small *ngIf=\"dispatchForm.get('courierName')?.invalid && dispatchForm.get('courierName')?.touched\"\r\n class=\"text-danger-color block mt-1\">\r\n Courier Name is required.\r\n </small>\r\n <!-- validation -->\r\n </div>\r\n <!-- Courier Name -->\r\n\r\n <!-- Tracking Number -->\r\n <div class=\"col-12 sm:col-6 md:col-3 input-container\">\r\n <label for=\"trackingNumber\" class=\"input-title\">Tracking Number</label>\r\n <input autocomplete=\"off\" formControlName=\"trackingNumber\" type=\"text\" id=\"trackingNumber\"\r\n name=\"trackingNumber\" class=\"p-inputtext p-component p-element input-field border-1 w-full\"\r\n placeholder=\"enter tracking number\" />\r\n <small\r\n *ngIf=\"dispatchForm.get('trackingNumber')?.invalid && dispatchForm.get('trackingNumber')?.touched\"\r\n class=\"text-danger-color block mt-1\">\r\n Tracking Number is required.\r\n </small>\r\n </div>\r\n <!-- Tracking Number -->\r\n\r\n <!-- Tracking URL -->\r\n <div class=\"col-12 sm:col-6 md:col-3 input-container\">\r\n <label for=\"trackingUrl\" class=\"input-title\">Tracking URL</label>\r\n <input autocomplete=\"off\" formControlName=\"trackingUrl\" type=\"text\" id=\"trackingUrl\"\r\n name=\"trackingUrl\" class=\"p-inputtext p-component p-element input-field border-1 w-full\"\r\n placeholder=\"enter tracking url\" />\r\n <small *ngIf=\"dispatchForm.get('trackingUrl')?.invalid && dispatchForm.get('trackingUrl')?.touched\"\r\n class=\"text-danger-color block mt-1\">\r\n <span *ngIf=\"dispatchForm.get('trackingUrl')?.errors?.['required']\">Tracking URL is\r\n required.</span>\r\n <span *ngIf=\"dispatchForm.get('trackingUrl')?.errors?.['pattern']\">Invalid URL format.</span>\r\n </small>\r\n </div>\r\n <!-- Tracking URL -->\r\n\r\n <!-- Notes -->\r\n <div class=\"col-12 md:col-6 input-container\">\r\n <label for=\"notes\" class=\"input-title\">Notes</label>\r\n <textarea autocomplete=\"off\" formControlName=\"notes\" rows=\"5\" id=\"notes\" name=\"notes\"\r\n class=\"p-inputtext p-component p-element input-field border-1 w-full\"\r\n placeholder=\"enter notes\"></textarea>\r\n <small *ngIf=\"dispatchForm.get('notes')?.invalid && dispatchForm.get('notes')?.touched\"\r\n class=\"text-danger-color block mt-1\">\r\n Notes are required.\r\n </small>\r\n </div>\r\n <!-- Notes -->\r\n\r\n <!-- Address with Copy Icon -->\r\n <div class=\"col-12 md:col-6 pt-0\">\r\n <div class=\"mb-1\">Address</div>\r\n <ng-container *ngIf=\"(clinicAddress$ | async) as address\">\r\n <address #completeAddress>{{address?.street}}, {{address?.state}}, {{address?.postalCode}}\r\n <i class=\"pi pi-copy cursor-pointer text-xl text-secondary-color\"\r\n (click)=\"copyToClipboard(completeAddress.textContent)\"></i>\r\n </address>\r\n </ng-container>\r\n </div>\r\n <!-- Address with Copy Icon -->\r\n </div>\r\n </form>\r\n </section>\r\n</fx-component>" }]
|
|
87
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
|
|
88
|
+
|
|
89
|
+
class ConfigurationPanelComponent {
|
|
90
|
+
fb;
|
|
91
|
+
visible = false;
|
|
92
|
+
isVisible = new EventEmitter();
|
|
93
|
+
configuration = new EventEmitter();
|
|
94
|
+
rows = 1;
|
|
95
|
+
enableAPI = false;
|
|
96
|
+
api = '';
|
|
97
|
+
dynamicForm;
|
|
98
|
+
columnTypes = ['text', 'input-text', 'input-number', 'dropdown', 'smart-dropdown', 'checkbox', 'radio', 'radio-group', 'file-upload', 'textarea'];
|
|
99
|
+
constructor(fb) {
|
|
100
|
+
this.fb = fb;
|
|
101
|
+
this.dynamicForm = this.fb.group({
|
|
102
|
+
columns: this.fb.array([])
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
get columns() {
|
|
106
|
+
return this.dynamicForm.get('columns');
|
|
107
|
+
}
|
|
108
|
+
// Add Column Dynamically
|
|
109
|
+
addColumn() {
|
|
110
|
+
const columnFormGroup = this.fb.group({
|
|
111
|
+
header: ['', Validators.required],
|
|
112
|
+
cellType: ['', Validators.required],
|
|
113
|
+
placeholder: '',
|
|
114
|
+
options: this.fb.array([]),
|
|
115
|
+
apiUrl: '',
|
|
116
|
+
valueKey: '',
|
|
117
|
+
labelKey: '',
|
|
118
|
+
className: '',
|
|
119
|
+
apiKey: ''
|
|
120
|
+
});
|
|
121
|
+
this.columns.push(columnFormGroup);
|
|
122
|
+
}
|
|
123
|
+
// Remove Column
|
|
124
|
+
removeColumn(index) {
|
|
125
|
+
this.columns.removeAt(index);
|
|
126
|
+
}
|
|
127
|
+
// Add Options Dynamically
|
|
128
|
+
addOption(columnIndex) {
|
|
129
|
+
const optionGroup = this.fb.group({
|
|
130
|
+
optionName: ['', Validators.required],
|
|
131
|
+
optionValue: ['', Validators.required]
|
|
132
|
+
});
|
|
133
|
+
const column = this.columns.at(columnIndex);
|
|
134
|
+
const options = column.get('options');
|
|
135
|
+
options.push(optionGroup);
|
|
136
|
+
}
|
|
137
|
+
// Get options FormArray for a specific column
|
|
138
|
+
getOptions(columnIndex) {
|
|
139
|
+
const column = this.columns.at(columnIndex);
|
|
140
|
+
return column.get('options');
|
|
141
|
+
}
|
|
142
|
+
closeDialog() {
|
|
143
|
+
this.isVisible.emit(false);
|
|
144
|
+
}
|
|
145
|
+
saveConfiguration() {
|
|
146
|
+
this.configuration.emit({ rows: this.rows, columns: this.dynamicForm.value?.columns, enableAPI: this.enableAPI, api: this.api });
|
|
147
|
+
this.isVisible.emit(false);
|
|
148
|
+
}
|
|
149
|
+
onSubmit() {
|
|
150
|
+
console.log("Value columns formArray", this.dynamicForm.value);
|
|
151
|
+
}
|
|
152
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ConfigurationPanelComponent, deps: [{ token: i1$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
|
|
153
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: ConfigurationPanelComponent, isStandalone: true, selector: "fx-configuration-panel", inputs: { visible: "visible" }, outputs: { isVisible: "isVisible", configuration: "configuration" }, ngImport: i0, template: "<p-dialog [modal]=\"true\" [draggable]=\"false\" [(visible)]=\"visible\" [style]=\"{ width: '35rem' }\">\r\n <ng-content pTemplate=\"header\">\r\n <div class=\"flex p-2 bg-white border-2\">\r\n <p class=\"text-base\">Edit Configuration</p>\r\n </div>\r\n </ng-content>\r\n\r\n <ng-template pTemplate=\"content\">\r\n <div class=\"flex flex-col gap-4 bg-white p-2 border-2 border-gray-200\">\r\n <div class=\"flex items-center gap-4 mb-8\">\r\n <label for=\"rows\" class=\"font-semibold w-24\">Rows</label>\r\n <input type=\"text\" [readonly]=\"enableAPI\" [(ngModel)]=\"rows\" placeholder=\"rows\" class=\"form__input\" id=\"name\" autocomplete=\"rows\" />\r\n </div>\r\n <div class=\"flex items-center gap-4 mb-8\">\r\n <label for=\"enableAPI\" class=\"font-semibold w-24\">Enable API</label>\r\n <input type=\"checkbox\" [(ngModel)]=\"enableAPI\" placeholder=\"API Url\" id=\"enableAPI\" autocomplete=\"enableAPI\" />\r\n </div>\r\n @if (enableAPI) {\r\n <div class=\"flex items-center gap-4 mb-8\">\r\n <label for=\"api\" class=\"font-semibold w-24\">API</label>\r\n <input type=\"text\" [(ngModel)]=\"api\" placeholder=\"Enter API Url\" id=\"api\" autocomplete=\"api\" />\r\n </div>\r\n }\r\n <div class=\"flex items-center gap-4 mb-8\">\r\n <div class=\"grid grid-nogutter\">\r\n <div class=\"col-2 mb-3 flex items-center gap-3\">\r\n <p class=\"text-sm font-semibold\">Columns:</p>\r\n <button type=\"button\" (click)=\"addColumn()\">Add Column</button>\r\n </div>\r\n <div class=\"col-10\">\r\n <form [formGroup]=\"dynamicForm\" (ngSubmit)=\"onSubmit()\">\r\n <div formArrayName=\"columns\">\r\n <div *ngFor=\"let column of columns.controls; let i = index\" [formGroupName]=\"i\">\r\n <div class=\"flex gap-4 mb-2\">\r\n <label class=\"white-space-nowrap\">Column Name:</label>\r\n <input formControlName=\"header\" placeholder=\"Enter Column Name\" class=\"form__input\" />\r\n </div>\r\n <div class=\"flex gap-4\">\r\n <label>Column Type:</label>\r\n <select formControlName=\"cellType\">\r\n <option *ngFor=\"let type of columnTypes\" [value]=\"type\">{{type}}</option>\r\n </select>\r\n </div>\r\n @if (enableAPI) {\r\n <div class=\"flex gap-4 mt-2\">\r\n <label>API Value Key:</label>\r\n <input formControlName=\"apiKey\" placeholder=\"Enter Value Key\" class=\"form__input\" />\r\n </div>\r\n }\r\n \r\n <!-- Show options if columnType is 'radio-group' or 'dropdown' -->\r\n <div *ngIf=\"['radio-group', 'dropdown'].includes(column.value.cellType)\">\r\n <div formArrayName=\"options\">\r\n <div *ngFor=\"let option of getOptions(i).controls; let j = index\" [formGroupName]=\"j\">\r\n <label>Option {{ j + 1 }}:</label>\r\n <input formControlName=\"optionName\" placeholder=\"Enter option name\" class=\"form__input\" />\r\n <input formControlName=\"optionValue\" placeholder=\"Enter option value\" class=\"form__input\" />\r\n <button type=\"button\" (click)=\"getOptions(i).removeAt(j)\">Remove Option</button>\r\n </div>\r\n </div>\r\n <button type=\"button\" (click)=\"addOption(i)\">Add Option</button>\r\n </div>\r\n\r\n <!-- Show apiUrl if columnType is 'smart-dropdown' -->\r\n <div *ngIf=\"['smart-dropdown'].includes(column.value.cellType)\" class=\"flex gap-2\">\r\n <div>\r\n <label>API Url</label>\r\n <input formControlName=\"apiUrl\" placeholder=\"Enter api url\" class=\"form__input\" />\r\n </div>\r\n <div>\r\n <label>Value Key</label>\r\n <input formControlName=\"valueKey\" placeholder=\"Enter Value Key\" class=\"form__input\" />\r\n </div>\r\n <div>\r\n <label>Label Key</label>\r\n <input formControlName=\"labelKey\" placeholder=\"Enter Label Key\" class=\"form__input\" />\r\n </div>\r\n </div>\r\n \r\n <button type=\"button\" (click)=\"columns.removeAt(i)\">Remove Column</button>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"footer\">\r\n <div class=\"flex justify-end bg-blue-500 gap-4 w-full\">\r\n <p-button label=\"Cancel\" severity=\"secondary\" (click)=\"closeDialog()\" />\r\n <p-button styleClass=\"border border-indigo-600\" label=\"Save\" (click)=\"saveConfiguration()\" />\r\n </div>\r\n </ng-template>\r\n</p-dialog>", styles: [":is() .p-dialog-content{padding:1.5rem}:is() .p-dialog-header{background:#fff;padding:1rem;font-size:1.25rem;font-weight:700}.form__input{width:100%;padding:8px;border:1px solid #ccc;border-radius:5px}label{font-size:14px;font-weight:600;margin-bottom:5px}.button-group{display:flex;justify-content:flex-end;gap:10px;padding-top:1rem}button{padding:8px 12px;border:none;border-radius:5px;cursor:pointer}.cancel{background:#ccc;color:#000}.save{background:#007bff;color:#fff}button:hover{opacity:.8}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.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$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: i4.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i5.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "visible", "style", "position"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
154
|
+
}
|
|
155
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ConfigurationPanelComponent, decorators: [{
|
|
156
|
+
type: Component,
|
|
157
|
+
args: [{ selector: 'fx-configuration-panel', standalone: true, imports: [CommonModule, ReactiveFormsModule, ButtonModule, DialogModule, InputTextModule, FormsModule], template: "<p-dialog [modal]=\"true\" [draggable]=\"false\" [(visible)]=\"visible\" [style]=\"{ width: '35rem' }\">\r\n <ng-content pTemplate=\"header\">\r\n <div class=\"flex p-2 bg-white border-2\">\r\n <p class=\"text-base\">Edit Configuration</p>\r\n </div>\r\n </ng-content>\r\n\r\n <ng-template pTemplate=\"content\">\r\n <div class=\"flex flex-col gap-4 bg-white p-2 border-2 border-gray-200\">\r\n <div class=\"flex items-center gap-4 mb-8\">\r\n <label for=\"rows\" class=\"font-semibold w-24\">Rows</label>\r\n <input type=\"text\" [readonly]=\"enableAPI\" [(ngModel)]=\"rows\" placeholder=\"rows\" class=\"form__input\" id=\"name\" autocomplete=\"rows\" />\r\n </div>\r\n <div class=\"flex items-center gap-4 mb-8\">\r\n <label for=\"enableAPI\" class=\"font-semibold w-24\">Enable API</label>\r\n <input type=\"checkbox\" [(ngModel)]=\"enableAPI\" placeholder=\"API Url\" id=\"enableAPI\" autocomplete=\"enableAPI\" />\r\n </div>\r\n @if (enableAPI) {\r\n <div class=\"flex items-center gap-4 mb-8\">\r\n <label for=\"api\" class=\"font-semibold w-24\">API</label>\r\n <input type=\"text\" [(ngModel)]=\"api\" placeholder=\"Enter API Url\" id=\"api\" autocomplete=\"api\" />\r\n </div>\r\n }\r\n <div class=\"flex items-center gap-4 mb-8\">\r\n <div class=\"grid grid-nogutter\">\r\n <div class=\"col-2 mb-3 flex items-center gap-3\">\r\n <p class=\"text-sm font-semibold\">Columns:</p>\r\n <button type=\"button\" (click)=\"addColumn()\">Add Column</button>\r\n </div>\r\n <div class=\"col-10\">\r\n <form [formGroup]=\"dynamicForm\" (ngSubmit)=\"onSubmit()\">\r\n <div formArrayName=\"columns\">\r\n <div *ngFor=\"let column of columns.controls; let i = index\" [formGroupName]=\"i\">\r\n <div class=\"flex gap-4 mb-2\">\r\n <label class=\"white-space-nowrap\">Column Name:</label>\r\n <input formControlName=\"header\" placeholder=\"Enter Column Name\" class=\"form__input\" />\r\n </div>\r\n <div class=\"flex gap-4\">\r\n <label>Column Type:</label>\r\n <select formControlName=\"cellType\">\r\n <option *ngFor=\"let type of columnTypes\" [value]=\"type\">{{type}}</option>\r\n </select>\r\n </div>\r\n @if (enableAPI) {\r\n <div class=\"flex gap-4 mt-2\">\r\n <label>API Value Key:</label>\r\n <input formControlName=\"apiKey\" placeholder=\"Enter Value Key\" class=\"form__input\" />\r\n </div>\r\n }\r\n \r\n <!-- Show options if columnType is 'radio-group' or 'dropdown' -->\r\n <div *ngIf=\"['radio-group', 'dropdown'].includes(column.value.cellType)\">\r\n <div formArrayName=\"options\">\r\n <div *ngFor=\"let option of getOptions(i).controls; let j = index\" [formGroupName]=\"j\">\r\n <label>Option {{ j + 1 }}:</label>\r\n <input formControlName=\"optionName\" placeholder=\"Enter option name\" class=\"form__input\" />\r\n <input formControlName=\"optionValue\" placeholder=\"Enter option value\" class=\"form__input\" />\r\n <button type=\"button\" (click)=\"getOptions(i).removeAt(j)\">Remove Option</button>\r\n </div>\r\n </div>\r\n <button type=\"button\" (click)=\"addOption(i)\">Add Option</button>\r\n </div>\r\n\r\n <!-- Show apiUrl if columnType is 'smart-dropdown' -->\r\n <div *ngIf=\"['smart-dropdown'].includes(column.value.cellType)\" class=\"flex gap-2\">\r\n <div>\r\n <label>API Url</label>\r\n <input formControlName=\"apiUrl\" placeholder=\"Enter api url\" class=\"form__input\" />\r\n </div>\r\n <div>\r\n <label>Value Key</label>\r\n <input formControlName=\"valueKey\" placeholder=\"Enter Value Key\" class=\"form__input\" />\r\n </div>\r\n <div>\r\n <label>Label Key</label>\r\n <input formControlName=\"labelKey\" placeholder=\"Enter Label Key\" class=\"form__input\" />\r\n </div>\r\n </div>\r\n \r\n <button type=\"button\" (click)=\"columns.removeAt(i)\">Remove Column</button>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"footer\">\r\n <div class=\"flex justify-end bg-blue-500 gap-4 w-full\">\r\n <p-button label=\"Cancel\" severity=\"secondary\" (click)=\"closeDialog()\" />\r\n <p-button styleClass=\"border border-indigo-600\" label=\"Save\" (click)=\"saveConfiguration()\" />\r\n </div>\r\n </ng-template>\r\n</p-dialog>", styles: [":is() .p-dialog-content{padding:1.5rem}:is() .p-dialog-header{background:#fff;padding:1rem;font-size:1.25rem;font-weight:700}.form__input{width:100%;padding:8px;border:1px solid #ccc;border-radius:5px}label{font-size:14px;font-weight:600;margin-bottom:5px}.button-group{display:flex;justify-content:flex-end;gap:10px;padding-top:1rem}button{padding:8px 12px;border:none;border-radius:5px;cursor:pointer}.cancel{background:#ccc;color:#000}.save{background:#007bff;color:#fff}button:hover{opacity:.8}\n"] }]
|
|
158
|
+
}], ctorParameters: () => [{ type: i1$1.FormBuilder }], propDecorators: { visible: [{
|
|
159
|
+
type: Input
|
|
160
|
+
}], isVisible: [{
|
|
161
|
+
type: Output
|
|
162
|
+
}], configuration: [{
|
|
163
|
+
type: Output
|
|
164
|
+
}] } });
|
|
165
|
+
|
|
166
|
+
class SettingsPanelComponent extends FxComponent {
|
|
167
|
+
configuration = new EventEmitter();
|
|
168
|
+
visible = false;
|
|
169
|
+
openSettingDialog() {
|
|
170
|
+
this.visible = true;
|
|
171
|
+
}
|
|
172
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SettingsPanelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
173
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: SettingsPanelComponent, isStandalone: true, selector: "fx-settings-panel", outputs: { configuration: "configuration" }, usesInheritance: true, ngImport: i0, template: "<fx-configuration-panel [visible]=\"visible\" (isVisible)=\"visible = $event\" (configuration)=\"configuration.emit($event)\"></fx-configuration-panel>\r\n\r\n<div class=\"fx-element\">\r\n <ng-content></ng-content>\r\n <ng-container *ngIf=\"fxData.$fxForm?.$mode !== FxMode.VIEW\">\r\n <div class=\"fx-overlay border-gray-400 border rounded cursor-pointer\" (click)=\"onElementSelect(fxData)\"\r\n (dblclick)=\"openSettingDialog()\">\r\n <div class=\"fx-actions flex justify-between\">\r\n\r\n <div class=\"bg-gray-700 text-gray-300 px-2 rounded-t ml-2 text-xs flex justify-center items-center\">\r\n <div>#{{ fxData.name }}-<span class=\"text-xs italic\">{{ fxData.id }}</span></div>\r\n </div>\r\n\r\n <div class=\"flex justify-around items-end mr-2\">\r\n <div class=\"cursor-pointer bg-secondary text-white w-8 mr-1 text-center rounded-t\" title=\"Settings\"\r\n (click)=\"fxSettingService.openSetting(fxData)\">\r\n <i class=\"fa fa-cog text-xs\"></i>\r\n </div>\r\n <div (click)=\"deleteElement(fxData)\"\r\n class=\"cursor-pointer bg-red-600 text-white w-8 mr-1 text-center rounded-t\" title=\"Delete\">\r\n <i class=\"fa fa-times text-xs\"></i>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <ng-container #dynamicComponentContainer></ng-container>\r\n </ng-container>\r\n</div>", styles: [".fx-element{position:relative}.fx-element .fx-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background:#0000001a;z-index:-1;pointer-events:none;opacity:0}.fx-element:hover .fx-overlay{z-index:1;opacity:1;pointer-events:auto}.fx-element:hover .fx-overlay .fx-actions{position:absolute;margin-top:-26px;height:25px;border-top-right-radius:10px;width:100%;border-top-left-radius:10px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "component", type: ConfigurationPanelComponent, selector: "fx-configuration-panel", inputs: ["visible"], outputs: ["isVisible", "configuration"] }] });
|
|
174
|
+
}
|
|
175
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SettingsPanelComponent, decorators: [{
|
|
176
|
+
type: Component,
|
|
177
|
+
args: [{ selector: 'fx-settings-panel', standalone: true, imports: [CommonModule, ButtonModule, InputTextModule, ConfigurationPanelComponent], template: "<fx-configuration-panel [visible]=\"visible\" (isVisible)=\"visible = $event\" (configuration)=\"configuration.emit($event)\"></fx-configuration-panel>\r\n\r\n<div class=\"fx-element\">\r\n <ng-content></ng-content>\r\n <ng-container *ngIf=\"fxData.$fxForm?.$mode !== FxMode.VIEW\">\r\n <div class=\"fx-overlay border-gray-400 border rounded cursor-pointer\" (click)=\"onElementSelect(fxData)\"\r\n (dblclick)=\"openSettingDialog()\">\r\n <div class=\"fx-actions flex justify-between\">\r\n\r\n <div class=\"bg-gray-700 text-gray-300 px-2 rounded-t ml-2 text-xs flex justify-center items-center\">\r\n <div>#{{ fxData.name }}-<span class=\"text-xs italic\">{{ fxData.id }}</span></div>\r\n </div>\r\n\r\n <div class=\"flex justify-around items-end mr-2\">\r\n <div class=\"cursor-pointer bg-secondary text-white w-8 mr-1 text-center rounded-t\" title=\"Settings\"\r\n (click)=\"fxSettingService.openSetting(fxData)\">\r\n <i class=\"fa fa-cog text-xs\"></i>\r\n </div>\r\n <div (click)=\"deleteElement(fxData)\"\r\n class=\"cursor-pointer bg-red-600 text-white w-8 mr-1 text-center rounded-t\" title=\"Delete\">\r\n <i class=\"fa fa-times text-xs\"></i>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <ng-container #dynamicComponentContainer></ng-container>\r\n </ng-container>\r\n</div>", styles: [".fx-element{position:relative}.fx-element .fx-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background:#0000001a;z-index:-1;pointer-events:none;opacity:0}.fx-element:hover .fx-overlay{z-index:1;opacity:1;pointer-events:auto}.fx-element:hover .fx-overlay .fx-actions{position:absolute;margin-top:-26px;height:25px;border-top-right-radius:10px;width:100%;border-top-left-radius:10px}\n"] }]
|
|
178
|
+
}], propDecorators: { configuration: [{
|
|
179
|
+
type: Output
|
|
180
|
+
}] } });
|
|
181
|
+
|
|
182
|
+
class DynamicTableComponent extends FxBaseComponent {
|
|
183
|
+
cdr;
|
|
184
|
+
fxBuilderWrapperService;
|
|
185
|
+
tableRows = [];
|
|
186
|
+
previewType = FxMode.VIEW;
|
|
187
|
+
tableConfig = {
|
|
188
|
+
columns: [
|
|
189
|
+
{ header: 'Column 1', cellType: 'text' },
|
|
190
|
+
{ header: 'Column 2', cellType: 'text' },
|
|
191
|
+
{ header: 'Column 3', cellType: 'text' },
|
|
192
|
+
{ header: 'Column 4', cellType: 'text' },
|
|
193
|
+
{ header: 'Column 5', cellType: 'text' },
|
|
194
|
+
],
|
|
195
|
+
};
|
|
196
|
+
destroy$ = new Subject();
|
|
197
|
+
uploadedImages = [];
|
|
198
|
+
tableFormControl = new FormControl();
|
|
199
|
+
smartDropdownOptions = {};
|
|
200
|
+
http = inject(HttpClient);
|
|
201
|
+
constructor(cdr, fxBuilderWrapperService) {
|
|
202
|
+
super(cdr);
|
|
203
|
+
this.cdr = cdr;
|
|
204
|
+
this.fxBuilderWrapperService = fxBuilderWrapperService;
|
|
205
|
+
this.onInit.subscribe((fxData) => {
|
|
206
|
+
this._register(this.tableFormControl);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
ngOnInit() {
|
|
210
|
+
this.fxBuilderWrapperService.variables$.pipe(takeUntil(this.destroy$)).subscribe((variables) => {
|
|
211
|
+
if (variables) {
|
|
212
|
+
let dynamicTableValues;
|
|
213
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
214
|
+
if (key.includes('dynamic-table')) {
|
|
215
|
+
dynamicTableValues = value;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (Object.keys(dynamicTableValues).length) {
|
|
219
|
+
// const fileHeaderName = dynamicTableValues?.columns.find((f: any) => f.cellType === 'file-upload')?.header;
|
|
220
|
+
const fileHeaderName = dynamicTableValues?.columns.find((f) => f.cellType === 'file-upload')?.header;
|
|
221
|
+
dynamicTableValues?.rows?.forEach((item, index) => {
|
|
222
|
+
this.uploadedImages[index] = item[fileHeaderName] ? item[fileHeaderName] : null;
|
|
223
|
+
});
|
|
224
|
+
this.tableConfig = dynamicTableValues;
|
|
225
|
+
this.fxData.value = this.tableConfig;
|
|
226
|
+
this.tableFormControl.reset();
|
|
227
|
+
this.tableFormControl.setValue(this.tableConfig);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
ngAfterViewInit() {
|
|
233
|
+
setTimeout(() => {
|
|
234
|
+
if (this.fxData?.value && Object.keys(this.fxData?.value)?.length != 0) {
|
|
235
|
+
this.tableConfig = this.fxData.value;
|
|
236
|
+
this.fetchSmartDropdownData();
|
|
237
|
+
}
|
|
238
|
+
}, 100);
|
|
239
|
+
}
|
|
240
|
+
fetchSmartDropdownData() {
|
|
241
|
+
this.tableConfig.columns
|
|
242
|
+
.filter((column) => column.cellType === 'smart-dropdown' && column?.apiUrl)
|
|
243
|
+
.forEach((column) => {
|
|
244
|
+
this.http.get(column.apiUrl).subscribe((response) => {
|
|
245
|
+
this.smartDropdownOptions[column.header] = response.map((item) => ({
|
|
246
|
+
value: item[column.valueKey],
|
|
247
|
+
name: item[column.labelKey],
|
|
248
|
+
}));
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
uploadImage(event, rowIndex) {
|
|
253
|
+
const file = event.target.files?.[0];
|
|
254
|
+
if (file) {
|
|
255
|
+
const reader = new FileReader();
|
|
256
|
+
reader.onload = () => {
|
|
257
|
+
this.uploadedImages[rowIndex] = reader.result;
|
|
258
|
+
};
|
|
259
|
+
reader.readAsDataURL(file);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
settings() {
|
|
263
|
+
return [
|
|
264
|
+
new FxStringSetting({ key: 'column-size', $title: 'No. of columns', value: 1 }),
|
|
265
|
+
new FxStringSetting({ key: 'table-config', $title: 'Table Configuration', value: {} }),
|
|
266
|
+
];
|
|
267
|
+
}
|
|
268
|
+
validations() {
|
|
269
|
+
return [FxValidatorService.required];
|
|
270
|
+
}
|
|
271
|
+
getArray(count) {
|
|
272
|
+
return Array.from({ length: count });
|
|
273
|
+
}
|
|
274
|
+
onChangeConfiguration(event) {
|
|
275
|
+
const columns = event.columns.map((col) => {
|
|
276
|
+
return {
|
|
277
|
+
header: col?.header,
|
|
278
|
+
cellType: col?.cellType,
|
|
279
|
+
placeholder: col?.placeholder,
|
|
280
|
+
options: col?.options,
|
|
281
|
+
apiUrl: col?.apiUrl,
|
|
282
|
+
valueKey: col?.valueKey,
|
|
283
|
+
labelKey: col?.labelKey,
|
|
284
|
+
className: col?.className,
|
|
285
|
+
apiKey: col?.apiKey
|
|
286
|
+
};
|
|
287
|
+
});
|
|
288
|
+
if (!event?.enableAPI) {
|
|
289
|
+
this.tableConfig.columns = columns;
|
|
290
|
+
this.tableConfig.rows = Array.from({ length: +event?.rows }, (e, index) => ({ name: `SKU-${index + 1}`, age: index % 2 !== 0, gender: 'male' }));
|
|
291
|
+
this.fetchSmartDropdownData();
|
|
292
|
+
}
|
|
293
|
+
if (event?.enableAPI) {
|
|
294
|
+
this.drawTable(event, columns);
|
|
295
|
+
this.tableConfig = {
|
|
296
|
+
columns: columns,
|
|
297
|
+
rows: []
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
this.fxData.value = this.tableConfig;
|
|
301
|
+
this.tableFormControl.reset();
|
|
302
|
+
this.tableFormControl.setValue(this.tableConfig);
|
|
303
|
+
}
|
|
304
|
+
updateSettings() {
|
|
305
|
+
if (this.fxData.settings) {
|
|
306
|
+
for (let setting of this.fxData.settings) {
|
|
307
|
+
if (setting.key === 'table-config') {
|
|
308
|
+
setting.value = this.tableConfig;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
drawTable(event, columns) {
|
|
314
|
+
let rows;
|
|
315
|
+
this.http.get(event.api).subscribe((res) => {
|
|
316
|
+
if (res) {
|
|
317
|
+
rows = res.map((item) => {
|
|
318
|
+
const newObj = {};
|
|
319
|
+
columns.forEach((col) => {
|
|
320
|
+
newObj[col.header] = item[col.apiKey];
|
|
321
|
+
});
|
|
322
|
+
return newObj;
|
|
323
|
+
});
|
|
324
|
+
this.tableConfig = {
|
|
325
|
+
columns,
|
|
326
|
+
rows
|
|
327
|
+
};
|
|
328
|
+
this.fxData.value = this.tableConfig;
|
|
329
|
+
this.tableFormControl.reset();
|
|
330
|
+
this.tableFormControl.setValue(this.tableConfig);
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
deleteFile(file, index) {
|
|
335
|
+
this.uploadedImages.splice(index, 1, null);
|
|
336
|
+
}
|
|
337
|
+
ngOnDestroy() {
|
|
338
|
+
this.destroy$.next(true);
|
|
339
|
+
this.destroy$.complete();
|
|
340
|
+
}
|
|
341
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicTableComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: FxBuilderWrapperService }], target: i0.ɵɵFactoryTarget.Component });
|
|
342
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: DynamicTableComponent, isStandalone: true, selector: "fx-dynamic-table", inputs: { tableRows: "tableRows", previewType: "previewType", tableConfig: "tableConfig" }, usesInheritance: true, ngImport: i0, template: "<fx-settings-panel [fxData]=\"fxData\" (configuration)=\"onChangeConfiguration($event)\">\r\n <div style=\"padding: 0 1.5rem;\" *ngIf=\"fxData\">\r\n <table style=\"width: 100%;\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let column of tableConfig.columns\">{{ column.header }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let row of tableConfig.rows; let rowIndex = index\">\r\n <td style=\"text-align: center;\" *ngFor=\"let column of tableConfig.columns\">\r\n <ng-container [ngSwitch]=\"column.cellType\">\r\n <span [class]=\"column?.className\" *ngSwitchCase=\"'text'\">{{row[column.header]}}</span>\r\n \r\n <input [class]=\"column?.className\" *ngSwitchCase=\"'input-text'\"\r\n [(ngModel)]=\"row[column.header]\" />\r\n \r\n <input [class]=\"column?.className\" *ngSwitchCase=\"'input-number'\" type=\"number\"\r\n [(ngModel)]=\"row[column.header]\" />\r\n \r\n <select [class]=\"column?.className\" *ngSwitchCase=\"'dropdown'\"\r\n [(ngModel)]=\"row[column.header]\">\r\n <option *ngFor=\"let option of column?.options\" [value]=\"option?.optionValue\"> \r\n {{ option?.optionName }}\r\n </option>\r\n </select>\r\n \r\n <select [class]=\"column?.className\" style=\"width: 60%;\" *ngSwitchCase=\"'smart-dropdown'\"\r\n [(ngModel)]=\"row[column.header]\">\r\n <option *ngFor=\"let option of smartDropdownOptions[column.header]\" [value]=\"option?.value\">\r\n {{option?.name }}\r\n </option>\r\n </select>\r\n \r\n <input [class]=\"column?.className\" *ngSwitchCase=\"'checkbox'\" type=\"checkbox\"\r\n [(ngModel)]=\"row[column.header]\" />\r\n \r\n <input name=\"radio-{{rowIndex}}\" [class]=\"column?.className\" *ngSwitchCase=\"'radio'\" type=\"radio\"\r\n [(ngModel)]=\"row[column.header]\" />\r\n \r\n <div [class]=\"column?.className\" style=\"display: flex; justify-content: center; gap: 10px;\"\r\n *ngSwitchCase=\"'radio-group'\">\r\n <label *ngFor=\"let option of column.options\">\r\n <input name=\"radio-group-{{rowIndex}}\" type=\"radio\" [value]=\"option?.optionName\"\r\n [(ngModel)]=\"row[column.header]\" />\r\n {{ option?.optionName }}\r\n </label>\r\n </div>\r\n \r\n <ng-container *ngSwitchCase=\"'file-upload'\">\r\n <div style=\"display: flex; flex-direction: column; align-items: center;\">\r\n <img width=\"100\" *ngIf=\"uploadedImages[rowIndex]\" [src]=\"uploadedImages[rowIndex]\"\r\n alt=\"Uploaded Image\" (click)=\"deleteFile(uploadedImages[rowIndex], rowIndex)\"/>\r\n <input [class]=\"column?.className\" type=\"file\" name=\"file\" #uploadFile [(ngModel)]=\"row[column.header]\" hidden multiple\r\n (change)=\"uploadImage($event, rowIndex)\" />\r\n <button (click)=\"uploadFile.click()\">Upload</button>\r\n </div>\r\n </ng-container>\r\n \r\n <ng-container *ngSwitchCase=\"'textarea'\">\r\n <textarea [class]=\"column?.className\" name=\"\" id=\"\" cols=\"30\" rows=\"2\"></textarea>\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n</fx-settings-panel>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.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$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1$1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: SettingsPanelComponent, selector: "fx-settings-panel", outputs: ["configuration"] }, { kind: "ngmodule", type: ReactiveFormsModule }] });
|
|
343
|
+
}
|
|
344
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DynamicTableComponent, decorators: [{
|
|
345
|
+
type: Component,
|
|
346
|
+
args: [{ selector: 'fx-dynamic-table', standalone: true, imports: [CommonModule, FormsModule, SettingsPanelComponent, ReactiveFormsModule], template: "<fx-settings-panel [fxData]=\"fxData\" (configuration)=\"onChangeConfiguration($event)\">\r\n <div style=\"padding: 0 1.5rem;\" *ngIf=\"fxData\">\r\n <table style=\"width: 100%;\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let column of tableConfig.columns\">{{ column.header }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let row of tableConfig.rows; let rowIndex = index\">\r\n <td style=\"text-align: center;\" *ngFor=\"let column of tableConfig.columns\">\r\n <ng-container [ngSwitch]=\"column.cellType\">\r\n <span [class]=\"column?.className\" *ngSwitchCase=\"'text'\">{{row[column.header]}}</span>\r\n \r\n <input [class]=\"column?.className\" *ngSwitchCase=\"'input-text'\"\r\n [(ngModel)]=\"row[column.header]\" />\r\n \r\n <input [class]=\"column?.className\" *ngSwitchCase=\"'input-number'\" type=\"number\"\r\n [(ngModel)]=\"row[column.header]\" />\r\n \r\n <select [class]=\"column?.className\" *ngSwitchCase=\"'dropdown'\"\r\n [(ngModel)]=\"row[column.header]\">\r\n <option *ngFor=\"let option of column?.options\" [value]=\"option?.optionValue\"> \r\n {{ option?.optionName }}\r\n </option>\r\n </select>\r\n \r\n <select [class]=\"column?.className\" style=\"width: 60%;\" *ngSwitchCase=\"'smart-dropdown'\"\r\n [(ngModel)]=\"row[column.header]\">\r\n <option *ngFor=\"let option of smartDropdownOptions[column.header]\" [value]=\"option?.value\">\r\n {{option?.name }}\r\n </option>\r\n </select>\r\n \r\n <input [class]=\"column?.className\" *ngSwitchCase=\"'checkbox'\" type=\"checkbox\"\r\n [(ngModel)]=\"row[column.header]\" />\r\n \r\n <input name=\"radio-{{rowIndex}}\" [class]=\"column?.className\" *ngSwitchCase=\"'radio'\" type=\"radio\"\r\n [(ngModel)]=\"row[column.header]\" />\r\n \r\n <div [class]=\"column?.className\" style=\"display: flex; justify-content: center; gap: 10px;\"\r\n *ngSwitchCase=\"'radio-group'\">\r\n <label *ngFor=\"let option of column.options\">\r\n <input name=\"radio-group-{{rowIndex}}\" type=\"radio\" [value]=\"option?.optionName\"\r\n [(ngModel)]=\"row[column.header]\" />\r\n {{ option?.optionName }}\r\n </label>\r\n </div>\r\n \r\n <ng-container *ngSwitchCase=\"'file-upload'\">\r\n <div style=\"display: flex; flex-direction: column; align-items: center;\">\r\n <img width=\"100\" *ngIf=\"uploadedImages[rowIndex]\" [src]=\"uploadedImages[rowIndex]\"\r\n alt=\"Uploaded Image\" (click)=\"deleteFile(uploadedImages[rowIndex], rowIndex)\"/>\r\n <input [class]=\"column?.className\" type=\"file\" name=\"file\" #uploadFile [(ngModel)]=\"row[column.header]\" hidden multiple\r\n (change)=\"uploadImage($event, rowIndex)\" />\r\n <button (click)=\"uploadFile.click()\">Upload</button>\r\n </div>\r\n </ng-container>\r\n \r\n <ng-container *ngSwitchCase=\"'textarea'\">\r\n <textarea [class]=\"column?.className\" name=\"\" id=\"\" cols=\"30\" rows=\"2\"></textarea>\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n</fx-settings-panel>" }]
|
|
347
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: FxBuilderWrapperService }], propDecorators: { tableRows: [{
|
|
348
|
+
type: Input
|
|
349
|
+
}], previewType: [{
|
|
350
|
+
type: Input
|
|
351
|
+
}], tableConfig: [{
|
|
352
|
+
type: Input
|
|
353
|
+
}] } });
|
|
354
|
+
|
|
355
|
+
class ToggleButtonComponent extends FxBaseComponent {
|
|
356
|
+
cdr;
|
|
357
|
+
toggleBtnControl = new UntypedFormControl(false);
|
|
358
|
+
isToggled = false;
|
|
359
|
+
constructor(cdr) {
|
|
360
|
+
super(cdr);
|
|
361
|
+
this.cdr = cdr;
|
|
362
|
+
this.onInit.subscribe((fxData) => {
|
|
363
|
+
this._register(this.toggleBtnControl);
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
toggle() {
|
|
367
|
+
this.isToggled = !this.toggleBtnControl.value;
|
|
368
|
+
this.toggleBtnControl.setValue(this.isToggled);
|
|
369
|
+
}
|
|
370
|
+
settings() {
|
|
371
|
+
return [
|
|
372
|
+
new FxStringSetting({ key: 'classes', $title: 'Classes', value: '' }),
|
|
373
|
+
new FxStringSetting({ key: 'active-text', $title: 'Active Text', value: 'On' }),
|
|
374
|
+
new FxStringSetting({ key: 'inactive-text', $title: 'Inactive Text', value: 'Off' }),
|
|
375
|
+
];
|
|
376
|
+
}
|
|
377
|
+
validations() {
|
|
378
|
+
return [FxValidatorService.required];
|
|
379
|
+
}
|
|
380
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ToggleButtonComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
381
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ToggleButtonComponent, isStandalone: true, selector: "lib-toggle-button", usesInheritance: true, ngImport: i0, template: "<fx-component [fxData]=\"fxData\">\r\n <button\r\n class=\"custom-toggle-btn\"\r\n [class]=\"setting('classes') ? setting('classes'): ''\"\r\n [class.active]=\"toggleBtnControl.value\"\r\n (click)=\"toggle()\"\r\n >\r\n {{ toggleBtnControl.value ? setting('active-text') : setting('inactive-text') }}\r\n </button>\r\n</fx-component>\r\n", styles: [".custom-toggle-btn{padding:10px 20px;font-size:16px;font-weight:700;color:#fff;border:none;border-radius:5px;cursor:pointer;background-color:#ccc;transition:background-color .3s}.custom-toggle-btn.active{background-color:#4caf50}.custom-toggle-btn:hover{opacity:.9}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: FxComponent, selector: "fx-component", inputs: ["fxData"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: FormsModule }] });
|
|
382
|
+
}
|
|
383
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ToggleButtonComponent, decorators: [{
|
|
384
|
+
type: Component,
|
|
385
|
+
args: [{ selector: 'lib-toggle-button', standalone: true, imports: [CommonModule, FxComponent, ReactiveFormsModule, FormsModule], template: "<fx-component [fxData]=\"fxData\">\r\n <button\r\n class=\"custom-toggle-btn\"\r\n [class]=\"setting('classes') ? setting('classes'): ''\"\r\n [class.active]=\"toggleBtnControl.value\"\r\n (click)=\"toggle()\"\r\n >\r\n {{ toggleBtnControl.value ? setting('active-text') : setting('inactive-text') }}\r\n </button>\r\n</fx-component>\r\n", styles: [".custom-toggle-btn{padding:10px 20px;font-size:16px;font-weight:700;color:#fff;border:none;border-radius:5px;cursor:pointer;background-color:#ccc;transition:background-color .3s}.custom-toggle-btn.active{background-color:#4caf50}.custom-toggle-btn:hover{opacity:.9}\n"] }]
|
|
386
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
|
|
387
|
+
|
|
388
|
+
class UploaderComponent extends FxBaseComponent {
|
|
389
|
+
cdr;
|
|
390
|
+
uploadFileControl = new UntypedFormControl();
|
|
391
|
+
uploadedFiles = [];
|
|
392
|
+
constructor(cdr) {
|
|
393
|
+
super(cdr);
|
|
394
|
+
this.cdr = cdr;
|
|
395
|
+
this.onInit.subscribe((fxData) => {
|
|
396
|
+
this._register(this.uploadFileControl);
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
onFileSelected(event) {
|
|
400
|
+
const input = event.target;
|
|
401
|
+
if (input.files) {
|
|
402
|
+
for (let i = 0; i < input?.files?.length; i++) {
|
|
403
|
+
const file = input.files[i];
|
|
404
|
+
const reader = new FileReader();
|
|
405
|
+
reader.onload = e => {
|
|
406
|
+
this.uploadedFiles.push({
|
|
407
|
+
file: file,
|
|
408
|
+
previewUrl: e.target?.result,
|
|
409
|
+
name: file?.name,
|
|
410
|
+
id: v4()
|
|
411
|
+
});
|
|
412
|
+
this.uploadFileControl.setValue(this.uploadedFiles);
|
|
413
|
+
};
|
|
414
|
+
reader.readAsDataURL(file);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
deleteFile(id) {
|
|
419
|
+
this.uploadedFiles = this.uploadedFiles.filter(file => file?.id !== id);
|
|
420
|
+
}
|
|
421
|
+
settings() {
|
|
422
|
+
return [
|
|
423
|
+
new FxStringSetting({ key: 'upload-text', $title: 'Upload Text', value: 'Upload File' }),
|
|
424
|
+
new FxSelectSetting({ key: 'multiple-upload', $title: 'Multiple Upload', value: false }, [{ option: 'Enable', value: true }, { option: 'Disable', value: false }])
|
|
425
|
+
];
|
|
426
|
+
}
|
|
427
|
+
validations() {
|
|
428
|
+
return [FxValidatorService.required];
|
|
429
|
+
}
|
|
430
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: UploaderComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
431
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: UploaderComponent, isStandalone: true, selector: "fx-uploader", usesInheritance: true, ngImport: i0, template: "<fx-component [fxData]=\"fxData\">\r\n <div class=\"custom-upload\">\r\n <button type=\"button\" (click)=\"fileInput.click()\">\r\n {{setting('upload-text')}}\r\n </button>\r\n <input\r\n #fileInput\r\n type=\"file\"\r\n [multiple]=\"setting('multiple-upload')\"\r\n (change)=\"onFileSelected($event)\"\r\n [formControl]=\"uploadFileControl\"\r\n hidden\r\n />\r\n <div class=\"file-list\">\r\n <ng-container *ngIf=\"uploadedFiles?.length\">\r\n <div (click)=\"deleteFile(file?.id)\" *ngFor=\"let file of uploadedFiles\">\r\n <img class=\"file-thumbnail\" style=\"border-radius: 4px\" [src]=\"file?.previewUrl\" alt=\"\">\r\n <!-- <p>{{file?.name}}</p> -->\r\n </div>\r\n </ng-container>\r\n </div>\r\n </div>\r\n</fx-component>\r\n", styles: [".custom-upload{display:flex;flex-direction:row;align-items:flex-start}.custom-upload button{padding:10px 20px;font-size:16px;font-weight:700;color:#fff;background-color:#007bff;border:none;border-radius:5px;cursor:pointer;transition:background-color .3s}.custom-upload button:hover{background-color:#0056b3}.custom-upload .file-list{display:flex}.custom-upload .file-list p{margin:0;padding:5px;background-color:#f1f1f1;border:1px solid #ddd;border-radius:3px;font-size:14px}.custom-upload .file-list>div{display:flex;flex-direction:column;align-items:center;justify-content:center}.custom-upload .file-list .file-thumbnail{width:100px;height:100px;object-fit:contain}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FxComponent, selector: "fx-component", inputs: ["fxData"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
|
|
432
|
+
}
|
|
433
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: UploaderComponent, decorators: [{
|
|
434
|
+
type: Component,
|
|
435
|
+
args: [{ selector: 'fx-uploader', standalone: true, imports: [CommonModule, FxComponent, FormsModule, ReactiveFormsModule], template: "<fx-component [fxData]=\"fxData\">\r\n <div class=\"custom-upload\">\r\n <button type=\"button\" (click)=\"fileInput.click()\">\r\n {{setting('upload-text')}}\r\n </button>\r\n <input\r\n #fileInput\r\n type=\"file\"\r\n [multiple]=\"setting('multiple-upload')\"\r\n (change)=\"onFileSelected($event)\"\r\n [formControl]=\"uploadFileControl\"\r\n hidden\r\n />\r\n <div class=\"file-list\">\r\n <ng-container *ngIf=\"uploadedFiles?.length\">\r\n <div (click)=\"deleteFile(file?.id)\" *ngFor=\"let file of uploadedFiles\">\r\n <img class=\"file-thumbnail\" style=\"border-radius: 4px\" [src]=\"file?.previewUrl\" alt=\"\">\r\n <!-- <p>{{file?.name}}</p> -->\r\n </div>\r\n </ng-container>\r\n </div>\r\n </div>\r\n</fx-component>\r\n", styles: [".custom-upload{display:flex;flex-direction:row;align-items:flex-start}.custom-upload button{padding:10px 20px;font-size:16px;font-weight:700;color:#fff;background-color:#007bff;border:none;border-radius:5px;cursor:pointer;transition:background-color .3s}.custom-upload button:hover{background-color:#0056b3}.custom-upload .file-list{display:flex}.custom-upload .file-list p{margin:0;padding:5px;background-color:#f1f1f1;border:1px solid #ddd;border-radius:3px;font-size:14px}.custom-upload .file-list>div{display:flex;flex-direction:column;align-items:center;justify-content:center}.custom-upload .file-list .file-thumbnail{width:100px;height:100px;object-fit:contain}\n"] }]
|
|
436
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
|
|
437
|
+
|
|
438
|
+
class ToggleComponent extends FxBaseComponent {
|
|
439
|
+
cdr;
|
|
440
|
+
toggleControl = new FormControl(false);
|
|
441
|
+
constructor(cdr) {
|
|
442
|
+
super(cdr);
|
|
443
|
+
this.cdr = cdr;
|
|
444
|
+
this.onInit.subscribe((fxData) => {
|
|
445
|
+
this._register(this.toggleControl);
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
settings() {
|
|
449
|
+
return [
|
|
450
|
+
new FxStringSetting({ key: 'accept', $title: 'Accept Text', value: 'Yes' }),
|
|
451
|
+
new FxStringSetting({ key: 'reject', $title: 'Reject Text', value: 'No' })
|
|
452
|
+
];
|
|
453
|
+
}
|
|
454
|
+
validations() {
|
|
455
|
+
return [FxValidatorService.required];
|
|
456
|
+
}
|
|
457
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ToggleComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
458
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ToggleComponent, isStandalone: true, selector: "fx-toggle", usesInheritance: true, ngImport: i0, template: "<fx-component [fxData]=\"fxData\">\r\n <div style=\"display: flex;\">\r\n <label>\r\n <input [formControl]=\"toggleControl\" type=\"radio\" name=\"radio_grp\" class=\"form-radio mr-3\" value=\"true\">\r\n <span class=\"mt-1\">{{setting('accept')}}</span>\r\n </label>\r\n <label>\r\n <input [formControl]=\"toggleControl\" type=\"radio\" name=\"radio_grp\" class=\"form-radio mr-3\" value=\"false\">\r\n <span class=\"mt-1\">{{setting('reject')}}</span>\r\n </label>\r\n </div>\r\n</fx-component>\r\n", styles: ["label{position:relative;white-space:nowrap;border-radius:0;border:0 solid #999999;margin:0 14px 0 0;width:120px;height:auto;padding:0;text-align:center;cursor:pointer}.form-radio{background-color:#dae6f0;color:#fff;box-shadow:none;transition:background-color .2s,color .2s,border-color .2s,box-shadow .2s;border:1px solid #DEDEDE;padding:9px 10px;margin:0;white-space:nowrap;width:100%;height:38px;background-image:none;border-radius:4px}.form-radio:checked{background-color:#add8e6;border-color:#9bbbd6}.form-radio:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #9dc1fb,0 1px 2px #000;background-color:#add8e6}.form-radio:hover{border-color:#4682b4}span{position:absolute;inset:8px 0 0;margin:0;padding:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: FxComponent, selector: "fx-component", inputs: ["fxData"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.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$1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
|
|
459
|
+
}
|
|
460
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ToggleComponent, decorators: [{
|
|
461
|
+
type: Component,
|
|
462
|
+
args: [{ selector: 'fx-toggle', standalone: true, imports: [CommonModule, FxComponent, FormsModule, ReactiveFormsModule], template: "<fx-component [fxData]=\"fxData\">\r\n <div style=\"display: flex;\">\r\n <label>\r\n <input [formControl]=\"toggleControl\" type=\"radio\" name=\"radio_grp\" class=\"form-radio mr-3\" value=\"true\">\r\n <span class=\"mt-1\">{{setting('accept')}}</span>\r\n </label>\r\n <label>\r\n <input [formControl]=\"toggleControl\" type=\"radio\" name=\"radio_grp\" class=\"form-radio mr-3\" value=\"false\">\r\n <span class=\"mt-1\">{{setting('reject')}}</span>\r\n </label>\r\n </div>\r\n</fx-component>\r\n", styles: ["label{position:relative;white-space:nowrap;border-radius:0;border:0 solid #999999;margin:0 14px 0 0;width:120px;height:auto;padding:0;text-align:center;cursor:pointer}.form-radio{background-color:#dae6f0;color:#fff;box-shadow:none;transition:background-color .2s,color .2s,border-color .2s,box-shadow .2s;border:1px solid #DEDEDE;padding:9px 10px;margin:0;white-space:nowrap;width:100%;height:38px;background-image:none;border-radius:4px}.form-radio:checked{background-color:#add8e6;border-color:#9bbbd6}.form-radio:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #9dc1fb,0 1px 2px #000;background-color:#add8e6}.form-radio:hover{border-color:#4682b4}span{position:absolute;inset:8px 0 0;margin:0;padding:0}\n"] }]
|
|
463
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
|
|
464
|
+
|
|
465
|
+
class FxBuilderWrapperComponent {
|
|
466
|
+
fxWrapperService;
|
|
467
|
+
componentBuilder;
|
|
468
|
+
fxForm = FxUtils.createNewForm();
|
|
469
|
+
fxMode = FxMode.EDIT;
|
|
470
|
+
fxConfiguration = {
|
|
471
|
+
settings: true,
|
|
472
|
+
logics: true,
|
|
473
|
+
customControls: true,
|
|
474
|
+
};
|
|
475
|
+
FxScope = FxScope;
|
|
476
|
+
FxMode = FxMode;
|
|
477
|
+
constructor(fxWrapperService) {
|
|
478
|
+
this.fxWrapperService = fxWrapperService;
|
|
479
|
+
}
|
|
480
|
+
ngOnInit() {
|
|
481
|
+
if (!Boolean(this.fxWrapperService.getComponent('dispatch-to-clinic'))) {
|
|
482
|
+
this.fxWrapperService.registerCustomComponent('Dispatch To Clinic', 'dispatch-to-clinic', DispatchToClinicComponent);
|
|
483
|
+
}
|
|
484
|
+
if (!Boolean(this.fxWrapperService.getComponent('dynamic-table'))) {
|
|
485
|
+
this.fxWrapperService.registerCustomComponent('Dynamic Table', 'dynamic-table', DynamicTableComponent);
|
|
486
|
+
}
|
|
487
|
+
if (!Boolean(this.fxWrapperService.getComponent('toggle-button'))) {
|
|
488
|
+
this.fxWrapperService.registerCustomComponent('Toggle Button', 'toggle-button', ToggleButtonComponent);
|
|
489
|
+
}
|
|
490
|
+
if (!Boolean(this.fxWrapperService.getComponent('uploader'))) {
|
|
491
|
+
this.fxWrapperService.registerCustomComponent('Uploader', 'uploader', UploaderComponent);
|
|
492
|
+
}
|
|
493
|
+
if (!Boolean(this.fxWrapperService.getComponent('toggle'))) {
|
|
494
|
+
this.fxWrapperService.registerCustomComponent('Toggle', 'toggle', ToggleComponent);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
;
|
|
498
|
+
getParsedForm() {
|
|
499
|
+
return this.componentBuilder.getParsedForm();
|
|
500
|
+
}
|
|
501
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FxBuilderWrapperComponent, deps: [{ token: FxBuilderWrapperService }], target: i0.ɵɵFactoryTarget.Component });
|
|
502
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: FxBuilderWrapperComponent, isStandalone: true, selector: "fx-builder-wrapper", inputs: { fxForm: ["fx-form", "fxForm"] }, viewQueries: [{ propertyName: "componentBuilder", first: true, predicate: ["componentBuilder"], descendants: true }], ngImport: i0, template: `
|
|
503
|
+
<fx-component-builder
|
|
504
|
+
#componentBuilder
|
|
505
|
+
[fx-form]="fxForm"
|
|
506
|
+
[configuration]="fxConfiguration"
|
|
507
|
+
[scope]="FxScope.BUILDER"
|
|
508
|
+
>
|
|
509
|
+
</fx-component-builder>
|
|
510
|
+
`, isInline: true, styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: FxComponentBuilder, selector: "fx-component-builder", inputs: ["fx-form", "scope", "configuration"] }] });
|
|
511
|
+
}
|
|
512
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FxBuilderWrapperComponent, decorators: [{
|
|
513
|
+
type: Component,
|
|
514
|
+
args: [{ selector: 'fx-builder-wrapper', standalone: true, imports: [CommonModule, FxComponentBuilder], template: `
|
|
515
|
+
<fx-component-builder
|
|
516
|
+
#componentBuilder
|
|
517
|
+
[fx-form]="fxForm"
|
|
518
|
+
[configuration]="fxConfiguration"
|
|
519
|
+
[scope]="FxScope.BUILDER"
|
|
520
|
+
>
|
|
521
|
+
</fx-component-builder>
|
|
522
|
+
` }]
|
|
523
|
+
}], ctorParameters: () => [{ type: FxBuilderWrapperService }], propDecorators: { componentBuilder: [{
|
|
524
|
+
type: ViewChild,
|
|
525
|
+
args: ['componentBuilder']
|
|
526
|
+
}], fxForm: [{
|
|
527
|
+
type: Input,
|
|
528
|
+
args: [{ alias: 'fx-form', required: true }]
|
|
529
|
+
}] } });
|
|
530
|
+
|
|
531
|
+
class FxFormWrapperComponent {
|
|
532
|
+
fxWrapperService;
|
|
533
|
+
form;
|
|
534
|
+
fxForm;
|
|
535
|
+
variables;
|
|
536
|
+
fxFormSubmit = new EventEmitter();
|
|
537
|
+
constructor(fxWrapperService) {
|
|
538
|
+
this.fxWrapperService = fxWrapperService;
|
|
539
|
+
}
|
|
540
|
+
ngOnChanges(changes) {
|
|
541
|
+
if ('variables' in changes && !changes['fxForm']) {
|
|
542
|
+
this.fxWrapperService.variables$.next(this.variables);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
ngOnInit() {
|
|
546
|
+
if (!Boolean(this.fxWrapperService.getComponent('dispatch-to-clinic'))) {
|
|
547
|
+
this.fxWrapperService.registerCustomComponent('Dispatch To Clinic', 'dispatch-to-clinic', DispatchToClinicComponent);
|
|
548
|
+
}
|
|
549
|
+
if (!Boolean(this.fxWrapperService.getComponent('dynamic-table'))) {
|
|
550
|
+
this.fxWrapperService.registerCustomComponent('Dynamic Table', 'dynamic-table', DynamicTableComponent);
|
|
551
|
+
}
|
|
552
|
+
if (!Boolean(this.fxWrapperService.getComponent('toggle-button'))) {
|
|
553
|
+
this.fxWrapperService.registerCustomComponent('Toggle Button', 'toggle-button', ToggleButtonComponent);
|
|
554
|
+
}
|
|
555
|
+
if (!Boolean(this.fxWrapperService.getComponent('uploader'))) {
|
|
556
|
+
this.fxWrapperService.registerCustomComponent('Uploader', 'uploader', UploaderComponent);
|
|
557
|
+
}
|
|
558
|
+
if (!Boolean(this.fxWrapperService.getComponent('toggle'))) {
|
|
559
|
+
this.fxWrapperService.registerCustomComponent('Toggle', 'toggle', ToggleComponent);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
onSubmit(event) {
|
|
563
|
+
this.fxFormSubmit.emit(event);
|
|
564
|
+
}
|
|
565
|
+
submit() {
|
|
566
|
+
this.form.submit();
|
|
567
|
+
}
|
|
568
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FxFormWrapperComponent, deps: [{ token: FxBuilderWrapperService }], target: i0.ɵɵFactoryTarget.Component });
|
|
569
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: FxFormWrapperComponent, isStandalone: true, selector: "fx-form-component", inputs: { fxForm: "fxForm", variables: "variables" }, outputs: { fxFormSubmit: "fxFormSubmit" }, viewQueries: [{ propertyName: "form", first: true, predicate: ["form"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
570
|
+
<fx-form
|
|
571
|
+
[fxForm]="fxForm"
|
|
572
|
+
[value]="variables"
|
|
573
|
+
(onSubmit)="onSubmit($event)"
|
|
574
|
+
#form
|
|
575
|
+
>
|
|
576
|
+
</fx-form>
|
|
577
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: FxFormComponent, selector: "fx-form", inputs: ["formGroup", "fxForm", "value", "mode"], outputs: ["onSubmit"] }] });
|
|
578
|
+
}
|
|
579
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FxFormWrapperComponent, decorators: [{
|
|
580
|
+
type: Component,
|
|
581
|
+
args: [{
|
|
582
|
+
selector: 'fx-form-component',
|
|
583
|
+
standalone: true,
|
|
584
|
+
imports: [CommonModule, FxFormComponent],
|
|
585
|
+
template: `
|
|
586
|
+
<fx-form
|
|
587
|
+
[fxForm]="fxForm"
|
|
588
|
+
[value]="variables"
|
|
589
|
+
(onSubmit)="onSubmit($event)"
|
|
590
|
+
#form
|
|
591
|
+
>
|
|
592
|
+
</fx-form>
|
|
593
|
+
`,
|
|
594
|
+
}]
|
|
595
|
+
}], ctorParameters: () => [{ type: FxBuilderWrapperService }], propDecorators: { form: [{
|
|
596
|
+
type: ViewChild,
|
|
597
|
+
args: ['form']
|
|
598
|
+
}], fxForm: [{
|
|
599
|
+
type: Input
|
|
600
|
+
}], variables: [{
|
|
601
|
+
type: Input
|
|
602
|
+
}], fxFormSubmit: [{
|
|
603
|
+
type: Output
|
|
604
|
+
}] } });
|
|
605
|
+
|
|
606
|
+
/*
|
|
607
|
+
* Public API Surface of fx-builder-wrapper
|
|
608
|
+
*/
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Generated bundle index. Do not edit.
|
|
612
|
+
*/
|
|
613
|
+
|
|
614
|
+
export { FxBuilderWrapperComponent, FxBuilderWrapperService, FxFormWrapperComponent };
|
|
615
|
+
//# sourceMappingURL=fx-form-builder-wrapper.mjs.map
|