@pongrass/utils 1.1.7-v20 → 1.1.9-v20
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/pongrass-utils.mjs +102 -57
- package/fesm2022/pongrass-utils.mjs.map +1 -1
- package/index.d.ts +21 -10
- package/package.json +1 -1
|
@@ -664,7 +664,7 @@ class CheckboxCellRendererComponent {
|
|
|
664
664
|
}
|
|
665
665
|
// Return Cell Value
|
|
666
666
|
refresh(params) {
|
|
667
|
-
this.value = params.value === 'Y' || params.value === 1 ? true : false;
|
|
667
|
+
this.value = params.value === 'Y' || params.value === 1 || params.value === '1' ? true : false;
|
|
668
668
|
return true;
|
|
669
669
|
}
|
|
670
670
|
onChangeCheckBox(event) {
|
|
@@ -1686,66 +1686,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
1686
1686
|
args: ['keydown', ['$event']]
|
|
1687
1687
|
}] } });
|
|
1688
1688
|
|
|
1689
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1690
1689
|
class DecimalInputDirective {
|
|
1691
1690
|
el = inject((ElementRef));
|
|
1692
|
-
control = inject(NgControl);
|
|
1693
|
-
sub;
|
|
1691
|
+
control = inject(NgControl, { optional: true });
|
|
1694
1692
|
wsDecimalInput = 4;
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
this.sub = this.control.valueChanges?.subscribe(value => {
|
|
1699
|
-
const inputEl = this.el.nativeElement;
|
|
1700
|
-
// Skip if input element is focused (user typing)
|
|
1701
|
-
if (document.activeElement === inputEl)
|
|
1702
|
-
return;
|
|
1703
|
-
this.formatValue(value);
|
|
1704
|
-
});
|
|
1705
|
-
}
|
|
1706
|
-
ngOnDestroy() {
|
|
1707
|
-
this.sub?.unsubscribe();
|
|
1693
|
+
wsAcceptStringInput = true;
|
|
1694
|
+
get decimalPlaces() {
|
|
1695
|
+
return this.wsDecimalInput;
|
|
1708
1696
|
}
|
|
1709
|
-
|
|
1697
|
+
onInput(e) {
|
|
1710
1698
|
const input = this.el.nativeElement;
|
|
1711
|
-
const
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
if (
|
|
1715
|
-
|
|
1716
|
-
|
|
1699
|
+
const before = input.value;
|
|
1700
|
+
let cleaned = before.replace(/[^0-9.]/g, '');
|
|
1701
|
+
const parts = cleaned.split('.');
|
|
1702
|
+
if (parts.length > 2) {
|
|
1703
|
+
cleaned = parts[0] + '.' + parts.slice(1).join('');
|
|
1704
|
+
}
|
|
1705
|
+
if (parts.length === 2 && parts[1].length > this.decimalPlaces) {
|
|
1706
|
+
cleaned = parts[0] + '.' + parts[1].slice(0, this.decimalPlaces);
|
|
1717
1707
|
}
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1708
|
+
if (cleaned !== before) {
|
|
1709
|
+
const cursorPos = input.selectionStart ?? 0;
|
|
1710
|
+
input.value = cleaned;
|
|
1711
|
+
const newPos = cursorPos + (cleaned.length - before.length);
|
|
1712
|
+
input.setSelectionRange(newPos, newPos);
|
|
1713
|
+
this.control?.control?.setValue(this.wsAcceptStringInput ? cleaned : Number(cleaned) || null, { emitEvent: false, onlySelf: true });
|
|
1722
1714
|
}
|
|
1723
1715
|
}
|
|
1724
|
-
|
|
1725
|
-
|
|
1716
|
+
onPaste(e) {
|
|
1717
|
+
const text = e.clipboardData?.getData('text') ?? '';
|
|
1718
|
+
if (!/^\d*\.?\d*$/.test(text)) {
|
|
1719
|
+
e.preventDefault();
|
|
1720
|
+
}
|
|
1726
1721
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1722
|
+
onBlur() {
|
|
1723
|
+
const val = this.el.nativeElement.value.trim();
|
|
1724
|
+
if (!val)
|
|
1729
1725
|
return;
|
|
1730
|
-
|
|
1726
|
+
const num = Number(val);
|
|
1727
|
+
if (isNaN(num))
|
|
1731
1728
|
return;
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
formatted = integerPart + '.' + decimalPart.slice(0, this.wsDecimalInput);
|
|
1729
|
+
let str = num.toFixed(this.decimalPlaces);
|
|
1730
|
+
if (!this.wsAcceptStringInput) {
|
|
1731
|
+
this.control?.control?.setValue(num, { emitEvent: false });
|
|
1736
1732
|
}
|
|
1737
|
-
|
|
1738
|
-
|
|
1733
|
+
else {
|
|
1734
|
+
this.control?.control?.setValue(str, { emitEvent: false });
|
|
1735
|
+
}
|
|
1736
|
+
this.el.nativeElement.value = str;
|
|
1739
1737
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1738
|
+
constructor() {
|
|
1739
|
+
this.control?.valueChanges?.subscribe(v => {
|
|
1740
|
+
if (document.activeElement !== this.el.nativeElement) {
|
|
1741
|
+
this.formatProgrammatic(v);
|
|
1742
|
+
}
|
|
1743
|
+
});
|
|
1743
1744
|
}
|
|
1744
|
-
|
|
1745
|
-
|
|
1745
|
+
formatProgrammatic(value) {
|
|
1746
|
+
if (value == null || value === '') {
|
|
1747
|
+
this.el.nativeElement.value = '';
|
|
1748
|
+
return;
|
|
1749
|
+
}
|
|
1750
|
+
const str = Number(value).toFixed(this.decimalPlaces);
|
|
1751
|
+
this.el.nativeElement.value = str;
|
|
1746
1752
|
}
|
|
1747
1753
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: DecimalInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1748
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.9", type: DecimalInputDirective, isStandalone: true, selector: "[wsDecimalInput]", inputs: { wsDecimalInput: "wsDecimalInput" }, host: { listeners: { "
|
|
1754
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.9", type: DecimalInputDirective, isStandalone: true, selector: "[wsDecimalInput]", inputs: { wsDecimalInput: "wsDecimalInput", wsAcceptStringInput: "wsAcceptStringInput" }, host: { listeners: { "input": "onInput($event)", "paste": "onPaste($event)", "blur": "onBlur()" } }, ngImport: i0 });
|
|
1749
1755
|
}
|
|
1750
1756
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: DecimalInputDirective, decorators: [{
|
|
1751
1757
|
type: Directive,
|
|
@@ -1753,11 +1759,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
1753
1759
|
selector: '[wsDecimalInput]',
|
|
1754
1760
|
standalone: true
|
|
1755
1761
|
}]
|
|
1756
|
-
}], propDecorators: { wsDecimalInput: [{
|
|
1762
|
+
}], ctorParameters: () => [], propDecorators: { wsDecimalInput: [{
|
|
1757
1763
|
type: Input
|
|
1758
|
-
}],
|
|
1764
|
+
}], wsAcceptStringInput: [{
|
|
1765
|
+
type: Input
|
|
1766
|
+
}], onInput: [{
|
|
1759
1767
|
type: HostListener,
|
|
1760
|
-
args: ['
|
|
1768
|
+
args: ['input', ['$event']]
|
|
1769
|
+
}], onPaste: [{
|
|
1770
|
+
type: HostListener,
|
|
1771
|
+
args: ['paste', ['$event']]
|
|
1761
1772
|
}], onBlur: [{
|
|
1762
1773
|
type: HostListener,
|
|
1763
1774
|
args: ['blur']
|
|
@@ -2138,6 +2149,12 @@ class MultiFormComponent {
|
|
|
2138
2149
|
disabled: field.validations?.readonly || false
|
|
2139
2150
|
}, validators));
|
|
2140
2151
|
}
|
|
2152
|
+
else if (field.type === FormFieldType.Float) {
|
|
2153
|
+
this.multiForm.addControl(field.controlName, this.formBuilder.control({
|
|
2154
|
+
value: field?.value !== '' ? this.updateFloatValue(field.value) : '',
|
|
2155
|
+
disabled: field.validations?.readonly || false
|
|
2156
|
+
}, validators));
|
|
2157
|
+
}
|
|
2141
2158
|
else {
|
|
2142
2159
|
this.multiForm.addControl(field.controlName, this.formBuilder.control({ value: field?.value || '', disabled: field.validations?.readonly || false }, validators));
|
|
2143
2160
|
}
|
|
@@ -2168,6 +2185,9 @@ class MultiFormComponent {
|
|
|
2168
2185
|
else if (field.type === FormFieldType.Date || field.type === FormFieldType.NewDate) {
|
|
2169
2186
|
initialValue = field?.value ? new Date(field.value) : this.setDefaultAdvanceDate(new Date(), field?.validations?.defaultAdvance || '');
|
|
2170
2187
|
}
|
|
2188
|
+
else if (field.type === FormFieldType.Float) {
|
|
2189
|
+
initialValue = field?.value ? this.updateFloatValue(field.value) : '';
|
|
2190
|
+
}
|
|
2171
2191
|
else {
|
|
2172
2192
|
initialValue = field.value || '';
|
|
2173
2193
|
}
|
|
@@ -2183,6 +2203,9 @@ class MultiFormComponent {
|
|
|
2183
2203
|
else if (field.type === FormFieldType.Date || field.type === FormFieldType.NewDate) {
|
|
2184
2204
|
control.setValue(field?.value ? new Date(field.value) : '', { emitEvent: false });
|
|
2185
2205
|
}
|
|
2206
|
+
else if (field.type === FormFieldType.Float) {
|
|
2207
|
+
control.setValue(field?.value ? this.updateFloatValue(field.value) : '', { emitEvent: false });
|
|
2208
|
+
}
|
|
2186
2209
|
else {
|
|
2187
2210
|
control.setValue(field.value || '', { emitEvent: false });
|
|
2188
2211
|
}
|
|
@@ -2197,7 +2220,7 @@ class MultiFormComponent {
|
|
|
2197
2220
|
this.multiForm.markAsPristine();
|
|
2198
2221
|
}
|
|
2199
2222
|
getTruthyOrFalsy(value) {
|
|
2200
|
-
return value === '1' ? true : false;
|
|
2223
|
+
return value === '1' || value === 1 ? true : false;
|
|
2201
2224
|
}
|
|
2202
2225
|
getValidators(validations) {
|
|
2203
2226
|
const validators = [];
|
|
@@ -2349,12 +2372,34 @@ class MultiFormComponent {
|
|
|
2349
2372
|
}
|
|
2350
2373
|
return null;
|
|
2351
2374
|
}
|
|
2375
|
+
/**
|
|
2376
|
+
* Set precision for float type
|
|
2377
|
+
* @param value
|
|
2378
|
+
* @returns
|
|
2379
|
+
*/
|
|
2380
|
+
updateFloatValue(value) {
|
|
2381
|
+
if (value == null || value === '') {
|
|
2382
|
+
return null;
|
|
2383
|
+
}
|
|
2384
|
+
const precision = this.configurationService?.allConfigValues()?.formConfig?.formValidations?.defaultDecimalPrecision ?? 2;
|
|
2385
|
+
if (typeof value === 'number') {
|
|
2386
|
+
return Number.isFinite(value) ? value.toFixed(precision) : null;
|
|
2387
|
+
}
|
|
2388
|
+
if (typeof value === 'string') {
|
|
2389
|
+
const trimmed = value.trim();
|
|
2390
|
+
if (trimmed === '')
|
|
2391
|
+
return null;
|
|
2392
|
+
const num = parseFloat(trimmed);
|
|
2393
|
+
return Number.isFinite(num) ? num.toFixed(precision) : null;
|
|
2394
|
+
}
|
|
2395
|
+
return null;
|
|
2396
|
+
}
|
|
2352
2397
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: MultiFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2353
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: MultiFormComponent, isStandalone: false, selector: "prg-ws-multi-form", inputs: { config: "config", showUnsavedFlags: "showUnsavedFlags", currentTableGridsSelectedIndex: "currentTableGridsSelectedIndex", formId: "formId" }, outputs: { fieldAction: "fieldAction", formSavedUnsavedListen: "formSavedUnsavedListen", selectionChangeEvent: "selectionChangeEvent" }, usesOnChanges: true, ngImport: i0, template: "<form [formGroup]=\"multiForm\" cForm class=\"multiform-wrapper\" wsCircularFocus>\r\n @for (row of config?.rows; track $index; let isLast = $last) {\r\n <div class=\"row gx-3 multiform-inner\" [id]=\"formId\" [ngClass]=\"config?.rows?.length > 1 && !isLast ? 'border-bottom mb-3' : ''\">\r\n @for (field of row; track $index) {\r\n @if (field?.type !== FormFieldType.Separator && field?.type !== FormFieldType.FormHeader) {\r\n <div class=\"mb-3\" [class]=\"'field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\" [attr.data-id]=\"field.controlName\">\r\n @if (multiForm.controls[field.controlName]) {\r\n <!-- Label -->\r\n @if (field.label && field.type !== FormFieldType.Checkbox) {\r\n <label\r\n [wsShowTooltipIfTruncated]=\"field.label\"\r\n cLabel\r\n class=\"mb-1 label-multiform single-line-label\"\r\n [for]=\"field.controlName\"\r\n [ngClass]=\"{ 'text-danger': isFormSubmitted && multiForm.controls[field.controlName]?.errors }\"\r\n [ngStyle]=\"field.styles?.label\"\r\n >{{ field.label }}\r\n @if (field?.validations?.required || false) {\r\n <strong class=\"text-danger\">*</strong>\r\n }\r\n </label>\r\n }\r\n\r\n <!-- Text, Email, Number Inputs -->\r\n @if (\r\n field.type === FormFieldType.Text ||\r\n field.type === FormFieldType.Email ||\r\n field.type === FormFieldType.Number ||\r\n field.type === FormFieldType.Password ||\r\n field.type === FormFieldType.Url ||\r\n field.type === FormFieldType.Tel\r\n ) {\r\n <div class=\"position-relative w-100\">\r\n <input\r\n [type]=\"field.type\"\r\n cFormControl\r\n [formControlName]=\"field.controlName\"\r\n [id]=\"field.controlName\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [ngClass]=\"{\r\n 'form-invalid border-danger border border-2':\r\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors,\r\n 'no-label-margin': !field.label\r\n }\"\r\n [min]=\"field.validations?.min\"\r\n [max]=\"field.validations?.max\"\r\n [ngStyle]=\"field.styles?.field\" />\r\n\r\n @if (field.actionButton) {\r\n <button\r\n type=\"button\"\r\n [cTooltip]=\"field.actionButton?.tooltip\"\r\n tooltipPlacement=\"top\"\r\n cButton\r\n color=\"primary\"\r\n variant=\"outline\"\r\n aria-label=\"action\"\r\n class=\"d-flex position-absolute top-50 end-0 translate-middle-y me-2 btn p-0 border-0 bg-transparent\"\r\n (click)=\"onClickFieldAction($event, field)\">\r\n <svg cIcon class=\"text-primary\" [name]=\"field.actionButton.icon\" size=\"xl\"></svg>\r\n </button>\r\n }\r\n @if (multiForm.controls[field.controlName]?.touched || isFormSubmitted) {\r\n @if (multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['pattern']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is invalid</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Minimum length {{ field?.validations?.minLength }} characters is required\r\n </small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\r\n </small>\r\n }\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n <!-- Select Inputs -->\r\n @else if (field.type === FormFieldType.Select || field.type === inputType?.colorSelect) {\r\n <ng-container>\r\n <c-multi-select\r\n [multiple]=\"field?.multiple || false\"\r\n [allowCreateOptions]=\"field?.allowCreateOptions || false\"\r\n [search]=\"field?.allowCreateOptions || field?.allowSearch || field?.search || false\"\r\n [searchNoResultsLabel]=\"field?.searchNoResultsLabel || 'No results found'\"\r\n [clearSearchOnSelect]=\"true\"\r\n [selectionType]=\"field?.selectionType || 'tags'\"\r\n [cleaner]=\"field?.allowCleaner === false ? false : true\"\r\n [formControlName]=\"field.controlName\"\r\n [placeholder]=\"field.placeholder || 'Select'\"\r\n [wsMultiSelectStyler]=\"field.type === inputType?.colorSelect\"\r\n [options]=\"colorCodes$\"\r\n [optionsMaxHeight]=\"400\"\r\n [ngClass]=\"{\r\n 'form-invalid': (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n (searchValueChange)=\"handleSearch(field, $event)\"\r\n (valueChange)=\"onValueChange($event, field.controlName)\"\r\n [ngStyle]=\"field.styles?.field\">\r\n @if (field.type === inputType?.colorSelect) {\r\n @for (option of colorCodes$; track $index) {\r\n <c-multi-select-option [value]=\"option?.label\">\r\n <label class=\"d-flex gap-2\">\r\n <span class=\"color-box\" [style.background-color]=\"option?.value\"></span>\r\n {{ option.label }}\r\n </label>\r\n </c-multi-select-option>\r\n }\r\n } @else {\r\n @for (option of field.options; track $index) {\r\n <c-multi-select-option [value]=\"option?.value\">\r\n {{ option.label }}\r\n </c-multi-select-option>\r\n }\r\n }\r\n </c-multi-select>\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n\r\n <!-- Date input -->\r\n @else if (field.type === FormFieldType.Date) {\r\n <ng-container>\r\n <input\r\n type=\"text\"\r\n [placeholder]=\"field?.label || 'Select Date'\"\r\n class=\"form-control\"\r\n [ngClass]=\"{\r\n 'form-invalid': (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n (bsValueChange)=\"onDateValueChange($event, field.controlName)\"\r\n [formControlName]=\"field.controlName\"\r\n [dateInputFormat]=\"configurationService?.allConfigValues()?.defaultDateFormat || 'MM/DD/YYYY'\"\r\n [bsConfig]=\"{\r\n containerClass: 'pongrass-red-datepicker',\r\n showWeekNumbers: false,\r\n adaptivePosition: true,\r\n useUtc: false\r\n }\"\r\n bsDatepicker\r\n [ngStyle]=\"field.styles?.field\" />\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n\r\n @else if (field.type === FormFieldType.NewDate) {\r\n <ng-container>\r\n <c-date-picker\r\n [formControlName]=\"field.controlName\"\r\n [calendarDate]=\"multiForm.controls[field.controlName]?.value\"\r\n inputReadOnly=\"true\"\r\n [showAdjacentDays]=\"false\"\r\n locale=\"en-US\">\r\n </c-date-picker>\r\n </ng-container>\r\n }\r\n\r\n <!-- Date Time input -->\r\n @else if (field.type === FormFieldType.Datetime) {\r\n <app-date-time-picker [formControlName]=\"field.controlName\"></app-date-time-picker>\r\n }\r\n\r\n <!-- Textarea -->\r\n @else if (field.type === FormFieldType.Textarea) {\r\n <ng-container>\r\n <textarea\r\n cFormControl\r\n [id]=\"field.controlName\"\r\n [rows]=\"field?.textareaRows || 4\"\r\n [columns]=\"field?.textareaColumns || 4\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [ngClass]=\"{\r\n 'form-invalid border-danger border border-2':\r\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n [formControlName]=\"field.controlName\"\r\n [ngStyle]=\"field.styles?.field\"></textarea>\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Minimum length {{ field?.validations?.minLength }} characters is required\r\n </small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\r\n </small>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n <!-- Checkbox -->\r\n @else if (field.type === FormFieldType.Checkbox) {\r\n <div class=\"no-label-margin\">\r\n <input cFormCheckInput [id]=\"field.controlName\" type=\"checkbox\" [formControlName]=\"field.controlName\" [ngStyle]=\"field.styles?.field\" />\r\n <label cFormCheckLabel [for]=\"field.controlName\" class=\"ms-2\" [ngStyle]=\"field.styles?.label\">{{ field.label }}</label>\r\n </div>\r\n }\r\n\r\n @else if (field.type === FormFieldType.Switch) {\r\n <c-form-check sizing=\"lg\" [switch]=\"true\">\r\n <input cFormCheckInput [id]=\"field.controlName\" type=\"checkbox\" [formControlName]=\"field.controlName\" [ngStyle]=\"field.styles?.field\" />\r\n <label cFormCheckLabel [for]=\"field.controlName\" class=\"ms-2\" [ngStyle]=\"field.styles?.label\">{{ field.info }}</label>\r\n </c-form-check>\r\n }\r\n <!-- Decimal input -->\r\n @else if (field.type === FormFieldType.Float) {\r\n <ng-container>\r\n <input\r\n cFormControl\r\n [id]=\"field.controlName\"\r\n type=\"number\"\r\n class=\"me-2\"\r\n [formControlName]=\"field.controlName\"\r\n [wsDecimalInput]=\"field.validations?.precision || 2\"\r\n [ngClass]=\"{\r\n 'form-invalid border-danger border border-2':\r\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n [min]=\"field.validations?.min\"\r\n [max]=\"field.validations?.max\"\r\n [ngStyle]=\"field.styles?.field\" />\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['pattern']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is invalid</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Minimum length {{ field?.validations?.minLength }} characters is required\r\n </small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\r\n </small>\r\n }\r\n }\r\n </ng-container>\r\n } @else if (field.type === FormFieldType.Edition) {\r\n <ng-container>\r\n <prg-ws-edition-list-grouped\r\n (selectedEditionsChange)=\"onEditionChange($event)\"\r\n [multiple]=\"field?.multiple === false ? false : true\"\r\n [hasFormError]=\"isFormSubmitted && multiForm.controls[field.controlName]?.errors\">\r\n </prg-ws-edition-list-grouped>\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n }\r\n }\r\n </ng-container>\r\n } @else if (field.type === FormFieldType.Timepicker) {\r\n <c-time-picker [formControlName]=\"field.controlName\" seconds />\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n @if (field?.type === FormFieldType.Separator) {\r\n <div [class]=\"'field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\"></div>\r\n }\r\n @if (field?.type === FormFieldType.FormHeader) {\r\n <div [class]=\"'fs-6 fw-bold my-2 field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\">{{ field?.label }}</div>\r\n }\r\n }\r\n </div>\r\n }\r\n</form>\r\n", styles: [".no-label-margin{margin-top:1.6rem}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}.h-135{height:135px}.single-line-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;display:block}.label-multiform{font-size:16px;font-weight:400}.field-checkbox{display:flex;align-items:center}::ng-deep [data-coreui-theme=dark] .bs-datepicker{background:#212631;box-shadow:0 0 10px #323a49}::ng-deep [data-coreui-theme=dark] .bs-datepicker .bs-datepicker-body{border:1px solid #323a49}::ng-deep .pongrass-red-datepicker .bs-datepicker-head{background-color:#ff4d5c}::ng-deep .pongrass-red-datepicker .bs-datepicker-body table td span.selected,::ng-deep .pongrass-red-datepicker .theme-red .bs-datepicker-body table td.selected span,::ng-deep .pongrass-red-datepicker .theme-red .bs-datepicker-body table td span[class*=select-]:after,::ng-deep .pongrass-red-datepicker .theme-red .bs-datepicker-body table td[class*=select-] span:after{background-color:#ff4d5c}::ng-deep .pongrass-red-datepicker .bs-datepicker-body table td.week span{color:#ff4d5c}\n"], dependencies: [{ kind: "directive", type: CircularFocusDirective, selector: "[wsCircularFocus]", inputs: ["formId", "formGroup"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.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: i3.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i3.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { 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.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i3.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { 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: i1.MultiSelectComponent, selector: "c-multi-select", inputs: ["allowCreateOptions", "cleaner", "clearSearchOnSelect", "disabled", "loading", "multiple", "options", "optionsMaxHeight", "optionsStyle", "placeholder", "resetSelectionOnOptionsChange", "search", "searchNoResultsLabel", "searchValue", "selectAll", "selectAllLabel", "selectionType", "selectionTypeCounterText", "selectionTypeCounterTextPluralMap", "size", "value", "valid", "virtualScroller", "visibleItems", "itemSize", "itemMinWidth", "visible", "popperOptions"], outputs: ["searchValueChange", "valueChange", "visibleChange"], exportAs: ["cMultiSelect"] }, { kind: "component", type: i1.MultiSelectOptionComponent, selector: "c-multi-select-option", inputs: ["optionsStyle", "label", "text", "visible", "disabled", "selected", "value", "active", "role"], outputs: ["selectedChange", "focusChange"], exportAs: ["cMultiSelectOption"] }, { kind: "directive", type: i1.FormDirective, selector: "form[cForm]", inputs: ["validated"] }, { kind: "component", type: i1.FormCheckComponent, selector: "c-form-check", inputs: ["inline", "reverse", "sizing", "switch"], exportAs: ["cFormCheck"] }, { kind: "directive", type: i1.FormCheckLabelDirective, selector: "label[cFormCheckLabel]" }, { kind: "directive", type: i1.FormCheckInputDirective, selector: "input[cFormCheckInput]", inputs: ["type", "indeterminate", "valid"] }, { kind: "directive", type: i1.FormControlDirective, selector: "input[cFormControl], textarea[cFormControl]", inputs: ["sizing", "valid", "type", "plaintext"] }, { kind: "directive", type: i1.FormLabelDirective, selector: "[cLabel]", inputs: ["cLabel", "sizing"] }, { kind: "directive", type: i1$1.IconDirective, selector: "svg[cIcon]", inputs: ["cIcon", "customClasses", "size", "title", "height", "width", "name", "viewBox", "xmlns", "pointer-events", "role"], exportAs: ["cIcon"] }, { kind: "component", type: i1.DatePickerComponent, selector: "c-date-picker", inputs: ["calendars", "placeholder", "date"], outputs: ["dateChange"], exportAs: ["cDatePicker"] }, { kind: "directive", type: DecimalInputDirective, selector: "[wsDecimalInput]", inputs: ["wsDecimalInput"] }, { kind: "directive", type: ShowTooltipIfTruncatedDirective, selector: "[wsShowTooltipIfTruncated]", inputs: ["wsShowTooltipIfTruncated"] }, { kind: "directive", type: i1.TooltipDirective, selector: "[cTooltip]", inputs: ["cTooltip", "cTooltipOptions", "cTooltipPlacement", "cTooltipRef", "cTooltipTrigger", "cTooltipVisible"], outputs: ["cTooltipVisibleChange"], exportAs: ["cTooltip"] }, { kind: "directive", type: i1.ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "tabindex", "type", "variant"], exportAs: ["cButton"] }, { kind: "directive", type: i8.BsDatepickerDirective, selector: "[bsDatepicker]", inputs: ["placement", "triggers", "outsideClick", "container", "outsideEsc", "isDisabled", "minDate", "maxDate", "ignoreMinMaxErrors", "minMode", "daysDisabled", "datesDisabled", "datesEnabled", "dateCustomClasses", "dateTooltipTexts", "isOpen", "bsValue", "bsConfig"], outputs: ["onShown", "onHidden", "bsValueChange"], exportAs: ["bsDatepicker"] }, { kind: "directive", type: i8.BsDatepickerInputDirective, selector: "input[bsDatepicker]" }, { kind: "component", type: EditionListGroupedComponent, selector: "prg-ws-edition-list-grouped", inputs: ["label", "multiple", "hasFormError"], outputs: ["selectedEditionsChange"] }, { kind: "directive", type: MultiSelectStylerDirective, selector: "[wsMultiSelectStyler]", inputs: ["wsMultiSelectStyler", "options"] }, { kind: "component", type: i1.TimePickerComponent, selector: "c-time-picker", inputs: ["cleaner", "dateTimeFormatOptions", "disabled", "filterHours", "filterMinutes", "filterSeconds", "indicator", "inputReadOnly", "locale", "placeholder", "seconds", "size", "time", "variant", "valid", "visible"], outputs: ["timeChange"], exportAs: ["cTimePicker"] }, { kind: "component", type: DateTimePickerComponent, selector: "app-date-time-picker" }] });
|
|
2398
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: MultiFormComponent, isStandalone: false, selector: "prg-ws-multi-form", inputs: { config: "config", showUnsavedFlags: "showUnsavedFlags", currentTableGridsSelectedIndex: "currentTableGridsSelectedIndex", formId: "formId" }, outputs: { fieldAction: "fieldAction", formSavedUnsavedListen: "formSavedUnsavedListen", selectionChangeEvent: "selectionChangeEvent" }, usesOnChanges: true, ngImport: i0, template: "<form [formGroup]=\"multiForm\" cForm class=\"multiform-wrapper\" wsCircularFocus>\r\n @for (row of config?.rows; track $index; let isLast = $last) {\r\n <div class=\"row gx-3 multiform-inner\" [id]=\"formId\" [ngClass]=\"config?.rows?.length > 1 && !isLast ? 'border-bottom mb-3' : ''\">\r\n @for (field of row; track $index) {\r\n @if (field?.type !== FormFieldType.Separator && field?.type !== FormFieldType.FormHeader) {\r\n <div class=\"mb-3\" [class]=\"'field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\" [attr.data-id]=\"field.controlName\">\r\n @if (multiForm.controls[field.controlName]) {\r\n <!-- Label -->\r\n @if (field.label && field.type !== FormFieldType.Checkbox) {\r\n <label\r\n [wsShowTooltipIfTruncated]=\"field.label\"\r\n cLabel\r\n class=\"mb-1 label-multiform single-line-label\"\r\n [for]=\"field.controlName\"\r\n [ngClass]=\"{ 'text-danger': isFormSubmitted && multiForm.controls[field.controlName]?.errors }\"\r\n [ngStyle]=\"field.styles?.label\"\r\n >{{ field.label }}\r\n @if (field?.validations?.required || false) {\r\n <strong class=\"text-danger\">*</strong>\r\n }\r\n </label>\r\n }\r\n\r\n <!-- Text, Email, Number Inputs -->\r\n @if (\r\n field.type === FormFieldType.Text ||\r\n field.type === FormFieldType.Email ||\r\n field.type === FormFieldType.Number ||\r\n field.type === FormFieldType.Password ||\r\n field.type === FormFieldType.Url ||\r\n field.type === FormFieldType.Tel\r\n ) {\r\n <div class=\"position-relative w-100\">\r\n <input\r\n [type]=\"field.type\"\r\n cFormControl\r\n [formControlName]=\"field.controlName\"\r\n [id]=\"field.controlName\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [ngClass]=\"{\r\n 'form-invalid border-danger border border-2':\r\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors,\r\n 'no-label-margin': !field.label\r\n }\"\r\n [min]=\"field.validations?.min\"\r\n [max]=\"field.validations?.max\"\r\n [ngStyle]=\"field.styles?.field\" />\r\n\r\n @if (field.actionButton) {\r\n <button\r\n type=\"button\"\r\n [cTooltip]=\"field.actionButton?.tooltip\"\r\n tooltipPlacement=\"top\"\r\n cButton\r\n color=\"primary\"\r\n variant=\"outline\"\r\n aria-label=\"action\"\r\n class=\"d-flex position-absolute top-50 end-0 translate-middle-y me-2 btn p-0 border-0 bg-transparent\"\r\n (click)=\"onClickFieldAction($event, field)\">\r\n <svg cIcon class=\"text-primary\" [name]=\"field.actionButton.icon\" size=\"xl\"></svg>\r\n </button>\r\n }\r\n @if (multiForm.controls[field.controlName]?.touched || isFormSubmitted) {\r\n @if (multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['pattern']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is invalid</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Minimum length {{ field?.validations?.minLength }} characters is required\r\n </small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\r\n </small>\r\n }\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n <!-- Select Inputs -->\r\n @else if (field.type === FormFieldType.Select || field.type === inputType?.colorSelect) {\r\n <ng-container>\r\n <c-multi-select\r\n [multiple]=\"field?.multiple || false\"\r\n [allowCreateOptions]=\"field?.allowCreateOptions || false\"\r\n [search]=\"field?.allowCreateOptions || field?.allowSearch || field?.search || false\"\r\n [searchNoResultsLabel]=\"field?.searchNoResultsLabel || 'No results found'\"\r\n [clearSearchOnSelect]=\"true\"\r\n [selectionType]=\"field?.selectionType || 'tags'\"\r\n [cleaner]=\"field?.allowCleaner === false ? false : true\"\r\n [formControlName]=\"field.controlName\"\r\n [placeholder]=\"field.placeholder || 'Select'\"\r\n [wsMultiSelectStyler]=\"field.type === inputType?.colorSelect\"\r\n [options]=\"colorCodes$\"\r\n [optionsMaxHeight]=\"400\"\r\n [ngClass]=\"{\r\n 'form-invalid': (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n (searchValueChange)=\"handleSearch(field, $event)\"\r\n (valueChange)=\"onValueChange($event, field.controlName)\"\r\n [ngStyle]=\"field.styles?.field\">\r\n @if (field.type === inputType?.colorSelect) {\r\n @for (option of colorCodes$; track $index) {\r\n <c-multi-select-option [value]=\"option?.label\">\r\n <label class=\"d-flex gap-2\">\r\n <span class=\"color-box\" [style.background-color]=\"option?.value\"></span>\r\n {{ option.label }}\r\n </label>\r\n </c-multi-select-option>\r\n }\r\n } @else {\r\n @for (option of field.options; track $index) {\r\n <c-multi-select-option [value]=\"option?.value\">\r\n {{ option.label }}\r\n </c-multi-select-option>\r\n }\r\n }\r\n </c-multi-select>\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n\r\n <!-- Date input -->\r\n @else if (field.type === FormFieldType.Date) {\r\n <ng-container>\r\n <input\r\n type=\"text\"\r\n [placeholder]=\"field?.label || 'Select Date'\"\r\n class=\"form-control\"\r\n [ngClass]=\"{\r\n 'form-invalid': (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n (bsValueChange)=\"onDateValueChange($event, field.controlName)\"\r\n [formControlName]=\"field.controlName\"\r\n [dateInputFormat]=\"configurationService?.allConfigValues()?.defaultDateFormat || 'MM/DD/YYYY'\"\r\n [bsConfig]=\"{\r\n containerClass: 'pongrass-red-datepicker',\r\n showWeekNumbers: false,\r\n adaptivePosition: true,\r\n useUtc: false\r\n }\"\r\n bsDatepicker\r\n [ngStyle]=\"field.styles?.field\" />\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n\r\n @else if (field.type === FormFieldType.NewDate) {\r\n <ng-container>\r\n <c-date-picker\r\n [formControlName]=\"field.controlName\"\r\n [calendarDate]=\"multiForm.controls[field.controlName]?.value\"\r\n inputReadOnly=\"true\"\r\n [showAdjacentDays]=\"false\"\r\n locale=\"en-US\">\r\n </c-date-picker>\r\n </ng-container>\r\n }\r\n\r\n <!-- Date Time input -->\r\n @else if (field.type === FormFieldType.Datetime) {\r\n <app-date-time-picker [formControlName]=\"field.controlName\"></app-date-time-picker>\r\n }\r\n\r\n <!-- Textarea -->\r\n @else if (field.type === FormFieldType.Textarea) {\r\n <ng-container>\r\n <textarea\r\n cFormControl\r\n [id]=\"field.controlName\"\r\n [rows]=\"field?.textareaRows || 4\"\r\n [columns]=\"field?.textareaColumns || 4\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [ngClass]=\"{\r\n 'form-invalid border-danger border border-2':\r\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n [formControlName]=\"field.controlName\"\r\n [ngStyle]=\"field.styles?.field\"></textarea>\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Minimum length {{ field?.validations?.minLength }} characters is required\r\n </small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\r\n </small>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n <!-- Checkbox -->\r\n @else if (field.type === FormFieldType.Checkbox) {\r\n <div class=\"no-label-margin\">\r\n <input cFormCheckInput [id]=\"field.controlName\" type=\"checkbox\" [formControlName]=\"field.controlName\" [ngStyle]=\"field.styles?.field\" />\r\n <label cFormCheckLabel [for]=\"field.controlName\" class=\"ms-2\" [ngStyle]=\"field.styles?.label\">{{ field.label }}</label>\r\n </div>\r\n }\r\n\r\n @else if (field.type === FormFieldType.Switch) {\r\n <c-form-check sizing=\"lg\" [switch]=\"true\">\r\n <input cFormCheckInput [id]=\"field.controlName\" type=\"checkbox\" [formControlName]=\"field.controlName\" [ngStyle]=\"field.styles?.field\" />\r\n <label cFormCheckLabel [for]=\"field.controlName\" class=\"ms-2\" [ngStyle]=\"field.styles?.label\">{{ field.info }}</label>\r\n </c-form-check>\r\n }\r\n <!-- Decimal input -->\r\n @else if (field.type === FormFieldType.Float) {\r\n <ng-container>\r\n <input\r\n cFormControl\r\n [id]=\"field.controlName\"\r\n type=\"number\"\r\n class=\"me-2\"\r\n [formControlName]=\"field.controlName\"\r\n [wsDecimalInput]=\"field.validations?.precision || configurationService?.allConfigValues()?.formConfig?.formValidations?.defaultDecimalPrecision || 2\"\r\n [wsAcceptStringInput]=\"false\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [ngClass]=\"{\r\n 'form-invalid border-danger border border-2':\r\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n [min]=\"field.validations?.min\"\r\n [max]=\"field.validations?.max\"\r\n [ngStyle]=\"field.styles?.field\" />\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['pattern']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is invalid</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Minimum length {{ field?.validations?.minLength }} characters is required\r\n </small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\r\n </small>\r\n }\r\n }\r\n </ng-container>\r\n } @else if (field.type === FormFieldType.Edition) {\r\n <ng-container>\r\n <prg-ws-edition-list-grouped\r\n (selectedEditionsChange)=\"onEditionChange($event)\"\r\n [multiple]=\"field?.multiple === false ? false : true\"\r\n [hasFormError]=\"isFormSubmitted && multiForm.controls[field.controlName]?.errors\">\r\n </prg-ws-edition-list-grouped>\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n }\r\n }\r\n </ng-container>\r\n } @else if (field.type === FormFieldType.Timepicker) {\r\n <c-time-picker [formControlName]=\"field.controlName\" seconds />\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n @if (field?.type === FormFieldType.Separator) {\r\n <div [class]=\"'field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\"></div>\r\n }\r\n @if (field?.type === FormFieldType.FormHeader) {\r\n <div [class]=\"'fs-6 fw-bold my-2 field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\">{{ field?.label }}</div>\r\n }\r\n }\r\n </div>\r\n }\r\n</form>\r\n", styles: [".no-label-margin{margin-top:1.6rem}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}.h-135{height:135px}.single-line-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;display:block}.label-multiform{font-size:16px;font-weight:400}.field-checkbox{display:flex;align-items:center}::ng-deep [data-coreui-theme=dark] .bs-datepicker{background:#212631;box-shadow:0 0 10px #323a49}::ng-deep [data-coreui-theme=dark] .bs-datepicker .bs-datepicker-body{border:1px solid #323a49}::ng-deep .pongrass-red-datepicker .bs-datepicker-head{background-color:#ff4d5c}::ng-deep .pongrass-red-datepicker .bs-datepicker-body table td span.selected,::ng-deep .pongrass-red-datepicker .theme-red .bs-datepicker-body table td.selected span,::ng-deep .pongrass-red-datepicker .theme-red .bs-datepicker-body table td span[class*=select-]:after,::ng-deep .pongrass-red-datepicker .theme-red .bs-datepicker-body table td[class*=select-] span:after{background-color:#ff4d5c}::ng-deep .pongrass-red-datepicker .bs-datepicker-body table td.week span{color:#ff4d5c}\n"], dependencies: [{ kind: "directive", type: CircularFocusDirective, selector: "[wsCircularFocus]", inputs: ["formId", "formGroup"] }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.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: i3.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i3.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { 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.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i3.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { 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: i1.MultiSelectComponent, selector: "c-multi-select", inputs: ["allowCreateOptions", "cleaner", "clearSearchOnSelect", "disabled", "loading", "multiple", "options", "optionsMaxHeight", "optionsStyle", "placeholder", "resetSelectionOnOptionsChange", "search", "searchNoResultsLabel", "searchValue", "selectAll", "selectAllLabel", "selectionType", "selectionTypeCounterText", "selectionTypeCounterTextPluralMap", "size", "value", "valid", "virtualScroller", "visibleItems", "itemSize", "itemMinWidth", "visible", "popperOptions"], outputs: ["searchValueChange", "valueChange", "visibleChange"], exportAs: ["cMultiSelect"] }, { kind: "component", type: i1.MultiSelectOptionComponent, selector: "c-multi-select-option", inputs: ["optionsStyle", "label", "text", "visible", "disabled", "selected", "value", "active", "role"], outputs: ["selectedChange", "focusChange"], exportAs: ["cMultiSelectOption"] }, { kind: "directive", type: i1.FormDirective, selector: "form[cForm]", inputs: ["validated"] }, { kind: "component", type: i1.FormCheckComponent, selector: "c-form-check", inputs: ["inline", "reverse", "sizing", "switch"], exportAs: ["cFormCheck"] }, { kind: "directive", type: i1.FormCheckLabelDirective, selector: "label[cFormCheckLabel]" }, { kind: "directive", type: i1.FormCheckInputDirective, selector: "input[cFormCheckInput]", inputs: ["type", "indeterminate", "valid"] }, { kind: "directive", type: i1.FormControlDirective, selector: "input[cFormControl], textarea[cFormControl]", inputs: ["sizing", "valid", "type", "plaintext"] }, { kind: "directive", type: i1.FormLabelDirective, selector: "[cLabel]", inputs: ["cLabel", "sizing"] }, { kind: "directive", type: i1$1.IconDirective, selector: "svg[cIcon]", inputs: ["cIcon", "customClasses", "size", "title", "height", "width", "name", "viewBox", "xmlns", "pointer-events", "role"], exportAs: ["cIcon"] }, { kind: "component", type: i1.DatePickerComponent, selector: "c-date-picker", inputs: ["calendars", "placeholder", "date"], outputs: ["dateChange"], exportAs: ["cDatePicker"] }, { kind: "directive", type: DecimalInputDirective, selector: "[wsDecimalInput]", inputs: ["wsDecimalInput", "wsAcceptStringInput"] }, { kind: "directive", type: ShowTooltipIfTruncatedDirective, selector: "[wsShowTooltipIfTruncated]", inputs: ["wsShowTooltipIfTruncated"] }, { kind: "directive", type: i1.TooltipDirective, selector: "[cTooltip]", inputs: ["cTooltip", "cTooltipOptions", "cTooltipPlacement", "cTooltipRef", "cTooltipTrigger", "cTooltipVisible"], outputs: ["cTooltipVisibleChange"], exportAs: ["cTooltip"] }, { kind: "directive", type: i1.ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "tabindex", "type", "variant"], exportAs: ["cButton"] }, { kind: "directive", type: i8.BsDatepickerDirective, selector: "[bsDatepicker]", inputs: ["placement", "triggers", "outsideClick", "container", "outsideEsc", "isDisabled", "minDate", "maxDate", "ignoreMinMaxErrors", "minMode", "daysDisabled", "datesDisabled", "datesEnabled", "dateCustomClasses", "dateTooltipTexts", "isOpen", "bsValue", "bsConfig"], outputs: ["onShown", "onHidden", "bsValueChange"], exportAs: ["bsDatepicker"] }, { kind: "directive", type: i8.BsDatepickerInputDirective, selector: "input[bsDatepicker]" }, { kind: "component", type: EditionListGroupedComponent, selector: "prg-ws-edition-list-grouped", inputs: ["label", "multiple", "hasFormError"], outputs: ["selectedEditionsChange"] }, { kind: "directive", type: MultiSelectStylerDirective, selector: "[wsMultiSelectStyler]", inputs: ["wsMultiSelectStyler", "options"] }, { kind: "component", type: i1.TimePickerComponent, selector: "c-time-picker", inputs: ["cleaner", "dateTimeFormatOptions", "disabled", "filterHours", "filterMinutes", "filterSeconds", "indicator", "inputReadOnly", "locale", "placeholder", "seconds", "size", "time", "variant", "valid", "visible"], outputs: ["timeChange"], exportAs: ["cTimePicker"] }, { kind: "component", type: DateTimePickerComponent, selector: "app-date-time-picker" }] });
|
|
2354
2399
|
}
|
|
2355
2400
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: MultiFormComponent, decorators: [{
|
|
2356
2401
|
type: Component,
|
|
2357
|
-
args: [{ selector: 'prg-ws-multi-form', standalone: false, template: "<form [formGroup]=\"multiForm\" cForm class=\"multiform-wrapper\" wsCircularFocus>\r\n @for (row of config?.rows; track $index; let isLast = $last) {\r\n <div class=\"row gx-3 multiform-inner\" [id]=\"formId\" [ngClass]=\"config?.rows?.length > 1 && !isLast ? 'border-bottom mb-3' : ''\">\r\n @for (field of row; track $index) {\r\n @if (field?.type !== FormFieldType.Separator && field?.type !== FormFieldType.FormHeader) {\r\n <div class=\"mb-3\" [class]=\"'field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\" [attr.data-id]=\"field.controlName\">\r\n @if (multiForm.controls[field.controlName]) {\r\n <!-- Label -->\r\n @if (field.label && field.type !== FormFieldType.Checkbox) {\r\n <label\r\n [wsShowTooltipIfTruncated]=\"field.label\"\r\n cLabel\r\n class=\"mb-1 label-multiform single-line-label\"\r\n [for]=\"field.controlName\"\r\n [ngClass]=\"{ 'text-danger': isFormSubmitted && multiForm.controls[field.controlName]?.errors }\"\r\n [ngStyle]=\"field.styles?.label\"\r\n >{{ field.label }}\r\n @if (field?.validations?.required || false) {\r\n <strong class=\"text-danger\">*</strong>\r\n }\r\n </label>\r\n }\r\n\r\n <!-- Text, Email, Number Inputs -->\r\n @if (\r\n field.type === FormFieldType.Text ||\r\n field.type === FormFieldType.Email ||\r\n field.type === FormFieldType.Number ||\r\n field.type === FormFieldType.Password ||\r\n field.type === FormFieldType.Url ||\r\n field.type === FormFieldType.Tel\r\n ) {\r\n <div class=\"position-relative w-100\">\r\n <input\r\n [type]=\"field.type\"\r\n cFormControl\r\n [formControlName]=\"field.controlName\"\r\n [id]=\"field.controlName\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [ngClass]=\"{\r\n 'form-invalid border-danger border border-2':\r\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors,\r\n 'no-label-margin': !field.label\r\n }\"\r\n [min]=\"field.validations?.min\"\r\n [max]=\"field.validations?.max\"\r\n [ngStyle]=\"field.styles?.field\" />\r\n\r\n @if (field.actionButton) {\r\n <button\r\n type=\"button\"\r\n [cTooltip]=\"field.actionButton?.tooltip\"\r\n tooltipPlacement=\"top\"\r\n cButton\r\n color=\"primary\"\r\n variant=\"outline\"\r\n aria-label=\"action\"\r\n class=\"d-flex position-absolute top-50 end-0 translate-middle-y me-2 btn p-0 border-0 bg-transparent\"\r\n (click)=\"onClickFieldAction($event, field)\">\r\n <svg cIcon class=\"text-primary\" [name]=\"field.actionButton.icon\" size=\"xl\"></svg>\r\n </button>\r\n }\r\n @if (multiForm.controls[field.controlName]?.touched || isFormSubmitted) {\r\n @if (multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['pattern']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is invalid</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Minimum length {{ field?.validations?.minLength }} characters is required\r\n </small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\r\n </small>\r\n }\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n <!-- Select Inputs -->\r\n @else if (field.type === FormFieldType.Select || field.type === inputType?.colorSelect) {\r\n <ng-container>\r\n <c-multi-select\r\n [multiple]=\"field?.multiple || false\"\r\n [allowCreateOptions]=\"field?.allowCreateOptions || false\"\r\n [search]=\"field?.allowCreateOptions || field?.allowSearch || field?.search || false\"\r\n [searchNoResultsLabel]=\"field?.searchNoResultsLabel || 'No results found'\"\r\n [clearSearchOnSelect]=\"true\"\r\n [selectionType]=\"field?.selectionType || 'tags'\"\r\n [cleaner]=\"field?.allowCleaner === false ? false : true\"\r\n [formControlName]=\"field.controlName\"\r\n [placeholder]=\"field.placeholder || 'Select'\"\r\n [wsMultiSelectStyler]=\"field.type === inputType?.colorSelect\"\r\n [options]=\"colorCodes$\"\r\n [optionsMaxHeight]=\"400\"\r\n [ngClass]=\"{\r\n 'form-invalid': (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n (searchValueChange)=\"handleSearch(field, $event)\"\r\n (valueChange)=\"onValueChange($event, field.controlName)\"\r\n [ngStyle]=\"field.styles?.field\">\r\n @if (field.type === inputType?.colorSelect) {\r\n @for (option of colorCodes$; track $index) {\r\n <c-multi-select-option [value]=\"option?.label\">\r\n <label class=\"d-flex gap-2\">\r\n <span class=\"color-box\" [style.background-color]=\"option?.value\"></span>\r\n {{ option.label }}\r\n </label>\r\n </c-multi-select-option>\r\n }\r\n } @else {\r\n @for (option of field.options; track $index) {\r\n <c-multi-select-option [value]=\"option?.value\">\r\n {{ option.label }}\r\n </c-multi-select-option>\r\n }\r\n }\r\n </c-multi-select>\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n\r\n <!-- Date input -->\r\n @else if (field.type === FormFieldType.Date) {\r\n <ng-container>\r\n <input\r\n type=\"text\"\r\n [placeholder]=\"field?.label || 'Select Date'\"\r\n class=\"form-control\"\r\n [ngClass]=\"{\r\n 'form-invalid': (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n (bsValueChange)=\"onDateValueChange($event, field.controlName)\"\r\n [formControlName]=\"field.controlName\"\r\n [dateInputFormat]=\"configurationService?.allConfigValues()?.defaultDateFormat || 'MM/DD/YYYY'\"\r\n [bsConfig]=\"{\r\n containerClass: 'pongrass-red-datepicker',\r\n showWeekNumbers: false,\r\n adaptivePosition: true,\r\n useUtc: false\r\n }\"\r\n bsDatepicker\r\n [ngStyle]=\"field.styles?.field\" />\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n\r\n @else if (field.type === FormFieldType.NewDate) {\r\n <ng-container>\r\n <c-date-picker\r\n [formControlName]=\"field.controlName\"\r\n [calendarDate]=\"multiForm.controls[field.controlName]?.value\"\r\n inputReadOnly=\"true\"\r\n [showAdjacentDays]=\"false\"\r\n locale=\"en-US\">\r\n </c-date-picker>\r\n </ng-container>\r\n }\r\n\r\n <!-- Date Time input -->\r\n @else if (field.type === FormFieldType.Datetime) {\r\n <app-date-time-picker [formControlName]=\"field.controlName\"></app-date-time-picker>\r\n }\r\n\r\n <!-- Textarea -->\r\n @else if (field.type === FormFieldType.Textarea) {\r\n <ng-container>\r\n <textarea\r\n cFormControl\r\n [id]=\"field.controlName\"\r\n [rows]=\"field?.textareaRows || 4\"\r\n [columns]=\"field?.textareaColumns || 4\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [ngClass]=\"{\r\n 'form-invalid border-danger border border-2':\r\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n [formControlName]=\"field.controlName\"\r\n [ngStyle]=\"field.styles?.field\"></textarea>\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Minimum length {{ field?.validations?.minLength }} characters is required\r\n </small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\r\n </small>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n <!-- Checkbox -->\r\n @else if (field.type === FormFieldType.Checkbox) {\r\n <div class=\"no-label-margin\">\r\n <input cFormCheckInput [id]=\"field.controlName\" type=\"checkbox\" [formControlName]=\"field.controlName\" [ngStyle]=\"field.styles?.field\" />\r\n <label cFormCheckLabel [for]=\"field.controlName\" class=\"ms-2\" [ngStyle]=\"field.styles?.label\">{{ field.label }}</label>\r\n </div>\r\n }\r\n\r\n @else if (field.type === FormFieldType.Switch) {\r\n <c-form-check sizing=\"lg\" [switch]=\"true\">\r\n <input cFormCheckInput [id]=\"field.controlName\" type=\"checkbox\" [formControlName]=\"field.controlName\" [ngStyle]=\"field.styles?.field\" />\r\n <label cFormCheckLabel [for]=\"field.controlName\" class=\"ms-2\" [ngStyle]=\"field.styles?.label\">{{ field.info }}</label>\r\n </c-form-check>\r\n }\r\n <!-- Decimal input -->\r\n @else if (field.type === FormFieldType.Float) {\r\n <ng-container>\r\n <input\r\n cFormControl\r\n [id]=\"field.controlName\"\r\n type=\"number\"\r\n class=\"me-2\"\r\n [formControlName]=\"field.controlName\"\r\n [wsDecimalInput]=\"field.validations?.precision || 2\"\r\n [ngClass]=\"{\r\n 'form-invalid border-danger border border-2':\r\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n [min]=\"field.validations?.min\"\r\n [max]=\"field.validations?.max\"\r\n [ngStyle]=\"field.styles?.field\" />\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['pattern']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is invalid</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Minimum length {{ field?.validations?.minLength }} characters is required\r\n </small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\r\n </small>\r\n }\r\n }\r\n </ng-container>\r\n } @else if (field.type === FormFieldType.Edition) {\r\n <ng-container>\r\n <prg-ws-edition-list-grouped\r\n (selectedEditionsChange)=\"onEditionChange($event)\"\r\n [multiple]=\"field?.multiple === false ? false : true\"\r\n [hasFormError]=\"isFormSubmitted && multiForm.controls[field.controlName]?.errors\">\r\n </prg-ws-edition-list-grouped>\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n }\r\n }\r\n </ng-container>\r\n } @else if (field.type === FormFieldType.Timepicker) {\r\n <c-time-picker [formControlName]=\"field.controlName\" seconds />\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n @if (field?.type === FormFieldType.Separator) {\r\n <div [class]=\"'field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\"></div>\r\n }\r\n @if (field?.type === FormFieldType.FormHeader) {\r\n <div [class]=\"'fs-6 fw-bold my-2 field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\">{{ field?.label }}</div>\r\n }\r\n }\r\n </div>\r\n }\r\n</form>\r\n", styles: [".no-label-margin{margin-top:1.6rem}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}.h-135{height:135px}.single-line-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;display:block}.label-multiform{font-size:16px;font-weight:400}.field-checkbox{display:flex;align-items:center}::ng-deep [data-coreui-theme=dark] .bs-datepicker{background:#212631;box-shadow:0 0 10px #323a49}::ng-deep [data-coreui-theme=dark] .bs-datepicker .bs-datepicker-body{border:1px solid #323a49}::ng-deep .pongrass-red-datepicker .bs-datepicker-head{background-color:#ff4d5c}::ng-deep .pongrass-red-datepicker .bs-datepicker-body table td span.selected,::ng-deep .pongrass-red-datepicker .theme-red .bs-datepicker-body table td.selected span,::ng-deep .pongrass-red-datepicker .theme-red .bs-datepicker-body table td span[class*=select-]:after,::ng-deep .pongrass-red-datepicker .theme-red .bs-datepicker-body table td[class*=select-] span:after{background-color:#ff4d5c}::ng-deep .pongrass-red-datepicker .bs-datepicker-body table td.week span{color:#ff4d5c}\n"] }]
|
|
2402
|
+
args: [{ selector: 'prg-ws-multi-form', standalone: false, template: "<form [formGroup]=\"multiForm\" cForm class=\"multiform-wrapper\" wsCircularFocus>\r\n @for (row of config?.rows; track $index; let isLast = $last) {\r\n <div class=\"row gx-3 multiform-inner\" [id]=\"formId\" [ngClass]=\"config?.rows?.length > 1 && !isLast ? 'border-bottom mb-3' : ''\">\r\n @for (field of row; track $index) {\r\n @if (field?.type !== FormFieldType.Separator && field?.type !== FormFieldType.FormHeader) {\r\n <div class=\"mb-3\" [class]=\"'field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\" [attr.data-id]=\"field.controlName\">\r\n @if (multiForm.controls[field.controlName]) {\r\n <!-- Label -->\r\n @if (field.label && field.type !== FormFieldType.Checkbox) {\r\n <label\r\n [wsShowTooltipIfTruncated]=\"field.label\"\r\n cLabel\r\n class=\"mb-1 label-multiform single-line-label\"\r\n [for]=\"field.controlName\"\r\n [ngClass]=\"{ 'text-danger': isFormSubmitted && multiForm.controls[field.controlName]?.errors }\"\r\n [ngStyle]=\"field.styles?.label\"\r\n >{{ field.label }}\r\n @if (field?.validations?.required || false) {\r\n <strong class=\"text-danger\">*</strong>\r\n }\r\n </label>\r\n }\r\n\r\n <!-- Text, Email, Number Inputs -->\r\n @if (\r\n field.type === FormFieldType.Text ||\r\n field.type === FormFieldType.Email ||\r\n field.type === FormFieldType.Number ||\r\n field.type === FormFieldType.Password ||\r\n field.type === FormFieldType.Url ||\r\n field.type === FormFieldType.Tel\r\n ) {\r\n <div class=\"position-relative w-100\">\r\n <input\r\n [type]=\"field.type\"\r\n cFormControl\r\n [formControlName]=\"field.controlName\"\r\n [id]=\"field.controlName\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [ngClass]=\"{\r\n 'form-invalid border-danger border border-2':\r\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors,\r\n 'no-label-margin': !field.label\r\n }\"\r\n [min]=\"field.validations?.min\"\r\n [max]=\"field.validations?.max\"\r\n [ngStyle]=\"field.styles?.field\" />\r\n\r\n @if (field.actionButton) {\r\n <button\r\n type=\"button\"\r\n [cTooltip]=\"field.actionButton?.tooltip\"\r\n tooltipPlacement=\"top\"\r\n cButton\r\n color=\"primary\"\r\n variant=\"outline\"\r\n aria-label=\"action\"\r\n class=\"d-flex position-absolute top-50 end-0 translate-middle-y me-2 btn p-0 border-0 bg-transparent\"\r\n (click)=\"onClickFieldAction($event, field)\">\r\n <svg cIcon class=\"text-primary\" [name]=\"field.actionButton.icon\" size=\"xl\"></svg>\r\n </button>\r\n }\r\n @if (multiForm.controls[field.controlName]?.touched || isFormSubmitted) {\r\n @if (multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['pattern']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is invalid</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Minimum length {{ field?.validations?.minLength }} characters is required\r\n </small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\r\n </small>\r\n }\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n <!-- Select Inputs -->\r\n @else if (field.type === FormFieldType.Select || field.type === inputType?.colorSelect) {\r\n <ng-container>\r\n <c-multi-select\r\n [multiple]=\"field?.multiple || false\"\r\n [allowCreateOptions]=\"field?.allowCreateOptions || false\"\r\n [search]=\"field?.allowCreateOptions || field?.allowSearch || field?.search || false\"\r\n [searchNoResultsLabel]=\"field?.searchNoResultsLabel || 'No results found'\"\r\n [clearSearchOnSelect]=\"true\"\r\n [selectionType]=\"field?.selectionType || 'tags'\"\r\n [cleaner]=\"field?.allowCleaner === false ? false : true\"\r\n [formControlName]=\"field.controlName\"\r\n [placeholder]=\"field.placeholder || 'Select'\"\r\n [wsMultiSelectStyler]=\"field.type === inputType?.colorSelect\"\r\n [options]=\"colorCodes$\"\r\n [optionsMaxHeight]=\"400\"\r\n [ngClass]=\"{\r\n 'form-invalid': (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n (searchValueChange)=\"handleSearch(field, $event)\"\r\n (valueChange)=\"onValueChange($event, field.controlName)\"\r\n [ngStyle]=\"field.styles?.field\">\r\n @if (field.type === inputType?.colorSelect) {\r\n @for (option of colorCodes$; track $index) {\r\n <c-multi-select-option [value]=\"option?.label\">\r\n <label class=\"d-flex gap-2\">\r\n <span class=\"color-box\" [style.background-color]=\"option?.value\"></span>\r\n {{ option.label }}\r\n </label>\r\n </c-multi-select-option>\r\n }\r\n } @else {\r\n @for (option of field.options; track $index) {\r\n <c-multi-select-option [value]=\"option?.value\">\r\n {{ option.label }}\r\n </c-multi-select-option>\r\n }\r\n }\r\n </c-multi-select>\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n\r\n <!-- Date input -->\r\n @else if (field.type === FormFieldType.Date) {\r\n <ng-container>\r\n <input\r\n type=\"text\"\r\n [placeholder]=\"field?.label || 'Select Date'\"\r\n class=\"form-control\"\r\n [ngClass]=\"{\r\n 'form-invalid': (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n (bsValueChange)=\"onDateValueChange($event, field.controlName)\"\r\n [formControlName]=\"field.controlName\"\r\n [dateInputFormat]=\"configurationService?.allConfigValues()?.defaultDateFormat || 'MM/DD/YYYY'\"\r\n [bsConfig]=\"{\r\n containerClass: 'pongrass-red-datepicker',\r\n showWeekNumbers: false,\r\n adaptivePosition: true,\r\n useUtc: false\r\n }\"\r\n bsDatepicker\r\n [ngStyle]=\"field.styles?.field\" />\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n\r\n @else if (field.type === FormFieldType.NewDate) {\r\n <ng-container>\r\n <c-date-picker\r\n [formControlName]=\"field.controlName\"\r\n [calendarDate]=\"multiForm.controls[field.controlName]?.value\"\r\n inputReadOnly=\"true\"\r\n [showAdjacentDays]=\"false\"\r\n locale=\"en-US\">\r\n </c-date-picker>\r\n </ng-container>\r\n }\r\n\r\n <!-- Date Time input -->\r\n @else if (field.type === FormFieldType.Datetime) {\r\n <app-date-time-picker [formControlName]=\"field.controlName\"></app-date-time-picker>\r\n }\r\n\r\n <!-- Textarea -->\r\n @else if (field.type === FormFieldType.Textarea) {\r\n <ng-container>\r\n <textarea\r\n cFormControl\r\n [id]=\"field.controlName\"\r\n [rows]=\"field?.textareaRows || 4\"\r\n [columns]=\"field?.textareaColumns || 4\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [ngClass]=\"{\r\n 'form-invalid border-danger border border-2':\r\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n [formControlName]=\"field.controlName\"\r\n [ngStyle]=\"field.styles?.field\"></textarea>\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Minimum length {{ field?.validations?.minLength }} characters is required\r\n </small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\r\n </small>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n <!-- Checkbox -->\r\n @else if (field.type === FormFieldType.Checkbox) {\r\n <div class=\"no-label-margin\">\r\n <input cFormCheckInput [id]=\"field.controlName\" type=\"checkbox\" [formControlName]=\"field.controlName\" [ngStyle]=\"field.styles?.field\" />\r\n <label cFormCheckLabel [for]=\"field.controlName\" class=\"ms-2\" [ngStyle]=\"field.styles?.label\">{{ field.label }}</label>\r\n </div>\r\n }\r\n\r\n @else if (field.type === FormFieldType.Switch) {\r\n <c-form-check sizing=\"lg\" [switch]=\"true\">\r\n <input cFormCheckInput [id]=\"field.controlName\" type=\"checkbox\" [formControlName]=\"field.controlName\" [ngStyle]=\"field.styles?.field\" />\r\n <label cFormCheckLabel [for]=\"field.controlName\" class=\"ms-2\" [ngStyle]=\"field.styles?.label\">{{ field.info }}</label>\r\n </c-form-check>\r\n }\r\n <!-- Decimal input -->\r\n @else if (field.type === FormFieldType.Float) {\r\n <ng-container>\r\n <input\r\n cFormControl\r\n [id]=\"field.controlName\"\r\n type=\"number\"\r\n class=\"me-2\"\r\n [formControlName]=\"field.controlName\"\r\n [wsDecimalInput]=\"field.validations?.precision || configurationService?.allConfigValues()?.formConfig?.formValidations?.defaultDecimalPrecision || 2\"\r\n [wsAcceptStringInput]=\"false\"\r\n [placeholder]=\"field.placeholder || ''\"\r\n [ngClass]=\"{\r\n 'form-invalid border-danger border border-2':\r\n (multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors\r\n }\"\r\n [min]=\"field.validations?.min\"\r\n [max]=\"field.validations?.max\"\r\n [ngStyle]=\"field.styles?.field\" />\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['pattern']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is invalid</small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['minlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Minimum length {{ field?.validations?.minLength }} characters is required\r\n </small>\r\n } @else if (multiForm.controls[field.controlName]?.errors?.['maxlength']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">\r\n Maximum length {{ field?.validations?.maxLength }} characters is allowed\r\n </small>\r\n }\r\n }\r\n </ng-container>\r\n } @else if (field.type === FormFieldType.Edition) {\r\n <ng-container>\r\n <prg-ws-edition-list-grouped\r\n (selectedEditionsChange)=\"onEditionChange($event)\"\r\n [multiple]=\"field?.multiple === false ? false : true\"\r\n [hasFormError]=\"isFormSubmitted && multiForm.controls[field.controlName]?.errors\">\r\n </prg-ws-edition-list-grouped>\r\n @if ((multiForm.controls[field.controlName]?.touched || isFormSubmitted) && multiForm.controls[field.controlName]?.errors) {\r\n @if (multiForm.controls[field.controlName]?.errors?.['required']) {\r\n <small class=\"text-danger fst-italic form-invalid-label\">{{ field?.label }} is required</small>\r\n }\r\n }\r\n </ng-container>\r\n } @else if (field.type === FormFieldType.Timepicker) {\r\n <c-time-picker [formControlName]=\"field.controlName\" seconds />\r\n }\r\n }\r\n </div>\r\n }\r\n\r\n @if (field?.type === FormFieldType.Separator) {\r\n <div [class]=\"'field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\"></div>\r\n }\r\n @if (field?.type === FormFieldType.FormHeader) {\r\n <div [class]=\"'fs-6 fw-bold my-2 field-' + field.type\" [ngClass]=\"field.colspan ? 'col-md-' + field.colspan : 'col'\">{{ field?.label }}</div>\r\n }\r\n }\r\n </div>\r\n }\r\n</form>\r\n", styles: [".no-label-margin{margin-top:1.6rem}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}.h-135{height:135px}.single-line-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;display:block}.label-multiform{font-size:16px;font-weight:400}.field-checkbox{display:flex;align-items:center}::ng-deep [data-coreui-theme=dark] .bs-datepicker{background:#212631;box-shadow:0 0 10px #323a49}::ng-deep [data-coreui-theme=dark] .bs-datepicker .bs-datepicker-body{border:1px solid #323a49}::ng-deep .pongrass-red-datepicker .bs-datepicker-head{background-color:#ff4d5c}::ng-deep .pongrass-red-datepicker .bs-datepicker-body table td span.selected,::ng-deep .pongrass-red-datepicker .theme-red .bs-datepicker-body table td.selected span,::ng-deep .pongrass-red-datepicker .theme-red .bs-datepicker-body table td span[class*=select-]:after,::ng-deep .pongrass-red-datepicker .theme-red .bs-datepicker-body table td[class*=select-] span:after{background-color:#ff4d5c}::ng-deep .pongrass-red-datepicker .bs-datepicker-body table td.week span{color:#ff4d5c}\n"] }]
|
|
2358
2403
|
}], ctorParameters: () => [], propDecorators: { config: [{
|
|
2359
2404
|
type: Input
|
|
2360
2405
|
}], showUnsavedFlags: [{
|
|
@@ -2548,7 +2593,7 @@ class TableGridComponent {
|
|
|
2548
2593
|
subscribeUntil$ = new Subject();
|
|
2549
2594
|
autoSizeStrategy = {
|
|
2550
2595
|
type: 'fitCellContents',
|
|
2551
|
-
defaultMinWidth: 100
|
|
2596
|
+
defaultMinWidth: this.configurationService.allConfigValues()?.tableGridConfig?.defaultMinWidth || 100
|
|
2552
2597
|
};
|
|
2553
2598
|
/**
|
|
2554
2599
|
* Resize all columns to fit the grid width while maintaining their minimum widths.
|
|
@@ -2659,7 +2704,7 @@ class TableGridComponent {
|
|
|
2659
2704
|
const initialState = this.tableGridState.map(item => ({
|
|
2660
2705
|
colId: item.key,
|
|
2661
2706
|
hide: item.visible === null || item.visible === undefined ? false : !item.visible,
|
|
2662
|
-
width: item.width,
|
|
2707
|
+
width: item.width || this.configurationService.allConfigValues()?.tableGridConfig?.defaultMinWidth || 100,
|
|
2663
2708
|
sort: item.sort || null
|
|
2664
2709
|
}));
|
|
2665
2710
|
this.gridAPI.api.applyColumnState({
|
|
@@ -2673,7 +2718,7 @@ class TableGridComponent {
|
|
|
2673
2718
|
this.tableGridState.push({
|
|
2674
2719
|
key: columnState.colId,
|
|
2675
2720
|
visible: columnState.hide ? !columnState.hide : true,
|
|
2676
|
-
width: columnState.width,
|
|
2721
|
+
width: columnState.width || this.configurationService.allConfigValues()?.tableGridConfig?.defaultMinWidth || 100,
|
|
2677
2722
|
sort: columnState.sort
|
|
2678
2723
|
});
|
|
2679
2724
|
});
|
|
@@ -2808,7 +2853,7 @@ class TableGridComponent {
|
|
|
2808
2853
|
}
|
|
2809
2854
|
this.tableConfiguration.initialState.forEach((col) => {
|
|
2810
2855
|
col.visible = col.visible === null || col.visible === undefined ? true : col.visible;
|
|
2811
|
-
col.width =
|
|
2856
|
+
col.width = col.width || this.configurationService.allConfigValues()?.tableGridConfig?.defaultMinWidth || 100;
|
|
2812
2857
|
col.sort = null;
|
|
2813
2858
|
this.tableGridState.push(col);
|
|
2814
2859
|
this.columnsListselectionForm.controls[col.key].setValue(true);
|
|
@@ -2818,7 +2863,7 @@ class TableGridComponent {
|
|
|
2818
2863
|
state: this.tableGridState.map(item => ({
|
|
2819
2864
|
colId: item.key,
|
|
2820
2865
|
hide: item.visible === null || item.visible === undefined ? false : !item.visible,
|
|
2821
|
-
width:
|
|
2866
|
+
width: item.width || this.configurationService.allConfigValues()?.tableGridConfig?.defaultMinWidth || 100,
|
|
2822
2867
|
sort: item.sort || null,
|
|
2823
2868
|
flex: 1
|
|
2824
2869
|
})),
|
|
@@ -2884,7 +2929,7 @@ class TableGridComponent {
|
|
|
2884
2929
|
const columnState = this.tableGridState.map(item => ({
|
|
2885
2930
|
colId: item.key,
|
|
2886
2931
|
hide: true,
|
|
2887
|
-
width:
|
|
2932
|
+
width: this.configurationService.allConfigValues()?.tableGridConfig?.defaultMinWidth || 100,
|
|
2888
2933
|
sort: item.sort || null,
|
|
2889
2934
|
flex: 1
|
|
2890
2935
|
}));
|