@lenne.tech/ng-base 14.15.0 → 14.15.1
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/base-components/components/tags/tags.component.d.ts +2 -1
- package/esm2020/base-components/components/tags/tags.component.mjs +28 -5
- package/fesm2015/lenne.tech-ng-base-base-components.mjs +27 -4
- package/fesm2015/lenne.tech-ng-base-base-components.mjs.map +1 -1
- package/fesm2020/lenne.tech-ng-base-base-components.mjs +27 -4
- package/fesm2020/lenne.tech-ng-base-base-components.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -276,8 +276,25 @@ class TagsComponent {
|
|
|
276
276
|
* Add new tag
|
|
277
277
|
*
|
|
278
278
|
* @param tag
|
|
279
|
+
* @param reset
|
|
279
280
|
*/
|
|
280
|
-
addTag(tag) {
|
|
281
|
+
addTag(tag, reset = true) {
|
|
282
|
+
// Check if user copy string into input
|
|
283
|
+
if (tag.split(' ').length > 1) {
|
|
284
|
+
const tags = tag.split(' ');
|
|
285
|
+
for (let i = 0; i < tags.length; i++) {
|
|
286
|
+
this.addTag(tags[i], i + 1 === tags.length);
|
|
287
|
+
}
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
// Check if user copy string into input
|
|
291
|
+
if (tag.split(',').length > 1) {
|
|
292
|
+
const tags = tag.split(',');
|
|
293
|
+
for (let i = 0; i < tags.length; i++) {
|
|
294
|
+
this.addTag(tags[i], i + 1 === tags.length);
|
|
295
|
+
}
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
281
298
|
if (tag.endsWith(',') || tag.endsWith(' ')) {
|
|
282
299
|
tag = tag.slice(0, -1);
|
|
283
300
|
}
|
|
@@ -297,7 +314,9 @@ class TagsComponent {
|
|
|
297
314
|
}
|
|
298
315
|
if (this.control.value?.length === 0) {
|
|
299
316
|
this.control.setValue([foundOption.value]);
|
|
300
|
-
|
|
317
|
+
if (reset) {
|
|
318
|
+
this.inputValue = '';
|
|
319
|
+
}
|
|
301
320
|
this.control.setErrors(null);
|
|
302
321
|
return;
|
|
303
322
|
}
|
|
@@ -305,11 +324,15 @@ class TagsComponent {
|
|
|
305
324
|
this.control.value &&
|
|
306
325
|
!this.control.value.some((item) => item === foundOption.value)) {
|
|
307
326
|
this.control.setValue([...this.control.value, foundOption.value]);
|
|
308
|
-
|
|
327
|
+
if (reset) {
|
|
328
|
+
this.inputValue = '';
|
|
329
|
+
}
|
|
309
330
|
this.control.setErrors(null);
|
|
310
331
|
}
|
|
311
332
|
if (this.control.value.some((item) => item === foundOption.value)) {
|
|
312
|
-
|
|
333
|
+
if (reset) {
|
|
334
|
+
this.inputValue = '';
|
|
335
|
+
}
|
|
313
336
|
}
|
|
314
337
|
}
|
|
315
338
|
/**
|