@zhangt58/svelte-vtable 0.0.4 → 0.1.1
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 +163 -11
- package/package.json +11 -6
- package/src/components/{VirtualDataTable.svelte → DataTable.svelte} +9 -1
- package/src/components/DataTableControls.svelte +171 -62
- package/src/components/DataTableFilters.svelte +650 -0
- package/src/components/FiltersModal.svelte +40 -0
- package/src/lib/dist/styles.css +269 -269
- package/src/lib/filterUtils.js +145 -0
- package/src/lib/index.js +13 -1
- package/src/lib/styles.css +269 -269
package/src/lib/styles.css
CHANGED
|
@@ -1,270 +1,270 @@
|
|
|
1
1
|
.virtual-data-table {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
2
|
+
display: block;
|
|
3
|
+
min-width: 0;
|
|
4
|
+
height: 100%;
|
|
5
|
+
overflow: auto;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
:global(.datatable-table) {
|
|
9
|
+
display: table;
|
|
10
|
+
width: 100%;
|
|
11
|
+
min-width: 0;
|
|
12
|
+
border-collapse: collapse;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
font-size: 0.875rem; /* 14px - smaller, more compact */
|
|
15
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
|
|
16
|
+
line-height: 1.4;
|
|
17
|
+
border: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Sticky header support */
|
|
21
|
+
:global(.datatable-table) thead.sticky-header {
|
|
22
|
+
position: sticky;
|
|
23
|
+
top: 0;
|
|
24
|
+
z-index: 20;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Header visual styles - only bottom border */
|
|
28
|
+
:global(.datatable-table) thead th {
|
|
29
|
+
background-color: #f8f9fa;
|
|
30
|
+
font-size: 0.8125rem; /* 13px */
|
|
31
|
+
font-weight: 600;
|
|
32
|
+
text-transform: uppercase;
|
|
33
|
+
letter-spacing: 0.025em;
|
|
34
|
+
border-top: none;
|
|
35
|
+
border-left: none;
|
|
36
|
+
border-right: none;
|
|
37
|
+
border-bottom: 1px solid #dee2e6;
|
|
38
|
+
padding: 0.5rem 0.5rem;
|
|
39
|
+
text-align: left;
|
|
40
|
+
white-space: normal; /* Allow header text to wrap */
|
|
41
|
+
overflow: visible;
|
|
42
|
+
box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1); /* Keep border visible on scroll */
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Row striping - alternating colors */
|
|
46
|
+
/* VirtualList may wrap rows, so we target tr directly */
|
|
47
|
+
:global(.datatable-table tbody tr:nth-of-type(even)) {
|
|
48
|
+
background-color: #ffffff;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:global(.datatable-table tbody tr:nth-of-type(odd)) {
|
|
52
|
+
background-color: #f8f9fa;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Also ensure tr elements themselves have background */
|
|
56
|
+
:global(.datatable-table tbody tr) {
|
|
57
|
+
background-color: inherit;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Hover effect */
|
|
61
|
+
:global(.datatable-table tbody tr:hover) {
|
|
62
|
+
background-color: #e7f1ff !important;
|
|
63
|
+
transition: background-color 0.15s ease-in-out;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Selesky-500 row overrides striping and hover */
|
|
67
|
+
:global(.datatable-table tbody tr.selected-row) {
|
|
68
|
+
background-color: #e0f2fe !important; /* light sky background */
|
|
69
|
+
box-shadow: inset 4px 0 0 0 #0369a1; /* left accent */
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:global(.dark) :global(.datatable-table tbody tr.selected-row) {
|
|
73
|
+
/* brighter, higher-contrast selection in dark mode */
|
|
74
|
+
background-color: rgba(14,165,233,0.22) !important; /* stronger visible blue */
|
|
75
|
+
box-shadow: inset 6px 0 0 0 rgba(56,189,248,0.85); /* stronger left accent */
|
|
76
|
+
transition: background-color 0.12s ease-in-out, box-shadow 0.12s ease-in-out;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Also apply to cells to defeat any cell-level background from striping and ensure readable text */
|
|
80
|
+
:global(.datatable-table tbody tr.selected-row) td {
|
|
81
|
+
background-color: #e0f2fe !important;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:global(.dark) :global(.datatable-table tbody tr.selected-row) td {
|
|
85
|
+
background-color: rgba(14,165,233,0.22) !important;
|
|
86
|
+
color: #f0fbff !important; /* ensure high-contrast, very light text */
|
|
87
|
+
border-bottom-color: rgba(255,255,255,0.06);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Body cell defaults - only bottom border */
|
|
91
|
+
:global(.datatable-table tbody td) {
|
|
92
|
+
padding: 0.5rem 0.5rem;
|
|
93
|
+
border-top: none;
|
|
94
|
+
border-left: none;
|
|
95
|
+
border-right: none;
|
|
96
|
+
border-bottom: 1px solid #e9ecef;
|
|
97
|
+
vertical-align: middle;
|
|
98
|
+
text-align: left;
|
|
99
|
+
font-size: 0.875rem; /* 14px */
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
white-space: normal; /* Allow wrapping by default */
|
|
102
|
+
word-wrap: break-word;
|
|
103
|
+
box-sizing: border-box;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* No-wrap variant for cells that should truncate */
|
|
107
|
+
:global(.datatable-table tbody td.nowrap) {
|
|
108
|
+
white-space: nowrap;
|
|
109
|
+
text-overflow: ellipsis;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Compact variant */
|
|
113
|
+
:global(.datatable-table.compact tbody td) {
|
|
114
|
+
padding: 0.1rem 0.3rem;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Header content alignment helper */
|
|
118
|
+
:global(.datatable-table thead th > div) {
|
|
119
|
+
display: inline-flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
gap: 0.25rem;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Allow certain long cells to wrap fully if explicitly requested */
|
|
125
|
+
:global(.datatable-table td.wrap) {
|
|
126
|
+
white-space: normal;
|
|
127
|
+
word-break: break-word;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Dark mode variants for the datatable */
|
|
131
|
+
:global(.dark) :global(.datatable-table thead th) {
|
|
132
|
+
background-color: #1f2937;
|
|
133
|
+
border-bottom-color: #374151;
|
|
134
|
+
color: #f9fafb;
|
|
135
|
+
box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.3); /* Darker shadow for dark mode */
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
:global(.dark) :global(.datatable-table tbody tr:nth-of-type(even)) {
|
|
139
|
+
background-color: #111827;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
:global(.dark) :global(.datatable-table tbody tr:nth-of-type(odd)) {
|
|
143
|
+
background-color: #1f2937;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
:global(.dark) :global(.datatable-table tbody tr:hover) {
|
|
147
|
+
background-color: #374151 !important;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
:global(.dark) :global(.datatable-table tbody td) {
|
|
151
|
+
border-bottom-color: #374151;
|
|
152
|
+
color: #e5e7eb;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* Shared control styles (inputs, pagination, column filters) used by page components */
|
|
156
|
+
:global(.datatable-input) {
|
|
157
|
+
padding: 0.375rem 0.75rem;
|
|
158
|
+
font-size: 0.95rem;
|
|
159
|
+
border: 1px solid #ced4da;
|
|
160
|
+
border-radius: 0.25rem;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
:global(.datatable-input:focus) {
|
|
164
|
+
border-color: #86b7fe;
|
|
165
|
+
outline: 0;
|
|
166
|
+
box-shadow: 0 0 0.1rem 0.2rem rgba(13, 110, 253, 0.25);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:global(.search-filtering-row) {
|
|
170
|
+
background-color: #f8f9fa;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
:global(.search-filtering-row th) {
|
|
174
|
+
padding: 0.1rem 0.1rem;
|
|
175
|
+
border-bottom: 1px solid #dee2e6;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
:global(.column-filter) {
|
|
179
|
+
width: 95%;
|
|
180
|
+
padding: 0.2rem 0.25rem;
|
|
181
|
+
font-size: 0.8rem;
|
|
182
|
+
border: 1px solid #ced4da;
|
|
183
|
+
border-radius: 0.25rem;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
:global(.column-filter::placeholder) {
|
|
187
|
+
color: #adb5bd;
|
|
188
|
+
font-size: 0.75rem;
|
|
189
|
+
font-style: italic;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:global(.datatable-pagination) {
|
|
193
|
+
display: flex;
|
|
194
|
+
gap: 0.1rem;
|
|
195
|
+
margin-top: 0.6rem;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
:global(.datatable-pagination li a),
|
|
199
|
+
:global(.datatable-pagination li button) {
|
|
200
|
+
padding: 0.3rem 0.7rem;
|
|
201
|
+
border: 1px solid #dee2e6;
|
|
202
|
+
border-radius: 0;
|
|
203
|
+
background-color: #fff;
|
|
204
|
+
color: #0d6efd;
|
|
205
|
+
text-decoration: none;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
:global(.datatable-pagination li a:hover),
|
|
209
|
+
:global(.datatable-pagination li button:hover) {
|
|
210
|
+
background-color: #e9ecef;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
:global(.datatable-pagination .datatable-active a),
|
|
214
|
+
:global(.datatable-pagination .datatable-active button) {
|
|
215
|
+
background-color: #0d6efd;
|
|
216
|
+
border-color: #0d6efd;
|
|
217
|
+
color: #fff;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/* Force the active/current page to use the green tokens (override flowbite's primary/orange).
|
|
221
|
+
Intentionally specific to reliably win over third-party rules. */
|
|
222
|
+
:global([data-pagination-id] ul li [aria-current="page"]) {
|
|
223
|
+
background-color: #dcfce7 !important; /* bg-green-100 */
|
|
224
|
+
color: #16a34a !important; /* text-green-600 */
|
|
225
|
+
border-color: transparent !important;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* Ensure Prev/Next controls visually match the numeric buttons' border and rhythm
|
|
229
|
+
(keeps border, radius and min-width consistent). This is minimal and won't
|
|
230
|
+
override hover/text colors managed by Tailwind classes applied at runtime. */
|
|
231
|
+
:global([data-pagination-id] ul li:first-child > button),
|
|
232
|
+
:global([data-pagination-id] ul li:first-child > a),
|
|
233
|
+
:global([data-pagination-id] ul li:last-child > button),
|
|
234
|
+
:global([data-pagination-id] ul li:last-child > a) {
|
|
235
|
+
border: 1px solid #d1d5db; /* border-gray-300 */
|
|
236
|
+
min-width: 2rem; /* align with numeric buttons' min width */
|
|
237
|
+
background: transparent;
|
|
238
|
+
padding: 0.25rem 0.5rem; /* keep comfortable hit area */
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* Light mode: hover/focus for Prev/Next match numeric button hover */
|
|
242
|
+
:global([data-pagination-id] ul li:first-child > button:hover),
|
|
243
|
+
:global([data-pagination-id] ul li:first-child > a:hover),
|
|
244
|
+
:global([data-pagination-id] ul li:last-child > button:hover),
|
|
245
|
+
:global([data-pagination-id] ul li:last-child > a:hover),
|
|
246
|
+
:global([data-pagination-id] ul li:first-child > button:focus),
|
|
247
|
+
:global([data-pagination-id] ul li:first-child > a:focus),
|
|
248
|
+
:global([data-pagination-id] ul li:last-child > button:focus),
|
|
249
|
+
:global([data-pagination-id] ul li:last-child > a:focus) {
|
|
250
|
+
background-color: #f3f4f6; /* tailwind gray-100 */
|
|
251
|
+
outline: none;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* Ellipsis styling: make clickable and visually lighter (JS sets data-ellipsis/data-jump) */
|
|
255
|
+
:global([data-pagination-id] ul li [data-ellipsis="true"]) {
|
|
256
|
+
cursor: pointer;
|
|
257
|
+
background: transparent !important;
|
|
258
|
+
color: inherit;
|
|
259
|
+
opacity: 0.9;
|
|
260
|
+
font-size: 0.875rem;
|
|
261
|
+
padding: 0.25rem 0.5rem;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* Chevron sizing for Prev/Next so icons sit comfortably in the buttons */
|
|
265
|
+
:global([data-pagination-id] ul li:first-child svg),
|
|
266
|
+
:global([data-pagination-id] ul li:last-child svg) {
|
|
267
|
+
height: 1.25rem;
|
|
268
|
+
width: 1.25rem;
|
|
269
|
+
display: block;
|
|
270
|
+
}
|