@lavalogic/scoria 0.0.26 → 0.0.28
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 +5 -1
- package/dist/Components/Table/Misc/FilterInput.svelte +23 -20
- 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: {};
|
|
@@ -28,7 +28,11 @@
|
|
|
28
28
|
const disabled = action.isDisabled?.(cell.row.original, cell.row.index);
|
|
29
29
|
|
|
30
30
|
if (disabled != null) {
|
|
31
|
-
|
|
31
|
+
if (typeof disabled == 'boolean') {
|
|
32
|
+
return !disabled;
|
|
33
|
+
} else {
|
|
34
|
+
return disabled.then((it) => !it);
|
|
35
|
+
}
|
|
32
36
|
}
|
|
33
37
|
return (
|
|
34
38
|
(cell.column.columnDef as ActionsDef<T>).isEnabled?.(
|
|
@@ -144,9 +144,9 @@
|
|
|
144
144
|
// return 'type' in def && def.type === 'Number';
|
|
145
145
|
// }
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
const filteringStateValue = $derived(
|
|
148
|
+
tableContext.paginationRepo?.filtering.find((it) => it.id === def.id)?.value
|
|
149
|
+
);
|
|
150
150
|
|
|
151
151
|
$effect(() => {
|
|
152
152
|
if (isRemoteSelect) {
|
|
@@ -154,12 +154,14 @@
|
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
+
void filteringStateValue;
|
|
158
|
+
|
|
157
159
|
if (hasQuery) {
|
|
158
160
|
untrack(async () => {
|
|
159
161
|
try {
|
|
160
|
-
|
|
162
|
+
// as unknown as string | number | undefined;
|
|
161
163
|
|
|
162
|
-
if (
|
|
164
|
+
if (filteringStateValue != undefined) {
|
|
163
165
|
const x = tableContext.__queryValues.get(
|
|
164
166
|
customFilter?.label ?? customFilter?.objectName ?? customFilter?.queryKey ?? _uuid
|
|
165
167
|
);
|
|
@@ -167,16 +169,16 @@
|
|
|
167
169
|
}
|
|
168
170
|
} catch (e) {
|
|
169
171
|
console.warn(e);
|
|
172
|
+
value = null;
|
|
170
173
|
}
|
|
171
174
|
});
|
|
172
175
|
} else if (def instanceof SelectDef) {
|
|
173
176
|
untrack(async () => {
|
|
174
177
|
try {
|
|
175
|
-
const gotValue = getFilteringStateValue() as unknown as
|
|
176
|
-
| Array<string | number>
|
|
177
|
-
| undefined;
|
|
178
178
|
const x = (await options).filter((it) => {
|
|
179
|
-
return
|
|
179
|
+
return (filteringStateValue as unknown as Array<string | number> | undefined)?.includes(
|
|
180
|
+
it.value
|
|
181
|
+
);
|
|
180
182
|
});
|
|
181
183
|
selectedOptions = x;
|
|
182
184
|
} catch (e) {
|
|
@@ -188,9 +190,8 @@
|
|
|
188
190
|
selectedNumberFilterType.value === NumberDateFilterMode.Between &&
|
|
189
191
|
tableContext.paginationRepo?.filtering
|
|
190
192
|
) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const [min, max] = gotValue as [number, number | undefined];
|
|
193
|
+
if (filteringStateValue != undefined) {
|
|
194
|
+
const [min, max] = filteringStateValue as [number, number | undefined];
|
|
194
195
|
value = min;
|
|
195
196
|
valueMin = min;
|
|
196
197
|
valueMax = max ?? null;
|
|
@@ -198,9 +199,8 @@
|
|
|
198
199
|
value = valueMin = valueMax = null;
|
|
199
200
|
}
|
|
200
201
|
} else if (tableContext.paginationRepo?.filtering) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const [min] = gotValue as [number, number | undefined];
|
|
202
|
+
if (filteringStateValue != undefined) {
|
|
203
|
+
const [min] = filteringStateValue as [number, number | undefined];
|
|
204
204
|
value = min;
|
|
205
205
|
valueMin = min;
|
|
206
206
|
valueMax = min;
|
|
@@ -209,12 +209,15 @@
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
} else if (tableContext.paginationRepo?.filtering) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
if (
|
|
213
|
+
filteringStateValue == null ||
|
|
214
|
+
typeof filteringStateValue == 'string' ||
|
|
215
|
+
typeof filteringStateValue == 'number'
|
|
216
|
+
) {
|
|
217
|
+
value = filteringStateValue;
|
|
215
218
|
} else {
|
|
216
|
-
console.log('unknown value type:',
|
|
217
|
-
value =
|
|
219
|
+
console.log('unknown value type:', filteringStateValue);
|
|
220
|
+
value = filteringStateValue as string; // HACK attempt to keep production running
|
|
218
221
|
}
|
|
219
222
|
}
|
|
220
223
|
});
|