@sd-angular/core 19.0.0-beta.100 → 19.0.0-beta.102
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/assets/images/coming-soon.svg +23 -0
- package/assets/images/data-empty.svg +21 -0
- package/assets/images/expired.svg +22 -0
- package/assets/images/file-error.svg +28 -0
- package/assets/images/filter-empty.svg +20 -0
- package/assets/images/filter-required.svg +21 -0
- package/assets/images/forbidden.svg +15 -0
- package/assets/images/image-error.svg +27 -0
- package/assets/images/maintenance.svg +23 -0
- package/assets/images/not-found.svg +20 -0
- package/assets/images/offline.svg +20 -0
- package/assets/images/submitted.svg +18 -0
- package/assets/images/success.svg +18 -0
- package/assets/images/unauthorized.svg +22 -0
- package/assets/images/unknown-error.svg +18 -0
- package/assets/scss/core/image.scss +35 -0
- package/assets/scss/sd-core.scss +1 -0
- package/components/index.d.ts +1 -0
- package/components/operator/index.d.ts +1 -0
- package/components/operator/src/operator.component.d.ts +34 -0
- package/components/query-bar/index.d.ts +2 -0
- package/components/query-bar/src/actions-bar.component.d.ts +31 -0
- package/components/query-bar/src/build-chip.component.d.ts +67 -0
- package/components/query-bar/src/chip-popover.component.d.ts +73 -0
- package/components/query-bar/src/field-picker.component.d.ts +37 -0
- package/components/query-bar/src/inline-chip.component.d.ts +82 -0
- package/components/query-bar/src/inline-value-chip.component.d.ts +71 -0
- package/components/query-bar/src/popover-chip.component.d.ts +35 -0
- package/components/query-bar/src/query-bar.component.d.ts +137 -0
- package/components/query-bar/src/query-bar.model.d.ts +136 -0
- package/components/query-bar/src/saved-filters-menu.component.d.ts +39 -0
- package/components/table/src/components/column-title/column-title.component.d.ts +1 -1
- package/components/table/src/components/desktop-cell/desktop-cell.component.d.ts +3 -3
- package/components/table/src/components/filter/column-filter/column-filter.component.d.ts +3 -7
- package/components/table/src/directives/sd-table-cell-def.directive.d.ts +12 -4
- package/components/table/src/directives/sd-table-column-filter-def.directive.d.ts +12 -4
- package/components/table/src/directives/sd-table-expand-def.directive.d.ts +10 -4
- package/components/table/src/directives/sd-table-filter-def.directive.d.ts +3 -3
- package/components/table/src/directives/sd-table-footer-def.directive.d.ts +12 -4
- package/components/table/src/directives/sd-table-title-def.directive.d.ts +10 -4
- package/components/table/src/table.component.d.ts +7 -7
- package/components/view/src/view.component.d.ts +2 -1
- package/directives/src/sd-desktop.directive.d.ts +2 -4
- package/directives/src/sd-mobile.directive.d.ts +2 -4
- package/fesm2022/sd-angular-core-components-anchor.mjs +73 -47
- package/fesm2022/sd-angular-core-components-anchor.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-badge.mjs +2 -2
- package/fesm2022/sd-angular-core-components-badge.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-form-generic.mjs +16 -16
- package/fesm2022/sd-angular-core-components-form-generic.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-operator.mjs +75 -0
- package/fesm2022/sd-angular-core-components-operator.mjs.map +1 -0
- package/fesm2022/sd-angular-core-components-query-bar.mjs +1425 -0
- package/fesm2022/sd-angular-core-components-query-bar.mjs.map +1 -0
- package/fesm2022/sd-angular-core-components-quick-action.mjs +2 -2
- package/fesm2022/sd-angular-core-components-quick-action.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-table.mjs +60 -27
- package/fesm2022/sd-angular-core-components-table.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-upload-file.mjs +4 -4
- package/fesm2022/sd-angular-core-components-upload-file.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-view.mjs +5 -2
- package/fesm2022/sd-angular-core-components-view.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components.mjs +1 -0
- package/fesm2022/sd-angular-core-components.mjs.map +1 -1
- package/fesm2022/sd-angular-core-directives.mjs +15 -17
- package/fesm2022/sd-angular-core-directives.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-autocomplete.mjs +5 -8
- package/fesm2022/sd-angular-core-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-checkbox.mjs +83 -87
- package/fesm2022/sd-angular-core-forms-checkbox.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-chip-calendar.mjs +76 -57
- package/fesm2022/sd-angular-core-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-chip.mjs +73 -48
- package/fesm2022/sd-angular-core-forms-chip.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-date-range.mjs +41 -4
- package/fesm2022/sd-angular-core-forms-date-range.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-date.mjs +14 -9
- package/fesm2022/sd-angular-core-forms-date.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-datetime.mjs +8 -9
- package/fesm2022/sd-angular-core-forms-datetime.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-directives.mjs +18 -24
- package/fesm2022/sd-angular-core-forms-directives.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-input-number.mjs +5 -8
- package/fesm2022/sd-angular-core-forms-input-number.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-input.mjs +5 -9
- package/fesm2022/sd-angular-core-forms-input.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-models.mjs +13 -1
- package/fesm2022/sd-angular-core-forms-models.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-radio.mjs +116 -176
- package/fesm2022/sd-angular-core-forms-radio.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-select.mjs +23 -10
- package/fesm2022/sd-angular-core-forms-select.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-switch.mjs +80 -99
- package/fesm2022/sd-angular-core-forms-switch.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-textarea.mjs +5 -8
- package/fesm2022/sd-angular-core-forms-textarea.mjs.map +1 -1
- package/fesm2022/sd-angular-core-i18n.mjs +35 -0
- package/fesm2022/sd-angular-core-i18n.mjs.map +1 -1
- package/fesm2022/sd-angular-core-modules-layout.mjs +10 -10
- package/fesm2022/sd-angular-core-modules-layout.mjs.map +1 -1
- package/fesm2022/sd-angular-core-modules-permission.mjs.map +1 -1
- package/fesm2022/sd-angular-core-services-confirm.mjs +1 -1
- package/fesm2022/sd-angular-core-services-confirm.mjs.map +1 -1
- package/forms/autocomplete/src/autocomplete.component.d.ts +3 -4
- package/forms/checkbox/src/checkbox.component.d.ts +17 -20
- package/forms/chip/src/chip.component.d.ts +17 -17
- package/forms/chip-calendar/src/chip-calendar.component.d.ts +19 -19
- package/forms/date/src/date.component.d.ts +7 -4
- package/forms/date-range/src/date-range.component.d.ts +16 -2
- package/forms/datetime/src/datetime.component.d.ts +5 -4
- package/forms/directives/src/item-def.directive.d.ts +10 -5
- package/forms/directives/src/label-def.directive.d.ts +3 -2
- package/forms/directives/src/suffix-def.directive.d.ts +3 -2
- package/forms/directives/src/view-def.directive.d.ts +9 -9
- package/forms/input/src/input.component.d.ts +3 -5
- package/forms/input-number/src/input-number.component.d.ts +2 -3
- package/forms/models/src/sd-custom-validator.model.d.ts +13 -1
- package/forms/radio/src/radio.component.d.ts +32 -37
- package/forms/select/src/select.component.d.ts +8 -5
- package/forms/switch/src/switch.component.d.ts +17 -22
- package/forms/textarea/src/textarea.component.d.ts +2 -3
- package/i18n/src/en.d.ts +5 -0
- package/package.json +65 -57
- package/sd-angular-core-19.0.0-beta.102.tgz +0 -0
- package/sd-angular-core-19.0.0-beta.100.tgz +0 -0
|
@@ -1,103 +1,109 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input,
|
|
2
|
+
import { inject, ChangeDetectorRef, input, booleanAttribute, model, output, computed, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
|
-
import { NgForm, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
+
import { NgForm, FormGroup, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
5
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
6
6
|
import * as i2 from '@angular/material/slide-toggle';
|
|
7
7
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
8
8
|
import { SdLabel } from '@sd-angular/core/forms/label';
|
|
9
|
-
import {
|
|
9
|
+
import { TranslatePipe } from '@sd-angular/core/i18n';
|
|
10
|
+
import { SdFormControl, sdFormControlState } from '@sd-angular/core/forms/models';
|
|
10
11
|
import { sdIsEmpty, sdSerializeDataValue } from '@sd-angular/core/utilities/data-state';
|
|
11
12
|
import { Subscription } from 'rxjs';
|
|
12
13
|
import * as uuid from 'uuid';
|
|
13
14
|
|
|
14
15
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
15
|
-
/* eslint-disable @angular-eslint/no-input-rename */
|
|
16
16
|
class SdSwitch {
|
|
17
|
-
ref;
|
|
17
|
+
#ref = inject(ChangeDetectorRef);
|
|
18
18
|
id = `I${uuid.v4()}`;
|
|
19
|
-
|
|
19
|
+
#name = uuid.v4();
|
|
20
|
+
#model = false;
|
|
21
|
+
formControl = new SdFormControl();
|
|
22
|
+
#subscription = new Subscription();
|
|
23
|
+
// Inputs — accept null|undefined at boundary, transform to canonical
|
|
24
|
+
autoIdInput = input(undefined, {
|
|
25
|
+
alias: 'autoId',
|
|
26
|
+
transform: (v) => v ?? undefined,
|
|
27
|
+
});
|
|
28
|
+
name = input(undefined, {
|
|
29
|
+
transform: (v) => v ?? undefined,
|
|
30
|
+
});
|
|
31
|
+
form = input(undefined, {
|
|
32
|
+
transform: (val) => {
|
|
33
|
+
if (!val)
|
|
34
|
+
return undefined;
|
|
35
|
+
if (val instanceof NgForm)
|
|
36
|
+
return val.form;
|
|
37
|
+
if (val instanceof FormGroup)
|
|
38
|
+
return val;
|
|
39
|
+
if (val?.form instanceof FormGroup)
|
|
40
|
+
return val.form;
|
|
41
|
+
return undefined;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
label = input(undefined, {
|
|
45
|
+
transform: (v) => v ?? undefined,
|
|
46
|
+
});
|
|
47
|
+
// why: legacy callers pass `null` to mean "fallback to primary" — keep that contract
|
|
48
|
+
color = input('primary', {
|
|
49
|
+
transform: (v) => v || 'primary',
|
|
50
|
+
});
|
|
51
|
+
disabled = input(false, { transform: booleanAttribute });
|
|
52
|
+
viewed = input(false, { transform: booleanAttribute });
|
|
53
|
+
hideInlineError = input(false, { transform: booleanAttribute });
|
|
54
|
+
required = input(false, { transform: booleanAttribute });
|
|
55
|
+
// Two-way model
|
|
56
|
+
model = model(false);
|
|
57
|
+
// Outputs
|
|
58
|
+
sdChange = output();
|
|
59
|
+
// Computed (template bindings)
|
|
20
60
|
autoId = computed(() => (this.autoIdInput() ? `forms-switch-${this.autoIdInput()}` : undefined));
|
|
21
61
|
#state = sdFormControlState(computed(() => this.formControl));
|
|
22
62
|
dataDisabled = computed(() => (this.#state().disabled ? 'true' : 'false'));
|
|
23
63
|
dataEmpty = computed(() => (sdIsEmpty(this.#state().value) ? 'true' : 'false'));
|
|
24
64
|
dataValue = computed(() => sdSerializeDataValue(this.#state().value));
|
|
25
|
-
dataRequired = computed(() => (this.required ? 'true' : 'false'));
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
65
|
+
dataRequired = computed(() => (this.required() ? 'true' : 'false'));
|
|
66
|
+
constructor() {
|
|
67
|
+
effect(() => {
|
|
68
|
+
const val = this.name();
|
|
69
|
+
if (val)
|
|
70
|
+
this.#name = val;
|
|
71
|
+
});
|
|
72
|
+
effect(() => {
|
|
73
|
+
if (this.disabled())
|
|
74
|
+
this.formControl.disable();
|
|
75
|
+
else
|
|
76
|
+
this.formControl.enable();
|
|
77
|
+
});
|
|
78
|
+
effect(() => {
|
|
79
|
+
const value = this.model();
|
|
80
|
+
if (this.#model !== value) {
|
|
81
|
+
this.#model = value;
|
|
82
|
+
this.formControl.setValue(value, { emitEvent: false });
|
|
40
83
|
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
color;
|
|
48
|
-
set _color(val) {
|
|
49
|
-
this.color = val || 'primary';
|
|
50
|
-
}
|
|
51
|
-
set disabled(val) {
|
|
52
|
-
val = val === '' || !!val;
|
|
53
|
-
if (val) {
|
|
54
|
-
this.formControl.disable();
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
this.formControl.enable();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
#model = false;
|
|
61
|
-
set model(value) {
|
|
62
|
-
if (this.#model !== value) {
|
|
63
|
-
this.#model = value;
|
|
64
|
-
this.formControl.setValue(value, {
|
|
65
|
-
emitEvent: false,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
modelChange = new EventEmitter();
|
|
70
|
-
hideInlineError = false;
|
|
71
|
-
set _hideInlineError(val) {
|
|
72
|
-
this.hideInlineError = val === '' || val;
|
|
73
|
-
}
|
|
74
|
-
required = false;
|
|
75
|
-
set _required(val) {
|
|
76
|
-
this.required = val === '' || !!val;
|
|
77
|
-
this.#updateValidator();
|
|
78
|
-
}
|
|
79
|
-
sdChange = new EventEmitter();
|
|
80
|
-
formControl = new SdFormControl();
|
|
81
|
-
#subscription = new Subscription();
|
|
82
|
-
constructor(ref) {
|
|
83
|
-
this.ref = ref;
|
|
84
|
+
});
|
|
85
|
+
effect(() => {
|
|
86
|
+
this.required();
|
|
87
|
+
this.#updateValidator();
|
|
88
|
+
});
|
|
84
89
|
}
|
|
85
90
|
ngOnInit() {
|
|
86
91
|
this.#subscription.add(this.formControl.sdChanges.subscribe(() => {
|
|
87
|
-
this
|
|
92
|
+
this.#ref.markForCheck();
|
|
88
93
|
}));
|
|
89
94
|
}
|
|
90
95
|
ngAfterViewInit() {
|
|
91
96
|
this.#subscription.add(this.formControl.valueChanges.subscribe(this.#onChange));
|
|
92
|
-
this
|
|
93
|
-
this
|
|
97
|
+
this.form()?.addControl(this.#name, this.formControl);
|
|
98
|
+
this.#ref.detectChanges();
|
|
94
99
|
}
|
|
95
100
|
ngOnDestroy() {
|
|
96
|
-
this
|
|
101
|
+
this.form()?.removeControl(this.#name);
|
|
97
102
|
this.#subscription.unsubscribe();
|
|
98
103
|
}
|
|
99
104
|
#onChange = (value) => {
|
|
100
|
-
this
|
|
105
|
+
this.#model = value;
|
|
106
|
+
this.model.set(value);
|
|
101
107
|
this.sdChange.emit(value);
|
|
102
108
|
};
|
|
103
109
|
#updateValidator = () => {
|
|
@@ -105,45 +111,20 @@ class SdSwitch {
|
|
|
105
111
|
this.formControl.clearAsyncValidators();
|
|
106
112
|
const validators = [];
|
|
107
113
|
const asyncValidators = [];
|
|
108
|
-
if (this.required) {
|
|
114
|
+
if (this.required()) {
|
|
109
115
|
validators.push(Validators.required);
|
|
110
116
|
}
|
|
111
117
|
this.formControl.setValidators(validators);
|
|
112
118
|
this.formControl.setAsyncValidators(asyncValidators);
|
|
113
119
|
this.formControl.updateValueAndValidity();
|
|
114
120
|
};
|
|
115
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdSwitch, deps: [
|
|
116
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: SdSwitch, isStandalone: true, selector: "sd-switch", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, _name: { classPropertyName: "_name", publicName: "name", isSignal: false, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: false, isRequired: false, transformFunction: null }, _label: { classPropertyName: "_label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, _color: { classPropertyName: "_color", publicName: "color", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: false, isRequired: false, transformFunction: null }, _hideInlineError: { classPropertyName: "_hideInlineError", publicName: "hideInlineError", isSignal: false, isRequired: false, transformFunction: null }, _required: { classPropertyName: "_required", publicName: "required", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { modelChange: "modelChange", sdChange: "sdChange" }, ngImport: i0, template: "<mat-slide-toggle\r\n [formControl]=\"formControl\"\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [color]=\"color\">\r\n <sd-label [label]=\"label\" [required]=\"required\"></sd-label>\r\n</mat-slide-toggle>", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host ::ng-deep label{margin-bottom:0!important}:host ::ng-deep .mdc-switch{--mdc-switch-selected-focus-state-layer-color: var(--sd-primary-light);--mat-sys-primary: var(--sd-primary);--mdc-switch-selected-handle-color: var(--sd-primary);--mdc-switch-selected-hover-state-layer-color: var(--sd-primary-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-primary-light);--mdc-switch-selected-focus-handle-color: var(--sd-primary);--mdc-switch-selected-hover-handle-color: var(--sd-primary);--mdc-switch-selected-pressed-handle-color: var(--sd-primary);--mdc-switch-selected-focus-track-color: var(--sd-primary-light);--mdc-switch-selected-hover-track-color: var(--sd-primary-light);--mdc-switch-selected-pressed-track-color: var(--sd-primary-light);--mdc-switch-selected-track-color: var(--sd-primary-light)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatSlideToggleModule }, { kind: "component", type: i2.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "color", "disabled", "disableRipple", "tabIndex", "checked", "hideIcon", "disabledInteractive"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
121
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdSwitch, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
122
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdSwitch, isStandalone: true, selector: "sd-switch", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", sdChange: "sdChange" }, host: { properties: { "attr.data-sd-color": "color()" } }, ngImport: i0, template: "@if (viewed()) {\r\n @if (label()) {\r\n <div class=\"T14R text-black400\">{{ label() }}</div>\r\n }\r\n <div class=\"T14M\">{{ (model() ? 'core.form.switch.on' : 'core.form.switch.off') | translate }}</div>\r\n} @else {\r\n <mat-slide-toggle\r\n [formControl]=\"formControl\"\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-required]=\"dataRequired()\">\r\n <sd-label [label]=\"label()\" [required]=\"required()\"></sd-label>\r\n </mat-slide-toggle>\r\n}\r\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host ::ng-deep label{margin-bottom:0!important}:host([data-sd-color=primary]) ::ng-deep .mdc-switch{--mat-sys-primary: var(--sd-primary);--mdc-switch-selected-handle-color: var(--sd-primary);--mdc-switch-selected-focus-handle-color: var(--sd-primary);--mdc-switch-selected-hover-handle-color: var(--sd-primary);--mdc-switch-selected-pressed-handle-color: var(--sd-primary);--mdc-switch-selected-track-color: var(--sd-primary-light);--mdc-switch-selected-focus-track-color: var(--sd-primary-light);--mdc-switch-selected-hover-track-color: var(--sd-primary-light);--mdc-switch-selected-pressed-track-color: var(--sd-primary-light);--mdc-switch-selected-focus-state-layer-color: var(--sd-primary-light);--mdc-switch-selected-hover-state-layer-color: var(--sd-primary-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-primary-light)}:host([data-sd-color=secondary]) ::ng-deep .mdc-switch{--mat-sys-primary: var(--sd-secondary);--mdc-switch-selected-handle-color: var(--sd-secondary);--mdc-switch-selected-focus-handle-color: var(--sd-secondary);--mdc-switch-selected-hover-handle-color: var(--sd-secondary);--mdc-switch-selected-pressed-handle-color: var(--sd-secondary);--mdc-switch-selected-track-color: var(--sd-secondary-light);--mdc-switch-selected-focus-track-color: var(--sd-secondary-light);--mdc-switch-selected-hover-track-color: var(--sd-secondary-light);--mdc-switch-selected-pressed-track-color: var(--sd-secondary-light);--mdc-switch-selected-focus-state-layer-color: var(--sd-secondary-light);--mdc-switch-selected-hover-state-layer-color: var(--sd-secondary-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-secondary-light)}:host([data-sd-color=info]) ::ng-deep .mdc-switch{--mat-sys-primary: var(--sd-info);--mdc-switch-selected-handle-color: var(--sd-info);--mdc-switch-selected-focus-handle-color: var(--sd-info);--mdc-switch-selected-hover-handle-color: var(--sd-info);--mdc-switch-selected-pressed-handle-color: var(--sd-info);--mdc-switch-selected-track-color: var(--sd-info-light);--mdc-switch-selected-focus-track-color: var(--sd-info-light);--mdc-switch-selected-hover-track-color: var(--sd-info-light);--mdc-switch-selected-pressed-track-color: var(--sd-info-light);--mdc-switch-selected-focus-state-layer-color: var(--sd-info-light);--mdc-switch-selected-hover-state-layer-color: var(--sd-info-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-info-light)}:host([data-sd-color=success]) ::ng-deep .mdc-switch{--mat-sys-primary: var(--sd-success);--mdc-switch-selected-handle-color: var(--sd-success);--mdc-switch-selected-focus-handle-color: var(--sd-success);--mdc-switch-selected-hover-handle-color: var(--sd-success);--mdc-switch-selected-pressed-handle-color: var(--sd-success);--mdc-switch-selected-track-color: var(--sd-success-light);--mdc-switch-selected-focus-track-color: var(--sd-success-light);--mdc-switch-selected-hover-track-color: var(--sd-success-light);--mdc-switch-selected-pressed-track-color: var(--sd-success-light);--mdc-switch-selected-focus-state-layer-color: var(--sd-success-light);--mdc-switch-selected-hover-state-layer-color: var(--sd-success-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-success-light)}:host([data-sd-color=warning]) ::ng-deep .mdc-switch{--mat-sys-primary: var(--sd-warning);--mdc-switch-selected-handle-color: var(--sd-warning);--mdc-switch-selected-focus-handle-color: var(--sd-warning);--mdc-switch-selected-hover-handle-color: var(--sd-warning);--mdc-switch-selected-pressed-handle-color: var(--sd-warning);--mdc-switch-selected-track-color: var(--sd-warning-light);--mdc-switch-selected-focus-track-color: var(--sd-warning-light);--mdc-switch-selected-hover-track-color: var(--sd-warning-light);--mdc-switch-selected-pressed-track-color: var(--sd-warning-light);--mdc-switch-selected-focus-state-layer-color: var(--sd-warning-light);--mdc-switch-selected-hover-state-layer-color: var(--sd-warning-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-warning-light)}:host([data-sd-color=error]) ::ng-deep .mdc-switch{--mat-sys-primary: var(--sd-error);--mdc-switch-selected-handle-color: var(--sd-error);--mdc-switch-selected-focus-handle-color: var(--sd-error);--mdc-switch-selected-hover-handle-color: var(--sd-error);--mdc-switch-selected-pressed-handle-color: var(--sd-error);--mdc-switch-selected-track-color: var(--sd-error-light);--mdc-switch-selected-focus-track-color: var(--sd-error-light);--mdc-switch-selected-hover-track-color: var(--sd-error-light);--mdc-switch-selected-pressed-track-color: var(--sd-error-light);--mdc-switch-selected-focus-state-layer-color: var(--sd-error-light);--mdc-switch-selected-hover-state-layer-color: var(--sd-error-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-error-light)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatSlideToggleModule }, { kind: "component", type: i2.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "color", "disabled", "disableRipple", "tabIndex", "checked", "hideIcon", "disabledInteractive"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
117
123
|
}
|
|
118
124
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdSwitch, decorators: [{
|
|
119
125
|
type: Component,
|
|
120
|
-
args: [{ selector: 'sd-switch', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, ReactiveFormsModule, MatSlideToggleModule, MatFormFieldModule, SdLabel], template: "<mat-slide-toggle\r\n [formControl]=\"formControl\"\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [color]=\"color\">\r\n <sd-label [label]=\"label\" [required]=\"required\"></sd-label>\r\n</mat-slide-toggle>", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host ::ng-deep label{margin-bottom:0!important}:host ::ng-deep .mdc-switch{--mdc-switch-selected-focus-state-layer-color: var(--sd-primary-light);--mat-sys-primary: var(--sd-primary);--mdc-switch-selected-handle-color: var(--sd-primary);--mdc-switch-selected-hover-state-layer-color: var(--sd-primary-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-primary-light);--mdc-switch-selected-focus-handle-color: var(--sd-primary);--mdc-switch-selected-hover-handle-color: var(--sd-primary);--mdc-switch-selected-pressed-handle-color: var(--sd-primary);--mdc-switch-selected-focus-track-color: var(--sd-primary-light);--mdc-switch-selected-hover-track-color: var(--sd-primary-light);--mdc-switch-selected-pressed-track-color: var(--sd-primary-light);--mdc-switch-selected-track-color: var(--sd-primary-light)}\n"] }]
|
|
121
|
-
}], ctorParameters: () => [
|
|
122
|
-
type: Input,
|
|
123
|
-
args: ['name']
|
|
124
|
-
}], form: [{
|
|
125
|
-
type: Input
|
|
126
|
-
}], _label: [{
|
|
127
|
-
type: Input,
|
|
128
|
-
args: ['label']
|
|
129
|
-
}], _color: [{
|
|
130
|
-
type: Input,
|
|
131
|
-
args: ['color']
|
|
132
|
-
}], disabled: [{
|
|
133
|
-
type: Input
|
|
134
|
-
}], model: [{
|
|
135
|
-
type: Input
|
|
136
|
-
}], modelChange: [{
|
|
137
|
-
type: Output
|
|
138
|
-
}], _hideInlineError: [{
|
|
139
|
-
type: Input,
|
|
140
|
-
args: ['hideInlineError']
|
|
141
|
-
}], _required: [{
|
|
142
|
-
type: Input,
|
|
143
|
-
args: ['required']
|
|
144
|
-
}], sdChange: [{
|
|
145
|
-
type: Output
|
|
146
|
-
}] } });
|
|
126
|
+
args: [{ selector: 'sd-switch', changeDetection: ChangeDetectionStrategy.OnPush, host: { '[attr.data-sd-color]': 'color()' }, imports: [FormsModule, ReactiveFormsModule, MatSlideToggleModule, MatFormFieldModule, SdLabel, TranslatePipe], template: "@if (viewed()) {\r\n @if (label()) {\r\n <div class=\"T14R text-black400\">{{ label() }}</div>\r\n }\r\n <div class=\"T14M\">{{ (model() ? 'core.form.switch.on' : 'core.form.switch.off') | translate }}</div>\r\n} @else {\r\n <mat-slide-toggle\r\n [formControl]=\"formControl\"\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-required]=\"dataRequired()\">\r\n <sd-label [label]=\"label()\" [required]=\"required()\"></sd-label>\r\n </mat-slide-toggle>\r\n}\r\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host ::ng-deep label{margin-bottom:0!important}:host([data-sd-color=primary]) ::ng-deep .mdc-switch{--mat-sys-primary: var(--sd-primary);--mdc-switch-selected-handle-color: var(--sd-primary);--mdc-switch-selected-focus-handle-color: var(--sd-primary);--mdc-switch-selected-hover-handle-color: var(--sd-primary);--mdc-switch-selected-pressed-handle-color: var(--sd-primary);--mdc-switch-selected-track-color: var(--sd-primary-light);--mdc-switch-selected-focus-track-color: var(--sd-primary-light);--mdc-switch-selected-hover-track-color: var(--sd-primary-light);--mdc-switch-selected-pressed-track-color: var(--sd-primary-light);--mdc-switch-selected-focus-state-layer-color: var(--sd-primary-light);--mdc-switch-selected-hover-state-layer-color: var(--sd-primary-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-primary-light)}:host([data-sd-color=secondary]) ::ng-deep .mdc-switch{--mat-sys-primary: var(--sd-secondary);--mdc-switch-selected-handle-color: var(--sd-secondary);--mdc-switch-selected-focus-handle-color: var(--sd-secondary);--mdc-switch-selected-hover-handle-color: var(--sd-secondary);--mdc-switch-selected-pressed-handle-color: var(--sd-secondary);--mdc-switch-selected-track-color: var(--sd-secondary-light);--mdc-switch-selected-focus-track-color: var(--sd-secondary-light);--mdc-switch-selected-hover-track-color: var(--sd-secondary-light);--mdc-switch-selected-pressed-track-color: var(--sd-secondary-light);--mdc-switch-selected-focus-state-layer-color: var(--sd-secondary-light);--mdc-switch-selected-hover-state-layer-color: var(--sd-secondary-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-secondary-light)}:host([data-sd-color=info]) ::ng-deep .mdc-switch{--mat-sys-primary: var(--sd-info);--mdc-switch-selected-handle-color: var(--sd-info);--mdc-switch-selected-focus-handle-color: var(--sd-info);--mdc-switch-selected-hover-handle-color: var(--sd-info);--mdc-switch-selected-pressed-handle-color: var(--sd-info);--mdc-switch-selected-track-color: var(--sd-info-light);--mdc-switch-selected-focus-track-color: var(--sd-info-light);--mdc-switch-selected-hover-track-color: var(--sd-info-light);--mdc-switch-selected-pressed-track-color: var(--sd-info-light);--mdc-switch-selected-focus-state-layer-color: var(--sd-info-light);--mdc-switch-selected-hover-state-layer-color: var(--sd-info-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-info-light)}:host([data-sd-color=success]) ::ng-deep .mdc-switch{--mat-sys-primary: var(--sd-success);--mdc-switch-selected-handle-color: var(--sd-success);--mdc-switch-selected-focus-handle-color: var(--sd-success);--mdc-switch-selected-hover-handle-color: var(--sd-success);--mdc-switch-selected-pressed-handle-color: var(--sd-success);--mdc-switch-selected-track-color: var(--sd-success-light);--mdc-switch-selected-focus-track-color: var(--sd-success-light);--mdc-switch-selected-hover-track-color: var(--sd-success-light);--mdc-switch-selected-pressed-track-color: var(--sd-success-light);--mdc-switch-selected-focus-state-layer-color: var(--sd-success-light);--mdc-switch-selected-hover-state-layer-color: var(--sd-success-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-success-light)}:host([data-sd-color=warning]) ::ng-deep .mdc-switch{--mat-sys-primary: var(--sd-warning);--mdc-switch-selected-handle-color: var(--sd-warning);--mdc-switch-selected-focus-handle-color: var(--sd-warning);--mdc-switch-selected-hover-handle-color: var(--sd-warning);--mdc-switch-selected-pressed-handle-color: var(--sd-warning);--mdc-switch-selected-track-color: var(--sd-warning-light);--mdc-switch-selected-focus-track-color: var(--sd-warning-light);--mdc-switch-selected-hover-track-color: var(--sd-warning-light);--mdc-switch-selected-pressed-track-color: var(--sd-warning-light);--mdc-switch-selected-focus-state-layer-color: var(--sd-warning-light);--mdc-switch-selected-hover-state-layer-color: var(--sd-warning-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-warning-light)}:host([data-sd-color=error]) ::ng-deep .mdc-switch{--mat-sys-primary: var(--sd-error);--mdc-switch-selected-handle-color: var(--sd-error);--mdc-switch-selected-focus-handle-color: var(--sd-error);--mdc-switch-selected-hover-handle-color: var(--sd-error);--mdc-switch-selected-pressed-handle-color: var(--sd-error);--mdc-switch-selected-track-color: var(--sd-error-light);--mdc-switch-selected-focus-track-color: var(--sd-error-light);--mdc-switch-selected-hover-track-color: var(--sd-error-light);--mdc-switch-selected-pressed-track-color: var(--sd-error-light);--mdc-switch-selected-focus-state-layer-color: var(--sd-error-light);--mdc-switch-selected-hover-state-layer-color: var(--sd-error-light);--mdc-switch-selected-pressed-state-layer-color: var(--sd-error-light)}\n"] }]
|
|
127
|
+
}], ctorParameters: () => [] });
|
|
147
128
|
|
|
148
129
|
/**
|
|
149
130
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-forms-switch.mjs","sources":["../../../projects/sd-angular/forms/switch/src/switch.component.ts","../../../projects/sd-angular/forms/switch/src/switch.component.html","../../../projects/sd-angular/forms/switch/sd-angular-core-forms-switch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\n/* eslint-disable @angular-eslint/no-input-rename */\r\nimport {\r\n AfterViewInit,\r\n ChangeDetectionStrategy,\r\n ChangeDetectorRef,\r\n Component,\r\n computed,\r\n EventEmitter,\r\n Input,\r\n input,\r\n OnDestroy,\r\n OnInit,\r\n Output,\r\n} from '@angular/core';\r\nimport { AsyncValidatorFn, FormGroup, FormsModule, NgForm, ReactiveFormsModule, ValidatorFn, Validators } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\r\nimport { SdLabel } from '@sd-angular/core/forms/label';\r\nimport { SdFormControl, sdFormControlState } from '@sd-angular/core/forms/models';\r\nimport { sdIsEmpty, sdSerializeDataValue } from '@sd-angular/core/utilities/data-state';\r\nimport { SdColor } from '@sd-angular/core/utilities/models';\r\nimport { Subscription } from 'rxjs';\r\nimport * as uuid from 'uuid';\r\n\r\n@Component({\r\n selector: 'sd-switch',\r\n templateUrl: './switch.component.html',\r\n styleUrl: './switch.component.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n imports: [FormsModule, ReactiveFormsModule, MatSlideToggleModule, MatFormFieldModule, SdLabel],\r\n})\r\nexport class SdSwitch implements OnInit, AfterViewInit, OnDestroy {\r\n id = `I${uuid.v4()}`;\r\n readonly autoIdInput = input<string | undefined | null>(undefined, { alias: 'autoId' });\r\n readonly autoId = computed(() => (this.autoIdInput() ? `forms-switch-${this.autoIdInput()}` : undefined));\r\n readonly #state = sdFormControlState(computed(() => this.formControl));\r\n readonly dataDisabled = computed(() => (this.#state().disabled ? 'true' : 'false'));\r\n readonly dataEmpty = computed(() => (sdIsEmpty(this.#state().value) ? 'true' : 'false'));\r\n readonly dataValue = computed(() => sdSerializeDataValue(this.#state().value));\r\n readonly dataRequired = computed(() => (this.required ? 'true' : 'false'));\r\n #name = uuid.v4();\r\n @Input('name') set _name(val: string | undefined) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n\r\n #form?: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup | undefined | null) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n label?: string;\r\n @Input('label') set _label(val: string | undefined) {\r\n this.label = val;\r\n }\r\n color?: SdColor;\r\n @Input('color') set _color(val: SdColor | undefined | null) {\r\n this.color = val || 'primary';\r\n }\r\n @Input() set disabled(val: boolean | '' | undefined | null) {\r\n val = val === '' || !!val;\r\n if (val) {\r\n this.formControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n }\r\n }\r\n #model?: boolean | null = false;\r\n @Input() set model(value: boolean | undefined | null) {\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value, {\r\n emitEvent: false,\r\n });\r\n }\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n\r\n hideInlineError = false;\r\n @Input('hideInlineError') set _hideInlineError(val: boolean | '') {\r\n this.hideInlineError = val === '' || val;\r\n }\r\n required = false;\r\n @Input('required') set _required(val: boolean | '' | undefined | null) {\r\n this.required = val === '' || !!val;\r\n this.#updateValidator();\r\n }\r\n\r\n @Output() sdChange = new EventEmitter();\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n constructor(private ref: ChangeDetectorRef) {}\r\n\r\n ngOnInit() {\r\n this.#subscription.add(\r\n this.formControl.sdChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n })\r\n );\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.subscribe(this.#onChange));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n #onChange = (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n };\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.required) {\r\n validators.push(Validators.required);\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n };\r\n}\r\n","<mat-slide-toggle\r\n [formControl]=\"formControl\"\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [color]=\"color\">\r\n <sd-label [label]=\"label\" [required]=\"required\"></sd-label>\r\n</mat-slide-toggle>","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;AACA;MA+Ba,QAAQ,CAAA;AAkEC,IAAA,GAAA;AAjEpB,IAAA,EAAE,GAAG,CAAA,CAAA,EAAI,IAAI,CAAC,EAAE,EAAE,EAAE;IACX,WAAW,GAAG,KAAK,CAA4B,SAAS,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAC9E,MAAM,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,WAAW,EAAE,GAAG,CAAA,aAAA,EAAgB,IAAI,CAAC,WAAW,EAAE,CAAA,CAAE,GAAG,SAAS,CAAC,CAAC;AAChG,IAAA,MAAM,GAAG,kBAAkB,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7D,YAAY,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IAC1E,SAAS,GAAG,QAAQ,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAC/E,IAAA,SAAS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APpB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,WAAW,EAAA,eAAA,EAGJ,uBAAuB,CAAC,MAAM,WACtC,CAAC,WAAW,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAA,QAAA,EAAA,uXAAA,EAAA,MAAA,EAAA,CAAA,wqKAAA,CAAA,EAAA;sFAY3E,KAAK,EAAA,CAAA;sBAAvB,KAAK;uBAAC,MAAM;gBAOA,IAAI,EAAA,CAAA;sBAAhB;gBAUmB,MAAM,EAAA,CAAA;sBAAzB,KAAK;uBAAC,OAAO;gBAIM,MAAM,EAAA,CAAA;sBAAzB,KAAK;uBAAC,OAAO;gBAGD,QAAQ,EAAA,CAAA;sBAApB;gBASY,KAAK,EAAA,CAAA;sBAAjB;gBAQS,WAAW,EAAA,CAAA;sBAApB;gBAG6B,gBAAgB,EAAA,CAAA;sBAA7C,KAAK;uBAAC,iBAAiB;gBAID,SAAS,EAAA,CAAA;sBAA/B,KAAK;uBAAC,UAAU;gBAKP,QAAQ,EAAA,CAAA;sBAAjB;;;AE/FH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"sd-angular-core-forms-switch.mjs","sources":["../../../projects/sd-angular/forms/switch/src/switch.component.ts","../../../projects/sd-angular/forms/switch/src/switch.component.html","../../../projects/sd-angular/forms/switch/sd-angular-core-forms-switch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport {\r\n AfterViewInit,\r\n booleanAttribute,\r\n ChangeDetectionStrategy,\r\n ChangeDetectorRef,\r\n Component,\r\n computed,\r\n effect,\r\n inject,\r\n input,\r\n model,\r\n OnDestroy,\r\n OnInit,\r\n output,\r\n} from '@angular/core';\r\nimport { AsyncValidatorFn, FormGroup, FormsModule, NgForm, ReactiveFormsModule, ValidatorFn, Validators } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\r\nimport { SdLabel } from '@sd-angular/core/forms/label';\r\nimport { TranslatePipe } from '@sd-angular/core/i18n';\r\nimport { SdFormControl, sdFormControlState } from '@sd-angular/core/forms/models';\r\nimport { sdIsEmpty, sdSerializeDataValue } from '@sd-angular/core/utilities/data-state';\r\nimport { Color } from '@sd-angular/core/utilities/models';\r\nimport { Subscription } from 'rxjs';\r\nimport * as uuid from 'uuid';\r\n\r\n@Component({\r\n selector: 'sd-switch',\r\n templateUrl: './switch.component.html',\r\n styleUrl: './switch.component.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: { '[attr.data-sd-color]': 'color()' },\r\n imports: [FormsModule, ReactiveFormsModule, MatSlideToggleModule, MatFormFieldModule, SdLabel, TranslatePipe],\r\n})\r\nexport class SdSwitch implements OnInit, AfterViewInit, OnDestroy {\r\n readonly #ref = inject(ChangeDetectorRef);\r\n\r\n id = `I${uuid.v4()}`;\r\n #name = uuid.v4();\r\n #model: boolean | null | undefined = false;\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n\r\n // Inputs — accept null|undefined at boundary, transform to canonical\r\n readonly autoIdInput = input<string | undefined, string | null | undefined>(undefined, {\r\n alias: 'autoId',\r\n transform: (v): string | undefined => v ?? undefined,\r\n });\r\n readonly name = input<string | undefined, string | null | undefined>(undefined, {\r\n transform: (v): string | undefined => v ?? undefined,\r\n });\r\n readonly form = input<FormGroup | undefined, any>(undefined, {\r\n transform: (val: any): FormGroup | undefined => {\r\n if (!val) return undefined;\r\n if (val instanceof NgForm) return val.form;\r\n if (val instanceof FormGroup) return val;\r\n if (val?.form instanceof FormGroup) return val.form;\r\n return undefined;\r\n },\r\n });\r\n readonly label = input<string | undefined, string | null | undefined>(undefined, {\r\n transform: (v): string | undefined => v ?? undefined,\r\n });\r\n // why: legacy callers pass `null` to mean \"fallback to primary\" — keep that contract\r\n readonly color = input<Color, Color | null | undefined>('primary', {\r\n transform: (v): Color => v || 'primary',\r\n });\r\n readonly disabled = input(false, { transform: booleanAttribute });\r\n readonly viewed = input(false, { transform: booleanAttribute });\r\n readonly hideInlineError = input(false, { transform: booleanAttribute });\r\n readonly required = input(false, { transform: booleanAttribute });\r\n\r\n // Two-way model\r\n readonly model = model<boolean | null | undefined>(false);\r\n\r\n // Outputs\r\n readonly sdChange = output<unknown>();\r\n\r\n // Computed (template bindings)\r\n readonly autoId = computed(() => (this.autoIdInput() ? `forms-switch-${this.autoIdInput()}` : undefined));\r\n readonly #state = sdFormControlState(computed(() => this.formControl));\r\n readonly dataDisabled = computed(() => (this.#state().disabled ? 'true' : 'false'));\r\n readonly dataEmpty = computed(() => (sdIsEmpty(this.#state().value) ? 'true' : 'false'));\r\n readonly dataValue = computed(() => sdSerializeDataValue(this.#state().value));\r\n readonly dataRequired = computed(() => (this.required() ? 'true' : 'false'));\r\n\r\n constructor() {\r\n effect(() => {\r\n const val = this.name();\r\n if (val) this.#name = val;\r\n });\r\n\r\n effect(() => {\r\n if (this.disabled()) this.formControl.disable();\r\n else this.formControl.enable();\r\n });\r\n\r\n effect(() => {\r\n const value = this.model();\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value, { emitEvent: false });\r\n }\r\n });\r\n\r\n effect(() => {\r\n this.required();\r\n this.#updateValidator();\r\n });\r\n }\r\n\r\n ngOnInit() {\r\n this.#subscription.add(\r\n this.formControl.sdChanges.subscribe(() => {\r\n this.#ref.markForCheck();\r\n })\r\n );\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.subscribe(this.#onChange));\r\n this.form()?.addControl(this.#name, this.formControl);\r\n this.#ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.form()?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n #onChange = (value: any) => {\r\n this.#model = value;\r\n this.model.set(value);\r\n this.sdChange.emit(value);\r\n };\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.required()) {\r\n validators.push(Validators.required);\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n };\r\n}\r\n","@if (viewed()) {\r\n @if (label()) {\r\n <div class=\"T14R text-black400\">{{ label() }}</div>\r\n }\r\n <div class=\"T14M\">{{ (model() ? 'core.form.switch.on' : 'core.form.switch.off') | translate }}</div>\r\n} @else {\r\n <mat-slide-toggle\r\n [formControl]=\"formControl\"\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-required]=\"dataRequired()\">\r\n <sd-label [label]=\"label()\" [required]=\"required()\"></sd-label>\r\n </mat-slide-toggle>\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;MAmCa,QAAQ,CAAA;AACV,IAAA,IAAI,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAEzC,IAAA,EAAE,GAAG,CAAA,CAAA,EAAI,IAAI,CAAC,EAAE,EAAE,EAAE;AACpB,IAAA,KAAK,GAAG,IAAI,CAAC,EAAE,EAAE;IACjB,MAAM,GAA+B,KAAK;AAC1C,IAAA,WAAW,GAAG,IAAI,aAAa,EAAE;AACjC,IAAA,aAAa,GAAG,IAAI,YAAY,EAAE;;AAGzB,IAAA,WAAW,GAAG,KAAK,CAAgD,SAAS,EAAE;AACrF,QAAA,KAAK,EAAE,QAAQ;QACf,SAAS,EAAE,CAAC,CAAC,KAAyB,CAAC,IAAI,SAAS;AACrD,KAAA,CAAC;AACO,IAAA,IAAI,GAAG,KAAK,CAAgD,SAAS,EAAE;QAC9E,SAAS,EAAE,CAAC,CAAC,KAAyB,CAAC,IAAI,S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;;AEjC/G;;AAEG;;;;"}
|
|
@@ -13,7 +13,7 @@ import { MatInputModule } from '@angular/material/input';
|
|
|
13
13
|
import * as i6 from '@angular/material/tooltip';
|
|
14
14
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
15
15
|
import { SdViewDefDirective, SdLabelDefDirective, SdSuffixDefDirective } from '@sd-angular/core/forms/directives';
|
|
16
|
-
import { SD_FORM_CONFIGURATION, sdFormControlState, SdFormControl } from '@sd-angular/core/forms/models';
|
|
16
|
+
import { SD_FORM_CONFIGURATION, sdFormControlState, SdFormControl, SdInlineErrorValidator } from '@sd-angular/core/forms/models';
|
|
17
17
|
import { sdIsEmpty, sdSerializeDataValue } from '@sd-angular/core/utilities/data-state';
|
|
18
18
|
import { NumberUtilities } from '@sd-angular/core/utilities/extensions';
|
|
19
19
|
import { Subscription } from 'rxjs';
|
|
@@ -243,14 +243,11 @@ class SdTextarea {
|
|
|
243
243
|
if (val)
|
|
244
244
|
asyncValidators.push(this.#customValidator(val));
|
|
245
245
|
if (inl)
|
|
246
|
-
validators.push(
|
|
246
|
+
validators.push(SdInlineErrorValidator);
|
|
247
247
|
this.formControl.setValidators(validators.length ? validators : null);
|
|
248
248
|
this.formControl.setAsyncValidators(asyncValidators.length ? asyncValidators : null);
|
|
249
249
|
this.formControl.updateValueAndValidity({ emitEvent: false });
|
|
250
250
|
};
|
|
251
|
-
customInlineErrorValidator() {
|
|
252
|
-
return () => ({ inlineError: true });
|
|
253
|
-
}
|
|
254
251
|
getCurrentLength = () => {
|
|
255
252
|
return (this.formControl.value ?? '').toString().length;
|
|
256
253
|
};
|
|
@@ -277,11 +274,11 @@ class SdTextarea {
|
|
|
277
274
|
};
|
|
278
275
|
};
|
|
279
276
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTextarea, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
280
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdTextarea, isStandalone: true, selector: "sd-textarea", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, helperText: { classPropertyName: "helperText", publicName: "helperText", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, autoHeight: { classPropertyName: "autoHeight", publicName: "autoHeight", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "pattern", isSignal: true, isRequired: false, transformFunction: null }, validator: { classPropertyName: "validator", publicName: "validator", isSignal: true, isRequired: false, transformFunction: null }, inlineError: { classPropertyName: "inlineError", publicName: "inlineError", isSignal: true, isRequired: false, transformFunction: null }, appearanceInput: { classPropertyName: "appearanceInput", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, floatLabel: { classPropertyName: "floatLabel", publicName: "floatLabel", isSignal: true, isRequired: false, transformFunction: null }, valueModel: { classPropertyName: "valueModel", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueModel: "modelChange", sdChange: "sdChange" }, queries: [{ propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelDef", first: true, predicate: SdLabelDefDirective, descendants: true, isSignal: true }, { propertyName: "sdSuffixDef", first: true, predicate: SdSuffixDefDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "textareaRef", first: true, predicate: ["textarea"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _hideInlineError = hideInlineError();\r\n@let _errorMessage = errorMessage();\r\n@let _viewDef = sdViewDef();\r\n@let _labelDef = sdLabelDef();\r\n@let _helperText = helperText();\r\n@let _required = required();\r\n@let _maxLength = maxlength();\r\n\r\n@if (viewed()) {\r\n @if (_labelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"_labelDef!.templateRef\"> </ng-container>\r\n } @else if (_label) {\r\n <div class=\"T14R text-black400\">{{ _label }}</div>\r\n }\r\n <div class=\"T14M\">{{ formControl.value | sdEmpty }}</div>\r\n} @else {\r\n @if (!_appearance && _labelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"_labelDef!.templateRef\"> </ng-container>\r\n }\r\n @if (!_appearance && _label && !_labelDef?.templateRef) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\r\n }\r\n\r\n <div\r\n class=\"d-flex align-items-center sd-textarea-container\"\r\n [class.sd-view]=\"_viewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n @if (_viewDef?.templateRef && !isFocused) {\r\n <ng-container *ngTemplateOutlet=\"_viewDef!.templateRef; context: { value: formControl.value }\"> </ng-container>\r\n } @else {\r\n <div class=\"sd-textarea-field-wrap\">\r\n <mat-form-field\r\n [class.sd-md]=\"size() === 'md'\"\r\n [class.sd-sm]=\"size() === 'sm'\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [appearance]=\"_appearance!\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_appearance && _label) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ _label }}</span>\r\n @if (_helperText) {\r\n <mat-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"above\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n\r\n <textarea\r\n matInput\r\n [placeholder]=\"placeholder() || _label || ''\"\r\n [formControl]=\"formControl\"\r\n [required]=\"_required\"\r\n autocomplete=\"off\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [rows]=\"rows()\"\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-invalid]=\"dataInvalid()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-maxlength]=\"dataMaxLength()\"\r\n [attr.data-pattern]=\"dataPattern()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n spellcheck=\"false\"\r\n #textarea>\r\n </textarea>\r\n\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\"> error </mat-icon>\r\n }\r\n\r\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-error>{{ _errorMessage }}</mat-error>\r\n }\r\n\r\n @if (sdSuffixDef()?.templateRef; as suffixRef) {\r\n <ng-container matSuffix>\r\n <ng-container *ngTemplateOutlet=\"suffixRef\"></ng-container>\r\n </ng-container>\r\n }\r\n <!-- <ng-container matSuffix>\r\n <ng-content select=\"[sdSuffix]\"></ng-content>\r\n </ng-container> -->\r\n </mat-form-field>\r\n\r\n @if (_maxLength !== null && !_hideInlineError && !formControl.disabled) {\r\n <div\r\n class=\"sd-maxlength-counter\"\r\n [class.sd-maxlength-counter--visible]=\"isFocused\"\r\n [class.sd-maxlength-counter--exceeded]=\"isMaxlengthExceeded()\"\r\n [attr.title]=\"isMaxlengthExceeded() ? ('core.form.textarea.exceeded' | translate) : null\">\r\n {{ getCurrentLength() }}/{{ _maxLength }}\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n}\r\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host{padding-top:5px;display:block}:host ::ng-deep textarea.mat-mdc-input-element{resize:none}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline .mdc-text-field--disabled{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field textarea.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-textarea-field-wrap{position:relative;flex:1;min-width:0}.sd-maxlength-counter{position:absolute;right:4px;top:calc(100% - 16px);opacity:0;font-size:10px;line-height:1.1;color:#00000061;pointer-events:none;transition:opacity .12s ease;z-index:1}.sd-maxlength-counter--exceeded{color:var(--sd-error);font-weight:600}:host ::ng-deep .sd-textarea-container.c-focused .sd-maxlength-counter,:host ::ng-deep .sd-textarea-container:hover .sd-maxlength-counter,:host ::ng-deep .sd-textarea-container .sd-maxlength-counter.sd-maxlength-counter--visible{opacity:1}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }, { kind: "pipe", type: SdEmptyPipe, name: "sdEmpty" }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
|
|
277
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdTextarea, isStandalone: true, selector: "sd-textarea", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, helperText: { classPropertyName: "helperText", publicName: "helperText", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, autoHeight: { classPropertyName: "autoHeight", publicName: "autoHeight", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "pattern", isSignal: true, isRequired: false, transformFunction: null }, validator: { classPropertyName: "validator", publicName: "validator", isSignal: true, isRequired: false, transformFunction: null }, inlineError: { classPropertyName: "inlineError", publicName: "inlineError", isSignal: true, isRequired: false, transformFunction: null }, appearanceInput: { classPropertyName: "appearanceInput", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, floatLabel: { classPropertyName: "floatLabel", publicName: "floatLabel", isSignal: true, isRequired: false, transformFunction: null }, valueModel: { classPropertyName: "valueModel", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueModel: "modelChange", sdChange: "sdChange" }, host: { properties: { "class.sd-has-label": "!!label()", "class.sd-viewed": "viewed()" } }, queries: [{ propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelDef", first: true, predicate: SdLabelDefDirective, descendants: true, isSignal: true }, { propertyName: "sdSuffixDef", first: true, predicate: SdSuffixDefDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "textareaRef", first: true, predicate: ["textarea"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _hideInlineError = hideInlineError();\r\n@let _errorMessage = errorMessage();\r\n@let _viewDef = sdViewDef();\r\n@let _labelDef = sdLabelDef();\r\n@let _helperText = helperText();\r\n@let _required = required();\r\n@let _maxLength = maxlength();\r\n\r\n@if (viewed()) {\r\n @if (_labelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"_labelDef!.templateRef\"> </ng-container>\r\n } @else if (_label) {\r\n <div class=\"T14R text-black400\">{{ _label }}</div>\r\n }\r\n <div class=\"T14M\">{{ formControl.value | sdEmpty }}</div>\r\n} @else {\r\n @if (!_appearance && _labelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"_labelDef!.templateRef\"> </ng-container>\r\n }\r\n @if (!_appearance && _label && !_labelDef?.templateRef) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\r\n }\r\n\r\n <div\r\n class=\"d-flex align-items-center sd-textarea-container\"\r\n [class.sd-view]=\"_viewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n @if (_viewDef?.templateRef && !isFocused) {\r\n <ng-container *ngTemplateOutlet=\"_viewDef!.templateRef; context: { value: formControl.value }\"> </ng-container>\r\n } @else {\r\n <div class=\"sd-textarea-field-wrap\">\r\n <mat-form-field\r\n [class.sd-md]=\"size() === 'md'\"\r\n [class.sd-sm]=\"size() === 'sm'\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [appearance]=\"_appearance!\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_appearance && _label) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ _label }}</span>\r\n @if (_helperText) {\r\n <mat-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"above\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n\r\n <textarea\r\n matInput\r\n [placeholder]=\"placeholder() || _label || ''\"\r\n [formControl]=\"formControl\"\r\n [required]=\"_required\"\r\n autocomplete=\"off\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [rows]=\"rows()\"\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-invalid]=\"dataInvalid()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-maxlength]=\"dataMaxLength()\"\r\n [attr.data-pattern]=\"dataPattern()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n spellcheck=\"false\"\r\n #textarea>\r\n </textarea>\r\n\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\"> error </mat-icon>\r\n }\r\n\r\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-error>{{ _errorMessage }}</mat-error>\r\n }\r\n\r\n @if (sdSuffixDef()?.templateRef; as suffixRef) {\r\n <ng-container matSuffix>\r\n <ng-container *ngTemplateOutlet=\"suffixRef\"></ng-container>\r\n </ng-container>\r\n }\r\n <!-- <ng-container matSuffix>\r\n <ng-content select=\"[sdSuffix]\"></ng-content>\r\n </ng-container> -->\r\n </mat-form-field>\r\n\r\n @if (_maxLength !== null && !_hideInlineError && !formControl.disabled) {\r\n <div\r\n class=\"sd-maxlength-counter\"\r\n [class.sd-maxlength-counter--visible]=\"isFocused\"\r\n [class.sd-maxlength-counter--exceeded]=\"isMaxlengthExceeded()\"\r\n [attr.title]=\"isMaxlengthExceeded() ? ('core.form.textarea.exceeded' | translate) : null\">\r\n {{ getCurrentLength() }}/{{ _maxLength }}\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n}\r\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-viewed){padding-top:0}:host ::ng-deep textarea.mat-mdc-input-element{resize:none}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline .mdc-text-field--disabled{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field textarea.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-textarea-field-wrap{position:relative;flex:1;min-width:0}.sd-maxlength-counter{position:absolute;right:4px;top:calc(100% - 16px);opacity:0;font-size:10px;line-height:1.1;color:#00000061;pointer-events:none;transition:opacity .12s ease;z-index:1}.sd-maxlength-counter--exceeded{color:var(--sd-error);font-weight:600}:host ::ng-deep .sd-textarea-container.c-focused .sd-maxlength-counter,:host ::ng-deep .sd-textarea-container:hover .sd-maxlength-counter,:host ::ng-deep .sd-textarea-container .sd-maxlength-counter.sd-maxlength-counter--visible{opacity:1}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }, { kind: "pipe", type: SdEmptyPipe, name: "sdEmpty" }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
|
|
281
278
|
}
|
|
282
279
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTextarea, decorators: [{
|
|
283
280
|
type: Component,
|
|
284
|
-
args: [{ selector: 'sd-textarea', standalone: true, imports: [
|
|
281
|
+
args: [{ selector: 'sd-textarea', standalone: true, host: { '[class.sd-has-label]': '!!label()', '[class.sd-viewed]': 'viewed()' }, imports: [
|
|
285
282
|
CommonModule,
|
|
286
283
|
FormsModule,
|
|
287
284
|
ReactiveFormsModule,
|
|
@@ -292,7 +289,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
292
289
|
SdLabel,
|
|
293
290
|
SdEmptyPipe,
|
|
294
291
|
TranslatePipe,
|
|
295
|
-
], template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _hideInlineError = hideInlineError();\r\n@let _errorMessage = errorMessage();\r\n@let _viewDef = sdViewDef();\r\n@let _labelDef = sdLabelDef();\r\n@let _helperText = helperText();\r\n@let _required = required();\r\n@let _maxLength = maxlength();\r\n\r\n@if (viewed()) {\r\n @if (_labelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"_labelDef!.templateRef\"> </ng-container>\r\n } @else if (_label) {\r\n <div class=\"T14R text-black400\">{{ _label }}</div>\r\n }\r\n <div class=\"T14M\">{{ formControl.value | sdEmpty }}</div>\r\n} @else {\r\n @if (!_appearance && _labelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"_labelDef!.templateRef\"> </ng-container>\r\n }\r\n @if (!_appearance && _label && !_labelDef?.templateRef) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\r\n }\r\n\r\n <div\r\n class=\"d-flex align-items-center sd-textarea-container\"\r\n [class.sd-view]=\"_viewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n @if (_viewDef?.templateRef && !isFocused) {\r\n <ng-container *ngTemplateOutlet=\"_viewDef!.templateRef; context: { value: formControl.value }\"> </ng-container>\r\n } @else {\r\n <div class=\"sd-textarea-field-wrap\">\r\n <mat-form-field\r\n [class.sd-md]=\"size() === 'md'\"\r\n [class.sd-sm]=\"size() === 'sm'\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [appearance]=\"_appearance!\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_appearance && _label) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ _label }}</span>\r\n @if (_helperText) {\r\n <mat-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"above\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n\r\n <textarea\r\n matInput\r\n [placeholder]=\"placeholder() || _label || ''\"\r\n [formControl]=\"formControl\"\r\n [required]=\"_required\"\r\n autocomplete=\"off\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [rows]=\"rows()\"\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-invalid]=\"dataInvalid()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-maxlength]=\"dataMaxLength()\"\r\n [attr.data-pattern]=\"dataPattern()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n spellcheck=\"false\"\r\n #textarea>\r\n </textarea>\r\n\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\"> error </mat-icon>\r\n }\r\n\r\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-error>{{ _errorMessage }}</mat-error>\r\n }\r\n\r\n @if (sdSuffixDef()?.templateRef; as suffixRef) {\r\n <ng-container matSuffix>\r\n <ng-container *ngTemplateOutlet=\"suffixRef\"></ng-container>\r\n </ng-container>\r\n }\r\n <!-- <ng-container matSuffix>\r\n <ng-content select=\"[sdSuffix]\"></ng-content>\r\n </ng-container> -->\r\n </mat-form-field>\r\n\r\n @if (_maxLength !== null && !_hideInlineError && !formControl.disabled) {\r\n <div\r\n class=\"sd-maxlength-counter\"\r\n [class.sd-maxlength-counter--visible]=\"isFocused\"\r\n [class.sd-maxlength-counter--exceeded]=\"isMaxlengthExceeded()\"\r\n [attr.title]=\"isMaxlengthExceeded() ? ('core.form.textarea.exceeded' | translate) : null\">\r\n {{ getCurrentLength() }}/{{ _maxLength }}\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n}\r\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host{padding-top:5px;display:block}:host ::ng-deep textarea.mat-mdc-input-element{resize:none}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline .mdc-text-field--disabled{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field textarea.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-textarea-field-wrap{position:relative;flex:1;min-width:0}.sd-maxlength-counter{position:absolute;right:4px;top:calc(100% - 16px);opacity:0;font-size:10px;line-height:1.1;color:#00000061;pointer-events:none;transition:opacity .12s ease;z-index:1}.sd-maxlength-counter--exceeded{color:var(--sd-error);font-weight:600}:host ::ng-deep .sd-textarea-container.c-focused .sd-maxlength-counter,:host ::ng-deep .sd-textarea-container:hover .sd-maxlength-counter,:host ::ng-deep .sd-textarea-container .sd-maxlength-counter.sd-maxlength-counter--visible{opacity:1}\n"] }]
|
|
292
|
+
], template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _hideInlineError = hideInlineError();\r\n@let _errorMessage = errorMessage();\r\n@let _viewDef = sdViewDef();\r\n@let _labelDef = sdLabelDef();\r\n@let _helperText = helperText();\r\n@let _required = required();\r\n@let _maxLength = maxlength();\r\n\r\n@if (viewed()) {\r\n @if (_labelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"_labelDef!.templateRef\"> </ng-container>\r\n } @else if (_label) {\r\n <div class=\"T14R text-black400\">{{ _label }}</div>\r\n }\r\n <div class=\"T14M\">{{ formControl.value | sdEmpty }}</div>\r\n} @else {\r\n @if (!_appearance && _labelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"_labelDef!.templateRef\"> </ng-container>\r\n }\r\n @if (!_appearance && _label && !_labelDef?.templateRef) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\r\n }\r\n\r\n <div\r\n class=\"d-flex align-items-center sd-textarea-container\"\r\n [class.sd-view]=\"_viewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n @if (_viewDef?.templateRef && !isFocused) {\r\n <ng-container *ngTemplateOutlet=\"_viewDef!.templateRef; context: { value: formControl.value }\"> </ng-container>\r\n } @else {\r\n <div class=\"sd-textarea-field-wrap\">\r\n <mat-form-field\r\n [class.sd-md]=\"size() === 'md'\"\r\n [class.sd-sm]=\"size() === 'sm'\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [appearance]=\"_appearance!\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_appearance && _label) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ _label }}</span>\r\n @if (_helperText) {\r\n <mat-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"above\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n\r\n <textarea\r\n matInput\r\n [placeholder]=\"placeholder() || _label || ''\"\r\n [formControl]=\"formControl\"\r\n [required]=\"_required\"\r\n autocomplete=\"off\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [rows]=\"rows()\"\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-invalid]=\"dataInvalid()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-maxlength]=\"dataMaxLength()\"\r\n [attr.data-pattern]=\"dataPattern()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n spellcheck=\"false\"\r\n #textarea>\r\n </textarea>\r\n\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\"> error </mat-icon>\r\n }\r\n\r\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-error>{{ _errorMessage }}</mat-error>\r\n }\r\n\r\n @if (sdSuffixDef()?.templateRef; as suffixRef) {\r\n <ng-container matSuffix>\r\n <ng-container *ngTemplateOutlet=\"suffixRef\"></ng-container>\r\n </ng-container>\r\n }\r\n <!-- <ng-container matSuffix>\r\n <ng-content select=\"[sdSuffix]\"></ng-content>\r\n </ng-container> -->\r\n </mat-form-field>\r\n\r\n @if (_maxLength !== null && !_hideInlineError && !formControl.disabled) {\r\n <div\r\n class=\"sd-maxlength-counter\"\r\n [class.sd-maxlength-counter--visible]=\"isFocused\"\r\n [class.sd-maxlength-counter--exceeded]=\"isMaxlengthExceeded()\"\r\n [attr.title]=\"isMaxlengthExceeded() ? ('core.form.textarea.exceeded' | translate) : null\">\r\n {{ getCurrentLength() }}/{{ _maxLength }}\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n}\r\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-viewed){padding-top:0}:host ::ng-deep textarea.mat-mdc-input-element{resize:none}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline .mdc-text-field--disabled{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field textarea.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-textarea-field-wrap{position:relative;flex:1;min-width:0}.sd-maxlength-counter{position:absolute;right:4px;top:calc(100% - 16px);opacity:0;font-size:10px;line-height:1.1;color:#00000061;pointer-events:none;transition:opacity .12s ease;z-index:1}.sd-maxlength-counter--exceeded{color:var(--sd-error);font-weight:600}:host ::ng-deep .sd-textarea-container.c-focused .sd-maxlength-counter,:host ::ng-deep .sd-textarea-container:hover .sd-maxlength-counter,:host ::ng-deep .sd-textarea-container .sd-maxlength-counter.sd-maxlength-counter--visible{opacity:1}\n"] }]
|
|
296
293
|
}], ctorParameters: () => [] });
|
|
297
294
|
|
|
298
295
|
/**
|