@elderbyte/ngx-starter 14.2.3 → 14.3.0
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/esm2020/lib/common/selection/selection-model.mjs +7 -2
- package/esm2020/lib/components/data-view/base/elder-data-view-base.mjs +3 -2
- package/esm2020/lib/components/select/elder-select/elder-select.component.mjs +3 -2
- package/esm2020/lib/components/select/multi/elder-multi-select-base.mjs +2 -2
- package/esm2020/lib/components/select/popup/selection-model-popup.directive.mjs +11 -5
- package/fesm2015/elderbyte-ngx-starter.mjs +20 -8
- package/fesm2015/elderbyte-ngx-starter.mjs.map +1 -1
- package/fesm2020/elderbyte-ngx-starter.mjs +20 -8
- package/fesm2020/elderbyte-ngx-starter.mjs.map +1 -1
- package/lib/common/selection/selection-model.d.ts +5 -2
- package/lib/components/data-view/base/elder-data-view-base.d.ts +1 -0
- package/lib/components/select/popup/selection-model-popup.directive.d.ts +4 -3
- package/package.json +1 -1
|
@@ -6422,7 +6422,7 @@ class SelectionModel {
|
|
|
6422
6422
|
* @param keyGetter value identity - default to value object equality
|
|
6423
6423
|
* @param selectableEvaluatorFn function to evaluate if the element in question is selectable
|
|
6424
6424
|
*/
|
|
6425
|
-
constructor(multiple = false, initial, keyGetter =
|
|
6425
|
+
constructor(multiple = false, initial, keyGetter = SelectionModel.FallbackKeyGetterFn, selectableEvaluatorFn = () => true) {
|
|
6426
6426
|
/***************************************************************************
|
|
6427
6427
|
* *
|
|
6428
6428
|
* Fields *
|
|
@@ -6457,6 +6457,10 @@ class SelectionModel {
|
|
|
6457
6457
|
this._selectableEvaluatorFn = fn;
|
|
6458
6458
|
this.replaceSelection(this.selectionSnapshot);
|
|
6459
6459
|
}
|
|
6460
|
+
set keyGetterFn(fn) {
|
|
6461
|
+
this._keyGetterFn = fn;
|
|
6462
|
+
this.replaceSelection(this.selectionSnapshot);
|
|
6463
|
+
}
|
|
6460
6464
|
/***************************************************************************
|
|
6461
6465
|
* *
|
|
6462
6466
|
* Public API *
|
|
@@ -6604,6 +6608,7 @@ class SelectionModel {
|
|
|
6604
6608
|
return false;
|
|
6605
6609
|
}
|
|
6606
6610
|
}
|
|
6611
|
+
SelectionModel.FallbackKeyGetterFn = ((a) => a);
|
|
6607
6612
|
|
|
6608
6613
|
var DataTransferStatus;
|
|
6609
6614
|
(function (DataTransferStatus) {
|
|
@@ -11772,11 +11777,12 @@ class SelectionModelPopupDirective {
|
|
|
11772
11777
|
* Constructor *
|
|
11773
11778
|
* *
|
|
11774
11779
|
**************************************************************************/
|
|
11775
|
-
constructor(templateRef, viewContainer, dialog, dataViewSelectionMode) {
|
|
11780
|
+
constructor(templateRef, viewContainer, dialog, dataViewSelectionMode, selectionModel) {
|
|
11776
11781
|
this.templateRef = templateRef;
|
|
11777
11782
|
this.viewContainer = viewContainer;
|
|
11778
11783
|
this.dialog = dialog;
|
|
11779
11784
|
this.dataViewSelectionMode = dataViewSelectionMode;
|
|
11785
|
+
this.selectionModel = selectionModel;
|
|
11780
11786
|
/***************************************************************************
|
|
11781
11787
|
* *
|
|
11782
11788
|
* Fields *
|
|
@@ -11807,10 +11813,14 @@ class SelectionModelPopupDirective {
|
|
|
11807
11813
|
/**
|
|
11808
11814
|
* Let the user choose some entities and return the selection.
|
|
11809
11815
|
*/
|
|
11810
|
-
choose(filters, sorts, multi = false) {
|
|
11816
|
+
choose(keyGetter, currentSelection, filters, sorts, multi = false) {
|
|
11811
11817
|
this.dataViewSelectionMode.filters = filters || [];
|
|
11812
11818
|
this.dataViewSelectionMode.sorts = sorts || [];
|
|
11813
11819
|
this.dataViewSelectionMode.multi = multi;
|
|
11820
|
+
this.selectionModel.isMultipleSelection = multi;
|
|
11821
|
+
this.selectionModel.keyGetterFn = keyGetter;
|
|
11822
|
+
this.selectionModel.replaceSelection(currentSelection);
|
|
11823
|
+
this.log.info('Replaced selection popup with current ' + currentSelection.length + ' entities:', currentSelection);
|
|
11814
11824
|
const dialogRef = this.openSelectDialog();
|
|
11815
11825
|
return dialogRef.afterClosed().pipe(switchMap((chosenEntities) => {
|
|
11816
11826
|
if (chosenEntities) {
|
|
@@ -11840,7 +11850,7 @@ class SelectionModelPopupDirective {
|
|
|
11840
11850
|
});
|
|
11841
11851
|
}
|
|
11842
11852
|
}
|
|
11843
|
-
SelectionModelPopupDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: SelectionModelPopupDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i1$7.MatDialog }, { token: ElderDataViewSelectionMode }], target: i0.ɵɵFactoryTarget.Directive });
|
|
11853
|
+
SelectionModelPopupDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: SelectionModelPopupDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i1$7.MatDialog }, { token: ElderDataViewSelectionMode }, { token: SelectionModel }], target: i0.ɵɵFactoryTarget.Directive });
|
|
11844
11854
|
SelectionModelPopupDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: SelectionModelPopupDirective, selector: "[elderSelectionModelPopup]", inputs: { elderSelectionModelPopupTransform: "elderSelectionModelPopupTransform" }, providers: [
|
|
11845
11855
|
{
|
|
11846
11856
|
provide: SelectionModel,
|
|
@@ -11868,7 +11878,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImpor
|
|
|
11868
11878
|
ElderTableProviders.ClearTableModel // Since this popup is frequently used inside an elder-table search box
|
|
11869
11879
|
]
|
|
11870
11880
|
}]
|
|
11871
|
-
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: i1$7.MatDialog }, { type: ElderDataViewSelectionMode }]; }, propDecorators: { elderSelectionModelPopupTransform: [{
|
|
11881
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: i1$7.MatDialog }, { type: ElderDataViewSelectionMode }, { type: SelectionModel }]; }, propDecorators: { elderSelectionModelPopupTransform: [{
|
|
11872
11882
|
type: Input,
|
|
11873
11883
|
args: ['elderSelectionModelPopupTransform']
|
|
11874
11884
|
}] } });
|
|
@@ -11907,8 +11917,9 @@ class ElderDataViewBaseComponent {
|
|
|
11907
11917
|
*/
|
|
11908
11918
|
this._embedded = false;
|
|
11909
11919
|
this._itemClickSubject = new Subject();
|
|
11920
|
+
this.EntityIdKeyFn = (entity) => entity ? this.getId(entity) : 0;
|
|
11910
11921
|
if (!selectionModel) {
|
|
11911
|
-
this.selectionModel = new SelectionModel(false, [],
|
|
11922
|
+
this.selectionModel = new SelectionModel(false, [], this.EntityIdKeyFn);
|
|
11912
11923
|
}
|
|
11913
11924
|
else {
|
|
11914
11925
|
this.selectionModel = selectionModel;
|
|
@@ -21772,7 +21783,8 @@ class ElderSelectComponent extends ElderSelectBase {
|
|
|
21772
21783
|
}
|
|
21773
21784
|
openSelectionPopup(event) {
|
|
21774
21785
|
if (this.selectionPopup) {
|
|
21775
|
-
this.selectionPopup.choose(this.
|
|
21786
|
+
this.selectionPopup.choose((e) => this.getEntityId(e), [], // TODO Or use current entity?
|
|
21787
|
+
this.filters, this.sorts, false).subscribe((selection) => {
|
|
21776
21788
|
this.updateValueByEntity(selection[0]);
|
|
21777
21789
|
});
|
|
21778
21790
|
}
|
|
@@ -22076,7 +22088,7 @@ class ElderMultiSelectBase extends ElderSelectBase {
|
|
|
22076
22088
|
}
|
|
22077
22089
|
openSelectionPopup(event) {
|
|
22078
22090
|
if (this.selectionPopup) {
|
|
22079
|
-
this.selectionPopup.choose(this.filters, this.sorts, true).subscribe((selection) => this.
|
|
22091
|
+
this.selectionPopup.choose((e) => this.getEntityId(e), this.entities, this.filters, this.sorts, true).subscribe((selection) => this.updateValueByEntities(selection));
|
|
22080
22092
|
}
|
|
22081
22093
|
else {
|
|
22082
22094
|
this.logger.warn('Cant open selection browser popup, since [SelectionModelPopupDirective] was not found!');
|