@ims360/svelte-ivory 0.0.39 → 0.0.41
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.
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
|
|
48
48
|
// this must be separate to the above effect, since otherwise the width would be reset on every scroll
|
|
49
49
|
$effect(() => {
|
|
50
|
-
if (!column.resizable) column.resize(props.width);
|
|
50
|
+
if (!column.resizable && props.width !== undefined) column.resize(props.width);
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
function onClick(e: MouseEvent) {
|
|
@@ -84,71 +84,69 @@
|
|
|
84
84
|
const treeIndicatorId = pseudoRandomId('tree-indicator-');
|
|
85
85
|
</script>
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
87
|
+
<VirtualList
|
|
88
|
+
data={results.entries}
|
|
89
|
+
class={twMerge(clsx(['flex flex-col overflow-hidden border-transparent', clazz]))}
|
|
90
|
+
bind:b_scrollTop={table.scrollTop}
|
|
91
|
+
{rowHeight}
|
|
92
|
+
>
|
|
93
|
+
{#snippet header()}
|
|
94
|
+
<div
|
|
95
|
+
class={twMerge(
|
|
96
|
+
clsx(
|
|
97
|
+
'flex w-fit min-w-full flex-row gap-2 border-b border-inherit pr-4 pl-2',
|
|
98
|
+
headerClass
|
|
99
|
+
)
|
|
100
|
+
)}
|
|
101
|
+
>
|
|
102
|
+
{#each table.columns as column (column.id)}
|
|
103
|
+
<ColumnHead {column}>
|
|
104
|
+
{#if typeof column.header === 'function'}
|
|
105
|
+
{@render column.header()}
|
|
106
|
+
{:else}
|
|
107
|
+
<div
|
|
108
|
+
class="flex grow flex-row items-center justify-start gap-4 py-2 text-start select-none"
|
|
109
|
+
>
|
|
110
|
+
{column.header}
|
|
111
|
+
</div>
|
|
112
|
+
{/if}
|
|
113
|
+
</ColumnHead>
|
|
114
|
+
{/each}
|
|
115
|
+
</div>
|
|
116
|
+
{/snippet}
|
|
117
|
+
{#snippet children({ row: { node, id, nestingLevel }, index })}
|
|
118
|
+
<Row
|
|
119
|
+
onclick={onclick ? () => onclick(node) : undefined}
|
|
120
|
+
href={href?.(node)}
|
|
121
|
+
class={rowClass}
|
|
122
|
+
>
|
|
123
|
+
{@render firstColumn?.({ row: node })}
|
|
124
|
+
<Column
|
|
125
|
+
id={treeIndicatorId}
|
|
126
|
+
resizable={false}
|
|
127
|
+
header=""
|
|
128
|
+
onclick={() => {
|
|
129
|
+
table.toggleExpansion(node.id);
|
|
130
|
+
}}
|
|
131
|
+
ignoreWidth={results.someHaveChildren}
|
|
132
|
+
width={results.someHaveChildren ? 24 : 0}
|
|
133
|
+
minWidth={0}
|
|
102
134
|
>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
{@render column.header()}
|
|
107
|
-
{:else}
|
|
108
|
-
<div
|
|
109
|
-
class="flex grow flex-row items-center justify-start gap-4 py-2 text-start select-none"
|
|
110
|
-
>
|
|
111
|
-
{column.header}
|
|
112
|
-
</div>
|
|
113
|
-
{/if}
|
|
114
|
-
</ColumnHead>
|
|
115
|
-
{/each}
|
|
116
|
-
</div>
|
|
117
|
-
{/snippet}
|
|
118
|
-
{#snippet children({ row: { node, id, nestingLevel }, index })}
|
|
119
|
-
<Row
|
|
120
|
-
onclick={onclick ? () => onclick(node) : undefined}
|
|
121
|
-
href={href?.(node)}
|
|
122
|
-
class={rowClass}
|
|
123
|
-
>
|
|
124
|
-
{@render firstColumn?.({ row: node })}
|
|
125
|
-
<Column
|
|
126
|
-
id={treeIndicatorId}
|
|
127
|
-
resizable={false}
|
|
128
|
-
header=""
|
|
129
|
-
onclick={() => {
|
|
130
|
-
table.toggleExpansion(node.id);
|
|
131
|
-
}}
|
|
132
|
-
ignoreWidth={results.someHaveChildren}
|
|
133
|
-
width={results.someHaveChildren ? 24 : 0}
|
|
134
|
-
minWidth={0}
|
|
135
|
+
<div
|
|
136
|
+
class="flex h-full items-center justify-end"
|
|
137
|
+
style="width: calc(var(--spacing) * {nestingLevel * nestingInset} + 24px);"
|
|
135
138
|
>
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
{@render passedChildren?.({ row: node, nestingLevel, index })}
|
|
151
|
-
</Row>
|
|
152
|
-
{/snippet}
|
|
153
|
-
</VirtualList>
|
|
154
|
-
{/key}
|
|
139
|
+
{#if node.children}
|
|
140
|
+
<ChevronRight
|
|
141
|
+
class={[
|
|
142
|
+
'ml-auto aspect-square shrink-0 transition-transform duration-100',
|
|
143
|
+
table.expanded.has(id) && 'rotate-90'
|
|
144
|
+
]}
|
|
145
|
+
/>
|
|
146
|
+
{/if}
|
|
147
|
+
</div>
|
|
148
|
+
</Column>
|
|
149
|
+
{@render passedChildren?.({ row: node, nestingLevel, index })}
|
|
150
|
+
</Row>
|
|
151
|
+
{/snippet}
|
|
152
|
+
</VirtualList>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/Table.svelte.ts"],"names":[],"mappings":"AAMI,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAU,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,GAAG,CAAC;AAM9E,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC;IAC7C,KAAK,CAAC,EAAE,UA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U,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
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
|
|
48
48
|
// this must be separate to the above effect, since otherwise the width would be reset on every scroll
|
|
49
49
|
$effect(() => {
|
|
50
|
-
if (!column.resizable) column.resize(props.width);
|
|
50
|
+
if (!column.resizable && props.width !== undefined) column.resize(props.width);
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
function onClick(e: MouseEvent) {
|
|
@@ -84,71 +84,69 @@
|
|
|
84
84
|
const treeIndicatorId = pseudoRandomId('tree-indicator-');
|
|
85
85
|
</script>
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
87
|
+
<VirtualList
|
|
88
|
+
data={results.entries}
|
|
89
|
+
class={twMerge(clsx(['flex flex-col overflow-hidden border-transparent', clazz]))}
|
|
90
|
+
bind:b_scrollTop={table.scrollTop}
|
|
91
|
+
{rowHeight}
|
|
92
|
+
>
|
|
93
|
+
{#snippet header()}
|
|
94
|
+
<div
|
|
95
|
+
class={twMerge(
|
|
96
|
+
clsx(
|
|
97
|
+
'flex w-fit min-w-full flex-row gap-2 border-b border-inherit pr-4 pl-2',
|
|
98
|
+
headerClass
|
|
99
|
+
)
|
|
100
|
+
)}
|
|
101
|
+
>
|
|
102
|
+
{#each table.columns as column (column.id)}
|
|
103
|
+
<ColumnHead {column}>
|
|
104
|
+
{#if typeof column.header === 'function'}
|
|
105
|
+
{@render column.header()}
|
|
106
|
+
{:else}
|
|
107
|
+
<div
|
|
108
|
+
class="flex grow flex-row items-center justify-start gap-4 py-2 text-start select-none"
|
|
109
|
+
>
|
|
110
|
+
{column.header}
|
|
111
|
+
</div>
|
|
112
|
+
{/if}
|
|
113
|
+
</ColumnHead>
|
|
114
|
+
{/each}
|
|
115
|
+
</div>
|
|
116
|
+
{/snippet}
|
|
117
|
+
{#snippet children({ row: { node, id, nestingLevel }, index })}
|
|
118
|
+
<Row
|
|
119
|
+
onclick={onclick ? () => onclick(node) : undefined}
|
|
120
|
+
href={href?.(node)}
|
|
121
|
+
class={rowClass}
|
|
122
|
+
>
|
|
123
|
+
{@render firstColumn?.({ row: node })}
|
|
124
|
+
<Column
|
|
125
|
+
id={treeIndicatorId}
|
|
126
|
+
resizable={false}
|
|
127
|
+
header=""
|
|
128
|
+
onclick={() => {
|
|
129
|
+
table.toggleExpansion(node.id);
|
|
130
|
+
}}
|
|
131
|
+
ignoreWidth={results.someHaveChildren}
|
|
132
|
+
width={results.someHaveChildren ? 24 : 0}
|
|
133
|
+
minWidth={0}
|
|
102
134
|
>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
{@render column.header()}
|
|
107
|
-
{:else}
|
|
108
|
-
<div
|
|
109
|
-
class="flex grow flex-row items-center justify-start gap-4 py-2 text-start select-none"
|
|
110
|
-
>
|
|
111
|
-
{column.header}
|
|
112
|
-
</div>
|
|
113
|
-
{/if}
|
|
114
|
-
</ColumnHead>
|
|
115
|
-
{/each}
|
|
116
|
-
</div>
|
|
117
|
-
{/snippet}
|
|
118
|
-
{#snippet children({ row: { node, id, nestingLevel }, index })}
|
|
119
|
-
<Row
|
|
120
|
-
onclick={onclick ? () => onclick(node) : undefined}
|
|
121
|
-
href={href?.(node)}
|
|
122
|
-
class={rowClass}
|
|
123
|
-
>
|
|
124
|
-
{@render firstColumn?.({ row: node })}
|
|
125
|
-
<Column
|
|
126
|
-
id={treeIndicatorId}
|
|
127
|
-
resizable={false}
|
|
128
|
-
header=""
|
|
129
|
-
onclick={() => {
|
|
130
|
-
table.toggleExpansion(node.id);
|
|
131
|
-
}}
|
|
132
|
-
ignoreWidth={results.someHaveChildren}
|
|
133
|
-
width={results.someHaveChildren ? 24 : 0}
|
|
134
|
-
minWidth={0}
|
|
135
|
+
<div
|
|
136
|
+
class="flex h-full items-center justify-end"
|
|
137
|
+
style="width: calc(var(--spacing) * {nestingLevel * nestingInset} + 24px);"
|
|
135
138
|
>
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
{@render passedChildren?.({ row: node, nestingLevel, index })}
|
|
151
|
-
</Row>
|
|
152
|
-
{/snippet}
|
|
153
|
-
</VirtualList>
|
|
154
|
-
{/key}
|
|
139
|
+
{#if node.children}
|
|
140
|
+
<ChevronRight
|
|
141
|
+
class={[
|
|
142
|
+
'ml-auto aspect-square shrink-0 transition-transform duration-100',
|
|
143
|
+
table.expanded.has(id) && 'rotate-90'
|
|
144
|
+
]}
|
|
145
|
+
/>
|
|
146
|
+
{/if}
|
|
147
|
+
</div>
|
|
148
|
+
</Column>
|
|
149
|
+
{@render passedChildren?.({ row: node, nestingLevel, index })}
|
|
150
|
+
</Row>
|
|
151
|
+
{/snippet}
|
|
152
|
+
</VirtualList>
|