@sd-angular/core 19.0.0-beta.70 → 19.0.0-beta.71
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 +1 -2
- package/components/modal/index.d.ts +1 -1
- package/components/modal/src/modal.component.d.ts +24 -0
- package/fesm2022/sd-angular-core-components-document-builder.mjs +1 -1
- package/fesm2022/sd-angular-core-components-document-builder.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-modal.mjs +57 -91
- package/fesm2022/sd-angular-core-components-modal.mjs.map +1 -1
- 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 +2 -2
- package/fesm2022/sd-angular-core-components-side-drawer.mjs.map +1 -1
- 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-upload-file.mjs +1 -1
- package/fesm2022/sd-angular-core-components-upload-file.mjs.map +1 -1
- package/fesm2022/sd-angular-core-components-workflow.mjs +11 -11
- package/fesm2022/sd-angular-core-components-workflow.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-chip-calendar.mjs +158 -197
- package/fesm2022/sd-angular-core-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sd-angular-core-forms-chip.mjs +173 -203
- package/fesm2022/sd-angular-core-forms-chip.mjs.map +1 -1
- package/forms/chip/src/chip.component.d.ts +35 -44
- package/forms/chip-calendar/src/chip-calendar.component.d.ts +35 -42
- package/package.json +68 -68
- package/sd-angular-core-19.0.0-beta.71.tgz +0 -0
- package/components/modal/src/modal/modal.component.d.ts +0 -31
- package/sd-angular-core-19.0.0-beta.70.tgz +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Pipe,
|
|
2
|
+
import { Pipe, inject, ChangeDetectorRef, input, booleanAttribute, output, contentChild, effect, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { ENTER, COMMA } from '@angular/cdk/keycodes';
|
|
4
4
|
import * as i1 from '@angular/common';
|
|
5
5
|
import { CommonModule } from '@angular/common';
|
|
6
6
|
import * as i2 from '@angular/forms';
|
|
7
|
-
import {
|
|
7
|
+
import { FormControl, NgForm, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
8
8
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
9
9
|
import * as i6 from '@angular/material/chips';
|
|
10
10
|
import { MatChipsModule } from '@angular/material/chips';
|
|
@@ -16,7 +16,9 @@ import { MatInputModule } from '@angular/material/input';
|
|
|
16
16
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
17
17
|
import * as i4 from '@angular/material/tooltip';
|
|
18
18
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
19
|
+
import { SdView } from '@sd-angular/core/components/view';
|
|
19
20
|
import { SdViewDefDirective, SdLabelDefDirective } from '@sd-angular/core/forms/directives';
|
|
21
|
+
import { SdLabel } from '@sd-angular/core/forms/label';
|
|
20
22
|
import { SdFormControl } from '@sd-angular/core/forms/models';
|
|
21
23
|
import { Subscription } from 'rxjs';
|
|
22
24
|
import * as uuid from 'uuid';
|
|
@@ -39,7 +41,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
|
|
|
39
41
|
}]
|
|
40
42
|
}], ctorParameters: () => [] });
|
|
41
43
|
|
|
42
|
-
class
|
|
44
|
+
class SdChipErrorStateMatcher {
|
|
43
45
|
formControl;
|
|
44
46
|
constructor(formControl) {
|
|
45
47
|
this.formControl = formControl;
|
|
@@ -50,233 +52,249 @@ class SdChipErrotStateMatcher {
|
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
class SdChip {
|
|
53
|
-
ref;
|
|
54
|
-
|
|
55
|
-
set _autoId(val) {
|
|
56
|
-
if (!val) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
this.autoId = `forms-chip-${val}`;
|
|
60
|
-
}
|
|
55
|
+
#ref = inject(ChangeDetectorRef);
|
|
56
|
+
#subscription = new Subscription();
|
|
61
57
|
#name = uuid.v4();
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
#form;
|
|
59
|
+
// Signals - inputs
|
|
60
|
+
autoId = input();
|
|
61
|
+
name = input();
|
|
62
|
+
appearance = input('outline');
|
|
63
|
+
floatLabel = input('auto');
|
|
64
|
+
size = input('md');
|
|
65
|
+
form = input();
|
|
66
|
+
label = input('');
|
|
67
|
+
placeholder = input();
|
|
68
|
+
removable = input(true);
|
|
69
|
+
hideInlineError = input(false, { transform: booleanAttribute });
|
|
70
|
+
model = input();
|
|
71
|
+
required = input(false, { transform: booleanAttribute });
|
|
72
|
+
min = input(0);
|
|
73
|
+
max = input(0);
|
|
74
|
+
addable = input(true, { transform: booleanAttribute });
|
|
75
|
+
disabled = input(false, { transform: booleanAttribute });
|
|
76
|
+
viewed = input(false, { transform: booleanAttribute });
|
|
77
|
+
hyperlink = input();
|
|
78
|
+
// Signals - outputs
|
|
79
|
+
modelChange = output();
|
|
80
|
+
sdChange = output();
|
|
81
|
+
// Template properties
|
|
82
|
+
input;
|
|
83
|
+
sdViewDef = contentChild(SdViewDefDirective);
|
|
84
|
+
sdLabelDef = contentChild(SdLabelDefDirective);
|
|
85
|
+
sdLabelTemplate = contentChild('sdLabel');
|
|
86
|
+
sdValueTemplate = contentChild('sdValue');
|
|
87
|
+
// Local states
|
|
88
|
+
#isBlurring = false;
|
|
89
|
+
isFocused = false;
|
|
90
|
+
#inputControl = new FormControl();
|
|
91
|
+
#formControl = new SdFormControl();
|
|
92
|
+
#matcher;
|
|
69
93
|
separatorKeysCodes = [ENTER, COMMA];
|
|
70
94
|
selectable = true;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (
|
|
76
|
-
|
|
95
|
+
constructor() {
|
|
96
|
+
// Update form reference
|
|
97
|
+
effect(() => {
|
|
98
|
+
const formInput = this.form();
|
|
99
|
+
if (formInput) {
|
|
100
|
+
if (formInput instanceof NgForm) {
|
|
101
|
+
this.#form = formInput.form;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this.#form = formInput;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
// Update validators
|
|
109
|
+
effect(() => {
|
|
110
|
+
this.required();
|
|
111
|
+
this.min();
|
|
112
|
+
this.max();
|
|
113
|
+
this.#updateValidator();
|
|
114
|
+
});
|
|
115
|
+
// Update model
|
|
116
|
+
effect(() => {
|
|
117
|
+
const values = this.model();
|
|
118
|
+
if (Array.isArray(values)) {
|
|
119
|
+
this.#formControl.setValue(values);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
// Handle disabled state
|
|
123
|
+
effect(() => {
|
|
124
|
+
const isDisabled = this.disabled();
|
|
125
|
+
if (isDisabled) {
|
|
126
|
+
this.#formControl.disable();
|
|
127
|
+
this.#inputControl.disable();
|
|
77
128
|
}
|
|
78
129
|
else {
|
|
79
|
-
this.#
|
|
130
|
+
this.#formControl.enable();
|
|
131
|
+
this.#inputControl.enable();
|
|
80
132
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
this
|
|
96
|
-
}
|
|
97
|
-
// Model
|
|
98
|
-
set model(values) {
|
|
99
|
-
if (!Array.isArray(values)) {
|
|
100
|
-
values = [];
|
|
101
|
-
}
|
|
102
|
-
this.formControl.setValue(values);
|
|
103
|
-
}
|
|
104
|
-
// Validator
|
|
105
|
-
required = false;
|
|
106
|
-
set _required(val) {
|
|
107
|
-
this.required = val === '' || !!val;
|
|
108
|
-
this.#updateValidator();
|
|
109
|
-
}
|
|
110
|
-
min;
|
|
111
|
-
set pMin(val) {
|
|
112
|
-
this.min = +val || 0;
|
|
113
|
-
this.#updateValidator();
|
|
133
|
+
});
|
|
134
|
+
// Setup auto id and name
|
|
135
|
+
effect(() => {
|
|
136
|
+
const autoIdVal = this.autoId();
|
|
137
|
+
if (autoIdVal) {
|
|
138
|
+
// autoId is just for form association, no further processing needed
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
effect(() => {
|
|
142
|
+
const nameVal = this.name();
|
|
143
|
+
if (nameVal) {
|
|
144
|
+
this.#name = nameVal;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
this.#matcher = new SdChipErrorStateMatcher(this.#formControl);
|
|
114
148
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
this.max = +val || 0;
|
|
118
|
-
this.#updateValidator();
|
|
149
|
+
get formControl() {
|
|
150
|
+
return this.#formControl;
|
|
119
151
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
set disabled(val) {
|
|
123
|
-
val = val === '' || val;
|
|
124
|
-
if (val) {
|
|
125
|
-
this.formControl.disable();
|
|
126
|
-
this.inputControl.disable();
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
this.formControl.enable();
|
|
130
|
-
this.inputControl.enable();
|
|
131
|
-
}
|
|
152
|
+
get inputControl() {
|
|
153
|
+
return this.#inputControl;
|
|
132
154
|
}
|
|
133
|
-
sdChange = new EventEmitter();
|
|
134
|
-
input;
|
|
135
|
-
sdView;
|
|
136
|
-
sdLabelDef;
|
|
137
|
-
isBlurring = false;
|
|
138
|
-
isFocused = false;
|
|
139
|
-
inputControl = new FormControl();
|
|
140
|
-
formControl = new SdFormControl();
|
|
141
|
-
matcher = new SdChipErrotStateMatcher(this.formControl);
|
|
142
|
-
/**
|
|
143
|
-
* Tổng hợp error message để hiển thị trong tooltip khi hideInlineError = true.
|
|
144
|
-
* Dùng getter (không phải computed) vì đây là component cũ dùng @Input decorator.
|
|
145
|
-
*/
|
|
146
155
|
get errorTooltipMessage() {
|
|
147
|
-
const errors = this
|
|
156
|
+
const errors = this.#formControl.errors;
|
|
148
157
|
if (!errors)
|
|
149
158
|
return undefined;
|
|
150
159
|
if (errors['required'])
|
|
151
160
|
return 'Vui lòng nhập thông tin';
|
|
152
161
|
if (errors['minlength'])
|
|
153
|
-
return `Vui lòng nhập ít nhất ${this.min} giá trị`;
|
|
162
|
+
return `Vui lòng nhập ít nhất ${this.min()} giá trị`;
|
|
154
163
|
if (errors['maxlength'])
|
|
155
|
-
return `Vui lòng nhập tối đa ${this.max} giá trị`;
|
|
164
|
+
return `Vui lòng nhập tối đa ${this.max()} giá trị`;
|
|
156
165
|
return undefined;
|
|
157
166
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
this.ref = ref;
|
|
167
|
+
get matcher() {
|
|
168
|
+
return this.#matcher;
|
|
161
169
|
}
|
|
162
170
|
ngAfterViewInit() {
|
|
163
|
-
this.#subscription.add(this
|
|
164
|
-
this
|
|
171
|
+
this.#subscription.add(this.#formControl.sdChanges.subscribe(() => {
|
|
172
|
+
this.#ref.markForCheck();
|
|
165
173
|
}));
|
|
166
|
-
this.#form?.addControl(this.#name, this
|
|
174
|
+
this.#form?.addControl(this.#name, this.#formControl);
|
|
167
175
|
}
|
|
168
176
|
ngOnDestroy() {
|
|
169
177
|
this.#form?.removeControl(this.#name);
|
|
170
178
|
this.#subscription.unsubscribe();
|
|
171
179
|
}
|
|
172
180
|
#updateValidator = () => {
|
|
173
|
-
this
|
|
174
|
-
this
|
|
181
|
+
this.#formControl.clearValidators();
|
|
182
|
+
this.#formControl.clearAsyncValidators();
|
|
175
183
|
const validators = [];
|
|
176
184
|
const asyncValidators = [];
|
|
177
|
-
if (this.required) {
|
|
185
|
+
if (this.required()) {
|
|
178
186
|
validators.push(Validators.required);
|
|
179
187
|
}
|
|
180
|
-
if (this.min > 0) {
|
|
181
|
-
validators.push(Validators.minLength(this.min));
|
|
188
|
+
if (this.min() > 0) {
|
|
189
|
+
validators.push(Validators.minLength(this.min()));
|
|
182
190
|
}
|
|
183
|
-
if (this.max > 0) {
|
|
184
|
-
validators.push(Validators.maxLength(this.max));
|
|
191
|
+
if (this.max() > 0) {
|
|
192
|
+
validators.push(Validators.maxLength(this.max()));
|
|
185
193
|
}
|
|
186
|
-
this
|
|
187
|
-
this
|
|
188
|
-
this
|
|
194
|
+
this.#formControl.setValidators(validators);
|
|
195
|
+
this.#formControl.setAsyncValidators(asyncValidators);
|
|
196
|
+
this.#formControl.updateValueAndValidity();
|
|
189
197
|
};
|
|
190
|
-
|
|
198
|
+
#add = (event) => {
|
|
191
199
|
const value = (event.value ?? '').toString().trim();
|
|
192
|
-
const values = this
|
|
193
|
-
if (value && this.addable && !values.includes(value)) {
|
|
200
|
+
const values = this.#formControl.value ?? [];
|
|
201
|
+
if (value && this.addable() && !values.includes(value)) {
|
|
194
202
|
values.push(value);
|
|
195
|
-
this
|
|
196
|
-
this.modelChange.emit(this
|
|
197
|
-
this.sdChange.emit(this
|
|
203
|
+
this.#formControl.setValue(values);
|
|
204
|
+
this.modelChange.emit(this.#formControl.value);
|
|
205
|
+
this.sdChange.emit(this.#formControl.value);
|
|
198
206
|
}
|
|
199
207
|
this.input.nativeElement.value = '';
|
|
200
|
-
this
|
|
208
|
+
this.#inputControl.setValue('');
|
|
201
209
|
};
|
|
202
|
-
|
|
210
|
+
#clickChip = ($event, item) => {
|
|
203
211
|
$event.stopPropagation();
|
|
204
212
|
$event.stopImmediatePropagation();
|
|
205
|
-
if (!this
|
|
206
|
-
this
|
|
213
|
+
if (!this.#formControl.disabled) {
|
|
214
|
+
this.#focus();
|
|
207
215
|
}
|
|
208
216
|
};
|
|
209
|
-
|
|
210
|
-
const values = this
|
|
217
|
+
#remove = (item) => {
|
|
218
|
+
const values = this.#formControl.value ?? [];
|
|
211
219
|
if (typeof item === 'string' || typeof item === 'number') {
|
|
212
|
-
this
|
|
213
|
-
this.modelChange.emit(this
|
|
214
|
-
this.sdChange.emit(this
|
|
220
|
+
this.#formControl.setValue(values.filter(value => item !== value));
|
|
221
|
+
this.modelChange.emit(this.#formControl.value);
|
|
222
|
+
this.sdChange.emit(this.#formControl.value);
|
|
215
223
|
}
|
|
216
|
-
this
|
|
217
|
-
this
|
|
224
|
+
this.#inputControl.setValue('');
|
|
225
|
+
this.#focus();
|
|
218
226
|
};
|
|
219
|
-
|
|
227
|
+
#select = (event) => {
|
|
220
228
|
const item = event.option.value;
|
|
221
|
-
const values = this
|
|
229
|
+
const values = this.#formControl.value ?? [];
|
|
222
230
|
if (item) {
|
|
223
231
|
if (typeof item === 'string' || typeof item === 'number') {
|
|
224
232
|
if (!values.includes(item)) {
|
|
225
233
|
values.push(item);
|
|
226
|
-
this
|
|
227
|
-
this.modelChange.emit(this
|
|
228
|
-
this.sdChange.emit(this
|
|
234
|
+
this.#formControl.setValue(values);
|
|
235
|
+
this.modelChange.emit(this.#formControl.value);
|
|
236
|
+
this.sdChange.emit(this.#formControl.value);
|
|
229
237
|
}
|
|
230
238
|
}
|
|
231
239
|
this.input.nativeElement.value = '';
|
|
232
|
-
this
|
|
240
|
+
this.#inputControl.setValue('', {
|
|
233
241
|
emitEvent: false,
|
|
234
242
|
});
|
|
235
243
|
}
|
|
236
244
|
};
|
|
237
|
-
onFocus = () => {
|
|
245
|
+
#onFocus = () => {
|
|
238
246
|
this.isFocused = true;
|
|
239
|
-
this
|
|
240
|
-
this
|
|
247
|
+
this.#isBlurring = false;
|
|
248
|
+
this.#inputControl.setValue('');
|
|
241
249
|
};
|
|
242
|
-
onBlur = () => {
|
|
243
|
-
this
|
|
250
|
+
#onBlur = () => {
|
|
251
|
+
this.#isBlurring = true;
|
|
244
252
|
setTimeout(() => {
|
|
245
|
-
if (this
|
|
253
|
+
if (this.#isBlurring) {
|
|
246
254
|
this.isFocused = false;
|
|
247
|
-
this
|
|
255
|
+
this.#inputControl.setValue('', {
|
|
248
256
|
emitEvent: false,
|
|
249
257
|
});
|
|
250
|
-
this
|
|
258
|
+
this.#ref.detectChanges();
|
|
251
259
|
}
|
|
252
260
|
}, 150);
|
|
253
261
|
};
|
|
254
|
-
onClick = () => {
|
|
255
|
-
if (this.
|
|
256
|
-
if (!this
|
|
257
|
-
this
|
|
262
|
+
#onClick = () => {
|
|
263
|
+
if (this.sdViewDef()?.templateRef) {
|
|
264
|
+
if (!this.#formControl.disabled && !this.isFocused) {
|
|
265
|
+
this.#focus();
|
|
258
266
|
}
|
|
259
267
|
}
|
|
260
268
|
};
|
|
261
|
-
focus = () => {
|
|
269
|
+
#focus = () => {
|
|
262
270
|
this.isFocused = true;
|
|
263
|
-
this
|
|
271
|
+
this.#isBlurring = false;
|
|
264
272
|
setTimeout(() => {
|
|
265
273
|
if (this.isFocused) {
|
|
266
274
|
this.input?.nativeElement?.focus();
|
|
267
275
|
}
|
|
268
276
|
}, 100);
|
|
269
277
|
};
|
|
270
|
-
|
|
278
|
+
#clear = ($event) => {
|
|
271
279
|
$event?.stopPropagation();
|
|
272
|
-
this
|
|
273
|
-
this
|
|
274
|
-
this.modelChange.emit(this
|
|
275
|
-
this.sdChange.emit(this
|
|
276
|
-
this
|
|
280
|
+
this.#inputControl.setValue('');
|
|
281
|
+
this.#formControl.setValue([]);
|
|
282
|
+
this.modelChange.emit(this.#formControl.value);
|
|
283
|
+
this.sdChange.emit(this.#formControl.value);
|
|
284
|
+
this.#ref.detectChanges();
|
|
277
285
|
};
|
|
278
|
-
|
|
279
|
-
|
|
286
|
+
// Public method to expose private methods for template
|
|
287
|
+
onAdd = (event) => this.#add(event);
|
|
288
|
+
onClickChip = (event, item) => this.#clickChip(event, item);
|
|
289
|
+
onRemove = (item) => this.#remove(item);
|
|
290
|
+
onSelect = (event) => this.#select(event);
|
|
291
|
+
onFocus = () => this.#onFocus();
|
|
292
|
+
onBlur = () => this.#onBlur();
|
|
293
|
+
onClick = () => this.#onClick();
|
|
294
|
+
focus = () => this.#focus();
|
|
295
|
+
onClear = ($event) => this.#clear($event);
|
|
296
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
297
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdChip, isStandalone: true, selector: "sd-chip", inputs: { autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, floatLabel: { classPropertyName: "floatLabel", publicName: "floatLabel", 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 }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, addable: { classPropertyName: "addable", publicName: "addable", 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 }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { modelChange: "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: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "@let _lbl = label();\r\n@let _app = appearance();\r\n@let _req = required();\r\n@let _viewed = viewed();\r\n@let _hideErr = hideInlineError();\r\n@let _viewDef = sdViewDef();\r\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\r\n@let _valueTemplate = (sdValueTemplate() ?? _viewDef?.templateRef) || undefined;\r\n@let _errMsg = errorTooltipMessage;\r\n\r\n@if (_viewed) {\r\n <sd-view\r\n [label]=\"_lbl\"\r\n [labelTemplate]=\"_labelTemplate\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"_valueTemplate\">\r\n </sd-view>\r\n} @else {\r\n @if (!_app && _labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\r\n }\r\n @if (!_app && _lbl && !_labelTemplate) {\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 (keydown.enter)=\"onClick()\"\r\n tabindex=\"0\"\r\n (click)=\"onClick()\">\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 [appearance]=\"_app\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_app && _lbl) {\r\n <mat-label>{{ _lbl }}</mat-label>\r\n }\r\n <mat-chip-grid [formControl]=\"formControl\" #chipList [class.sd-md]=\"size() === 'md'\" [class.sd-sm]=\"size() === 'sm'\">\r\n @for (item of formControl.value; track $index) {\r\n @if (item) {\r\n <mat-chip-row\r\n [class.sd-md]=\"size() === 'md'\"\r\n [class.sd-sm]=\"size() === 'sm'\"\r\n [removable]=\"removable()\"\r\n (removed)=\"onRemove(item)\"\r\n [disabled]=\"inputControl.disabled\"\r\n (click)=\"onClickChip($event, item)\">\r\n <span>{{ item }}</span>\r\n @if (!inputControl.disabled && item | sdRemovableChip: removable()) {\r\n <mat-icon matChipRemove>cancel</mat-icon>\r\n }\r\n </mat-chip-row>\r\n }\r\n }\r\n <input\r\n class=\"sd-chip-input\"\r\n [formControl]=\"inputControl\"\r\n [placeholder]=\"placeholder() || _lbl\"\r\n [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\r\n (matChipInputTokenEnd)=\"onAdd($event)\"\r\n autocomplete=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"_req\"\r\n matInput\r\n [attr.data-autoId]=\"autoId()\"\r\n #input />\r\n </mat-chip-grid>\r\n @if (_hideErr && _errMsg && formControl.touched) {\r\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errMsg\" matTooltipPosition=\"above\"> error </mat-icon>\r\n }\r\n\r\n @if (!_hideErr && _errMsg && formControl.touched) {\r\n <mat-error>{{ _errMsg }}</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}\r\n", styles: [":host{padding-top:5px;display:block}.sd-chip-input{margin-top:0!important}:host ::ng-deep .mat-mdc-form-field.no-padding-wrapper .mat-mdc-text-field-wrapper{padding-bottom:0}:host ::ng-deep mat-form-field.c-md .mat-mdc-standard-chip{padding:7px 10px;min-height:26px}:host ::ng-deep mat-form-field.c-md .mat-mdc-standard-chip .mat-mdc-chip-trailing-icon{padding:7px 7px 7px 10px}:host ::ng-deep .mat-mdc-chip-row.sd-sm{--mdc-chip-label-text-size: 12px;--mdc-chip-container-height: 20px}:host ::ng-deep .mat-mdc-chip-set.sd-md{margin-top:10px}:host ::ng-deep .mat-mdc-chip-set.sd-sm{margin-top:2px}.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: MatInputModule }, { kind: "directive", type: i3.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: "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: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i6.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i6.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i6.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i6.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { 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"] }, { kind: "pipe", type: SdRemovableChipPipe, name: "sdRemovableChip" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
280
298
|
}
|
|
281
299
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdChip, decorators: [{
|
|
282
300
|
type: Component,
|
|
@@ -291,61 +309,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
|
|
|
291
309
|
MatIconModule,
|
|
292
310
|
MatProgressSpinnerModule,
|
|
293
311
|
MatChipsModule,
|
|
312
|
+
SdLabel,
|
|
313
|
+
SdView,
|
|
294
314
|
SdRemovableChipPipe,
|
|
295
|
-
], template: "@let
|
|
296
|
-
}], ctorParameters: () => [
|
|
297
|
-
type: Input,
|
|
298
|
-
args: ['autoId']
|
|
299
|
-
}], _name: [{
|
|
300
|
-
type: Input,
|
|
301
|
-
args: ['name']
|
|
302
|
-
}], appearance: [{
|
|
303
|
-
type: Input
|
|
304
|
-
}], floatLabel: [{
|
|
305
|
-
type: Input
|
|
306
|
-
}], size: [{
|
|
307
|
-
type: Input
|
|
308
|
-
}], form: [{
|
|
309
|
-
type: Input
|
|
310
|
-
}], _addable: [{
|
|
311
|
-
type: Input,
|
|
312
|
-
args: ['addable']
|
|
313
|
-
}], label: [{
|
|
314
|
-
type: Input
|
|
315
|
-
}], placeholder: [{
|
|
316
|
-
type: Input
|
|
317
|
-
}], _removable: [{
|
|
318
|
-
type: Input,
|
|
319
|
-
args: ['removable']
|
|
320
|
-
}], _hideInlineError: [{
|
|
321
|
-
type: Input,
|
|
322
|
-
args: ['hideInlineError']
|
|
323
|
-
}], model: [{
|
|
324
|
-
type: Input
|
|
325
|
-
}], _required: [{
|
|
326
|
-
type: Input,
|
|
327
|
-
args: ['required']
|
|
328
|
-
}], pMin: [{
|
|
329
|
-
type: Input,
|
|
330
|
-
args: ['min']
|
|
331
|
-
}], pMax: [{
|
|
332
|
-
type: Input,
|
|
333
|
-
args: ['max']
|
|
334
|
-
}], modelChange: [{
|
|
335
|
-
type: Output
|
|
336
|
-
}], disabled: [{
|
|
337
|
-
type: Input
|
|
338
|
-
}], sdChange: [{
|
|
339
|
-
type: Output
|
|
340
|
-
}], input: [{
|
|
315
|
+
], template: "@let _lbl = label();\r\n@let _app = appearance();\r\n@let _req = required();\r\n@let _viewed = viewed();\r\n@let _hideErr = hideInlineError();\r\n@let _viewDef = sdViewDef();\r\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\r\n@let _valueTemplate = (sdValueTemplate() ?? _viewDef?.templateRef) || undefined;\r\n@let _errMsg = errorTooltipMessage;\r\n\r\n@if (_viewed) {\r\n <sd-view\r\n [label]=\"_lbl\"\r\n [labelTemplate]=\"_labelTemplate\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"_valueTemplate\">\r\n </sd-view>\r\n} @else {\r\n @if (!_app && _labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\r\n }\r\n @if (!_app && _lbl && !_labelTemplate) {\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 (keydown.enter)=\"onClick()\"\r\n tabindex=\"0\"\r\n (click)=\"onClick()\">\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 [appearance]=\"_app\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_app && _lbl) {\r\n <mat-label>{{ _lbl }}</mat-label>\r\n }\r\n <mat-chip-grid [formControl]=\"formControl\" #chipList [class.sd-md]=\"size() === 'md'\" [class.sd-sm]=\"size() === 'sm'\">\r\n @for (item of formControl.value; track $index) {\r\n @if (item) {\r\n <mat-chip-row\r\n [class.sd-md]=\"size() === 'md'\"\r\n [class.sd-sm]=\"size() === 'sm'\"\r\n [removable]=\"removable()\"\r\n (removed)=\"onRemove(item)\"\r\n [disabled]=\"inputControl.disabled\"\r\n (click)=\"onClickChip($event, item)\">\r\n <span>{{ item }}</span>\r\n @if (!inputControl.disabled && item | sdRemovableChip: removable()) {\r\n <mat-icon matChipRemove>cancel</mat-icon>\r\n }\r\n </mat-chip-row>\r\n }\r\n }\r\n <input\r\n class=\"sd-chip-input\"\r\n [formControl]=\"inputControl\"\r\n [placeholder]=\"placeholder() || _lbl\"\r\n [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\r\n (matChipInputTokenEnd)=\"onAdd($event)\"\r\n autocomplete=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"_req\"\r\n matInput\r\n [attr.data-autoId]=\"autoId()\"\r\n #input />\r\n </mat-chip-grid>\r\n @if (_hideErr && _errMsg && formControl.touched) {\r\n <mat-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errMsg\" matTooltipPosition=\"above\"> error </mat-icon>\r\n }\r\n\r\n @if (!_hideErr && _errMsg && formControl.touched) {\r\n <mat-error>{{ _errMsg }}</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}\r\n", styles: [":host{padding-top:5px;display:block}.sd-chip-input{margin-top:0!important}:host ::ng-deep .mat-mdc-form-field.no-padding-wrapper .mat-mdc-text-field-wrapper{padding-bottom:0}:host ::ng-deep mat-form-field.c-md .mat-mdc-standard-chip{padding:7px 10px;min-height:26px}:host ::ng-deep mat-form-field.c-md .mat-mdc-standard-chip .mat-mdc-chip-trailing-icon{padding:7px 7px 7px 10px}:host ::ng-deep .mat-mdc-chip-row.sd-sm{--mdc-chip-label-text-size: 12px;--mdc-chip-container-height: 20px}:host ::ng-deep .mat-mdc-chip-set.sd-md{margin-top:10px}:host ::ng-deep .mat-mdc-chip-set.sd-sm{margin-top:2px}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}\n"] }]
|
|
316
|
+
}], ctorParameters: () => [], propDecorators: { input: [{
|
|
341
317
|
type: ViewChild,
|
|
342
318
|
args: ['input']
|
|
343
|
-
}], sdView: [{
|
|
344
|
-
type: ContentChild,
|
|
345
|
-
args: [SdViewDefDirective]
|
|
346
|
-
}], sdLabelDef: [{
|
|
347
|
-
type: ContentChild,
|
|
348
|
-
args: [SdLabelDefDirective]
|
|
349
319
|
}] } });
|
|
350
320
|
|
|
351
321
|
/**
|