@isoftdata/svelte-table 2.8.1 → 2.9.0
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/Table.svelte +3 -1
- package/dist/Td.svelte +6 -3
- package/dist/Td.svelte.d.ts +38 -24
- package/dist/bracket-paths.d.ts +4 -16
- package/package.json +2 -2
package/dist/Table.svelte
CHANGED
|
@@ -903,7 +903,9 @@
|
|
|
903
903
|
</thead>
|
|
904
904
|
<tbody class:unselectable={selectionMode === 'RANGE'}>
|
|
905
905
|
{#snippet tableRow(row: R & { originalIndex: number; uuid: string }, index: number)}
|
|
906
|
-
{#if children}
|
|
906
|
+
{#if children}
|
|
907
|
+
{@render children({ row, index })}
|
|
908
|
+
{:else}
|
|
907
909
|
<tr
|
|
908
910
|
class:table-primary={rowIsSelected(row, rowSelectionIdProp, selectedRowIds)}
|
|
909
911
|
onclick={() => rowClick(row)}
|
package/dist/Td.svelte
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
1
|
+
<script
|
|
2
|
+
lang="ts"
|
|
3
|
+
generics="R extends UuidRowProps = any"
|
|
4
|
+
>
|
|
5
|
+
import type { ColumnInfo, RowProperties, UuidRowProps } from './'
|
|
3
6
|
import type { ColumnInfoRunicStore } from './column-info-store.svelte'
|
|
4
7
|
import type { HTMLTdAttributes, ClassValue } from 'svelte/elements'
|
|
5
8
|
import type { Writable } from 'svelte/store'
|
|
@@ -12,7 +15,7 @@
|
|
|
12
15
|
|
|
13
16
|
interface Props extends Omit<HTMLTdAttributes, 'align'> {
|
|
14
17
|
class?: ClassValue
|
|
15
|
-
property:
|
|
18
|
+
property: ColumnInfo<R>['property']
|
|
16
19
|
/** Direction to align the column's contents
|
|
17
20
|
*
|
|
18
21
|
* `start` and `end` are only available in Bootstrap 5+
|
package/dist/Td.svelte.d.ts
CHANGED
|
@@ -1,28 +1,42 @@
|
|
|
1
|
+
import type { RowProperties, UuidRowProps } from './';
|
|
1
2
|
import type { HTMLTdAttributes, ClassValue } from 'svelte/elements';
|
|
2
3
|
import { type Snippet } from 'svelte';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
declare class __sveltets_Render<R extends UuidRowProps = any> {
|
|
5
|
+
props(): Omit<HTMLTdAttributes, "align"> & {
|
|
6
|
+
class?: ClassValue;
|
|
7
|
+
property: `_${string}` | RowProperties<R>;
|
|
8
|
+
/** Direction to align the column's contents
|
|
9
|
+
*
|
|
10
|
+
* `start` and `end` are only available in Bootstrap 5+
|
|
11
|
+
*
|
|
12
|
+
* `left` and `right`should only be used while you transition to Boostrap 5+
|
|
13
|
+
*/
|
|
14
|
+
align?: "start" | "left" | "center" | "right" | "end";
|
|
15
|
+
/** If enabled, pressing enter while focused in this Td will focus the next non-disabled input/select/textarea in the column. Holding shift will go up instead of down.
|
|
16
|
+
*
|
|
17
|
+
* Can also be a callback that is fired when the enter key is used to move between rows.
|
|
18
|
+
*/
|
|
19
|
+
enterGoesDown?: boolean | ((ctx: {
|
|
20
|
+
event: KeyboardEvent;
|
|
21
|
+
tr: HTMLTableRowElement;
|
|
22
|
+
}) => void) | undefined;
|
|
23
|
+
/** If enabled, keypress (enter only) and click events on the Td's contents will have `stopPropagation`/`preventDefault` called on them. */
|
|
24
|
+
stopPropagation?: boolean;
|
|
25
|
+
tagName?: "TD" | "TH";
|
|
26
|
+
children?: Snippet;
|
|
27
|
+
};
|
|
28
|
+
events(): {};
|
|
29
|
+
slots(): {};
|
|
30
|
+
bindings(): "align";
|
|
31
|
+
exports(): {};
|
|
25
32
|
}
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
interface $$IsomorphicComponent {
|
|
34
|
+
new <R extends UuidRowProps = any>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<R>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<R>['props']>, ReturnType<__sveltets_Render<R>['events']>, ReturnType<__sveltets_Render<R>['slots']>> & {
|
|
35
|
+
$$bindings?: ReturnType<__sveltets_Render<R>['bindings']>;
|
|
36
|
+
} & ReturnType<__sveltets_Render<R>['exports']>;
|
|
37
|
+
<R extends UuidRowProps = any>(internal: unknown, props: ReturnType<__sveltets_Render<R>['props']> & {}): ReturnType<__sveltets_Render<R>['exports']>;
|
|
38
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
39
|
+
}
|
|
40
|
+
declare const Td: $$IsomorphicComponent;
|
|
41
|
+
type Td<R extends UuidRowProps = any> = InstanceType<typeof Td<R>>;
|
|
28
42
|
export default Td;
|
package/dist/bracket-paths.d.ts
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { NonRecursiveType, StaticPartOfArray, VariablePartOfArray, ToString } from 'type-fest/source/internal';
|
|
3
|
-
import type { PathsOptions } from 'type-fest/source/paths';
|
|
1
|
+
import type { PathsOptions, Paths } from 'type-fest';
|
|
4
2
|
/**
|
|
5
3
|
Generate a union of all possible paths to properties in the given object, denoting the object structure with brackets.
|
|
6
4
|
|
|
7
5
|
This is the `Paths` utility type from the `type-fest` package, but with brackets.
|
|
8
6
|
*/
|
|
9
|
-
export type BracketPaths<Row, Options extends PathsOptions = {}> =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
type DoEndBracket<Key extends string | number, DoBracket extends boolean | undefined> = DoBracket extends true ? `${Key}]` : Key;
|
|
14
|
-
type InternalPaths<T, Options extends InternalPathOptions = {}> = (Options['maxRecursionDepth'] extends number ? Options['maxRecursionDepth'] : 10) extends infer MaxDepth extends number ? Required<T> extends infer T ? T extends EmptyObject | readonly [] ? never : {
|
|
15
|
-
[Key in keyof T]: Key extends string | number ? DoEndBracket<Key, Options['doEndBracket']> | DoEndBracket<ToString<Key>, Options['doEndBracket']> | (GreaterThan<MaxDepth, 0> extends true ? IsNever<BracketPaths<T[Key], {
|
|
16
|
-
maxRecursionDepth: Subtract<MaxDepth, 1>;
|
|
17
|
-
}>> extends false ? `${DoEndBracket<Key, Options['doEndBracket']>}[${BracketPaths<T[Key], {
|
|
18
|
-
maxRecursionDepth: Subtract<MaxDepth, 1>;
|
|
19
|
-
doEndBracket: true;
|
|
20
|
-
}>}` : never : never) : never;
|
|
21
|
-
}[keyof T & (T extends UnknownArray ? number : unknown)] : never : never;
|
|
7
|
+
export type BracketPaths<Row, Options extends PathsOptions = {}> = DotToBracket<Paths<Row, Options>>;
|
|
8
|
+
export type DotToBracket<S extends string | unknown> = S extends `${infer Head}.${infer Tail}` ? `${Head}${_DotToBracketTail<Tail>}` : S;
|
|
9
|
+
type _DotToBracketTail<S extends string> = S extends `${infer Part}.${infer Rest}` ? `[${Part}]${_DotToBracketTail<Rest>}` : `[${S}]`;
|
|
22
10
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isoftdata/svelte-table",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"svelte": "^5.22.1",
|
|
41
41
|
"svelte-check": "^4.1.4",
|
|
42
42
|
"tslib": "^2.8.1",
|
|
43
|
-
"type-fest": "^4.
|
|
43
|
+
"type-fest": "^4.41.0",
|
|
44
44
|
"typescript": "^5.8.2",
|
|
45
45
|
"vite": "^6.2.0"
|
|
46
46
|
},
|