@lavalogic/scoria 0.0.45 → 0.0.47
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/QuickSearchCell.svelte +14 -8
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +3 -2
- package/dist/Components/Table/Body/Rows/TableRow.svelte +55 -17
- package/dist/Components/Table/Body/Rows/TableRow.svelte.d.ts +12 -2
- package/dist/Components/Table/Body/TableBody.svelte +33 -20
- package/dist/Components/Table/Body/TableBody.svelte.d.ts +21 -4
- package/dist/Components/Table/Misc/FilterInput.svelte +1 -6
- package/dist/Components/Table/Table.svelte +77 -4
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/AccessorDef.svelte.d.ts +2 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/CheckboxDef.svelte.d.ts +6 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/CheckboxDef.svelte.js +8 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/DateInputDef.svelte.d.ts +6 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/DateInputDef.svelte.js +8 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/NumberInputDef.svelte.d.ts +6 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/NumberInputDef.svelte.js +8 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/QueryDef.svelte.d.ts +5 -3
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/QueryDef.svelte.js +1 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.d.ts +7 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.js +8 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/TextInputDef.svelte.d.ts +6 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/TextInputDef.svelte.js +8 -0
- package/dist/Components/Table/Types/Columns/Definitions/Actions/ActionsDef.svelte.d.ts +1 -0
- package/dist/Components/Table/Types/Columns/Definitions/Actions/ActionsDef.svelte.js +3 -1
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.d.ts +5 -7
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.js +0 -8
- package/dist/Components/Table/Types/Columns/Definitions/Display/AbstractDisplayDef.svelte.d.ts +3 -3
- package/dist/Components/Table/Types/Columns/Definitions/Display/BubbleDef.svelte.d.ts +7 -2
- package/dist/Components/Table/Types/Columns/Definitions/Display/BubbleDef.svelte.js +8 -0
- package/dist/Components/Table/Types/Columns/Definitions/Display/DisplayDef.svelte.d.ts +7 -2
- package/dist/Components/Table/Types/Columns/Definitions/Display/DisplayDef.svelte.js +8 -0
- package/dist/Components/Table/Types/Columns/Definitions/Display/ProgressBarDef.svelte.d.ts +7 -2
- package/dist/Components/Table/Types/Columns/Definitions/Display/ProgressBarDef.svelte.js +8 -0
- package/dist/Components/Table/Types/Columns/Definitions/Display/ValidityDef.svelte.d.ts +2 -1
- package/dist/Components/Table/Types/Columns/Definitions/Display/ValidityDef.svelte.js +2 -0
- package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.d.ts +2 -1
- package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.js +3 -0
- package/dist/Components/Table/Types/Columns/Definitions/FilterOnly/FilterOnlyDef.svelte.d.ts +6 -4
- package/dist/Components/Table/Types/Columns/Definitions/FilterOnly/FilterOnlyDef.svelte.js +1 -0
- package/dist/Components/Table/Types/Columns/Definitions/JSONColumnDefSet.d.ts +11 -0
- package/dist/Components/Table/Types/Columns/Definitions/RowSelection/RowSelectionDef.svelte.d.ts +1 -0
- package/dist/Components/Table/Types/Columns/Definitions/RowSelection/RowSelectionDef.svelte.js +3 -1
- package/dist/Components/Table/Types/Columns/JSONColumnPinningState.d.ts +4 -0
- package/dist/Components/Table/Types/Columns/JSONColumnPinningState.js +1 -0
- package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +1 -1
- package/dist/Components/Table/Types/Context/TableContext.svelte.js +66 -62
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/scss/_mixins.scss +2 -0
- package/package.json +22 -22
- package/dist/Components/Table/Types/Columns/ColumnDefPreset.d.ts +0 -11
- /package/dist/Components/Table/Types/Columns/{ColumnDefPreset.js → Definitions/JSONColumnDefSet.js} +0 -0
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
const isSearchable = $derived(
|
|
65
|
-
hasFilterFn || hasAcceptableColumnType ||
|
|
65
|
+
hasFilterFn || hasAcceptableColumnType || customFilters?.has(def.id) == true
|
|
66
66
|
);
|
|
67
67
|
const isNumeric = $derived(
|
|
68
68
|
def instanceof NumberInputDef ||
|
|
@@ -70,12 +70,7 @@
|
|
|
70
70
|
customFilter?.type === CustomFilterType.Number
|
|
71
71
|
);
|
|
72
72
|
const options = $derived(
|
|
73
|
-
isSelect
|
|
74
|
-
? ((def as SelectDef<T>)?.getOptions?.() ??
|
|
75
|
-
(def as SelectDef<T>).getSpecificOptions?.() ??
|
|
76
|
-
customFilter?.options ??
|
|
77
|
-
[])
|
|
78
|
-
: []
|
|
73
|
+
isSelect ? ((def as SelectDef<T>)?.getOptions?.() ?? customFilter?.options ?? []) : []
|
|
79
74
|
);
|
|
80
75
|
const isDate = $derived(def instanceof DateInputDef);
|
|
81
76
|
const isRemoteSelect = $derived(customFilter?.type === CustomFilterType.Select);
|
|
@@ -232,7 +227,7 @@
|
|
|
232
227
|
let showToDateModal = $state(false);
|
|
233
228
|
</script>
|
|
234
229
|
|
|
235
|
-
<td class="input-cell">
|
|
230
|
+
<td class="input-cell {inputId}">
|
|
236
231
|
{#if isSearchable}
|
|
237
232
|
<div class="input-wrapper-parent">
|
|
238
233
|
{#if isDate}
|
|
@@ -243,6 +238,7 @@
|
|
|
243
238
|
<div class="spaced-around">
|
|
244
239
|
<Button
|
|
245
240
|
size={Size.FillHeight}
|
|
241
|
+
fullWidth
|
|
246
242
|
onclick={() => {
|
|
247
243
|
showFromDateModal = true;
|
|
248
244
|
}}>From {fromDate?.toLocaleDateString() ?? 'Any Date'}</Button
|
|
@@ -250,6 +246,7 @@
|
|
|
250
246
|
|
|
251
247
|
<Button
|
|
252
248
|
size={Size.FillHeight}
|
|
249
|
+
fullWidth
|
|
253
250
|
onclick={() => {
|
|
254
251
|
showToDateModal = true;
|
|
255
252
|
}}>To {toDate?.toLocaleDateString() ?? 'Any Date'}</Button
|
|
@@ -501,6 +498,8 @@ td.input-cell {
|
|
|
501
498
|
padding-left: 4px;
|
|
502
499
|
padding-right: 4px;
|
|
503
500
|
gap: 4px;
|
|
501
|
+
width: 100%;
|
|
502
|
+
justify-content: space-around;
|
|
504
503
|
}
|
|
505
504
|
|
|
506
505
|
td {
|
|
@@ -577,4 +576,11 @@ div.input-wrapper-parent div.input-wrapper.right {
|
|
|
577
576
|
min-width: 100px;
|
|
578
577
|
flex-grow: 2;
|
|
579
578
|
--input-padding-right: 2.6rem;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
td {
|
|
582
|
+
--input-width: 100%;
|
|
583
|
+
}
|
|
584
|
+
td .input-wrapper-parent {
|
|
585
|
+
width: 100%;
|
|
580
586
|
}</style>
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}}
|
|
71
|
-
onkeyup={(e) => {
|
|
71
|
+
onkeyup={(e: KeyboardEvent) => {
|
|
72
72
|
if (e.key === 'Enter') {
|
|
73
73
|
e.stopPropagation();
|
|
74
74
|
tableContext.onEditCell(cell.row.original, focusDetails.coordinates, !value);
|
|
75
75
|
}
|
|
76
76
|
}}
|
|
77
|
-
onkeydown={(e) => {
|
|
77
|
+
onkeydown={(e: KeyboardEvent) => {
|
|
78
78
|
if (e.key == 'Enter' || e.key == 'F2') {
|
|
79
79
|
e.stopPropagation();
|
|
80
80
|
}
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
tableContext.endFocus(focusDetails.coordinates);
|
|
89
89
|
}}
|
|
90
90
|
>
|
|
91
|
+
|
|
91
92
|
<label
|
|
92
93
|
class:multifocus={focusDetails.isMultiFocused}
|
|
93
94
|
class:multifocus-start={focusDetails.isMultiFocusStart}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<script lang="ts" module>
|
|
4
4
|
import { generateShortUUID } from '../../../../Helpers/Helpers.svelte.js';
|
|
5
|
-
import { getContext, untrack } from 'svelte';
|
|
5
|
+
import { getContext, onMount, untrack } from 'svelte';
|
|
6
6
|
import NestedTable from '../../NestedTable.svelte';
|
|
7
7
|
import type { Row } from '../../Types/Context/Row.js';
|
|
8
8
|
import { TableContext } from '../../Types/Context/TableContext.svelte.js';
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
row: Row<T>;
|
|
17
17
|
side: 'left' | 'right' | 'centre';
|
|
18
18
|
odd: boolean;
|
|
19
|
+
customHeight: number | undefined;
|
|
20
|
+
includeHighlight: boolean;
|
|
19
21
|
// oncontextmenu?: (e: MouseEvent) => void
|
|
20
22
|
}
|
|
21
23
|
</script>
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
<script lang="ts" generics="T extends object">
|
|
24
26
|
const tableContext = getContext<TableContext<T>>(TableContext.identifier);
|
|
25
27
|
|
|
26
|
-
const { row, side, odd = false }: TableRowProps<T> = $props();
|
|
28
|
+
const { row, side, odd = false, customHeight, includeHighlight }: TableRowProps<T> = $props();
|
|
27
29
|
|
|
28
30
|
const hoverable = $derived(tableContext.changeColourOnHover);
|
|
29
31
|
|
|
@@ -61,19 +63,7 @@
|
|
|
61
63
|
tableContext.highlightedItems.has(tableContext.selectionExtractor(row.original))
|
|
62
64
|
);
|
|
63
65
|
|
|
64
|
-
const
|
|
65
|
-
if (side === 'left') {
|
|
66
|
-
return (tableContext.columnPinning.left?.size ?? 0) > 0;
|
|
67
|
-
} else if (side === 'centre') {
|
|
68
|
-
return (
|
|
69
|
-
(tableContext.columnPinning.left?.size ?? 0) == 0 &&
|
|
70
|
-
(tableContext.columnPinning.right?.size ?? 0) != tableContext.columnDefs.length
|
|
71
|
-
);
|
|
72
|
-
} else {
|
|
73
|
-
return (tableContext.columnPinning.right?.size ?? 0) == tableContext.columnDefs.length;
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
const showHighlightButton = $derived(rowIndex != null && isAppropriateTableSide);
|
|
66
|
+
const showHighlightButton = $derived(rowIndex != null && includeHighlight);
|
|
77
67
|
|
|
78
68
|
const colspan = $derived(cells.length + (showHighlightButton ? 1 : 0));
|
|
79
69
|
|
|
@@ -111,11 +101,59 @@
|
|
|
111
101
|
expandedColumnDef = columnDef;
|
|
112
102
|
}
|
|
113
103
|
}
|
|
104
|
+
|
|
105
|
+
let trRef: HTMLTableRowElement | undefined = $state();
|
|
106
|
+
let _trHeight = $state(0);
|
|
107
|
+
export const trHeight = {
|
|
108
|
+
get value() {
|
|
109
|
+
return _trHeight;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
$effect(() => {
|
|
113
|
+
if (trRef) {
|
|
114
|
+
const observer = new ResizeObserver((entries) => {
|
|
115
|
+
if (customHeight) {
|
|
116
|
+
_trHeight = 0;
|
|
117
|
+
} else {
|
|
118
|
+
_trHeight = entries[0].borderBoxSize[0].blockSize;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
observer.observe(trRef);
|
|
122
|
+
|
|
123
|
+
const currentTrRef = trRef;
|
|
124
|
+
return () => observer.unobserve(currentTrRef);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
let innerTrRef: HTMLTableRowElement | undefined = $state();
|
|
129
|
+
// let _innerTrHeight = $state(0);
|
|
130
|
+
// export const innerTrHeight = {
|
|
131
|
+
// get value() {
|
|
132
|
+
// return _innerTrHeight;
|
|
133
|
+
// }
|
|
134
|
+
// };
|
|
135
|
+
// $effect(() => {
|
|
136
|
+
// if (innerTrRef) {
|
|
137
|
+
// const observer = new ResizeObserver((entries) => {
|
|
138
|
+
// _innerTrHeight = entries[0].borderBoxSize[0].blockSize;
|
|
139
|
+
// });
|
|
140
|
+
// observer.observe(innerTrRef);
|
|
141
|
+
|
|
142
|
+
// const currentinnerTrRef = innerTrRef;
|
|
143
|
+
// return () => observer.unobserve(currentTrRef);
|
|
144
|
+
// }
|
|
145
|
+
// });
|
|
114
146
|
</script>
|
|
115
147
|
|
|
116
148
|
<!-- onMouseEnter={onMouseEnter}
|
|
117
149
|
onMouseLeave={onMouseLeave} -->
|
|
118
|
-
<tr
|
|
150
|
+
<tr
|
|
151
|
+
class:hoverable
|
|
152
|
+
class:alt={tableContext.alternateRowColours && odd}
|
|
153
|
+
class:highlighted
|
|
154
|
+
style={customHeight ? `height: ${customHeight}px !important;` : null}
|
|
155
|
+
bind:this={trRef}
|
|
156
|
+
>
|
|
119
157
|
{#if showHighlightButton}
|
|
120
158
|
<ColumnHighlight
|
|
121
159
|
{rowIndex}
|
|
@@ -132,7 +170,7 @@ onMouseLeave={onMouseLeave} -->
|
|
|
132
170
|
|
|
133
171
|
{#if expandedColumnDef}
|
|
134
172
|
<!-- transition:slide={{ duration: 150, axis: 'y', delay: 0 }} -->
|
|
135
|
-
<tr class="inner-table">
|
|
173
|
+
<tr class="inner-table" bind:this={innerTrRef}>
|
|
136
174
|
{#await innerDataPromise}
|
|
137
175
|
<td {colspan}>loading…</td>
|
|
138
176
|
{:then data}
|
|
@@ -3,10 +3,16 @@ export interface TableRowProps<T extends object> {
|
|
|
3
3
|
row: Row<T>;
|
|
4
4
|
side: 'left' | 'right' | 'centre';
|
|
5
5
|
odd: boolean;
|
|
6
|
+
customHeight: number | undefined;
|
|
7
|
+
includeHighlight: boolean;
|
|
6
8
|
}
|
|
7
9
|
declare function $$render<T extends object>(): {
|
|
8
10
|
props: TableRowProps<T>;
|
|
9
|
-
exports: {
|
|
11
|
+
exports: {
|
|
12
|
+
trHeight: {
|
|
13
|
+
readonly value: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
10
16
|
bindings: "";
|
|
11
17
|
slots: {};
|
|
12
18
|
events: {};
|
|
@@ -16,7 +22,11 @@ declare class __sveltets_Render<T extends object> {
|
|
|
16
22
|
events(): ReturnType<typeof $$render<T>>['events'];
|
|
17
23
|
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
18
24
|
bindings(): "";
|
|
19
|
-
exports(): {
|
|
25
|
+
exports(): {
|
|
26
|
+
trHeight: {
|
|
27
|
+
readonly value: number;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
20
30
|
}
|
|
21
31
|
interface $$IsomorphicComponent {
|
|
22
32
|
new <T extends object>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
<svelte:options runes />
|
|
2
2
|
|
|
3
3
|
<script lang="ts" module>
|
|
4
|
-
export interface
|
|
4
|
+
export interface HeightData<T extends object> {
|
|
5
|
+
index: number;
|
|
6
|
+
applyTo: Array<TableBodyProps<T>['side']>;
|
|
7
|
+
maxHeight: number;
|
|
8
|
+
}
|
|
9
|
+
export interface TableBodyProps<T extends object> {
|
|
5
10
|
side: 'left' | 'centre' | 'right';
|
|
11
|
+
heights: Array<HeightData<T>>;
|
|
12
|
+
columns: Array<Column<T>>;
|
|
13
|
+
includeHighlight: boolean;
|
|
6
14
|
}
|
|
7
15
|
</script>
|
|
8
16
|
|
|
@@ -10,40 +18,45 @@
|
|
|
10
18
|
import { getContext } from 'svelte';
|
|
11
19
|
import { TableContext } from '../Types/Context/TableContext.svelte.js';
|
|
12
20
|
import QuickSearchCell from './QuickSearchCell.svelte';
|
|
13
|
-
import type { Column } from '../Types/Columns/Column.js';
|
|
14
21
|
import TableRow from './Rows/TableRow.svelte';
|
|
22
|
+
import type { Column } from '../Types/Columns/Column.js';
|
|
15
23
|
|
|
16
|
-
let { side }: TableBodyProps = $props();
|
|
24
|
+
let { side, heights, columns, includeHighlight }: TableBodyProps<T> = $props();
|
|
17
25
|
|
|
18
26
|
const tableContext = getContext<TableContext<T>>(TableContext.identifier);
|
|
19
27
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
side === 'left'
|
|
26
|
-
? tableContext.table.getLeftVisibleLeafColumns()
|
|
27
|
-
: side === 'right'
|
|
28
|
-
? tableContext.table.getRightVisibleLeafColumns()
|
|
29
|
-
: tableContext.table.getCenterVisibleLeafColumns();
|
|
30
|
-
|
|
31
|
-
quickFilterColumns = columns;
|
|
28
|
+
const rows: Array<TableRow<T>> = $state([]);
|
|
29
|
+
const _rowHeights = $derived(rows.map((it) => it?.trHeight.value ?? 0));
|
|
30
|
+
export const rowHeights = {
|
|
31
|
+
get value() {
|
|
32
|
+
return _rowHeights;
|
|
32
33
|
}
|
|
33
|
-
}
|
|
34
|
+
};
|
|
34
35
|
</script>
|
|
35
36
|
|
|
36
37
|
<tbody>
|
|
37
|
-
{#if tableContext.allowQuickFiltering && tableContext.showQuickFiltering &&
|
|
38
|
+
{#if tableContext.allowQuickFiltering && tableContext.showQuickFiltering && columns.length}
|
|
38
39
|
<tr class="sticky">
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
{#if includeHighlight}
|
|
41
|
+
<td class="highlight-dud"><!-- accomodating for row marking --></td>
|
|
42
|
+
{/if}
|
|
43
|
+
{#each columns as column (column)}
|
|
41
44
|
<QuickSearchCell {column} customFilters={tableContext.remoteFilters} />
|
|
42
45
|
{/each}
|
|
43
46
|
</tr>
|
|
44
47
|
{/if}
|
|
45
48
|
{#each tableContext.paginationRowModel.rows ?? [] as row, index (row)}
|
|
46
|
-
|
|
49
|
+
{@const customHeight = heights[index]?.applyTo.includes(side)
|
|
50
|
+
? heights[index].maxHeight
|
|
51
|
+
: undefined}
|
|
52
|
+
<TableRow
|
|
53
|
+
{includeHighlight}
|
|
54
|
+
{customHeight}
|
|
55
|
+
{row}
|
|
56
|
+
{side}
|
|
57
|
+
odd={index % 2 == 1}
|
|
58
|
+
bind:this={rows[index]}
|
|
59
|
+
/>
|
|
47
60
|
{/each}
|
|
48
61
|
</tbody>
|
|
49
62
|
|
|
@@ -1,9 +1,22 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface HeightData<T extends object> {
|
|
2
|
+
index: number;
|
|
3
|
+
applyTo: Array<TableBodyProps<T>['side']>;
|
|
4
|
+
maxHeight: number;
|
|
5
|
+
}
|
|
6
|
+
export interface TableBodyProps<T extends object> {
|
|
2
7
|
side: 'left' | 'centre' | 'right';
|
|
8
|
+
heights: Array<HeightData<T>>;
|
|
9
|
+
columns: Array<Column<T>>;
|
|
10
|
+
includeHighlight: boolean;
|
|
3
11
|
}
|
|
12
|
+
import type { Column } from '../Types/Columns/Column.js';
|
|
4
13
|
declare function $$render<T extends object>(): {
|
|
5
|
-
props: TableBodyProps
|
|
6
|
-
exports: {
|
|
14
|
+
props: TableBodyProps<T>;
|
|
15
|
+
exports: {
|
|
16
|
+
rowHeights: {
|
|
17
|
+
readonly value: number[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
7
20
|
bindings: "";
|
|
8
21
|
slots: {};
|
|
9
22
|
events: {};
|
|
@@ -13,7 +26,11 @@ declare class __sveltets_Render<T extends object> {
|
|
|
13
26
|
events(): ReturnType<typeof $$render<T>>['events'];
|
|
14
27
|
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
15
28
|
bindings(): "";
|
|
16
|
-
exports(): {
|
|
29
|
+
exports(): {
|
|
30
|
+
rowHeights: {
|
|
31
|
+
readonly value: number[];
|
|
32
|
+
};
|
|
33
|
+
};
|
|
17
34
|
}
|
|
18
35
|
interface $$IsomorphicComponent {
|
|
19
36
|
new <T extends object>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
@@ -119,12 +119,7 @@
|
|
|
119
119
|
);
|
|
120
120
|
|
|
121
121
|
const options = $derived(
|
|
122
|
-
isSelect
|
|
123
|
-
? ((def as SelectDef<T>)?.getOptions?.() ??
|
|
124
|
-
(def as SelectDef<T>).getSpecificOptions?.() ??
|
|
125
|
-
customFilter?.options ??
|
|
126
|
-
[])
|
|
127
|
-
: []
|
|
122
|
+
isSelect ? ((def as SelectDef<T>)?.getOptions?.() ?? customFilter?.options ?? []) : []
|
|
128
123
|
);
|
|
129
124
|
|
|
130
125
|
let optionsPromise: Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>> = $state(
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import TableSidebar from './Misc/TableSidebar.svelte';
|
|
16
16
|
import TableFooter from './Misc/TableFooter.svelte';
|
|
17
17
|
import TableHead from './Headers/TableHead.svelte';
|
|
18
|
-
import TableBody from './Body/TableBody.svelte';
|
|
18
|
+
import TableBody, { type HeightData } from './Body/TableBody.svelte';
|
|
19
19
|
import { shownPopup } from './Body/Rows/Columns/ActionsCell.svelte';
|
|
20
20
|
|
|
21
21
|
declare global {
|
|
@@ -264,6 +264,57 @@
|
|
|
264
264
|
const leftTotalSize = $derived(tableContext.table.getLeftTotalSize());
|
|
265
265
|
const centreTotalSize = $derived(tableContext.table.getCenterTotalSize());
|
|
266
266
|
const rightTotalSize = $derived(tableContext.table.getRightTotalSize());
|
|
267
|
+
|
|
268
|
+
const leftColumns = $derived(tableContext.table.getLeftVisibleLeafColumns());
|
|
269
|
+
const centreColumns = $derived(tableContext.table.getCenterVisibleLeafColumns());
|
|
270
|
+
const rightColumns = $derived(tableContext.table.getRightVisibleLeafColumns());
|
|
271
|
+
|
|
272
|
+
const appropriateSide = $derived.by(() => {
|
|
273
|
+
if (leftColumns.length > 0) {
|
|
274
|
+
return 'left';
|
|
275
|
+
} else if ((rightColumns.length ?? 0) != tableContext.columnDefs.length) {
|
|
276
|
+
return 'centre';
|
|
277
|
+
} else {
|
|
278
|
+
return 'right';
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
let leftTable: TableBody<T> | undefined = $state();
|
|
283
|
+
let centreTable: TableBody<T> | undefined = $state();
|
|
284
|
+
let rightTable: TableBody<T> | undefined = $state();
|
|
285
|
+
|
|
286
|
+
const totalRowSizes: Array<HeightData<T>> = $derived.by(() => {
|
|
287
|
+
if (!leftTable || !centreTable || !rightTable) {
|
|
288
|
+
return [];
|
|
289
|
+
}
|
|
290
|
+
const centre = centreTable.rowHeights.value;
|
|
291
|
+
const right = rightTable.rowHeights.value;
|
|
292
|
+
|
|
293
|
+
return leftTable?.rowHeights.value.map((_leftHeight, index) => {
|
|
294
|
+
const leftHeight = _leftHeight || 0;
|
|
295
|
+
const centreHeight = centre[index] || 0;
|
|
296
|
+
const rightHeight = right[index] || 0;
|
|
297
|
+
|
|
298
|
+
const maxHeight = Math.max(leftHeight, centreHeight, rightHeight);
|
|
299
|
+
const applyTo: HeightData<T>['applyTo'] = [];
|
|
300
|
+
|
|
301
|
+
if (leftHeight < maxHeight) {
|
|
302
|
+
applyTo.push('left');
|
|
303
|
+
}
|
|
304
|
+
if (centreHeight < maxHeight) {
|
|
305
|
+
applyTo.push('centre');
|
|
306
|
+
}
|
|
307
|
+
if (rightHeight < maxHeight) {
|
|
308
|
+
applyTo.push('right');
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
return {
|
|
312
|
+
index,
|
|
313
|
+
applyTo,
|
|
314
|
+
maxHeight
|
|
315
|
+
};
|
|
316
|
+
});
|
|
317
|
+
});
|
|
267
318
|
</script>
|
|
268
319
|
|
|
269
320
|
<svelte:window
|
|
@@ -349,7 +400,13 @@
|
|
|
349
400
|
<!-- {#if leftTotalSize > 0} -->
|
|
350
401
|
<table class="datatable__table left" style="min-width: {leftTotalSize}px">
|
|
351
402
|
<TableHead showHighlight={leftTotalSize > 0} side="left" />
|
|
352
|
-
<TableBody
|
|
403
|
+
<TableBody
|
|
404
|
+
includeHighlight={appropriateSide == 'left'}
|
|
405
|
+
columns={leftColumns}
|
|
406
|
+
heights={totalRowSizes}
|
|
407
|
+
side="left"
|
|
408
|
+
bind:this={leftTable}
|
|
409
|
+
/>
|
|
353
410
|
</table>
|
|
354
411
|
<!-- {/if} -->
|
|
355
412
|
|
|
@@ -357,14 +414,26 @@
|
|
|
357
414
|
|
|
358
415
|
<table class="datatable__table centre" style="min-width: {centreTotalSize}px">
|
|
359
416
|
<TableHead showHighlight={leftTotalSize == 0} side="centre" />
|
|
360
|
-
<TableBody
|
|
417
|
+
<TableBody
|
|
418
|
+
includeHighlight={appropriateSide == 'centre'}
|
|
419
|
+
columns={centreColumns}
|
|
420
|
+
heights={totalRowSizes}
|
|
421
|
+
side="centre"
|
|
422
|
+
bind:this={centreTable}
|
|
423
|
+
/>
|
|
361
424
|
</table>
|
|
362
425
|
<!-- {/if} -->
|
|
363
426
|
|
|
364
427
|
<!-- {#if rightTotalSize > 0} -->
|
|
365
428
|
<table class="datatable__table right" style="min-width: {rightTotalSize}px">
|
|
366
429
|
<TableHead showHighlight={false} side="right" />
|
|
367
|
-
<TableBody
|
|
430
|
+
<TableBody
|
|
431
|
+
includeHighlight={appropriateSide == 'right'}
|
|
432
|
+
columns={rightColumns}
|
|
433
|
+
heights={totalRowSizes}
|
|
434
|
+
side="right"
|
|
435
|
+
bind:this={rightTable}
|
|
436
|
+
/>
|
|
368
437
|
</table>
|
|
369
438
|
<!-- {/if} -->
|
|
370
439
|
</div>
|
|
@@ -449,6 +518,10 @@ div.resizer.isResizing {
|
|
|
449
518
|
opacity: 1;
|
|
450
519
|
}
|
|
451
520
|
|
|
521
|
+
.left {
|
|
522
|
+
border-right: solid 2px #3a4952;
|
|
523
|
+
}
|
|
524
|
+
|
|
452
525
|
.right {
|
|
453
526
|
border-left: solid 2px #3a4952;
|
|
454
527
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ColumnDef, type ColumnDefProps } from '../ColumnDef.svelte.js';
|
|
2
2
|
import type { AccessorType } from './AccessorType.js';
|
|
3
|
-
export interface AccessorDefProps<T extends object> extends ColumnDefProps<T> {
|
|
3
|
+
export interface AccessorDefProps<T extends object, FilterFnType> extends ColumnDefProps<T, FilterFnType> {
|
|
4
4
|
readonly id: string & keyof T;
|
|
5
5
|
}
|
|
6
|
-
export declare abstract class AccessorDef<T extends object,
|
|
6
|
+
export declare abstract class AccessorDef<T extends object, FilterFnType> extends ColumnDef<T, FilterFnType> {
|
|
7
7
|
readonly columnType: "Accessor";
|
|
8
8
|
abstract readonly accessorType: AccessorType;
|
|
9
9
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CustomFilterFn } from '../../../Filtering/CustomFilterFn.js';
|
|
2
|
+
import type { BoolFilterValueType, FilterFn } from '../../../Filtering/FilterFn.js';
|
|
2
3
|
import { AccessorDef, type AccessorDefProps } from './AccessorDef.svelte.js';
|
|
3
|
-
export interface CheckboxDefProps<T extends object> extends AccessorDefProps<T> {
|
|
4
|
+
export interface CheckboxDefProps<T extends object> extends AccessorDefProps<T, BoolFilterValueType> {
|
|
4
5
|
}
|
|
5
6
|
export declare class CheckboxDef<T extends object> extends AccessorDef<T, BoolFilterValueType> {
|
|
6
7
|
readonly accessorType: "Checkbox";
|
|
7
8
|
constructor(props: CheckboxDefProps<T>);
|
|
9
|
+
private _filterFn;
|
|
10
|
+
get filterFn(): CustomFilterFn | FilterFn<T, BoolFilterValueType> | undefined;
|
|
11
|
+
set filterFn(v: CustomFilterFn | FilterFn<T, BoolFilterValueType> | undefined);
|
|
8
12
|
}
|
|
@@ -4,5 +4,13 @@ export class CheckboxDef extends AccessorDef {
|
|
|
4
4
|
accessorType = AccessorType.Checkbox;
|
|
5
5
|
constructor(props) {
|
|
6
6
|
super(props);
|
|
7
|
+
this._filterFn = $state(props.filterFn);
|
|
8
|
+
}
|
|
9
|
+
_filterFn;
|
|
10
|
+
get filterFn() {
|
|
11
|
+
return this._filterFn;
|
|
12
|
+
}
|
|
13
|
+
set filterFn(v) {
|
|
14
|
+
this._filterFn = v;
|
|
7
15
|
}
|
|
8
16
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CustomFilterFn } from '../../../Filtering/CustomFilterFn.js';
|
|
2
|
+
import type { DateFilterValueType, FilterFn } from '../../../Filtering/FilterFn.js';
|
|
2
3
|
import { AccessorDef, type AccessorDefProps } from './AccessorDef.svelte.js';
|
|
3
|
-
export interface DateInputDefProps<T extends object> extends AccessorDefProps<T> {
|
|
4
|
+
export interface DateInputDefProps<T extends object> extends AccessorDefProps<T, DateFilterValueType> {
|
|
4
5
|
showTime?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare class DateInputDef<T extends object> extends AccessorDef<T, DateFilterValueType> {
|
|
7
8
|
readonly accessorType: "Date";
|
|
8
9
|
constructor(props: DateInputDefProps<T>);
|
|
10
|
+
private _filterFn;
|
|
11
|
+
get filterFn(): FilterFn<T, DateFilterValueType> | CustomFilterFn | undefined;
|
|
12
|
+
set filterFn(v: FilterFn<T, DateFilterValueType> | CustomFilterFn | undefined);
|
|
9
13
|
readonly showTime: boolean;
|
|
10
14
|
}
|
|
@@ -5,6 +5,14 @@ export class DateInputDef extends AccessorDef {
|
|
|
5
5
|
constructor(props) {
|
|
6
6
|
super(props);
|
|
7
7
|
this.showTime = $derived(props.showTime ?? false);
|
|
8
|
+
this._filterFn = $state(props.filterFn);
|
|
9
|
+
}
|
|
10
|
+
_filterFn;
|
|
11
|
+
get filterFn() {
|
|
12
|
+
return this._filterFn;
|
|
13
|
+
}
|
|
14
|
+
set filterFn(v) {
|
|
15
|
+
this._filterFn = v;
|
|
8
16
|
}
|
|
9
17
|
showTime;
|
|
10
18
|
}
|
package/dist/Components/Table/Types/Columns/Definitions/Accessors/NumberInputDef.svelte.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AccessorDef } from './AccessorDef.svelte.js';
|
|
2
2
|
import { type ColumnDefProps } from '../ColumnDef.svelte.js';
|
|
3
|
-
import type { NumberFilterValueType } from '../../../Filtering/FilterFn.js';
|
|
4
|
-
|
|
3
|
+
import type { FilterFn, NumberFilterValueType } from '../../../Filtering/FilterFn.js';
|
|
4
|
+
import type { CustomFilterFn } from '../../../Filtering/CustomFilterFn.js';
|
|
5
|
+
export interface NumberInputDefProps<T extends object> extends ColumnDefProps<T, NumberFilterValueType> {
|
|
5
6
|
min: number;
|
|
6
7
|
max: number;
|
|
7
8
|
}
|
|
@@ -10,4 +11,7 @@ export declare class NumberInputDef<T extends object> extends AccessorDef<T, Num
|
|
|
10
11
|
constructor(props: NumberInputDefProps<T>);
|
|
11
12
|
readonly min: number;
|
|
12
13
|
readonly max: number;
|
|
14
|
+
private _filterFn;
|
|
15
|
+
get filterFn(): CustomFilterFn | FilterFn<T, NumberFilterValueType> | undefined;
|
|
16
|
+
set filterFn(v: CustomFilterFn | FilterFn<T, NumberFilterValueType> | undefined);
|
|
13
17
|
}
|
|
@@ -7,7 +7,15 @@ export class NumberInputDef extends AccessorDef {
|
|
|
7
7
|
super(props);
|
|
8
8
|
this.min = $derived(props.min);
|
|
9
9
|
this.max = $derived(props.max);
|
|
10
|
+
this._filterFn = $state(props.filterFn);
|
|
10
11
|
}
|
|
11
12
|
min;
|
|
12
13
|
max;
|
|
14
|
+
_filterFn;
|
|
15
|
+
get filterFn() {
|
|
16
|
+
return this._filterFn;
|
|
17
|
+
}
|
|
18
|
+
set filterFn(v) {
|
|
19
|
+
this._filterFn = v;
|
|
20
|
+
}
|
|
13
21
|
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { SelectOption } from '../../../../../../Types/Internal/SelectOption.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CustomFilterFn } from '../../../Filtering/CustomFilterFn.js';
|
|
3
|
+
import type { FilterFn, SelectFilterValueType } from '../../../Filtering/FilterFn.js';
|
|
3
4
|
import type { ColumnDefProps } from '../ColumnDef.svelte.js';
|
|
4
5
|
import { AccessorDef } from './AccessorDef.svelte.js';
|
|
5
|
-
export interface QueryDefProps<T extends object> extends ColumnDefProps<T
|
|
6
|
+
export interface QueryDefProps<T extends object> extends ColumnDefProps<T, SelectFilterValueType<T>> {
|
|
6
7
|
valueAsObject: boolean;
|
|
7
8
|
query: (queryString: string, item: T, index: number) => Promise<Array<SelectOption<unknown>>>;
|
|
8
9
|
getDisplayValue: (item: T, index: number) => string | null | Promise<string | null>;
|
|
9
10
|
clearable?: boolean;
|
|
10
11
|
}
|
|
11
|
-
export declare class QueryDef<T extends object> extends AccessorDef<T,
|
|
12
|
+
export declare class QueryDef<T extends object> extends AccessorDef<T, SelectFilterValueType<T>> {
|
|
12
13
|
readonly accessorType: "Query";
|
|
13
14
|
constructor(props: QueryDefProps<T>);
|
|
15
|
+
readonly filterFn: CustomFilterFn | FilterFn<T, SelectFilterValueType<T>> | undefined;
|
|
14
16
|
readonly valueAsObject: boolean;
|
|
15
17
|
readonly getDisplayValue: (item: T, index: number) => string | null | Promise<string | null>;
|
|
16
18
|
readonly query: (queryString: string, item: T, index: number) => Promise<Array<SelectOption<unknown>>>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { SelectOption } from '../../../../../../Types/Internal/SelectOption.js';
|
|
2
|
+
import type { CustomFilterFn } from '../../../Filtering/CustomFilterFn.js';
|
|
3
|
+
import type { FilterFn, SelectFilterValueType } from '../../../Filtering/FilterFn.js';
|
|
2
4
|
import type { ColumnDefProps } from '../ColumnDef.svelte.js';
|
|
3
5
|
import { AccessorDef } from './AccessorDef.svelte.js';
|
|
4
|
-
export interface SelectDefProps<T extends object> extends ColumnDefProps<T
|
|
6
|
+
export interface SelectDefProps<T extends object> extends ColumnDefProps<T, SelectFilterValueType<T>> {
|
|
5
7
|
getOptions: () => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
6
8
|
getDisplayValue: (item: T, index: number) => string | null | Promise<string | null>;
|
|
7
9
|
sortingFn?: (a: T, b: T) => 1 | -1 | 0;
|
|
@@ -9,9 +11,12 @@ export interface SelectDefProps<T extends object> extends ColumnDefProps<T> {
|
|
|
9
11
|
optional?: boolean;
|
|
10
12
|
clearable?: boolean;
|
|
11
13
|
}
|
|
12
|
-
export declare class SelectDef<T extends object> extends AccessorDef<T, T
|
|
14
|
+
export declare class SelectDef<T extends object> extends AccessorDef<T, SelectFilterValueType<T>> {
|
|
13
15
|
constructor(props: SelectDefProps<T>);
|
|
14
16
|
readonly accessorType: "Select";
|
|
17
|
+
private _filterFn;
|
|
18
|
+
get filterFn(): FilterFn<T, SelectFilterValueType<T>> | CustomFilterFn | undefined;
|
|
19
|
+
set filterFn(v: FilterFn<T, SelectFilterValueType<T>> | CustomFilterFn | undefined);
|
|
15
20
|
readonly sortingFn?: (a: T, b: T) => 1 | -1 | 0;
|
|
16
21
|
readonly getDisplayValue: (item: T, index: number) => string | null | Promise<string | null>;
|
|
17
22
|
readonly optional: boolean;
|