@urbicon-ui/table 6.1.4
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/README.md +153 -0
- package/dist/cells/ActionButtons.svelte +224 -0
- package/dist/cells/ActionButtons.svelte.d.ts +74 -0
- package/dist/cells/CopyButton.svelte +89 -0
- package/dist/cells/CopyButton.svelte.d.ts +33 -0
- package/dist/cells/CustomCell.svelte +136 -0
- package/dist/cells/CustomCell.svelte.d.ts +44 -0
- package/dist/cells/DateCell.svelte +194 -0
- package/dist/cells/DateCell.svelte.d.ts +39 -0
- package/dist/cells/LinkCell.svelte +240 -0
- package/dist/cells/LinkCell.svelte.d.ts +42 -0
- package/dist/cells/NumberCell.svelte +225 -0
- package/dist/cells/NumberCell.svelte.d.ts +47 -0
- package/dist/cells/StatusBadge.svelte +121 -0
- package/dist/cells/StatusBadge.svelte.d.ts +44 -0
- package/dist/cells/UserAvatar.svelte +71 -0
- package/dist/cells/UserAvatar.svelte.d.ts +37 -0
- package/dist/cells/index.d.ts +8 -0
- package/dist/cells/index.js +9 -0
- package/dist/core/EmptyState.svelte +161 -0
- package/dist/core/EmptyState.svelte.d.ts +16 -0
- package/dist/core/ErrorState.svelte +158 -0
- package/dist/core/ErrorState.svelte.d.ts +15 -0
- package/dist/core/GroupedRow.svelte +239 -0
- package/dist/core/GroupedRow.svelte.d.ts +18 -0
- package/dist/core/LoadingState.svelte +75 -0
- package/dist/core/LoadingState.svelte.d.ts +14 -0
- package/dist/core/MobileCard.svelte +151 -0
- package/dist/core/MobileCard.svelte.d.ts +15 -0
- package/dist/core/TableCell.svelte +105 -0
- package/dist/core/TableCell.svelte.d.ts +14 -0
- package/dist/core/TableDesktop.svelte +480 -0
- package/dist/core/TableDesktop.svelte.d.ts +26 -0
- package/dist/core/TableHead.svelte +314 -0
- package/dist/core/TableHead.svelte.d.ts +7 -0
- package/dist/core/TableMobile.svelte +112 -0
- package/dist/core/TableMobile.svelte.d.ts +13 -0
- package/dist/core/TableProvider.svelte +271 -0
- package/dist/core/TableProvider.svelte.d.ts +40 -0
- package/dist/core/TableRow.svelte +171 -0
- package/dist/core/TableRow.svelte.d.ts +16 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/index.js +14 -0
- package/dist/core/sticky-context.svelte.d.ts +48 -0
- package/dist/core/sticky-context.svelte.js +88 -0
- package/dist/core/table/Table.svelte +304 -0
- package/dist/core/table/Table.svelte.d.ts +26 -0
- package/dist/core/table/index.d.ts +448 -0
- package/dist/core/table/index.js +1 -0
- package/dist/core/table-style-context.d.ts +66 -0
- package/dist/core/table-style-context.js +26 -0
- package/dist/factories/ColumnValidation.d.ts +49 -0
- package/dist/factories/ColumnValidation.js +188 -0
- package/dist/factories/TableColumns.d.ts +97 -0
- package/dist/factories/TableColumns.js +262 -0
- package/dist/factories/TypedColumnBuilder.d.ts +41 -0
- package/dist/factories/TypedColumnBuilder.js +72 -0
- package/dist/factories/index.d.ts +12 -0
- package/dist/factories/index.js +13 -0
- package/dist/features/HeaderMenu.svelte +236 -0
- package/dist/features/HeaderMenu.svelte.d.ts +8 -0
- package/dist/features/LiveUpdateBanner.svelte +66 -0
- package/dist/features/LiveUpdateBanner.svelte.d.ts +6 -0
- package/dist/features/SearchHighlight.svelte +21 -0
- package/dist/features/SearchHighlight.svelte.d.ts +8 -0
- package/dist/features/SmartFilterBar/ChipsField.svelte +104 -0
- package/dist/features/SmartFilterBar/ChipsField.svelte.d.ts +5 -0
- package/dist/features/SmartFilterBar/ColumnVisibilityMenu.svelte +84 -0
- package/dist/features/SmartFilterBar/ColumnVisibilityMenu.svelte.d.ts +3 -0
- package/dist/features/SmartFilterBar/FilterMenu.svelte +367 -0
- package/dist/features/SmartFilterBar/FilterMenu.svelte.d.ts +3 -0
- package/dist/features/SmartFilterBar/GroupingMenu.svelte +82 -0
- package/dist/features/SmartFilterBar/GroupingMenu.svelte.d.ts +3 -0
- package/dist/features/SmartFilterBar/SmartFilterBar.svelte +109 -0
- package/dist/features/SmartFilterBar/SmartFilterBar.svelte.d.ts +11 -0
- package/dist/features/SmartFilterBar/SummaryMenu.svelte +118 -0
- package/dist/features/SmartFilterBar/SummaryMenu.svelte.d.ts +3 -0
- package/dist/features/SummaryRow.svelte +97 -0
- package/dist/features/SummaryRow.svelte.d.ts +8 -0
- package/dist/features/index.d.ts +4 -0
- package/dist/features/index.js +4 -0
- package/dist/i18n/index.d.ts +366 -0
- package/dist/i18n/index.js +21 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +41 -0
- package/dist/stores/TableStore.svelte.d.ts +192 -0
- package/dist/stores/TableStore.svelte.js +362 -0
- package/dist/stores/concerns/index.d.ts +15 -0
- package/dist/stores/concerns/index.js +14 -0
- package/dist/stores/concerns/types.d.ts +31 -0
- package/dist/stores/concerns/types.js +1 -0
- package/dist/stores/concerns/useColumnOrder.svelte.d.ts +16 -0
- package/dist/stores/concerns/useColumnOrder.svelte.js +81 -0
- package/dist/stores/concerns/useColumnVisibility.svelte.d.ts +16 -0
- package/dist/stores/concerns/useColumnVisibility.svelte.js +58 -0
- package/dist/stores/concerns/useExpansion.svelte.d.ts +9 -0
- package/dist/stores/concerns/useExpansion.svelte.js +32 -0
- package/dist/stores/concerns/useFiltering.svelte.d.ts +20 -0
- package/dist/stores/concerns/useFiltering.svelte.js +109 -0
- package/dist/stores/concerns/useFocusManagement.svelte.d.ts +15 -0
- package/dist/stores/concerns/useFocusManagement.svelte.js +52 -0
- package/dist/stores/concerns/useGrouping.svelte.d.ts +15 -0
- package/dist/stores/concerns/useGrouping.svelte.js +86 -0
- package/dist/stores/concerns/useLiveUpdates.svelte.d.ts +45 -0
- package/dist/stores/concerns/useLiveUpdates.svelte.js +175 -0
- package/dist/stores/concerns/usePagination.svelte.d.ts +18 -0
- package/dist/stores/concerns/usePagination.svelte.js +54 -0
- package/dist/stores/concerns/usePersistence.svelte.d.ts +36 -0
- package/dist/stores/concerns/usePersistence.svelte.js +167 -0
- package/dist/stores/concerns/useRemoteData.svelte.d.ts +21 -0
- package/dist/stores/concerns/useRemoteData.svelte.js +64 -0
- package/dist/stores/concerns/useSearch.svelte.d.ts +8 -0
- package/dist/stores/concerns/useSearch.svelte.js +16 -0
- package/dist/stores/concerns/useSelection.svelte.d.ts +21 -0
- package/dist/stores/concerns/useSelection.svelte.js +110 -0
- package/dist/stores/concerns/useSorting.svelte.d.ts +11 -0
- package/dist/stores/concerns/useSorting.svelte.js +70 -0
- package/dist/stores/concerns/useSummary.svelte.d.ts +18 -0
- package/dist/stores/concerns/useSummary.svelte.js +96 -0
- package/dist/stores/index.d.ts +1 -0
- package/dist/stores/index.js +1 -0
- package/dist/style/index.css +137 -0
- package/dist/style/index.d.ts +2 -0
- package/dist/style/index.js +2 -0
- package/dist/style/table-theme.css +131 -0
- package/dist/style/themes/comfortable.css +20 -0
- package/dist/style/themes/compact.css +20 -0
- package/dist/translations/de.d.ts +177 -0
- package/dist/translations/de.js +176 -0
- package/dist/translations/en.d.ts +177 -0
- package/dist/translations/en.js +176 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/tableTypes.d.ts +262 -0
- package/dist/types/tableTypes.js +1 -0
- package/dist/utils/index.d.ts +165 -0
- package/dist/utils/index.js +330 -0
- package/dist/utils/sticky-measure.d.ts +54 -0
- package/dist/utils/sticky-measure.js +107 -0
- package/dist/utils/virtualizer.d.ts +43 -0
- package/dist/utils/virtualizer.js +43 -0
- package/dist/variants/index.d.ts +11 -0
- package/dist/variants/index.js +15 -0
- package/dist/variants/table-cells.variants.d.ts +827 -0
- package/dist/variants/table-cells.variants.js +627 -0
- package/dist/variants/table-features.variants.d.ts +547 -0
- package/dist/variants/table-features.variants.js +412 -0
- package/dist/variants/table-states.variants.d.ts +594 -0
- package/dist/variants/table-states.variants.js +394 -0
- package/dist/variants/table.system.d.ts +301 -0
- package/dist/variants/table.system.js +314 -0
- package/dist/variants/table.variants.d.ts +428 -0
- package/dist/variants/table.variants.js +360 -0
- package/package.json +93 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
<script lang="ts" generics="T = TableItem">
|
|
2
|
+
import type { TableProps } from './index';
|
|
3
|
+
import type { TableItem, Column } from '../../types/tableTypes';
|
|
4
|
+
import { getTableContext } from '../../stores/TableStore.svelte.js';
|
|
5
|
+
import { tableContainerVariants } from '../../variants';
|
|
6
|
+
import {
|
|
7
|
+
Pagination,
|
|
8
|
+
resolveIcon,
|
|
9
|
+
ChevronLeftIcon as ChevronLeftIconDefault,
|
|
10
|
+
ChevronRightIcon as ChevronRightIconDefault
|
|
11
|
+
} from '@urbicon-ui/blocks';
|
|
12
|
+
import SmartFilterBar from '../../features/SmartFilterBar/SmartFilterBar.svelte';
|
|
13
|
+
|
|
14
|
+
const ChevronLeftIcon = resolveIcon('chevronLeft', ChevronLeftIconDefault);
|
|
15
|
+
const ChevronRightIcon = resolveIcon('chevronRight', ChevronRightIconDefault);
|
|
16
|
+
import LiveUpdateBanner from '../../features/LiveUpdateBanner.svelte';
|
|
17
|
+
import { useTableI18n } from '../../i18n';
|
|
18
|
+
import TableDesktop from '../TableDesktop.svelte';
|
|
19
|
+
import TableMobile from '../TableMobile.svelte';
|
|
20
|
+
import TableProvider from '../TableProvider.svelte';
|
|
21
|
+
import { setTableStyleContext, resolveSlotClass } from '../table-style-context';
|
|
22
|
+
import { createStickyState, resolveStickyMode, setStickyContext } from '../sticky-context.svelte';
|
|
23
|
+
import {
|
|
24
|
+
measureToCssVar,
|
|
25
|
+
measureViewportOffsetTop,
|
|
26
|
+
observeStuck
|
|
27
|
+
} from '../../utils/sticky-measure';
|
|
28
|
+
|
|
29
|
+
const tt = useTableI18n();
|
|
30
|
+
|
|
31
|
+
let {
|
|
32
|
+
items = [] as T[],
|
|
33
|
+
columns = [],
|
|
34
|
+
class: className = '',
|
|
35
|
+
ariaLabel = undefined,
|
|
36
|
+
size = 'md' as 'sm' | 'md' | 'lg',
|
|
37
|
+
appearance = 'flush' as 'flush' | 'surface' | 'framed',
|
|
38
|
+
|
|
39
|
+
itemsPerPage = 10,
|
|
40
|
+
initialPage = 1,
|
|
41
|
+
expandedRowContent = undefined,
|
|
42
|
+
multiExpand = false,
|
|
43
|
+
onRowClick = undefined,
|
|
44
|
+
virtualized = false,
|
|
45
|
+
virtualHeight = '600px',
|
|
46
|
+
groupOrder = [],
|
|
47
|
+
initialGroupBy = null,
|
|
48
|
+
initialSummaryConfigs = [],
|
|
49
|
+
|
|
50
|
+
enableSmartFilter = true,
|
|
51
|
+
searchPlaceholder = tt('search.placeholder'),
|
|
52
|
+
searchDebounceMs = 300,
|
|
53
|
+
|
|
54
|
+
loadingText = tt('data.loading'),
|
|
55
|
+
errorText = tt('error.loadingError'),
|
|
56
|
+
noDataText = tt('data.empty'),
|
|
57
|
+
|
|
58
|
+
cell = undefined,
|
|
59
|
+
header = undefined,
|
|
60
|
+
body = undefined,
|
|
61
|
+
pagination = undefined,
|
|
62
|
+
empty = undefined,
|
|
63
|
+
loading = undefined,
|
|
64
|
+
error = undefined,
|
|
65
|
+
groupHeaderContent,
|
|
66
|
+
toolbar = undefined,
|
|
67
|
+
mode = 'client',
|
|
68
|
+
serverTotalItems = 0,
|
|
69
|
+
queryFn = undefined,
|
|
70
|
+
onQueryChange = undefined,
|
|
71
|
+
queryDebounceMs = 300,
|
|
72
|
+
persistenceConfig,
|
|
73
|
+
unstyled = false,
|
|
74
|
+
slotClasses = {},
|
|
75
|
+
enableColumnReorder = false,
|
|
76
|
+
enableLiveUpdates = false,
|
|
77
|
+
autoApplyOnNavigation = true,
|
|
78
|
+
selectionMode = 'none',
|
|
79
|
+
selectedIds = undefined,
|
|
80
|
+
onSelectionChange = undefined,
|
|
81
|
+
sticky = false,
|
|
82
|
+
stickyOffset = 0,
|
|
83
|
+
fit = 'content'
|
|
84
|
+
}: TableProps<T> = $props();
|
|
85
|
+
|
|
86
|
+
if (import.meta.env?.DEV && 'wrapper' in slotClasses) {
|
|
87
|
+
console.warn('[Table] slotClasses.wrapper was renamed to slotClasses.scrollArea in v1.5.');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Internally we erase the generic to TableItem because the data store and
|
|
91
|
+
// downstream cell pipelines work against the dynamic-record shape. The
|
|
92
|
+
// generic is preserved at the public surface (props + callbacks), so
|
|
93
|
+
// consumers writing `<Table<Apartment> ... />` get full type-safety.
|
|
94
|
+
const itemsErased = $derived(items as unknown as TableItem[]);
|
|
95
|
+
const columnsErased = $derived(columns as unknown as Column[]);
|
|
96
|
+
const expandedRowContentErased = $derived(
|
|
97
|
+
expandedRowContent as unknown as TableProps['expandedRowContent']
|
|
98
|
+
);
|
|
99
|
+
const cellErased = $derived(cell as unknown as TableProps['cell']);
|
|
100
|
+
const onRowClickErased = $derived(onRowClick as unknown as TableProps['onRowClick']);
|
|
101
|
+
const groupHeaderContentErased = $derived(
|
|
102
|
+
groupHeaderContent as unknown as TableProps['groupHeaderContent']
|
|
103
|
+
);
|
|
104
|
+
const onSelectionChangeErased = $derived(
|
|
105
|
+
onSelectionChange as unknown as TableProps['onSelectionChange']
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
setTableStyleContext({
|
|
109
|
+
get unstyled() {
|
|
110
|
+
return unstyled;
|
|
111
|
+
},
|
|
112
|
+
get slotClasses() {
|
|
113
|
+
return slotClasses;
|
|
114
|
+
},
|
|
115
|
+
get appearance() {
|
|
116
|
+
return appearance;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// `fit="viewport"` turns the table into its own scroll container (see the
|
|
121
|
+
// `contained` variant). Mutually exclusive with `virtualized`, which manages
|
|
122
|
+
// its own bounded scroll via `virtualHeight`.
|
|
123
|
+
const contained = $derived(fit === 'viewport' && !virtualized);
|
|
124
|
+
|
|
125
|
+
// Sticky pinning — resolve per-layer mode + provide reactive context.
|
|
126
|
+
// `getMode` keeps the context live when `sticky`/`fit` change at runtime.
|
|
127
|
+
//
|
|
128
|
+
// In contained mode `resolveStickyMode` forces header + group pinning and
|
|
129
|
+
// drops toolbar page-pinning (the toolbar is a static flex sibling outside
|
|
130
|
+
// the scroll box). The thead/group `top: calc(sticky-top + toolbar-h + …)`
|
|
131
|
+
// formulas then resolve to box-relative offsets because sticky-top is forced
|
|
132
|
+
// to 0 below and toolbar-h is never measured (toolbar is not pinned here).
|
|
133
|
+
const stickyState = createStickyState(() => resolveStickyMode(sticky, contained));
|
|
134
|
+
const stickyMode = $derived(stickyState.mode);
|
|
135
|
+
setStickyContext(stickyState);
|
|
136
|
+
|
|
137
|
+
let expandable = $derived(!!expandedRowContent);
|
|
138
|
+
|
|
139
|
+
let tableContainer = $state<HTMLElement | null>(null);
|
|
140
|
+
let tableDomWidth = $state<string>('100%');
|
|
141
|
+
|
|
142
|
+
// `--blocks-table-sticky-top` is the consumer-facing offset (e.g. fixed top bar).
|
|
143
|
+
// In contained mode the box's measured top handles the offset, so the
|
|
144
|
+
// page-relative sticky-top must be 0 (the thead pins to the box, not the page);
|
|
145
|
+
// `stickyOffset` is ignored there.
|
|
146
|
+
const containerStyle = $derived(`--blocks-table-sticky-top: ${contained ? 0 : stickyOffset}px;`);
|
|
147
|
+
const stuckRootMargin = $derived(`-${stickyOffset + 1}px`);
|
|
148
|
+
|
|
149
|
+
// Default toolbar = SmartFilterBar; consumers can override via the `toolbar` snippet
|
|
150
|
+
const hasToolbar = $derived(!!toolbar || enableSmartFilter);
|
|
151
|
+
|
|
152
|
+
$effect(() => {
|
|
153
|
+
if (tableContainer) {
|
|
154
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
155
|
+
for (const entry of entries) {
|
|
156
|
+
const width = entry.contentRect.width;
|
|
157
|
+
tableDomWidth = `${width}px`;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
resizeObserver.observe(tableContainer);
|
|
162
|
+
|
|
163
|
+
return () => {
|
|
164
|
+
resizeObserver.disconnect();
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
</script>
|
|
169
|
+
|
|
170
|
+
{#snippet prevIcon()}<ChevronLeftIcon class="h-4 w-4" />{/snippet}
|
|
171
|
+
{#snippet nextIcon()}<ChevronRightIcon class="h-4 w-4" />{/snippet}
|
|
172
|
+
|
|
173
|
+
<TableProvider
|
|
174
|
+
items={itemsErased}
|
|
175
|
+
columns={columnsErased}
|
|
176
|
+
{itemsPerPage}
|
|
177
|
+
{initialPage}
|
|
178
|
+
{groupOrder}
|
|
179
|
+
{initialGroupBy}
|
|
180
|
+
{initialSummaryConfigs}
|
|
181
|
+
{multiExpand}
|
|
182
|
+
loading={false}
|
|
183
|
+
{persistenceConfig}
|
|
184
|
+
{mode}
|
|
185
|
+
{serverTotalItems}
|
|
186
|
+
{queryFn}
|
|
187
|
+
{onQueryChange}
|
|
188
|
+
{queryDebounceMs}
|
|
189
|
+
{enableLiveUpdates}
|
|
190
|
+
{autoApplyOnNavigation}
|
|
191
|
+
{selectionMode}
|
|
192
|
+
{selectedIds}
|
|
193
|
+
onSelectionChange={onSelectionChangeErased}
|
|
194
|
+
>
|
|
195
|
+
{@render provider_content()}
|
|
196
|
+
</TableProvider>
|
|
197
|
+
|
|
198
|
+
{#snippet provider_content()}
|
|
199
|
+
{@const tableContext = getTableContext()}
|
|
200
|
+
{@const { state: tableState } = tableContext}
|
|
201
|
+
|
|
202
|
+
{@const tableStyles = tableContainerVariants({
|
|
203
|
+
appearance,
|
|
204
|
+
size,
|
|
205
|
+
responsive: true,
|
|
206
|
+
stickyToolbar: stickyMode.toolbar,
|
|
207
|
+
contained
|
|
208
|
+
})}
|
|
209
|
+
|
|
210
|
+
<div
|
|
211
|
+
class={resolveSlotClass(tableStyles.container(), slotClasses.container, unstyled, className)}
|
|
212
|
+
style={containerStyle}
|
|
213
|
+
data-table-container
|
|
214
|
+
data-testid="table"
|
|
215
|
+
bind:this={tableContainer}
|
|
216
|
+
{@attach contained ? measureViewportOffsetTop('--blocks-table-avail-top') : () => {}}
|
|
217
|
+
>
|
|
218
|
+
{#if hasToolbar}
|
|
219
|
+
{#if stickyMode.toolbar}
|
|
220
|
+
<div data-sticky-sentinel aria-hidden="true" class="-mt-px h-px"></div>
|
|
221
|
+
{/if}
|
|
222
|
+
<div
|
|
223
|
+
class={resolveSlotClass(tableStyles.toolbar(), slotClasses.toolbar, unstyled)}
|
|
224
|
+
data-table-toolbar
|
|
225
|
+
data-stuck={stickyMode.toolbar ? stickyState.toolbarStuck : undefined}
|
|
226
|
+
{@attach stickyMode.toolbar ? measureToCssVar('--blocks-table-toolbar-h') : () => {}}
|
|
227
|
+
{@attach stickyMode.toolbar
|
|
228
|
+
? observeStuck((stuck) => stickyState.setToolbarStuck(stuck), stuckRootMargin)
|
|
229
|
+
: () => {}}
|
|
230
|
+
>
|
|
231
|
+
{#if toolbar}
|
|
232
|
+
{@render toolbar()}
|
|
233
|
+
{:else if enableSmartFilter}
|
|
234
|
+
<SmartFilterBar placeholder={searchPlaceholder} debounceMs={searchDebounceMs} {size} />
|
|
235
|
+
{/if}
|
|
236
|
+
</div>
|
|
237
|
+
{/if}
|
|
238
|
+
|
|
239
|
+
{#if enableLiveUpdates}
|
|
240
|
+
<LiveUpdateBanner class={['mb-3', contained && 'md:shrink-0'].filter(Boolean).join(' ')} />
|
|
241
|
+
{/if}
|
|
242
|
+
|
|
243
|
+
<TableDesktop
|
|
244
|
+
{tableStyles}
|
|
245
|
+
{tableDomWidth}
|
|
246
|
+
{size}
|
|
247
|
+
{expandable}
|
|
248
|
+
expandedRowContent={expandedRowContentErased}
|
|
249
|
+
cell={cellErased}
|
|
250
|
+
{header}
|
|
251
|
+
{body}
|
|
252
|
+
{empty}
|
|
253
|
+
{loading}
|
|
254
|
+
{error}
|
|
255
|
+
{loadingText}
|
|
256
|
+
{errorText}
|
|
257
|
+
{noDataText}
|
|
258
|
+
onRowClick={onRowClickErased}
|
|
259
|
+
{virtualized}
|
|
260
|
+
{virtualHeight}
|
|
261
|
+
groupHeaderContent={groupHeaderContentErased}
|
|
262
|
+
{ariaLabel}
|
|
263
|
+
{enableColumnReorder}
|
|
264
|
+
/>
|
|
265
|
+
|
|
266
|
+
{#if !tableState.loading && !tableState.error}
|
|
267
|
+
<TableMobile
|
|
268
|
+
{size}
|
|
269
|
+
{expandable}
|
|
270
|
+
expandedRowContent={expandedRowContentErased}
|
|
271
|
+
cell={cellErased}
|
|
272
|
+
{empty}
|
|
273
|
+
{noDataText}
|
|
274
|
+
onRowClick={onRowClickErased}
|
|
275
|
+
/>
|
|
276
|
+
|
|
277
|
+
{#if tableContext.filteredItems.length > 0 && !tableState.groupByKey && !virtualized}
|
|
278
|
+
{#if pagination}
|
|
279
|
+
{@render pagination()}
|
|
280
|
+
{:else}
|
|
281
|
+
<Pagination
|
|
282
|
+
currentPage={tableState.currentPage}
|
|
283
|
+
totalPages={tableContext.totalPages}
|
|
284
|
+
onPageChange={tableContext.goToPage}
|
|
285
|
+
layout="table"
|
|
286
|
+
size="md"
|
|
287
|
+
variant="ghost"
|
|
288
|
+
intent="neutral"
|
|
289
|
+
tier="modify"
|
|
290
|
+
showInfo={true}
|
|
291
|
+
itemsPerPage={tableState.itemsPerPage}
|
|
292
|
+
totalItems={tableContext.totalItems}
|
|
293
|
+
previousIcon={prevIcon}
|
|
294
|
+
{nextIcon}
|
|
295
|
+
pageLabel={tt('pagination.page')}
|
|
296
|
+
class={['border-border-hairline border-t pt-2', contained && 'md:shrink-0']
|
|
297
|
+
.filter(Boolean)
|
|
298
|
+
.join(' ')}
|
|
299
|
+
/>
|
|
300
|
+
{/if}
|
|
301
|
+
{/if}
|
|
302
|
+
{/if}
|
|
303
|
+
</div>
|
|
304
|
+
{/snippet}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TableProps } from './index';
|
|
2
|
+
import type { TableItem } from '../../types/tableTypes';
|
|
3
|
+
declare function $$render<T = TableItem>(): {
|
|
4
|
+
props: TableProps<T>;
|
|
5
|
+
exports: {};
|
|
6
|
+
bindings: "";
|
|
7
|
+
slots: {};
|
|
8
|
+
events: {};
|
|
9
|
+
};
|
|
10
|
+
declare class __sveltets_Render<T = TableItem> {
|
|
11
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
12
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
13
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
14
|
+
bindings(): "";
|
|
15
|
+
exports(): {};
|
|
16
|
+
}
|
|
17
|
+
interface $$IsomorphicComponent {
|
|
18
|
+
new <T = TableItem>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
19
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
20
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
21
|
+
<T = TableItem>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
22
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
23
|
+
}
|
|
24
|
+
declare const Table: $$IsomorphicComponent;
|
|
25
|
+
type Table<T = TableItem> = InstanceType<typeof Table<T>>;
|
|
26
|
+
export default Table;
|