@lavalogic/scoria 0.10.1 → 0.11.1
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/Base/ContextWrapper.svelte +6 -3
- package/dist/Components/Base/ContextWrapper.svelte.d.ts +1 -0
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +3 -1
- package/dist/Components/Table/Body/TableBody.svelte +5 -1
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +2 -2
- package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +12 -12
- package/dist/Components/Table/Types/Context/TableContext.svelte.js +18 -11
- package/dist/Components/Table/Types/Filtering/FilterFn.d.ts +1 -1
- package/dist/Components/VerticalTabGroup.svelte +11 -2
- package/dist/Components/VerticalTabGroup.svelte.d.ts +1 -0
- package/dist/Contexts/UntypedInputContext.svelte.d.ts +2 -0
- package/dist/Contexts/UntypedInputContext.svelte.js +13 -0
- package/package.json +30 -30
|
@@ -12,18 +12,21 @@
|
|
|
12
12
|
|
|
13
13
|
export interface ContextWrapperProps {
|
|
14
14
|
children: Snippet;
|
|
15
|
+
debug?: boolean;
|
|
15
16
|
}
|
|
16
17
|
</script>
|
|
17
18
|
|
|
18
19
|
<script lang="ts">
|
|
19
|
-
const { children }: ContextWrapperProps = $props();
|
|
20
|
+
const { children, debug = false }: ContextWrapperProps = $props();
|
|
20
21
|
|
|
21
22
|
setContext(ContextMenuContext.identifier, new ContextMenuContext());
|
|
22
23
|
setContext(TooltipContext.identifier, new TooltipContext());
|
|
23
24
|
setContext(ToastContext.identifier, new ToastContext());
|
|
24
25
|
const alertContext = new AlertContext();
|
|
25
26
|
setContext(AlertContext.identifier, alertContext);
|
|
26
|
-
|
|
27
|
+
|
|
28
|
+
const untypedListenerContext = new UntypedInputContext(debug);
|
|
29
|
+
setContext(UntypedInputContext.identifier, untypedListenerContext);
|
|
27
30
|
</script>
|
|
28
31
|
|
|
29
32
|
<ContextMenu />
|
|
@@ -32,5 +35,5 @@
|
|
|
32
35
|
{#if alertContext.showModal}
|
|
33
36
|
<AlertModal />
|
|
34
37
|
{/if}
|
|
35
|
-
|
|
38
|
+
<svelte:window onkeydown={untypedListenerContext.handleGlobalKeydown} />
|
|
36
39
|
{@render children()}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Snippet } from 'svelte';
|
|
2
2
|
export interface ContextWrapperProps {
|
|
3
3
|
children: Snippet;
|
|
4
|
+
debug?: boolean;
|
|
4
5
|
}
|
|
5
6
|
declare const ContextWrapper: import("svelte").Component<ContextWrapperProps, {}, "">;
|
|
6
7
|
type ContextWrapper = ReturnType<typeof ContextWrapper>;
|
|
@@ -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}
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
<label>
|
|
17
17
|
{#await checked}
|
|
18
18
|
<input
|
|
19
|
-
onchange={tableContext.
|
|
19
|
+
onchange={tableContext.selectAllInCurrentPage}
|
|
20
20
|
type="checkbox"
|
|
21
21
|
checked={false}
|
|
22
22
|
disabled={tableContext.showSelectedOnly}
|
|
23
23
|
/>
|
|
24
24
|
{:then checked}
|
|
25
25
|
<input
|
|
26
|
-
onchange={tableContext.
|
|
26
|
+
onchange={tableContext.selectAllInCurrentPage}
|
|
27
27
|
type="checkbox"
|
|
28
28
|
{checked}
|
|
29
29
|
disabled={tableContext.showSelectedOnly}
|
|
@@ -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;
|
|
@@ -165,7 +165,7 @@ export declare class TableContext<T extends object> {
|
|
|
165
165
|
readonly updateSelectedItems: () => Promise<void>;
|
|
166
166
|
readonly resetSelectedItems: () => void;
|
|
167
167
|
readonly recalculateAllSelectedInCurrentPage: () => void;
|
|
168
|
-
readonly
|
|
168
|
+
readonly selectAllInCurrentPage: () => Promise<void>;
|
|
169
169
|
readonly onHighlightAll: () => void;
|
|
170
170
|
readonly onEditCell: (item: T, coords: CellCoordinates, value: unknown) => Promise<void>;
|
|
171
171
|
readonly handleTdKeydown: (e: KeyboardEvent) => void;
|
|
@@ -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;
|
|
@@ -675,6 +676,9 @@ export class TableContext {
|
|
|
675
676
|
const sortedData = this._currentPageData;
|
|
676
677
|
const rows = sortedData.map((item, index) => {
|
|
677
678
|
const unsortedIndex = this.originalRowIndices.get(item) ?? index;
|
|
679
|
+
if (!item) {
|
|
680
|
+
throw new Error('No Item was found');
|
|
681
|
+
}
|
|
678
682
|
const row = {
|
|
679
683
|
getValue: async (key) => {
|
|
680
684
|
const gotValue = this.columnDefsById.get(key).accessorFn?.(item, index);
|
|
@@ -860,7 +864,7 @@ export class TableContext {
|
|
|
860
864
|
});
|
|
861
865
|
});
|
|
862
866
|
};
|
|
863
|
-
|
|
867
|
+
selectAllInCurrentPage = async () => {
|
|
864
868
|
if (!this.dataRepo) {
|
|
865
869
|
return;
|
|
866
870
|
}
|
|
@@ -1672,6 +1676,9 @@ export class TableContext {
|
|
|
1672
1676
|
};
|
|
1673
1677
|
// #region private methods
|
|
1674
1678
|
createRow(item, index, unsortedIndex) {
|
|
1679
|
+
if (!item) {
|
|
1680
|
+
throw new Error('No Item was found');
|
|
1681
|
+
}
|
|
1675
1682
|
const row = {
|
|
1676
1683
|
getValue: async (key) => {
|
|
1677
1684
|
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>;
|
|
@@ -12,14 +12,23 @@
|
|
|
12
12
|
style?: string;
|
|
13
13
|
noscroll?: boolean;
|
|
14
14
|
noTabMessage?: string;
|
|
15
|
+
nohistory?: boolean;
|
|
15
16
|
}
|
|
16
17
|
</script>
|
|
17
18
|
|
|
18
19
|
<script lang="ts">
|
|
19
|
-
let {
|
|
20
|
+
let {
|
|
21
|
+
name,
|
|
22
|
+
tabs,
|
|
23
|
+
selected,
|
|
24
|
+
style,
|
|
25
|
+
noscroll,
|
|
26
|
+
noTabMessage,
|
|
27
|
+
nohistory = false
|
|
28
|
+
}: VerticalTabGroupProps = $props();
|
|
20
29
|
|
|
21
30
|
onMount(() => {
|
|
22
|
-
if (name) {
|
|
31
|
+
if (name && nohistory !== true) {
|
|
23
32
|
const tabName = sessionStorage.getItem(`${name}-active-tab`);
|
|
24
33
|
if (tabName) {
|
|
25
34
|
tabs.find((it) => it.label === tabName)?.onclick();
|
|
@@ -6,6 +6,7 @@ export interface VerticalTabGroupProps {
|
|
|
6
6
|
style?: string;
|
|
7
7
|
noscroll?: boolean;
|
|
8
8
|
noTabMessage?: string;
|
|
9
|
+
nohistory?: boolean;
|
|
9
10
|
}
|
|
10
11
|
declare const VerticalTabGroup: import("svelte").Component<VerticalTabGroupProps, {}, "">;
|
|
11
12
|
type VerticalTabGroup = ReturnType<typeof VerticalTabGroup>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export type StringCallback = (value: string) => boolean | void | Promise<boolean | void>;
|
|
2
2
|
import type { Unsubscriber } from '../Types/Internal/Misc.js';
|
|
3
3
|
export declare class UntypedInputContext {
|
|
4
|
+
private debug;
|
|
5
|
+
constructor(debug?: boolean);
|
|
4
6
|
static readonly identifier: unique symbol;
|
|
5
7
|
private readonly registeredListeners;
|
|
6
8
|
readonly registerListener: (listener: StringCallback) => Unsubscriber;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export class UntypedInputContext {
|
|
2
|
+
debug;
|
|
3
|
+
constructor(debug = false) {
|
|
4
|
+
this.debug = debug;
|
|
5
|
+
}
|
|
2
6
|
static identifier = Symbol();
|
|
3
7
|
registeredListeners = [];
|
|
4
8
|
registerListener = (listener) => {
|
|
@@ -42,11 +46,20 @@ export class UntypedInputContext {
|
|
|
42
46
|
if (!this.tagNameSet.has(document.activeElement?.tagName)) {
|
|
43
47
|
clearTimeout(this.debounceTimer);
|
|
44
48
|
if (e.key === 'Enter') {
|
|
49
|
+
if (this.debug) {
|
|
50
|
+
console.log('firing');
|
|
51
|
+
}
|
|
45
52
|
this.fire();
|
|
53
|
+
if (this.debug) {
|
|
54
|
+
console.log('clearing');
|
|
55
|
+
}
|
|
46
56
|
this.untypedValue = '';
|
|
47
57
|
return;
|
|
48
58
|
}
|
|
49
59
|
if (e.key.length == 1) {
|
|
60
|
+
if (this.debug) {
|
|
61
|
+
console.log(`adding ${e.key}`);
|
|
62
|
+
}
|
|
50
63
|
this.untypedValue += e.key;
|
|
51
64
|
}
|
|
52
65
|
// else {
|
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.
|
|
4
|
+
"version": "0.11.1",
|
|
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"
|