@masterteam/components 0.0.2 → 0.0.4
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/masterteam-components-checkbox-field.mjs +1 -1
- package/fesm2022/masterteam-components-checkbox-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-date-field.mjs +1 -1
- package/fesm2022/masterteam-components-date-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-field-validation.mjs +137 -0
- package/fesm2022/masterteam-components-field-validation.mjs.map +1 -0
- package/fesm2022/masterteam-components-icon-field.mjs +6 -170
- package/fesm2022/masterteam-components-icon-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-multi-select-field.mjs +1 -1
- package/fesm2022/masterteam-components-multi-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-number-field.mjs +4 -3
- package/fesm2022/masterteam-components-number-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-select-field.mjs +1 -1
- package/fesm2022/masterteam-components-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-slider-field.mjs +1 -1
- package/fesm2022/masterteam-components-slider-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-text-field.mjs +25 -9
- package/fesm2022/masterteam-components-text-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-textarea-field.mjs +2 -2
- package/fesm2022/masterteam-components-textarea-field.mjs.map +1 -1
- package/fesm2022/masterteam-components.mjs +321 -22
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/field-validation/index.d.ts +13 -0
- package/index.d.ts +244 -1
- package/number-field/index.d.ts +2 -2
- package/package.json +19 -13
- package/text-field/index.d.ts +2 -2
- package/assets/mticons/fonts/mticons.svg +0 -483
- package/assets/mticons/fonts/mticons.ttf +0 -0
- package/assets/mticons/fonts/mticons.woff +0 -0
- package/assets/mticons/fonts/mticons.woff2 +0 -0
- package/assets/mticons/mticons.css +0 -35
- package/assets/mticons/style.css +0 -1446
|
@@ -56,7 +56,7 @@ class CheckboxField {
|
|
|
56
56
|
this.disabled.set(disabled);
|
|
57
57
|
}
|
|
58
58
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CheckboxField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
59
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: CheckboxField, isStandalone: true, selector: "mt-checkbox-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChange: "onChange" }, host: { properties: { "class": "class()" } }, viewQueries: [{ propertyName: "checkbox", first: true, predicate: ["checkbox"], descendants: true, static: true }], ngImport: i0, template: "<p-checkbox\n #checkbox=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onChange)=\"onChange.emit($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [binary]=\"true\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n class=\"leading-none\"\n></p-checkbox>\n@if (label()) {\n <label\n class=\"ms-2\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n", styles: [":host{display:flex;align-items:center}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i2.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "
|
|
59
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: CheckboxField, isStandalone: true, selector: "mt-checkbox-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChange: "onChange" }, host: { properties: { "class": "class()" } }, viewQueries: [{ propertyName: "checkbox", first: true, predicate: ["checkbox"], descendants: true, static: true }], ngImport: i0, template: "<p-checkbox\n #checkbox=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onChange)=\"onChange.emit($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [binary]=\"true\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n class=\"leading-none\"\n></p-checkbox>\n@if (label()) {\n <label\n class=\"ms-2\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n", styles: [":host{display:flex;align-items:center}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i2.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "styleClass", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }] });
|
|
60
60
|
}
|
|
61
61
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CheckboxField, decorators: [{
|
|
62
62
|
type: Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masterteam-components-checkbox-field.mjs","sources":["../../../../packages/masterteam/components/checkbox-field/checkbox-field.ts","../../../../packages/masterteam/components/checkbox-field/checkbox-field.html","../../../../packages/masterteam/components/checkbox-field/masterteam-components-checkbox-field.ts"],"sourcesContent":["import {\n Component,\n ViewChild,\n signal,\n input,\n effect,\n output,\n inject,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport {\n CheckboxModule,\n Checkbox,\n CheckboxChangeEvent,\n} from 'primeng/checkbox';\n\n@Component({\n selector: 'mt-checkbox-field',\n standalone: true,\n imports: [FormsModule, CheckboxModule],\n templateUrl: './checkbox-field.html',\n styleUrls: ['./checkbox-field.scss'],\n host: {\n '[class]': 'class()',\n },\n})\nexport class CheckboxField implements ControlValueAccessor {\n @ViewChild('checkbox', { static: true })\n checkbox: Checkbox;\n\n label = input<string>();\n placeholder = input<string>();\n class = input<string>('');\n readonly = input<boolean>(false);\n pInputs = input<Partial<Checkbox>>();\n\n onChange = output<CheckboxChangeEvent>();\n\n public ngControl = inject(NgControl, { self: true });\n\n requiredValidator = Validators.required;\n value = signal<boolean | null>(null);\n disabled = signal<boolean>(false);\n\n onTouched: () => void = () => {};\n onModelChange: (value: boolean | null) => void = () => {};\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n\n // Effect to apply pInputs reactively when the pInputs signal changes\n effect(() => {\n const currentPInputs = this.pInputs();\n // Ensure checkbox ViewChild is initialized and pInputs has a value\n // @ViewChild with static: true makes 'checkbox' available during construction/ngOnInit\n if (this.checkbox && currentPInputs) {\n this.applyInputsToCheckbox();\n }\n });\n }\n\n applyInputsToCheckbox() {\n const currentPInputs = this.pInputs();\n if (currentPInputs) {\n Object.assign(this.checkbox, currentPInputs);\n }\n }\n\n onValueChange(value: boolean | null) {\n this.onModelChange(value);\n this.value.set(value);\n }\n\n writeValue(value: boolean | null) {\n this.value.set(value);\n }\n\n registerOnChange(fn: any) {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: any) {\n this.onTouched = fn;\n }\n\n setDisabledState(disabled: boolean) {\n this.disabled.set(disabled);\n }\n}\n","<p-checkbox\n #checkbox=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onChange)=\"onChange.emit($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [binary]=\"true\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n class=\"leading-none\"\n></p-checkbox>\n@if (label()) {\n <label\n class=\"ms-2\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MA+Ba,aAAa,CAAA;AAExB,IAAA,QAAQ;IAER,KAAK,GAAG,KAAK,EAAU;IACvB,WAAW,GAAG,KAAK,EAAU;AAC7B,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC;AACzB,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,CAAC;IAChC,OAAO,GAAG,KAAK,EAAqB;IAEpC,QAAQ,GAAG,MAAM,EAAuB;IAEjC,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAEpD,IAAA,iBAAiB,GAAG,UAAU,CAAC,QAAQ;AACvC,IAAA,KAAK,GAAG,MAAM,CAAiB,IAAI,CAAC;AACpC,IAAA,QAAQ,GAAG,MAAM,CAAU,KAAK,CAAC;AAEjC,IAAA,SAAS,GAAe,MAAK,
|
|
1
|
+
{"version":3,"file":"masterteam-components-checkbox-field.mjs","sources":["../../../../packages/masterteam/components/checkbox-field/checkbox-field.ts","../../../../packages/masterteam/components/checkbox-field/checkbox-field.html","../../../../packages/masterteam/components/checkbox-field/masterteam-components-checkbox-field.ts"],"sourcesContent":["import {\n Component,\n ViewChild,\n signal,\n input,\n effect,\n output,\n inject,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport {\n CheckboxModule,\n Checkbox,\n CheckboxChangeEvent,\n} from 'primeng/checkbox';\n\n@Component({\n selector: 'mt-checkbox-field',\n standalone: true,\n imports: [FormsModule, CheckboxModule],\n templateUrl: './checkbox-field.html',\n styleUrls: ['./checkbox-field.scss'],\n host: {\n '[class]': 'class()',\n },\n})\nexport class CheckboxField implements ControlValueAccessor {\n @ViewChild('checkbox', { static: true })\n checkbox: Checkbox;\n\n label = input<string>();\n placeholder = input<string>();\n class = input<string>('');\n readonly = input<boolean>(false);\n pInputs = input<Partial<Checkbox>>();\n\n onChange = output<CheckboxChangeEvent>();\n\n public ngControl = inject(NgControl, { self: true });\n\n requiredValidator = Validators.required;\n value = signal<boolean | null>(null);\n disabled = signal<boolean>(false);\n\n onTouched: () => void = () => {};\n onModelChange: (value: boolean | null) => void = () => {};\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n\n // Effect to apply pInputs reactively when the pInputs signal changes\n effect(() => {\n const currentPInputs = this.pInputs();\n // Ensure checkbox ViewChild is initialized and pInputs has a value\n // @ViewChild with static: true makes 'checkbox' available during construction/ngOnInit\n if (this.checkbox && currentPInputs) {\n this.applyInputsToCheckbox();\n }\n });\n }\n\n applyInputsToCheckbox() {\n const currentPInputs = this.pInputs();\n if (currentPInputs) {\n Object.assign(this.checkbox, currentPInputs);\n }\n }\n\n onValueChange(value: boolean | null) {\n this.onModelChange(value);\n this.value.set(value);\n }\n\n writeValue(value: boolean | null) {\n this.value.set(value);\n }\n\n registerOnChange(fn: any) {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: any) {\n this.onTouched = fn;\n }\n\n setDisabledState(disabled: boolean) {\n this.disabled.set(disabled);\n }\n}\n","<p-checkbox\n #checkbox=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onChange)=\"onChange.emit($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [binary]=\"true\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n class=\"leading-none\"\n></p-checkbox>\n@if (label()) {\n <label\n class=\"ms-2\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MA+Ba,aAAa,CAAA;AAExB,IAAA,QAAQ;IAER,KAAK,GAAG,KAAK,EAAU;IACvB,WAAW,GAAG,KAAK,EAAU;AAC7B,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC;AACzB,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,CAAC;IAChC,OAAO,GAAG,KAAK,EAAqB;IAEpC,QAAQ,GAAG,MAAM,EAAuB;IAEjC,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AA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
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
62
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: DateField, isStandalone: true, selector: "mt-date-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, showIcon: { classPropertyName: "showIcon", publicName: "showIcon", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null }, showTime: { classPropertyName: "showTime", publicName: "showTime", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.styleClass" }, classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "calendar", first: true, predicate: ["calendar"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "@if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-datepicker\n #calendar\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n [baseZIndex]=\"1051\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n styleClass=\"w-full\"\n [showIcon]=\"showIcon()\"\n [showClear]=\"showClear()\"\n [showTime]=\"showTime()\"\n appendTo=\"body\"\n>\n</p-datepicker>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i2.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "
|
|
62
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: DateField, isStandalone: true, selector: "mt-date-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, showIcon: { classPropertyName: "showIcon", publicName: "showIcon", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null }, showTime: { classPropertyName: "showTime", publicName: "showTime", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.styleClass" }, classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "calendar", first: true, predicate: ["calendar"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "@if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-datepicker\n #calendar\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n [baseZIndex]=\"1051\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n styleClass=\"w-full\"\n [showIcon]=\"showIcon()\"\n [showClear]=\"showClear()\"\n [showTime]=\"showTime()\"\n appendTo=\"body\"\n>\n</p-datepicker>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i2.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "styleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "readonlyInput", "shortYearCutoff", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "view", "defaultDate", "appendTo"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }] });
|
|
63
63
|
}
|
|
64
64
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DateField, decorators: [{
|
|
65
65
|
type: Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masterteam-components-date-field.mjs","sources":["../../../../packages/masterteam/components/date-field/date-field.ts","../../../../packages/masterteam/components/date-field/date-field.html","../../../../packages/masterteam/components/date-field/masterteam-components-date-field.ts"],"sourcesContent":["import {\n Component,\n HostBinding,\n OnChanges,\n OnInit,\n SimpleChanges,\n ViewChild,\n signal,\n input,\n inject,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport { DatePickerModule, DatePicker } from 'primeng/datepicker';\n\n@Component({\n selector: 'mt-date-field',\n standalone: true,\n imports: [FormsModule, DatePickerModule],\n templateUrl: './date-field.html',\n styleUrls: ['./date-field.scss'],\n host: {\n class: 'grid gap-1',\n },\n})\nexport class DateField implements ControlValueAccessor, OnInit, OnChanges {\n @ViewChild('calendar', { static: true })\n calendar: DatePicker;\n\n readonly field = input<boolean>(true);\n readonly label = input<string>();\n readonly placeholder = input<string>();\n readonly class = input<string>('');\n readonly readonly = input<boolean>(false);\n readonly showIcon = input<boolean>(true);\n readonly showClear = input<boolean>(false);\n readonly showTime = input<boolean>(false);\n readonly pInputs = input<Partial<DatePicker>>();\n\n @HostBinding('class') styleClass: string;\n\n requiredValidator = Validators.required;\n value = signal<string | null>(null);\n disabled = signal<boolean>(false);\n\n onTouched: () => void = () => {};\n onModelChange: (value: string) => void = () => {};\n\n public ngControl = inject(NgControl, { self: true });\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n applyInputsToCalendar() {\n Object.assign(this.calendar, this.pInputs());\n }\n\n ngOnInit() {\n this.styleClass = this.class();\n if (this.pInputs()) {\n this.applyInputsToCalendar();\n }\n }\n onValueChange(value: string) {\n this.onModelChange(value);\n this.value.set(value);\n }\n ngOnChanges(changes: SimpleChanges) {\n if (changes['pInputs']) {\n this.applyInputsToCalendar();\n }\n }\n\n writeValue(value: string) {\n this.value.set(value);\n }\n\n registerOnChange(fn: any) {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: any) {\n this.onTouched = fn;\n }\n\n setDisabledState(disabled: boolean) {\n this.disabled.set(disabled);\n }\n}\n","@if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-datepicker\n #calendar\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n [baseZIndex]=\"1051\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n styleClass=\"w-full\"\n [showIcon]=\"showIcon()\"\n [showClear]=\"showClear()\"\n [showTime]=\"showTime()\"\n appendTo=\"body\"\n>\n</p-datepicker>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MA6Ba,SAAS,CAAA;AAEpB,IAAA,QAAQ;AAEC,IAAA,KAAK,GAAG,KAAK,CAAU,IAAI,CAAC;IAC5B,KAAK,GAAG,KAAK,EAAU;IACvB,WAAW,GAAG,KAAK,EAAU;AAC7B,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC;AACzB,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,CAAC;AAChC,IAAA,QAAQ,GAAG,KAAK,CAAU,IAAI,CAAC;AAC/B,IAAA,SAAS,GAAG,KAAK,CAAU,KAAK,CAAC;AACjC,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,CAAC;IAChC,OAAO,GAAG,KAAK,EAAuB;AAEzB,IAAA,UAAU;AAEhC,IAAA,iBAAiB,GAAG,UAAU,CAAC,QAAQ;AACvC,IAAA,KAAK,GAAG,MAAM,CAAgB,IAAI,CAAC;AACnC,IAAA,QAAQ,GAAG,MAAM,CAAU,KAAK,CAAC;AAEjC,IAAA,SAAS,GAAe,MAAK,
|
|
1
|
+
{"version":3,"file":"masterteam-components-date-field.mjs","sources":["../../../../packages/masterteam/components/date-field/date-field.ts","../../../../packages/masterteam/components/date-field/date-field.html","../../../../packages/masterteam/components/date-field/masterteam-components-date-field.ts"],"sourcesContent":["import {\n Component,\n HostBinding,\n OnChanges,\n OnInit,\n SimpleChanges,\n ViewChild,\n signal,\n input,\n inject,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport { DatePickerModule, DatePicker } from 'primeng/datepicker';\n\n@Component({\n selector: 'mt-date-field',\n standalone: true,\n imports: [FormsModule, DatePickerModule],\n templateUrl: './date-field.html',\n styleUrls: ['./date-field.scss'],\n host: {\n class: 'grid gap-1',\n },\n})\nexport class DateField implements ControlValueAccessor, OnInit, OnChanges {\n @ViewChild('calendar', { static: true })\n calendar: DatePicker;\n\n readonly field = input<boolean>(true);\n readonly label = input<string>();\n readonly placeholder = input<string>();\n readonly class = input<string>('');\n readonly readonly = input<boolean>(false);\n readonly showIcon = input<boolean>(true);\n readonly showClear = input<boolean>(false);\n readonly showTime = input<boolean>(false);\n readonly pInputs = input<Partial<DatePicker>>();\n\n @HostBinding('class') styleClass: string;\n\n requiredValidator = Validators.required;\n value = signal<string | null>(null);\n disabled = signal<boolean>(false);\n\n onTouched: () => void = () => {};\n onModelChange: (value: string) => void = () => {};\n\n public ngControl = inject(NgControl, { self: true });\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n applyInputsToCalendar() {\n Object.assign(this.calendar, this.pInputs());\n }\n\n ngOnInit() {\n this.styleClass = this.class();\n if (this.pInputs()) {\n this.applyInputsToCalendar();\n }\n }\n onValueChange(value: string) {\n this.onModelChange(value);\n this.value.set(value);\n }\n ngOnChanges(changes: SimpleChanges) {\n if (changes['pInputs']) {\n this.applyInputsToCalendar();\n }\n }\n\n writeValue(value: string) {\n this.value.set(value);\n }\n\n registerOnChange(fn: any) {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: any) {\n this.onTouched = fn;\n }\n\n setDisabledState(disabled: boolean) {\n this.disabled.set(disabled);\n }\n}\n","@if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-datepicker\n #calendar\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n [baseZIndex]=\"1051\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n styleClass=\"w-full\"\n [showIcon]=\"showIcon()\"\n [showClear]=\"showClear()\"\n [showTime]=\"showTime()\"\n appendTo=\"body\"\n>\n</p-datepicker>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MA6Ba,SAAS,CAAA;AAEpB,IAAA,QAAQ;AAEC,IAAA,KAAK,GAAG,KAAK,CAAU,IAAI,CAAC;IAC5B,KAAK,GAAG,KAAK,EAAU;IACvB,WAAW,GAAG,KAAK,EAAU;AAC7B,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC;AACzB,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,CAAC;AAChC,IAAA,QAAQ,GAAG,KAAK,CAAU,IAAI,CAAC;AAC/B,IAAA,SAAS,GAAG,KAAK,CAAU,KAAK,CAAC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CAAA,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;gBAajB,UAAU,EAAA,CAAA;sBAA/B,WAAW;uBAAC,OAAO;;;AE3CtB;;AAEG;;;;"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, Component } from '@angular/core';
|
|
3
|
+
import { Message } from 'primeng/message';
|
|
4
|
+
|
|
5
|
+
class FieldValidation {
|
|
6
|
+
control = input(null);
|
|
7
|
+
touched = input(false, {
|
|
8
|
+
transform: booleanAttribute,
|
|
9
|
+
});
|
|
10
|
+
customErrorClass = input('');
|
|
11
|
+
getErrorMessage() {
|
|
12
|
+
const ctrl = this.control();
|
|
13
|
+
if (!ctrl || !ctrl.errors)
|
|
14
|
+
return '';
|
|
15
|
+
const errors = ctrl.errors;
|
|
16
|
+
// Handle errors with embedded messages (from ValidatorConfig)
|
|
17
|
+
for (const errorKey in errors) {
|
|
18
|
+
const errorValue = errors[errorKey];
|
|
19
|
+
// If error has a message property, use it
|
|
20
|
+
if (errorValue && typeof errorValue === 'object' && errorValue.message) {
|
|
21
|
+
return errorValue.message;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// // Default error messages based on error type
|
|
25
|
+
// if (errors['required']) {
|
|
26
|
+
// return 'This field is required';
|
|
27
|
+
// }
|
|
28
|
+
// if (errors['email']) {
|
|
29
|
+
// return 'Please enter a valid email address';
|
|
30
|
+
// }
|
|
31
|
+
// if (errors['minlength']) {
|
|
32
|
+
// const requiredLength = errors['minlength'].requiredLength;
|
|
33
|
+
// const actualLength = errors['minlength'].actualLength;
|
|
34
|
+
// return `Minimum length is ${requiredLength} characters (current: ${actualLength})`;
|
|
35
|
+
// }
|
|
36
|
+
// if (errors['maxlength']) {
|
|
37
|
+
// const requiredLength = errors['maxlength'].requiredLength;
|
|
38
|
+
// const actualLength = errors['maxlength'].actualLength;
|
|
39
|
+
// return `Maximum length is ${requiredLength} characters (current: ${actualLength})`;
|
|
40
|
+
// }
|
|
41
|
+
// if (errors['min']) {
|
|
42
|
+
// const min = errors['min'].min;
|
|
43
|
+
// const actual = errors['min'].actual;
|
|
44
|
+
// return `Minimum value is ${min} (current: ${actual})`;
|
|
45
|
+
// }
|
|
46
|
+
// if (errors['max']) {
|
|
47
|
+
// const max = errors['max'].max;
|
|
48
|
+
// const actual = errors['max'].actual;
|
|
49
|
+
// return `Maximum value is ${max} (current: ${actual})`;
|
|
50
|
+
// }
|
|
51
|
+
// if (errors['pattern']) {
|
|
52
|
+
// const pattern = errors['pattern'].requiredPattern;
|
|
53
|
+
// return `Invalid format. Expected pattern: ${pattern}`;
|
|
54
|
+
// }
|
|
55
|
+
// if (errors['custom']) {
|
|
56
|
+
// return errors['custom'].message || 'Invalid value';
|
|
57
|
+
// }
|
|
58
|
+
// For any other errors, try to extract meaningful information
|
|
59
|
+
const firstErrorKey = Object.keys(errors)[0];
|
|
60
|
+
const firstError = errors[firstErrorKey];
|
|
61
|
+
// If it's an object with a message, use it
|
|
62
|
+
if (firstError && typeof firstError === 'object' && firstError.message) {
|
|
63
|
+
return firstError.message;
|
|
64
|
+
}
|
|
65
|
+
// If it's a string, use it
|
|
66
|
+
if (typeof firstError === 'string') {
|
|
67
|
+
return firstError;
|
|
68
|
+
}
|
|
69
|
+
// Fallback to error key
|
|
70
|
+
return `Invalid ${firstErrorKey}`;
|
|
71
|
+
}
|
|
72
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FieldValidation, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
73
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: FieldValidation, isStandalone: true, selector: "mt-field-validation", inputs: { control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, customErrorClass: { classPropertyName: "customErrorClass", publicName: "customErrorClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
74
|
+
@if (control() && control()!.invalid && (control()!.touched || touched())) {
|
|
75
|
+
<p-message severity="error" variant="simple" size="small">
|
|
76
|
+
{{ getErrorMessage() }}</p-message
|
|
77
|
+
>
|
|
78
|
+
<!-- <div -->
|
|
79
|
+
<!-- class="text-red-500 text-sm mt-1 flex items-start gap-1" -->
|
|
80
|
+
<!-- [class]=" -->
|
|
81
|
+
<!-- customErrorClass() || -->
|
|
82
|
+
<!-- 'text-red-500 text-sm mt-1 flex items-start gap-1' -->
|
|
83
|
+
<!-- " -->
|
|
84
|
+
<!-- > -->
|
|
85
|
+
<!-- <span -->
|
|
86
|
+
<!-- class="inline-block w-4 h-4 flex-shrink-0 mt-0.5" -->
|
|
87
|
+
<!-- aria-hidden="true" -->
|
|
88
|
+
<!-- > -->
|
|
89
|
+
<!-- <svg viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"> -->
|
|
90
|
+
<!-- <path -->
|
|
91
|
+
<!-- fill-rule="evenodd" -->
|
|
92
|
+
<!-- d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zM8 4a.905.905 0 0 1 .9.995l-.35 3.507a.553.553 0 0 1-1.1 0L7.1 4.995A.905.905 0 0 1 8 4zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" -->
|
|
93
|
+
<!-- /> -->
|
|
94
|
+
<!-- </svg> -->
|
|
95
|
+
<!-- </span> -->
|
|
96
|
+
<!-- <span class="flex-1">{{ getErrorMessage() }}</span> -->
|
|
97
|
+
<!-- </div> -->
|
|
98
|
+
}
|
|
99
|
+
`, isInline: true, dependencies: [{ kind: "component", type: Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }] });
|
|
100
|
+
}
|
|
101
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FieldValidation, decorators: [{
|
|
102
|
+
type: Component,
|
|
103
|
+
args: [{ selector: 'mt-field-validation', standalone: true, imports: [Message], template: `
|
|
104
|
+
@if (control() && control()!.invalid && (control()!.touched || touched())) {
|
|
105
|
+
<p-message severity="error" variant="simple" size="small">
|
|
106
|
+
{{ getErrorMessage() }}</p-message
|
|
107
|
+
>
|
|
108
|
+
<!-- <div -->
|
|
109
|
+
<!-- class="text-red-500 text-sm mt-1 flex items-start gap-1" -->
|
|
110
|
+
<!-- [class]=" -->
|
|
111
|
+
<!-- customErrorClass() || -->
|
|
112
|
+
<!-- 'text-red-500 text-sm mt-1 flex items-start gap-1' -->
|
|
113
|
+
<!-- " -->
|
|
114
|
+
<!-- > -->
|
|
115
|
+
<!-- <span -->
|
|
116
|
+
<!-- class="inline-block w-4 h-4 flex-shrink-0 mt-0.5" -->
|
|
117
|
+
<!-- aria-hidden="true" -->
|
|
118
|
+
<!-- > -->
|
|
119
|
+
<!-- <svg viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"> -->
|
|
120
|
+
<!-- <path -->
|
|
121
|
+
<!-- fill-rule="evenodd" -->
|
|
122
|
+
<!-- d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zM8 4a.905.905 0 0 1 .9.995l-.35 3.507a.553.553 0 0 1-1.1 0L7.1 4.995A.905.905 0 0 1 8 4zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" -->
|
|
123
|
+
<!-- /> -->
|
|
124
|
+
<!-- </svg> -->
|
|
125
|
+
<!-- </span> -->
|
|
126
|
+
<!-- <span class="flex-1">{{ getErrorMessage() }}</span> -->
|
|
127
|
+
<!-- </div> -->
|
|
128
|
+
}
|
|
129
|
+
` }]
|
|
130
|
+
}] });
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Generated bundle index. Do not edit.
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
export { FieldValidation };
|
|
137
|
+
//# sourceMappingURL=masterteam-components-field-validation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterteam-components-field-validation.mjs","sources":["../../../../packages/masterteam/components/field-validation/field-validation.ts","../../../../packages/masterteam/components/field-validation/masterteam-components-field-validation.ts"],"sourcesContent":["import { booleanAttribute, Component, input } from '@angular/core';\nimport { Message } from 'primeng/message';\nimport { AbstractControl } from '@angular/forms';\n\n@Component({\n selector: 'mt-field-validation',\n standalone: true,\n imports: [Message],\n template: `\n @if (control() && control()!.invalid && (control()!.touched || touched())) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">\n {{ getErrorMessage() }}</p-message\n >\n <!-- <div -->\n <!-- class=\"text-red-500 text-sm mt-1 flex items-start gap-1\" -->\n <!-- [class]=\" -->\n <!-- customErrorClass() || -->\n <!-- 'text-red-500 text-sm mt-1 flex items-start gap-1' -->\n <!-- \" -->\n <!-- > -->\n <!-- <span -->\n <!-- class=\"inline-block w-4 h-4 flex-shrink-0 mt-0.5\" -->\n <!-- aria-hidden=\"true\" -->\n <!-- > -->\n <!-- <svg viewBox=\"0 0 16 16\" fill=\"currentColor\" class=\"w-4 h-4\"> -->\n <!-- <path -->\n <!-- fill-rule=\"evenodd\" -->\n <!-- d=\"M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zM8 4a.905.905 0 0 1 .9.995l-.35 3.507a.553.553 0 0 1-1.1 0L7.1 4.995A.905.905 0 0 1 8 4zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z\" -->\n <!-- /> -->\n <!-- </svg> -->\n <!-- </span> -->\n <!-- <span class=\"flex-1\">{{ getErrorMessage() }}</span> -->\n <!-- </div> -->\n }\n `,\n styles: [],\n})\nexport class FieldValidation {\n readonly control = input<AbstractControl | null>(null);\n readonly touched = input<boolean, unknown>(false, {\n transform: booleanAttribute,\n });\n readonly customErrorClass = input<string>('');\n\n getErrorMessage(): string {\n const ctrl = this.control();\n if (!ctrl || !ctrl.errors) return '';\n\n const errors = ctrl.errors;\n\n // Handle errors with embedded messages (from ValidatorConfig)\n for (const errorKey in errors) {\n const errorValue = errors[errorKey];\n\n // If error has a message property, use it\n if (errorValue && typeof errorValue === 'object' && errorValue.message) {\n return errorValue.message;\n }\n }\n\n // // Default error messages based on error type\n // if (errors['required']) {\n // return 'This field is required';\n // }\n // if (errors['email']) {\n // return 'Please enter a valid email address';\n // }\n // if (errors['minlength']) {\n // const requiredLength = errors['minlength'].requiredLength;\n // const actualLength = errors['minlength'].actualLength;\n // return `Minimum length is ${requiredLength} characters (current: ${actualLength})`;\n // }\n // if (errors['maxlength']) {\n // const requiredLength = errors['maxlength'].requiredLength;\n // const actualLength = errors['maxlength'].actualLength;\n // return `Maximum length is ${requiredLength} characters (current: ${actualLength})`;\n // }\n // if (errors['min']) {\n // const min = errors['min'].min;\n // const actual = errors['min'].actual;\n // return `Minimum value is ${min} (current: ${actual})`;\n // }\n // if (errors['max']) {\n // const max = errors['max'].max;\n // const actual = errors['max'].actual;\n // return `Maximum value is ${max} (current: ${actual})`;\n // }\n // if (errors['pattern']) {\n // const pattern = errors['pattern'].requiredPattern;\n // return `Invalid format. Expected pattern: ${pattern}`;\n // }\n // if (errors['custom']) {\n // return errors['custom'].message || 'Invalid value';\n // }\n\n // For any other errors, try to extract meaningful information\n const firstErrorKey = Object.keys(errors)[0];\n const firstError = errors[firstErrorKey];\n\n // If it's an object with a message, use it\n if (firstError && typeof firstError === 'object' && firstError.message) {\n return firstError.message;\n }\n\n // If it's a string, use it\n if (typeof firstError === 'string') {\n return firstError;\n }\n\n // Fallback to error key\n return `Invalid ${firstErrorKey}`;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAqCa,eAAe,CAAA;AACjB,IAAA,OAAO,GAAG,KAAK,CAAyB,IAAI,CAAC;AAC7C,IAAA,OAAO,GAAG,KAAK,CAAmB,KAAK,EAAE;AAChD,QAAA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