@lavalogic/scoria 0.11.12 → 0.11.13
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.
|
@@ -167,6 +167,7 @@ export declare class TableContext<T extends object> {
|
|
|
167
167
|
setSelectionMap: (set: SvelteMap<unknown, T>) => void;
|
|
168
168
|
readonly updateSelectedItems: () => Promise<void>;
|
|
169
169
|
readonly resetSelectedItems: () => void;
|
|
170
|
+
private lastIncrement;
|
|
170
171
|
readonly recalculateAllSelectedInCurrentPage: () => void;
|
|
171
172
|
readonly selectAllInCurrentPage: () => Promise<void>;
|
|
172
173
|
readonly onHighlightAll: () => void;
|
|
@@ -798,22 +798,6 @@ export class TableContext {
|
|
|
798
798
|
}
|
|
799
799
|
return this.selectedItems.has(this.selectionExtractor(item));
|
|
800
800
|
};
|
|
801
|
-
// public readonly HACK__reselectItem = (item: T) => {
|
|
802
|
-
// if (!this.selectionExtractor) {
|
|
803
|
-
// throw new Error('No selection extractor was supplied');
|
|
804
|
-
// }
|
|
805
|
-
// if (!this.isSelectable) {
|
|
806
|
-
// return true;
|
|
807
|
-
// }
|
|
808
|
-
// const key = this.selectionExtractor(item);
|
|
809
|
-
// if (this.selectedItems.has(key)) {
|
|
810
|
-
// this.selectedItems.delete(key);
|
|
811
|
-
// this.selectedItems.set(key, item);
|
|
812
|
-
// } else {
|
|
813
|
-
// this.selectedItems.set(key, item);
|
|
814
|
-
// this.selectedItems.delete(key);
|
|
815
|
-
// }
|
|
816
|
-
// };
|
|
817
801
|
addInvalidValue = (item) => {
|
|
818
802
|
this.invalidValues.set(this.selectionExtractor(item), item);
|
|
819
803
|
};
|
|
@@ -832,13 +816,6 @@ export class TableContext {
|
|
|
832
816
|
this.highlightedItems.set(key, item);
|
|
833
817
|
}
|
|
834
818
|
};
|
|
835
|
-
// public readonly toggleHighlightedRow = (rowIndex: number) => {
|
|
836
|
-
// if (this.highlightedRowIndexIds.has(rowIndex)) {
|
|
837
|
-
// this.highlightedRowIndexIds.delete(rowIndex);
|
|
838
|
-
// } else {
|
|
839
|
-
// this.highlightedRowIndexIds.add(rowIndex);
|
|
840
|
-
// }
|
|
841
|
-
// };
|
|
842
819
|
resetHighlightedRows = () => {
|
|
843
820
|
this.highlightedItems.clear();
|
|
844
821
|
};
|
|
@@ -901,16 +878,23 @@ export class TableContext {
|
|
|
901
878
|
}
|
|
902
879
|
this.recalculateAllSelectedInCurrentPage();
|
|
903
880
|
};
|
|
881
|
+
lastIncrement = Number.MIN_SAFE_INTEGER;
|
|
904
882
|
recalculateAllSelectedInCurrentPage = () => {
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
.
|
|
912
|
-
|
|
913
|
-
|
|
883
|
+
const invalidValues = this._invalidValues;
|
|
884
|
+
const allSelectedInCurrentPage = [...this.selectedItems.keys()];
|
|
885
|
+
const currentIncrement = ++this.lastIncrement;
|
|
886
|
+
this.allSelectedInCurrentPage
|
|
887
|
+
?.then(() => {
|
|
888
|
+
if (this.lastIncrement == currentIncrement) {
|
|
889
|
+
this.hasInvalidSelectedItems = allSelectedInCurrentPage.some((key) => {
|
|
890
|
+
return invalidValues.has(key);
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
else {
|
|
894
|
+
if (dev) {
|
|
895
|
+
console.log('skipping recalculation due to stale data');
|
|
896
|
+
}
|
|
897
|
+
}
|
|
914
898
|
})
|
|
915
899
|
.catch((e) => {
|
|
916
900
|
console.log(e);
|