@ims360/svelte-ivory 0.0.48 → 0.0.49
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/Column.svelte +17 -17
- package/dist/components/table/Table.svelte +7 -3
- package/dist/components/table/Table.svelte.d.ts +1 -0
- package/dist/components/table/Table.svelte.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/components/table/Column.svelte +17 -17
- package/src/lib/components/table/Table.svelte +7 -3
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
<script lang="ts">
|
|
28
28
|
let {
|
|
29
|
-
class: clazz
|
|
29
|
+
class: clazz,
|
|
30
30
|
children,
|
|
31
31
|
onclick,
|
|
32
32
|
ignoreWidth = false,
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
const column = tableContext.registerColumn({ resizable, ...props });
|
|
43
43
|
|
|
44
44
|
const finalOnClick = $derived(onclick || rowContext.onclick);
|
|
45
|
-
const allowClicking = $derived(!!onclick);
|
|
45
|
+
const allowClicking = $derived(!!(onclick || rowContext.onclick));
|
|
46
46
|
|
|
47
47
|
const element = $derived.by(() => {
|
|
48
48
|
if (finalOnClick) return 'button';
|
|
@@ -59,27 +59,27 @@
|
|
|
59
59
|
$effect(() => {
|
|
60
60
|
if (!column.resizable && props.width !== undefined) column.resize(props.width);
|
|
61
61
|
});
|
|
62
|
+
|
|
63
|
+
const widthStyle = $derived(
|
|
64
|
+
`calc(${column.width ?? 0}px - var(--spacing) * ${offsetNestingLevel * tableContext.nestingInset}) !important;`
|
|
65
|
+
);
|
|
62
66
|
</script>
|
|
63
67
|
|
|
64
68
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
65
69
|
<svelte:element
|
|
66
70
|
this={element}
|
|
67
71
|
onclick={allowClicking ? finalOnClick : undefined}
|
|
68
|
-
href={rowContext.href}
|
|
72
|
+
href={!allowClicking ? rowContext.href : undefined}
|
|
69
73
|
type={allowClicking ? 'button' : undefined}
|
|
70
|
-
style={ignoreWidth
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
]
|
|
80
|
-
]}
|
|
74
|
+
style={ignoreWidth ? '' : `width: ${widthStyle}`}
|
|
75
|
+
class={twMerge(
|
|
76
|
+
clsx([
|
|
77
|
+
'box-border flex h-full shrink-0 flex-row items-center justify-start gap-1 truncate',
|
|
78
|
+
column.width !== 0 && 'pr-2',
|
|
79
|
+
defaultClasses,
|
|
80
|
+
clazz
|
|
81
|
+
])
|
|
82
|
+
)}
|
|
81
83
|
>
|
|
82
|
-
|
|
83
|
-
{@render children()}
|
|
84
|
-
</div>
|
|
84
|
+
{@render children()}
|
|
85
85
|
</svelte:element>
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
readonly registerColumn: (config: ColumnConfig) => ColumnController;
|
|
48
48
|
readonly toggleExpansion: (id: string) => void;
|
|
49
49
|
readonly nestingInset: number;
|
|
50
|
+
readonly rowHeight: number;
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
function setTableContext<T extends TableRow<T>>(context: TableContext<T>) {
|
|
@@ -160,6 +161,9 @@
|
|
|
160
161
|
},
|
|
161
162
|
get nestingInset() {
|
|
162
163
|
return nestingInset;
|
|
164
|
+
},
|
|
165
|
+
get rowHeight() {
|
|
166
|
+
return rowHeight;
|
|
163
167
|
}
|
|
164
168
|
});
|
|
165
169
|
</script>
|
|
@@ -213,9 +217,9 @@
|
|
|
213
217
|
minWidth={0}
|
|
214
218
|
>
|
|
215
219
|
<div
|
|
216
|
-
class="flex h-full items-center justify-end
|
|
217
|
-
style="width: calc(var(--spacing) * {nestingLevel *
|
|
218
|
-
|
|
220
|
+
class="flex h-full items-center justify-end"
|
|
221
|
+
style="width: calc(var(--spacing) * {nestingLevel * nestingInset -
|
|
222
|
+
2} + {treeIndicatorInset}px);"
|
|
219
223
|
>
|
|
220
224
|
{#if node.children}
|
|
221
225
|
<ChevronRight
|
|
@@ -41,6 +41,7 @@ export type TableContext<T extends TableRow<T>> = {
|
|
|
41
41
|
readonly registerColumn: (config: ColumnConfig) => ColumnController;
|
|
42
42
|
readonly toggleExpansion: (id: string) => void;
|
|
43
43
|
readonly nestingInset: number;
|
|
44
|
+
readonly rowHeight: number;
|
|
44
45
|
};
|
|
45
46
|
export declare function getTableContext<T extends TableRow<T>>(): TableContext<T>;
|
|
46
47
|
declare function $$render<T extends TableRow<T>>(): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/Table.svelte.ts"],"names":[],"mappings":"AAKI,OAAO,EAAmC,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAA6B,KAAK,QAAQ,EAAE,MAAM,GAAG,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAOhF,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC;IAC7C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC3B,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;QAAE,GAAG,EAAE,CAAC,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC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C,CAAC,CAAC;IAChZ,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/I,YAAY,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;CACjE;AACD,QAAA,MAAM,KAAK,EAAE,qBAAmC,CAAC;AAC/B,KAAK,KAAK,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,eAAe,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
<script lang="ts">
|
|
28
28
|
let {
|
|
29
|
-
class: clazz
|
|
29
|
+
class: clazz,
|
|
30
30
|
children,
|
|
31
31
|
onclick,
|
|
32
32
|
ignoreWidth = false,
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
const column = tableContext.registerColumn({ resizable, ...props });
|
|
43
43
|
|
|
44
44
|
const finalOnClick = $derived(onclick || rowContext.onclick);
|
|
45
|
-
const allowClicking = $derived(!!onclick);
|
|
45
|
+
const allowClicking = $derived(!!(onclick || rowContext.onclick));
|
|
46
46
|
|
|
47
47
|
const element = $derived.by(() => {
|
|
48
48
|
if (finalOnClick) return 'button';
|
|
@@ -59,27 +59,27 @@
|
|
|
59
59
|
$effect(() => {
|
|
60
60
|
if (!column.resizable && props.width !== undefined) column.resize(props.width);
|
|
61
61
|
});
|
|
62
|
+
|
|
63
|
+
const widthStyle = $derived(
|
|
64
|
+
`calc(${column.width ?? 0}px - var(--spacing) * ${offsetNestingLevel * tableContext.nestingInset}) !important;`
|
|
65
|
+
);
|
|
62
66
|
</script>
|
|
63
67
|
|
|
64
68
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
65
69
|
<svelte:element
|
|
66
70
|
this={element}
|
|
67
71
|
onclick={allowClicking ? finalOnClick : undefined}
|
|
68
|
-
href={rowContext.href}
|
|
72
|
+
href={!allowClicking ? rowContext.href : undefined}
|
|
69
73
|
type={allowClicking ? 'button' : undefined}
|
|
70
|
-
style={ignoreWidth
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
]
|
|
80
|
-
]}
|
|
74
|
+
style={ignoreWidth ? '' : `width: ${widthStyle}`}
|
|
75
|
+
class={twMerge(
|
|
76
|
+
clsx([
|
|
77
|
+
'box-border flex h-full shrink-0 flex-row items-center justify-start gap-1 truncate',
|
|
78
|
+
column.width !== 0 && 'pr-2',
|
|
79
|
+
defaultClasses,
|
|
80
|
+
clazz
|
|
81
|
+
])
|
|
82
|
+
)}
|
|
81
83
|
>
|
|
82
|
-
|
|
83
|
-
{@render children()}
|
|
84
|
-
</div>
|
|
84
|
+
{@render children()}
|
|
85
85
|
</svelte:element>
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
readonly registerColumn: (config: ColumnConfig) => ColumnController;
|
|
48
48
|
readonly toggleExpansion: (id: string) => void;
|
|
49
49
|
readonly nestingInset: number;
|
|
50
|
+
readonly rowHeight: number;
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
function setTableContext<T extends TableRow<T>>(context: TableContext<T>) {
|
|
@@ -160,6 +161,9 @@
|
|
|
160
161
|
},
|
|
161
162
|
get nestingInset() {
|
|
162
163
|
return nestingInset;
|
|
164
|
+
},
|
|
165
|
+
get rowHeight() {
|
|
166
|
+
return rowHeight;
|
|
163
167
|
}
|
|
164
168
|
});
|
|
165
169
|
</script>
|
|
@@ -213,9 +217,9 @@
|
|
|
213
217
|
minWidth={0}
|
|
214
218
|
>
|
|
215
219
|
<div
|
|
216
|
-
class="flex h-full items-center justify-end
|
|
217
|
-
style="width: calc(var(--spacing) * {nestingLevel *
|
|
218
|
-
|
|
220
|
+
class="flex h-full items-center justify-end"
|
|
221
|
+
style="width: calc(var(--spacing) * {nestingLevel * nestingInset -
|
|
222
|
+
2} + {treeIndicatorInset}px);"
|
|
219
223
|
>
|
|
220
224
|
{#if node.children}
|
|
221
225
|
<ChevronRight
|