@lavalogic/scoria 0.0.24 → 0.0.26

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.
@@ -115,8 +115,8 @@ progress {
115
115
 
116
116
  .progress-text {
117
117
  position: absolute;
118
- top: 1px;
119
- bottom: 1px;
118
+ top: 8px;
119
+ bottom: 8px;
120
120
  left: -2px;
121
121
  right: -2px;
122
122
  max-height: 100%;
@@ -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: TableCell<T>;
20
+ cell: ActionsTableCell<T>;
14
21
  }
15
22
  </script>
16
23
 
@@ -18,17 +25,18 @@
18
25
  const { action, cell }: TableActionProps<T> = $props();
19
26
 
20
27
  const isEnabledPromise: boolean | Promise<boolean> = $derived.by(() => {
21
- if (action.isDisabled) {
22
- return action.isDisabled(cell.row.original, cell.row.index);
23
- } else if ((cell.column.columnDef as ActionsDef<T>).isEnabled) {
24
- return (cell.column.columnDef as ActionsDef<T>).isEnabled!(
28
+ const disabled = action.isDisabled?.(cell.row.original, cell.row.index);
29
+
30
+ if (disabled != null) {
31
+ return !disabled;
32
+ }
33
+ return (
34
+ (cell.column.columnDef as ActionsDef<T>).isEnabled?.(
25
35
  cell.row.original,
26
36
  cell.row.index,
27
37
  action
28
- );
29
- }
30
-
31
- return Promise.resolve(true);
38
+ ) ?? true
39
+ );
32
40
  });
33
41
 
34
42
  const labelPromise: Promise<string> = $derived.by(() => {
@@ -42,20 +50,25 @@
42
50
  });
43
51
  </script>
44
52
 
45
- {#await Promise.all([labelPromise, isEnabledPromise]) then [label, enabled]}
46
- <Button
47
- fullWidth
48
- size={Size.Medium}
49
- colourSet={(cell.column.columnDef as ActionsDef<T>).getColourSet?.(
50
- cell.row.original,
51
- cell.row.index,
52
- action
53
- ) ?? ColourSet.Secondary}
54
- disabled={!enabled}
55
- onclick={() => {
56
- action.callback(cell.row.original, cell.row.index);
57
- }}>{label}</Button
58
- >
53
+ {#await labelPromise then label}
54
+ {#await isEnabledPromise then isEnabled}
55
+ <Button
56
+ fullWidth
57
+ size={Size.Medium}
58
+ colourSet={(cell.column.columnDef as ActionsDef<T>).getColourSet?.(
59
+ cell.row.original,
60
+ cell.row.index,
61
+ action
62
+ ) ?? ColourSet.Secondary}
63
+ disabled={!isEnabled}
64
+ onclick={() => {
65
+ action.callback(cell.row.original, cell.row.index);
66
+ }}>{label}</Button
67
+ >
68
+ {:catch e}
69
+ {@debug e}
70
+ Error Loading Button
71
+ {/await}
59
72
  {:catch e}
60
73
  {@debug e}
61
74
  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: TableCell<T>;
13
+ cell: ActionsTableCell<T>;
6
14
  }
7
15
  declare function $$render<T extends object>(): {
8
16
  props: TableActionProps<T>;
@@ -322,6 +322,11 @@
322
322
  flex-flow: row nowrap;
323
323
  box-sizing: border-box;
324
324
  overflow: auto;
325
+ background-color: #cbd4da;
326
+ gap: 1px;
327
+ }
328
+ .spread_row .scrollable > .block {
329
+ background-color: #ffffff;
325
330
  }
326
331
  .spread_row .block {
327
332
  display: flex;
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.0.24",
4
+ "version": "0.0.26",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },