@ilhombek/base-form 0.0.1 → 0.0.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.
- package/fesm2022/ilhombek-base-form.mjs +640 -24
- package/fesm2022/ilhombek-base-form.mjs.map +1 -1
- package/lib/components/datepicker/datepicker.component.d.ts +20 -0
- package/lib/components/dynamic-form-field/dynamic-form-field.component.d.ts +15 -0
- package/lib/components/dynamic-form.component.d.ts +9 -0
- package/lib/components/multi-select/multi-select.component.d.ts +30 -0
- package/lib/components/password-input/password-input.component.d.ts +20 -0
- package/lib/components/select-input/select-input.component.d.ts +30 -0
- package/lib/components/text-input/text-input.component.d.ts +20 -0
- package/lib/components/text-input-number/number-input.component.d.ts +21 -0
- package/lib/components/textarea-input/textarea-input.component.d.ts +19 -0
- package/lib/components/time-picker/time-picker.component.d.ts +19 -0
- package/lib/core/dynamic-form/question-base.d.ts +17 -0
- package/lib/core/dynamic-form/question-datepicker.d.ts +11 -0
- package/lib/core/dynamic-form/question-multi-select.d.ts +16 -0
- package/lib/core/dynamic-form/question-password-input.d.ts +5 -0
- package/lib/core/dynamic-form/question-select-input.d.ts +34 -0
- package/lib/core/dynamic-form/question-text-input.d.ts +5 -0
- package/lib/core/dynamic-form/question-textarea.d.ts +5 -0
- package/lib/core/dynamic-form/question-time-picker.d.ts +12 -0
- package/lib/core/enums/async-option.enum.d.ts +9 -0
- package/lib/core/enums/option-type.enum.d.ts +4 -0
- package/lib/core/enums/question-type.enum.d.ts +13 -0
- package/lib/core/models/question-base.d.ts +26 -0
- package/lib/services/question-control.service.d.ts +9 -0
- package/package.json +1 -1
- package/public-api.d.ts +23 -2
|
@@ -1,33 +1,649 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { forwardRef, input, output, ChangeDetectionStrategy, Component, computed, Injectable } from '@angular/core';
|
|
3
|
+
import * as i3 from '@angular/forms';
|
|
4
|
+
import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule, FormControl, Validators, FormGroup } from '@angular/forms';
|
|
5
|
+
import * as i2 from '@angular/common';
|
|
6
|
+
import { CommonModule } from '@angular/common';
|
|
7
|
+
import * as i1 from 'primeng/inputtext';
|
|
8
|
+
import { InputTextModule } from 'primeng/inputtext';
|
|
9
|
+
import * as i1$1 from 'primeng/select';
|
|
10
|
+
import { SelectModule } from 'primeng/select';
|
|
11
|
+
import { of, debounceTime } from 'rxjs';
|
|
12
|
+
import * as i1$2 from 'primeng/datepicker';
|
|
13
|
+
import { DatePickerModule } from 'primeng/datepicker';
|
|
14
|
+
import * as i1$3 from 'primeng/password';
|
|
15
|
+
import { PasswordModule } from 'primeng/password';
|
|
16
|
+
import * as i1$4 from 'primeng/inputnumber';
|
|
17
|
+
import { InputNumberModule } from 'primeng/inputnumber';
|
|
18
|
+
import * as i1$5 from 'primeng/multiselect';
|
|
19
|
+
import { MultiSelectModule } from 'primeng/multiselect';
|
|
20
|
+
import { ButtonModule } from 'primeng/button';
|
|
3
21
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
22
|
+
const VALUE_ACCESSOR_PROVIDER$7 = {
|
|
23
|
+
provide: NG_VALUE_ACCESSOR,
|
|
24
|
+
useExisting: forwardRef(() => TextInputComponent),
|
|
25
|
+
multi: true
|
|
26
|
+
};
|
|
27
|
+
class TextInputComponent {
|
|
28
|
+
label = input();
|
|
29
|
+
icon = input();
|
|
30
|
+
placeholder = input('');
|
|
31
|
+
onChangeEmit = output();
|
|
32
|
+
required = input();
|
|
33
|
+
value = '';
|
|
34
|
+
disabled = false;
|
|
35
|
+
onChange = (value) => { };
|
|
36
|
+
onTouched = () => { };
|
|
37
|
+
writeValue(value) {
|
|
38
|
+
this.value = value || '';
|
|
39
|
+
}
|
|
40
|
+
registerOnChange(fn) {
|
|
41
|
+
this.onChange = fn;
|
|
42
|
+
}
|
|
43
|
+
registerOnTouched(fn) {
|
|
44
|
+
this.onTouched = fn;
|
|
45
|
+
}
|
|
46
|
+
setDisabledState(isDisabled) {
|
|
47
|
+
this.disabled = isDisabled;
|
|
48
|
+
}
|
|
49
|
+
handleInput(event) {
|
|
50
|
+
const value = event.target.value;
|
|
51
|
+
this.value = value;
|
|
52
|
+
this.onChange(value);
|
|
53
|
+
this.onChangeEmit.emit(value);
|
|
54
|
+
this.onTouched();
|
|
55
|
+
}
|
|
56
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
57
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: TextInputComponent, isStandalone: true, selector: "base-form-text-input", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChangeEmit: "onChangeEmit" }, providers: [VALUE_ACCESSOR_PROVIDER$7], ngImport: i0, template: "<div class=\"flex flex-col gap-1\">\n @if(label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <span class=\"w-full\" [ngClass]=\"{'p-input-icon-left': icon()}\">\n @if (icon()) {\n <i class=\"pi pi-search\" [ngClass]=\"{'absolute top-[12px]': icon()}\"></i>\n }\n <input pInputText type=\"text\"\n class=\"p-inputtext w-full\"\n [ngClass]=\"{\n '!pl-[40px]': icon(),\n 'ng-invalid ng-dirty': required() && !value,\n }\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [value]=\"value\"\n (input)=\"handleInput($event)\" />\n </span>\n</div>\n", styles: [":host{display:block;flex:1 1 auto;min-width:0}.p-inputtext{border-radius:.5rem;border:1px solid #e5e7eb}.p-inputtext:focus{box-shadow:0 0 0 2px #3b82f680;border-color:#3b82f6}.p-input-icon-left>i:first-of-type{left:1rem}.p-input-icon-left{position:relative}\n"], dependencies: [{ kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i1.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8
58
|
}
|
|
9
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type:
|
|
10
|
-
type:
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextInputComponent, decorators: [{
|
|
60
|
+
type: Component,
|
|
61
|
+
args: [{ selector: 'base-form-text-input', imports: [InputTextModule, CommonModule], providers: [VALUE_ACCESSOR_PROVIDER$7], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-1\">\n @if(label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <span class=\"w-full\" [ngClass]=\"{'p-input-icon-left': icon()}\">\n @if (icon()) {\n <i class=\"pi pi-search\" [ngClass]=\"{'absolute top-[12px]': icon()}\"></i>\n }\n <input pInputText type=\"text\"\n class=\"p-inputtext w-full\"\n [ngClass]=\"{\n '!pl-[40px]': icon(),\n 'ng-invalid ng-dirty': required() && !value,\n }\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [value]=\"value\"\n (input)=\"handleInput($event)\" />\n </span>\n</div>\n", styles: [":host{display:block;flex:1 1 auto;min-width:0}.p-inputtext{border-radius:.5rem;border:1px solid #e5e7eb}.p-inputtext:focus{box-shadow:0 0 0 2px #3b82f680;border-color:#3b82f6}.p-input-icon-left>i:first-of-type{left:1rem}.p-input-icon-left{position:relative}\n"] }]
|
|
62
|
+
}] });
|
|
63
|
+
|
|
64
|
+
var OptionTypeEnum;
|
|
65
|
+
(function (OptionTypeEnum) {
|
|
66
|
+
OptionTypeEnum["EAGER"] = "eager";
|
|
67
|
+
OptionTypeEnum["ASYNC"] = "async";
|
|
68
|
+
})(OptionTypeEnum || (OptionTypeEnum = {}));
|
|
69
|
+
|
|
70
|
+
const VALUE_ACCESSOR_PROVIDER$6 = {
|
|
71
|
+
provide: NG_VALUE_ACCESSOR,
|
|
72
|
+
useExisting: forwardRef(() => SelectInputComponent),
|
|
73
|
+
multi: true
|
|
74
|
+
};
|
|
75
|
+
class SelectInputComponent {
|
|
76
|
+
label = input();
|
|
77
|
+
options = input();
|
|
78
|
+
optionLabel = input('label');
|
|
79
|
+
optionValue = input('value');
|
|
80
|
+
normalizeValue = input();
|
|
81
|
+
placeholder = input('');
|
|
82
|
+
onChangeEmit = output();
|
|
83
|
+
required = input();
|
|
84
|
+
optionType = input(OptionTypeEnum.EAGER);
|
|
85
|
+
asyncOptionType = input();
|
|
86
|
+
loading = false;
|
|
87
|
+
// private _asyncOptionService = inject(AsyncOptionsService)
|
|
88
|
+
// private _messageService = inject(ToastService)
|
|
89
|
+
_options = [];
|
|
90
|
+
asyncOptionsPipe$ = computed(() => of([]));
|
|
91
|
+
value;
|
|
92
|
+
disabled = false;
|
|
93
|
+
// Callbacks
|
|
94
|
+
onChange = (value) => { };
|
|
95
|
+
onTouched = () => { };
|
|
96
|
+
writeValue(value) {
|
|
97
|
+
this.value = value;
|
|
98
|
+
}
|
|
99
|
+
registerOnChange(fn) {
|
|
100
|
+
this.onChange = fn;
|
|
101
|
+
}
|
|
102
|
+
registerOnTouched(fn) {
|
|
103
|
+
this.onTouched = fn;
|
|
104
|
+
}
|
|
105
|
+
setDisabledState(isDisabled) {
|
|
106
|
+
this.disabled = isDisabled;
|
|
107
|
+
}
|
|
108
|
+
handleChange(event) {
|
|
109
|
+
this.value = event.value;
|
|
110
|
+
const _normalizeValueFc = this.normalizeValue();
|
|
111
|
+
if (_normalizeValueFc instanceof Function) {
|
|
112
|
+
const normalizedValue = _normalizeValueFc(this.value);
|
|
113
|
+
this.onChange(normalizedValue);
|
|
114
|
+
this.onChangeEmit.emit(normalizedValue);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
this.onChange(this.value);
|
|
118
|
+
this.onChangeEmit.emit(this.value);
|
|
119
|
+
}
|
|
120
|
+
this.onTouched();
|
|
121
|
+
}
|
|
122
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SelectInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
123
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: SelectInputComponent, isStandalone: true, selector: "base-form-select-input", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, normalizeValue: { classPropertyName: "normalizeValue", publicName: "normalizeValue", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, optionType: { classPropertyName: "optionType", publicName: "optionType", isSignal: true, isRequired: false, transformFunction: null }, asyncOptionType: { classPropertyName: "asyncOptionType", publicName: "asyncOptionType", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChangeEmit: "onChangeEmit" }, providers: [VALUE_ACCESSOR_PROVIDER$6], ngImport: i0, template: "<div class=\"flex flex-col gap-1\">\n @if (label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <p-select [options]=\"(asyncOptionsPipe$() | async) || []\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n [ngModel]=\"value\"\n [loading]=\"loading\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n appendTo=\"body\"\n (onChange)=\"handleChange($event)\"\n [ngClass]=\"{'ng-invalid': required() && !value}\"\n ></p-select>\n</div>\n", styles: [":host{display:block}.p-dropdown{border-radius:.5rem;border:1px solid #e5e7eb}.p-dropdown:not(.p-disabled):hover{border-color:#3b82f6}.p-dropdown:not(.p-disabled).p-focus{box-shadow:0 0 0 2px #3b82f680;border-color:#3b82f6}\n"], dependencies: [{ kind: "ngmodule", type: SelectModule }, { kind: "component", type: i1$1.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
124
|
+
}
|
|
125
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SelectInputComponent, decorators: [{
|
|
126
|
+
type: Component,
|
|
127
|
+
args: [{ selector: 'base-form-select-input', imports: [SelectModule, FormsModule, CommonModule], providers: [VALUE_ACCESSOR_PROVIDER$6], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-1\">\n @if (label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <p-select [options]=\"(asyncOptionsPipe$() | async) || []\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n [ngModel]=\"value\"\n [loading]=\"loading\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n appendTo=\"body\"\n (onChange)=\"handleChange($event)\"\n [ngClass]=\"{'ng-invalid': required() && !value}\"\n ></p-select>\n</div>\n", styles: [":host{display:block}.p-dropdown{border-radius:.5rem;border:1px solid #e5e7eb}.p-dropdown:not(.p-disabled):hover{border-color:#3b82f6}.p-dropdown:not(.p-disabled).p-focus{box-shadow:0 0 0 2px #3b82f680;border-color:#3b82f6}\n"] }]
|
|
128
|
+
}] });
|
|
129
|
+
|
|
130
|
+
const VALUE_ACCESSOR_PROVIDER$5 = {
|
|
131
|
+
provide: NG_VALUE_ACCESSOR,
|
|
132
|
+
useExisting: forwardRef(() => DatepickerComponent),
|
|
133
|
+
multi: true
|
|
134
|
+
};
|
|
135
|
+
class DatepickerComponent {
|
|
136
|
+
label = input();
|
|
137
|
+
onChangeEmit = output();
|
|
138
|
+
required = input();
|
|
139
|
+
view = input("date");
|
|
140
|
+
value;
|
|
141
|
+
disabled = false;
|
|
142
|
+
// Callbacks
|
|
143
|
+
onChange = (value) => { };
|
|
144
|
+
onTouched = () => { };
|
|
145
|
+
writeValue(value) {
|
|
146
|
+
if (this.view() === 'year') {
|
|
147
|
+
this.value = new Date(value, 0, 1);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
this.value = value;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
registerOnChange(fn) {
|
|
154
|
+
this.onChange = fn;
|
|
155
|
+
}
|
|
156
|
+
registerOnTouched(fn) {
|
|
157
|
+
this.onTouched = fn;
|
|
158
|
+
}
|
|
159
|
+
setDisabledState(isDisabled) {
|
|
160
|
+
this.disabled = isDisabled;
|
|
161
|
+
}
|
|
162
|
+
handleChange(event) {
|
|
163
|
+
const date = new Date(event);
|
|
164
|
+
const dates = [date.getDay(), date.getMonth(), date.getFullYear()];
|
|
165
|
+
const formatedValue = this.view() === 'year' ? dates[2] : this.view() === 'month' ? dates[1] : dates.join('-');
|
|
166
|
+
this.value = event;
|
|
167
|
+
this.onChange(formatedValue);
|
|
168
|
+
this.onChangeEmit.emit(this.value);
|
|
169
|
+
this.onTouched();
|
|
170
|
+
}
|
|
171
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DatepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
172
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: DatepickerComponent, isStandalone: true, selector: "base-form-datepicker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChangeEmit: "onChangeEmit" }, providers: [VALUE_ACCESSOR_PROVIDER$5], ngImport: i0, template: "<div class=\"flex flex-col gap-1\">\n @if (label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <p-datepicker [iconDisplay]=\"'input'\"\n [ngClass]=\"{'ng-invalid ng-dirty': required() && !value}\"\n [showIcon]=\"true\"\n [view]=\"view()\"\n [ngModel]=\"value\"\n [dateFormat]=\"view() === 'year' ? 'yy' : view() === 'month' ? 'mm' : 'dd-mm-yy'\"\n (onSelect)=\"handleChange($event)\"\n appendTo=\"body\"\n inputId=\"icondisplay\" />\n</div>\n\n", styles: [":host{display:block}::ng-deep .p-datepicker{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i1$2.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "fluid", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "size", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
173
|
+
}
|
|
174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DatepickerComponent, decorators: [{
|
|
175
|
+
type: Component,
|
|
176
|
+
args: [{ selector: 'base-form-datepicker', imports: [DatePickerModule, CommonModule, FormsModule], providers: [VALUE_ACCESSOR_PROVIDER$5], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-1\">\n @if (label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <p-datepicker [iconDisplay]=\"'input'\"\n [ngClass]=\"{'ng-invalid ng-dirty': required() && !value}\"\n [showIcon]=\"true\"\n [view]=\"view()\"\n [ngModel]=\"value\"\n [dateFormat]=\"view() === 'year' ? 'yy' : view() === 'month' ? 'mm' : 'dd-mm-yy'\"\n (onSelect)=\"handleChange($event)\"\n appendTo=\"body\"\n inputId=\"icondisplay\" />\n</div>\n\n", styles: [":host{display:block}::ng-deep .p-datepicker{width:100%}\n"] }]
|
|
177
|
+
}] });
|
|
178
|
+
|
|
179
|
+
const VALUE_ACCESSOR_PROVIDER$4 = {
|
|
180
|
+
provide: NG_VALUE_ACCESSOR,
|
|
181
|
+
useExisting: forwardRef(() => PasswordInputComponent),
|
|
182
|
+
multi: true
|
|
183
|
+
};
|
|
184
|
+
class PasswordInputComponent {
|
|
185
|
+
label = input();
|
|
186
|
+
icon = input();
|
|
187
|
+
placeholder = input('');
|
|
188
|
+
onChangeEmit = output();
|
|
189
|
+
required = input();
|
|
190
|
+
value = '';
|
|
191
|
+
disabled = false;
|
|
192
|
+
onChange = (value) => { };
|
|
193
|
+
onTouched = () => { };
|
|
194
|
+
writeValue(value) {
|
|
195
|
+
this.value = value || '';
|
|
196
|
+
}
|
|
197
|
+
registerOnChange(fn) {
|
|
198
|
+
this.onChange = fn;
|
|
199
|
+
}
|
|
200
|
+
registerOnTouched(fn) {
|
|
201
|
+
this.onTouched = fn;
|
|
202
|
+
}
|
|
203
|
+
setDisabledState(isDisabled) {
|
|
204
|
+
this.disabled = isDisabled;
|
|
205
|
+
}
|
|
206
|
+
handleInput(event) {
|
|
207
|
+
const value = event.target.value;
|
|
208
|
+
this.value = value;
|
|
209
|
+
this.onChange(value);
|
|
210
|
+
this.onChangeEmit.emit(value);
|
|
211
|
+
this.onTouched();
|
|
212
|
+
}
|
|
213
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: PasswordInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
214
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: PasswordInputComponent, isStandalone: true, selector: "base-form-password-input", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChangeEmit: "onChangeEmit" }, providers: [VALUE_ACCESSOR_PROVIDER$4], ngImport: i0, template: "<div class=\"flex flex-col gap-1\">\n @if(label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <span class=\"w-full\" [ngClass]=\"{'p-input-icon-left': icon()}\">\n @if (icon()) {\n <i class=\"pi pi-search\" [ngClass]=\"{'absolute top-[12px]': icon()}\"></i>\n }\n <p-password id=\"password\"\n [feedback]=\"false\"\n showClear=\"true\"\n (input)=\"handleInput($event)\"\n [ngClass]=\"{'!pl-[40px]': icon(), 'ng-invalid ng-dirty': required() && !value}\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n class=\" w-full\" />\n </span>\n</div>\n", styles: [":host{display:block;flex:1 1 auto;min-width:0}.p-inputtext{border-radius:.5rem;border:1px solid #e5e7eb}.p-inputtext:focus{box-shadow:0 0 0 2px #3b82f680;border-color:#3b82f6}.p-input-icon-left>i:first-of-type{left:1rem}.p-input-icon-left{position:relative}\n"], dependencies: [{ kind: "ngmodule", type: PasswordModule }, { kind: "component", type: i1$3.Password, selector: "p-password", inputs: ["ariaLabel", "fluid", "ariaLabelledBy", "label", "disabled", "promptLabel", "mediumRegex", "strongRegex", "weakLabel", "mediumLabel", "maxLength", "strongLabel", "inputId", "feedback", "appendTo", "toggleMask", "size", "inputStyleClass", "styleClass", "style", "inputStyle", "showTransitionOptions", "hideTransitionOptions", "autocomplete", "placeholder", "showClear", "autofocus", "variant", "tabindex"], outputs: ["onFocus", "onBlur", "onClear"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
215
|
+
}
|
|
216
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: PasswordInputComponent, decorators: [{
|
|
217
|
+
type: Component,
|
|
218
|
+
args: [{ selector: 'base-form-password-input', imports: [PasswordModule, CommonModule], providers: [VALUE_ACCESSOR_PROVIDER$4], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-1\">\n @if(label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <span class=\"w-full\" [ngClass]=\"{'p-input-icon-left': icon()}\">\n @if (icon()) {\n <i class=\"pi pi-search\" [ngClass]=\"{'absolute top-[12px]': icon()}\"></i>\n }\n <p-password id=\"password\"\n [feedback]=\"false\"\n showClear=\"true\"\n (input)=\"handleInput($event)\"\n [ngClass]=\"{'!pl-[40px]': icon(), 'ng-invalid ng-dirty': required() && !value}\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n class=\" w-full\" />\n </span>\n</div>\n", styles: [":host{display:block;flex:1 1 auto;min-width:0}.p-inputtext{border-radius:.5rem;border:1px solid #e5e7eb}.p-inputtext:focus{box-shadow:0 0 0 2px #3b82f680;border-color:#3b82f6}.p-input-icon-left>i:first-of-type{left:1rem}.p-input-icon-left{position:relative}\n"] }]
|
|
219
|
+
}] });
|
|
220
|
+
|
|
221
|
+
const VALUE_ACCESSOR_PROVIDER$3 = {
|
|
222
|
+
provide: NG_VALUE_ACCESSOR,
|
|
223
|
+
useExisting: forwardRef(() => NumberInputComponent),
|
|
224
|
+
multi: true
|
|
225
|
+
};
|
|
226
|
+
class NumberInputComponent {
|
|
227
|
+
label = input();
|
|
228
|
+
placeholder = input('');
|
|
229
|
+
min = input(0);
|
|
230
|
+
max = input();
|
|
231
|
+
required = input();
|
|
232
|
+
onChangeEmit = output();
|
|
233
|
+
value;
|
|
234
|
+
disabled = false;
|
|
235
|
+
onChange = (value) => { };
|
|
236
|
+
onTouched = () => { };
|
|
237
|
+
writeValue(value) {
|
|
238
|
+
this.value = value || '';
|
|
239
|
+
this.onChange(this.value);
|
|
240
|
+
}
|
|
241
|
+
registerOnChange(fn) {
|
|
242
|
+
this.onChange = fn;
|
|
243
|
+
}
|
|
244
|
+
registerOnTouched(fn) {
|
|
245
|
+
this.onTouched = fn;
|
|
246
|
+
}
|
|
247
|
+
setDisabledState(isDisabled) {
|
|
248
|
+
this.disabled = isDisabled;
|
|
249
|
+
}
|
|
250
|
+
handleInput({ value }) {
|
|
251
|
+
this.value = value;
|
|
252
|
+
this.onChange(value);
|
|
253
|
+
this.onChangeEmit.emit(value);
|
|
254
|
+
this.onTouched();
|
|
255
|
+
}
|
|
256
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: NumberInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
257
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: NumberInputComponent, isStandalone: true, selector: "base-form-number-input", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChangeEmit: "onChangeEmit" }, providers: [VALUE_ACCESSOR_PROVIDER$3], ngImport: i0, template: "<div class=\"flex flex-col gap-1\">\n @if(label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <p-inputNumber [min]=\"min()\"\n [max]=\"max()\"\n [ngModel]=\"value\"\n [fluid]=\"true\"\n [placeholder]=\"placeholder()\"\n (onInput)=\"handleInput($event)\"\n [showButtons]=\"true\"\n class=\"p-inputnumber w-full\" [ngClass]=\"{'ng-invalid ng-dirty': required() && !value}\">\n </p-inputNumber>\n</div>\n", styles: [":host{display:block}.p-inputnumber{border-radius:.5rem}::ng-deep .p-inputtext:enabled:focus{box-shadow:0 0 0 2px #3b82f680;border-color:#3b82f6}\n"], dependencies: [{ kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i1$4.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled", "fluid"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
258
|
+
}
|
|
259
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: NumberInputComponent, decorators: [{
|
|
260
|
+
type: Component,
|
|
261
|
+
args: [{ selector: 'base-form-number-input', imports: [InputNumberModule, CommonModule, FormsModule], providers: [VALUE_ACCESSOR_PROVIDER$3], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-1\">\n @if(label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <p-inputNumber [min]=\"min()\"\n [max]=\"max()\"\n [ngModel]=\"value\"\n [fluid]=\"true\"\n [placeholder]=\"placeholder()\"\n (onInput)=\"handleInput($event)\"\n [showButtons]=\"true\"\n class=\"p-inputnumber w-full\" [ngClass]=\"{'ng-invalid ng-dirty': required() && !value}\">\n </p-inputNumber>\n</div>\n", styles: [":host{display:block}.p-inputnumber{border-radius:.5rem}::ng-deep .p-inputtext:enabled:focus{box-shadow:0 0 0 2px #3b82f680;border-color:#3b82f6}\n"] }]
|
|
262
|
+
}] });
|
|
263
|
+
|
|
264
|
+
var QuestionTypeEnum;
|
|
265
|
+
(function (QuestionTypeEnum) {
|
|
266
|
+
QuestionTypeEnum["TextInput"] = "textInput";
|
|
267
|
+
QuestionTypeEnum["SelectInput"] = "selectInput";
|
|
268
|
+
QuestionTypeEnum["DatePicker"] = "datePicker";
|
|
269
|
+
QuestionTypeEnum["TextArea"] = "textArea";
|
|
270
|
+
QuestionTypeEnum["TimePicker"] = "timePicker";
|
|
271
|
+
QuestionTypeEnum["MultiSelect"] = "multiSelect";
|
|
272
|
+
})(QuestionTypeEnum || (QuestionTypeEnum = {}));
|
|
273
|
+
var QuestionFieldTypeEnum;
|
|
274
|
+
(function (QuestionFieldTypeEnum) {
|
|
275
|
+
QuestionFieldTypeEnum["Number"] = "number";
|
|
276
|
+
QuestionFieldTypeEnum["Email"] = "email";
|
|
277
|
+
QuestionFieldTypeEnum["Password"] = "password";
|
|
278
|
+
})(QuestionFieldTypeEnum || (QuestionFieldTypeEnum = {}));
|
|
279
|
+
|
|
280
|
+
const VALUE_ACCESSOR_PROVIDER$2 = {
|
|
281
|
+
provide: NG_VALUE_ACCESSOR,
|
|
282
|
+
useExisting: forwardRef(() => TimePickerComponent),
|
|
283
|
+
multi: true
|
|
284
|
+
};
|
|
285
|
+
class TimePickerComponent {
|
|
286
|
+
label = input();
|
|
287
|
+
hourFormat = input('24');
|
|
288
|
+
onChangeEmit = output();
|
|
289
|
+
required = input();
|
|
290
|
+
value;
|
|
291
|
+
disabled = false;
|
|
292
|
+
// Callbacks
|
|
293
|
+
onChange = (value) => { };
|
|
294
|
+
onTouched = () => { };
|
|
295
|
+
writeValue(value) {
|
|
296
|
+
if (value) {
|
|
297
|
+
const [h, m] = value.split(":").map(Number);
|
|
298
|
+
this.value = new Date(1970, 0, 1, h, m);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
registerOnChange(fn) {
|
|
302
|
+
this.onChange = fn;
|
|
303
|
+
}
|
|
304
|
+
registerOnTouched(fn) {
|
|
305
|
+
this.onTouched = fn;
|
|
306
|
+
}
|
|
307
|
+
setDisabledState(isDisabled) {
|
|
308
|
+
this.disabled = isDisabled;
|
|
309
|
+
}
|
|
310
|
+
handleChange(event) {
|
|
311
|
+
const date = new Date(event);
|
|
312
|
+
const dates = [date.getMinutes(), date.getHours()];
|
|
313
|
+
this.value = event;
|
|
314
|
+
this.onChange(`${dates[1]}:${dates[0]}`);
|
|
315
|
+
this.onChangeEmit.emit(this.value);
|
|
316
|
+
this.onTouched();
|
|
317
|
+
}
|
|
318
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TimePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
319
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: TimePickerComponent, isStandalone: true, selector: "base-form-time-picker", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hourFormat: { classPropertyName: "hourFormat", publicName: "hourFormat", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChangeEmit: "onChangeEmit" }, providers: [VALUE_ACCESSOR_PROVIDER$2], ngImport: i0, template: "<div class=\"flex flex-col gap-1\">\n @if (label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <p-datepicker [iconDisplay]=\"'input'\"\n [ngClass]=\"{'ng-invalid ng-dirty': required() && !value}\"\n [showIcon]=\"true\"\n (onSelect)=\"handleChange($event)\"\n appendTo=\"body\"\n [ngModel]=\"value\"\n [timeOnly]=\"true\"\n [hourFormat]=\"hourFormat()\"\n inputId=\"icondisplay\" />\n</div>\n\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i1$2.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "fluid", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "size", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
320
|
+
}
|
|
321
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TimePickerComponent, decorators: [{
|
|
322
|
+
type: Component,
|
|
323
|
+
args: [{ selector: 'base-form-time-picker', imports: [DatePickerModule, CommonModule, FormsModule], providers: [VALUE_ACCESSOR_PROVIDER$2], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-1\">\n @if (label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <p-datepicker [iconDisplay]=\"'input'\"\n [ngClass]=\"{'ng-invalid ng-dirty': required() && !value}\"\n [showIcon]=\"true\"\n (onSelect)=\"handleChange($event)\"\n appendTo=\"body\"\n [ngModel]=\"value\"\n [timeOnly]=\"true\"\n [hourFormat]=\"hourFormat()\"\n inputId=\"icondisplay\" />\n</div>\n\n", styles: [":host{display:block}\n"] }]
|
|
324
|
+
}] });
|
|
325
|
+
|
|
326
|
+
const VALUE_ACCESSOR_PROVIDER$1 = {
|
|
327
|
+
provide: NG_VALUE_ACCESSOR,
|
|
328
|
+
useExisting: forwardRef(() => TextareaInputComponent),
|
|
329
|
+
multi: true
|
|
330
|
+
};
|
|
331
|
+
class TextareaInputComponent {
|
|
332
|
+
label = input();
|
|
333
|
+
placeholder = input('');
|
|
334
|
+
required = input();
|
|
335
|
+
onChangeEmit = output();
|
|
336
|
+
value = '';
|
|
337
|
+
disabled = false;
|
|
338
|
+
onChange = (value) => { };
|
|
339
|
+
onTouched = () => { };
|
|
340
|
+
writeValue(value) {
|
|
341
|
+
this.value = value || '';
|
|
342
|
+
}
|
|
343
|
+
registerOnChange(fn) {
|
|
344
|
+
this.onChange = fn;
|
|
345
|
+
}
|
|
346
|
+
registerOnTouched(fn) {
|
|
347
|
+
this.onTouched = fn;
|
|
348
|
+
}
|
|
349
|
+
setDisabledState(isDisabled) {
|
|
350
|
+
this.disabled = isDisabled;
|
|
351
|
+
}
|
|
352
|
+
handleInput(event) {
|
|
353
|
+
const value = event.target.value;
|
|
354
|
+
this.value = value;
|
|
355
|
+
this.onChange(value);
|
|
356
|
+
this.onChangeEmit.emit(value);
|
|
357
|
+
this.onTouched();
|
|
358
|
+
}
|
|
359
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextareaInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
360
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: TextareaInputComponent, isStandalone: true, selector: "base-form-textarea-input", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChangeEmit: "onChangeEmit" }, providers: [VALUE_ACCESSOR_PROVIDER$1], ngImport: i0, template: "<div class=\"flex flex-col gap-1\">\n @if(label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <span class=\"w-full\">\n <textarea pInputTextarea rows=\"3\" class=\"p-inputtext w-full\" [placeholder]=\"placeholder()\" [disabled]=\"disabled\"\n [ngClass]=\"{'ng-invalid ng-dirty': required() && !value}\"\n [value]=\"value\" (input)=\"handleInput($event)\"></textarea>\n </span>\n</div>\n", styles: [":host{display:block}.p-inputtext{border-radius:.5rem;border:1px solid #e5e7eb}.p-inputtext:focus{box-shadow:0 0 0 2px #3b82f680;border-color:#3b82f6}.p-input-icon-left>i:first-of-type{left:1rem}.p-input-icon-left{position:relative}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
361
|
+
}
|
|
362
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextareaInputComponent, decorators: [{
|
|
363
|
+
type: Component,
|
|
364
|
+
args: [{ selector: 'base-form-textarea-input', imports: [CommonModule], providers: [VALUE_ACCESSOR_PROVIDER$1], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-1\">\n @if(label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <span class=\"w-full\">\n <textarea pInputTextarea rows=\"3\" class=\"p-inputtext w-full\" [placeholder]=\"placeholder()\" [disabled]=\"disabled\"\n [ngClass]=\"{'ng-invalid ng-dirty': required() && !value}\"\n [value]=\"value\" (input)=\"handleInput($event)\"></textarea>\n </span>\n</div>\n", styles: [":host{display:block}.p-inputtext{border-radius:.5rem;border:1px solid #e5e7eb}.p-inputtext:focus{box-shadow:0 0 0 2px #3b82f680;border-color:#3b82f6}.p-input-icon-left>i:first-of-type{left:1rem}.p-input-icon-left{position:relative}\n"] }]
|
|
365
|
+
}] });
|
|
366
|
+
|
|
367
|
+
const VALUE_ACCESSOR_PROVIDER = {
|
|
368
|
+
provide: NG_VALUE_ACCESSOR,
|
|
369
|
+
useExisting: forwardRef(() => MultiSelectComponent),
|
|
370
|
+
multi: true
|
|
371
|
+
};
|
|
372
|
+
class MultiSelectComponent {
|
|
373
|
+
label = input();
|
|
374
|
+
options = input.required();
|
|
375
|
+
optionLabel = input('label');
|
|
376
|
+
optionValue = input('value');
|
|
377
|
+
normalizeValue = input();
|
|
378
|
+
placeholder = input('');
|
|
379
|
+
onChangeEmit = output();
|
|
380
|
+
required = input();
|
|
381
|
+
optionType = input();
|
|
382
|
+
asyncOptionType = input();
|
|
383
|
+
value = [];
|
|
384
|
+
disabled = false;
|
|
385
|
+
loading = false;
|
|
386
|
+
// private _asyncOptionService = inject(AsyncOptionsService)
|
|
387
|
+
// private _messageService = inject(ToastService)
|
|
388
|
+
_options = [];
|
|
389
|
+
asyncOptionsPipe$ = computed(() => of([]));
|
|
390
|
+
// Callbacks
|
|
391
|
+
onChange = (value) => { };
|
|
392
|
+
onTouched = () => { };
|
|
393
|
+
writeValue(value) {
|
|
394
|
+
this.value = value?.map((opt) => opt[this.optionValue()]);
|
|
395
|
+
}
|
|
396
|
+
registerOnChange(fn) {
|
|
397
|
+
this.onChange = fn;
|
|
398
|
+
}
|
|
399
|
+
registerOnTouched(fn) {
|
|
400
|
+
this.onTouched = fn;
|
|
401
|
+
}
|
|
402
|
+
setDisabledState(isDisabled) {
|
|
403
|
+
this.disabled = isDisabled;
|
|
404
|
+
}
|
|
405
|
+
handleChange(event) {
|
|
406
|
+
this.value = event.value;
|
|
407
|
+
const _normalizeValueFc = this.normalizeValue();
|
|
408
|
+
if (_normalizeValueFc instanceof Function) {
|
|
409
|
+
const normalizedValue = _normalizeValueFc(this.value, this._options);
|
|
410
|
+
this.onChange(normalizedValue);
|
|
411
|
+
this.onChangeEmit.emit(normalizedValue);
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
this.onChange(this.value);
|
|
415
|
+
this.onChangeEmit.emit(this.value);
|
|
416
|
+
}
|
|
417
|
+
this.onTouched();
|
|
418
|
+
}
|
|
419
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MultiSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
420
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: MultiSelectComponent, isStandalone: true, selector: "base-form-multi-select", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, normalizeValue: { classPropertyName: "normalizeValue", publicName: "normalizeValue", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, optionType: { classPropertyName: "optionType", publicName: "optionType", isSignal: true, isRequired: false, transformFunction: null }, asyncOptionType: { classPropertyName: "asyncOptionType", publicName: "asyncOptionType", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChangeEmit: "onChangeEmit" }, providers: [VALUE_ACCESSOR_PROVIDER], ngImport: i0, template: "<div class=\"flex flex-col gap-1\">\n @if (label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <p-multiselect [options]=\"(asyncOptionsPipe$() | async) || []\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n [placeholder]=\"placeholder()\"\n [ngModel]=\"value\"\n (onChange)=\"handleChange($event)\"\n [disabled]=\"disabled\"\n [loading]=\"loading\"\n appendTo=\"body\"\n [ngClass]=\"{'ng-invalid ng-dirty': required() && !value?.length}\"\n />\n</div>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i1$5.MultiSelect, selector: "p-multiSelect, p-multiselect, p-multi-select", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "fluid", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "chipIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "size", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus", "highlightOnSelect"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
421
|
+
}
|
|
422
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: MultiSelectComponent, decorators: [{
|
|
423
|
+
type: Component,
|
|
424
|
+
args: [{ selector: 'base-form-multi-select', imports: [MultiSelectModule, CommonModule, FormsModule], providers: [VALUE_ACCESSOR_PROVIDER], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-1\">\n @if (label()) {\n <label class=\"text-sm font-medium text-gray-700\">{{ label() }}</label>\n }\n <p-multiselect [options]=\"(asyncOptionsPipe$() | async) || []\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n [placeholder]=\"placeholder()\"\n [ngModel]=\"value\"\n (onChange)=\"handleChange($event)\"\n [disabled]=\"disabled\"\n [loading]=\"loading\"\n appendTo=\"body\"\n [ngClass]=\"{'ng-invalid ng-dirty': required() && !value?.length}\"\n />\n</div>\n", styles: [":host{display:block}\n"] }]
|
|
425
|
+
}] });
|
|
426
|
+
|
|
427
|
+
class DynamicFormFieldComponent {
|
|
428
|
+
question = input.required();
|
|
429
|
+
form = input.required();
|
|
430
|
+
QuestionTypeEnum = QuestionTypeEnum;
|
|
431
|
+
QuestionFieldTypeEnum = QuestionFieldTypeEnum;
|
|
432
|
+
OptionTypeEnum = OptionTypeEnum;
|
|
433
|
+
get isValid() {
|
|
434
|
+
return this.form().controls[this.question().key].valid;
|
|
435
|
+
}
|
|
436
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicFormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
437
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: DynamicFormFieldComponent, isStandalone: true, selector: "base-form-dynamic-form-field", inputs: { question: { classPropertyName: "question", publicName: "question", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div [formGroup]=\"form()\">\n <label class=\"text-sm font-medium text-gray-700\" [attr.for]=\"question().key\">\n {{ question().label }} @if(question().required) {<span class=\"text-red-500\">*</span>}\n </label>\n <div>\n @switch (question().controlType) {\n @case (QuestionTypeEnum.TextInput) {\n @if (question().type === QuestionFieldTypeEnum.Number) {\n <base-form-number-input [formControlName]=\"question().key\"\n [id]=\"question().key\"\n [required]=\"question().required\"\n [placeholder]=\"question().placeholder\"/>\n } @else if(question().type === QuestionFieldTypeEnum.Password) {\n <base-form-password-input [formControlName]=\"question().key\"\n [id]=\"question().key\"\n [required]=\"question().required\"\n [placeholder]=\"question().placeholder\"\n />\n } @else {\n <base-form-text-input [formControlName]=\"question().key\"\n [id]=\"question().key\"\n [required]=\"question().required\"\n [placeholder]=\"question().placeholder\"/>\n }\n }\n @case (QuestionTypeEnum.SelectInput) {\n <base-form-select-input [options]=\"$any(question()).options\"\n [formControlName]=\"question().key\"\n [required]=\"question().required\"\n [optionLabel]=\"$any(question()).optionLabel\"\n [optionValue]=\"$any(question()).optionValue\"\n [optionType]=\"$any(question()).optionType\"\n [asyncOptionType]=\"$any(question()).asyncOptionType\"\n [placeholder]=\"question().placeholder\"\n [normalizeValue]=\"$any(question()).normalizeValue\"\n />\n }\n @case (QuestionTypeEnum.MultiSelect) {\n <base-form-multi-select [options]=\"$any(question()).options\"\n [formControlName]=\"question().key\"\n [optionLabel]=\"$any(question()).optionLabel\"\n [optionValue]=\"$any(question()).optionValue\"\n [normalizeValue]=\"$any(question()).normalizeValue\"\n [optionType]=\"$any(question()).optionType\"\n [asyncOptionType]=\"$any(question()).asyncOptionType\"\n [required]=\"question().required\"\n [placeholder]=\"question().placeholder\"/>\n }\n @case (QuestionTypeEnum.DatePicker) {\n <base-form-datepicker [formControlName]=\"question().key\"\n [required]=\"question().required\"\n [view]=\"$any(question()).view\"\n />\n }\n @case (QuestionTypeEnum.TextArea) {\n <base-form-textarea-input [formControlName]=\"question().key\"\n [required]=\"question().required\"/>\n }\n @case (QuestionTypeEnum.TimePicker) {\n <base-form-time-picker [formControlName]=\"question().key\"\n [required]=\"question().required\"\n [hourFormat]=\"$any(question()).hourFormat\"\n />\n }\n }\n </div>\n</div>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: TextInputComponent, selector: "base-form-text-input", inputs: ["label", "icon", "placeholder", "required"], outputs: ["onChangeEmit"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: NumberInputComponent, selector: "base-form-number-input", inputs: ["label", "placeholder", "min", "max", "required"], outputs: ["onChangeEmit"] }, { kind: "component", type: DatepickerComponent, selector: "base-form-datepicker", inputs: ["label", "required", "view"], outputs: ["onChangeEmit"] }, { kind: "component", type: TimePickerComponent, selector: "base-form-time-picker", inputs: ["label", "hourFormat", "required"], outputs: ["onChangeEmit"] }, { kind: "component", type: SelectInputComponent, selector: "base-form-select-input", inputs: ["label", "options", "optionLabel", "optionValue", "normalizeValue", "placeholder", "required", "optionType", "asyncOptionType"], outputs: ["onChangeEmit"] }, { kind: "component", type: TextareaInputComponent, selector: "base-form-textarea-input", inputs: ["label", "placeholder", "required"], outputs: ["onChangeEmit"] }, { kind: "component", type: MultiSelectComponent, selector: "base-form-multi-select", inputs: ["label", "options", "optionLabel", "optionValue", "normalizeValue", "placeholder", "required", "optionType", "asyncOptionType"], outputs: ["onChangeEmit"] }, { kind: "component", type: PasswordInputComponent, selector: "base-form-password-input", inputs: ["label", "icon", "placeholder", "required"], outputs: ["onChangeEmit"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
438
|
+
}
|
|
439
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicFormFieldComponent, decorators: [{
|
|
440
|
+
type: Component,
|
|
441
|
+
args: [{ selector: 'base-form-dynamic-form-field', imports: [
|
|
442
|
+
TextInputComponent,
|
|
443
|
+
ReactiveFormsModule,
|
|
444
|
+
NumberInputComponent,
|
|
445
|
+
DatepickerComponent,
|
|
446
|
+
TimePickerComponent,
|
|
447
|
+
SelectInputComponent,
|
|
448
|
+
TextareaInputComponent,
|
|
449
|
+
MultiSelectComponent,
|
|
450
|
+
PasswordInputComponent
|
|
451
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [formGroup]=\"form()\">\n <label class=\"text-sm font-medium text-gray-700\" [attr.for]=\"question().key\">\n {{ question().label }} @if(question().required) {<span class=\"text-red-500\">*</span>}\n </label>\n <div>\n @switch (question().controlType) {\n @case (QuestionTypeEnum.TextInput) {\n @if (question().type === QuestionFieldTypeEnum.Number) {\n <base-form-number-input [formControlName]=\"question().key\"\n [id]=\"question().key\"\n [required]=\"question().required\"\n [placeholder]=\"question().placeholder\"/>\n } @else if(question().type === QuestionFieldTypeEnum.Password) {\n <base-form-password-input [formControlName]=\"question().key\"\n [id]=\"question().key\"\n [required]=\"question().required\"\n [placeholder]=\"question().placeholder\"\n />\n } @else {\n <base-form-text-input [formControlName]=\"question().key\"\n [id]=\"question().key\"\n [required]=\"question().required\"\n [placeholder]=\"question().placeholder\"/>\n }\n }\n @case (QuestionTypeEnum.SelectInput) {\n <base-form-select-input [options]=\"$any(question()).options\"\n [formControlName]=\"question().key\"\n [required]=\"question().required\"\n [optionLabel]=\"$any(question()).optionLabel\"\n [optionValue]=\"$any(question()).optionValue\"\n [optionType]=\"$any(question()).optionType\"\n [asyncOptionType]=\"$any(question()).asyncOptionType\"\n [placeholder]=\"question().placeholder\"\n [normalizeValue]=\"$any(question()).normalizeValue\"\n />\n }\n @case (QuestionTypeEnum.MultiSelect) {\n <base-form-multi-select [options]=\"$any(question()).options\"\n [formControlName]=\"question().key\"\n [optionLabel]=\"$any(question()).optionLabel\"\n [optionValue]=\"$any(question()).optionValue\"\n [normalizeValue]=\"$any(question()).normalizeValue\"\n [optionType]=\"$any(question()).optionType\"\n [asyncOptionType]=\"$any(question()).asyncOptionType\"\n [required]=\"question().required\"\n [placeholder]=\"question().placeholder\"/>\n }\n @case (QuestionTypeEnum.DatePicker) {\n <base-form-datepicker [formControlName]=\"question().key\"\n [required]=\"question().required\"\n [view]=\"$any(question()).view\"\n />\n }\n @case (QuestionTypeEnum.TextArea) {\n <base-form-textarea-input [formControlName]=\"question().key\"\n [required]=\"question().required\"/>\n }\n @case (QuestionTypeEnum.TimePicker) {\n <base-form-time-picker [formControlName]=\"question().key\"\n [required]=\"question().required\"\n [hourFormat]=\"$any(question()).hourFormat\"\n />\n }\n }\n </div>\n</div>\n", styles: [":host{display:block}\n"] }]
|
|
452
|
+
}] });
|
|
453
|
+
|
|
454
|
+
class DynamicFormComponent {
|
|
455
|
+
formContainer = input([]);
|
|
456
|
+
form = input.required();
|
|
457
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
458
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: DynamicFormComponent, isStandalone: true, selector: "school-dynamic-form", inputs: { formContainer: { classPropertyName: "formContainer", publicName: "formContainer", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
459
|
+
<form [formGroup]="form()">
|
|
460
|
+
<div class="space-y-2 w-full">
|
|
461
|
+
@for (container of formContainer(); track container) {
|
|
462
|
+
<div class="grid gap-4 w-full" [ngStyle]="{'grid-template-columns': 'repeat(' + container.containers.length + ', minmax(0, 1fr))'}">
|
|
463
|
+
@for (question of container.containers; track question) {
|
|
464
|
+
<base-form-dynamic-form-field [question]="question" [form]="form()" />
|
|
465
|
+
}
|
|
466
|
+
</div>
|
|
467
|
+
}
|
|
468
|
+
</div>
|
|
469
|
+
</form>
|
|
470
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: DynamicFormFieldComponent, selector: "base-form-dynamic-form-field", inputs: ["question", "form"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
471
|
+
}
|
|
472
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DynamicFormComponent, decorators: [{
|
|
473
|
+
type: Component,
|
|
11
474
|
args: [{
|
|
12
|
-
|
|
475
|
+
selector: 'school-dynamic-form',
|
|
476
|
+
imports: [
|
|
477
|
+
ReactiveFormsModule,
|
|
478
|
+
DynamicFormFieldComponent,
|
|
479
|
+
ButtonModule,
|
|
480
|
+
CommonModule,
|
|
481
|
+
],
|
|
482
|
+
template: `
|
|
483
|
+
<form [formGroup]="form()">
|
|
484
|
+
<div class="space-y-2 w-full">
|
|
485
|
+
@for (container of formContainer(); track container) {
|
|
486
|
+
<div class="grid gap-4 w-full" [ngStyle]="{'grid-template-columns': 'repeat(' + container.containers.length + ', minmax(0, 1fr))'}">
|
|
487
|
+
@for (question of container.containers; track question) {
|
|
488
|
+
<base-form-dynamic-form-field [question]="question" [form]="form()" />
|
|
489
|
+
}
|
|
490
|
+
</div>
|
|
491
|
+
}
|
|
492
|
+
</div>
|
|
493
|
+
</form>
|
|
494
|
+
`,
|
|
495
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
13
496
|
}]
|
|
14
|
-
}]
|
|
497
|
+
}] });
|
|
15
498
|
|
|
16
|
-
class
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
499
|
+
class QuestionBase {
|
|
500
|
+
value;
|
|
501
|
+
key;
|
|
502
|
+
label;
|
|
503
|
+
required;
|
|
504
|
+
order;
|
|
505
|
+
controlType;
|
|
506
|
+
type;
|
|
507
|
+
validators;
|
|
508
|
+
placeholder;
|
|
509
|
+
nonNullable;
|
|
510
|
+
onValueChange;
|
|
511
|
+
constructor(options) {
|
|
512
|
+
this.value = options.value;
|
|
513
|
+
this.key = options.key || '';
|
|
514
|
+
this.label = options.label || '';
|
|
515
|
+
this.required = !!options.required;
|
|
516
|
+
this.order = options.order === undefined ? 1 : options.order;
|
|
517
|
+
this.controlType = (options.controlType || '');
|
|
518
|
+
this.type = (options.type || '');
|
|
519
|
+
this.nonNullable = options.nonNullable || true;
|
|
520
|
+
this.validators = options.validators || [];
|
|
521
|
+
this.placeholder = options.placeholder || '';
|
|
522
|
+
this.onValueChange = options.onValueChange;
|
|
523
|
+
}
|
|
23
524
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
525
|
+
|
|
526
|
+
class QuestionDatePicker extends QuestionBase {
|
|
527
|
+
controlType = QuestionTypeEnum.DatePicker;
|
|
528
|
+
view;
|
|
529
|
+
constructor(options) {
|
|
530
|
+
super(options);
|
|
531
|
+
this.view = options.view || 'date';
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
class QuestionMultiSelect extends QuestionBase {
|
|
536
|
+
controlType = QuestionTypeEnum.MultiSelect;
|
|
537
|
+
loading;
|
|
538
|
+
optionLabel;
|
|
539
|
+
optionValue;
|
|
540
|
+
options;
|
|
541
|
+
optionType;
|
|
542
|
+
asyncOptionType;
|
|
543
|
+
normalizeValue;
|
|
544
|
+
constructor(options) {
|
|
545
|
+
super(options);
|
|
546
|
+
this.loading = options.loading || false;
|
|
547
|
+
this.optionLabel = options.optionLabel || 'label';
|
|
548
|
+
this.optionValue = options.optionValue || 'value';
|
|
549
|
+
this.options = options.options;
|
|
550
|
+
this.optionType = options.optionType || OptionTypeEnum.EAGER;
|
|
551
|
+
if (this.optionType === OptionTypeEnum.ASYNC) {
|
|
552
|
+
this.asyncOptionType = options.asyncOptionType;
|
|
553
|
+
}
|
|
554
|
+
this.normalizeValue = options.normalizeValue;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
class QuestionPasswordInput extends QuestionBase {
|
|
559
|
+
controlType = QuestionTypeEnum.TextInput;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
class QuestionSelectInput extends QuestionBase {
|
|
563
|
+
controlType = QuestionTypeEnum.SelectInput;
|
|
564
|
+
optionLabel;
|
|
565
|
+
optionValue;
|
|
566
|
+
options;
|
|
567
|
+
optionType;
|
|
568
|
+
asyncOptionType;
|
|
569
|
+
normalizeValue;
|
|
570
|
+
constructor(options) {
|
|
571
|
+
super(options);
|
|
572
|
+
this.optionLabel = options.optionLabel || 'label';
|
|
573
|
+
this.optionValue = options.optionValue || 'value';
|
|
574
|
+
this.options = options.options;
|
|
575
|
+
this.optionType = options.optionType || OptionTypeEnum.EAGER;
|
|
576
|
+
if (this.optionType === OptionTypeEnum.ASYNC) {
|
|
577
|
+
this.asyncOptionType = options.asyncOptionType;
|
|
578
|
+
}
|
|
579
|
+
this.normalizeValue = options.normalizeValue;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
class QuestionTextInput extends QuestionBase {
|
|
584
|
+
controlType = QuestionTypeEnum.TextInput;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
class QuestionTextArea extends QuestionBase {
|
|
588
|
+
controlType = QuestionTypeEnum.TextArea;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
class QuestionTimePicker extends QuestionBase {
|
|
592
|
+
controlType = QuestionTypeEnum.TimePicker;
|
|
593
|
+
hourFormat;
|
|
594
|
+
constructor(options) {
|
|
595
|
+
super(options);
|
|
596
|
+
this.hourFormat = options.hourFormat || '24';
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
var AsyncOptionEnum;
|
|
601
|
+
(function (AsyncOptionEnum) {
|
|
602
|
+
AsyncOptionEnum["SUBJECTS"] = "subjects";
|
|
603
|
+
AsyncOptionEnum["FACILITIES"] = "facilities";
|
|
604
|
+
AsyncOptionEnum["ROOM_TYPES"] = "room_types";
|
|
605
|
+
AsyncOptionEnum["ROOMS"] = "rooms";
|
|
606
|
+
AsyncOptionEnum["BUILDINGS"] = "buildings";
|
|
607
|
+
AsyncOptionEnum["TEACHERS"] = "teachers";
|
|
608
|
+
AsyncOptionEnum["CLASS_TYPES"] = "class_types";
|
|
609
|
+
})(AsyncOptionEnum || (AsyncOptionEnum = {}));
|
|
610
|
+
|
|
611
|
+
class QuestionControlService {
|
|
612
|
+
toFormGroup(containers) {
|
|
613
|
+
const questions = this._getQuestionsFromContainer(containers);
|
|
614
|
+
const group = {};
|
|
615
|
+
questions.forEach((question) => {
|
|
616
|
+
const control = new FormControl(question.value || null, { nonNullable: question.nonNullable });
|
|
617
|
+
if (question.required) {
|
|
618
|
+
control.addValidators(Validators.required);
|
|
619
|
+
}
|
|
620
|
+
if (question.validators.length) {
|
|
621
|
+
control.addValidators(question.validators);
|
|
622
|
+
}
|
|
623
|
+
group[question.key] = control;
|
|
624
|
+
});
|
|
625
|
+
questions.forEach(question => {
|
|
626
|
+
group[question.key].valueChanges
|
|
627
|
+
.pipe(debounceTime(250))
|
|
628
|
+
.subscribe((value) => {
|
|
629
|
+
if (question.onValueChange instanceof Function) {
|
|
630
|
+
question.onValueChange(value, questions);
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
});
|
|
634
|
+
return new FormGroup(group);
|
|
635
|
+
}
|
|
636
|
+
_getQuestionsFromContainer(containers) {
|
|
637
|
+
return containers.reduce((prev, curr) => {
|
|
638
|
+
prev.push(...curr.containers);
|
|
639
|
+
return prev;
|
|
640
|
+
}, []);
|
|
641
|
+
}
|
|
642
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: QuestionControlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
643
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: QuestionControlService });
|
|
644
|
+
}
|
|
645
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: QuestionControlService, decorators: [{
|
|
646
|
+
type: Injectable
|
|
31
647
|
}] });
|
|
32
648
|
|
|
33
649
|
/*
|
|
@@ -38,5 +654,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
38
654
|
* Generated bundle index. Do not edit.
|
|
39
655
|
*/
|
|
40
656
|
|
|
41
|
-
export {
|
|
657
|
+
export { AsyncOptionEnum, DatepickerComponent, DynamicFormComponent, DynamicFormFieldComponent, MultiSelectComponent, NumberInputComponent, OptionTypeEnum, PasswordInputComponent, QuestionBase, QuestionControlService, QuestionDatePicker, QuestionFieldTypeEnum, QuestionMultiSelect, QuestionPasswordInput, QuestionSelectInput, QuestionTextArea, QuestionTextInput, QuestionTimePicker, QuestionTypeEnum, SelectInputComponent, TextInputComponent, TextareaInputComponent, TimePickerComponent };
|
|
42
658
|
//# sourceMappingURL=ilhombek-base-form.mjs.map
|