@lavalogic/scoria 0.0.25 → 0.0.27
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/Rows/Columns/ActionsCell.svelte +2 -2
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte.d.ts +2 -2
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +40 -23
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte.d.ts +9 -1
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { Validity } from '../../../../../Types/Internal/Validity.js';
|
|
11
11
|
|
|
12
12
|
export interface ActionsCellProps<T extends object> {
|
|
13
|
-
cell:
|
|
13
|
+
cell: ActionsTableCell<T>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export let shownPopup = refWrapper<symbol | undefined>(undefined);
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
<script lang="ts" generics="T extends object">
|
|
20
20
|
import { getContext, tick, untrack } from 'svelte';
|
|
21
|
-
import TableAction from './TableAction.svelte';
|
|
21
|
+
import TableAction, { type ActionsTableCell } from './TableAction.svelte';
|
|
22
22
|
import type { ActionsDef } from '../../../Types/Columns/Definitions/Actions/ActionsDef.svelte.js';
|
|
23
23
|
import type { TableActionButton } from '../../../Types/Columns/TableActionButton.js';
|
|
24
24
|
import type { TableCell } from '../../../Types/Columns/TableCell.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export interface ActionsCellProps<T extends object> {
|
|
2
|
-
cell:
|
|
2
|
+
cell: ActionsTableCell<T>;
|
|
3
3
|
}
|
|
4
4
|
export declare let shownPopup: import("../../../../../index.js").RefWrapper<symbol | undefined>;
|
|
5
|
-
import type
|
|
5
|
+
import { type ActionsTableCell } from './TableAction.svelte';
|
|
6
6
|
declare function $$render<T extends object>(): {
|
|
7
7
|
props: ActionsCellProps<T>;
|
|
8
8
|
exports: {};
|
|
@@ -7,10 +7,17 @@
|
|
|
7
7
|
import type { ActionsDef } from '../../../Types/Columns/Definitions/Actions/ActionsDef.svelte.js';
|
|
8
8
|
import type { TableActionButton } from '../../../Types/Columns/TableActionButton.js';
|
|
9
9
|
import type { TableCell } from '../../../Types/Columns/TableCell.js';
|
|
10
|
+
import type { Column } from '../../../Types/Columns/Column.js';
|
|
10
11
|
|
|
12
|
+
export interface ActionsColumn<T extends object> extends Column<T> {
|
|
13
|
+
columnDef: ActionsDef<T>;
|
|
14
|
+
}
|
|
15
|
+
export interface ActionsTableCell<T extends object> extends TableCell<T> {
|
|
16
|
+
column: ActionsColumn<T>;
|
|
17
|
+
}
|
|
11
18
|
export interface TableActionProps<T extends object> {
|
|
12
19
|
action: TableActionButton<T>;
|
|
13
|
-
cell:
|
|
20
|
+
cell: ActionsTableCell<T>;
|
|
14
21
|
}
|
|
15
22
|
</script>
|
|
16
23
|
|
|
@@ -18,17 +25,22 @@
|
|
|
18
25
|
const { action, cell }: TableActionProps<T> = $props();
|
|
19
26
|
|
|
20
27
|
const isEnabledPromise: boolean | Promise<boolean> = $derived.by(() => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
const disabled = action.isDisabled?.(cell.row.original, cell.row.index);
|
|
29
|
+
|
|
30
|
+
if (disabled != null) {
|
|
31
|
+
if (typeof disabled == 'boolean') {
|
|
32
|
+
return !disabled;
|
|
33
|
+
} else {
|
|
34
|
+
return disabled.then((it) => !it);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return (
|
|
38
|
+
(cell.column.columnDef as ActionsDef<T>).isEnabled?.(
|
|
25
39
|
cell.row.original,
|
|
26
40
|
cell.row.index,
|
|
27
41
|
action
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return Promise.resolve(true);
|
|
42
|
+
) ?? true
|
|
43
|
+
);
|
|
32
44
|
});
|
|
33
45
|
|
|
34
46
|
const labelPromise: Promise<string> = $derived.by(() => {
|
|
@@ -42,20 +54,25 @@
|
|
|
42
54
|
});
|
|
43
55
|
</script>
|
|
44
56
|
|
|
45
|
-
{#await
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
cell.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
{#await labelPromise then label}
|
|
58
|
+
{#await isEnabledPromise then isEnabled}
|
|
59
|
+
<Button
|
|
60
|
+
fullWidth
|
|
61
|
+
size={Size.Medium}
|
|
62
|
+
colourSet={(cell.column.columnDef as ActionsDef<T>).getColourSet?.(
|
|
63
|
+
cell.row.original,
|
|
64
|
+
cell.row.index,
|
|
65
|
+
action
|
|
66
|
+
) ?? ColourSet.Secondary}
|
|
67
|
+
disabled={!isEnabled}
|
|
68
|
+
onclick={() => {
|
|
69
|
+
action.callback(cell.row.original, cell.row.index);
|
|
70
|
+
}}>{label}</Button
|
|
71
|
+
>
|
|
72
|
+
{:catch e}
|
|
73
|
+
{@debug e}
|
|
74
|
+
Error Loading Button
|
|
75
|
+
{/await}
|
|
59
76
|
{:catch e}
|
|
60
77
|
{@debug e}
|
|
61
78
|
Error Loading Button
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import type { ActionsDef } from '../../../Types/Columns/Definitions/Actions/ActionsDef.svelte.js';
|
|
1
2
|
import type { TableActionButton } from '../../../Types/Columns/TableActionButton.js';
|
|
2
3
|
import type { TableCell } from '../../../Types/Columns/TableCell.js';
|
|
4
|
+
import type { Column } from '../../../Types/Columns/Column.js';
|
|
5
|
+
export interface ActionsColumn<T extends object> extends Column<T> {
|
|
6
|
+
columnDef: ActionsDef<T>;
|
|
7
|
+
}
|
|
8
|
+
export interface ActionsTableCell<T extends object> extends TableCell<T> {
|
|
9
|
+
column: ActionsColumn<T>;
|
|
10
|
+
}
|
|
3
11
|
export interface TableActionProps<T extends object> {
|
|
4
12
|
action: TableActionButton<T>;
|
|
5
|
-
cell:
|
|
13
|
+
cell: ActionsTableCell<T>;
|
|
6
14
|
}
|
|
7
15
|
declare function $$render<T extends object>(): {
|
|
8
16
|
props: TableActionProps<T>;
|