@lavalogic/scoria 0.11.3 → 0.11.4
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.
|
@@ -151,10 +151,10 @@ export declare class TableContext<T extends object> {
|
|
|
151
151
|
readonly sortedData: T[];
|
|
152
152
|
readonly sortedRowModel: RowModel<T>;
|
|
153
153
|
_currentPageData: T[];
|
|
154
|
+
get currentPageData(): T[];
|
|
154
155
|
private _originalRowIndices;
|
|
155
156
|
get originalRowIndices(): Map<T, number>;
|
|
156
157
|
readonly paginationRowModel: RowModel<T>;
|
|
157
|
-
get currentPageData(): T[];
|
|
158
158
|
readonly selectionContains: (item: T) => boolean;
|
|
159
159
|
readonly addInvalidValue: (item: T) => void;
|
|
160
160
|
readonly removeInvalidValue: (item: T) => void;
|
|
@@ -66,13 +66,17 @@ export class TableContext {
|
|
|
66
66
|
}
|
|
67
67
|
this._dataRepo = $state(dataRepo);
|
|
68
68
|
// this.dataRepo.forceRefresh = this.forceVisibilityUpdate;
|
|
69
|
-
[
|
|
70
|
-
const x =
|
|
71
|
-
? this.sortedData.slice(
|
|
69
|
+
const [_currentPageData, _originalRowIndices] = $derived.by(() => {
|
|
70
|
+
const x = dataRepo.paginationType == PaginationType.Local
|
|
71
|
+
? this.sortedData.slice(dataRepo.pageStartIndex, dataRepo.pageEndIndexExclusive)
|
|
72
72
|
: (this.sortedData ?? []);
|
|
73
|
-
const y = new Map((
|
|
73
|
+
const y = new Map((dataRepo.data ?? []).map((item, index) => [item, index]));
|
|
74
74
|
return [x, y];
|
|
75
75
|
});
|
|
76
|
+
$effect(() => {
|
|
77
|
+
this._currentPageData = _currentPageData;
|
|
78
|
+
this._originalRowIndices = _originalRowIndices;
|
|
79
|
+
});
|
|
76
80
|
if (defaultColumnDefs.remoteFilters) {
|
|
77
81
|
this.remoteFilters = defaultColumnDefs.remoteFilters;
|
|
78
82
|
}
|
|
@@ -679,10 +683,13 @@ export class TableContext {
|
|
|
679
683
|
rowsById: new Map(rows.map((it, index) => [index.toString(), it])) //FIXME should this be by sorted id or by original id?
|
|
680
684
|
};
|
|
681
685
|
});
|
|
682
|
-
_currentPageData;
|
|
686
|
+
_currentPageData = $state([]);
|
|
687
|
+
get currentPageData() {
|
|
688
|
+
return this._currentPageData;
|
|
689
|
+
}
|
|
683
690
|
// FIXME this is most likely the cuplrit for add pod not working on receipt. It may be one tick behind the other values
|
|
684
691
|
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
685
|
-
_originalRowIndices;
|
|
692
|
+
_originalRowIndices = $state(new Map());
|
|
686
693
|
get originalRowIndices() {
|
|
687
694
|
return this._originalRowIndices;
|
|
688
695
|
}
|
|
@@ -763,9 +770,6 @@ export class TableContext {
|
|
|
763
770
|
rowsById: new Map(rows.map((it, index) => [index.toString(), it])) //FIXME should this be by sorted id or by original id?
|
|
764
771
|
};
|
|
765
772
|
});
|
|
766
|
-
get currentPageData() {
|
|
767
|
-
return this._currentPageData;
|
|
768
|
-
}
|
|
769
773
|
// #endregion
|
|
770
774
|
// #region public methods
|
|
771
775
|
selectionContains = (item) => {
|