@lavalogic/scoria 0.10.0 → 0.10.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.
@@ -10,13 +10,12 @@
10
10
 
11
11
  export interface FocusableImmutableCellProps<T extends object> {
12
12
  cell: TableCell<T>;
13
- value?: unknown;
14
13
  children?: Snippet;
15
14
  }
16
15
  </script>
17
16
 
18
17
  <script lang="ts" generics="T extends object">
19
- const { cell, value: externalValue, children }: FocusableImmutableCellProps<T> = $props();
18
+ const { cell, children }: FocusableImmutableCellProps<T> = $props();
20
19
 
21
20
  const value = $derived(cell.getValue());
22
21
 
@@ -72,27 +71,19 @@ class:bottom={focusDetails.bottomEdge} -->
72
71
  }}
73
72
  >
74
73
  {#if hasValue}
75
- {#if externalValue}
76
- {#await externalValue}
77
- loading…
78
- {:then externalValue}
79
- {externalValue}
80
- {/await}
81
- {:else}
82
- {#await visibleValue}
83
- loading…
84
- {:then value}
85
- {(value instanceof Date
86
- ? value.toLocaleDateString()
87
- : options.length
88
- ? options.find((it) => it.value === value)?.label
89
- : value) ??
90
- value ??
91
- ''}
92
- {:catch e}
93
- {e?.toString()}
94
- {/await}
95
- {/if}
74
+ {#await visibleValue}
75
+ loading…
76
+ {:then visibleValue}
77
+ {(visibleValue instanceof Date
78
+ ? visibleValue.toLocaleDateString()
79
+ : options.length
80
+ ? options.find((it) => it.value === visibleValue)?.label
81
+ : visibleValue) ??
82
+ visibleValue ??
83
+ ''}
84
+ {:catch e}
85
+ {e?.toString()}
86
+ {/await}
96
87
  {:else if children}
97
88
  <div
98
89
  class="slot-wrapper"
@@ -2,7 +2,6 @@ import { type Snippet } from 'svelte';
2
2
  import type { TableCell } from '../../../Types/Columns/TableCell.js';
3
3
  export interface FocusableImmutableCellProps<T extends object> {
4
4
  cell: TableCell<T>;
5
- value?: unknown;
6
5
  children?: Snippet;
7
6
  }
8
7
  declare function $$render<T extends object>(): {
@@ -58,9 +58,7 @@
58
58
  {#if cell.column.getIsVisible()}
59
59
  {@const columnDef = cell.column.columnDef}
60
60
 
61
- {#if cell.column.columnDef instanceof ValidityDef}
62
- <ValidityCell {cell} />
63
- {:else if columnDef instanceof RowSelectionDef}
61
+ {#if columnDef instanceof RowSelectionDef}
64
62
  <TableRowSelectionCheckbox {cell} />
65
63
  {:else if isActionsDef(cell)}
66
64
  <ActionsCell {cell} />
@@ -68,6 +66,18 @@
68
66
  <ExpandCell {cell} {expandedColumnDef} {onExpandChange} />
69
67
  {:else if columnDef.columnType !== ColumnType.Display}
70
68
  <AccessorComponent {cell} />
69
+ {:else if cell.column.columnDef instanceof AbstractDisplayDef}
70
+ {#if cell.column.columnDef.displayType === DisplayType.Bubbles}
71
+ <BubbleCell {cell} />
72
+ {:else if cell.column.columnDef.displayType === DisplayType.Validity}
73
+ <ValidityCell {cell} />
74
+ {:else if isProgressBarTableCell(cell)}
75
+ <ProgressCell {cell} />
76
+ {:else if cell.column.columnDef.displayType === DisplayType.Normal}
77
+ <FocusableImmutableCell {cell} />
78
+ {:else}
79
+ {@debug cell}
80
+ {/if}
71
81
  {:else}
72
82
  {@const valueOrComponentPromise =
73
83
  cell.column.columnDef.accessorFn?.(cell.row.original, cell.row.originalIndex) ??
@@ -75,35 +85,23 @@
75
85
  null}
76
86
 
77
87
  {#await valueOrComponentPromise}
78
- <FocusableImmutableCell value={valueOrComponentPromise} {cell} />
79
- {:then value}
80
- {@render ValueFallback(value)}
88
+ <FocusableImmutableCell {cell} />
89
+ {:then Value}
90
+ {#if Value == null || typeof Value === 'string' || typeof Value == 'number'}
91
+ <FocusableImmutableCell {cell} />
92
+ {:else if valueOrComponentIsConstructor(Value)}
93
+ <FocusableImmutableCell {cell}>
94
+ <Value {cell} />
95
+ </FocusableImmutableCell>
96
+ {:else if typeof Value === 'function'}
97
+ <FocusableImmutableCell {cell}>
98
+ {@render Value(cell)}
99
+ </FocusableImmutableCell>
100
+ {:else}
101
+ {@debug cell}
102
+ {/if}
81
103
  {:catch e}
82
104
  <FocusableImmutableCell value={e?.toString()} {cell} />
83
105
  {/await}
84
106
  {/if}
85
107
  {/if}
86
-
87
- {#snippet ValueFallback(Value: unknown)}
88
- {#if cell.column.columnDef instanceof AbstractDisplayDef && Array.isArray(Value)}
89
- {#if cell.column.columnDef.displayType === DisplayType.Bubbles}
90
- <BubbleCell {cell} />
91
- {:else if isProgressBarTableCell(cell)}
92
- <ProgressCell {cell} />
93
- {:else}
94
- {@debug cell}
95
- {/if}
96
- {:else if Value == null || typeof Value === 'string' || typeof Value == 'number'}
97
- <FocusableImmutableCell value={Value} {cell} />
98
- {:else if valueOrComponentIsConstructor(Value)}
99
- <FocusableImmutableCell {cell}>
100
- <Value {cell} />
101
- </FocusableImmutableCell>
102
- {:else if typeof Value === 'function'}
103
- <FocusableImmutableCell {cell}>
104
- {@render Value(cell)}
105
- </FocusableImmutableCell>
106
- {:else}
107
- {@debug cell}
108
- {/if}
109
- {/snippet}
@@ -2,7 +2,6 @@ export declare const DisplayType: {
2
2
  readonly Normal: "Normal";
3
3
  readonly Bubbles: "Bubbles";
4
4
  readonly Progress: "Progress";
5
- readonly Icon: "Icon";
6
5
  readonly Validity: "Validity";
7
6
  };
8
7
  export type DisplayType = (typeof DisplayType)[keyof typeof DisplayType];
@@ -2,7 +2,7 @@ export const DisplayType = {
2
2
  Normal: 'Normal',
3
3
  Bubbles: 'Bubbles',
4
4
  Progress: 'Progress',
5
- Icon: 'Icon',
5
+ // Icon: 'Icon', // NYI
6
6
  Validity: 'Validity'
7
7
  };
8
8
  Object.freeze(DisplayType);
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.10.0",
4
+ "version": "0.10.1",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },