@masterteam/components 0.0.10 → 0.0.11
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/checkbox-field/index.d.ts +3 -1
- package/fesm2022/masterteam-components-checkbox-field.mjs +5 -3
- package/fesm2022/masterteam-components-checkbox-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-toggle-field.mjs +80 -0
- package/fesm2022/masterteam-components-toggle-field.mjs.map +1 -0
- package/package.json +26 -22
- package/toggle-field/index.d.ts +33 -0
|
@@ -6,12 +6,14 @@ import { isInvalid } from '@masterteam/components';
|
|
|
6
6
|
declare class CheckboxField implements ControlValueAccessor {
|
|
7
7
|
checkbox: Checkbox;
|
|
8
8
|
label: _angular_core.InputSignal<string | undefined>;
|
|
9
|
+
labelPosition: _angular_core.InputSignal<"top" | "start" | "end" | "bottom">;
|
|
9
10
|
placeholder: _angular_core.InputSignal<string | undefined>;
|
|
10
11
|
readonly: _angular_core.InputSignal<boolean>;
|
|
11
12
|
pInputs: _angular_core.InputSignal<Partial<Checkbox> | undefined>;
|
|
12
13
|
onChange: _angular_core.OutputEmitterRef<CheckboxChangeEvent>;
|
|
13
14
|
ngControl: NgControl;
|
|
14
15
|
isInvalid: typeof isInvalid;
|
|
16
|
+
isVertical: _angular_core.Signal<boolean>;
|
|
15
17
|
requiredValidator: typeof Validators.required;
|
|
16
18
|
value: _angular_core.WritableSignal<boolean | null>;
|
|
17
19
|
disabled: _angular_core.WritableSignal<boolean>;
|
|
@@ -25,7 +27,7 @@ declare class CheckboxField implements ControlValueAccessor {
|
|
|
25
27
|
registerOnTouched(fn: any): void;
|
|
26
28
|
setDisabledState(disabled: boolean): void;
|
|
27
29
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CheckboxField, never>;
|
|
28
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CheckboxField, "mt-checkbox-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "pInputs": { "alias": "pInputs"; "required": false; "isSignal": true; }; }, { "onChange": "onChange"; }, never, never, true, never>;
|
|
30
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CheckboxField, "mt-checkbox-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "labelPosition": { "alias": "labelPosition"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "pInputs": { "alias": "pInputs"; "required": false; "isSignal": true; }; }, { "onChange": "onChange"; }, never, never, true, never>;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
export { CheckboxField };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, inject, signal, effect, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { input, output, inject, computed, signal, effect, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { NgControl, Validators, FormsModule } from '@angular/forms';
|
|
5
5
|
import * as i2 from 'primeng/checkbox';
|
|
@@ -10,12 +10,14 @@ import { isInvalid } from '@masterteam/components';
|
|
|
10
10
|
class CheckboxField {
|
|
11
11
|
checkbox;
|
|
12
12
|
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
|
|
13
|
+
labelPosition = input('end', ...(ngDevMode ? [{ debugName: "labelPosition" }] : []));
|
|
13
14
|
placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : []));
|
|
14
15
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : []));
|
|
15
16
|
pInputs = input(...(ngDevMode ? [undefined, { debugName: "pInputs" }] : []));
|
|
16
17
|
onChange = output();
|
|
17
18
|
ngControl = inject(NgControl, { self: true });
|
|
18
19
|
isInvalid = isInvalid;
|
|
20
|
+
isVertical = computed(() => this.labelPosition() === 'top' || this.labelPosition() === 'bottom', ...(ngDevMode ? [{ debugName: "isVertical" }] : []));
|
|
19
21
|
requiredValidator = Validators.required;
|
|
20
22
|
value = signal(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
21
23
|
disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
@@ -58,13 +60,13 @@ class CheckboxField {
|
|
|
58
60
|
this.disabled.set(disabled);
|
|
59
61
|
}
|
|
60
62
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: CheckboxField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
61
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", 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 }, 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: { classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "checkbox", first: true, predicate: ["checkbox"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"
|
|
63
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: CheckboxField, isStandalone: true, selector: "mt-checkbox-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", 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: { classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "checkbox", first: true, predicate: ["checkbox"], descendants: true, static: true }], ngImport: i0, template: "<div\n class=\"flex gap-1\"\n [class.items-center]=\"!isVertical()\"\n [class.gap-2]=\"!isVertical()\"\n [class.flex-col]=\"isVertical()\"\n [class.flex-col-reverse]=\"labelPosition() === 'top'\"\n [class.flex-row-reverse]=\"labelPosition() === 'start'\"\n [class.justify-end]=\"labelPosition() === 'start'\"\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 [invalid]=\"isInvalid(ngControl?.control)\"\n class=\"leading-none\"\n ></p-checkbox>\n @if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n }\n</div>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\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: 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"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
62
64
|
}
|
|
63
65
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: CheckboxField, decorators: [{
|
|
64
66
|
type: Component,
|
|
65
67
|
args: [{ selector: 'mt-checkbox-field', standalone: true, imports: [FormsModule, CheckboxModule, FieldValidation], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
66
68
|
class: 'grid gap-1',
|
|
67
|
-
}, template: "<div class=\"
|
|
69
|
+
}, template: "<div\n class=\"flex gap-1\"\n [class.items-center]=\"!isVertical()\"\n [class.gap-2]=\"!isVertical()\"\n [class.flex-col]=\"isVertical()\"\n [class.flex-col-reverse]=\"labelPosition() === 'top'\"\n [class.flex-row-reverse]=\"labelPosition() === 'start'\"\n [class.justify-end]=\"labelPosition() === 'start'\"\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 [invalid]=\"isInvalid(ngControl?.control)\"\n class=\"leading-none\"\n ></p-checkbox>\n @if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n }\n</div>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\n" }]
|
|
68
70
|
}], ctorParameters: () => [], propDecorators: { checkbox: [{
|
|
69
71
|
type: ViewChild,
|
|
70
72
|
args: ['checkbox', { static: true }]
|
|
@@ -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 ChangeDetectionStrategy,\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';\nimport { FieldValidation } from '@masterteam/components/field-validation';\nimport { isInvalid } from '@masterteam/components';\n\n@Component({\n selector: 'mt-checkbox-field',\n standalone: true,\n imports: [FormsModule, CheckboxModule, FieldValidation],\n templateUrl: './checkbox-field.html',\n styleUrls: ['./checkbox-field.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'grid gap-1',\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 readonly = input<boolean>(false);\n pInputs = input<Partial<Checkbox>>();\n\n onChange = output<CheckboxChangeEvent>();\n\n public ngControl = inject(NgControl, { self: true });\n\n isInvalid = isInvalid;\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","<div class=\"
|
|
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 ChangeDetectionStrategy,\n computed,\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';\nimport { FieldValidation } from '@masterteam/components/field-validation';\nimport { isInvalid } from '@masterteam/components';\n\n@Component({\n selector: 'mt-checkbox-field',\n standalone: true,\n imports: [FormsModule, CheckboxModule, FieldValidation],\n templateUrl: './checkbox-field.html',\n styleUrls: ['./checkbox-field.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'grid gap-1',\n },\n})\nexport class CheckboxField implements ControlValueAccessor {\n @ViewChild('checkbox', { static: true })\n checkbox: Checkbox;\n\n label = input<string>();\n labelPosition = input<'top' | 'start' | 'end' | 'bottom'>('end');\n placeholder = 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 isInvalid = isInvalid;\n\n isVertical = computed(\n () => this.labelPosition() === 'top' || this.labelPosition() === 'bottom',\n );\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","<div\n class=\"flex gap-1\"\n [class.items-center]=\"!isVertical()\"\n [class.gap-2]=\"!isVertical()\"\n [class.flex-col]=\"isVertical()\"\n [class.flex-col-reverse]=\"labelPosition() === 'top'\"\n [class.flex-row-reverse]=\"labelPosition() === 'start'\"\n [class.justify-end]=\"labelPosition() === 'start'\"\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 [invalid]=\"isInvalid(ngControl?.control)\"\n class=\"leading-none\"\n ></p-checkbox>\n @if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n }\n</div>\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":";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,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,QAAA,EAAA,2CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,qDAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,UAAA,EAAA,SAAA,EAAA,gBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAE,cAAc,0ZAAE,eAAe,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAQ3C,aAAa,EAAA,UAAA,EAAA,CAAA;kBAXzB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,mBAAmB,EAAA,UAAA,EACjB,IAAI,EAAA,OAAA,EACP,CAAC,WAAW,EAAE,cAAc,EAAE,eAAe,CAAC,EAAA,eAAA,EAGtC,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,KAAK,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,4/BAAA,EAAA;wDAID,QAAQ,EAAA,CAAA;sBADP,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;;AErCzC;;AAEG;;;;"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, inject, computed, signal, effect, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/forms';
|
|
4
|
+
import { NgControl, Validators, FormsModule } from '@angular/forms';
|
|
5
|
+
import * as i2 from 'primeng/toggleswitch';
|
|
6
|
+
import { ToggleSwitchModule } from 'primeng/toggleswitch';
|
|
7
|
+
import { FieldValidation } from '@masterteam/components/field-validation';
|
|
8
|
+
import { isInvalid } from '@masterteam/components';
|
|
9
|
+
|
|
10
|
+
class ToggleField {
|
|
11
|
+
toggle;
|
|
12
|
+
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
|
|
13
|
+
labelPosition = input('end', ...(ngDevMode ? [{ debugName: "labelPosition" }] : []));
|
|
14
|
+
placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : []));
|
|
15
|
+
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : []));
|
|
16
|
+
pInputs = input(...(ngDevMode ? [undefined, { debugName: "pInputs" }] : []));
|
|
17
|
+
onChange = output();
|
|
18
|
+
ngControl = inject(NgControl, { self: true });
|
|
19
|
+
isInvalid = isInvalid;
|
|
20
|
+
isVertical = computed(() => this.labelPosition() === 'top' || this.labelPosition() === 'bottom', ...(ngDevMode ? [{ debugName: "isVertical" }] : []));
|
|
21
|
+
requiredValidator = Validators.required;
|
|
22
|
+
value = signal(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
23
|
+
disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
24
|
+
onTouched = () => { };
|
|
25
|
+
onModelChange = () => { };
|
|
26
|
+
constructor() {
|
|
27
|
+
if (this.ngControl) {
|
|
28
|
+
this.ngControl.valueAccessor = this;
|
|
29
|
+
}
|
|
30
|
+
// Effect to apply pInputs reactively when the pInputs signal changes
|
|
31
|
+
effect(() => {
|
|
32
|
+
const currentPInputs = this.pInputs();
|
|
33
|
+
// Ensure checkbox ViewChild is initialized and pInputs has a value
|
|
34
|
+
// @ViewChild with static: true makes 'checkbox' available during construction/ngOnInit
|
|
35
|
+
if (this.toggle && currentPInputs) {
|
|
36
|
+
this.applyInputsToCheckbox();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
applyInputsToCheckbox() {
|
|
41
|
+
const currentPInputs = this.pInputs();
|
|
42
|
+
if (currentPInputs) {
|
|
43
|
+
Object.assign(this.toggle, currentPInputs);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
onValueChange(value) {
|
|
47
|
+
this.onModelChange(value);
|
|
48
|
+
this.value.set(value);
|
|
49
|
+
}
|
|
50
|
+
writeValue(value) {
|
|
51
|
+
this.value.set(value);
|
|
52
|
+
}
|
|
53
|
+
registerOnChange(fn) {
|
|
54
|
+
this.onModelChange = fn;
|
|
55
|
+
}
|
|
56
|
+
registerOnTouched(fn) {
|
|
57
|
+
this.onTouched = fn;
|
|
58
|
+
}
|
|
59
|
+
setDisabledState(disabled) {
|
|
60
|
+
this.disabled.set(disabled);
|
|
61
|
+
}
|
|
62
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ToggleField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
63
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: ToggleField, isStandalone: true, selector: "mt-toggle-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", 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: { classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "toggle", first: true, predicate: ["toggle"], descendants: true, static: true }], ngImport: i0, template: "<div\n class=\"flex gap-1\"\n [class.items-center]=\"!isVertical()\"\n [class.gap-2]=\"!isVertical()\"\n [class.flex-col]=\"isVertical()\"\n [class.flex-col-reverse]=\"labelPosition() === 'top'\"\n [class.flex-row-reverse]=\"labelPosition() === 'start'\"\n [class.justify-end]=\"labelPosition() === 'start'\"\n>\n <p-toggleswitch\n #checkbox\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onChange)=\"onTouched(); onChange.emit($event)\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n class=\"leading-none\"\n ></p-toggleswitch>\n @if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n }\n</div>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\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: ToggleSwitchModule }, { kind: "component", type: i2.ToggleSwitch, selector: "p-toggleswitch, p-toggleSwitch, p-toggle-switch", inputs: ["styleClass", "tabindex", "inputId", "readonly", "trueValue", "falseValue", "ariaLabel", "size", "ariaLabelledBy", "autofocus"], outputs: ["onChange"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
64
|
+
}
|
|
65
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ToggleField, decorators: [{
|
|
66
|
+
type: Component,
|
|
67
|
+
args: [{ selector: 'mt-toggle-field', standalone: true, imports: [FormsModule, ToggleSwitchModule, FieldValidation], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
68
|
+
class: 'grid gap-1',
|
|
69
|
+
}, template: "<div\n class=\"flex gap-1\"\n [class.items-center]=\"!isVertical()\"\n [class.gap-2]=\"!isVertical()\"\n [class.flex-col]=\"isVertical()\"\n [class.flex-col-reverse]=\"labelPosition() === 'top'\"\n [class.flex-row-reverse]=\"labelPosition() === 'start'\"\n [class.justify-end]=\"labelPosition() === 'start'\"\n>\n <p-toggleswitch\n #checkbox\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onChange)=\"onTouched(); onChange.emit($event)\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n class=\"leading-none\"\n ></p-toggleswitch>\n @if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n }\n</div>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\n" }]
|
|
70
|
+
}], ctorParameters: () => [], propDecorators: { toggle: [{
|
|
71
|
+
type: ViewChild,
|
|
72
|
+
args: ['toggle', { static: true }]
|
|
73
|
+
}] } });
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Generated bundle index. Do not edit.
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
export { ToggleField };
|
|
80
|
+
//# sourceMappingURL=masterteam-components-toggle-field.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterteam-components-toggle-field.mjs","sources":["../../../../packages/masterteam/components/toggle-field/toggle-field.ts","../../../../packages/masterteam/components/toggle-field/toggle-field.html","../../../../packages/masterteam/components/toggle-field/masterteam-components-toggle-field.ts"],"sourcesContent":["import {\n Component,\n ViewChild,\n signal,\n input,\n effect,\n output,\n inject,\n ChangeDetectionStrategy,\n computed,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport {\n ToggleSwitchModule,\n ToggleSwitch,\n ToggleSwitchChangeEvent,\n} from 'primeng/toggleswitch';\nimport { FieldValidation } from '@masterteam/components/field-validation';\nimport { isInvalid } from '@masterteam/components';\n\n@Component({\n selector: 'mt-toggle-field',\n standalone: true,\n imports: [FormsModule, ToggleSwitchModule, FieldValidation],\n templateUrl: './toggle-field.html',\n styleUrls: ['./toggle-field.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'grid gap-1',\n },\n})\nexport class ToggleField implements ControlValueAccessor {\n @ViewChild('toggle', { static: true })\n toggle: ToggleSwitch;\n\n label = input<string>();\n labelPosition = input<'top' | 'start' | 'end' | 'bottom'>('end');\n placeholder = input<string>();\n readonly = input<boolean>(false);\n pInputs = input<Partial<ToggleSwitch>>();\n\n onChange = output<ToggleSwitchChangeEvent>();\n\n public ngControl = inject(NgControl, { self: true });\n\n isInvalid = isInvalid;\n\n isVertical = computed(\n () => this.labelPosition() === 'top' || this.labelPosition() === 'bottom',\n );\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.toggle && currentPInputs) {\n this.applyInputsToCheckbox();\n }\n });\n }\n\n applyInputsToCheckbox() {\n const currentPInputs = this.pInputs();\n if (currentPInputs) {\n Object.assign(this.toggle, 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","<div\n class=\"flex gap-1\"\n [class.items-center]=\"!isVertical()\"\n [class.gap-2]=\"!isVertical()\"\n [class.flex-col]=\"isVertical()\"\n [class.flex-col-reverse]=\"labelPosition() === 'top'\"\n [class.flex-row-reverse]=\"labelPosition() === 'start'\"\n [class.justify-end]=\"labelPosition() === 'start'\"\n>\n <p-toggleswitch\n #checkbox\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onChange)=\"onTouched(); onChange.emit($event)\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n class=\"leading-none\"\n ></p-toggleswitch>\n @if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n }\n</div>\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":";;;;;;;;;MAoCa,WAAW,CAAA;AAEtB,IAAA,MAAM;IAEN,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;AACvB,IAAA,aAAa,GAAG,KAAK,CAAqC,KAAK,yDAAC;IAChE,WAAW,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;AAC7B,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,oDAAC;IAChC,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAyB;IAExC,QAAQ,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A,UAAA,EAAA,CAAA;kBAXvB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,EAAA,UAAA,EACf,IAAI,EAAA,OAAA,EACP,CAAC,WAAW,EAAE,kBAAkB,EAAE,eAAe,CAAC,EAAA,eAAA,EAG1C,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,KAAK,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,49BAAA,EAAA;wDAID,MAAM,EAAA,CAAA;sBADL,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;;AErCvC;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@masterteam/components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"directory": ".",
|
|
6
6
|
"linkDirectory": false,
|
|
@@ -38,6 +38,10 @@
|
|
|
38
38
|
"types": "./index.d.ts",
|
|
39
39
|
"default": "./fesm2022/masterteam-components.mjs"
|
|
40
40
|
},
|
|
41
|
+
"./avatar-text": {
|
|
42
|
+
"types": "./avatar-text/index.d.ts",
|
|
43
|
+
"default": "./fesm2022/masterteam-components-avatar-text.mjs"
|
|
44
|
+
},
|
|
41
45
|
"./avatar": {
|
|
42
46
|
"types": "./avatar/index.d.ts",
|
|
43
47
|
"default": "./fesm2022/masterteam-components-avatar.mjs"
|
|
@@ -46,29 +50,29 @@
|
|
|
46
50
|
"types": "./button/index.d.ts",
|
|
47
51
|
"default": "./fesm2022/masterteam-components-button.mjs"
|
|
48
52
|
},
|
|
49
|
-
"./button-group": {
|
|
50
|
-
"types": "./button-group/index.d.ts",
|
|
51
|
-
"default": "./fesm2022/masterteam-components-button-group.mjs"
|
|
52
|
-
},
|
|
53
53
|
"./card": {
|
|
54
54
|
"types": "./card/index.d.ts",
|
|
55
55
|
"default": "./fesm2022/masterteam-components-card.mjs"
|
|
56
56
|
},
|
|
57
|
-
"./
|
|
58
|
-
"types": "./
|
|
59
|
-
"default": "./fesm2022/masterteam-components-
|
|
57
|
+
"./button-group": {
|
|
58
|
+
"types": "./button-group/index.d.ts",
|
|
59
|
+
"default": "./fesm2022/masterteam-components-button-group.mjs"
|
|
60
60
|
},
|
|
61
61
|
"./checkbox-field": {
|
|
62
62
|
"types": "./checkbox-field/index.d.ts",
|
|
63
63
|
"default": "./fesm2022/masterteam-components-checkbox-field.mjs"
|
|
64
64
|
},
|
|
65
|
+
"./color-picker-field": {
|
|
66
|
+
"types": "./color-picker-field/index.d.ts",
|
|
67
|
+
"default": "./fesm2022/masterteam-components-color-picker-field.mjs"
|
|
68
|
+
},
|
|
65
69
|
"./chip": {
|
|
66
70
|
"types": "./chip/index.d.ts",
|
|
67
71
|
"default": "./fesm2022/masterteam-components-chip.mjs"
|
|
68
72
|
},
|
|
69
|
-
"./
|
|
70
|
-
"types": "./
|
|
71
|
-
"default": "./fesm2022/masterteam-components-
|
|
73
|
+
"./editor-field": {
|
|
74
|
+
"types": "./editor-field/index.d.ts",
|
|
75
|
+
"default": "./fesm2022/masterteam-components-editor-field.mjs"
|
|
72
76
|
},
|
|
73
77
|
"./date-field": {
|
|
74
78
|
"types": "./date-field/index.d.ts",
|
|
@@ -78,10 +82,6 @@
|
|
|
78
82
|
"types": "./field-validation/index.d.ts",
|
|
79
83
|
"default": "./fesm2022/masterteam-components-field-validation.mjs"
|
|
80
84
|
},
|
|
81
|
-
"./editor-field": {
|
|
82
|
-
"types": "./editor-field/index.d.ts",
|
|
83
|
-
"default": "./fesm2022/masterteam-components-editor-field.mjs"
|
|
84
|
-
},
|
|
85
85
|
"./icon-field": {
|
|
86
86
|
"types": "./icon-field/index.d.ts",
|
|
87
87
|
"default": "./fesm2022/masterteam-components-icon-field.mjs"
|
|
@@ -90,26 +90,30 @@
|
|
|
90
90
|
"types": "./list/index.d.ts",
|
|
91
91
|
"default": "./fesm2022/masterteam-components-list.mjs"
|
|
92
92
|
},
|
|
93
|
-
"./number-field": {
|
|
94
|
-
"types": "./number-field/index.d.ts",
|
|
95
|
-
"default": "./fesm2022/masterteam-components-number-field.mjs"
|
|
96
|
-
},
|
|
97
93
|
"./multi-select-field": {
|
|
98
94
|
"types": "./multi-select-field/index.d.ts",
|
|
99
95
|
"default": "./fesm2022/masterteam-components-multi-select-field.mjs"
|
|
100
96
|
},
|
|
101
|
-
"./
|
|
102
|
-
"types": "./
|
|
103
|
-
"default": "./fesm2022/masterteam-components-
|
|
97
|
+
"./number-field": {
|
|
98
|
+
"types": "./number-field/index.d.ts",
|
|
99
|
+
"default": "./fesm2022/masterteam-components-number-field.mjs"
|
|
104
100
|
},
|
|
105
101
|
"./slider-field": {
|
|
106
102
|
"types": "./slider-field/index.d.ts",
|
|
107
103
|
"default": "./fesm2022/masterteam-components-slider-field.mjs"
|
|
108
104
|
},
|
|
105
|
+
"./select-field": {
|
|
106
|
+
"types": "./select-field/index.d.ts",
|
|
107
|
+
"default": "./fesm2022/masterteam-components-select-field.mjs"
|
|
108
|
+
},
|
|
109
109
|
"./text-field": {
|
|
110
110
|
"types": "./text-field/index.d.ts",
|
|
111
111
|
"default": "./fesm2022/masterteam-components-text-field.mjs"
|
|
112
112
|
},
|
|
113
|
+
"./toggle-field": {
|
|
114
|
+
"types": "./toggle-field/index.d.ts",
|
|
115
|
+
"default": "./fesm2022/masterteam-components-toggle-field.mjs"
|
|
116
|
+
},
|
|
113
117
|
"./textarea-field": {
|
|
114
118
|
"types": "./textarea-field/index.d.ts",
|
|
115
119
|
"default": "./fesm2022/masterteam-components-textarea-field.mjs"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, NgControl, Validators } from '@angular/forms';
|
|
3
|
+
import { ToggleSwitch, ToggleSwitchChangeEvent } from 'primeng/toggleswitch';
|
|
4
|
+
import { isInvalid } from '@masterteam/components';
|
|
5
|
+
|
|
6
|
+
declare class ToggleField implements ControlValueAccessor {
|
|
7
|
+
toggle: ToggleSwitch;
|
|
8
|
+
label: _angular_core.InputSignal<string | undefined>;
|
|
9
|
+
labelPosition: _angular_core.InputSignal<"top" | "start" | "end" | "bottom">;
|
|
10
|
+
placeholder: _angular_core.InputSignal<string | undefined>;
|
|
11
|
+
readonly: _angular_core.InputSignal<boolean>;
|
|
12
|
+
pInputs: _angular_core.InputSignal<Partial<ToggleSwitch> | undefined>;
|
|
13
|
+
onChange: _angular_core.OutputEmitterRef<ToggleSwitchChangeEvent>;
|
|
14
|
+
ngControl: NgControl;
|
|
15
|
+
isInvalid: typeof isInvalid;
|
|
16
|
+
isVertical: _angular_core.Signal<boolean>;
|
|
17
|
+
requiredValidator: typeof Validators.required;
|
|
18
|
+
value: _angular_core.WritableSignal<boolean | null>;
|
|
19
|
+
disabled: _angular_core.WritableSignal<boolean>;
|
|
20
|
+
onTouched: () => void;
|
|
21
|
+
onModelChange: (value: boolean | null) => void;
|
|
22
|
+
constructor();
|
|
23
|
+
applyInputsToCheckbox(): void;
|
|
24
|
+
onValueChange(value: boolean | null): void;
|
|
25
|
+
writeValue(value: boolean | null): void;
|
|
26
|
+
registerOnChange(fn: any): void;
|
|
27
|
+
registerOnTouched(fn: any): void;
|
|
28
|
+
setDisabledState(disabled: boolean): void;
|
|
29
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ToggleField, never>;
|
|
30
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ToggleField, "mt-toggle-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "labelPosition": { "alias": "labelPosition"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "pInputs": { "alias": "pInputs"; "required": false; "isSignal": true; }; }, { "onChange": "onChange"; }, never, never, true, never>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { ToggleField };
|