@lavalogic/scoria 0.24.0 → 0.25.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.
- package/dist/Components/Base/ContextWrapper.svelte +1 -0
- package/dist/Components/Base/Pagination.svelte +28 -7
- package/dist/Components/Base/Pagination.svelte.d.ts +8 -0
- package/dist/Components/Base/PaginationProps.d.ts +4 -2
- package/dist/Components/Base/Snippets.svelte +3 -0
- package/dist/Components/Base/Snippets.svelte.d.ts +1 -0
- package/dist/Components/Contexts/ContextMenu.svelte +87 -8
- package/dist/Components/Contexts/ContextMenuOption.svelte +35 -9
- package/dist/Components/Contexts/ContextMenuOptionProps.d.ts +1 -0
- package/dist/Components/Contexts/MaybeFocusable.d.ts +3 -0
- package/dist/Components/Contexts/MaybeFocusable.js +1 -0
- package/dist/Components/Contexts/Toast.svelte +18 -10
- package/dist/Components/HorizontalTabGroup.svelte +0 -23
- package/dist/Components/NumberInput.svelte +13 -8
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +28 -20
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +22 -53
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +32 -23
- package/dist/Components/Table/Body/Rows/TableRow.svelte +86 -60
- package/dist/Components/Table/Body/Rows/TableRow.svelte.d.ts +22 -13
- package/dist/Components/Table/Body/TableBody.svelte +23 -28
- package/dist/Components/Table/Body/TableBody.svelte.d.ts +10 -2
- package/dist/Components/Table/Body/TableBodyProps.d.ts +2 -0
- package/dist/Components/Table/ColumnDefinitions/ExampleItemColumnDefRepository.svelte.js +8 -8
- package/dist/Components/Table/Table.svelte +54 -56
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.d.ts +2 -2
- package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +1 -1
- package/dist/Components/Table/Types/Context/TableContext.svelte.js +4 -1
- package/dist/Components/Touch/NumberKeyboard.svelte +58 -19
- package/dist/Components/VerticalTabGroup.svelte +1 -29
- package/dist/Types/Internal/TabOption.d.ts +0 -1
- package/package.json +1 -1
|
@@ -77,7 +77,7 @@ export declare class TableContext<T extends object, RowIdType extends Primitive>
|
|
|
77
77
|
private _focusedRowIndices;
|
|
78
78
|
get focusedRowIndices(): ReadonlySet<number>;
|
|
79
79
|
private readonly _highlightedItems;
|
|
80
|
-
get highlightedItems(): SvelteMap<
|
|
80
|
+
get highlightedItems(): SvelteMap<RowIdType, T>;
|
|
81
81
|
_focusedColumnIds: ReadonlySet<string>;
|
|
82
82
|
get focusedColumnIds(): ReadonlySet<string>;
|
|
83
83
|
private _isMousingDown;
|
|
@@ -314,7 +314,6 @@ export class TableContext {
|
|
|
314
314
|
if (browser) {
|
|
315
315
|
this._getUserDefaults();
|
|
316
316
|
const removeInvalidPresets = () => {
|
|
317
|
-
console.warn('invalid presets. removing:', localStorage.getItem(`${this.userId}-${tableName}-presets`));
|
|
318
317
|
localStorage.removeItem(`${this.userId}-${tableName}-presets`);
|
|
319
318
|
localStorage.removeItem(`${this.userId}-${tableName}-selected-preset-name`);
|
|
320
319
|
const visibilityState = {};
|
|
@@ -1241,6 +1240,7 @@ export class TableContext {
|
|
|
1241
1240
|
};
|
|
1242
1241
|
onHighlightAll = () => {
|
|
1243
1242
|
if (this.allHighlighted) {
|
|
1243
|
+
// console.debug('All were highlighted. Clearing');
|
|
1244
1244
|
this.highlightedItems.clear();
|
|
1245
1245
|
return Promise.resolve();
|
|
1246
1246
|
}
|
|
@@ -2155,6 +2155,9 @@ export class TableContext {
|
|
|
2155
2155
|
}
|
|
2156
2156
|
indices.set(item, rowIndex);
|
|
2157
2157
|
}
|
|
2158
|
+
selectedRows.sort((left, right) => {
|
|
2159
|
+
return (indices.get(left) ?? -1) - (indices.get(right) ?? -1);
|
|
2160
|
+
});
|
|
2158
2161
|
// TODO somewhere between here and the ending of the copy functionality, we end up with issues where instead of it using the accessor fn, it tries to pick up the select option, and ends up using the value ("1", etc)
|
|
2159
2162
|
const selectedCells = [];
|
|
2160
2163
|
const rowLength = selectedRows.length;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import { devCatch, passthrough } from '../../Helpers/Helpers.svelte.js';
|
|
5
5
|
import { InputVariant } from '../../Types/Internal/InputVariant.js';
|
|
6
|
-
import { tick } from 'svelte';
|
|
6
|
+
import { tick, untrack } from 'svelte';
|
|
7
7
|
import Icon from '../Icon.svelte';
|
|
8
8
|
import TextInput from '../TextInput.svelte';
|
|
9
9
|
import type { NumberKeyboardProps } from './NumberKeyboardProps.js';
|
|
@@ -17,10 +17,29 @@
|
|
|
17
17
|
max,
|
|
18
18
|
decimal = false,
|
|
19
19
|
inputRef = $bindable(),
|
|
20
|
-
coerceValue =
|
|
20
|
+
coerceValue = false,
|
|
21
21
|
}: NumberKeyboardProps = $props();
|
|
22
22
|
|
|
23
|
-
let _value: string = $derived(
|
|
23
|
+
let _value: string = $derived(
|
|
24
|
+
value != null && value % 1 == 0 ? value.toString() : getDecimalValue()
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
function getDecimalPlaces(value: number): number {
|
|
28
|
+
const str = value.toString();
|
|
29
|
+
if (!str.includes('.')) {
|
|
30
|
+
return decimal ? 2 : 0;
|
|
31
|
+
}
|
|
32
|
+
return str.split('.')[1].length;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const decimalPlaces = $derived(
|
|
36
|
+
min != null ? getDecimalPlaces(min) : max != null ? getDecimalPlaces(max) : decimal ? 2 : 0
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
function getDecimalValue(): string {
|
|
40
|
+
//HACK this absolutely moronic line is intentional. It's the best way to allow arbitrary decimal places without adding leading zeroes
|
|
41
|
+
return value ? parseFloat(value.toFixed(decimalPlaces)).toString() : '';
|
|
42
|
+
}
|
|
24
43
|
|
|
25
44
|
const newValue = $derived.by(() => {
|
|
26
45
|
const v = decimal ? parseFloat(_value) : parseInt(_value);
|
|
@@ -32,22 +51,32 @@
|
|
|
32
51
|
|
|
33
52
|
$effect(() => {
|
|
34
53
|
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
54
|
+
if (coerceValue) {
|
|
55
|
+
const v =
|
|
56
|
+
min != undefined && newValue != null && min > newValue
|
|
57
|
+
? min
|
|
58
|
+
: max != undefined && newValue != null && max < newValue
|
|
59
|
+
? max
|
|
60
|
+
: newValue;
|
|
42
61
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
62
|
+
value = v;
|
|
63
|
+
} else {
|
|
64
|
+
value = newValue;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
untrack(() => {
|
|
68
|
+
refocus();
|
|
69
|
+
});
|
|
48
70
|
}
|
|
49
71
|
});
|
|
50
72
|
|
|
73
|
+
function refocus() {
|
|
74
|
+
tick()
|
|
75
|
+
.then(() => {
|
|
76
|
+
inputRef?.focus();
|
|
77
|
+
})
|
|
78
|
+
.catch(devCatch);
|
|
79
|
+
}
|
|
51
80
|
function getPrevValue() {
|
|
52
81
|
if (inputRef) {
|
|
53
82
|
if (
|
|
@@ -62,6 +91,7 @@
|
|
|
62
91
|
|
|
63
92
|
function addDecimal() {
|
|
64
93
|
_value = getPrevValue() + '.';
|
|
94
|
+
refocus();
|
|
65
95
|
}
|
|
66
96
|
|
|
67
97
|
/* due to the fact that number inputs won't allow a leading dot, we have to use a text input
|
|
@@ -74,16 +104,24 @@
|
|
|
74
104
|
|
|
75
105
|
function backspace() {
|
|
76
106
|
const preVvalue = getPrevValue();
|
|
77
|
-
|
|
107
|
+
const v = preVvalue && _value.slice(0, _value.length - 1);
|
|
108
|
+
_value = v;
|
|
78
109
|
}
|
|
79
110
|
|
|
80
111
|
function minus() {
|
|
81
|
-
|
|
112
|
+
const v = ((decimal ? parseFloat(_value) : parseInt(_value)) || 0) - 1;
|
|
113
|
+
|
|
114
|
+
_value = (min != null ? Math.max(min, v) : v).toString();
|
|
82
115
|
}
|
|
83
116
|
|
|
84
117
|
function plus() {
|
|
85
|
-
|
|
118
|
+
const v = ((decimal ? parseFloat(_value) : parseInt(_value)) || 0) + 1;
|
|
119
|
+
|
|
120
|
+
_value = (max != null ? Math.min(max, v) : v).toString();
|
|
86
121
|
}
|
|
122
|
+
|
|
123
|
+
const lessThanMin = $derived(min != null && (value == null || value < min));
|
|
124
|
+
const moreThanMax = $derived(max != null && (value == null || value > max));
|
|
87
125
|
</script>
|
|
88
126
|
|
|
89
127
|
<div class="number-input-wrapper">
|
|
@@ -98,6 +136,7 @@
|
|
|
98
136
|
bind:value={_value}
|
|
99
137
|
variant={InputVariant.Modal}
|
|
100
138
|
required
|
|
139
|
+
invalid={lessThanMin || moreThanMax}
|
|
101
140
|
/>
|
|
102
141
|
{#if max != undefined}
|
|
103
142
|
<TextInput
|
|
@@ -204,7 +243,7 @@
|
|
|
204
243
|
<button
|
|
205
244
|
onkeydown={passthrough}
|
|
206
245
|
type="button"
|
|
207
|
-
disabled={!decimal || (value != null && value % 1 !== 0)}
|
|
246
|
+
disabled={!decimal || (value != null && value % 1 !== 0) || _value.endsWith('.')}
|
|
208
247
|
onclick={addDecimal}>.</button
|
|
209
248
|
>
|
|
210
249
|
<button
|
|
@@ -2,18 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
<script
|
|
4
4
|
lang="ts"
|
|
5
|
-
|
|
5
|
+
generics="CommonDenominator"
|
|
6
6
|
>
|
|
7
|
-
import { dev } from '$app/environment';
|
|
8
7
|
import { onMount, untrack } from 'svelte';
|
|
9
8
|
import VerticalTabGroupButton from './VerticalTabGroupButton.svelte';
|
|
10
9
|
import type { VerticalTabGroupProps } from './VerticalTabGroupProps.js';
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<script
|
|
14
|
-
lang="ts"
|
|
15
|
-
generics="CommonDenominator"
|
|
16
|
-
>
|
|
17
10
|
let {
|
|
18
11
|
name,
|
|
19
12
|
tabs,
|
|
@@ -24,27 +17,6 @@
|
|
|
24
17
|
nohistory = false,
|
|
25
18
|
}: VerticalTabGroupProps<CommonDenominator> = $props();
|
|
26
19
|
|
|
27
|
-
$effect(() => {
|
|
28
|
-
if (!dev) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
for (const tab of tabs) {
|
|
32
|
-
if (tab.debug) {
|
|
33
|
-
$inspect(
|
|
34
|
-
tab.label,
|
|
35
|
-
tab.content,
|
|
36
|
-
tab.onclick,
|
|
37
|
-
tab.args,
|
|
38
|
-
tab.iconLeft,
|
|
39
|
-
tab.iconRight,
|
|
40
|
-
tab.isValid,
|
|
41
|
-
tab.disabled,
|
|
42
|
-
tab.visible
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
20
|
onMount(() => {
|
|
49
21
|
if (name && !nohistory) {
|
|
50
22
|
const tabName = sessionStorage.getItem(`${name}-active-tab`);
|