@sdcorejs/angular 21.2.5 → 22.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/fonts/fonts.scss +2 -2
- package/assets/images/coming-soon.svg +6 -6
- package/assets/images/data-empty.svg +2 -2
- package/assets/images/expired.svg +6 -6
- package/assets/images/file-error.svg +6 -6
- package/assets/images/filter-empty.svg +2 -2
- package/assets/images/filter-required.svg +2 -2
- package/assets/images/forbidden.svg +2 -2
- package/assets/images/image-error.svg +8 -8
- package/assets/images/maintenance.svg +3 -3
- package/assets/images/not-found.svg +2 -2
- package/assets/images/offline.svg +5 -5
- package/assets/images/submitted.svg +5 -5
- package/assets/images/success.svg +3 -3
- package/assets/images/unauthorized.svg +2 -2
- package/assets/images/unknown-error.svg +2 -2
- package/fesm2022/sdcorejs-angular-components-anchor.mjs +46 -29
- package/fesm2022/sdcorejs-angular-components-anchor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +167 -94
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-audit-diff.mjs +20 -13
- package/fesm2022/sdcorejs-angular-components-audit-diff.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs +65 -40
- package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-avatar.mjs +15 -9
- package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-badge.mjs +31 -17
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs +17 -10
- package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +17 -10
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-card.mjs +28 -17
- package/fesm2022/sdcorejs-angular-components-card.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-chart.mjs +52 -32
- package/fesm2022/sdcorejs-angular-components-chart.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs +3 -3
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-code-editor.mjs +15 -9
- package/fesm2022/sdcorejs-angular-components-code-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs +32 -19
- package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor.mjs +38 -21
- package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +396 -306
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-history.mjs +10 -10
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +12 -12
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs +42 -24
- package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-job-progress.mjs +39 -21
- package/fesm2022/sdcorejs-angular-components-job-progress.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +9 -8
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +22 -14
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +21 -12
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-operator.mjs +17 -10
- package/fesm2022/sdcorejs-angular-components-operator.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-org-chart.mjs +26 -16
- package/fesm2022/sdcorejs-angular-components-org-chart.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-preview.mjs +288 -147
- package/fesm2022/sdcorejs-angular-components-preview.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +279 -153
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs +69 -36
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs +3 -3
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +17 -13
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +26 -16
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-splitter.mjs +58 -37
- package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-stepper.mjs +36 -21
- package/fesm2022/sdcorejs-angular-components-stepper.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +27 -23
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab.mjs +34 -20
- package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +432 -272
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs +86 -46
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +65 -40
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-view.mjs +25 -14
- package/fesm2022/sdcorejs-angular-components-view.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-configurations.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +42 -33
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +80 -42
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs +15 -9
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +41 -24
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip.mjs +37 -22
- package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +55 -30
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +63 -34
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +65 -35
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-directives.mjs +12 -12
- package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +94 -53
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-inline-text.mjs +33 -18
- package/fesm2022/sdcorejs-angular-forms-inline-text.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs +25 -14
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +66 -35
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +94 -49
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-label.mjs +3 -3
- package/fesm2022/sdcorejs-angular-forms-label.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-models.mjs +13 -8
- package/fesm2022/sdcorejs-angular-forms-models.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-radio.mjs +41 -22
- package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +112 -59
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-switch.mjs +21 -12
- package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +48 -26
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time-range.mjs +83 -43
- package/fesm2022/sdcorejs-angular-forms-time-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time.mjs +72 -38
- package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +76 -41
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms.mjs +4 -4
- package/fesm2022/sdcorejs-angular-forms.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-handlers.mjs +3 -3
- package/fesm2022/sdcorejs-angular-handlers.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +12 -9
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-interceptors.mjs +6 -6
- package/fesm2022/sdcorejs-angular-interceptors.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-auth.mjs +11 -10
- package/fesm2022/sdcorejs-angular-modules-auth.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-icon.mjs +19 -11
- package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-keycloak.mjs +7 -7
- package/fesm2022/sdcorejs-angular-modules-keycloak.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +387 -247
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-permission.mjs +13 -11
- package/fesm2022/sdcorejs-angular-modules-permission.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-pipes.mjs +25 -25
- package/fesm2022/sdcorejs-angular-pipes.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-api.mjs +10 -10
- package/fesm2022/sdcorejs-angular-services-api.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-cache.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-cache.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +9 -9
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-excel.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-loading.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-loading.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-notify.mjs +21 -16
- package/fesm2022/sdcorejs-angular-services-notify.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-persistence.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-persistence.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-storage.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-task.mjs +19 -11
- package/fesm2022/sdcorejs-angular-services-task.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs +17 -10
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-viewport.mjs +15 -9
- package/fesm2022/sdcorejs-angular-services-viewport.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-extensions.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-models.mjs.map +1 -1
- package/package.json +11 -11
|
@@ -24,7 +24,8 @@ class SdSwitch {
|
|
|
24
24
|
autoIdInput = input(undefined, { ...(ngDevMode ? { debugName: "autoIdInput" } : /* istanbul ignore next */ {}), alias: 'autoId',
|
|
25
25
|
transform: (v) => v ?? undefined });
|
|
26
26
|
name = input(undefined, { ...(ngDevMode ? { debugName: "name" } : /* istanbul ignore next */ {}), transform: (v) => v ?? undefined });
|
|
27
|
-
form = input(undefined,
|
|
27
|
+
form = input(undefined, /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "form" }] : /* istanbul ignore next */ []));
|
|
28
29
|
label = input(undefined, { ...(ngDevMode ? { debugName: "label" } : /* istanbul ignore next */ {}), transform: (v) => v ?? undefined });
|
|
29
30
|
// why: legacy callers pass `null` to mean "fallback to primary" — keep that contract
|
|
30
31
|
color = input('primary', { ...(ngDevMode ? { debugName: "color" } : /* istanbul ignore next */ {}), transform: (v) => v || 'primary' });
|
|
@@ -38,16 +39,22 @@ class SdSwitch {
|
|
|
38
39
|
hideInlineError = input(false, { ...(ngDevMode ? { debugName: "hideInlineError" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
39
40
|
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
40
41
|
// Two-way model
|
|
41
|
-
model = model(false,
|
|
42
|
+
model = model(false, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "model" }] : /* istanbul ignore next */ []));
|
|
42
44
|
// Outputs
|
|
43
45
|
sdChange = output();
|
|
44
46
|
// Computed (template bindings)
|
|
45
|
-
autoId = computed(() => (this.autoIdInput() ? `forms-switch-${this.autoIdInput()}` : undefined),
|
|
47
|
+
autoId = computed(() => (this.autoIdInput() ? `forms-switch-${this.autoIdInput()}` : undefined), /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
46
49
|
#state = sdFormControlState(computed(() => this.formControl));
|
|
47
|
-
dataDisabled = computed(() => (this.#state().disabled ? 'true' : 'false'),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
dataDisabled = computed(() => (this.#state().disabled ? 'true' : 'false'), /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "dataDisabled" }] : /* istanbul ignore next */ []));
|
|
52
|
+
dataEmpty = computed(() => (sdIsEmpty(this.#state().value) ? 'true' : 'false'), /* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "dataEmpty" }] : /* istanbul ignore next */ []));
|
|
54
|
+
dataValue = computed(() => sdSerializeDataValue(this.#state().value), /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "dataValue" }] : /* istanbul ignore next */ []));
|
|
56
|
+
dataRequired = computed(() => (this.required() ? 'true' : 'false'), /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "dataRequired" }] : /* istanbul ignore next */ []));
|
|
51
58
|
// why: `[required]` gắn Validators.required nhưng template TRƯỚC ĐÂY không render bất kỳ
|
|
52
59
|
// message nào, nên switch bắt buộc để OFF chặn submit mà người dùng không thấy lý do —
|
|
53
60
|
// đúng loại bug "error invalid nhưng message ẩn". Dùng lại key `core.form.input.required`
|
|
@@ -55,7 +62,8 @@ class SdSwitch {
|
|
|
55
62
|
errorMessage = computed(() => {
|
|
56
63
|
void this.#state();
|
|
57
64
|
return this.formControl.errors?.['required'] ? this.#i18n.t('core.form.input.required') : undefined;
|
|
58
|
-
},
|
|
65
|
+
}, /* @ts-ignore */
|
|
66
|
+
...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
59
67
|
#formConnector = _sdFormControlConnector({
|
|
60
68
|
form: this.form,
|
|
61
69
|
name: computed(() => this.name() || this.#defaultName),
|
|
@@ -73,7 +81,8 @@ class SdSwitch {
|
|
|
73
81
|
/** Shared reactive form policy — `validationError` is already interaction-gated (touched/dirty). */
|
|
74
82
|
connectorState = this.#formConnector.state;
|
|
75
83
|
/** Message to render inline; `undefined` while untouched, or when `hideInlineError` is set. */
|
|
76
|
-
visibleErrorMessage = computed(() => (this.hideInlineError() ? undefined : this.connectorState().validationError),
|
|
84
|
+
visibleErrorMessage = computed(() => (this.hideInlineError() ? undefined : this.connectorState().validationError), /* @ts-ignore */
|
|
85
|
+
...(ngDevMode ? [{ debugName: "visibleErrorMessage" }] : /* istanbul ignore next */ []));
|
|
77
86
|
ngOnInit() {
|
|
78
87
|
this.#subscription.add(this.formControl.sdChanges.subscribe(() => {
|
|
79
88
|
this.#ref.markForCheck();
|
|
@@ -82,10 +91,10 @@ class SdSwitch {
|
|
|
82
91
|
ngOnDestroy() {
|
|
83
92
|
this.#subscription.unsubscribe();
|
|
84
93
|
}
|
|
85
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
86
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
94
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSwitch, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
95
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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: { "class.sd-c-primary": "color() === 'primary'", "class.sd-c-secondary": "color() === 'secondary'", "class.sd-c-info": "color() === 'info'", "class.sd-c-success": "color() === 'success'", "class.sd-c-warning": "color() === 'warning'", "class.sd-c-error": "color() === 'error'" } }, ngImport: i0, template: "@if (isViewed()) {\n @if (label()) {\n <div class=\"T14R text-secondary\">{{ label() }}</div>\n }\n <div class=\"T14M\">{{ (model() ? 'core.form.switch.on' : 'core.form.switch.off') | sdTranslate }}</div>\n} @else {\n <mat-slide-toggle\n [formControl]=\"formControl\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-empty]=\"dataEmpty()\"\n [attr.data-value]=\"dataValue()\"\n [attr.data-required]=\"dataRequired()\">\n <sd-label [label]=\"label()\" [required]=\"required()\"></sd-label>\n </mat-slide-toggle>\n @let _errorMessage = visibleErrorMessage();\n @if (_errorMessage) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n}\n", styles: [":host ::ng-deep label{margin-bottom:0!important}:host{--sd-c: var(--sd-primary);--sd-switch-handle: var(--sd-surface, #fff);--sd-switch-track-off: var(--sd-surface-muted, #e7e8ed);--sd-switch-track-off-hover: var(--sd-border, #c4c6d0);--sd-switch-handle-off: var(--sd-text-secondary, #44474f)}:host(.sd-c-secondary){--sd-c: var(--sd-secondary)}:host(.sd-c-info){--sd-c: var(--sd-info)}:host(.sd-c-success){--sd-c: var(--sd-success)}:host(.sd-c-warning){--sd-c: var(--sd-warning)}:host(.sd-c-error){--sd-c: var(--sd-error)}:host ::ng-deep .mat-mdc-slide-toggle,:host ::ng-deep .mdc-switch{--mdc-switch-selected-handle-color: var(--sd-switch-handle) !important;--mdc-switch-selected-focus-handle-color: var(--sd-switch-handle) !important;--mdc-switch-selected-hover-handle-color: var(--sd-switch-handle) !important;--mdc-switch-selected-pressed-handle-color: var(--sd-switch-handle) !important;--mdc-switch-selected-icon-color: var(--sd-c) !important;--mdc-switch-selected-focus-icon-color: var(--sd-c) !important;--mdc-switch-selected-hover-icon-color: var(--sd-c) !important;--mdc-switch-selected-pressed-icon-color: var(--sd-c) !important;--mdc-switch-selected-track-color: var(--sd-c) !important;--mdc-switch-selected-focus-track-color: var(--sd-c) !important;--mdc-switch-selected-hover-track-color: var(--sd-c) !important;--mdc-switch-selected-pressed-track-color: var(--sd-c) !important;--mdc-switch-selected-focus-state-layer-color: var(--sd-c) !important;--mdc-switch-selected-hover-state-layer-color: var(--sd-c) !important;--mdc-switch-selected-pressed-state-layer-color: var(--sd-c) !important;--mdc-switch-unselected-track-color: var(--sd-switch-track-off) !important;--mdc-switch-unselected-focus-track-color: var(--sd-switch-track-off-hover) !important;--mdc-switch-unselected-hover-track-color: var(--sd-switch-track-off-hover) !important;--mdc-switch-unselected-pressed-track-color: var(--sd-switch-track-off-hover) !important;--mdc-switch-unselected-handle-color: var(--sd-switch-handle-off) !important;--mdc-switch-unselected-focus-handle-color: var(--sd-switch-handle-off) !important;--mdc-switch-unselected-hover-handle-color: var(--sd-switch-handle-off) !important;--mdc-switch-unselected-pressed-handle-color: var(--sd-switch-handle-off) !important;--mat-slide-toggle-selected-handle-color: var(--sd-switch-handle) !important;--mat-slide-toggle-selected-focus-handle-color: var(--sd-switch-handle) !important;--mat-slide-toggle-selected-hover-handle-color: var(--sd-switch-handle) !important;--mat-slide-toggle-selected-pressed-handle-color: var(--sd-switch-handle) !important;--mat-slide-toggle-selected-icon-color: var(--sd-c) !important;--mat-slide-toggle-selected-focus-icon-color: var(--sd-c) !important;--mat-slide-toggle-selected-hover-icon-color: var(--sd-c) !important;--mat-slide-toggle-selected-pressed-icon-color: var(--sd-c) !important;--mat-slide-toggle-selected-track-color: var(--sd-c) !important;--mat-slide-toggle-selected-focus-track-color: var(--sd-c) !important;--mat-slide-toggle-selected-hover-track-color: var(--sd-c) !important;--mat-slide-toggle-selected-pressed-track-color: var(--sd-c) !important;--mat-slide-toggle-selected-focus-state-layer-color: var(--sd-c) !important;--mat-slide-toggle-selected-hover-state-layer-color: var(--sd-c) !important;--mat-slide-toggle-selected-pressed-state-layer-color: var(--sd-c) !important;--mat-slide-toggle-unselected-track-color: var(--sd-switch-track-off) !important;--mat-slide-toggle-unselected-focus-track-color: var(--sd-switch-track-off-hover) !important;--mat-slide-toggle-unselected-hover-track-color: var(--sd-switch-track-off-hover) !important;--mat-slide-toggle-unselected-pressed-track-color: var(--sd-switch-track-off-hover) !important;--mat-slide-toggle-unselected-handle-color: var(--sd-switch-handle-off) !important;--mat-slide-toggle-unselected-focus-handle-color: var(--sd-switch-handle-off) !important;--mat-slide-toggle-unselected-hover-handle-color: var(--sd-switch-handle-off) !important;--mat-slide-toggle-unselected-pressed-handle-color: var(--sd-switch-handle-off) !important;--mat-slide-toggle-track-outline-color: transparent !important;--mat-slide-toggle-selected-track-outline-color: transparent !important}\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", "fullWidth", "disableRipple", "tabIndex", "checked", "hideIcon", "disabledInteractive"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
87
96
|
}
|
|
88
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
97
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdSwitch, decorators: [{
|
|
89
98
|
type: Component,
|
|
90
99
|
args: [{ selector: 'sd-switch', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
91
100
|
// why: dùng host class .sd-c-<x> (thay vì data-attr) để reactivity host-binding với
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdcorejs-angular-forms-switch.mjs","sources":["../../../projects/sdcorejs-angular/forms/switch/src/switch.component.ts","../../../projects/sdcorejs-angular/forms/switch/src/switch.component.html","../../../projects/sdcorejs-angular/forms/switch/sdcorejs-angular-forms-switch.ts"],"sourcesContent":["import { Utilities } from '@sdcorejs/utils/fns';\n\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n computed,\n inject,\n input,\n model,\n OnDestroy,\n OnInit,\n output,\n} from '@angular/core';\nimport { FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\nimport { SdLabel } from '@sdcorejs/angular/forms/label';\nimport { I18nService, SdTranslatePipe } from '@sdcorejs/angular/i18n';\nimport {\n SdFormControl,\n sdFormControlState,\n SdViewed,\n SdViewedInput,\n sdViewedInline,\n sdViewedTransform,\n ɵsdFormControlConnector,\n ɵSdFormControlParent,\n} from '@sdcorejs/angular/forms/models';\nimport { sdIsEmpty, sdSerializeDataValue } from '@sdcorejs/angular/utilities/data-state';\nimport { Color } from '@sdcorejs/utils/models';\nimport { Subscription } from 'rxjs';\n\n@Component({\n selector: 'sd-switch',\n templateUrl: './switch.component.html',\n styleUrl: './switch.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n // why: dùng host class .sd-c-<x> (thay vì data-attr) để reactivity host-binding với\n // signal chắc chắn áp dụng + có default fallback `sd-c-primary` khi color() là 'primary'.\n // Test cũ assert data-sd-color đã được thay bằng class assert tương ứng.\n '[class.sd-c-primary]': \"color() === 'primary'\",\n '[class.sd-c-secondary]': \"color() === 'secondary'\",\n '[class.sd-c-info]': \"color() === 'info'\",\n '[class.sd-c-success]': \"color() === 'success'\",\n '[class.sd-c-warning]': \"color() === 'warning'\",\n '[class.sd-c-error]': \"color() === 'error'\",\n },\n imports: [FormsModule, ReactiveFormsModule, MatSlideToggleModule, MatFormFieldModule, SdLabel, SdTranslatePipe],\n})\nexport class SdSwitch implements OnInit, OnDestroy {\n readonly #ref = inject(ChangeDetectorRef);\n readonly #i18n = inject(I18nService);\n\n id = `I${Utilities.generateUuid()}`;\n readonly #defaultName = Utilities.generateUuid();\n formControl = new SdFormControl();\n #subscription = new Subscription();\n\n // Inputs — accept null|undefined at boundary, transform to canonical\n readonly autoIdInput = input<string | undefined, string | null | undefined>(undefined, {\n alias: 'autoId',\n transform: (v): string | undefined => v ?? undefined,\n });\n readonly name = input<string | undefined, string | null | undefined>(undefined, {\n transform: (v): string | undefined => v ?? undefined,\n });\n readonly form = input<ɵSdFormControlParent>(undefined);\n readonly label = input<string | undefined, string | null | undefined>(undefined, {\n transform: (v): string | undefined => v ?? undefined,\n });\n // why: legacy callers pass `null` to mean \"fallback to primary\" — keep that contract\n readonly color = input<Color, Color | null | undefined>('primary', {\n transform: (v): Color => v || 'primary',\n });\n readonly disabled = input(false, { transform: booleanAttribute });\n /** Display mode: `false` edit · `true` static view · `'inline'` interactive (disabled `'inline'` → static). */\n readonly viewed = input<SdViewed, SdViewedInput>(false, { transform: sdViewedTransform });\n\n // why: tri-state viewed — `'inline'` keeps the switch interactive; disabled `'inline'` → static.\n readonly #viewedState = sdViewedInline(this.viewed, undefined, this.disabled);\n /** `true` when the static read-only view should render. */\n readonly isViewed = this.#viewedState.isViewed;\n readonly hideInlineError = input(false, { transform: booleanAttribute });\n readonly required = input(false, { transform: booleanAttribute });\n\n // Two-way model\n readonly model = model<boolean | null | undefined>(false);\n\n // Outputs\n readonly sdChange = output<unknown>();\n\n // Computed (template bindings)\n readonly autoId = computed(() => (this.autoIdInput() ? `forms-switch-${this.autoIdInput()}` : undefined));\n readonly #state = sdFormControlState(computed(() => this.formControl));\n readonly dataDisabled = computed(() => (this.#state().disabled ? 'true' : 'false'));\n readonly dataEmpty = computed(() => (sdIsEmpty(this.#state().value) ? 'true' : 'false'));\n readonly dataValue = computed(() => sdSerializeDataValue(this.#state().value));\n readonly dataRequired = computed(() => (this.required() ? 'true' : 'false'));\n\n // why: `[required]` gắn Validators.required nhưng template TRƯỚC ĐÂY không render bất kỳ\n // message nào, nên switch bắt buộc để OFF chặn submit mà người dùng không thấy lý do —\n // đúng loại bug \"error invalid nhưng message ẩn\". Dùng lại key `core.form.input.required`\n // ('Vui lòng nhập thông tin') vì catalog i18n chưa có key riêng cho switch.\n readonly errorMessage = computed<string | undefined>(() => {\n void this.#state();\n return this.formControl.errors?.['required'] ? this.#i18n.t('core.form.input.required') : undefined;\n });\n\n readonly #formConnector = ɵsdFormControlConnector<boolean | null | undefined, boolean | null | undefined>({\n form: this.form,\n name: computed(() => this.name() || this.#defaultName),\n control: computed(() => this.formControl),\n model: this.model,\n writeModel: value => {\n this.model.set(value);\n this.sdChange.emit(value);\n },\n validators: computed(() => (this.required() ? Validators.required : null)),\n disabled: this.disabled,\n validationError: this.errorMessage,\n controlEquals: (controlValue, modelValue) => (controlValue === null && modelValue === false) || Object.is(controlValue, modelValue),\n });\n\n /** Shared reactive form policy — `validationError` is already interaction-gated (touched/dirty). */\n readonly connectorState = this.#formConnector.state;\n /** Message to render inline; `undefined` while untouched, or when `hideInlineError` is set. */\n readonly visibleErrorMessage = computed(() => (this.hideInlineError() ? undefined : this.connectorState().validationError));\n\n ngOnInit() {\n this.#subscription.add(\n this.formControl.sdChanges.subscribe(() => {\n this.#ref.markForCheck();\n })\n );\n }\n\n ngOnDestroy() {\n this.#subscription.unsubscribe();\n }\n}\n","@if (isViewed()) {\n @if (label()) {\n <div class=\"T14R text-secondary\">{{ label() }}</div>\n }\n <div class=\"T14M\">{{ (model() ? 'core.form.switch.on' : 'core.form.switch.off') | sdTranslate }}</div>\n} @else {\n <mat-slide-toggle\n [formControl]=\"formControl\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-empty]=\"dataEmpty()\"\n [attr.data-value]=\"dataValue()\"\n [attr.data-required]=\"dataRequired()\">\n <sd-label [label]=\"label()\" [required]=\"required()\"></sd-label>\n </mat-slide-toggle>\n @let _errorMessage = visibleErrorMessage();\n @if (_errorMessage) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵsdFormControlConnector"],"mappings":";;;;;;;;;;;;;;;MAoDa,QAAQ,CAAA;AACV,IAAA,IAAI,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAChC,IAAA,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;AAEpC,IAAA,EAAE,GAAG,CAAA,CAAA,EAAI,SAAS,CAAC,YAAY,EAAE,EAAE;AAC1B,IAAA,YAAY,GAAG,SAAS,CAAC,YAAY,EAAE;AAChD,IAAA,WAAW,GAAG,IAAI,aAAa,EAAE;AACjC,IAAA,aAAa,GAAG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AAA,EAAA,CAAA;;4FAEnG,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAlBpB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,WAAW,EAAA,eAAA,EAGJ,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;;;;AAIJ,wBAAA,sBAAsB,EAAE,uBAAuB;AAC/C,wBAAA,wBAAwB,EAAE,yBAAyB;AACnD,wBAAA,mBAAmB,EAAE,oBAAoB;AACzC,wBAAA,sBAAsB,EAAE,uBAAuB;AAC/C,wBAAA,sBAAsB,EAAE,uBAAuB;AAC/C,wBAAA,oBAAoB,EAAE,qBAAqB;AAC5C,qBAAA,EAAA,OAAA,EACQ,CAAC,WAAW,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,CAAC,EAAA,QAAA,EAAA,usBAAA,EAAA,MAAA,EAAA,CAAA,qoIAAA,CAAA,EAAA;;;AElDjH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"sdcorejs-angular-forms-switch.mjs","sources":["../../../projects/sdcorejs-angular/forms/switch/src/switch.component.ts","../../../projects/sdcorejs-angular/forms/switch/src/switch.component.html","../../../projects/sdcorejs-angular/forms/switch/sdcorejs-angular-forms-switch.ts"],"sourcesContent":["import { Utilities } from '@sdcorejs/utils/fns';\n\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n computed,\n inject,\n input,\n model,\n OnDestroy,\n OnInit,\n output,\n} from '@angular/core';\nimport { FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\nimport { SdLabel } from '@sdcorejs/angular/forms/label';\nimport { I18nService, SdTranslatePipe } from '@sdcorejs/angular/i18n';\nimport {\n SdFormControl,\n sdFormControlState,\n SdViewed,\n SdViewedInput,\n sdViewedInline,\n sdViewedTransform,\n ɵsdFormControlConnector,\n ɵSdFormControlParent,\n} from '@sdcorejs/angular/forms/models';\nimport { sdIsEmpty, sdSerializeDataValue } from '@sdcorejs/angular/utilities/data-state';\nimport { Color } from '@sdcorejs/utils/models';\nimport { Subscription } from 'rxjs';\n\n@Component({\n selector: 'sd-switch',\n templateUrl: './switch.component.html',\n styleUrl: './switch.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n // why: dùng host class .sd-c-<x> (thay vì data-attr) để reactivity host-binding với\n // signal chắc chắn áp dụng + có default fallback `sd-c-primary` khi color() là 'primary'.\n // Test cũ assert data-sd-color đã được thay bằng class assert tương ứng.\n '[class.sd-c-primary]': \"color() === 'primary'\",\n '[class.sd-c-secondary]': \"color() === 'secondary'\",\n '[class.sd-c-info]': \"color() === 'info'\",\n '[class.sd-c-success]': \"color() === 'success'\",\n '[class.sd-c-warning]': \"color() === 'warning'\",\n '[class.sd-c-error]': \"color() === 'error'\",\n },\n imports: [FormsModule, ReactiveFormsModule, MatSlideToggleModule, MatFormFieldModule, SdLabel, SdTranslatePipe],\n})\nexport class SdSwitch implements OnInit, OnDestroy {\n readonly #ref = inject(ChangeDetectorRef);\n readonly #i18n = inject(I18nService);\n\n id = `I${Utilities.generateUuid()}`;\n readonly #defaultName = Utilities.generateUuid();\n formControl = new SdFormControl();\n #subscription = new Subscription();\n\n // Inputs — accept null|undefined at boundary, transform to canonical\n readonly autoIdInput = input<string | undefined, string | null | undefined>(undefined, {\n alias: 'autoId',\n transform: (v): string | undefined => v ?? undefined,\n });\n readonly name = input<string | undefined, string | null | undefined>(undefined, {\n transform: (v): string | undefined => v ?? undefined,\n });\n readonly form = input<ɵSdFormControlParent>(undefined);\n readonly label = input<string | undefined, string | null | undefined>(undefined, {\n transform: (v): string | undefined => v ?? undefined,\n });\n // why: legacy callers pass `null` to mean \"fallback to primary\" — keep that contract\n readonly color = input<Color, Color | null | undefined>('primary', {\n transform: (v): Color => v || 'primary',\n });\n readonly disabled = input(false, { transform: booleanAttribute });\n /** Display mode: `false` edit · `true` static view · `'inline'` interactive (disabled `'inline'` → static). */\n readonly viewed = input<SdViewed, SdViewedInput>(false, { transform: sdViewedTransform });\n\n // why: tri-state viewed — `'inline'` keeps the switch interactive; disabled `'inline'` → static.\n readonly #viewedState = sdViewedInline(this.viewed, undefined, this.disabled);\n /** `true` when the static read-only view should render. */\n readonly isViewed = this.#viewedState.isViewed;\n readonly hideInlineError = input(false, { transform: booleanAttribute });\n readonly required = input(false, { transform: booleanAttribute });\n\n // Two-way model\n readonly model = model<boolean | null | undefined>(false);\n\n // Outputs\n readonly sdChange = output<unknown>();\n\n // Computed (template bindings)\n readonly autoId = computed(() => (this.autoIdInput() ? `forms-switch-${this.autoIdInput()}` : undefined));\n readonly #state = sdFormControlState(computed(() => this.formControl));\n readonly dataDisabled = computed(() => (this.#state().disabled ? 'true' : 'false'));\n readonly dataEmpty = computed(() => (sdIsEmpty(this.#state().value) ? 'true' : 'false'));\n readonly dataValue = computed(() => sdSerializeDataValue(this.#state().value));\n readonly dataRequired = computed(() => (this.required() ? 'true' : 'false'));\n\n // why: `[required]` gắn Validators.required nhưng template TRƯỚC ĐÂY không render bất kỳ\n // message nào, nên switch bắt buộc để OFF chặn submit mà người dùng không thấy lý do —\n // đúng loại bug \"error invalid nhưng message ẩn\". Dùng lại key `core.form.input.required`\n // ('Vui lòng nhập thông tin') vì catalog i18n chưa có key riêng cho switch.\n readonly errorMessage = computed<string | undefined>(() => {\n void this.#state();\n return this.formControl.errors?.['required'] ? this.#i18n.t('core.form.input.required') : undefined;\n });\n\n readonly #formConnector = ɵsdFormControlConnector<boolean | null | undefined, boolean | null | undefined>({\n form: this.form,\n name: computed(() => this.name() || this.#defaultName),\n control: computed(() => this.formControl),\n model: this.model,\n writeModel: value => {\n this.model.set(value);\n this.sdChange.emit(value);\n },\n validators: computed(() => (this.required() ? Validators.required : null)),\n disabled: this.disabled,\n validationError: this.errorMessage,\n controlEquals: (controlValue, modelValue) => (controlValue === null && modelValue === false) || Object.is(controlValue, modelValue),\n });\n\n /** Shared reactive form policy — `validationError` is already interaction-gated (touched/dirty). */\n readonly connectorState = this.#formConnector.state;\n /** Message to render inline; `undefined` while untouched, or when `hideInlineError` is set. */\n readonly visibleErrorMessage = computed(() => (this.hideInlineError() ? undefined : this.connectorState().validationError));\n\n ngOnInit() {\n this.#subscription.add(\n this.formControl.sdChanges.subscribe(() => {\n this.#ref.markForCheck();\n })\n );\n }\n\n ngOnDestroy() {\n this.#subscription.unsubscribe();\n }\n}\n","@if (isViewed()) {\n @if (label()) {\n <div class=\"T14R text-secondary\">{{ label() }}</div>\n }\n <div class=\"T14M\">{{ (model() ? 'core.form.switch.on' : 'core.form.switch.off') | sdTranslate }}</div>\n} @else {\n <mat-slide-toggle\n [formControl]=\"formControl\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-empty]=\"dataEmpty()\"\n [attr.data-value]=\"dataValue()\"\n [attr.data-required]=\"dataRequired()\">\n <sd-label [label]=\"label()\" [required]=\"required()\"></sd-label>\n </mat-slide-toggle>\n @let _errorMessage = visibleErrorMessage();\n @if (_errorMessage) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵsdFormControlConnector"],"mappings":";;;;;;;;;;;;;;;MAoDa,QAAQ,CAAA;AACV,IAAA,IAAI,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAChC,IAAA,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;AAEpC,IAAA,EAAE,GAAG,CAAA,CAAA,EAAI,SAAS,CAAC,YAAY,EAAE,EAAE;AAC1B,IAAA,YAAY,GAAG,SAAS,CAAC,YAAY,EAAE;AAChD,IAAA,WAAW,GAAG,IAAI,aAAa,EAAE;AACjC,IAAA,aAAa,GAAG,IAAI,YAAY,EAAE;;AAGzB,IAAA,WAAW,GAAG,KAAK,CAAgD,SAAS,EAAA,EAA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OAAO,EAAE,eAAe,CAAC,EAAA,QAAA,EAAA,usBAAA,EAAA,MAAA,EAAA,CAAA,qoIAAA,CAAA,EAAA;;;AElDjH;;AAEG;;"}
|
|
@@ -28,10 +28,14 @@ class SdTextarea {
|
|
|
28
28
|
// ==========================================
|
|
29
29
|
// 1. SIGNAL QUERIES
|
|
30
30
|
// ==========================================
|
|
31
|
-
textareaRef = viewChild('textarea',
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
textareaRef = viewChild('textarea', /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "textareaRef" }] : /* istanbul ignore next */ []));
|
|
33
|
+
sdViewDef = contentChild(SdViewDefDirective, /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "sdViewDef" }] : /* istanbul ignore next */ []));
|
|
35
|
+
sdLabelDef = contentChild(SdLabelDefDirective, /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "sdLabelDef" }] : /* istanbul ignore next */ []));
|
|
37
|
+
sdSuffixDef = contentChild(SdSuffixDefDirective, /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "sdSuffixDef" }] : /* istanbul ignore next */ []));
|
|
35
39
|
// ==========================================
|
|
36
40
|
// 2. INJECTS
|
|
37
41
|
// ==========================================
|
|
@@ -45,28 +49,39 @@ class SdTextarea {
|
|
|
45
49
|
// 3. SIGNAL INPUTS & MODEL
|
|
46
50
|
// ==========================================
|
|
47
51
|
autoIdInput = input(undefined, { ...(ngDevMode ? { debugName: "autoIdInput" } : /* istanbul ignore next */ {}), alias: 'autoId' });
|
|
48
|
-
autoId = computed(() => (this.autoIdInput() ? `forms-textarea-${this.autoIdInput()}` : undefined),
|
|
52
|
+
autoId = computed(() => (this.autoIdInput() ? `forms-textarea-${this.autoIdInput()}` : undefined), /* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
49
54
|
#state = sdFormControlState(computed(() => this.formControl));
|
|
50
|
-
dataDisabled = computed(() => (this.#state().disabled ? 'true' : 'false'),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
dataDisabled = computed(() => (this.#state().disabled ? 'true' : 'false'), /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "dataDisabled" }] : /* istanbul ignore next */ []));
|
|
57
|
+
dataInvalid = computed(() => (this.#state().invalid ? 'true' : 'false'), /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "dataInvalid" }] : /* istanbul ignore next */ []));
|
|
59
|
+
dataEmpty = computed(() => (sdIsEmpty(this.#state().value) ? 'true' : 'false'), /* @ts-ignore */
|
|
60
|
+
...(ngDevMode ? [{ debugName: "dataEmpty" }] : /* istanbul ignore next */ []));
|
|
61
|
+
dataValue = computed(() => sdSerializeDataValue(this.#state().value), /* @ts-ignore */
|
|
62
|
+
...(ngDevMode ? [{ debugName: "dataValue" }] : /* istanbul ignore next */ []));
|
|
63
|
+
dataRequired = computed(() => (this.required() ? 'true' : 'false'), /* @ts-ignore */
|
|
64
|
+
...(ngDevMode ? [{ debugName: "dataRequired" }] : /* istanbul ignore next */ []));
|
|
55
65
|
dataMaxLength = computed(() => {
|
|
56
66
|
const v = this.maxlength();
|
|
57
67
|
return v == null ? null : String(v);
|
|
58
|
-
},
|
|
68
|
+
}, /* @ts-ignore */
|
|
69
|
+
...(ngDevMode ? [{ debugName: "dataMaxLength" }] : /* istanbul ignore next */ []));
|
|
59
70
|
dataPattern = computed(() => {
|
|
60
71
|
const v = this.pattern();
|
|
61
72
|
return v == null || v === '' ? null : String(v);
|
|
62
|
-
},
|
|
73
|
+
}, /* @ts-ignore */
|
|
74
|
+
...(ngDevMode ? [{ debugName: "dataPattern" }] : /* istanbul ignore next */ []));
|
|
63
75
|
dataErrorMessage = computed(() => {
|
|
64
76
|
void this.#state();
|
|
65
77
|
const msg = this.errorMessage();
|
|
66
78
|
return msg && msg.length > 0 ? msg : null;
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
|
|
79
|
+
}, /* @ts-ignore */
|
|
80
|
+
...(ngDevMode ? [{ debugName: "dataErrorMessage" }] : /* istanbul ignore next */ []));
|
|
81
|
+
name = input(Utilities.generateUuid(), /* @ts-ignore */
|
|
82
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
83
|
+
size = input('md', /* @ts-ignore */
|
|
84
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
70
85
|
// Ghi (TransformT): any (để không bị lỗi typing khi cha truyền vào)
|
|
71
86
|
form = input(undefined, { ...(ngDevMode ? { debugName: "form" } : /* istanbul ignore next */ {}), transform: (val) => {
|
|
72
87
|
if (!val)
|
|
@@ -85,7 +100,8 @@ class SdTextarea {
|
|
|
85
100
|
label = input(undefined, { ...(ngDevMode ? { debugName: "label" } : /* istanbul ignore next */ {}), transform: (v) => v ?? undefined });
|
|
86
101
|
helperText = input(undefined, { ...(ngDevMode ? { debugName: "helperText" } : /* istanbul ignore next */ {}), transform: (v) => v ?? undefined });
|
|
87
102
|
placeholder = input(undefined, { ...(ngDevMode ? { debugName: "placeholder" } : /* istanbul ignore next */ {}), transform: (v) => v ?? undefined });
|
|
88
|
-
rows = input(5,
|
|
103
|
+
rows = input(5, /* @ts-ignore */
|
|
104
|
+
...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
89
105
|
hideInlineError = input(false, { ...(ngDevMode ? { debugName: "hideInlineError" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
90
106
|
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
91
107
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
@@ -103,7 +119,8 @@ class SdTextarea {
|
|
|
103
119
|
enterInlineEdit = () => this.#viewedState.enterInlineEdit();
|
|
104
120
|
maxlength = input(null, { ...(ngDevMode ? { debugName: "maxlength" } : /* istanbul ignore next */ {}), transform: v => (v != null && NumberUtilities.isPositiveInteger(Number(v)) ? Number(v) : null) });
|
|
105
121
|
pattern = input(undefined, { ...(ngDevMode ? { debugName: "pattern" } : /* istanbul ignore next */ {}), transform: (v) => v ?? undefined });
|
|
106
|
-
validator = input(
|
|
122
|
+
validator = input(/* @ts-ignore */
|
|
123
|
+
...(ngDevMode ? [undefined, { debugName: "validator" }] : /* istanbul ignore next */ []));
|
|
107
124
|
inlineError = input(undefined, { ...(ngDevMode ? { debugName: "inlineError" } : /* istanbul ignore next */ {}), transform: (v) => v ?? undefined });
|
|
108
125
|
/**
|
|
109
126
|
* Tổng hợp error message để hiển thị trong tooltip khi hideInlineError = true.
|
|
@@ -124,10 +141,13 @@ class SdTextarea {
|
|
|
124
141
|
if (errors['inlineError'])
|
|
125
142
|
return this.inlineError();
|
|
126
143
|
return undefined;
|
|
127
|
-
},
|
|
144
|
+
}, /* @ts-ignore */
|
|
145
|
+
...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
128
146
|
appearanceInput = input(undefined, { ...(ngDevMode ? { debugName: "appearanceInput" } : /* istanbul ignore next */ {}), alias: 'appearance' });
|
|
129
|
-
appearance = computed(() => this.appearanceInput() ?? this.#formConfiguration?.appearance ?? 'outline',
|
|
130
|
-
|
|
147
|
+
appearance = computed(() => this.appearanceInput() ?? this.#formConfiguration?.appearance ?? 'outline', /* @ts-ignore */
|
|
148
|
+
...(ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []));
|
|
149
|
+
floatLabel = input('auto', /* @ts-ignore */
|
|
150
|
+
...(ngDevMode ? [{ debugName: "floatLabel" }] : /* istanbul ignore next */ []));
|
|
131
151
|
valueModel = model(undefined, { ...(ngDevMode ? { debugName: "valueModel" } : /* istanbul ignore next */ {}), alias: 'model' });
|
|
132
152
|
// ==========================================
|
|
133
153
|
// 4. SIGNAL OUTPUTS
|
|
@@ -150,14 +170,16 @@ class SdTextarea {
|
|
|
150
170
|
if (this.inlineError())
|
|
151
171
|
validators.push(SdInlineErrorValidator);
|
|
152
172
|
return validators;
|
|
153
|
-
},
|
|
173
|
+
}, /* @ts-ignore */
|
|
174
|
+
...(ngDevMode ? [{ debugName: "#validators" }] : /* istanbul ignore next */ []));
|
|
154
175
|
#asyncValidators = computed(() => {
|
|
155
176
|
const validator = this.validator();
|
|
156
177
|
// why: dùng helper dùng chung thay vì bản copy nội bộ. Bản copy cũ coerce
|
|
157
178
|
// `c.value || null` nên số 0 hợp lệ bị nuốt thành null trước khi tới validator
|
|
158
179
|
// của consumer; HandleSdCustomValidator giữ nguyên 0 (`c.value === 0 ? c.value : ...`).
|
|
159
180
|
return validator ? [HandleSdCustomValidator(validator)] : [];
|
|
160
|
-
},
|
|
181
|
+
}, /* @ts-ignore */
|
|
182
|
+
...(ngDevMode ? [{ debugName: "#asyncValidators" }] : /* istanbul ignore next */ []));
|
|
161
183
|
// why: validator đi qua connector (addValidators/removeValidators — CỘNG DỒN) thay cho
|
|
162
184
|
// clearValidators()+setValidators() cũ. `formControl` là public: consumer hoàn toàn có
|
|
163
185
|
// thể tự gắn validator lên nó, và block cũ xoá sạch mọi validator đó mỗi lần bất kỳ
|
|
@@ -256,10 +278,10 @@ class SdTextarea {
|
|
|
256
278
|
const max = this.maxlength();
|
|
257
279
|
return !!(max && max > 0 && this.getCurrentLength() > max);
|
|
258
280
|
};
|
|
259
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
260
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", 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": "isViewed() || isInline()" } }, 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 _sdLabelDef = sdLabelDef();\r\n@let _helperText = helperText();\r\n@let _required = required();\r\n@let _maxLength = maxlength();\r\n@let _isInline = isInline();\r\n<!-- why: m\u1ED9t c\u1ED5ng gate duy nh\u1EA5t cho <mat-error>, aria-invalid v\u00E0 aria-describedby \u2014 message\r\n hi\u1EC7n m\u00E0 control kh\u00F4ng b\u00E1o invalid th\u00EC screen reader kh\u00F4ng bi\u1EBFt \u00F4 \u0111ang l\u1ED7i. -->\r\n@let _errorVisible = !!_errorMessage && formControl.touched;\r\n@let _showInlineError = !_hideInlineError && _errorVisible;\r\n\r\n@if (isViewed()) {\r\n @if (_sdLabelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"_sdLabelDef!.templateRef\"> </ng-container>\r\n } @else if (_label) {\r\n <div class=\"T14R text-secondary\">{{ _label }}</div>\r\n }\r\n <div class=\"T14M\">{{ formControl.value | sdEmpty }}</div>\r\n} @else {\r\n @if (!_appearance && _sdLabelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"_sdLabelDef!.templateRef\"> </ng-container>\r\n }\r\n @if (!_appearance && _label && !_sdLabelDef?.templateRef) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\r\n }\r\n\r\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout. aria-hidden=\"true\" c\u0169 \u1EA9n C\u1EA2 c\u00E2y con \u2014 label, <textarea>,\r\n <mat-error> \u2014 kh\u1ECFi accessibility tree. role=\"presentation\" ch\u1EC9 v\u00F4 hi\u1EC7u ho\u00E1 ch\u00EDnh div,\r\n KH\u00D4NG lan xu\u1ED1ng con; (click) l\u00E0 ti\u1EC7n \u00EDch chu\u1ED9t m\u00E0 b\u00E0n ph\u00EDm \u0111\u00E3 c\u00F3 qua Tab. -->\r\n <div\r\n class=\"d-flex align-items-center sd-textarea-container\"\r\n role=\"presentation\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\">\r\n <div class=\"sd-textarea-field-wrap\" [class.sd-inline-textarea]=\"_isInline\">\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 class=\"sd-form-field-label\">\r\n <span>{{ _label }}</span>\r\n @if (_helperText) {\r\n <sd-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"above\" name=\"info\"></sd-icon>\r\n }\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 [attr.aria-invalid]=\"_errorVisible ? 'true' : null\"\r\n [attr.aria-describedby]=\"_errorMessage ? errorId : null\"\r\n spellcheck=\"false\"\r\n #textarea>\r\n </textarea>\r\n\r\n @if (_hideInlineError && _errorVisible) {\r\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\r\n @if (_hideInlineError && _errorVisible) {\r\n <span class=\"sd-visually-hidden\" [id]=\"errorId\" matSuffix>{{ _errorMessage }}</span>\r\r\n }\r\n\r\n @if (_showInlineError) {\r\n <mat-error [id]=\"errorId\">{{ _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' | sdTranslate) : null\">\r\n {{ getCurrentLength() }}/{{ _maxLength }}\r\n </div>\r\n }\r\n </div>\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-primary-contrast{color:var(--sd-primary-contrast)!important}.bg-primary-contrast{background:var(--sd-primary-contrast)!important}.border-primary-contrast{border-color:var(--sd-primary-contrast)!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-secondary-contrast{color:var(--sd-secondary-contrast)!important}.bg-secondary-contrast{background:var(--sd-secondary-contrast)!important}.border-secondary-contrast{border-color:var(--sd-secondary-contrast)!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-info-contrast{color:var(--sd-info-contrast)!important}.bg-info-contrast{background:var(--sd-info-contrast)!important}.border-info-contrast{border-color:var(--sd-info-contrast)!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-success-contrast{color:var(--sd-success-contrast)!important}.bg-success-contrast{background:var(--sd-success-contrast)!important}.border-success-contrast{border-color:var(--sd-success-contrast)!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-warning-contrast{color:var(--sd-warning-contrast)!important}.bg-warning-contrast{background:var(--sd-warning-contrast)!important}.border-warning-contrast{border-color:var(--sd-warning-contrast)!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-error-contrast{color:var(--sd-error-contrast)!important}.bg-error-contrast{background:var(--sd-error-contrast)!important}.border-error-contrast{border-color:var(--sd-error-contrast)!important}.text-surface{color:var(--sd-surface)!important}.bg-surface{background:var(--sd-surface)!important}.border-surface{border-color:var(--sd-surface)!important}.text-surface-muted{color:var(--sd-surface-muted)!important}.bg-surface-muted{background:var(--sd-surface-muted)!important}.border-surface-muted{border-color:var(--sd-surface-muted)!important}.text-text{color:var(--sd-text)!important}.bg-text{background:var(--sd-text)!important}.border-text{border-color:var(--sd-text)!important}.text-text-secondary{color:var(--sd-text-secondary)!important}.bg-text-secondary{background:var(--sd-text-secondary)!important}.border-text-secondary{border-color:var(--sd-text-secondary)!important}.text-text-muted{color:var(--sd-text-muted)!important}.bg-text-muted{background:var(--sd-text-muted)!important}.border-text-muted{border-color:var(--sd-text-muted)!important}.text-border{color:var(--sd-border)!important}.bg-border{background:var(--sd-border)!important}.border-border{border-color:var(--sd-border)!important}.text-border-strong{color:var(--sd-border-strong)!important}.bg-border-strong{background:var(--sd-border-strong)!important}.border-border-strong{border-color:var(--sd-border-strong)!important}.text-disabled-bg{color:var(--sd-disabled-bg)!important}.bg-disabled-bg{background:var(--sd-disabled-bg)!important}.border-disabled-bg{border-color:var(--sd-disabled-bg)!important}.text-disabled-text{color:var(--sd-disabled-text)!important}.bg-disabled-text{background:var(--sd-disabled-text)!important}.border-disabled-text{border-color:var(--sd-disabled-text)!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}.text-secondary{color:var(--sd-text-secondary)!important}.text-muted{color:var(--sd-text-muted)!important}.text-body{color:var(--sd-text)!important}.bg-muted{background:var(--sd-surface-muted)!important}.sd-inline-textarea{cursor:text;border-radius:4px;background-color:#0000000a;transition:background-color .15s ease}.sd-inline-textarea:hover{background-color:#00000014}.sd-inline-textarea:focus-within{background-color:#0000000f;box-shadow:inset 0 0 0 1px var(--sd-primary, #1f6feb)}.sd-inline-textarea ::ng-deep .mat-mdc-text-field-wrapper{padding:0 6px;background:transparent}.sd-inline-textarea ::ng-deep .mat-mdc-form-field-flex{padding:0}.sd-inline-textarea ::ng-deep .mdc-notched-outline{display:none}.sd-inline-textarea ::ng-deep .mat-mdc-form-field-subscript-wrapper{display:none}.sd-inline-textarea ::ng-deep .mat-mdc-form-field-infix{padding:4px 0;min-height:0;border:0}: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-disabled-bg)}:host ::ng-deep .mat-mdc-form-field textarea.mat-mdc-input-element:disabled{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.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: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { 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: MatTooltipModule }, { kind: "directive", type: i5.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: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
281
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTextarea, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
282
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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": "isViewed() || isInline()" } }, 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();\n@let _appearance = appearance();\n@let _hideInlineError = hideInlineError();\n@let _errorMessage = errorMessage();\n@let _sdLabelDef = sdLabelDef();\n@let _helperText = helperText();\n@let _required = required();\n@let _maxLength = maxlength();\n@let _isInline = isInline();\n<!-- why: m\u1ED9t c\u1ED5ng gate duy nh\u1EA5t cho <mat-error>, aria-invalid v\u00E0 aria-describedby \u2014 message\n hi\u1EC7n m\u00E0 control kh\u00F4ng b\u00E1o invalid th\u00EC screen reader kh\u00F4ng bi\u1EBFt \u00F4 \u0111ang l\u1ED7i. -->\n@let _errorVisible = !!_errorMessage && formControl.touched;\n@let _showInlineError = !_hideInlineError && _errorVisible;\n\n@if (isViewed()) {\n @if (_sdLabelDef?.templateRef) {\n <ng-container *ngTemplateOutlet=\"_sdLabelDef!.templateRef\"> </ng-container>\n } @else if (_label) {\n <div class=\"T14R text-secondary\">{{ _label }}</div>\n }\n <div class=\"T14M\">{{ formControl.value | sdEmpty }}</div>\n} @else {\n @if (!_appearance && _sdLabelDef?.templateRef) {\n <ng-container *ngTemplateOutlet=\"_sdLabelDef!.templateRef\"> </ng-container>\n }\n @if (!_appearance && _label && !_sdLabelDef?.templateRef) {\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\n }\n\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout. aria-hidden=\"true\" c\u0169 \u1EA9n C\u1EA2 c\u00E2y con \u2014 label, <textarea>,\n <mat-error> \u2014 kh\u1ECFi accessibility tree. role=\"presentation\" ch\u1EC9 v\u00F4 hi\u1EC7u ho\u00E1 ch\u00EDnh div,\n KH\u00D4NG lan xu\u1ED1ng con; (click) l\u00E0 ti\u1EC7n \u00EDch chu\u1ED9t m\u00E0 b\u00E0n ph\u00EDm \u0111\u00E3 c\u00F3 qua Tab. -->\n <div\n class=\"d-flex align-items-center sd-textarea-container\"\n role=\"presentation\"\n [class.c-focused]=\"isFocused\"\n [class.c-disabled]=\"formControl.disabled\"\n (click)=\"onClick()\">\n <div class=\"sd-textarea-field-wrap\" [class.sd-inline-textarea]=\"_isInline\">\n <mat-form-field\n [class.sd-md]=\"size() === 'md'\"\n [class.sd-sm]=\"size() === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [appearance]=\"_appearance!\"\n [floatLabel]=\"floatLabel()\">\n @if (_appearance && _label) {\n <mat-label class=\"sd-form-field-label\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <sd-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"above\" name=\"info\"></sd-icon>\n }\n </mat-label>\n }\n\n <textarea\n matInput\n [placeholder]=\"placeholder() || _label || ''\"\n [formControl]=\"formControl\"\n [required]=\"_required\"\n autocomplete=\"off\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n [rows]=\"rows()\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-invalid]=\"dataInvalid()\"\n [attr.data-empty]=\"dataEmpty()\"\n [attr.data-value]=\"dataValue()\"\n [attr.data-required]=\"dataRequired()\"\n [attr.data-maxlength]=\"dataMaxLength()\"\n [attr.data-pattern]=\"dataPattern()\"\n [attr.data-error-message]=\"dataErrorMessage()\"\n [attr.aria-invalid]=\"_errorVisible ? 'true' : null\"\n [attr.aria-describedby]=\"_errorMessage ? errorId : null\"\n spellcheck=\"false\"\n #textarea>\n </textarea>\n\n @if (_hideInlineError && _errorVisible) {\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\n @if (_hideInlineError && _errorVisible) {\n <span class=\"sd-visually-hidden\" [id]=\"errorId\" matSuffix>{{ _errorMessage }}</span>\n\n }\n\n @if (_showInlineError) {\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\n }\n\n @if (sdSuffixDef()?.templateRef; as suffixRef) {\n <ng-container matSuffix>\n <ng-container *ngTemplateOutlet=\"suffixRef\"></ng-container>\n </ng-container>\n }\n <!-- <ng-container matSuffix>\n <ng-content select=\"[sdSuffix]\"></ng-content>\n </ng-container> -->\n </mat-form-field>\n\n @if (_maxLength !== null && !_hideInlineError && !formControl.disabled) {\n <div\n class=\"sd-maxlength-counter\"\n [class.sd-maxlength-counter--visible]=\"isFocused\"\n [class.sd-maxlength-counter--exceeded]=\"isMaxlengthExceeded()\"\n [attr.title]=\"isMaxlengthExceeded() ? ('core.form.textarea.exceeded' | sdTranslate) : null\">\n {{ getCurrentLength() }}/{{ _maxLength }}\n </div>\n }\n </div>\n </div>\n}\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-primary-contrast{color:var(--sd-primary-contrast)!important}.bg-primary-contrast{background:var(--sd-primary-contrast)!important}.border-primary-contrast{border-color:var(--sd-primary-contrast)!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-secondary-contrast{color:var(--sd-secondary-contrast)!important}.bg-secondary-contrast{background:var(--sd-secondary-contrast)!important}.border-secondary-contrast{border-color:var(--sd-secondary-contrast)!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-info-contrast{color:var(--sd-info-contrast)!important}.bg-info-contrast{background:var(--sd-info-contrast)!important}.border-info-contrast{border-color:var(--sd-info-contrast)!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-success-contrast{color:var(--sd-success-contrast)!important}.bg-success-contrast{background:var(--sd-success-contrast)!important}.border-success-contrast{border-color:var(--sd-success-contrast)!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-warning-contrast{color:var(--sd-warning-contrast)!important}.bg-warning-contrast{background:var(--sd-warning-contrast)!important}.border-warning-contrast{border-color:var(--sd-warning-contrast)!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-error-contrast{color:var(--sd-error-contrast)!important}.bg-error-contrast{background:var(--sd-error-contrast)!important}.border-error-contrast{border-color:var(--sd-error-contrast)!important}.text-surface{color:var(--sd-surface)!important}.bg-surface{background:var(--sd-surface)!important}.border-surface{border-color:var(--sd-surface)!important}.text-surface-muted{color:var(--sd-surface-muted)!important}.bg-surface-muted{background:var(--sd-surface-muted)!important}.border-surface-muted{border-color:var(--sd-surface-muted)!important}.text-text{color:var(--sd-text)!important}.bg-text{background:var(--sd-text)!important}.border-text{border-color:var(--sd-text)!important}.text-text-secondary{color:var(--sd-text-secondary)!important}.bg-text-secondary{background:var(--sd-text-secondary)!important}.border-text-secondary{border-color:var(--sd-text-secondary)!important}.text-text-muted{color:var(--sd-text-muted)!important}.bg-text-muted{background:var(--sd-text-muted)!important}.border-text-muted{border-color:var(--sd-text-muted)!important}.text-border{color:var(--sd-border)!important}.bg-border{background:var(--sd-border)!important}.border-border{border-color:var(--sd-border)!important}.text-border-strong{color:var(--sd-border-strong)!important}.bg-border-strong{background:var(--sd-border-strong)!important}.border-border-strong{border-color:var(--sd-border-strong)!important}.text-disabled-bg{color:var(--sd-disabled-bg)!important}.bg-disabled-bg{background:var(--sd-disabled-bg)!important}.border-disabled-bg{border-color:var(--sd-disabled-bg)!important}.text-disabled-text{color:var(--sd-disabled-text)!important}.bg-disabled-text{background:var(--sd-disabled-text)!important}.border-disabled-text{border-color:var(--sd-disabled-text)!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}.text-secondary{color:var(--sd-text-secondary)!important}.text-muted{color:var(--sd-text-muted)!important}.text-body{color:var(--sd-text)!important}.bg-muted{background:var(--sd-surface-muted)!important}.sd-inline-textarea{cursor:text;border-radius:4px;background-color:#0000000a;transition:background-color .15s ease}.sd-inline-textarea:hover{background-color:#00000014}.sd-inline-textarea:focus-within{background-color:#0000000f;box-shadow:inset 0 0 0 1px var(--sd-primary, #1f6feb)}.sd-inline-textarea ::ng-deep .mat-mdc-text-field-wrapper{padding:0 6px;background:transparent}.sd-inline-textarea ::ng-deep .mat-mdc-form-field-flex{padding:0}.sd-inline-textarea ::ng-deep .mdc-notched-outline{display:none}.sd-inline-textarea ::ng-deep .mat-mdc-form-field-subscript-wrapper{display:none}.sd-inline-textarea ::ng-deep .mat-mdc-form-field-infix{padding:4px 0;min-height:0;border:0}: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-disabled-bg)}:host ::ng-deep .mat-mdc-form-field textarea.mat-mdc-input-element:disabled{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.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: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { 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]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[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: MatTooltipModule }, { kind: "directive", type: i5.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: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
261
283
|
}
|
|
262
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
284
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTextarea, decorators: [{
|
|
263
285
|
type: Component,
|
|
264
286
|
args: [{ selector: 'sd-textarea', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, host: { '[class.sd-has-label]': '!!label()', '[class.sd-viewed]': 'isViewed() || isInline()' }, imports: [
|
|
265
287
|
SdIcon,
|
|
@@ -272,7 +294,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
272
294
|
SdLabel,
|
|
273
295
|
SdEmptyPipe,
|
|
274
296
|
SdTranslatePipe,
|
|
275
|
-
], template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _hideInlineError = hideInlineError();\r\n@let _errorMessage = errorMessage();\r\n@let _sdLabelDef = sdLabelDef();\r\n@let _helperText = helperText();\r\n@let _required = required();\r\n@let _maxLength = maxlength();\r\n@let _isInline = isInline();\r\n<!-- why: m\u1ED9t c\u1ED5ng gate duy nh\u1EA5t cho <mat-error>, aria-invalid v\u00E0 aria-describedby \u2014 message\r\n hi\u1EC7n m\u00E0 control kh\u00F4ng b\u00E1o invalid th\u00EC screen reader kh\u00F4ng bi\u1EBFt \u00F4 \u0111ang l\u1ED7i. -->\r\n@let _errorVisible = !!_errorMessage && formControl.touched;\r\n@let _showInlineError = !_hideInlineError && _errorVisible;\r\n\r\n@if (isViewed()) {\r\n @if (_sdLabelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"_sdLabelDef!.templateRef\"> </ng-container>\r\n } @else if (_label) {\r\n <div class=\"T14R text-secondary\">{{ _label }}</div>\r\n }\r\n <div class=\"T14M\">{{ formControl.value | sdEmpty }}</div>\r\n} @else {\r\n @if (!_appearance && _sdLabelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"_sdLabelDef!.templateRef\"> </ng-container>\r\n }\r\n @if (!_appearance && _label && !_sdLabelDef?.templateRef) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\r\n }\r\n\r\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout. aria-hidden=\"true\" c\u0169 \u1EA9n C\u1EA2 c\u00E2y con \u2014 label, <textarea>,\r\n <mat-error> \u2014 kh\u1ECFi accessibility tree. role=\"presentation\" ch\u1EC9 v\u00F4 hi\u1EC7u ho\u00E1 ch\u00EDnh div,\r\n KH\u00D4NG lan xu\u1ED1ng con; (click) l\u00E0 ti\u1EC7n \u00EDch chu\u1ED9t m\u00E0 b\u00E0n ph\u00EDm \u0111\u00E3 c\u00F3 qua Tab. -->\r\n <div\r\n class=\"d-flex align-items-center sd-textarea-container\"\r\n role=\"presentation\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\">\r\n <div class=\"sd-textarea-field-wrap\" [class.sd-inline-textarea]=\"_isInline\">\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 class=\"sd-form-field-label\">\r\n <span>{{ _label }}</span>\r\n @if (_helperText) {\r\n <sd-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"above\" name=\"info\"></sd-icon>\r\n }\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 [attr.aria-invalid]=\"_errorVisible ? 'true' : null\"\r\n [attr.aria-describedby]=\"_errorMessage ? errorId : null\"\r\n spellcheck=\"false\"\r\n #textarea>\r\n </textarea>\r\n\r\n @if (_hideInlineError && _errorVisible) {\r\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\r\n @if (_hideInlineError && _errorVisible) {\r\n <span class=\"sd-visually-hidden\" [id]=\"errorId\" matSuffix>{{ _errorMessage }}</span>\r\r\n }\r\n\r\n @if (_showInlineError) {\r\n <mat-error [id]=\"errorId\">{{ _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' | sdTranslate) : null\">\r\n {{ getCurrentLength() }}/{{ _maxLength }}\r\n </div>\r\n }\r\n </div>\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-primary-contrast{color:var(--sd-primary-contrast)!important}.bg-primary-contrast{background:var(--sd-primary-contrast)!important}.border-primary-contrast{border-color:var(--sd-primary-contrast)!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-secondary-contrast{color:var(--sd-secondary-contrast)!important}.bg-secondary-contrast{background:var(--sd-secondary-contrast)!important}.border-secondary-contrast{border-color:var(--sd-secondary-contrast)!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-info-contrast{color:var(--sd-info-contrast)!important}.bg-info-contrast{background:var(--sd-info-contrast)!important}.border-info-contrast{border-color:var(--sd-info-contrast)!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-success-contrast{color:var(--sd-success-contrast)!important}.bg-success-contrast{background:var(--sd-success-contrast)!important}.border-success-contrast{border-color:var(--sd-success-contrast)!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-warning-contrast{color:var(--sd-warning-contrast)!important}.bg-warning-contrast{background:var(--sd-warning-contrast)!important}.border-warning-contrast{border-color:var(--sd-warning-contrast)!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-error-contrast{color:var(--sd-error-contrast)!important}.bg-error-contrast{background:var(--sd-error-contrast)!important}.border-error-contrast{border-color:var(--sd-error-contrast)!important}.text-surface{color:var(--sd-surface)!important}.bg-surface{background:var(--sd-surface)!important}.border-surface{border-color:var(--sd-surface)!important}.text-surface-muted{color:var(--sd-surface-muted)!important}.bg-surface-muted{background:var(--sd-surface-muted)!important}.border-surface-muted{border-color:var(--sd-surface-muted)!important}.text-text{color:var(--sd-text)!important}.bg-text{background:var(--sd-text)!important}.border-text{border-color:var(--sd-text)!important}.text-text-secondary{color:var(--sd-text-secondary)!important}.bg-text-secondary{background:var(--sd-text-secondary)!important}.border-text-secondary{border-color:var(--sd-text-secondary)!important}.text-text-muted{color:var(--sd-text-muted)!important}.bg-text-muted{background:var(--sd-text-muted)!important}.border-text-muted{border-color:var(--sd-text-muted)!important}.text-border{color:var(--sd-border)!important}.bg-border{background:var(--sd-border)!important}.border-border{border-color:var(--sd-border)!important}.text-border-strong{color:var(--sd-border-strong)!important}.bg-border-strong{background:var(--sd-border-strong)!important}.border-border-strong{border-color:var(--sd-border-strong)!important}.text-disabled-bg{color:var(--sd-disabled-bg)!important}.bg-disabled-bg{background:var(--sd-disabled-bg)!important}.border-disabled-bg{border-color:var(--sd-disabled-bg)!important}.text-disabled-text{color:var(--sd-disabled-text)!important}.bg-disabled-text{background:var(--sd-disabled-text)!important}.border-disabled-text{border-color:var(--sd-disabled-text)!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}.text-secondary{color:var(--sd-text-secondary)!important}.text-muted{color:var(--sd-text-muted)!important}.text-body{color:var(--sd-text)!important}.bg-muted{background:var(--sd-surface-muted)!important}.sd-inline-textarea{cursor:text;border-radius:4px;background-color:#0000000a;transition:background-color .15s ease}.sd-inline-textarea:hover{background-color:#00000014}.sd-inline-textarea:focus-within{background-color:#0000000f;box-shadow:inset 0 0 0 1px var(--sd-primary, #1f6feb)}.sd-inline-textarea ::ng-deep .mat-mdc-text-field-wrapper{padding:0 6px;background:transparent}.sd-inline-textarea ::ng-deep .mat-mdc-form-field-flex{padding:0}.sd-inline-textarea ::ng-deep .mdc-notched-outline{display:none}.sd-inline-textarea ::ng-deep .mat-mdc-form-field-subscript-wrapper{display:none}.sd-inline-textarea ::ng-deep .mat-mdc-form-field-infix{padding:4px 0;min-height:0;border:0}: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-disabled-bg)}:host ::ng-deep .mat-mdc-form-field textarea.mat-mdc-input-element:disabled{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.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"] }]
|
|
297
|
+
], template: "@let _label = label();\n@let _appearance = appearance();\n@let _hideInlineError = hideInlineError();\n@let _errorMessage = errorMessage();\n@let _sdLabelDef = sdLabelDef();\n@let _helperText = helperText();\n@let _required = required();\n@let _maxLength = maxlength();\n@let _isInline = isInline();\n<!-- why: m\u1ED9t c\u1ED5ng gate duy nh\u1EA5t cho <mat-error>, aria-invalid v\u00E0 aria-describedby \u2014 message\n hi\u1EC7n m\u00E0 control kh\u00F4ng b\u00E1o invalid th\u00EC screen reader kh\u00F4ng bi\u1EBFt \u00F4 \u0111ang l\u1ED7i. -->\n@let _errorVisible = !!_errorMessage && formControl.touched;\n@let _showInlineError = !_hideInlineError && _errorVisible;\n\n@if (isViewed()) {\n @if (_sdLabelDef?.templateRef) {\n <ng-container *ngTemplateOutlet=\"_sdLabelDef!.templateRef\"> </ng-container>\n } @else if (_label) {\n <div class=\"T14R text-secondary\">{{ _label }}</div>\n }\n <div class=\"T14M\">{{ formControl.value | sdEmpty }}</div>\n} @else {\n @if (!_appearance && _sdLabelDef?.templateRef) {\n <ng-container *ngTemplateOutlet=\"_sdLabelDef!.templateRef\"> </ng-container>\n }\n @if (!_appearance && _label && !_sdLabelDef?.templateRef) {\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\n }\n\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout. aria-hidden=\"true\" c\u0169 \u1EA9n C\u1EA2 c\u00E2y con \u2014 label, <textarea>,\n <mat-error> \u2014 kh\u1ECFi accessibility tree. role=\"presentation\" ch\u1EC9 v\u00F4 hi\u1EC7u ho\u00E1 ch\u00EDnh div,\n KH\u00D4NG lan xu\u1ED1ng con; (click) l\u00E0 ti\u1EC7n \u00EDch chu\u1ED9t m\u00E0 b\u00E0n ph\u00EDm \u0111\u00E3 c\u00F3 qua Tab. -->\n <div\n class=\"d-flex align-items-center sd-textarea-container\"\n role=\"presentation\"\n [class.c-focused]=\"isFocused\"\n [class.c-disabled]=\"formControl.disabled\"\n (click)=\"onClick()\">\n <div class=\"sd-textarea-field-wrap\" [class.sd-inline-textarea]=\"_isInline\">\n <mat-form-field\n [class.sd-md]=\"size() === 'md'\"\n [class.sd-sm]=\"size() === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [appearance]=\"_appearance!\"\n [floatLabel]=\"floatLabel()\">\n @if (_appearance && _label) {\n <mat-label class=\"sd-form-field-label\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <sd-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"above\" name=\"info\"></sd-icon>\n }\n </mat-label>\n }\n\n <textarea\n matInput\n [placeholder]=\"placeholder() || _label || ''\"\n [formControl]=\"formControl\"\n [required]=\"_required\"\n autocomplete=\"off\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n [rows]=\"rows()\"\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-invalid]=\"dataInvalid()\"\n [attr.data-empty]=\"dataEmpty()\"\n [attr.data-value]=\"dataValue()\"\n [attr.data-required]=\"dataRequired()\"\n [attr.data-maxlength]=\"dataMaxLength()\"\n [attr.data-pattern]=\"dataPattern()\"\n [attr.data-error-message]=\"dataErrorMessage()\"\n [attr.aria-invalid]=\"_errorVisible ? 'true' : null\"\n [attr.aria-describedby]=\"_errorMessage ? errorId : null\"\n spellcheck=\"false\"\n #textarea>\n </textarea>\n\n @if (_hideInlineError && _errorVisible) {\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\n @if (_hideInlineError && _errorVisible) {\n <span class=\"sd-visually-hidden\" [id]=\"errorId\" matSuffix>{{ _errorMessage }}</span>\n\n }\n\n @if (_showInlineError) {\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\n }\n\n @if (sdSuffixDef()?.templateRef; as suffixRef) {\n <ng-container matSuffix>\n <ng-container *ngTemplateOutlet=\"suffixRef\"></ng-container>\n </ng-container>\n }\n <!-- <ng-container matSuffix>\n <ng-content select=\"[sdSuffix]\"></ng-content>\n </ng-container> -->\n </mat-form-field>\n\n @if (_maxLength !== null && !_hideInlineError && !formControl.disabled) {\n <div\n class=\"sd-maxlength-counter\"\n [class.sd-maxlength-counter--visible]=\"isFocused\"\n [class.sd-maxlength-counter--exceeded]=\"isMaxlengthExceeded()\"\n [attr.title]=\"isMaxlengthExceeded() ? ('core.form.textarea.exceeded' | sdTranslate) : null\">\n {{ getCurrentLength() }}/{{ _maxLength }}\n </div>\n }\n </div>\n </div>\n}\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-primary-contrast{color:var(--sd-primary-contrast)!important}.bg-primary-contrast{background:var(--sd-primary-contrast)!important}.border-primary-contrast{border-color:var(--sd-primary-contrast)!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-secondary-contrast{color:var(--sd-secondary-contrast)!important}.bg-secondary-contrast{background:var(--sd-secondary-contrast)!important}.border-secondary-contrast{border-color:var(--sd-secondary-contrast)!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-info-contrast{color:var(--sd-info-contrast)!important}.bg-info-contrast{background:var(--sd-info-contrast)!important}.border-info-contrast{border-color:var(--sd-info-contrast)!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-success-contrast{color:var(--sd-success-contrast)!important}.bg-success-contrast{background:var(--sd-success-contrast)!important}.border-success-contrast{border-color:var(--sd-success-contrast)!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-warning-contrast{color:var(--sd-warning-contrast)!important}.bg-warning-contrast{background:var(--sd-warning-contrast)!important}.border-warning-contrast{border-color:var(--sd-warning-contrast)!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-error-contrast{color:var(--sd-error-contrast)!important}.bg-error-contrast{background:var(--sd-error-contrast)!important}.border-error-contrast{border-color:var(--sd-error-contrast)!important}.text-surface{color:var(--sd-surface)!important}.bg-surface{background:var(--sd-surface)!important}.border-surface{border-color:var(--sd-surface)!important}.text-surface-muted{color:var(--sd-surface-muted)!important}.bg-surface-muted{background:var(--sd-surface-muted)!important}.border-surface-muted{border-color:var(--sd-surface-muted)!important}.text-text{color:var(--sd-text)!important}.bg-text{background:var(--sd-text)!important}.border-text{border-color:var(--sd-text)!important}.text-text-secondary{color:var(--sd-text-secondary)!important}.bg-text-secondary{background:var(--sd-text-secondary)!important}.border-text-secondary{border-color:var(--sd-text-secondary)!important}.text-text-muted{color:var(--sd-text-muted)!important}.bg-text-muted{background:var(--sd-text-muted)!important}.border-text-muted{border-color:var(--sd-text-muted)!important}.text-border{color:var(--sd-border)!important}.bg-border{background:var(--sd-border)!important}.border-border{border-color:var(--sd-border)!important}.text-border-strong{color:var(--sd-border-strong)!important}.bg-border-strong{background:var(--sd-border-strong)!important}.border-border-strong{border-color:var(--sd-border-strong)!important}.text-disabled-bg{color:var(--sd-disabled-bg)!important}.bg-disabled-bg{background:var(--sd-disabled-bg)!important}.border-disabled-bg{border-color:var(--sd-disabled-bg)!important}.text-disabled-text{color:var(--sd-disabled-text)!important}.bg-disabled-text{background:var(--sd-disabled-text)!important}.border-disabled-text{border-color:var(--sd-disabled-text)!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}.text-secondary{color:var(--sd-text-secondary)!important}.text-muted{color:var(--sd-text-muted)!important}.text-body{color:var(--sd-text)!important}.bg-muted{background:var(--sd-surface-muted)!important}.sd-inline-textarea{cursor:text;border-radius:4px;background-color:#0000000a;transition:background-color .15s ease}.sd-inline-textarea:hover{background-color:#00000014}.sd-inline-textarea:focus-within{background-color:#0000000f;box-shadow:inset 0 0 0 1px var(--sd-primary, #1f6feb)}.sd-inline-textarea ::ng-deep .mat-mdc-text-field-wrapper{padding:0 6px;background:transparent}.sd-inline-textarea ::ng-deep .mat-mdc-form-field-flex{padding:0}.sd-inline-textarea ::ng-deep .mdc-notched-outline{display:none}.sd-inline-textarea ::ng-deep .mat-mdc-form-field-subscript-wrapper{display:none}.sd-inline-textarea ::ng-deep .mat-mdc-form-field-infix{padding:4px 0;min-height:0;border:0}: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-disabled-bg)}:host ::ng-deep .mat-mdc-form-field textarea.mat-mdc-input-element:disabled{color:var(--sd-disabled-text)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.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"] }]
|
|
276
298
|
}], ctorParameters: () => [], propDecorators: { textareaRef: [{ type: i0.ViewChild, args: ['textarea', { isSignal: true }] }], sdViewDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdViewDefDirective), { isSignal: true }] }], sdLabelDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdLabelDefDirective), { isSignal: true }] }], sdSuffixDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdSuffixDefDirective), { isSignal: true }] }], autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], helperText: [{ type: i0.Input, args: [{ isSignal: true, alias: "helperText", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], hideInlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideInlineError", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], viewed: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewed", required: false }] }], autoHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoHeight", required: false }] }], maxlength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxlength", required: false }] }], pattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "pattern", required: false }] }], validator: [{ type: i0.Input, args: [{ isSignal: true, alias: "validator", required: false }] }], inlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "inlineError", required: false }] }], appearanceInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], floatLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "floatLabel", required: false }] }], valueModel: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }, { type: i0.Output, args: ["modelChange"] }], sdChange: [{ type: i0.Output, args: ["sdChange"] }] } });
|
|
277
299
|
|
|
278
300
|
/**
|