@sd-angular/core 19.0.0-beta.4 → 19.0.0-beta.40
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/scss/ckeditor5.scss +60 -2
- package/assets/scss/core/bootstrap.scss +17 -0
- package/assets/scss/core/grid.scss +40 -0
- package/assets/scss/sd-core.scss +1 -0
- package/components/avatar/index.d.ts +1 -0
- package/components/avatar/src/avatar.component.d.ts +15 -0
- package/components/badge/src/badge.component.d.ts +77 -19
- package/components/button/src/button.component.d.ts +26 -28
- package/components/document-builder/index.d.ts +1 -0
- package/components/document-builder/src/document-builder.component.d.ts +20 -37
- package/components/document-builder/src/document-builder.model.d.ts +11 -10
- package/components/document-builder/src/plugins/block-space/block-space.plugin.d.ts +9 -0
- package/components/document-builder/src/plugins/ck-comment/ck-comment.plugin.d.ts +43 -0
- package/components/document-builder/src/plugins/ck-comment/ck-comment.plugin.model.d.ts +50 -0
- package/components/document-builder/src/plugins/heading/heading.plugin.d.ts +5 -0
- package/components/document-builder/src/plugins/highlight-range/highlight-range.plugin.d.ts +4 -0
- package/components/document-builder/src/plugins/image-custom/image-custom.plugin.d.ts +31 -0
- package/components/document-builder/src/plugins/{image-upload.plugin.d.ts → image-upload/image-upload.plugin.d.ts} +0 -4
- package/components/document-builder/src/plugins/index.d.ts +11 -5
- package/components/document-builder/src/plugins/{page-orientation.plugin.d.ts → page-orientation/page-orientation.plugin.d.ts} +2 -2
- package/components/document-builder/src/plugins/paste-handler/filters/bookmark.d.ts +14 -0
- package/components/document-builder/src/plugins/paste-handler/filters/br.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/image.d.ts +25 -0
- package/components/document-builder/src/plugins/paste-handler/filters/list.d.ts +29 -0
- package/components/document-builder/src/plugins/paste-handler/filters/parse.d.ts +35 -0
- package/components/document-builder/src/plugins/paste-handler/filters/removeboldwrapper.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/removegooglesheetstag.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/removeinvalidtablewidth.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/removemsattributes.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/removestyleblock.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/removexmlns.d.ts +15 -0
- package/components/document-builder/src/plugins/paste-handler/filters/replacemsfootnotes.d.ts +54 -0
- package/components/document-builder/src/plugins/paste-handler/filters/replacetabswithinprewithspaces.d.ts +24 -0
- package/components/document-builder/src/plugins/paste-handler/filters/space.d.ts +27 -0
- package/components/document-builder/src/plugins/paste-handler/filters/table.d.ts +16 -0
- package/components/document-builder/src/plugins/paste-handler/filters/utils.d.ts +25 -0
- package/components/document-builder/src/plugins/paste-handler/index.d.ts +35 -0
- package/components/document-builder/src/plugins/paste-handler/normalizers/googledocsnormalizer.d.ts +31 -0
- package/components/document-builder/src/plugins/paste-handler/normalizers/googlesheetsnormalizer.d.ts +31 -0
- package/components/document-builder/src/plugins/paste-handler/normalizers/mswordnormalizer.d.ts +29 -0
- package/components/document-builder/src/plugins/paste-handler/types.d.ts +30 -0
- package/components/document-builder/src/plugins/table-custom/index.d.ts +34 -0
- package/components/index.d.ts +3 -0
- package/components/mini-editor/index.d.ts +2 -0
- package/components/mini-editor/src/mini-editor.component.d.ts +90 -0
- package/components/mini-editor/src/mini-editor.model.d.ts +42 -0
- package/components/side-drawer/src/side-drawer.component.d.ts +1 -2
- package/components/table/src/components/selector-action/action-filter.pipe.d.ts +11 -10
- package/components/table/src/directives/index.d.ts +2 -0
- package/components/table/src/directives/sd-table-column-filter-def.directive.d.ts +9 -0
- package/components/table/src/directives/sticky-shadow.directive.d.ts +17 -0
- package/components/table/src/models/table-column.model.d.ts +32 -32
- package/components/table/src/models/table-command.model.d.ts +7 -3
- package/components/table/src/models/table-item.model.d.ts +5 -3
- package/components/table/src/models/table-option-export.model.d.ts +3 -2
- package/components/table/src/models/table-option-selector.model.d.ts +11 -10
- package/components/table/src/models/table-option.model.d.ts +10 -8
- package/components/table/src/services/table-filter/table-filter.model.d.ts +2 -2
- package/components/table/src/table.component.d.ts +33 -35
- package/components/view/index.d.ts +1 -0
- package/components/view/src/view.component.d.ts +16 -0
- package/components/workflow/src/models/index.d.ts +1 -0
- package/directives/index.d.ts +1 -0
- package/directives/src/sd-href.directive.d.ts +9 -0
- package/fesm2022/sd-angular-core-components-avatar.mjs +90 -0
- package/fesm2022/sd-angular-core-components-avatar.mjs.map +1 -0
- package/fesm2022/sd-angular-core-components-badge.mjs +102 -91
- package/fesm2022/sd-angular-core-components-badge.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-button.mjs +64 -96
- package/fesm2022/sd-angular-core-components-button.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-document-builder.mjs +3860 -963
- package/fesm2022/sd-angular-core-components-document-builder.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-history.mjs +1 -1
- package/fesm2022/sd-angular-core-components-history.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-import-excel.mjs +1 -1
- package/fesm2022/sd-angular-core-components-import-excel.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-mini-editor.mjs +326 -0
- package/fesm2022/sd-angular-core-components-mini-editor.mjs.map +1 -0
- package/fesm2022/sd-angular-core-components-preview.mjs +1 -1
- package/fesm2022/sd-angular-core-components-preview.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-side-drawer.mjs +21 -8
- package/fesm2022/sd-angular-core-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-tab-router.mjs +1 -1
- package/fesm2022/sd-angular-core-components-tab-router.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-table.mjs +724 -472
- package/fesm2022/sd-angular-core-components-table.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-upload-file.mjs +1 -1
- package/fesm2022/sd-angular-core-components-upload-file.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-view.mjs +45 -0
- package/fesm2022/sd-angular-core-components-view.mjs.map +1 -0
- package/fesm2022/sd-angular-core-components-workflow.mjs +33 -43
- package/fesm2022/sd-angular-core-components-workflow.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components.mjs +3 -0
- package/fesm2022/sd-angular-core-components.mjs.map +1 -1
- package/fesm2022/sd-angular-core-directives.mjs +80 -27
- package/fesm2022/sd-angular-core-directives.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-autocomplete.mjs +211 -357
- package/fesm2022/sd-angular-core-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-date-range.mjs +145 -245
- package/fesm2022/sd-angular-core-forms-date-range.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-date.mjs +137 -271
- package/fesm2022/sd-angular-core-forms-date.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-datetime.mjs +138 -276
- package/fesm2022/sd-angular-core-forms-datetime.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-input-number.mjs +174 -336
- package/fesm2022/sd-angular-core-forms-input-number.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-input.mjs +130 -283
- package/fesm2022/sd-angular-core-forms-input.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-radio.mjs +5 -2
- package/fesm2022/sd-angular-core-forms-radio.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-select.mjs +241 -416
- package/fesm2022/sd-angular-core-forms-select.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-textarea.mjs +133 -226
- package/fesm2022/sd-angular-core-forms-textarea.mjs.map +1 -1
- package/fesm2022/sd-angular-core-modules-keycloak.mjs +126 -0
- package/fesm2022/sd-angular-core-modules-keycloak.mjs.map +1 -0
- package/fesm2022/sd-angular-core-modules-layout.mjs +54 -19
- package/fesm2022/sd-angular-core-modules-layout.mjs.map +1 -1
- package/fesm2022/sd-angular-core-modules.mjs +1 -1
- package/fesm2022/sd-angular-core-pipes.mjs +21 -1
- package/fesm2022/sd-angular-core-pipes.mjs.map +1 -1
- package/fesm2022/sd-angular-core-services-confirm.mjs +2 -2
- package/fesm2022/sd-angular-core-services-confirm.mjs.map +1 -1
- package/fesm2022/sd-angular-core-services-docx.mjs +173 -0
- package/fesm2022/sd-angular-core-services-docx.mjs.map +1 -0
- package/fesm2022/sd-angular-core-services-notify.mjs +2 -2
- package/fesm2022/sd-angular-core-services-notify.mjs.map +1 -1
- package/fesm2022/sd-angular-core-services.mjs +1 -0
- package/fesm2022/sd-angular-core-services.mjs.map +1 -1
- package/fesm2022/sd-angular-core-utilities-extensions.mjs +10 -6
- package/fesm2022/sd-angular-core-utilities-extensions.mjs.map +1 -1
- package/fesm2022/sd-angular-core-utilities-models.mjs +15 -1
- package/fesm2022/sd-angular-core-utilities-models.mjs.map +1 -1
- package/forms/autocomplete/src/autocomplete.component.d.ts +50 -56
- package/forms/date/src/date.component.d.ts +41 -45
- package/forms/date-range/src/date-range.component.d.ts +28 -33
- package/forms/datetime/src/datetime.component.d.ts +41 -45
- package/forms/input/src/input.component.d.ts +46 -56
- package/forms/input-number/src/input-number.component.d.ts +47 -54
- package/forms/select/src/select.component.d.ts +50 -58
- package/forms/textarea/src/textarea.component.d.ts +34 -41
- package/modules/index.d.ts +1 -1
- package/modules/keycloak/index.d.ts +4 -0
- package/modules/keycloak/keycloak.configuration.d.ts +11 -0
- package/modules/keycloak/keycloak.interceptor.d.ts +2 -0
- package/modules/keycloak/keycloak.module.d.ts +18 -0
- package/modules/keycloak/keycloak.service.d.ts +14 -0
- package/modules/layout/components/sidebar-v1/components/sidebar/sidebar.component.d.ts +1 -0
- package/modules/layout/components/sidebar-v1/components/user/user.component.d.ts +5 -2
- package/modules/layout/configurations/layout.configuration.d.ts +3 -0
- package/modules/layout/services/storage/storage.service.d.ts +1 -0
- package/package.json +89 -71
- package/pipes/index.d.ts +1 -0
- package/pipes/src/empty.pipe.d.ts +7 -0
- package/sd-angular-core-19.0.0-beta.40.tgz +0 -0
- package/services/confirm/src/lib/confirm.service.d.ts +1 -0
- package/services/docx/index.d.ts +1 -0
- package/services/docx/src/lib/docx.model.d.ts +9 -0
- package/services/docx/src/lib/docx.service.d.ts +13 -0
- package/services/docx/src/public-api.d.ts +2 -0
- package/services/index.d.ts +1 -0
- package/utilities/extensions/src/string.extension.d.ts +2 -0
- package/utilities/models/index.d.ts +3 -0
- package/utilities/models/src/filter.model.d.ts +14 -2
- package/utilities/models/src/icon.model.d.ts +2 -0
- package/utilities/models/src/nested-key-of.model.d.ts +5 -0
- package/utilities/models/src/pattern.model.d.ts +1 -1
- package/utilities/models/src/unwrap-signal.model.d.ts +6 -0
- package/components/document-builder/src/plugins/comment.plugin.d.ts +0 -4
- package/components/document-builder/src/plugins/table-fit.plugin.d.ts +0 -4
- package/fesm2022/sd-angular-core-modules-oidc.mjs +0 -127
- package/fesm2022/sd-angular-core-modules-oidc.mjs.map +0 -1
- package/modules/oidc/dynamic-sts.loader.d.ts +0 -11
- package/modules/oidc/index.d.ts +0 -2
- package/modules/oidc/oidc.configuration.d.ts +0 -11
- package/modules/oidc/oidc.module.d.ts +0 -14
- /package/components/document-builder/src/plugins/{variable.plugin.d.ts → variable/variable.plugin.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i1 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import {
|
|
4
|
+
import { viewChild, contentChild, inject, ChangeDetectorRef, input, computed, booleanAttribute, model, output, effect, untracked, Component } from '@angular/core';
|
|
5
5
|
import * as i2 from '@angular/forms';
|
|
6
6
|
import { NgForm, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import * as i3 from '@angular/material/form-field';
|
|
@@ -13,141 +13,121 @@ import { MatInputModule } from '@angular/material/input';
|
|
|
13
13
|
import * as i6 from '@angular/material/tooltip';
|
|
14
14
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
15
15
|
import { SdViewDefDirective, SdLabelDefDirective, SdSuffixDefDirective } from '@sd-angular/core/forms/directives';
|
|
16
|
-
import {
|
|
16
|
+
import { SD_FORM_CONFIGURATION, SdFormControl } from '@sd-angular/core/forms/models';
|
|
17
17
|
import { NumberUtilities } from '@sd-angular/core/utilities/extensions';
|
|
18
18
|
import { Subscription } from 'rxjs';
|
|
19
19
|
import * as uuid from 'uuid';
|
|
20
|
+
import { SdLabel } from '@sd-angular/core/forms/label';
|
|
21
|
+
import { SdEmptyPipe } from '@sd-angular/core/pipes';
|
|
20
22
|
|
|
21
23
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
22
24
|
/* eslint-disable @angular-eslint/no-input-rename */
|
|
23
25
|
class SdTextarea {
|
|
24
|
-
ref;
|
|
25
|
-
formConfig;
|
|
26
26
|
id = `I${uuid.v4()}`;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
sdChange =
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.hideInlineError = val === '' || !!val;
|
|
74
|
-
}
|
|
75
|
-
required = false;
|
|
76
|
-
set _required(val) {
|
|
77
|
-
this.required = val === '' || !!val;
|
|
78
|
-
this.#updateValidator();
|
|
79
|
-
}
|
|
80
|
-
maxlength = null;
|
|
81
|
-
set _maxlength(val) {
|
|
82
|
-
if (val !== undefined && val !== null) {
|
|
83
|
-
this.maxlength = +val;
|
|
84
|
-
this.#updateValidator();
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
this.maxlength = null;
|
|
88
|
-
this.#updateValidator();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
#pattern;
|
|
92
|
-
set pattern(val) {
|
|
93
|
-
this.#pattern = val;
|
|
94
|
-
this.#updateValidator();
|
|
95
|
-
}
|
|
96
|
-
#validator;
|
|
97
|
-
set validator(validator) {
|
|
98
|
-
this.#validator = validator;
|
|
99
|
-
this.#updateValidator();
|
|
100
|
-
}
|
|
101
|
-
inlineError;
|
|
102
|
-
set _inlineError(val) {
|
|
103
|
-
this.inlineError = val;
|
|
104
|
-
this.#updateValidator();
|
|
105
|
-
}
|
|
106
|
-
set disabled(val) {
|
|
107
|
-
val = val === '' || val;
|
|
108
|
-
if (val) {
|
|
109
|
-
this.formControl.disable();
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
this.formControl.enable();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
viewed = false;
|
|
116
|
-
set _viewed(val) {
|
|
117
|
-
this.viewed = val === '' || !!val;
|
|
118
|
-
}
|
|
119
|
-
#autoHeight = false;
|
|
120
|
-
set _autoHeight(val) {
|
|
121
|
-
this.#autoHeight = val === '' || val;
|
|
122
|
-
}
|
|
123
|
-
textarea;
|
|
124
|
-
sdViewDef;
|
|
125
|
-
sdLabelDef;
|
|
126
|
-
sdSuffixDef;
|
|
127
|
-
isFocused = false;
|
|
27
|
+
// ==========================================
|
|
28
|
+
// 1. SIGNAL QUERIES
|
|
29
|
+
// ==========================================
|
|
30
|
+
textareaRef = viewChild('textarea');
|
|
31
|
+
sdViewDef = contentChild(SdViewDefDirective);
|
|
32
|
+
sdLabelDef = contentChild(SdLabelDefDirective);
|
|
33
|
+
sdSuffixDef = contentChild(SdSuffixDefDirective);
|
|
34
|
+
// ==========================================
|
|
35
|
+
// 2. INJECTS
|
|
36
|
+
// ==========================================
|
|
37
|
+
ref = inject(ChangeDetectorRef);
|
|
38
|
+
formConfig = inject(SD_FORM_CONFIGURATION, { optional: true });
|
|
39
|
+
// ==========================================
|
|
40
|
+
// 3. SIGNAL INPUTS & MODEL
|
|
41
|
+
// ==========================================
|
|
42
|
+
autoIdInput = input(undefined, { alias: 'autoId' });
|
|
43
|
+
autoId = computed(() => this.autoIdInput() ? `forms-textarea-${this.autoIdInput()}` : undefined);
|
|
44
|
+
name = input(uuid.v4());
|
|
45
|
+
size = input('md');
|
|
46
|
+
// Chấp nhận mọi loại Form cha truyền xuống (FormGroup<{}>, FormGroup<any>, NgForm...)
|
|
47
|
+
form = input();
|
|
48
|
+
label = input();
|
|
49
|
+
helperText = input();
|
|
50
|
+
placeholder = input('');
|
|
51
|
+
rows = input(5);
|
|
52
|
+
hideInlineError = input(false, { transform: booleanAttribute });
|
|
53
|
+
required = input(false, { transform: booleanAttribute });
|
|
54
|
+
disabled = input(false, { transform: booleanAttribute });
|
|
55
|
+
viewed = input(false, { transform: booleanAttribute });
|
|
56
|
+
autoHeight = input(false, { transform: booleanAttribute });
|
|
57
|
+
maxlength = input(null, {
|
|
58
|
+
transform: (v) => (v != null && NumberUtilities.isPositiveInteger(Number(v))) ? Number(v) : null
|
|
59
|
+
});
|
|
60
|
+
pattern = input();
|
|
61
|
+
validator = input();
|
|
62
|
+
inlineError = input();
|
|
63
|
+
appearanceInput = input(undefined, { alias: 'appearance' });
|
|
64
|
+
appearance = computed(() => this.appearanceInput() ?? this.formConfig?.appearance ?? 'outline');
|
|
65
|
+
valueModel = model(undefined, { alias: 'model' });
|
|
66
|
+
// ==========================================
|
|
67
|
+
// 4. SIGNAL OUTPUTS
|
|
68
|
+
// ==========================================
|
|
69
|
+
sdChange = output();
|
|
70
|
+
// ==========================================
|
|
71
|
+
// 5. INTERNAL STATE & STREAMS
|
|
72
|
+
// ==========================================
|
|
128
73
|
formControl = new SdFormControl();
|
|
129
74
|
#subscription = new Subscription();
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
75
|
+
isFocused = false;
|
|
76
|
+
constructor() {
|
|
77
|
+
// EFFECT 1: Sync model thay đổi từ bên ngoài
|
|
78
|
+
effect(() => {
|
|
79
|
+
const val = this.valueModel();
|
|
80
|
+
untracked(() => {
|
|
81
|
+
if (this.formControl.value !== val) {
|
|
82
|
+
this.formControl.setValue(val, { emitEvent: false });
|
|
83
|
+
// [IMPROVE] Cập nhật chiều cao khi value đổi từ bên ngoài
|
|
84
|
+
if (this.autoHeight())
|
|
85
|
+
this.#adjustHeight();
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
// EFFECT 2: Sync Disable
|
|
90
|
+
effect(() => {
|
|
91
|
+
if (this.disabled())
|
|
92
|
+
this.formControl.disable({ emitEvent: false });
|
|
93
|
+
else
|
|
94
|
+
this.formControl.enable({ emitEvent: false });
|
|
95
|
+
});
|
|
96
|
+
// EFFECT 3: Update Validators
|
|
97
|
+
effect(() => {
|
|
98
|
+
const req = this.required();
|
|
99
|
+
const maxLen = this.maxlength();
|
|
100
|
+
const pat = this.pattern();
|
|
101
|
+
const val = this.validator();
|
|
102
|
+
const inl = this.inlineError();
|
|
103
|
+
untracked(() => this.#updateValidator(req, maxLen, pat, val, inl));
|
|
104
|
+
});
|
|
133
105
|
}
|
|
134
106
|
ngOnInit() {
|
|
135
|
-
this.
|
|
136
|
-
this.#subscription.add(this.formControl.sdChanges.subscribe(() => {
|
|
137
|
-
this.ref.markForCheck();
|
|
138
|
-
}));
|
|
107
|
+
this.#subscription.add(this.formControl.sdChanges.subscribe(() => this.ref.markForCheck()));
|
|
139
108
|
this.#subscription.add(this.formControl.valueChanges.subscribe(this.#onChange));
|
|
140
|
-
this
|
|
109
|
+
const formGroup = this.form() instanceof NgForm ? this.form().form : this.form();
|
|
110
|
+
formGroup?.addControl(this.name(), this.formControl);
|
|
141
111
|
}
|
|
142
112
|
ngAfterViewInit() {
|
|
143
|
-
if (this
|
|
144
|
-
|
|
113
|
+
if (this.autoHeight()) {
|
|
114
|
+
setTimeout(() => this.#adjustHeight(), 0);
|
|
145
115
|
}
|
|
146
116
|
}
|
|
147
117
|
ngOnDestroy() {
|
|
148
|
-
this
|
|
118
|
+
const formGroup = this.form() instanceof NgForm ? this.form().form : this.form();
|
|
119
|
+
formGroup?.removeControl(this.name());
|
|
149
120
|
this.#subscription.unsubscribe();
|
|
150
121
|
}
|
|
122
|
+
// Hàm private tính toán chiều cao mượt mà
|
|
123
|
+
#adjustHeight() {
|
|
124
|
+
const el = this.textareaRef()?.nativeElement;
|
|
125
|
+
if (el) {
|
|
126
|
+
el.style.height = 'auto';
|
|
127
|
+
el.style.overflowY = 'hidden';
|
|
128
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
151
131
|
onFocus = () => {
|
|
152
132
|
this.isFocused = true;
|
|
153
133
|
};
|
|
@@ -159,58 +139,49 @@ class SdTextarea {
|
|
|
159
139
|
}
|
|
160
140
|
};
|
|
161
141
|
onClick = () => {
|
|
162
|
-
if (this.sdViewDef?.templateRef) {
|
|
142
|
+
if (this.sdViewDef()?.templateRef) {
|
|
163
143
|
if (!this.formControl.disabled && !this.isFocused) {
|
|
164
144
|
this.focus();
|
|
165
145
|
}
|
|
166
146
|
}
|
|
167
147
|
};
|
|
168
148
|
blur = () => {
|
|
169
|
-
this.
|
|
149
|
+
this.textareaRef()?.nativeElement?.blur();
|
|
170
150
|
};
|
|
171
151
|
focus = () => {
|
|
172
152
|
this.isFocused = true;
|
|
173
153
|
setTimeout(() => {
|
|
174
|
-
this.
|
|
154
|
+
this.textareaRef()?.nativeElement?.focus();
|
|
175
155
|
}, 100);
|
|
176
156
|
};
|
|
177
157
|
#onChange = (value) => {
|
|
178
|
-
if (this
|
|
179
|
-
this
|
|
180
|
-
this.textarea.nativeElement.style.height = this.textarea.nativeElement.scrollHeight + 'px';
|
|
158
|
+
if (this.autoHeight()) {
|
|
159
|
+
this.#adjustHeight();
|
|
181
160
|
}
|
|
182
|
-
this.
|
|
161
|
+
this.valueModel.set(value);
|
|
183
162
|
this.sdChange.emit(value);
|
|
184
163
|
};
|
|
185
|
-
#updateValidator = () => {
|
|
164
|
+
#updateValidator = (req, maxLen, pat, val, inl) => {
|
|
186
165
|
this.formControl.clearValidators();
|
|
187
166
|
this.formControl.clearAsyncValidators();
|
|
188
167
|
const validators = [];
|
|
189
168
|
const asyncValidators = [];
|
|
190
|
-
if (
|
|
169
|
+
if (req)
|
|
191
170
|
validators.push(Validators.required);
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (this.#validator) {
|
|
200
|
-
asyncValidators.push(this.#customValidator(this.#validator));
|
|
201
|
-
}
|
|
202
|
-
if (this.inlineError) {
|
|
171
|
+
if (maxLen != null)
|
|
172
|
+
validators.push(Validators.maxLength(maxLen));
|
|
173
|
+
if (pat)
|
|
174
|
+
validators.push(Validators.pattern(pat));
|
|
175
|
+
if (val)
|
|
176
|
+
asyncValidators.push(this.#customValidator(val));
|
|
177
|
+
if (inl)
|
|
203
178
|
validators.push(this.customInlineErrorValidator());
|
|
204
|
-
|
|
205
|
-
this.formControl.
|
|
206
|
-
this.formControl.
|
|
207
|
-
this.formControl.updateValueAndValidity();
|
|
179
|
+
this.formControl.setValidators(validators.length ? validators : null);
|
|
180
|
+
this.formControl.setAsyncValidators(asyncValidators.length ? asyncValidators : null);
|
|
181
|
+
this.formControl.updateValueAndValidity({ emitEvent: false });
|
|
208
182
|
};
|
|
209
|
-
// Hàm tạo Validators tùy chỉnh cho inlineError
|
|
210
183
|
customInlineErrorValidator() {
|
|
211
|
-
return () => {
|
|
212
|
-
return { inlineError: true };
|
|
213
|
-
};
|
|
184
|
+
return () => ({ inlineError: true });
|
|
214
185
|
}
|
|
215
186
|
#customValidator = (func) => {
|
|
216
187
|
return async (c) => {
|
|
@@ -219,98 +190,34 @@ class SdTextarea {
|
|
|
219
190
|
const result = func(value);
|
|
220
191
|
if (result instanceof Promise) {
|
|
221
192
|
const message = await result;
|
|
222
|
-
if (message)
|
|
223
|
-
return {
|
|
224
|
-
customValidator: message,
|
|
225
|
-
};
|
|
226
|
-
}
|
|
193
|
+
if (message)
|
|
194
|
+
return { customValidator: message };
|
|
227
195
|
return null;
|
|
228
196
|
}
|
|
229
|
-
if (result)
|
|
230
|
-
return {
|
|
231
|
-
customValidator: result,
|
|
232
|
-
};
|
|
233
|
-
}
|
|
197
|
+
if (result)
|
|
198
|
+
return { customValidator: result };
|
|
234
199
|
return null;
|
|
235
200
|
}
|
|
236
201
|
return null;
|
|
237
202
|
};
|
|
238
203
|
};
|
|
239
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdTextarea, deps: [
|
|
240
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdTextarea, isStandalone: true, selector: "sd-textarea", inputs: { _autoId: ["autoId", "_autoId"], name: "name", size: "size", appearance: "appearance", form: "form", _label: ["label", "_label"], _helperText: ["helperText", "_helperText"], placeholder: "placeholder", rows: "rows", model: "model", _hideInlineError: ["hideInlineError", "_hideInlineError"], _required: ["required", "_required"], _maxlength: ["maxlength", "_maxlength"], pattern: "pattern", validator: "validator", _inlineError: ["inlineError", "_inlineError"], disabled: "disabled", _viewed: ["viewed", "_viewed"], _autoHeight: ["autoHeight", "_autoHeight"] }, outputs: { modelChange: "modelChange", sdChange: "sdChange" }, queries: [{ propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true }, { propertyName: "sdLabelDef", first: true, predicate: SdLabelDefDirective, descendants: true }, { propertyName: "sdSuffixDef", first: true, predicate: SdSuffixDefDirective, descendants: true }], viewQueries: [{ propertyName: "textarea", first: true, predicate: ["textarea"], descendants: true }], ngImport: i0, template: "@if (viewed) {\r\n @if (sdLabelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef!.templateRef\"> </ng-container>\r\n } @else if (label) {\r\n <div class=\"text-secondary\">{{ label }}</div>\r\n }\r\n <div class=\"T16M\">{{ formControl.value }}</div>\r\n} @else {\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"sdViewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n @if (sdViewDef?.templateRef && !isFocused) {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n sdViewDef!.templateRef;\r\n context: {\r\n value: formControl.value\r\n }\r\n \">\r\n </ng-container>\r\n } @else {\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 @if (appearance && label) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ label }}</span>\r\n @if (helperText) {\r\n <mat-icon [matTooltip]=\"helperText\" matTooltipPosition=\"above\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n <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 spellcheck=\"false\"\r\n #textarea>\r\n </textarea>\r\n\r\n @if (maxlength && !formControl.disabled) {\r\n <span matSuffix>{{ formControl.value?.length || 0 }}/{{ maxlength }}</span>\r\n }\r\n <mat-error *ngIf=\"formControl.touched && formControl.errors?.['required']\">\r\n <ng-container *ngIf=\"!hideInlineError\">{{ 'Vui l\u00F2ng nh\u1EADp th\u00F4ng tin' }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.touched && formControl.errors?.['maxlength']\">\r\n <ng-container *ngIf=\"!hideInlineError\"\r\n >{{ 'S\u1ED1 k\u00FD t\u1EF1 t\u1ED1i \u0111a: ' }} <strong>{{ maxlength }}</strong>\r\n </ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.touched && formControl.errors?.['pattern']\">\r\n <ng-container *ngIf=\"!hideInlineError\">{{ '\u0110\u1ECBnh d\u1EA1ng kh\u00F4ng h\u1EE3p l\u1EC7' }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.touched && formControl.errors?.['customValidator']\">\r\n <ng-container *ngIf=\"!hideInlineError\">{{ formControl.errors?.['customValidator'] }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.touched && formControl.errors?.['inlineError']\">\r\n <ng-container *ngIf=\"!hideInlineError\">{{ inlineError }}</ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n }\r\n </div>\r\n}\r\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host ::ng-deep textarea.mat-mdc-input-element{resize:none}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline .mdc-text-field--disabled{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field textarea.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] });
|
|
204
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdTextarea, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
205
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.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 }, valueModel: { classPropertyName: "valueModel", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueModel: "modelChange", sdChange: "sdChange" }, queries: [{ propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelDef", first: true, predicate: SdLabelDefDirective, descendants: true, isSignal: true }, { propertyName: "sdSuffixDef", first: true, predicate: SdSuffixDefDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "textareaRef", first: true, predicate: ["textarea"], descendants: true, isSignal: true }], ngImport: i0, template: "@let lbl = label();\r\n@let app = appearance();\r\n@let hideErr = hideInlineError();\r\n@let viewDef = sdViewDef();\r\n@let lblDef = sdLabelDef();\r\n@let hText = helperText();\r\n@let req = required();\r\n@let maxLen = maxlength();\r\n\r\n@if (viewed()) {\r\n @if (lblDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"lblDef!.templateRef\"> </ng-container>\r\n } @else if (lbl) {\r\n <div class=\"T14R text-black400\">{{ lbl }}</div>\r\n }\r\n <div class=\"T14M\">{{ formControl.value | sdEmpty }}</div>\r\n} @else {\r\n @if (!app && lblDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"lblDef!.templateRef\"> </ng-container>\r\n }\r\n @if (!app && lbl && !lblDef?.templateRef) {\r\n <sd-label [label]=\"lbl\" [required]=\"req\"></sd-label>\r\n }\r\n \r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"viewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n \r\n @if (viewDef?.templateRef && !isFocused) {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n viewDef!.templateRef;\r\n context: { value: formControl.value }\r\n \">\r\n </ng-container>\r\n } @else {\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]=\"hideErr\"\r\n [appearance]=\"app!\">\r\n \r\n @if (app && lbl) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ lbl }}</span>\r\n @if (hText) {\r\n <mat-icon [matTooltip]=\"hText\" matTooltipPosition=\"above\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n \r\n <textarea\r\n matInput\r\n [placeholder]=\"placeholder() || lbl || ''\"\r\n [formControl]=\"formControl\"\r\n [required]=\"req\"\r\n autocomplete=\"off\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [rows]=\"rows()\"\r\n [attr.data-autoId]=\"autoId()\"\r\n spellcheck=\"false\"\r\n #textarea>\r\n </textarea>\r\n\r\n @if (maxLen !== null && !formControl.disabled) {\r\n <span matSuffix>{{ formControl.value?.length || 0 }}/{{ maxLen }}</span>\r\n }\r\n\r\n @if (formControl.touched && formControl.errors?.['required']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Vui l\u00F2ng nh\u1EADp th\u00F4ng tin' }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.touched && formControl.errors?.['maxlength']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'S\u1ED1 k\u00FD t\u1EF1 t\u1ED1i \u0111a: ' }} <strong>{{ maxLen }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.touched && formControl.errors?.['pattern']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ '\u0110\u1ECBnh d\u1EA1ng kh\u00F4ng h\u1EE3p l\u1EC7' }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.touched && formControl.errors?.['customValidator']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ formControl.errors?.['customValidator'] }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.touched && formControl.errors?.['inlineError']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ inlineError() }}\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host{padding-top:5px;display:block}:host ::ng-deep textarea.mat-mdc-input-element{resize:none}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline .mdc-text-field--disabled{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field textarea.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }, { kind: "pipe", type: SdEmptyPipe, name: "sdEmpty" }] });
|
|
241
206
|
}
|
|
242
207
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdTextarea, decorators: [{
|
|
243
208
|
type: Component,
|
|
244
|
-
args: [{ selector: 'sd-textarea', standalone: true, imports: [
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
type: Input
|
|
257
|
-
}], appearance: [{
|
|
258
|
-
type: Input
|
|
259
|
-
}], form: [{
|
|
260
|
-
type: Input
|
|
261
|
-
}], _label: [{
|
|
262
|
-
type: Input,
|
|
263
|
-
args: ['label']
|
|
264
|
-
}], _helperText: [{
|
|
265
|
-
type: Input,
|
|
266
|
-
args: ['helperText']
|
|
267
|
-
}], placeholder: [{
|
|
268
|
-
type: Input
|
|
269
|
-
}], rows: [{
|
|
270
|
-
type: Input
|
|
271
|
-
}], model: [{
|
|
272
|
-
type: Input
|
|
273
|
-
}], modelChange: [{
|
|
274
|
-
type: Output
|
|
275
|
-
}], sdChange: [{
|
|
276
|
-
type: Output
|
|
277
|
-
}], _hideInlineError: [{
|
|
278
|
-
type: Input,
|
|
279
|
-
args: ['hideInlineError']
|
|
280
|
-
}], _required: [{
|
|
281
|
-
type: Input,
|
|
282
|
-
args: ['required']
|
|
283
|
-
}], _maxlength: [{
|
|
284
|
-
type: Input,
|
|
285
|
-
args: ['maxlength']
|
|
286
|
-
}], pattern: [{
|
|
287
|
-
type: Input
|
|
288
|
-
}], validator: [{
|
|
289
|
-
type: Input
|
|
290
|
-
}], _inlineError: [{
|
|
291
|
-
type: Input,
|
|
292
|
-
args: ['inlineError']
|
|
293
|
-
}], disabled: [{
|
|
294
|
-
type: Input
|
|
295
|
-
}], _viewed: [{
|
|
296
|
-
type: Input,
|
|
297
|
-
args: ['viewed']
|
|
298
|
-
}], _autoHeight: [{
|
|
299
|
-
type: Input,
|
|
300
|
-
args: ['autoHeight']
|
|
301
|
-
}], textarea: [{
|
|
302
|
-
type: ViewChild,
|
|
303
|
-
args: ['textarea']
|
|
304
|
-
}], sdViewDef: [{
|
|
305
|
-
type: ContentChild,
|
|
306
|
-
args: [SdViewDefDirective]
|
|
307
|
-
}], sdLabelDef: [{
|
|
308
|
-
type: ContentChild,
|
|
309
|
-
args: [SdLabelDefDirective]
|
|
310
|
-
}], sdSuffixDef: [{
|
|
311
|
-
type: ContentChild,
|
|
312
|
-
args: [SdSuffixDefDirective]
|
|
313
|
-
}] } });
|
|
209
|
+
args: [{ selector: 'sd-textarea', standalone: true, imports: [
|
|
210
|
+
CommonModule,
|
|
211
|
+
FormsModule,
|
|
212
|
+
ReactiveFormsModule,
|
|
213
|
+
MatFormFieldModule,
|
|
214
|
+
MatInputModule,
|
|
215
|
+
MatIconModule,
|
|
216
|
+
MatTooltipModule,
|
|
217
|
+
SdLabel,
|
|
218
|
+
SdEmptyPipe,
|
|
219
|
+
], template: "@let lbl = label();\r\n@let app = appearance();\r\n@let hideErr = hideInlineError();\r\n@let viewDef = sdViewDef();\r\n@let lblDef = sdLabelDef();\r\n@let hText = helperText();\r\n@let req = required();\r\n@let maxLen = maxlength();\r\n\r\n@if (viewed()) {\r\n @if (lblDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"lblDef!.templateRef\"> </ng-container>\r\n } @else if (lbl) {\r\n <div class=\"T14R text-black400\">{{ lbl }}</div>\r\n }\r\n <div class=\"T14M\">{{ formControl.value | sdEmpty }}</div>\r\n} @else {\r\n @if (!app && lblDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"lblDef!.templateRef\"> </ng-container>\r\n }\r\n @if (!app && lbl && !lblDef?.templateRef) {\r\n <sd-label [label]=\"lbl\" [required]=\"req\"></sd-label>\r\n }\r\n \r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"viewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n \r\n @if (viewDef?.templateRef && !isFocused) {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n viewDef!.templateRef;\r\n context: { value: formControl.value }\r\n \">\r\n </ng-container>\r\n } @else {\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]=\"hideErr\"\r\n [appearance]=\"app!\">\r\n \r\n @if (app && lbl) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ lbl }}</span>\r\n @if (hText) {\r\n <mat-icon [matTooltip]=\"hText\" matTooltipPosition=\"above\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n \r\n <textarea\r\n matInput\r\n [placeholder]=\"placeholder() || lbl || ''\"\r\n [formControl]=\"formControl\"\r\n [required]=\"req\"\r\n autocomplete=\"off\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [rows]=\"rows()\"\r\n [attr.data-autoId]=\"autoId()\"\r\n spellcheck=\"false\"\r\n #textarea>\r\n </textarea>\r\n\r\n @if (maxLen !== null && !formControl.disabled) {\r\n <span matSuffix>{{ formControl.value?.length || 0 }}/{{ maxLen }}</span>\r\n }\r\n\r\n @if (formControl.touched && formControl.errors?.['required']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Vui l\u00F2ng nh\u1EADp th\u00F4ng tin' }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.touched && formControl.errors?.['maxlength']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'S\u1ED1 k\u00FD t\u1EF1 t\u1ED1i \u0111a: ' }} <strong>{{ maxLen }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.touched && formControl.errors?.['pattern']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ '\u0110\u1ECBnh d\u1EA1ng kh\u00F4ng h\u1EE3p l\u1EC7' }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.touched && formControl.errors?.['customValidator']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ formControl.errors?.['customValidator'] }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.touched && formControl.errors?.['inlineError']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ inlineError() }}\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host{padding-top:5px;display:block}:host ::ng-deep textarea.mat-mdc-input-element{resize:none}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline .mdc-text-field--disabled{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field textarea.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}\n"] }]
|
|
220
|
+
}], ctorParameters: () => [] });
|
|
314
221
|
|
|
315
222
|
/**
|
|
316
223
|
* Generated bundle index. Do not edit.
|