@lavalogic/scoria 0.11.0 → 0.11.2
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/dist/Components/Table/Body/TableBody.svelte +5 -1
- package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +11 -11
- package/dist/Components/Table/Types/Context/TableContext.svelte.js +27 -11
- package/dist/Components/Table/Types/Filtering/FilterFn.d.ts +1 -1
- package/package.json +30 -30
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<script lang="ts" generics="T extends object">
|
|
18
|
+
import { dev } from '$app/environment';
|
|
18
19
|
import { getContext } from 'svelte';
|
|
20
|
+
import type { Column } from '../Types/Columns/Column.js';
|
|
19
21
|
import { TableContext } from '../Types/Context/TableContext.svelte.js';
|
|
20
22
|
import QuickSearchCell from './QuickSearchCell.svelte';
|
|
21
23
|
import TableRow from './Rows/TableRow.svelte';
|
|
22
|
-
import type { Column } from '../Types/Columns/Column.js';
|
|
23
24
|
|
|
24
25
|
let { side, heights, columns, includeHighlight }: TableBodyProps<T> = $props();
|
|
25
26
|
|
|
@@ -46,6 +47,9 @@
|
|
|
46
47
|
</tr>
|
|
47
48
|
{/if}
|
|
48
49
|
{#each tableContext.paginationRowModel.rows ?? [] as row, index (row)}
|
|
50
|
+
{#if dev && !row.original}
|
|
51
|
+
{@debug row}
|
|
52
|
+
{/if}
|
|
49
53
|
{@const customHeight = heights[index]?.applyTo.includes(side)
|
|
50
54
|
? heights[index].maxHeight
|
|
51
55
|
: undefined}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { SvelteMap, SvelteSet } from 'svelte/reactivity';
|
|
2
|
+
import type { Updater } from 'svelte/store';
|
|
3
|
+
import type { ColumnPinningState } from '../Columns/ColumnPinningState.js';
|
|
4
|
+
import type { ColumnSizingState } from '../Columns/ColumnSizingState.js';
|
|
2
5
|
import type { ColumnDef } from '../Columns/Definitions/ColumnDef.svelte.js';
|
|
6
|
+
import type { ColumnDefSet } from '../Columns/Definitions/ColumnDefSet.js';
|
|
3
7
|
import type { DefsWrapper } from '../Columns/DefsWrapper.js';
|
|
8
|
+
import type { VisibilityState } from '../Columns/VisibilityState.js';
|
|
9
|
+
import type { CellCoordinates } from '../Coordinates/CellCoordinates.js';
|
|
10
|
+
import type { CellCoordinatesWithoutColumn } from '../Coordinates/CellCoordinatesWithoutColumn.js';
|
|
4
11
|
import type { IDataRepository } from '../DataRepository/IDataRepository.js';
|
|
5
|
-
import {
|
|
6
|
-
import type { TableInitOptions } from './TableInitOptions.js';
|
|
12
|
+
import type { ColumnFiltersState } from '../Filtering/ColumnFiltersState.js';
|
|
7
13
|
import type { CustomRemoteFilters } from '../Filtering/CustomRemoteFilters.js';
|
|
8
14
|
import type { BoolFilterValueType, DateFilterValueType, FilterFn, NumberFilterValueType, SelectFilterValueType, StringFilterValueType } from '../Filtering/FilterFn.js';
|
|
9
|
-
import type {
|
|
10
|
-
import type { CellCoordinates } from '../Coordinates/CellCoordinates.js';
|
|
11
|
-
import type { ColumnSizingState } from '../Columns/ColumnSizingState.js';
|
|
12
|
-
import type { ColumnPinningState } from '../Columns/ColumnPinningState.js';
|
|
13
|
-
import type { VisibilityState } from '../Columns/VisibilityState.js';
|
|
14
|
-
import type { CellCoordinatesWithoutColumn } from '../Coordinates/CellCoordinatesWithoutColumn.js';
|
|
15
|
-
import type { Updater } from 'svelte/store';
|
|
15
|
+
import type { HasCustomFilterFunction } from '../Filtering/HasCustomFilterFunction.js';
|
|
16
16
|
import type { OnChangeFn } from '../OnChangeFn.js';
|
|
17
|
-
import
|
|
17
|
+
import { ToolbarPosition } from '../Toolbar/ToolbarPosition.js';
|
|
18
18
|
import type { ITable } from './ITable.js';
|
|
19
|
-
import type { HasCustomFilterFunction } from '../Filtering/HasCustomFilterFunction.js';
|
|
20
19
|
import type { RowModel } from './RowModel.js';
|
|
20
|
+
import type { TableInitOptions } from './TableInitOptions.js';
|
|
21
21
|
export declare class TableContext<T extends object> {
|
|
22
22
|
readonly defaultColumnDefs: DefsWrapper<T>;
|
|
23
23
|
readonly tableName: string;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
+
import { browser, dev } from '$app/environment';
|
|
2
|
+
import { asyncAll, asyncFilterIndices, asyncSleep, getCanvasContext, getErrorMessage } from '../../../../Helpers/Helpers.svelte.js';
|
|
3
|
+
import { tick } from 'svelte';
|
|
1
4
|
import { SvelteMap, SvelteSet } from 'svelte/reactivity';
|
|
2
5
|
import { ColumnType } from '../Columns/ColumnType.js';
|
|
3
|
-
import { ToolbarPosition } from '../Toolbar/ToolbarPosition.js';
|
|
4
|
-
import { RowSelectionDef } from '../Columns/Definitions/RowSelection/RowSelectionDef.svelte.js';
|
|
5
|
-
import { tick } from 'svelte';
|
|
6
|
-
import { PaginationType } from '../Pagination/PaginationType.js';
|
|
7
|
-
import { asyncAll, asyncFilterIndices, asyncSleep, getCanvasContext, getErrorMessage } from '../../../../Helpers/Helpers.svelte.js';
|
|
8
6
|
import { AccessorDef } from '../Columns/Definitions/Accessors/AccessorDef.svelte.js';
|
|
7
|
+
import { CheckboxDef } from '../Columns/Definitions/Accessors/CheckboxDef.svelte.js';
|
|
8
|
+
import { DateInputDef } from '../Columns/Definitions/Accessors/DateInputDef.svelte.js';
|
|
9
9
|
import { NumberInputDef } from '../Columns/Definitions/Accessors/NumberInputDef.svelte.js';
|
|
10
10
|
import { SelectDef } from '../Columns/Definitions/Accessors/SelectDef.svelte.js';
|
|
11
11
|
import { TextInputDef } from '../Columns/Definitions/Accessors/TextInputDef.svelte.js';
|
|
12
|
-
import { CheckboxDef } from '../Columns/Definitions/Accessors/CheckboxDef.svelte.js';
|
|
13
|
-
import { DateInputDef } from '../Columns/Definitions/Accessors/DateInputDef.svelte.js';
|
|
14
|
-
import { ProgressBarDef } from '../Columns/Definitions/Display/ProgressBarDef.svelte.js';
|
|
15
|
-
import { DisplayDef } from '../Columns/Definitions/Display/DisplayDef.svelte.js';
|
|
16
|
-
import { browser, dev } from '$app/environment';
|
|
17
12
|
import { BubbleDef } from '../Columns/Definitions/Display/BubbleDef.svelte.js';
|
|
13
|
+
import { DisplayDef } from '../Columns/Definitions/Display/DisplayDef.svelte.js';
|
|
14
|
+
import { ProgressBarDef } from '../Columns/Definitions/Display/ProgressBarDef.svelte.js';
|
|
15
|
+
import { RowSelectionDef } from '../Columns/Definitions/RowSelection/RowSelectionDef.svelte.js';
|
|
18
16
|
import { allowedEmptyFilterModes } from '../DataRepository/LocalTableDataRepository.svelte.js';
|
|
17
|
+
import { PaginationType } from '../Pagination/PaginationType.js';
|
|
18
|
+
import { ToolbarPosition } from '../Toolbar/ToolbarPosition.js';
|
|
19
19
|
const SORTING_ICON_WIDTH = 24;
|
|
20
20
|
const InternalSymbol = Symbol();
|
|
21
21
|
const uncopyableColumns = new Set([
|
|
@@ -600,6 +600,7 @@ export class TableContext {
|
|
|
600
600
|
// }
|
|
601
601
|
return comparableSortingFn(id, desc);
|
|
602
602
|
};
|
|
603
|
+
// FIXME this is most likely the cuplrit for add pod not working on receipt. It may be one tick behind the other values
|
|
603
604
|
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
604
605
|
originalRowIndices = $derived(new Map((this.dataRepo?.data ?? []).map((item, index) => [item, index])));
|
|
605
606
|
// private _filterTimer: ReturnType<typeof setTimeout> | undefined;
|
|
@@ -659,7 +660,13 @@ export class TableContext {
|
|
|
659
660
|
});
|
|
660
661
|
sortedRowModel = $derived.by(() => {
|
|
661
662
|
const rows = this.sortedData.map((item, index) => {
|
|
662
|
-
const
|
|
663
|
+
const originalIndex = this.originalRowIndices.get(item);
|
|
664
|
+
const unsortedIndex = originalIndex ?? index;
|
|
665
|
+
if (originalIndex == null) {
|
|
666
|
+
console.log($state.snapshot(this.sortedData));
|
|
667
|
+
console.log($state.snapshot(this.originalRowIndices));
|
|
668
|
+
throw new Error(`Sorted Data not found in Original Row Indices: original index ${originalIndex}, index ${index}`);
|
|
669
|
+
}
|
|
663
670
|
return this.createRow(item, index, unsortedIndex);
|
|
664
671
|
});
|
|
665
672
|
return {
|
|
@@ -675,6 +682,11 @@ export class TableContext {
|
|
|
675
682
|
const sortedData = this._currentPageData;
|
|
676
683
|
const rows = sortedData.map((item, index) => {
|
|
677
684
|
const unsortedIndex = this.originalRowIndices.get(item) ?? index;
|
|
685
|
+
if (!item) {
|
|
686
|
+
console.log($state.snapshot(sortedData));
|
|
687
|
+
console.log($state.snapshot(this.originalRowIndices));
|
|
688
|
+
throw new Error(`No Item was found at index ${index}`);
|
|
689
|
+
}
|
|
678
690
|
const row = {
|
|
679
691
|
getValue: async (key) => {
|
|
680
692
|
const gotValue = this.columnDefsById.get(key).accessorFn?.(item, index);
|
|
@@ -1672,6 +1684,10 @@ export class TableContext {
|
|
|
1672
1684
|
};
|
|
1673
1685
|
// #region private methods
|
|
1674
1686
|
createRow(item, index, unsortedIndex) {
|
|
1687
|
+
if (!item) {
|
|
1688
|
+
console.log($state.snapshot(this.originalRowIndices));
|
|
1689
|
+
throw new Error(`No Item was found at index ${index} (unsorted index ${unsortedIndex})`);
|
|
1690
|
+
}
|
|
1675
1691
|
const row = {
|
|
1676
1692
|
getValue: async (key) => {
|
|
1677
1693
|
const gotValue = this.columnDefsById.get(key).accessorFn?.(item, unsortedIndex);
|
|
@@ -6,4 +6,4 @@ export type SelectFilterValueType<T, columnType = T[keyof T]> = string | Array<u
|
|
|
6
6
|
} | undefined;
|
|
7
7
|
export type BoolFilterValueType = boolean | null;
|
|
8
8
|
export type StringFilterValueType = string | null;
|
|
9
|
-
export type FilterFn<T extends object, FilterValueType> = (row: Row<T>, columnId: string, filterValue: FilterValueType) => Promise<boolean>;
|
|
9
|
+
export type FilterFn<T extends object, FilterValueType> = (row: Row<T>, columnId: string, filterValue: FilterValueType) => boolean | Promise<boolean>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lavalogic/scoria",
|
|
3
3
|
"description": "Svelte components used for the FloWMS Web Frontend",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "restricted"
|
|
7
7
|
},
|
|
@@ -30,44 +30,44 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@chromatic-com/storybook": "^4.1.3",
|
|
33
|
-
"@eslint/compat": "^2.0.
|
|
34
|
-
"@eslint/js": "^9.39.
|
|
35
|
-
"@playwright/test": "^1.
|
|
36
|
-
"@storybook/addon-a11y": "^10.
|
|
37
|
-
"@storybook/addon-docs": "^10.
|
|
38
|
-
"@storybook/addon-svelte-csf": "^5.0.
|
|
39
|
-
"@storybook/addon-vitest": "^10.
|
|
40
|
-
"@storybook/sveltekit": "^10.
|
|
41
|
-
"@sveltejs/adapter-node": "^5.5.
|
|
42
|
-
"@sveltejs/kit": "^2.
|
|
33
|
+
"@eslint/compat": "^2.0.2",
|
|
34
|
+
"@eslint/js": "^9.39.3",
|
|
35
|
+
"@playwright/test": "^1.58.2",
|
|
36
|
+
"@storybook/addon-a11y": "^10.2.10",
|
|
37
|
+
"@storybook/addon-docs": "^10.2.10",
|
|
38
|
+
"@storybook/addon-svelte-csf": "^5.0.11",
|
|
39
|
+
"@storybook/addon-vitest": "^10.2.10",
|
|
40
|
+
"@storybook/sveltekit": "^10.2.10",
|
|
41
|
+
"@sveltejs/adapter-node": "^5.5.3",
|
|
42
|
+
"@sveltejs/kit": "^2.52.2",
|
|
43
43
|
"@sveltejs/package": "^2.5.7",
|
|
44
44
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
45
45
|
"@types/eslint": "^9.6.1",
|
|
46
|
-
"@types/node": "^25.0
|
|
47
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
48
|
-
"@typescript-eslint/parser": "^8.
|
|
49
|
-
"@vitest/browser": "^4.0.
|
|
50
|
-
"eslint": "^9.39.
|
|
46
|
+
"@types/node": "^25.3.0",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
48
|
+
"@typescript-eslint/parser": "^8.56.0",
|
|
49
|
+
"@vitest/browser": "^4.0.18",
|
|
50
|
+
"eslint": "^9.39.3",
|
|
51
51
|
"eslint-config-prettier": "^10.1.8",
|
|
52
|
-
"eslint-plugin-storybook": "^10.
|
|
53
|
-
"eslint-plugin-svelte": "^3.
|
|
54
|
-
"globals": "^17.
|
|
52
|
+
"eslint-plugin-storybook": "^10.2.10",
|
|
53
|
+
"eslint-plugin-svelte": "^3.15.0",
|
|
54
|
+
"globals": "^17.3.0",
|
|
55
55
|
"mdsvex": "^0.12.6",
|
|
56
|
-
"playwright": "^1.
|
|
57
|
-
"prettier": "^3.
|
|
58
|
-
"prettier-plugin-svelte": "^3.
|
|
59
|
-
"publint": "^0.3.
|
|
60
|
-
"sass-embedded": "^1.97.
|
|
61
|
-
"storybook": "^10.
|
|
62
|
-
"svelte": "^5.
|
|
63
|
-
"svelte-check": "^4.
|
|
56
|
+
"playwright": "^1.58.2",
|
|
57
|
+
"prettier": "^3.8.1",
|
|
58
|
+
"prettier-plugin-svelte": "^3.5.0",
|
|
59
|
+
"publint": "^0.3.17",
|
|
60
|
+
"sass-embedded": "^1.97.3",
|
|
61
|
+
"storybook": "^10.2.10",
|
|
62
|
+
"svelte": "^5.53.0",
|
|
63
|
+
"svelte-check": "^4.4.1",
|
|
64
64
|
"svelte-render-scan": "^1.1.0",
|
|
65
65
|
"typescript": "^5.9.3",
|
|
66
|
-
"typescript-eslint": "^8.
|
|
66
|
+
"typescript-eslint": "^8.56.0",
|
|
67
67
|
"vite": "^7.3.1",
|
|
68
68
|
"vite-plugin-devtools-json": "^1.0.0",
|
|
69
|
-
"vitest": "^4.0.
|
|
70
|
-
"vitest-browser-svelte": "^2.0.
|
|
69
|
+
"vitest": "^4.0.18",
|
|
70
|
+
"vitest-browser-svelte": "^2.0.2"
|
|
71
71
|
},
|
|
72
72
|
"keywords": [
|
|
73
73
|
"svelte"
|