@sd-angular/core 19.0.0-beta.32 → 19.0.0-beta.33
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/components/view/src/view.component.d.ts +11 -11
- package/fesm2022/sd-angular-core-components-table.mjs +4 -4
- package/fesm2022/sd-angular-core-components-table.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-view.mjs +28 -40
- package/fesm2022/sd-angular-core-components-view.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-workflow.mjs +22 -22
- package/fesm2022/sd-angular-core-components-workflow.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-autocomplete.mjs +165 -327
- package/fesm2022/sd-angular-core-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-date.mjs +134 -279
- package/fesm2022/sd-angular-core-forms-date.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-datetime.mjs +132 -289
- package/fesm2022/sd-angular-core-forms-datetime.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-input-number.mjs +161 -337
- package/fesm2022/sd-angular-core-forms-input-number.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-input.mjs +126 -286
- package/fesm2022/sd-angular-core-forms-input.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-select.mjs +205 -400
- package/fesm2022/sd-angular-core-forms-select.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-textarea.mjs +120 -226
- package/fesm2022/sd-angular-core-forms-textarea.mjs.map +1 -1
- package/fesm2022/sd-angular-core-modules-layout.mjs +1 -1
- package/fesm2022/sd-angular-core-modules-layout.mjs.map +1 -1
- package/fesm2022/sd-angular-core-services-confirm.mjs +1 -1
- package/forms/autocomplete/src/autocomplete.component.d.ts +44 -51
- package/forms/date/src/date.component.d.ts +40 -46
- package/forms/datetime/src/datetime.component.d.ts +39 -47
- package/forms/input/src/input.component.d.ts +44 -55
- package/forms/input-number/src/input-number.component.d.ts +45 -53
- package/forms/select/src/select.component.d.ts +47 -56
- package/forms/textarea/src/textarea.component.d.ts +33 -40
- package/package.json +56 -56
- package/sd-angular-core-19.0.0-beta.33.tgz +0 -0
- package/sd-angular-core-19.0.0-beta.32.tgz +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, input, computed, inject, ChangeDetectorRef, booleanAttribute, model, output, EventEmitter, effect, untracked, Output, ChangeDetectionStrategy, 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 { MatButtonModule } from '@angular/material/button';
|
|
@@ -16,217 +16,149 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|
|
16
16
|
import { SdView } from '@sd-angular/core/components/view';
|
|
17
17
|
import { SdSuffixDefDirective, SdViewDefDirective } from '@sd-angular/core/forms/directives';
|
|
18
18
|
import { SdLabel } from '@sd-angular/core/forms/label';
|
|
19
|
-
import { SdFormControl, HandleSdCustomValidator
|
|
19
|
+
import { SD_FORM_CONFIGURATION, SdFormControl, HandleSdCustomValidator } from '@sd-angular/core/forms/models';
|
|
20
20
|
import { SdPatternCommons } from '@sd-angular/core/utilities/models';
|
|
21
21
|
import { Subscription } from 'rxjs';
|
|
22
22
|
import * as uuid from 'uuid';
|
|
23
23
|
|
|
24
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
25
|
-
/* eslint-disable @angular-eslint/no-input-rename */
|
|
26
|
-
// eslint-disable-next-line @angular-eslint/component-class-suffix
|
|
27
24
|
class SdInput {
|
|
28
|
-
ref;
|
|
29
|
-
formConfig;
|
|
30
|
-
sdLabelTemplate;
|
|
31
|
-
sdValueTemplate;
|
|
32
25
|
id = `I${uuid.v4()}`;
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
this
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
this.required = val === '' || !!val;
|
|
94
|
-
this.#updateValidator();
|
|
95
|
-
}
|
|
96
|
-
readonly = false;
|
|
97
|
-
set _readonly(val) {
|
|
98
|
-
this.readonly = val === '' || val;
|
|
99
|
-
}
|
|
100
|
-
minlength;
|
|
101
|
-
set _minlength(val) {
|
|
102
|
-
if (val === undefined || val === null) {
|
|
103
|
-
this.minlength = undefined;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
this.minlength = +val;
|
|
107
|
-
}
|
|
108
|
-
this.#updateValidator();
|
|
109
|
-
}
|
|
110
|
-
maxlength;
|
|
111
|
-
set _maxlength(val) {
|
|
112
|
-
if (val === undefined || val === null) {
|
|
113
|
-
this.maxlength = undefined;
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
this.maxlength = +val;
|
|
117
|
-
}
|
|
118
|
-
this.#updateValidator();
|
|
119
|
-
}
|
|
120
|
-
#pattern;
|
|
121
|
-
set _pattern(val) {
|
|
122
|
-
const pattern = SdPatternCommons.find(e => e.type === val);
|
|
123
|
-
if (pattern) {
|
|
124
|
-
this.#pattern = pattern.regex;
|
|
125
|
-
this.patternErrorMessage = pattern.errorMessage;
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
this.#pattern = val ?? undefined;
|
|
129
|
-
}
|
|
130
|
-
this.#updateValidator();
|
|
131
|
-
}
|
|
132
|
-
patternErrorMessage;
|
|
133
|
-
set _patternErrorMessage(val) {
|
|
134
|
-
this.patternErrorMessage = val ?? this.patternErrorMessage;
|
|
135
|
-
}
|
|
136
|
-
#validator;
|
|
137
|
-
set _validator(value) {
|
|
138
|
-
this.#validator = value;
|
|
139
|
-
this.#updateValidator();
|
|
140
|
-
}
|
|
141
|
-
inlineError;
|
|
142
|
-
set _inlineError(val) {
|
|
143
|
-
this.inlineError = val;
|
|
144
|
-
this.#updateValidator();
|
|
145
|
-
}
|
|
146
|
-
// Optional
|
|
147
|
-
set disabled(val) {
|
|
148
|
-
val = val === '' || val;
|
|
149
|
-
if (val) {
|
|
150
|
-
this.formControl.disable();
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
this.formControl.enable();
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
viewed = false;
|
|
157
|
-
set _viewed(val) {
|
|
158
|
-
this.viewed = val === '' || !!val;
|
|
159
|
-
}
|
|
160
|
-
hyperlink;
|
|
161
|
-
tooltip;
|
|
162
|
-
sdChange = new EventEmitter();
|
|
163
|
-
sdFocus = new EventEmitter();
|
|
164
|
-
sdBlur = new EventEmitter();
|
|
26
|
+
// ==========================================
|
|
27
|
+
// 1. SIGNAL QUERIES (Thay thế @ViewChild / @ContentChild)
|
|
28
|
+
// ==========================================
|
|
29
|
+
control = viewChild('control');
|
|
30
|
+
sdLabelTemplate = contentChild('sdLabel');
|
|
31
|
+
sdValueTemplate = contentChild('sdValue');
|
|
32
|
+
sdSuffixDef = contentChild(SdSuffixDefDirective);
|
|
33
|
+
sdViewDef = contentChild(SdViewDefDirective);
|
|
34
|
+
// ==========================================
|
|
35
|
+
// 2. SIGNAL INPUTS & MODEL
|
|
36
|
+
// ==========================================
|
|
37
|
+
autoIdInput = input(undefined, { alias: 'autoId' });
|
|
38
|
+
autoId = computed(() => (this.autoIdInput() ? `forms-input-${this.autoIdInput()}` : undefined));
|
|
39
|
+
name = input(uuid.v4());
|
|
40
|
+
// ==========================================
|
|
41
|
+
// 3. INJECT (Thay thế Constructor DI)
|
|
42
|
+
// ==========================================
|
|
43
|
+
#ref = inject(ChangeDetectorRef);
|
|
44
|
+
#formConfig = inject(SD_FORM_CONFIGURATION, { optional: true });
|
|
45
|
+
appearanceInput = input(undefined, { alias: 'appearance' });
|
|
46
|
+
appearance = computed(() => this.appearanceInput() ?? this.#formConfig?.appearance ?? 'outline');
|
|
47
|
+
size = input('md');
|
|
48
|
+
form = input();
|
|
49
|
+
label = input();
|
|
50
|
+
helperText = input();
|
|
51
|
+
placeholder = input();
|
|
52
|
+
type = input('text');
|
|
53
|
+
hideInlineError = input(false, { transform: booleanAttribute });
|
|
54
|
+
blurOnEnter = input(false, { transform: booleanAttribute });
|
|
55
|
+
required = input(false, { transform: booleanAttribute });
|
|
56
|
+
readonly = input(false, { transform: booleanAttribute });
|
|
57
|
+
disabled = input(false, { transform: booleanAttribute });
|
|
58
|
+
viewed = input(false, { transform: booleanAttribute });
|
|
59
|
+
minlength = input(undefined, { transform: v => (v == null ? undefined : Number(v)) });
|
|
60
|
+
maxlength = input(undefined, { transform: v => (v == null ? undefined : Number(v)) });
|
|
61
|
+
pattern = input();
|
|
62
|
+
patternErrorMessage = input();
|
|
63
|
+
resolvedPattern = computed(() => {
|
|
64
|
+
const val = this.pattern();
|
|
65
|
+
const patternObj = SdPatternCommons.find(e => e.type === val);
|
|
66
|
+
return patternObj ? patternObj.regex : (val ?? undefined);
|
|
67
|
+
});
|
|
68
|
+
resolvedPatternErrorMsg = computed(() => {
|
|
69
|
+
const val = this.pattern();
|
|
70
|
+
const patternObj = SdPatternCommons.find(e => e.type === val);
|
|
71
|
+
return this.patternErrorMessage() ?? (patternObj ? patternObj.errorMessage : undefined);
|
|
72
|
+
});
|
|
73
|
+
validator = input();
|
|
74
|
+
inlineError = input();
|
|
75
|
+
hyperlink = input();
|
|
76
|
+
tooltip = input();
|
|
77
|
+
valueModel = model(undefined, { alias: 'model' });
|
|
78
|
+
// ==========================================
|
|
79
|
+
// 4. SIGNAL OUTPUTS (Thay thế @Output)
|
|
80
|
+
// ==========================================
|
|
81
|
+
sdChange = output();
|
|
82
|
+
sdFocus = output(); // Đổi sang void vì không truyền data
|
|
83
|
+
sdBlur = output();
|
|
84
|
+
keyupEnter = output();
|
|
85
|
+
// 🚨 GIỮ LẠI EVENT_EMITTER DUY NHẤT VÌ CẦN CHECK OBSERVERED
|
|
165
86
|
sdFocusForceBlur = new EventEmitter();
|
|
166
|
-
keyupEnter = new EventEmitter();
|
|
167
|
-
control;
|
|
168
|
-
sdSuffixDef;
|
|
169
|
-
sdViewDef;
|
|
170
87
|
formControl = new SdFormControl();
|
|
171
88
|
#subscription = new Subscription();
|
|
172
89
|
isFocused = false;
|
|
173
|
-
constructor(
|
|
174
|
-
|
|
175
|
-
|
|
90
|
+
constructor() {
|
|
91
|
+
effect(() => {
|
|
92
|
+
const val = this.valueModel();
|
|
93
|
+
untracked(() => {
|
|
94
|
+
if (this.formControl.value !== val) {
|
|
95
|
+
this.formControl.setValue(val, { emitEvent: false });
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
effect(() => {
|
|
100
|
+
if (this.disabled()) {
|
|
101
|
+
this.formControl.disable({ emitEvent: false });
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this.formControl.enable({ emitEvent: false });
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
effect(() => {
|
|
108
|
+
const req = this.required();
|
|
109
|
+
const min = this.minlength();
|
|
110
|
+
const max = this.maxlength();
|
|
111
|
+
const pat = this.resolvedPattern();
|
|
112
|
+
const inl = this.inlineError();
|
|
113
|
+
const val = this.validator();
|
|
114
|
+
untracked(() => {
|
|
115
|
+
this.#updateValidator(req, min, max, pat, inl, val);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
176
118
|
}
|
|
177
119
|
ngOnInit() {
|
|
178
|
-
this.appearance = this.appearance || this.formConfig?.appearance;
|
|
179
120
|
this.#subscription.add(this.formControl.sdChanges.subscribe(() => {
|
|
180
|
-
this
|
|
121
|
+
this.#ref.markForCheck();
|
|
181
122
|
}));
|
|
182
123
|
}
|
|
183
124
|
ngAfterViewInit() {
|
|
184
125
|
this.#subscription.add(this.formControl.valueChanges.subscribe(this.#onChange));
|
|
185
|
-
this
|
|
186
|
-
this.
|
|
126
|
+
const formGroup = this.form() instanceof NgForm ? this.form().form : this.form();
|
|
127
|
+
formGroup?.addControl(this.name(), this.formControl);
|
|
128
|
+
this.#ref.detectChanges();
|
|
187
129
|
}
|
|
188
130
|
ngOnDestroy() {
|
|
189
|
-
this
|
|
131
|
+
const formGroup = this.form() instanceof NgForm ? this.form().form : this.form();
|
|
132
|
+
formGroup?.removeControl(this.name());
|
|
190
133
|
this.#subscription.unsubscribe();
|
|
191
134
|
}
|
|
192
135
|
reValidate = () => {
|
|
193
136
|
this.formControl.updateValueAndValidity();
|
|
194
137
|
};
|
|
195
|
-
#updateValidator = () => {
|
|
196
|
-
this.formControl.clearValidators();
|
|
197
|
-
this.formControl.clearAsyncValidators();
|
|
138
|
+
#updateValidator = (req, min, max, pat, inl, val) => {
|
|
198
139
|
const validators = [];
|
|
199
140
|
const asyncValidators = [];
|
|
200
|
-
if (
|
|
141
|
+
if (req)
|
|
201
142
|
validators.push(Validators.required);
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (
|
|
207
|
-
validators.push(Validators.
|
|
208
|
-
|
|
209
|
-
if (this.#pattern) {
|
|
210
|
-
validators.push(Validators.pattern(this.#pattern));
|
|
211
|
-
}
|
|
212
|
-
if (this.inlineError) {
|
|
143
|
+
if (min && min > 0)
|
|
144
|
+
validators.push(Validators.minLength(min));
|
|
145
|
+
if (max && max > 0)
|
|
146
|
+
validators.push(Validators.maxLength(max));
|
|
147
|
+
if (pat)
|
|
148
|
+
validators.push(Validators.pattern(pat));
|
|
149
|
+
if (inl)
|
|
213
150
|
validators.push(this.customInlineErrorValidator());
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
this.formControl.
|
|
219
|
-
this.formControl.setAsyncValidators(asyncValidators);
|
|
220
|
-
this.formControl.updateValueAndValidity();
|
|
151
|
+
if (val)
|
|
152
|
+
asyncValidators.push(HandleSdCustomValidator(val));
|
|
153
|
+
this.formControl.setValidators(validators.length ? validators : null);
|
|
154
|
+
this.formControl.setAsyncValidators(asyncValidators.length ? asyncValidators : null);
|
|
155
|
+
this.formControl.updateValueAndValidity({ emitEvent: false });
|
|
221
156
|
};
|
|
222
|
-
// Hàm tạo Validators tùy chỉnh cho inlineError
|
|
223
157
|
customInlineErrorValidator() {
|
|
224
|
-
return () => {
|
|
225
|
-
return { inlineError: true };
|
|
226
|
-
};
|
|
158
|
+
return () => ({ inlineError: true });
|
|
227
159
|
}
|
|
228
160
|
#onChange = () => {
|
|
229
|
-
this.
|
|
161
|
+
this.valueModel.set(this.formControl.value);
|
|
230
162
|
this.sdChange.emit(this.formControl.value);
|
|
231
163
|
};
|
|
232
164
|
onKeyupEnter = () => {
|
|
@@ -235,14 +167,14 @@ class SdInput {
|
|
|
235
167
|
this.formControl.setValue(val.trim());
|
|
236
168
|
}
|
|
237
169
|
this.keyupEnter.emit(this.formControl.value);
|
|
238
|
-
if (this
|
|
170
|
+
if (this.blurOnEnter()) {
|
|
239
171
|
this.blur();
|
|
240
172
|
}
|
|
241
173
|
};
|
|
242
174
|
onFocus = () => {
|
|
243
175
|
this.isFocused = true;
|
|
244
|
-
this.sdFocus.emit();
|
|
245
|
-
if (this.sdFocusForceBlur.
|
|
176
|
+
this.sdFocus.emit(); // Gọi .emit() y hệt như cũ
|
|
177
|
+
if (this.sdFocusForceBlur.observed) {
|
|
246
178
|
this.blur();
|
|
247
179
|
this.sdFocusForceBlur.emit();
|
|
248
180
|
}
|
|
@@ -256,7 +188,8 @@ class SdInput {
|
|
|
256
188
|
this.sdBlur.emit(this.formControl.value);
|
|
257
189
|
};
|
|
258
190
|
onClick = () => {
|
|
259
|
-
|
|
191
|
+
// 🚨 GỌI SIGNAL: Phải thêm () vào sdViewDef
|
|
192
|
+
if (this.sdViewDef()?.templateRef) {
|
|
260
193
|
if (!this.formControl.disabled && !this.isFocused) {
|
|
261
194
|
this.focus();
|
|
262
195
|
}
|
|
@@ -264,16 +197,18 @@ class SdInput {
|
|
|
264
197
|
};
|
|
265
198
|
blur = () => {
|
|
266
199
|
this.isFocused = false;
|
|
267
|
-
|
|
200
|
+
// 🚨 GỌI SIGNAL: Phải thêm () vào control
|
|
201
|
+
this.control()?.nativeElement?.blur();
|
|
268
202
|
};
|
|
269
203
|
focus = () => {
|
|
270
204
|
this.isFocused = true;
|
|
271
205
|
setTimeout(() => {
|
|
272
|
-
|
|
206
|
+
// 🚨 GỌI SIGNAL: Phải thêm () vào control
|
|
207
|
+
this.control()?.nativeElement?.focus();
|
|
273
208
|
}, 100);
|
|
274
209
|
};
|
|
275
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdInput, deps: [
|
|
276
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdInput, isStandalone: true, selector: "sd-input", inputs: { _autoId: ["autoId", "_autoId"], _name: ["name", "_name"], appearance: "appearance", size: "size", _form: ["form", "_form"], _label: ["label", "_label"], _helperText: ["helperText", "_helperText"], _placeholder: ["placeholder", "_placeholder"], type: "type", _hideInlineError: ["hideInlineError", "_hideInlineError"], _blurOnEnter: ["blurOnEnter", "_blurOnEnter"], model: "model", _required: ["required", "_required"], _readonly: ["readonly", "_readonly"], _minlength: ["minlength", "_minlength"], _maxlength: ["maxlength", "_maxlength"], _pattern: ["pattern", "_pattern"], _patternErrorMessage: ["patternErrorMessage", "_patternErrorMessage"], _validator: ["validator", "_validator"], _inlineError: ["inlineError", "_inlineError"], disabled: "disabled", _viewed: ["viewed", "_viewed"], hyperlink: "hyperlink", tooltip: "tooltip" }, outputs: { modelChange: "modelChange", sdChange: "sdChange", sdFocus: "sdFocus", sdBlur: "sdBlur", sdFocusForceBlur: "sdFocusForceBlur", keyupEnter: "keyupEnter" }, queries: [{ propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true }, { propertyName: "sdSuffixDef", first: true, predicate: SdSuffixDefDirective, descendants: true }, { propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true }], viewQueries: [{ propertyName: "control", first: true, predicate: ["control"], descendants: true }], ngImport: i0, template: "@if (viewed) {\r\n <sd-view\r\n [label]=\"label\"\r\n [labelTemplate]=\"sdLabelTemplate\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink\"\r\n [valueTemplate]=\"sdValueTemplate\">\r\n </sd-view>\r\n} @else {\r\n @if (!appearance) {\r\n <ng-content select=\"[sdLabel]\">\r\n @if (label) {\r\n <sd-label [label]=\"label\" [required]=\"required\"></sd-label>\r\n }\r\n </ng-content>\r\n }\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 [class.sd-form-tooltip]=\"!!tooltip\"\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=\"below\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n <input\r\n aria-hidden=\"true\"\r\n [id]=\"id\"\r\n [formControl]=\"formControl\"\r\n [type]=\"type\"\r\n #control\r\n matInput\r\n [placeholder]=\"placeholder || label || ''\"\r\n (keyup.enter)=\"onKeyupEnter()\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"required\"\r\n [readonly]=\"readonly\"\r\n [autocomplete]=\"id\"\r\n autocorrect=\"off\"\r\n [step]=\"1\"\r\n [attr.data-autoId]=\"autoId\" />\r\n @if (maxlength && !formControl.disabled) {\r\n <span matSuffix>{{ formControl.value?.length || 0 }}/{{ maxlength }}</span>\r\n }\r\n @if (sdSuffixDef?.templateRef) {\r\n <ng-container matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdSuffixDef!.templateRef\"></ng-container>\r\n </ng-container>\r\n }\r\n @if (formControl.errors?.['required']) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ 'Vui l\u00F2ng nh\u1EADp th\u00F4ng tin' }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['maxlength']) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ 'S\u1ED1 k\u00FD t\u1EF1 t\u1ED1i \u0111a: ' }} {{ maxlength }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['pattern']) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ patternErrorMessage || '\u0110\u1ECBnh d\u1EA1ng kh\u00F4ng h\u1EE3p l\u1EC7' }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['customValidator']) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ formControl.errors?.['customValidator'] }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['inlineError']) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ inlineError }}\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n <div *ngIf=\"tooltip\" class=\"sd-tooltip\">\r\n <mat-icon (click)=\"sdTooltip.toggle()\" [matTooltip]=\"formControl.value || tooltip\" matSuffix #sdTooltip=\"matTooltip\">info</mat-icon>\r\n </div>\r\n }\r\n </div>\r\n}\r\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host ::ng-deep .mat-mdc-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-tooltip{display:inline-block;text-align:center;margin:auto;width:30px}:host{padding-top:5px;display:block}.sd-md:hover .btn-copy{visibility:visible}\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"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }, { kind: "component", type: SdView, selector: "sd-view", inputs: ["label", "value", "display", "hyperlink", "labelTemplate", "valueTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
210
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
211
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdInput, isStandalone: true, selector: "sd-input", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, appearanceInput: { classPropertyName: "appearanceInput", publicName: "appearance", 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 }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, blurOnEnter: { classPropertyName: "blurOnEnter", publicName: "blurOnEnter", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", 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 }, minlength: { classPropertyName: "minlength", publicName: "minlength", 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 }, patternErrorMessage: { classPropertyName: "patternErrorMessage", publicName: "patternErrorMessage", 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 }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, valueModel: { classPropertyName: "valueModel", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueModel: "modelChange", sdChange: "sdChange", sdFocus: "sdFocus", sdBlur: "sdBlur", keyupEnter: "keyupEnter", sdFocusForceBlur: "sdFocusForceBlur" }, queries: [{ propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }, { propertyName: "sdSuffixDef", first: true, predicate: SdSuffixDefDirective, descendants: true, isSignal: true }, { propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "control", first: true, predicate: ["control"], 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 hText = helperText();\r\n@let ttip = tooltip();\r\n@let maxLen = maxlength();\r\n@let req = required();\r\n\r\n@if (viewed()) {\r\n <sd-view\r\n [label]=\"lbl\"\r\n [labelTemplate]=\"sdLabelTemplate()\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"sdValueTemplate()\">\r\n </sd-view>\r\n} @else {\r\n @if (!app) {\r\n <ng-content select=\"[sdLabel]\">\r\n @if (lbl) {\r\n <sd-label [label]=\"lbl\" [required]=\"req\"></sd-label>\r\n }\r\n </ng-content>\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 *ngTemplateOutlet=\"viewDef!.templateRef; context: { value: formControl.value }\"> </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 [class.sd-form-tooltip]=\"!!ttip\"\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=\"below\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n \r\n <input\r\n aria-hidden=\"true\"\r\n [id]=\"id\"\r\n [formControl]=\"formControl\"\r\n [type]=\"type()\"\r\n #control\r\n matInput\r\n [placeholder]=\"placeholder() || lbl || ''\"\r\n (keyup.enter)=\"onKeyupEnter()\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"req\"\r\n [readonly]=\"readonly()\"\r\n [autocomplete]=\"id\"\r\n autocorrect=\"off\"\r\n [step]=\"1\"\r\n [attr.data-autoId]=\"autoId()\" />\r\n\r\n @if (maxLen && !formControl.disabled) {\r\n <span matSuffix>{{ formControl.value?.length || 0 }}/{{ maxLen }}</span>\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\r\n @if (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.errors?.['maxlength']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'S\u1ED1 k\u00FD t\u1EF1 t\u1ED1i \u0111a: ' }} {{ maxLen }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['pattern']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ resolvedPatternErrorMsg() || '\u0110\u1ECBnh d\u1EA1ng kh\u00F4ng h\u1EE3p l\u1EC7' }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (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.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 @if (ttip) {\r\n <div class=\"sd-tooltip\">\r\n <mat-icon (click)=\"sdTooltip.toggle()\" [matTooltip]=\"formControl.value || ttip\" matSuffix #sdTooltip=\"matTooltip\">info</mat-icon>\r\n </div>\r\n }\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 ::ng-deep .mat-mdc-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-tooltip{display:inline-block;text-align:center;margin:auto;width:30px}:host{padding-top:5px;display:block}.sd-md:hover .btn-copy{visibility:visible}\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: "ngmodule", type: MatButtonModule }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }, { kind: "component", type: SdView, selector: "sd-view", inputs: ["label", "value", "display", "hyperlink", "labelTemplate", "valueTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
277
212
|
}
|
|
278
213
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdInput, decorators: [{
|
|
279
214
|
type: Component,
|
|
@@ -287,105 +222,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
|
|
|
287
222
|
MatTooltipModule,
|
|
288
223
|
MatButtonModule,
|
|
289
224
|
SdLabel,
|
|
290
|
-
SdView
|
|
291
|
-
], template: "@if (viewed) {\r\n <sd-view\r\n [label]=\"
|
|
292
|
-
}], ctorParameters: () => [
|
|
293
|
-
type: Inject,
|
|
294
|
-
args: [SD_FORM_CONFIGURATION]
|
|
295
|
-
}, {
|
|
296
|
-
type: Optional
|
|
297
|
-
}] }], propDecorators: { sdLabelTemplate: [{
|
|
298
|
-
type: ContentChild,
|
|
299
|
-
args: ['sdLabel']
|
|
300
|
-
}], sdValueTemplate: [{
|
|
301
|
-
type: ContentChild,
|
|
302
|
-
args: ['sdValue']
|
|
303
|
-
}], _autoId: [{
|
|
304
|
-
type: Input,
|
|
305
|
-
args: ['autoId']
|
|
306
|
-
}], _name: [{
|
|
307
|
-
type: Input,
|
|
308
|
-
args: ['name']
|
|
309
|
-
}], appearance: [{
|
|
310
|
-
type: Input
|
|
311
|
-
}], size: [{
|
|
312
|
-
type: Input
|
|
313
|
-
}], _form: [{
|
|
314
|
-
type: Input,
|
|
315
|
-
args: ['form']
|
|
316
|
-
}], _label: [{
|
|
317
|
-
type: Input,
|
|
318
|
-
args: ['label']
|
|
319
|
-
}], _helperText: [{
|
|
320
|
-
type: Input,
|
|
321
|
-
args: ['helperText']
|
|
322
|
-
}], _placeholder: [{
|
|
323
|
-
type: Input,
|
|
324
|
-
args: ['placeholder']
|
|
325
|
-
}], type: [{
|
|
326
|
-
type: Input
|
|
327
|
-
}], _hideInlineError: [{
|
|
328
|
-
type: Input,
|
|
329
|
-
args: ['hideInlineError']
|
|
330
|
-
}], _blurOnEnter: [{
|
|
331
|
-
type: Input,
|
|
332
|
-
args: ['blurOnEnter']
|
|
333
|
-
}], model: [{
|
|
334
|
-
type: Input
|
|
335
|
-
}], modelChange: [{
|
|
336
|
-
type: Output
|
|
337
|
-
}], _required: [{
|
|
338
|
-
type: Input,
|
|
339
|
-
args: ['required']
|
|
340
|
-
}], _readonly: [{
|
|
341
|
-
type: Input,
|
|
342
|
-
args: ['readonly']
|
|
343
|
-
}], _minlength: [{
|
|
344
|
-
type: Input,
|
|
345
|
-
args: ['minlength']
|
|
346
|
-
}], _maxlength: [{
|
|
347
|
-
type: Input,
|
|
348
|
-
args: ['maxlength']
|
|
349
|
-
}], _pattern: [{
|
|
350
|
-
type: Input,
|
|
351
|
-
args: ['pattern']
|
|
352
|
-
}], _patternErrorMessage: [{
|
|
353
|
-
type: Input,
|
|
354
|
-
args: ['patternErrorMessage']
|
|
355
|
-
}], _validator: [{
|
|
356
|
-
type: Input,
|
|
357
|
-
args: ['validator']
|
|
358
|
-
}], _inlineError: [{
|
|
359
|
-
type: Input,
|
|
360
|
-
args: ['inlineError']
|
|
361
|
-
}], disabled: [{
|
|
362
|
-
type: Input
|
|
363
|
-
}], _viewed: [{
|
|
364
|
-
type: Input,
|
|
365
|
-
args: ['viewed']
|
|
366
|
-
}], hyperlink: [{
|
|
367
|
-
type: Input
|
|
368
|
-
}], tooltip: [{
|
|
369
|
-
type: Input
|
|
370
|
-
}], sdChange: [{
|
|
371
|
-
type: Output
|
|
372
|
-
}], sdFocus: [{
|
|
373
|
-
type: Output
|
|
374
|
-
}], sdBlur: [{
|
|
375
|
-
type: Output
|
|
376
|
-
}], sdFocusForceBlur: [{
|
|
377
|
-
type: Output
|
|
378
|
-
}], keyupEnter: [{
|
|
225
|
+
SdView,
|
|
226
|
+
], template: "@let lbl = label();\r\n@let app = appearance();\r\n@let hideErr = hideInlineError();\r\n@let viewDef = sdViewDef();\r\n@let hText = helperText();\r\n@let ttip = tooltip();\r\n@let maxLen = maxlength();\r\n@let req = required();\r\n\r\n@if (viewed()) {\r\n <sd-view\r\n [label]=\"lbl\"\r\n [labelTemplate]=\"sdLabelTemplate()\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"sdValueTemplate()\">\r\n </sd-view>\r\n} @else {\r\n @if (!app) {\r\n <ng-content select=\"[sdLabel]\">\r\n @if (lbl) {\r\n <sd-label [label]=\"lbl\" [required]=\"req\"></sd-label>\r\n }\r\n </ng-content>\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 *ngTemplateOutlet=\"viewDef!.templateRef; context: { value: formControl.value }\"> </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 [class.sd-form-tooltip]=\"!!ttip\"\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=\"below\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n \r\n <input\r\n aria-hidden=\"true\"\r\n [id]=\"id\"\r\n [formControl]=\"formControl\"\r\n [type]=\"type()\"\r\n #control\r\n matInput\r\n [placeholder]=\"placeholder() || lbl || ''\"\r\n (keyup.enter)=\"onKeyupEnter()\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"req\"\r\n [readonly]=\"readonly()\"\r\n [autocomplete]=\"id\"\r\n autocorrect=\"off\"\r\n [step]=\"1\"\r\n [attr.data-autoId]=\"autoId()\" />\r\n\r\n @if (maxLen && !formControl.disabled) {\r\n <span matSuffix>{{ formControl.value?.length || 0 }}/{{ maxLen }}</span>\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\r\n @if (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.errors?.['maxlength']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'S\u1ED1 k\u00FD t\u1EF1 t\u1ED1i \u0111a: ' }} {{ maxLen }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['pattern']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ resolvedPatternErrorMsg() || '\u0110\u1ECBnh d\u1EA1ng kh\u00F4ng h\u1EE3p l\u1EC7' }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (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.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 @if (ttip) {\r\n <div class=\"sd-tooltip\">\r\n <mat-icon (click)=\"sdTooltip.toggle()\" [matTooltip]=\"formControl.value || ttip\" matSuffix #sdTooltip=\"matTooltip\">info</mat-icon>\r\n </div>\r\n }\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 ::ng-deep .mat-mdc-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-tooltip{display:inline-block;text-align:center;margin:auto;width:30px}:host{padding-top:5px;display:block}.sd-md:hover .btn-copy{visibility:visible}\n"] }]
|
|
227
|
+
}], ctorParameters: () => [], propDecorators: { sdFocusForceBlur: [{
|
|
379
228
|
type: Output
|
|
380
|
-
}], control: [{
|
|
381
|
-
type: ViewChild,
|
|
382
|
-
args: ['control']
|
|
383
|
-
}], sdSuffixDef: [{
|
|
384
|
-
type: ContentChild,
|
|
385
|
-
args: [SdSuffixDefDirective]
|
|
386
|
-
}], sdViewDef: [{
|
|
387
|
-
type: ContentChild,
|
|
388
|
-
args: [SdViewDefDirective]
|
|
389
229
|
}] } });
|
|
390
230
|
function backendErrorValidator(backendErrorMessage) {
|
|
391
231
|
return (control) => {
|