@sd-angular/core 0.0.1007 → 0.0.1008
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/autocomplete/sd-angular-core-autocomplete.metadata.json +1 -1
- package/bundles/sd-angular-core-autocomplete.umd.js +2 -1
- package/bundles/sd-angular-core-autocomplete.umd.js.map +1 -1
- package/bundles/sd-angular-core-autocomplete.umd.min.js +1 -1
- package/bundles/sd-angular-core-autocomplete.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-select.umd.js +133 -123
- package/bundles/sd-angular-core-select.umd.js.map +1 -1
- package/bundles/sd-angular-core-select.umd.min.js +2 -2
- package/bundles/sd-angular-core-select.umd.min.js.map +1 -1
- package/esm2015/autocomplete/src/lib/autocomplete.module.js +3 -2
- package/esm2015/select/src/lib/select.component.js +72 -72
- package/esm2015/select/src/lib/select.module.js +6 -3
- package/fesm2015/sd-angular-core-autocomplete.js +2 -1
- package/fesm2015/sd-angular-core-autocomplete.js.map +1 -1
- package/fesm2015/sd-angular-core-select.js +75 -73
- package/fesm2015/sd-angular-core-select.js.map +1 -1
- package/package.json +1 -1
- package/{sd-angular-core-0.0.1007.tgz → sd-angular-core-0.0.1008.tgz} +0 -0
- package/select/sd-angular-core-select.metadata.json +1 -1
- package/select/src/lib/select.component.d.ts +11 -5
|
@@ -337,7 +337,7 @@
|
|
|
337
337
|
{ type: core.TemplateRef }
|
|
338
338
|
]; };
|
|
339
339
|
|
|
340
|
-
var _input, _name, _form, _items,
|
|
340
|
+
var _input, _name, _form, _items, _delay, _validator, _subscription, _selectedItems, _allItems, _allItem, _updateValidator, _loadSelectedItems, _loadItems, _onChange, _customValidator;
|
|
341
341
|
var SdSelect = /** @class */ (function () {
|
|
342
342
|
function SdSelect(ref, utilityService) {
|
|
343
343
|
var _this = this;
|
|
@@ -351,8 +351,6 @@
|
|
|
351
351
|
_form.set(this, void 0);
|
|
352
352
|
// Items
|
|
353
353
|
_items.set(this, []);
|
|
354
|
-
_currentItems.set(this, []);
|
|
355
|
-
_allItem.set(this, {});
|
|
356
354
|
// Server search
|
|
357
355
|
this.loading = false;
|
|
358
356
|
_delay.set(this, 500); // Sau khoảng thời gian delay nếu không có thay đổi thì thì mới bắt đầu thực hiện gọi hàm
|
|
@@ -363,12 +361,15 @@
|
|
|
363
361
|
this.limit = 100;
|
|
364
362
|
this.filtered = false;
|
|
365
363
|
this.selectAll = false;
|
|
366
|
-
_allItems.set(this, void 0);
|
|
367
|
-
this.allSelected = false;
|
|
368
364
|
this.modelChange = new core.EventEmitter();
|
|
369
365
|
this.sdChange = new core.EventEmitter();
|
|
370
366
|
this.sdSelection = new core.EventEmitter();
|
|
371
367
|
_subscription.set(this, new rxjs.Subscription());
|
|
368
|
+
_selectedItems.set(this, void 0);
|
|
369
|
+
_allItems.set(this, void 0);
|
|
370
|
+
_allItem.set(this, {});
|
|
371
|
+
this.allSelected = false;
|
|
372
|
+
this.isFocused = false;
|
|
372
373
|
_updateValidator.set(this, function () {
|
|
373
374
|
_this.formControl.clearValidators();
|
|
374
375
|
_this.formControl.clearAsyncValidators();
|
|
@@ -384,23 +385,36 @@
|
|
|
384
385
|
_this.formControl.setAsyncValidators(asyncValidators);
|
|
385
386
|
_this.formControl.updateValueAndValidity();
|
|
386
387
|
});
|
|
387
|
-
|
|
388
|
-
var results;
|
|
388
|
+
_loadSelectedItems.set(this, function (value, items) { return __awaiter(_this, void 0, void 0, function () {
|
|
389
|
+
var values, results, objItem_1;
|
|
389
390
|
var _this = this;
|
|
390
391
|
return __generator(this, function (_c) {
|
|
391
392
|
switch (_c.label) {
|
|
392
|
-
case 0:
|
|
393
|
+
case 0:
|
|
394
|
+
if (!(value === null || value === void 0 ? void 0 : value.toString())) {
|
|
395
|
+
return [2 /*return*/, []];
|
|
396
|
+
}
|
|
397
|
+
values = Array.isArray(value) ? value : [value];
|
|
398
|
+
if (!this.valueField && !this.displayField) {
|
|
399
|
+
return [2 /*return*/, values];
|
|
400
|
+
}
|
|
401
|
+
this.loading = true;
|
|
402
|
+
if (!values.some(function (val) { return __classPrivateFieldGet(_this, _allItem)[val] === undefined; })) return [3 /*break*/, 2];
|
|
403
|
+
return [4 /*yield*/, items(value, true).finally(function () { return _this.loading = false; })];
|
|
393
404
|
case 1:
|
|
394
405
|
results = _c.sent();
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
406
|
+
objItem_1 = this.valueField ? this.utilityService.arrayToObject(results, this.valueField) : results.forEach(function (item) { return objItem_1[item === null || item === void 0 ? void 0 : item.toString()] = item; });
|
|
407
|
+
__classPrivateFieldSet(this, _allItem, Object.assign(Object.assign(Object.assign({}, values.map(function (val) {
|
|
408
|
+
var _c, _d;
|
|
409
|
+
return (_c = {}, _c[val] = (_d = {}, _d[_this.valueField] = val, _d[_this.displayField] = val, _d), _c);
|
|
410
|
+
})), __classPrivateFieldGet(this, _allItem)), objItem_1));
|
|
411
|
+
_c.label = 2;
|
|
412
|
+
case 2: return [2 /*return*/, values.map(function (val) { return __classPrivateFieldGet(_this, _allItem)[val]; })];
|
|
399
413
|
}
|
|
400
414
|
});
|
|
401
415
|
}); });
|
|
402
416
|
_loadItems.set(this, function (searchText, items) { return __awaiter(_this, void 0, void 0, function () {
|
|
403
|
-
var
|
|
417
|
+
var results, objItem, selectedItems;
|
|
404
418
|
var _this = this;
|
|
405
419
|
return __generator(this, function (_c) {
|
|
406
420
|
switch (_c.label) {
|
|
@@ -410,31 +424,11 @@
|
|
|
410
424
|
case 1:
|
|
411
425
|
results = _c.sent();
|
|
412
426
|
objItem = this.valueField ? this.utilityService.arrayToObject(results, this.valueField) : results.forEach(function (item) { return objItem[item === null || item === void 0 ? void 0 : item.toString()] = item; });
|
|
413
|
-
Object.assign(__classPrivateFieldGet(this, _allItem), objItem);
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
values.map(function (val) { return val === null || val === void 0 ? void 0 : val.toString(); }).forEach(function (val) {
|
|
419
|
-
var _c;
|
|
420
|
-
if (!objItem[val]) {
|
|
421
|
-
if (__classPrivateFieldGet(_this, _allItem)[val]) {
|
|
422
|
-
results.push(__classPrivateFieldGet(_this, _allItem)[val]);
|
|
423
|
-
}
|
|
424
|
-
else {
|
|
425
|
-
if (_this.valueField && _this.displayField) {
|
|
426
|
-
results.push((_c = {},
|
|
427
|
-
_c[_this.valueField] = val,
|
|
428
|
-
_c[_this.displayField] = val,
|
|
429
|
-
_c));
|
|
430
|
-
}
|
|
431
|
-
else {
|
|
432
|
-
results.push(val);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
return [2 /*return*/, results];
|
|
427
|
+
__classPrivateFieldSet(this, _allItem, Object.assign(Object.assign({}, __classPrivateFieldGet(this, _allItem)), objItem));
|
|
428
|
+
return [4 /*yield*/, __classPrivateFieldGet(this, _loadSelectedItems).call(this, this.formControl.value, items)];
|
|
429
|
+
case 2:
|
|
430
|
+
selectedItems = _c.sent();
|
|
431
|
+
return [2 /*return*/, __spread(selectedItems, results)];
|
|
438
432
|
}
|
|
439
433
|
});
|
|
440
434
|
}); });
|
|
@@ -454,13 +448,12 @@
|
|
|
454
448
|
_this.formControl.updateValueAndValidity({ emitEvent: true });
|
|
455
449
|
};
|
|
456
450
|
_onChange.set(this, function (value) {
|
|
457
|
-
var _a, _b;
|
|
458
451
|
if (Array.isArray(value)) {
|
|
459
452
|
_this.modelChange.emit(value);
|
|
460
453
|
_this.sdChange.emit(value);
|
|
461
454
|
_this.sdSelection.emit({
|
|
462
455
|
value: value,
|
|
463
|
-
items:
|
|
456
|
+
items: _this.selectedItems
|
|
464
457
|
});
|
|
465
458
|
}
|
|
466
459
|
else {
|
|
@@ -468,7 +461,7 @@
|
|
|
468
461
|
_this.sdChange.emit(value);
|
|
469
462
|
_this.sdSelection.emit({
|
|
470
463
|
value: value,
|
|
471
|
-
item:
|
|
464
|
+
item: _this.selectedItems[0]
|
|
472
465
|
});
|
|
473
466
|
}
|
|
474
467
|
});
|
|
@@ -493,6 +486,22 @@
|
|
|
493
486
|
});
|
|
494
487
|
}
|
|
495
488
|
};
|
|
489
|
+
this.onClick = function () {
|
|
490
|
+
var _a;
|
|
491
|
+
if ((_a = _this.sdView) === null || _a === void 0 ? void 0 : _a.templateRef) {
|
|
492
|
+
if (!_this.formControl.disabled && !_this.isFocused) {
|
|
493
|
+
_this.focus();
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
this.focus = function () {
|
|
498
|
+
_this.isFocused = true;
|
|
499
|
+
setTimeout(function () {
|
|
500
|
+
var _a, _b;
|
|
501
|
+
(_a = _this.select) === null || _a === void 0 ? void 0 : _a.focus();
|
|
502
|
+
(_b = _this.select) === null || _b === void 0 ? void 0 : _b.open();
|
|
503
|
+
}, 100);
|
|
504
|
+
};
|
|
496
505
|
_customValidator.set(this, function (func) {
|
|
497
506
|
return function (c) { return __awaiter(_this, void 0, void 0, function () {
|
|
498
507
|
var value, result, message;
|
|
@@ -526,11 +535,15 @@
|
|
|
526
535
|
});
|
|
527
536
|
this.onOpenChange = function (isOpened) {
|
|
528
537
|
if (isOpened) {
|
|
538
|
+
_this.isFocused = true;
|
|
529
539
|
if (__classPrivateFieldGet(_this, _input)) {
|
|
530
540
|
__classPrivateFieldGet(_this, _input).value = null;
|
|
531
541
|
}
|
|
532
542
|
_this.searchTerm$.next('');
|
|
533
543
|
}
|
|
544
|
+
else {
|
|
545
|
+
_this.isFocused = false;
|
|
546
|
+
}
|
|
534
547
|
};
|
|
535
548
|
}
|
|
536
549
|
Object.defineProperty(SdSelect.prototype, "input", {
|
|
@@ -576,20 +589,7 @@
|
|
|
576
589
|
});
|
|
577
590
|
Object.defineProperty(SdSelect.prototype, "model", {
|
|
578
591
|
set: function (value) {
|
|
579
|
-
|
|
580
|
-
// if (Array.isArray(value)) {
|
|
581
|
-
// this.formControl.setValue(value.map(val => (val ?? '') + ''));
|
|
582
|
-
// } else {
|
|
583
|
-
// this.formControl.setValue((value ?? '') + '');
|
|
584
|
-
// }
|
|
585
|
-
// this.ref.detectChanges();
|
|
586
|
-
// this.#model = value;
|
|
587
|
-
if (Array.isArray(value)) {
|
|
588
|
-
this.formControl.setValue(value);
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
this.formControl.setValue(value);
|
|
592
|
-
}
|
|
592
|
+
this.formControl.setValue(value);
|
|
593
593
|
},
|
|
594
594
|
enumerable: false,
|
|
595
595
|
configurable: true
|
|
@@ -666,75 +666,82 @@
|
|
|
666
666
|
__classPrivateFieldGet(this, _subscription).add(this.formControl.touchedChanges.subscribe(function () {
|
|
667
667
|
_this.ref.markForCheck();
|
|
668
668
|
}));
|
|
669
|
-
__classPrivateFieldSet(this, _allItems,
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
var
|
|
703
|
-
|
|
669
|
+
__classPrivateFieldSet(this, _allItems, rxjs.combineLatest([
|
|
670
|
+
this.searchTerm$.asObservable().pipe(operators.startWith(''), operators.debounceTime(typeof (__classPrivateFieldGet(this, _items)) === 'function' ? __classPrivateFieldGet(this, _delay) : 0)),
|
|
671
|
+
this.formControl.valueChanges.pipe(operators.startWith(this.formControl.value))
|
|
672
|
+
]).pipe(operators.switchMap(function (_c) {
|
|
673
|
+
var _d = __read(_c, 2), val = _d[0], formValue = _d[1];
|
|
674
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
675
|
+
var changeAliasLowerCase, searchText, isArray, hasFields;
|
|
676
|
+
var _this = this;
|
|
677
|
+
return __generator(this, function (_c) {
|
|
678
|
+
switch (_c.label) {
|
|
679
|
+
case 0:
|
|
680
|
+
if (!(typeof (__classPrivateFieldGet(this, _items)) === 'function')) return [3 /*break*/, 2];
|
|
681
|
+
return [4 /*yield*/, __classPrivateFieldGet(this, _loadItems).call(this, val, __classPrivateFieldGet(this, _items))];
|
|
682
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
683
|
+
case 2:
|
|
684
|
+
changeAliasLowerCase = this.utilityService.changeAliasLowerCase;
|
|
685
|
+
searchText = changeAliasLowerCase(val);
|
|
686
|
+
isArray = Array.isArray(formValue);
|
|
687
|
+
hasFields = !!this.valueField && !!this.displayField;
|
|
688
|
+
return [2 /*return*/, __classPrivateFieldGet(this, _items).filter(function (item) {
|
|
689
|
+
var value = hasFields ? item[_this.valueField] : item;
|
|
690
|
+
var display = hasFields ? item[_this.displayField] : item;
|
|
691
|
+
if (changeAliasLowerCase(value).includes(searchText) || changeAliasLowerCase(display).includes(searchText)) {
|
|
692
|
+
return true;
|
|
693
|
+
}
|
|
694
|
+
if (isArray) {
|
|
695
|
+
return formValue.some(function (e) { return e === value; });
|
|
696
|
+
}
|
|
697
|
+
return formValue === value;
|
|
698
|
+
}).sort(function (a, b) {
|
|
699
|
+
if (!_this.multiple) {
|
|
700
|
+
return 0;
|
|
701
|
+
}
|
|
702
|
+
var value1 = hasFields ? a[_this.valueField] : a;
|
|
703
|
+
var value2 = hasFields ? b[_this.valueField] : b;
|
|
704
|
+
if (isArray) {
|
|
705
|
+
var t1_1 = formValue.some(function (e) { return e === value1; });
|
|
706
|
+
var t2_1 = formValue.some(function (e) { return e === value2; });
|
|
707
|
+
if (t1_1 && !t2_1) {
|
|
708
|
+
return -1;
|
|
709
|
+
}
|
|
710
|
+
if (!t1_1 && t2_1) {
|
|
711
|
+
return 1;
|
|
712
|
+
}
|
|
713
|
+
return 0;
|
|
714
|
+
}
|
|
715
|
+
var t1 = formValue === value1;
|
|
716
|
+
var t2 = formValue === value2;
|
|
717
|
+
if (t1 && !t2) {
|
|
704
718
|
return -1;
|
|
705
719
|
}
|
|
706
|
-
if (!
|
|
720
|
+
if (!t1 && t2) {
|
|
707
721
|
return 1;
|
|
708
722
|
}
|
|
709
723
|
return 0;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
if (t1 && !t2) {
|
|
714
|
-
return -1;
|
|
715
|
-
}
|
|
716
|
-
if (!t1 && t2) {
|
|
717
|
-
return 1;
|
|
718
|
-
}
|
|
719
|
-
return 0;
|
|
720
|
-
})];
|
|
721
|
-
}
|
|
724
|
+
})];
|
|
725
|
+
}
|
|
726
|
+
});
|
|
722
727
|
});
|
|
723
|
-
})
|
|
724
|
-
this
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
this.display = rxjs.combineLatest([__classPrivateFieldGet(this, _allItems), this.formControl.valueChanges.pipe(operators.startWith(this.formControl.value))]).pipe(operators.map(function (_c) {
|
|
729
|
-
var _d = __read(_c, 2), items = _d[0], formValue = _d[1];
|
|
730
|
-
var isArray = Array.isArray(formValue);
|
|
731
|
-
if (!_this.valueField || !_this.displayField) {
|
|
732
|
-
return isArray ? formValue === null || formValue === void 0 ? void 0 : formValue.join(', ') : formValue;
|
|
728
|
+
})));
|
|
729
|
+
__classPrivateFieldSet(this, _selectedItems, __classPrivateFieldGet(this, _allItems).pipe(operators.map(function (items) {
|
|
730
|
+
var formValue = _this.formControl.value;
|
|
731
|
+
if (!(formValue === null || formValue === void 0 ? void 0 : formValue.toString())) {
|
|
732
|
+
return [];
|
|
733
733
|
}
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
.
|
|
737
|
-
|
|
734
|
+
var values = Array.isArray(formValue) ? formValue : [formValue];
|
|
735
|
+
_this.selectedItems = values.map(function (val) {
|
|
736
|
+
if (_this.valueField) {
|
|
737
|
+
return items === null || items === void 0 ? void 0 : items.find(function (item) { return item[_this.valueField] === val; });
|
|
738
|
+
}
|
|
739
|
+
return val;
|
|
740
|
+
});
|
|
741
|
+
return _this.selectedItems;
|
|
742
|
+
})));
|
|
743
|
+
this.filteredItems = __classPrivateFieldGet(this, _allItems).pipe(operators.map(function (allItems) { return allItems.filter(function (item, index) { return index < _this.limit; }); }));
|
|
744
|
+
this.display = __classPrivateFieldGet(this, _selectedItems).pipe(operators.map(function (selectedItems) { var _a; return (_a = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.map(function (item) { return _this.displayField ? item[_this.displayField] : item; })) === null || _a === void 0 ? void 0 : _a.join(', '); }));
|
|
738
745
|
};
|
|
739
746
|
SdSelect.prototype.ngAfterViewInit = function () {
|
|
740
747
|
var _a;
|
|
@@ -756,13 +763,13 @@
|
|
|
756
763
|
};
|
|
757
764
|
return SdSelect;
|
|
758
765
|
}());
|
|
759
|
-
_input = new WeakMap(), _name = new WeakMap(), _form = new WeakMap(), _items = new WeakMap(),
|
|
766
|
+
_input = new WeakMap(), _name = new WeakMap(), _form = new WeakMap(), _items = new WeakMap(), _delay = new WeakMap(), _validator = new WeakMap(), _subscription = new WeakMap(), _selectedItems = new WeakMap(), _allItems = new WeakMap(), _allItem = new WeakMap(), _updateValidator = new WeakMap(), _loadSelectedItems = new WeakMap(), _loadItems = new WeakMap(), _onChange = new WeakMap(), _customValidator = new WeakMap();
|
|
760
767
|
SdSelect.decorators = [
|
|
761
768
|
{ type: core.Component, args: [{
|
|
762
769
|
selector: 'sd-select',
|
|
763
|
-
template: "<div class=\"d-flex align-items-center\">\r\n <mat-form-field class=\"sd-md\" [ngClass]=\"{'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n
|
|
770
|
+
template: "<div class=\"d-flex align-items-center\" [class.sd-view]=\"sdView?.templateRef\" [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\" (click)=\"onClick()\">\r\n <ng-container *ngIf=\"sdView?.templateRef && !isFocused; else default\">\r\n <ng-container\r\n *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value, selectedItems: selectedItems }\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field class=\"sd-md\" [ngClass]=\"{'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n appearance=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <mat-select #select [formControl]=\"formControl\" placeholder=\"{{placeholder || label}}\" multiple\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && (multiple ? formControl?.value?.length : formControl?.value)}\"\r\n [required]=\"isRequired\" (openedChange)=\"onOpenChange($event)\" *ngIf=\"multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"multiple && selectAll\">\r\n <mat-checkbox class=\"mat-option\" [(ngModel)]=\"allSelected\" [ngModelOptions]=\"{standalone: true}\"\r\n (change)=\"onSelectAll()\">\r\n T\u1EA5t c\u1EA3</mat-checkbox>\r\n </ng-container>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item[valueField]\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-select #select [formControl]=\"formControl\" placeholder=\"{{placeholder || label}}\"\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && formControl?.value}\" [required]=\"isRequired\"\r\n (openedChange)=\"onOpenChange($event)\" *ngIf=\"!multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item[valueField]\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async\" [value]=\"item\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-icon\r\n *ngIf=\"(multiple ? formControl?.value?.length : formControl?.value) && !isRequired && !formControl.disabled\"\r\n class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.customValidator && !disableErrorMessage\">\r\n {{formControl?.errors?.customValidator}}\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-template>\r\n</div>",
|
|
764
771
|
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
765
|
-
styles: [":host{display:block;padding-top:5px}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline .mat-select-arrow-wrapper{transform:none}:host ::ng-deep .sd-selected .mat-select-arrow{border:none}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field mat-select.mat-select-disabled .mat-select-value{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}::ng-deep .sd-select-panel .mat-option.sd-filtered-input{background-color:#fff;position:-webkit-sticky;position:sticky;top:0;z-index:10}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline{width:100%}::ng-deep .sd-select-panel .mat-option.sd-filtered-input mat-pseudo-checkbox{display:none}::ng-deep .mat-select-panel .mat-option.sd-filtered-input{height:auto}::ng-deep .sd-select-panel .mat-option.sd-filtered-input input{color:#000}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field-prefix .mat-icon{margin-right:0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper{padding:10px 0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper .mat-form-field-outline{background-color:rgba(0,0,0,.04)}"]
|
|
772
|
+
styles: [":host{display:block;padding-top:5px}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline .mat-select-arrow-wrapper{transform:none}:host ::ng-deep .sd-selected .mat-select-arrow{border:none}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field mat-select.mat-select-disabled .mat-select-value{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input{background-color:#fff;position:-webkit-sticky;position:sticky;top:0;z-index:10}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline{width:100%}::ng-deep .sd-select-panel .mat-option.sd-filtered-input mat-pseudo-checkbox{display:none}::ng-deep .mat-select-panel .mat-option.sd-filtered-input{height:auto}::ng-deep .sd-select-panel .mat-option.sd-filtered-input input{color:#000}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field-prefix .mat-icon{margin-right:0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper{padding:10px 0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper .mat-form-field-outline{background-color:rgba(0,0,0,.04)}"]
|
|
766
773
|
},] }
|
|
767
774
|
];
|
|
768
775
|
SdSelect.ctorParameters = function () { return [
|
|
@@ -792,7 +799,8 @@
|
|
|
792
799
|
_selectAll: [{ type: core.Input, args: ['selectAll',] }],
|
|
793
800
|
modelChange: [{ type: core.Output }],
|
|
794
801
|
sdChange: [{ type: core.Output }],
|
|
795
|
-
sdSelection: [{ type: core.Output }]
|
|
802
|
+
sdSelection: [{ type: core.Output }],
|
|
803
|
+
sdView: [{ type: core.ContentChild, args: [common.SdViewDefDirective,] }]
|
|
796
804
|
};
|
|
797
805
|
|
|
798
806
|
var SdSelectModule = /** @class */ (function () {
|
|
@@ -813,7 +821,8 @@
|
|
|
813
821
|
select.MatSelectModule,
|
|
814
822
|
progressSpinner.MatProgressSpinnerModule,
|
|
815
823
|
checkbox.MatCheckboxModule,
|
|
816
|
-
translate.SdTranslateModule
|
|
824
|
+
translate.SdTranslateModule,
|
|
825
|
+
common.SdCommonModule
|
|
817
826
|
],
|
|
818
827
|
declarations: [
|
|
819
828
|
SdSelect,
|
|
@@ -821,7 +830,8 @@
|
|
|
821
830
|
],
|
|
822
831
|
exports: [
|
|
823
832
|
SdSelect,
|
|
824
|
-
SdSelectDisplayDefDirective
|
|
833
|
+
SdSelectDisplayDefDirective,
|
|
834
|
+
common.SdCommonModule
|
|
825
835
|
],
|
|
826
836
|
providers: []
|
|
827
837
|
},] }
|