@softwareone/spi-sv5-library 1.9.0 → 1.10.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/Button/Button.svelte +16 -0
- package/dist/Controls/Input/Input.svelte +1 -1
- package/dist/Controls/{Label.svelte → Label/Label.svelte} +1 -1
- package/dist/Controls/Select/Select.svelte +1 -1
- package/dist/Controls/TextArea/TextArea.svelte +1 -1
- package/dist/Controls/Toggle/Toggle.svelte +1 -1
- package/dist/Table/ActionsColumn.svelte +203 -0
- package/dist/Table/ActionsColumn.svelte.d.ts +9 -0
- package/dist/Table/Body.svelte +90 -0
- package/dist/Table/Body.svelte.d.ts +27 -0
- package/dist/Table/ColumnVisibilityDropdown.svelte +174 -0
- package/dist/Table/ColumnVisibilityDropdown.svelte.d.ts +27 -0
- package/dist/Table/Footer.svelte +34 -0
- package/dist/Table/Footer.svelte.d.ts +28 -0
- package/dist/Table/Header.svelte +176 -0
- package/dist/Table/Header.svelte.d.ts +28 -0
- package/dist/Table/PageSize.svelte +164 -0
- package/dist/Table/PageSize.svelte.d.ts +28 -0
- package/dist/Table/Pagination.svelte +145 -0
- package/dist/Table/Pagination.svelte.d.ts +27 -0
- package/dist/Table/RowCheckBox.svelte +31 -0
- package/dist/Table/RowCheckBox.svelte.d.ts +9 -0
- package/dist/Table/Skeleton.svelte +99 -0
- package/dist/Table/Skeleton.svelte.d.ts +7 -0
- package/dist/Table/Table.svelte +351 -0
- package/dist/Table/Table.svelte.d.ts +45 -0
- package/dist/Table/adapter/flex-render.svelte +40 -0
- package/dist/Table/adapter/flex-render.svelte.d.ts +28 -0
- package/dist/Table/adapter/index.d.ts +4 -0
- package/dist/Table/adapter/index.js +4 -0
- package/dist/Table/adapter/render-component.d.ts +13 -0
- package/dist/Table/adapter/render-component.js +18 -0
- package/dist/Table/adapter/table.svelte.d.ts +6 -0
- package/dist/Table/adapter/table.svelte.js +66 -0
- package/dist/Table/consts.d.ts +4 -0
- package/dist/Table/consts.js +4 -0
- package/dist/Table/context.d.ts +4 -0
- package/dist/Table/context.js +15 -0
- package/dist/Table/excel-setting.d.ts +8 -0
- package/dist/Table/excel-setting.js +3 -0
- package/dist/Table/excel.d.ts +4 -0
- package/dist/Table/excel.js +66 -0
- package/dist/Table/index.d.ts +6 -0
- package/dist/Table/index.js +6 -0
- package/dist/Table/types.d.ts +16 -0
- package/dist/Table/types.js +1 -0
- package/dist/Table/util.d.ts +4 -0
- package/dist/Table/util.js +46 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +21 -1
- /package/dist/Controls/{Label.svelte.d.ts → Label/Label.svelte.d.ts} +0 -0
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
border: none;
|
|
84
84
|
background: #fff;
|
|
85
85
|
color: #472aff;
|
|
86
|
+
padding: 8px;
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
.btn-outline-none-primary:hover:not(:disabled),
|
|
@@ -117,8 +118,23 @@
|
|
|
117
118
|
color: #dc182c;
|
|
118
119
|
}
|
|
119
120
|
|
|
121
|
+
.btn-outline-none-danger {
|
|
122
|
+
border: none;
|
|
123
|
+
background: #fff;
|
|
124
|
+
color: #dc182c;
|
|
125
|
+
padding: 8px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.btn-outline-none-danger:hover:not(:disabled),
|
|
129
|
+
.btn-outline-none-danger:focus:not(:disabled),
|
|
120
130
|
.btn-outline-danger:hover:not(:disabled),
|
|
121
131
|
.btn-outline-danger:focus:not(:disabled) {
|
|
122
132
|
background: #fce8ea;
|
|
123
133
|
}
|
|
134
|
+
|
|
135
|
+
.btn-outline-none-primary:disabled,
|
|
136
|
+
.btn-outline-none-danger:disabled {
|
|
137
|
+
background: transparent;
|
|
138
|
+
color: #6b7180;
|
|
139
|
+
}
|
|
124
140
|
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
3
|
|
|
4
|
-
import Label from '../Label.svelte';
|
|
4
|
+
import Label from '../Label/Label.svelte';
|
|
5
5
|
import InputIcon from './InputIcon.svelte';
|
|
6
6
|
|
|
7
7
|
type InputType = 'text' | 'password' | 'number' | 'date' | 'money';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Attachment } from 'svelte/attachments';
|
|
5
5
|
|
|
6
6
|
import { Search, type SelectOption } from '../../index.js';
|
|
7
|
-
import Label from '../Label.svelte';
|
|
7
|
+
import Label from '../Label/Label.svelte';
|
|
8
8
|
|
|
9
9
|
interface SelectProps {
|
|
10
10
|
options: string[] | SelectOption[];
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Action } from './types.js';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
actions: Action[];
|
|
6
|
+
isLastChild?: boolean;
|
|
7
|
+
isOnlyOneRow?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { actions, isLastChild = false, isOnlyOneRow = false }: Props = $props();
|
|
11
|
+
|
|
12
|
+
const icons: Record<string, string> = {
|
|
13
|
+
Edit: 'edit',
|
|
14
|
+
Delete: 'delete'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const indexLastSecondaryAction = $derived(
|
|
18
|
+
actions.findLastIndex((action) => !action.isMainAction)
|
|
19
|
+
);
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<div class="actions-column">
|
|
23
|
+
{#if actions.length > 1}
|
|
24
|
+
<div class="actions-group">
|
|
25
|
+
<span class="actions-trigger">...</span>
|
|
26
|
+
<div
|
|
27
|
+
class={[
|
|
28
|
+
'actions-menu',
|
|
29
|
+
isOnlyOneRow && 'actions-menu--only-row',
|
|
30
|
+
isLastChild && !isOnlyOneRow && 'actions-menu--last',
|
|
31
|
+
!isLastChild && !isOnlyOneRow && 'actions-menu--top'
|
|
32
|
+
]}
|
|
33
|
+
>
|
|
34
|
+
<ul class="actions-list">
|
|
35
|
+
{#each actions as action, index}
|
|
36
|
+
<li>
|
|
37
|
+
<button
|
|
38
|
+
type="button"
|
|
39
|
+
onclick={action.onClick}
|
|
40
|
+
class="action-button"
|
|
41
|
+
class:action-button--delete={action.isDelete && action.isEnabled}
|
|
42
|
+
disabled={!action.isEnabled}
|
|
43
|
+
>
|
|
44
|
+
<span>{action.name}</span>
|
|
45
|
+
</button>
|
|
46
|
+
</li>
|
|
47
|
+
{#if indexLastSecondaryAction !== -1 && indexLastSecondaryAction !== actions.length - 1 && indexLastSecondaryAction === index}
|
|
48
|
+
<hr class="action-divider" />
|
|
49
|
+
{/if}
|
|
50
|
+
{/each}
|
|
51
|
+
</ul>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
{:else}
|
|
55
|
+
{@const action = actions[0]}
|
|
56
|
+
{@const nameIcon = icons[action.name]}
|
|
57
|
+
|
|
58
|
+
<button
|
|
59
|
+
type="button"
|
|
60
|
+
onclick={action.onClick}
|
|
61
|
+
class="action-button action-button--single"
|
|
62
|
+
class:action-button--delete={action.isDelete && action.isEnabled}
|
|
63
|
+
disabled={!action.isEnabled}
|
|
64
|
+
>
|
|
65
|
+
{#if nameIcon}
|
|
66
|
+
<span class="material-icons-outlined">
|
|
67
|
+
{nameIcon}
|
|
68
|
+
</span>
|
|
69
|
+
{:else}
|
|
70
|
+
<span class:action-button--primary={action.isEnabled}>{action.name}</span>
|
|
71
|
+
{/if}
|
|
72
|
+
</button>
|
|
73
|
+
{/if}
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<style>
|
|
77
|
+
.actions-column {
|
|
78
|
+
--color-primary: #472aff;
|
|
79
|
+
--color-red-200: #dc182c;
|
|
80
|
+
--color-gray-200: #e5e7eb;
|
|
81
|
+
--color-gray-300: #d1d5db;
|
|
82
|
+
--color-white: #ffffff;
|
|
83
|
+
--color-text: #000000;
|
|
84
|
+
--shadow-menu: 0 2px 10px rgba(0, 0, 0, 0.2);
|
|
85
|
+
--radius-lg: 8px;
|
|
86
|
+
--spacing-xs: 4px;
|
|
87
|
+
--spacing-sm: 8px;
|
|
88
|
+
--spacing-md: 10px;
|
|
89
|
+
--spacing-lg: 14px;
|
|
90
|
+
--z-index-menu: 1;
|
|
91
|
+
--font-size-sm: 14px;
|
|
92
|
+
--font-size-2xl: 24px;
|
|
93
|
+
--transition-standard: all 0.3s ease;
|
|
94
|
+
|
|
95
|
+
position: relative;
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
justify-content: center;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.actions-group {
|
|
102
|
+
position: absolute;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.actions-trigger {
|
|
106
|
+
display: inline-block;
|
|
107
|
+
margin-bottom: var(--spacing-sm);
|
|
108
|
+
font-size: var(--font-size-2xl);
|
|
109
|
+
font-weight: bold;
|
|
110
|
+
cursor: default;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.actions-menu {
|
|
114
|
+
position: absolute;
|
|
115
|
+
z-index: var(--z-index-menu);
|
|
116
|
+
width: 108px;
|
|
117
|
+
padding: var(--spacing-md) var(--spacing-lg);
|
|
118
|
+
background: var(--color-white);
|
|
119
|
+
border-radius: var(--radius-lg);
|
|
120
|
+
box-shadow: var(--shadow-menu);
|
|
121
|
+
visibility: hidden;
|
|
122
|
+
opacity: 0;
|
|
123
|
+
transition: var(--transition-standard);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.actions-group:hover .actions-menu {
|
|
127
|
+
visibility: visible;
|
|
128
|
+
opacity: 1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.actions-menu--only-row {
|
|
132
|
+
right: 28px;
|
|
133
|
+
bottom: 16px;
|
|
134
|
+
transform: translateY(50%);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.actions-menu--last {
|
|
138
|
+
bottom: 28px;
|
|
139
|
+
left: 50%;
|
|
140
|
+
transform: translateX(-50%);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.actions-menu--top {
|
|
144
|
+
top: 32px;
|
|
145
|
+
left: 50%;
|
|
146
|
+
transform: translateX(-50%);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.actions-list {
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: column;
|
|
152
|
+
gap: var(--spacing-sm);
|
|
153
|
+
margin: 0;
|
|
154
|
+
padding: 0;
|
|
155
|
+
list-style: none;
|
|
156
|
+
text-align: left;
|
|
157
|
+
font-size: var(--font-size-sm);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.action-button {
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
padding: 0;
|
|
164
|
+
border: none;
|
|
165
|
+
background: none;
|
|
166
|
+
color: var(--color-text);
|
|
167
|
+
font-size: inherit;
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.action-button:hover:not(:disabled) {
|
|
172
|
+
font-weight: 500;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.action-button:disabled {
|
|
176
|
+
color: var(--color-gray-300);
|
|
177
|
+
cursor: not-allowed;
|
|
178
|
+
font-weight: normal;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.action-button--delete {
|
|
182
|
+
color: var(--color-red-200);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.action-button--single {
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.action-button--primary {
|
|
191
|
+
color: var(--color-primary);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.action-button--primary:hover {
|
|
195
|
+
font-weight: 600;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.action-divider {
|
|
199
|
+
border: none;
|
|
200
|
+
border-top: 1px solid var(--color-gray-200);
|
|
201
|
+
margin: 0;
|
|
202
|
+
}
|
|
203
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Action } from './types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
actions: Action[];
|
|
4
|
+
isLastChild?: boolean;
|
|
5
|
+
isOnlyOneRow?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const ActionsColumn: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type ActionsColumn = ReturnType<typeof ActionsColumn>;
|
|
9
|
+
export default ActionsColumn;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import { flip } from 'svelte/animate';
|
|
3
|
+
import { FlexRender, type Row } from './adapter/index.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
bodyRows: Row<T>[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { bodyRows }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<tbody class="table-body">
|
|
13
|
+
{#each bodyRows as row (row.id)}
|
|
14
|
+
<tr
|
|
15
|
+
animate:flip={{ duration: 500 }}
|
|
16
|
+
class={['table-row', row.getIsSelected() && 'table-row--selected']}
|
|
17
|
+
>
|
|
18
|
+
{#each row.getVisibleCells() as cell}
|
|
19
|
+
{@const alignColumn = cell.column.columnDef.meta?.alignColumn}
|
|
20
|
+
{@const columnWidth = cell.column.columnDef.meta?.columnWidth}
|
|
21
|
+
{@const columnStyle = cell.column.columnDef.meta?.style}
|
|
22
|
+
<td
|
|
23
|
+
class={[
|
|
24
|
+
'table-cell',
|
|
25
|
+
alignColumn === 'right' && 'table-cell--right',
|
|
26
|
+
alignColumn === 'center' && 'table-cell--center',
|
|
27
|
+
!alignColumn && 'table-cell--left'
|
|
28
|
+
]}
|
|
29
|
+
style:width={columnWidth}
|
|
30
|
+
style={columnStyle}
|
|
31
|
+
>
|
|
32
|
+
<FlexRender content={cell.column.columnDef.cell} context={cell.getContext()} />
|
|
33
|
+
</td>
|
|
34
|
+
{/each}
|
|
35
|
+
</tr>
|
|
36
|
+
{/each}
|
|
37
|
+
</tbody>
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
.table-body {
|
|
41
|
+
--color-white: #fff;
|
|
42
|
+
--color-black: #000;
|
|
43
|
+
--color-row-selected: #eaecff;
|
|
44
|
+
--color-gray-300: #e0e5e8;
|
|
45
|
+
--color-gray-400: #f3f4f6;
|
|
46
|
+
--spacing-md: 8px;
|
|
47
|
+
--spacing-lg: 16px;
|
|
48
|
+
--font-size-sm: 14px;
|
|
49
|
+
|
|
50
|
+
background: var(--color-white);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.table-row {
|
|
54
|
+
transition: background-color 100ms ease;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.table-row:hover {
|
|
58
|
+
background: var(--color-gray-400);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.table-row--selected {
|
|
62
|
+
background: var(--color-row-selected);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.table-row--selected:hover {
|
|
66
|
+
background: var(--color-row-selected);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.table-cell {
|
|
70
|
+
max-width: 50px;
|
|
71
|
+
padding: var(--spacing-md) var(--spacing-lg);
|
|
72
|
+
border-bottom: 0.5px solid var(--color-gray-300);
|
|
73
|
+
font-size: var(--font-size-sm);
|
|
74
|
+
color: var(--color-black);
|
|
75
|
+
word-wrap: break-word;
|
|
76
|
+
white-space: normal;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.table-cell--left {
|
|
80
|
+
text-align: left;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.table-cell--center {
|
|
84
|
+
text-align: center;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.table-cell--right {
|
|
88
|
+
text-align: right;
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Row } from './adapter/index.js';
|
|
2
|
+
declare function $$render<T>(): {
|
|
3
|
+
props: {
|
|
4
|
+
bodyRows: Row<T>[];
|
|
5
|
+
};
|
|
6
|
+
exports: {};
|
|
7
|
+
bindings: "";
|
|
8
|
+
slots: {};
|
|
9
|
+
events: {};
|
|
10
|
+
};
|
|
11
|
+
declare class __sveltets_Render<T> {
|
|
12
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
13
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
14
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
15
|
+
bindings(): "";
|
|
16
|
+
exports(): {};
|
|
17
|
+
}
|
|
18
|
+
interface $$IsomorphicComponent {
|
|
19
|
+
new <T>(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']>> & {
|
|
20
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
21
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
22
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
23
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
24
|
+
}
|
|
25
|
+
declare const Body: $$IsomorphicComponent;
|
|
26
|
+
type Body<T> = InstanceType<typeof Body<T>>;
|
|
27
|
+
export default Body;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import type { Column } from './adapter/index.js';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
columns: Column<T, unknown>[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let { columns }: Props = $props();
|
|
9
|
+
|
|
10
|
+
let isOpen = $state(false);
|
|
11
|
+
|
|
12
|
+
const toggleModal = () => {
|
|
13
|
+
isOpen = !isOpen;
|
|
14
|
+
};
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div class="column-visibility">
|
|
18
|
+
<button type="button" class="column-visibility-toggle" onclick={toggleModal}>
|
|
19
|
+
<span class="material-icons">table_rows</span>
|
|
20
|
+
Columns
|
|
21
|
+
</button>
|
|
22
|
+
|
|
23
|
+
{#if isOpen}
|
|
24
|
+
<div class="column-visibility-dropdown" role="menu">
|
|
25
|
+
<div class="column-visibility-header">
|
|
26
|
+
<h2 class="column-visibility-title">Toggle columns</h2>
|
|
27
|
+
<button type="button" onclick={toggleModal} class="column-visibility-close">
|
|
28
|
+
<span class="material-icons">close</span>
|
|
29
|
+
</button>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<div class="column-visibility-list">
|
|
33
|
+
{#each columns as column}
|
|
34
|
+
{@const columnDef = column.columnDef}
|
|
35
|
+
{@const header = typeof columnDef.header === 'string' ? columnDef.header : column.id}
|
|
36
|
+
|
|
37
|
+
<label class="column-visibility-item">
|
|
38
|
+
<input
|
|
39
|
+
type="checkbox"
|
|
40
|
+
checked={column.getIsVisible()}
|
|
41
|
+
onchange={() => column.toggleVisibility()}
|
|
42
|
+
/>
|
|
43
|
+
<span class="column-visibility-label">{header}</span>
|
|
44
|
+
</label>
|
|
45
|
+
{/each}
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
{/if}
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
{#if isOpen}
|
|
52
|
+
<button
|
|
53
|
+
type="button"
|
|
54
|
+
class="column-visibility-backdrop"
|
|
55
|
+
onclick={toggleModal}
|
|
56
|
+
aria-label="Close dropdown"
|
|
57
|
+
></button>
|
|
58
|
+
{/if}
|
|
59
|
+
|
|
60
|
+
<style>
|
|
61
|
+
.column-visibility {
|
|
62
|
+
--color-white: #ffffff;
|
|
63
|
+
--color-gray-50: #f9fafb;
|
|
64
|
+
--color-gray-100: #f3f4f6;
|
|
65
|
+
--color-gray-500: #6b7280;
|
|
66
|
+
--color-gray-600: #4b5563;
|
|
67
|
+
--spacing-xs: 8px;
|
|
68
|
+
--spacing-sm: 8px;
|
|
69
|
+
--spacing-md: 16px;
|
|
70
|
+
--font-size-sm: 14px;
|
|
71
|
+
--font-size-icon: 14px;
|
|
72
|
+
--font-semibold: 600;
|
|
73
|
+
--radius-lg: 8px;
|
|
74
|
+
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
75
|
+
--z-index-dropdown: 10;
|
|
76
|
+
--z-index-backdrop: 9;
|
|
77
|
+
|
|
78
|
+
position: relative;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.column-visibility-toggle {
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
gap: var(--spacing-xs);
|
|
85
|
+
padding: var(--spacing-sm) var(--spacing-md);
|
|
86
|
+
border: none;
|
|
87
|
+
border-radius: var(--radius-lg);
|
|
88
|
+
background: var(--color-white);
|
|
89
|
+
font-size: var(--font-size-sm);
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.column-visibility-toggle:hover {
|
|
94
|
+
background: var(--color-gray-100);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.column-visibility-toggle .material-icons {
|
|
98
|
+
font-size: var(--font-size-icon);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.column-visibility-dropdown {
|
|
102
|
+
position: absolute;
|
|
103
|
+
top: 48px;
|
|
104
|
+
right: 0;
|
|
105
|
+
z-index: var(--z-index-dropdown);
|
|
106
|
+
width: 224px;
|
|
107
|
+
padding: var(--spacing-md);
|
|
108
|
+
background: var(--color-white);
|
|
109
|
+
border-radius: var(--radius-lg);
|
|
110
|
+
box-shadow: var(--shadow-lg);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.column-visibility-header {
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
justify-content: space-between;
|
|
117
|
+
margin-bottom: var(--spacing-sm);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.column-visibility-title {
|
|
121
|
+
margin: 0;
|
|
122
|
+
font-size: var(--font-size-sm);
|
|
123
|
+
font-weight: var(--font-semibold);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.column-visibility-close {
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
padding: 0;
|
|
130
|
+
border: none;
|
|
131
|
+
background: none;
|
|
132
|
+
color: var(--color-gray-500);
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.column-visibility-close:hover {
|
|
137
|
+
color: var(--color-gray-600);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.column-visibility-close .material-icons {
|
|
141
|
+
font-size: var(--font-size-icon);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.column-visibility-list {
|
|
145
|
+
max-height: 240px;
|
|
146
|
+
overflow-y: auto;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.column-visibility-item {
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
gap: var(--spacing-xs);
|
|
153
|
+
padding: var(--spacing-sm);
|
|
154
|
+
border-radius: var(--radius-lg);
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.column-visibility-item:hover {
|
|
159
|
+
background: var(--color-gray-50);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.column-visibility-label {
|
|
163
|
+
font-size: var(--font-size-sm);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.column-visibility-backdrop {
|
|
167
|
+
position: fixed;
|
|
168
|
+
inset: 0;
|
|
169
|
+
z-index: var(--z-index-backdrop);
|
|
170
|
+
border: none;
|
|
171
|
+
background: transparent;
|
|
172
|
+
cursor: default;
|
|
173
|
+
}
|
|
174
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Column } from './adapter/index.js';
|
|
2
|
+
declare function $$render<T>(): {
|
|
3
|
+
props: {
|
|
4
|
+
columns: Column<T, unknown>[];
|
|
5
|
+
};
|
|
6
|
+
exports: {};
|
|
7
|
+
bindings: "";
|
|
8
|
+
slots: {};
|
|
9
|
+
events: {};
|
|
10
|
+
};
|
|
11
|
+
declare class __sveltets_Render<T> {
|
|
12
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
13
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
14
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
15
|
+
bindings(): "";
|
|
16
|
+
exports(): {};
|
|
17
|
+
}
|
|
18
|
+
interface $$IsomorphicComponent {
|
|
19
|
+
new <T>(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']>> & {
|
|
20
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
21
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
22
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
23
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
24
|
+
}
|
|
25
|
+
declare const ColumnVisibilityDropdown: $$IsomorphicComponent;
|
|
26
|
+
type ColumnVisibilityDropdown<T> = InstanceType<typeof ColumnVisibilityDropdown<T>>;
|
|
27
|
+
export default ColumnVisibilityDropdown;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import type { Table } from './adapter/index.js';
|
|
3
|
+
import PageSize from './PageSize.svelte';
|
|
4
|
+
import Pagination from './Pagination.svelte';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
table: Table<T>;
|
|
8
|
+
minPageSize: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { table, minPageSize }: Props = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<footer class="table-footer">
|
|
15
|
+
<Pagination {table} />
|
|
16
|
+
<PageSize {table} {minPageSize} />
|
|
17
|
+
</footer>
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
.table-footer {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
margin-bottom: 20px;
|
|
25
|
+
font-size: 14px;
|
|
26
|
+
font-weight: 500;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@media (max-width: 750px) {
|
|
30
|
+
.table-footer {
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Table } from './adapter/index.js';
|
|
2
|
+
declare function $$render<T>(): {
|
|
3
|
+
props: {
|
|
4
|
+
table: Table<T>;
|
|
5
|
+
minPageSize: boolean;
|
|
6
|
+
};
|
|
7
|
+
exports: {};
|
|
8
|
+
bindings: "";
|
|
9
|
+
slots: {};
|
|
10
|
+
events: {};
|
|
11
|
+
};
|
|
12
|
+
declare class __sveltets_Render<T> {
|
|
13
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
14
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
15
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
16
|
+
bindings(): "";
|
|
17
|
+
exports(): {};
|
|
18
|
+
}
|
|
19
|
+
interface $$IsomorphicComponent {
|
|
20
|
+
new <T>(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']>> & {
|
|
21
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
22
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
23
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
24
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
25
|
+
}
|
|
26
|
+
declare const Footer: $$IsomorphicComponent;
|
|
27
|
+
type Footer<T> = InstanceType<typeof Footer<T>>;
|
|
28
|
+
export default Footer;
|