@masterteam/components 0.0.4 → 0.0.5
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-icon-field.mjs +3 -5
- package/fesm2022/masterteam-components-icon-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-text-field.mjs +5 -2
- package/fesm2022/masterteam-components-text-field.mjs.map +1 -1
- package/icon-field/index.d.ts +2 -3
- package/package.json +1 -1
- package/text-field/index.d.ts +2 -1
|
@@ -8,9 +8,7 @@ import { Icon } from '@masterteam/icons';
|
|
|
8
8
|
|
|
9
9
|
class IconField {
|
|
10
10
|
label = input('');
|
|
11
|
-
icons = mtIcons?.regular
|
|
12
|
-
name: icon,
|
|
13
|
-
})) ?? [];
|
|
11
|
+
icons = mtIcons?.regular ?? [];
|
|
14
12
|
selectedIcon = signal(null);
|
|
15
13
|
requiredValidator = Validators.required;
|
|
16
14
|
ngControl = inject(NgControl, { self: true });
|
|
@@ -38,13 +36,13 @@ class IconField {
|
|
|
38
36
|
return c.errors;
|
|
39
37
|
}
|
|
40
38
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IconField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
41
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: IconField, isStandalone: true, selector: "mt-icon-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, ngImport: i0, template: "@if (label()) {\n <label\n (click)=\"dropdown.show(); dropdown.focus()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-select\n #dropdown\n [options]=\"icons\"\n [filter]=\"false\"\n filterBy=\"name\"\n
|
|
39
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: IconField, isStandalone: true, selector: "mt-icon-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, ngImport: i0, template: "@if (label()) {\n <label\n (click)=\"dropdown.show(); dropdown.focus()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-select\n #dropdown\n [options]=\"icons\"\n [filter]=\"false\"\n filterBy=\"name\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n appendTo=\"body\"\n (ngModelChange)=\"onChangeIcon($event)\"\n [ngModel]=\"selectedIcon()\"\n placeholder=\"Select Icon\"\n styleClass=\"w-full\"\n panelStyleClass=\"icon-select-panel\"\n>\n <ng-template let-icon #selectedItem>\n @if (icon) {\n <div class=\"flex items-center justify-center text-2xl\">\n <mt-icon [icon]=\"icon\" />\n </div>\n } @else {\n <div class=\"flex items-center justify-center\">Select Icon</div>\n }\n </ng-template>\n <ng-template let-icon #item>\n <div class=\"w-full h-full flex items-center justify-center text-lg\">\n <mt-icon [icon]=\"icon\" />\n </div>\n </ng-template>\n</p-select>\n", styles: ["::ng-deep .icon-select-panel .p-select-list-container .p-select-list{display:grid;grid-template-columns:repeat(7,1fr);padding-inline:calc(var(--spacing) * 2);gap:.5rem}::ng-deep .icon-select-panel .p-select-list-container .p-select-list .p-select-option{padding:.25rem;border-radius:var(--p-select-option-border-radius);width:2.5rem;height:2.5rem}\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: "component", type: Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }] });
|
|
42
40
|
}
|
|
43
41
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: IconField, decorators: [{
|
|
44
42
|
type: Component,
|
|
45
43
|
args: [{ selector: 'mt-icon-field', imports: [FormsModule, Select, Icon], host: {
|
|
46
44
|
class: 'grid gap-1',
|
|
47
|
-
}, template: "@if (label()) {\n <label\n (click)=\"dropdown.show(); dropdown.focus()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-select\n #dropdown\n [options]=\"icons\"\n [filter]=\"false\"\n filterBy=\"name\"\n
|
|
45
|
+
}, template: "@if (label()) {\n <label\n (click)=\"dropdown.show(); dropdown.focus()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-select\n #dropdown\n [options]=\"icons\"\n [filter]=\"false\"\n filterBy=\"name\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n appendTo=\"body\"\n (ngModelChange)=\"onChangeIcon($event)\"\n [ngModel]=\"selectedIcon()\"\n placeholder=\"Select Icon\"\n styleClass=\"w-full\"\n panelStyleClass=\"icon-select-panel\"\n>\n <ng-template let-icon #selectedItem>\n @if (icon) {\n <div class=\"flex items-center justify-center text-2xl\">\n <mt-icon [icon]=\"icon\" />\n </div>\n } @else {\n <div class=\"flex items-center justify-center\">Select Icon</div>\n }\n </ng-template>\n <ng-template let-icon #item>\n <div class=\"w-full h-full flex items-center justify-center text-lg\">\n <mt-icon [icon]=\"icon\" />\n </div>\n </ng-template>\n</p-select>\n", styles: ["::ng-deep .icon-select-panel .p-select-list-container .p-select-list{display:grid;grid-template-columns:repeat(7,1fr);padding-inline:calc(var(--spacing) * 2);gap:.5rem}::ng-deep .icon-select-panel .p-select-list-container .p-select-list .p-select-option{padding:.25rem;border-radius:var(--p-select-option-border-radius);width:2.5rem;height:2.5rem}\n"] }]
|
|
48
46
|
}], ctorParameters: () => [] });
|
|
49
47
|
|
|
50
48
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masterteam-components-icon-field.mjs","sources":["../../../../packages/masterteam/components/icon-field/icon-field.ts","../../../../packages/masterteam/components/icon-field/icon-field.html","../../../../packages/masterteam/components/icon-field/masterteam-components-icon-field.ts"],"sourcesContent":["import { Component, signal, inject, input } from '@angular/core';\nimport {\n ControlValueAccessor,\n FormControl,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport { Select } from 'primeng/select';\nimport * as mtIcons from '@masterteam/icons/assets/select-icons.json';\nimport { Icon } from '@masterteam/icons';\n\n@Component({\n selector: 'mt-icon-field',\n imports: [FormsModule, Select, Icon],\n templateUrl: './icon-field.html',\n styleUrls: ['./icon-field.scss'],\n host: {\n class: 'grid gap-1',\n },\n})\nexport class IconField implements ControlValueAccessor {\n readonly label = input<string>('');\n\n icons:
|
|
1
|
+
{"version":3,"file":"masterteam-components-icon-field.mjs","sources":["../../../../packages/masterteam/components/icon-field/icon-field.ts","../../../../packages/masterteam/components/icon-field/icon-field.html","../../../../packages/masterteam/components/icon-field/masterteam-components-icon-field.ts"],"sourcesContent":["import { Component, signal, inject, input } from '@angular/core';\nimport {\n ControlValueAccessor,\n FormControl,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport { Select } from 'primeng/select';\nimport * as mtIcons from '@masterteam/icons/assets/select-icons.json';\nimport { Icon, MTIcon } from '@masterteam/icons';\n\n@Component({\n selector: 'mt-icon-field',\n imports: [FormsModule, Select, Icon],\n templateUrl: './icon-field.html',\n styleUrls: ['./icon-field.scss'],\n host: {\n class: 'grid gap-1',\n },\n})\nexport class IconField implements ControlValueAccessor {\n readonly label = input<string>('');\n\n icons: MTIcon[] = (mtIcons?.regular as MTIcon[]) ?? [];\n selectedIcon = signal<string | null>(null);\n requiredValidator = Validators.required;\n\n public ngControl = inject(NgControl, { self: true });\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n private onTouched: () => void = () => {};\n private onChange: (icon: string) => void = () => {};\n\n writeValue(value: string) {\n this.selectedIcon.set(value);\n }\n\n registerOnChange(fn: any) {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: any) {\n this.onTouched = fn;\n }\n\n onChangeIcon(icon: string) {\n this.selectedIcon.set(icon);\n this.onChange(icon);\n }\n\n public validate(c: FormControl) {\n return c.errors;\n }\n}\n","@if (label()) {\n <label\n (click)=\"dropdown.show(); dropdown.focus()\"\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n<p-select\n #dropdown\n [options]=\"icons\"\n [filter]=\"false\"\n filterBy=\"name\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n appendTo=\"body\"\n (ngModelChange)=\"onChangeIcon($event)\"\n [ngModel]=\"selectedIcon()\"\n placeholder=\"Select Icon\"\n styleClass=\"w-full\"\n panelStyleClass=\"icon-select-panel\"\n>\n <ng-template let-icon #selectedItem>\n @if (icon) {\n <div class=\"flex items-center justify-center text-2xl\">\n <mt-icon [icon]=\"icon\" />\n </div>\n } @else {\n <div class=\"flex items-center justify-center\">Select Icon</div>\n }\n </ng-template>\n <ng-template let-icon #item>\n <div class=\"w-full h-full flex items-center justify-center text-lg\">\n <mt-icon [icon]=\"icon\" />\n </div>\n </ng-template>\n</p-select>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAqBa,SAAS,CAAA;AACX,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC;AAElC,IAAA,KAAK,GAAc,OAAO,EAAE,OAAoB,IAAI,EAAE;AACtD,IAAA,YAAY,GAAG,MAAM,CAAgB,IAAI,CAAC;AAC1C,IAAA,iBAAiB,GAAG,UAAU,CAAC,QAAQ;IAEhC,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAEpD,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE;AAClB,YAAA,IAAI,CAAC,SAAS,CAAC,aAAa,GAAG,IAAI;QACrC;IACF;AAEQ,IAAA,SAAS,GAAe,MAAK,EAAE,CAAC;AAChC,IAAA,QAAQ,GAA2B,MAAK,EAAE,CAAC;AAEnD,IAAA,UAAU,CAAC,KAAa,EAAA;AACtB,QAAA,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC;IAC9B;AAEA,IAAA,gBAAgB,CAAC,EAAO,EAAA;AACtB,QAAA,IAAI,CAAC,QAAQ,GAAG,EAAE;IACpB;AAEA,IAAA,iBAAiB,CAAC,EAAO,EAAA;AACvB,QAAA,IAAI,CAAC,SAAS,GAAG,EAAE;IACrB;AAEA,IAAA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K,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,kmCAAA,EAAA,MAAA,EAAA,CAAA,+VAAA,CAAA,EAAA;;;AEnBH;;AAEG;;;;"}
|
|
@@ -13,11 +13,13 @@ import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
|
|
|
13
13
|
import * as i4 from 'primeng/tooltip';
|
|
14
14
|
import { TooltipModule } from 'primeng/tooltip';
|
|
15
15
|
import { FieldValidation } from '@masterteam/components/field-validation';
|
|
16
|
+
import { Icon } from '@masterteam/icons';
|
|
16
17
|
|
|
17
18
|
// TODO: text stuck when reset
|
|
18
19
|
class TextField {
|
|
19
20
|
inputText;
|
|
20
21
|
field = input(true);
|
|
22
|
+
hint = input();
|
|
21
23
|
label = input();
|
|
22
24
|
placeholder = input();
|
|
23
25
|
class = input('');
|
|
@@ -83,7 +85,7 @@ class TextField {
|
|
|
83
85
|
this.disabled.set(disabled);
|
|
84
86
|
}
|
|
85
87
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TextField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
86
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: TextField, isStandalone: true, selector: "mt-text-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 }, type: { classPropertyName: "type", publicName: "type", 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 }, pKeyFilter: { classPropertyName: "pKeyFilter", publicName: "pKeyFilter", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.styleClass" }, classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "inputText", first: true, predicate: ["inputText"], 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@if (
|
|
88
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: TextField, isStandalone: true, selector: "mt-text-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", 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 }, type: { classPropertyName: "type", publicName: "type", 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 }, pKeyFilter: { classPropertyName: "pKeyFilter", publicName: "pKeyFilter", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.styleClass" }, classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "inputText", first: true, predicate: ["inputText"], 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@if (!hint()) {\n @if (!pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n />\n }\n @if (pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n [pKeyFilter]=\"pKeyFilter() === 'alphanum' ? alphaNum : pKeyFilter()\"\n />\n }\n} @else {\n <p-inputgroup>\n @if (!pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n />\n }\n @if (pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n [pKeyFilter]=\"pKeyFilter() === 'alphanum' ? alphaNum : pKeyFilter()\"\n />\n }\n <p-inputgroup-addon [pTooltip]=\"hint()\" tooltipPosition=\"top\">\n <mt-icon icon=\"general.help-circle\" />\n </p-inputgroup-addon>\n </p-inputgroup>\n}\n\n<mt-field-validation [control]=\"ngControl?.control!\"></mt-field-validation>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i2.InputText, selector: "[pInputText]", inputs: ["pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: KeyFilterModule }, { kind: "directive", type: i3.KeyFilter, selector: "[pKeyFilter]", inputs: ["pValidateOnly", "pKeyFilter"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i4.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo"] }, { kind: "ngmodule", type: InputGroupModule }, { kind: "component", type: i5.InputGroup, selector: "p-inputgroup, p-inputGroup, p-input-group", inputs: ["styleClass"] }, { kind: "ngmodule", type: InputGroupAddonModule }, { kind: "component", type: i6.InputGroupAddon, selector: "p-inputgroup-addon, p-inputGroupAddon", inputs: ["style", "styleClass"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched", "customErrorClass"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }] });
|
|
87
89
|
}
|
|
88
90
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: TextField, decorators: [{
|
|
89
91
|
type: Component,
|
|
@@ -95,9 +97,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
|
|
|
95
97
|
InputGroupModule,
|
|
96
98
|
InputGroupAddonModule,
|
|
97
99
|
FieldValidation,
|
|
100
|
+
Icon,
|
|
98
101
|
], host: {
|
|
99
102
|
class: 'grid gap-1',
|
|
100
|
-
}, template: "@if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n@if (
|
|
103
|
+
}, template: "@if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n}\n@if (!hint()) {\n @if (!pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n />\n }\n @if (pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n [pKeyFilter]=\"pKeyFilter() === 'alphanum' ? alphaNum : pKeyFilter()\"\n />\n }\n} @else {\n <p-inputgroup>\n @if (!pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n />\n }\n @if (pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n [pKeyFilter]=\"pKeyFilter() === 'alphanum' ? alphaNum : pKeyFilter()\"\n />\n }\n <p-inputgroup-addon [pTooltip]=\"hint()\" tooltipPosition=\"top\">\n <mt-icon icon=\"general.help-circle\" />\n </p-inputgroup-addon>\n </p-inputgroup>\n}\n\n<mt-field-validation [control]=\"ngControl?.control!\"></mt-field-validation>\n" }]
|
|
101
104
|
}], ctorParameters: () => [], propDecorators: { inputText: [{
|
|
102
105
|
type: ViewChild,
|
|
103
106
|
args: ['inputText', { static: true }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masterteam-components-text-field.mjs","sources":["../../../../packages/masterteam/components/text-field/text-field.ts","../../../../packages/masterteam/components/text-field/text-field.html","../../../../packages/masterteam/components/text-field/masterteam-components-text-field.ts"],"sourcesContent":["import {\n Component,\n HostBinding,\n SimpleChanges,\n ViewChild,\n signal,\n input,\n OnInit,\n OnChanges,\n inject,\n} from '@angular/core';\nimport { InputTextModule } from 'primeng/inputtext';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport { KeyFilterModule, KeyFilterPattern } from 'primeng/keyfilter';\nimport { InputGroupModule } from 'primeng/inputgroup';\nimport { InputGroupAddonModule } from 'primeng/inputgroupaddon';\nimport { TooltipModule } from 'primeng/tooltip';\nimport { FieldValidation } from '@masterteam/components/field-validation';\n\n// TODO: text stuck when reset\n@Component({\n selector: 'mt-text-field',\n standalone: true,\n imports: [\n FormsModule,\n InputTextModule,\n KeyFilterModule,\n TooltipModule,\n InputGroupModule,\n InputGroupAddonModule,\n FieldValidation,\n ],\n templateUrl: './text-field.html',\n styleUrls: ['./text-field.scss'],\n host: {\n class: 'grid gap-1',\n },\n})\nexport class TextField implements ControlValueAccessor, OnInit, OnChanges {\n @ViewChild('inputText', { static: true })\n inputText: HTMLInputElement;\n\n readonly field = input<boolean>(true);\n readonly label = input<string>();\n readonly placeholder = input<string>();\n readonly class = input<string>('');\n readonly type = input<string>('text');\n readonly readonly = input<boolean>(false);\n readonly pInputs = input<Partial<HTMLInputElement>>();\n readonly pKeyFilter = input<KeyFilterPattern | RegExp>();\n // readonly externalControl = input<any>(null);\n\n @HostBinding('class') styleClass: string;\n\n requiredValidator = Validators.required;\n value = signal<string | null>(null);\n disabled = signal<boolean>(false);\n\n alphaNum: RegExp = /[\\u0621-\\u064A\\u0660-\\u0669a-z0-9\\s]/i;\n\n onTouched: () => void = () => {};\n onModelChange: (value: any) => void = () => {};\n\n public ngControl: NgControl | null = null;\n\n constructor() {\n try {\n // Try to inject NgControl if available\n this.ngControl = inject(NgControl, { self: true, optional: true });\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n } catch (_e) {\n // If injection fails, ngControl will remain null\n this.ngControl = null;\n }\n }\n\n ngOnInit() {\n this.styleClass = this.class();\n // if (this.externalControl()) {\n // debugger\n // this.ngControl = this.externalControl();\n // }\n\n if (this.pInputs()) {\n this.applyInputsToInputText();\n }\n }\n\n applyInputsToInputText() {\n Object.assign(this.inputText, this.pInputs());\n }\n\n onValueChange(value: any) {\n this.onModelChange(value);\n this.onTouched();\n this.value.set(value);\n }\n ngOnChanges(changes: SimpleChanges) {\n if (changes['pInputs']) {\n this.applyInputsToInputText();\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@if (type() !== \"password\") {\n @if (!pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n />\n }\n @if (pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n [pKeyFilter]=\"pKeyFilter() === 'alphanum' ? alphaNum : pKeyFilter()\"\n />\n }\n}\n@if (type() === \"password\") {\n <p-inputgroup>\n @if (!pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n />\n }\n @if (pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n [pKeyFilter]=\"pKeyFilter() === 'alphanum' ? alphaNum : pKeyFilter()\"\n />\n }\n <p-inputgroup-addon\n [pTooltip]=\"'users-groups-managment.password-rules'\"\n tooltipPosition=\"top\"\n >\n <i class=\"mti mti-info-circle\"></i>\n </p-inputgroup-addon>\n </p-inputgroup>\n}\n\n<mt-field-validation [control]=\"ngControl?.control!\"></mt-field-validation>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAwBA;MAmBa,SAAS,CAAA;AAEpB,IAAA,SAAS;AAEA,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,IAAI,GAAG,KAAK,CAAS,MAAM,CAAC;AAC5B,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,CAAC;IAChC,OAAO,GAAG,KAAK,EAA6B;IAC5C,UAAU,GAAG,KAAK,EAA6B;;AAGlC,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;IAEjC,QAAQ,GAAW,uCAAuC;AAE1D,IAAA,SAAS,GAAe,MAAK,EAAE,CAAC;AAChC,IAAA,aAAa,GAAyB,MAAK,EAAE,CAAC;IAEvC,SAAS,GAAqB,IAAI;AAEzC,IAAA,WAAA,GAAA;AACE,QAAA,IAAI;;AAEF,YAAA,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAClE,YAAA,IAAI,IAAI,CAAC,SAAS,EAAE;AAClB,gBAAA,IAAI,CAAC,SAAS,CAAC,aAAa,GAAG,IAA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A,EAAA,MAAA,EAAA,aAAA,EAAA,cAAA,EAAA,UAAA,EAAA,YAAA,EAAA,cAAA,EAAA,UAAA,EAAA,iBAAA,EAAA,gBAAA,EAAA,UAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EACb,gBAAgB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,UAAA,EAAA,QAAA,EAAA,2CAAA,EAAA,MAAA,EAAA,CAAA,YAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAChB,qBAAqB,oKACrB,eAAe,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,SAAA,EAAA,kBAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAQN,SAAS,EAAA,UAAA,EAAA,CAAA;kBAlBrB,SAAS;+BACE,eAAe,EAAA,UAAA,EACb,IAAI,EAAA,OAAA,EACP;wBACP,WAAW;wBACX,eAAe;wBACf,eAAe;wBACf,aAAa;wBACb,gBAAgB;wBAChB,qBAAqB;wBACrB,eAAe;qBAChB,EAAA,IAAA,EAGK;AACJ,wBAAA,KAAK,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,28EAAA,EAAA;wDAID,SAAS,EAAA,CAAA;sBADR,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;gBAalB,UAAU,EAAA,CAAA;sBAA/B,WAAW;uBAAC,OAAO;;;AEzDtB;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"masterteam-components-text-field.mjs","sources":["../../../../packages/masterteam/components/text-field/text-field.ts","../../../../packages/masterteam/components/text-field/text-field.html","../../../../packages/masterteam/components/text-field/masterteam-components-text-field.ts"],"sourcesContent":["import {\n Component,\n HostBinding,\n SimpleChanges,\n ViewChild,\n signal,\n input,\n OnInit,\n OnChanges,\n inject,\n} from '@angular/core';\nimport { InputTextModule } from 'primeng/inputtext';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport { KeyFilterModule, KeyFilterPattern } from 'primeng/keyfilter';\nimport { InputGroupModule } from 'primeng/inputgroup';\nimport { InputGroupAddonModule } from 'primeng/inputgroupaddon';\nimport { TooltipModule } from 'primeng/tooltip';\nimport { FieldValidation } from '@masterteam/components/field-validation';\nimport { Icon } from '@masterteam/icons';\n\n// TODO: text stuck when reset\n@Component({\n selector: 'mt-text-field',\n standalone: true,\n imports: [\n FormsModule,\n InputTextModule,\n KeyFilterModule,\n TooltipModule,\n InputGroupModule,\n InputGroupAddonModule,\n FieldValidation,\n Icon,\n ],\n templateUrl: './text-field.html',\n styleUrls: ['./text-field.scss'],\n host: {\n class: 'grid gap-1',\n },\n})\nexport class TextField implements ControlValueAccessor, OnInit, OnChanges {\n @ViewChild('inputText', { static: true })\n inputText: HTMLInputElement;\n\n readonly field = input<boolean>(true);\n readonly hint = input<string>();\n readonly label = input<string>();\n readonly placeholder = input<string>();\n readonly class = input<string>('');\n readonly type = input<string>('text');\n readonly readonly = input<boolean>(false);\n readonly pInputs = input<Partial<HTMLInputElement>>();\n readonly pKeyFilter = input<KeyFilterPattern | RegExp>();\n // readonly externalControl = input<any>(null);\n\n @HostBinding('class') styleClass: string;\n\n requiredValidator = Validators.required;\n value = signal<string | null>(null);\n disabled = signal<boolean>(false);\n\n alphaNum: RegExp = /[\\u0621-\\u064A\\u0660-\\u0669a-z0-9\\s]/i;\n\n onTouched: () => void = () => {};\n onModelChange: (value: any) => void = () => {};\n\n public ngControl: NgControl | null = null;\n\n constructor() {\n try {\n // Try to inject NgControl if available\n this.ngControl = inject(NgControl, { self: true, optional: true });\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n } catch (_e) {\n // If injection fails, ngControl will remain null\n this.ngControl = null;\n }\n }\n\n ngOnInit() {\n this.styleClass = this.class();\n // if (this.externalControl()) {\n // debugger\n // this.ngControl = this.externalControl();\n // }\n\n if (this.pInputs()) {\n this.applyInputsToInputText();\n }\n }\n\n applyInputsToInputText() {\n Object.assign(this.inputText, this.pInputs());\n }\n\n onValueChange(value: any) {\n this.onModelChange(value);\n this.onTouched();\n this.value.set(value);\n }\n ngOnChanges(changes: SimpleChanges) {\n if (changes['pInputs']) {\n this.applyInputsToInputText();\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@if (!hint()) {\n @if (!pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n />\n }\n @if (pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n [pKeyFilter]=\"pKeyFilter() === 'alphanum' ? alphaNum : pKeyFilter()\"\n />\n }\n} @else {\n <p-inputgroup>\n @if (!pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n />\n }\n @if (pKeyFilter()) {\n <input\n #inputText=\"\"\n pInputText=\"\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n [disabled]=\"disabled() || readonly()\"\n [type]=\"type()\"\n [id]=\"ngControl?.name || label()\"\n [class.ng-invalid]=\"ngControl?.control?.invalid\"\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\n class=\"w-full\"\n [pKeyFilter]=\"pKeyFilter() === 'alphanum' ? alphaNum : pKeyFilter()\"\n />\n }\n <p-inputgroup-addon [pTooltip]=\"hint()\" tooltipPosition=\"top\">\n <mt-icon icon=\"general.help-circle\" />\n </p-inputgroup-addon>\n </p-inputgroup>\n}\n\n<mt-field-validation [control]=\"ngControl?.control!\"></mt-field-validation>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAyBA;MAoBa,SAAS,CAAA;AAEpB,IAAA,SAAS;AAEA,IAAA,KAAK,GAAG,KAAK,CAAU,IAAI,CAAC;IAC5B,IAAI,GAAG,KAAK,EAAU;IACtB,KAAK,GAAG,KAAK,EAAU;IACvB,WAAW,GAAG,KAAK,EAAU;AAC7B,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC;AACzB,IAAA,IAAI,GAAG,KAAK,CAAS,MAAM,CAAC;AAC5B,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,CAAC;IAChC,OAAO,GAAG,KAAK,EAA6B;IAC5C,UAAU,GAAG,KAAK,EAA6B;;AAGlC,IAAA,UAAU;AAEhC,IAAA,iBAAiB,GAAG,UAAU,CAAC,QAAQ;AACvC,IAAA,KAAK,GAAG,MAAM,CAAgB,IAAI,CAAC;AACnC,IAAA,QAAQ,GAAG,MAAM,CAAU,KAAK,C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A,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;gBAclB,UAAU,EAAA,CAAA;sBAA/B,WAAW;uBAAC,OAAO;;;AE5DtB;;AAEG;;;;"}
|
package/icon-field/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as _angular_forms from '@angular/forms';
|
|
2
2
|
import { ControlValueAccessor, Validators, NgControl, FormControl } from '@angular/forms';
|
|
3
3
|
import * as _angular_core from '@angular/core';
|
|
4
|
+
import { MTIcon } from '@masterteam/icons';
|
|
4
5
|
|
|
5
6
|
declare class IconField implements ControlValueAccessor {
|
|
6
7
|
readonly label: _angular_core.InputSignal<string>;
|
|
7
|
-
icons:
|
|
8
|
-
name: string;
|
|
9
|
-
}[];
|
|
8
|
+
icons: MTIcon[];
|
|
10
9
|
selectedIcon: _angular_core.WritableSignal<string | null>;
|
|
11
10
|
requiredValidator: typeof Validators.required;
|
|
12
11
|
ngControl: NgControl;
|
package/package.json
CHANGED
package/text-field/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { KeyFilterPattern } from 'primeng/keyfilter';
|
|
|
6
6
|
declare class TextField implements ControlValueAccessor, OnInit, OnChanges {
|
|
7
7
|
inputText: HTMLInputElement;
|
|
8
8
|
readonly field: _angular_core.InputSignal<boolean>;
|
|
9
|
+
readonly hint: _angular_core.InputSignal<string | undefined>;
|
|
9
10
|
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
10
11
|
readonly placeholder: _angular_core.InputSignal<string | undefined>;
|
|
11
12
|
readonly class: _angular_core.InputSignal<string>;
|
|
@@ -31,7 +32,7 @@ declare class TextField implements ControlValueAccessor, OnInit, OnChanges {
|
|
|
31
32
|
registerOnTouched(fn: any): void;
|
|
32
33
|
setDisabledState(disabled: boolean): void;
|
|
33
34
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TextField, never>;
|
|
34
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TextField, "mt-text-field", never, { "field": { "alias": "field"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "class": { "alias": "class"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "pInputs": { "alias": "pInputs"; "required": false; "isSignal": true; }; "pKeyFilter": { "alias": "pKeyFilter"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
35
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TextField, "mt-text-field", never, { "field": { "alias": "field"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "class": { "alias": "class"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "pInputs": { "alias": "pInputs"; "required": false; "isSignal": true; }; "pKeyFilter": { "alias": "pKeyFilter"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export { TextField };
|