@lavalogic/scoria 0.22.3 → 0.22.5
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/FileUpload.svelte +13 -5
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.d.ts +4 -3
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.js +1 -1
- package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +4 -3
- package/dist/Components/Table/Types/Context/TableContext.svelte.js +14 -11
- package/dist/Components/Table/Types/Coordinates/CellCoordinates.d.ts +2 -1
- package/dist/Components/Table/Types/Coordinates/ColumnIndices.d.ts +8 -0
- package/dist/Components/Table/Types/Coordinates/ColumnIndices.js +1 -0
- package/dist/Helpers/Helpers.svelte.js +4 -2
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
inputRef = $bindable(),
|
|
35
35
|
onblur,
|
|
36
|
-
onfocus
|
|
36
|
+
onfocus,
|
|
37
37
|
}: FileUploadProps = $props();
|
|
38
38
|
|
|
39
39
|
function onchange(e: Event & { currentTarget: EventTarget & HTMLInputElement }) {
|
|
@@ -90,7 +90,9 @@
|
|
|
90
90
|
<!-- HACK removed label for modals for now because I couldn't think of a decent style that doesn't interfere with scrolling -->
|
|
91
91
|
{#if labelTop && variant !== InputVariant.Modal}
|
|
92
92
|
<!-- <span class="top-label" class:invalid={isInvalid}>{labelTop}{#if optional}<i> - optional</i>{/if}</span> -->
|
|
93
|
-
<span
|
|
93
|
+
<span
|
|
94
|
+
class="top-label"
|
|
95
|
+
class:for-default={variant === InputVariant.Default}
|
|
94
96
|
>{labelTop}{#if optional}<i> - optional</i>{/if}</span
|
|
95
97
|
>
|
|
96
98
|
{#if variant === InputVariant.Default}
|
|
@@ -100,7 +102,10 @@
|
|
|
100
102
|
{/if}
|
|
101
103
|
{/if}
|
|
102
104
|
<!-- style="--background-colour: {leftIcon?.backgroundColour ?? rightIcon?.backgroundColour};" -->
|
|
103
|
-
<div
|
|
105
|
+
<div
|
|
106
|
+
class="icon-container"
|
|
107
|
+
class:for-modal={variant == InputVariant.Modal}
|
|
108
|
+
>
|
|
104
109
|
{#if leftIcon}
|
|
105
110
|
<Icon
|
|
106
111
|
name={leftIcon.name}
|
|
@@ -157,7 +162,7 @@
|
|
|
157
162
|
colourSet={ColourSet.Secondary}
|
|
158
163
|
backgroundColour="transparent"
|
|
159
164
|
icon={{ name: 'upload' }}
|
|
160
|
-
label="
|
|
165
|
+
label="Upload"
|
|
161
166
|
size={Size.Medium}
|
|
162
167
|
onclick={() => {
|
|
163
168
|
a();
|
|
@@ -180,7 +185,10 @@
|
|
|
180
185
|
/>
|
|
181
186
|
{/if}
|
|
182
187
|
{#if labelRight}
|
|
183
|
-
<span
|
|
188
|
+
<span
|
|
189
|
+
class="right-label"
|
|
190
|
+
class:for-modal={variant == InputVariant.Modal}>{labelRight}</span
|
|
191
|
+
>
|
|
184
192
|
{/if}
|
|
185
193
|
</div>
|
|
186
194
|
</label>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Pixels } from '../../../../../Types/Internal/Misc.js';
|
|
2
2
|
import type { SelectOption } from '../../../../../Types/Internal/SelectOption.js';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { MemoryColumnIndex } from '../../Coordinates/ColumnIndices.js';
|
|
4
5
|
import type { FilterFn } from '../../Filtering/FilterFn.js';
|
|
5
6
|
import type { FilterValueType } from '../../Filtering/FilterValueType.js';
|
|
6
7
|
import { ColumnType } from '../ColumnType.js';
|
|
@@ -10,7 +11,7 @@ export interface ColumnDefProps<T extends object, in FilterFnType, out OptionsTy
|
|
|
10
11
|
id: string;
|
|
11
12
|
header: string | Snippet;
|
|
12
13
|
debug?: boolean;
|
|
13
|
-
index?:
|
|
14
|
+
index?: MemoryColumnIndex;
|
|
14
15
|
allowFiltering?: boolean;
|
|
15
16
|
allowSorting?: boolean;
|
|
16
17
|
defaultHidden?: boolean;
|
|
@@ -30,8 +31,8 @@ export declare abstract class ColumnDef<T extends object, in FilterFnType = neve
|
|
|
30
31
|
readonly id: string;
|
|
31
32
|
debug: boolean;
|
|
32
33
|
private _index;
|
|
33
|
-
get index():
|
|
34
|
-
set index(v:
|
|
34
|
+
get index(): MemoryColumnIndex;
|
|
35
|
+
set index(v: MemoryColumnIndex);
|
|
35
36
|
abstract readonly columnType: ColumnType;
|
|
36
37
|
readonly defaultHidden: boolean;
|
|
37
38
|
readonly allowSorting: boolean;
|
|
@@ -8,6 +8,7 @@ import type { DefsWrapper } from '../Columns/DefsWrapper.js';
|
|
|
8
8
|
import type { VisibilityState } from '../Columns/VisibilityState.js';
|
|
9
9
|
import type { CellCoordinates } from '../Coordinates/CellCoordinates.js';
|
|
10
10
|
import type { CellCoordinatesWithoutColumn } from '../Coordinates/CellCoordinatesWithoutColumn.js';
|
|
11
|
+
import type { VisualColumnIndex } from '../Coordinates/ColumnIndices.js';
|
|
11
12
|
import type { IDataRepository } from '../DataRepository/IDataRepository.js';
|
|
12
13
|
import type { ColumnFiltersState } from '../Filtering/ColumnFiltersState.js';
|
|
13
14
|
import type { CustomRemoteFilters } from '../Filtering/CustomRemoteFilters.js';
|
|
@@ -231,9 +232,9 @@ export declare class TableContext<T extends object, RowIdType extends Primitive>
|
|
|
231
232
|
*/
|
|
232
233
|
private get _visualColumns();
|
|
233
234
|
/** Returns the visual index of the column with the given id, or -1 if not found. */
|
|
234
|
-
columnVisualIndex(id: string):
|
|
235
|
-
get focusStartVisualColumn():
|
|
236
|
-
get focusEndVisualColumn():
|
|
235
|
+
columnVisualIndex(id: string): VisualColumnIndex;
|
|
236
|
+
get focusStartVisualColumn(): VisualColumnIndex;
|
|
237
|
+
get focusEndVisualColumn(): VisualColumnIndex;
|
|
237
238
|
private _moveFocusEndRow;
|
|
238
239
|
private _moveFocusRow;
|
|
239
240
|
private getHighlightedRowData;
|
|
@@ -1163,7 +1163,7 @@ export class TableContext {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
};
|
|
1165
1165
|
resetSelectedItems = () => {
|
|
1166
|
-
this._selectedItems
|
|
1166
|
+
this._selectedItems.clear();
|
|
1167
1167
|
};
|
|
1168
1168
|
selectAllInCurrentPage = async () => {
|
|
1169
1169
|
void this.paginationRepo?.pageStartIndex;
|
|
@@ -1173,18 +1173,20 @@ export class TableContext {
|
|
|
1173
1173
|
? Math.min(this.paginationRepo.pageEndIndexExclusive, sortedData.length)
|
|
1174
1174
|
: sortedData.length;
|
|
1175
1175
|
// Will be doing one full reassignment to this.selectedItems to avoid svelteMap redraws
|
|
1176
|
-
const cloned = new SvelteMap(this.selectedItems);
|
|
1176
|
+
// const cloned = new SvelteMap(this.selectedItems);
|
|
1177
|
+
const sel = this.selectedItems; // HACK: keep the same svelteMap going so that we can support setSelectionMap()
|
|
1178
|
+
// if this is deemed problematic, we'll need to find another way to ask for a new map from the context consumer
|
|
1177
1179
|
const pending = [];
|
|
1178
1180
|
if (this.allSelectedInCurrentPage) {
|
|
1179
1181
|
for (let i = pageStartIndex; i < pageEndIndexExclusive; i++) {
|
|
1180
1182
|
const raw = this._cachedKey(sortedData[i]);
|
|
1181
1183
|
if (raw instanceof Promise) {
|
|
1182
1184
|
pending.push(raw.then((key) => {
|
|
1183
|
-
|
|
1185
|
+
sel.delete(key);
|
|
1184
1186
|
}));
|
|
1185
1187
|
}
|
|
1186
1188
|
else {
|
|
1187
|
-
|
|
1189
|
+
sel.delete(raw);
|
|
1188
1190
|
}
|
|
1189
1191
|
}
|
|
1190
1192
|
}
|
|
@@ -1202,10 +1204,10 @@ export class TableContext {
|
|
|
1202
1204
|
const raw = this._cachedKey(item);
|
|
1203
1205
|
if (raw instanceof Promise) {
|
|
1204
1206
|
return raw.then((key) => {
|
|
1205
|
-
|
|
1207
|
+
sel.set(key, item);
|
|
1206
1208
|
});
|
|
1207
1209
|
}
|
|
1208
|
-
|
|
1210
|
+
sel.set(raw, item);
|
|
1209
1211
|
};
|
|
1210
1212
|
const r = s instanceof Promise ? s.then(doSet) : doSet(s);
|
|
1211
1213
|
if (r instanceof Promise) {
|
|
@@ -1219,11 +1221,11 @@ export class TableContext {
|
|
|
1219
1221
|
const raw = this._cachedKey(item);
|
|
1220
1222
|
if (raw instanceof Promise) {
|
|
1221
1223
|
pending.push(raw.then((key) => {
|
|
1222
|
-
|
|
1224
|
+
sel.set(key, item);
|
|
1223
1225
|
}));
|
|
1224
1226
|
}
|
|
1225
1227
|
else {
|
|
1226
|
-
|
|
1228
|
+
sel.set(raw, item);
|
|
1227
1229
|
}
|
|
1228
1230
|
}
|
|
1229
1231
|
}
|
|
@@ -1231,7 +1233,8 @@ export class TableContext {
|
|
|
1231
1233
|
if (pending.length > 0) {
|
|
1232
1234
|
await Promise.all(pending);
|
|
1233
1235
|
}
|
|
1234
|
-
|
|
1236
|
+
// HACK
|
|
1237
|
+
// this._selectedItems = cloned;
|
|
1235
1238
|
};
|
|
1236
1239
|
onHighlightAll = () => {
|
|
1237
1240
|
if (this.allHighlighted) {
|
|
@@ -1572,8 +1575,8 @@ export class TableContext {
|
|
|
1572
1575
|
// newColumns[i].index += 1;
|
|
1573
1576
|
// }
|
|
1574
1577
|
if (originalIndex > dropTargetIndex && !targetIsLI(dropTarget)) {
|
|
1575
|
-
newDefs[dropTargetIndex].index
|
|
1576
|
-
this.dragTarget.index = newDefs[dropTargetIndex].index - 1;
|
|
1578
|
+
newDefs[dropTargetIndex].index = (newDefs[dropTargetIndex].index + 1);
|
|
1579
|
+
this.dragTarget.index = (newDefs[dropTargetIndex].index - 1);
|
|
1577
1580
|
newDefs.push(this.dragTarget);
|
|
1578
1581
|
}
|
|
1579
1582
|
else {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Position of a column in the `columnDefs` array (memory order). */
|
|
2
|
+
export type MemoryColumnIndex = number & {
|
|
3
|
+
readonly __brand: 'MemoryColumnIndex';
|
|
4
|
+
};
|
|
5
|
+
/** Position of a column in the visual display order (pinned-left → center → pinned-right). */
|
|
6
|
+
export type VisualColumnIndex = number & {
|
|
7
|
+
readonly __brand: 'VisualColumnIndex';
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -75,10 +75,12 @@ export function SQLFriendly(date) {
|
|
|
75
75
|
}
|
|
76
76
|
export function SQLFriendlyWithLocalTime(date, timeDate) {
|
|
77
77
|
if (typeof date === 'string') {
|
|
78
|
-
|
|
78
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
79
|
+
date = new Date(date);
|
|
79
80
|
}
|
|
80
81
|
if (typeof timeDate === 'string') {
|
|
81
|
-
|
|
82
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
83
|
+
timeDate = new Date(timeDate);
|
|
82
84
|
}
|
|
83
85
|
return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date
|
|
84
86
|
.getDate()
|