@zhangt58/svelte-vtable 0.3.3 → 0.3.5

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.
@@ -33,7 +33,7 @@
33
33
  aria-labelledby="vtable-modal-title"
34
34
  >
35
35
  <div
36
- class="vtable-modal-panel bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-3xl pointer-events-auto overflow-hidden"
36
+ class="vtable-modal-panel bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-sm sm:max-w-2xl lg:max-w-4xl xl:max-w-5xl pointer-events-auto overflow-hidden"
37
37
  >
38
38
  <div
39
39
  class="flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700"
@@ -411,6 +411,7 @@
411
411
  />
412
412
  <span
413
413
  class="flex-1 text-sm text-gray-700 dark:text-gray-300 select-none min-w-0 overflow-hidden text-ellipsis"
414
+ title={displayValue}
414
415
  >{displayValue}</span
415
416
  >
416
417
  {#if showCounts && column.counts && column.counts[value] !== undefined}
@@ -437,6 +438,7 @@
437
438
  />
438
439
  <span
439
440
  class="flex-1 text-sm text-gray-700 dark:text-gray-300 select-none min-w-0 overflow-hidden text-ellipsis"
441
+ title={displayValue}
440
442
  >{displayValue}</span
441
443
  >
442
444
  {#if showCounts && column.counts && column.counts[value] !== undefined}
@@ -13,9 +13,18 @@ export function getUniqueValuesWithCounts(data, key) {
13
13
 
14
14
  data.forEach((item) => {
15
15
  const value = item[key];
16
- // Handle null/undefined
17
- const normalizedValue = value ?? '(empty)';
18
- countMap[normalizedValue] = (countMap[normalizedValue] || 0) + 1;
16
+
17
+ if (Array.isArray(value)) {
18
+ // If the value is an array, count each element separately
19
+ for (const v of value) {
20
+ const normalizedV = String(v ?? '');
21
+ countMap[normalizedV] = (countMap[normalizedV] || 0) + 1;
22
+ }
23
+ } else {
24
+ // Handle null/undefined
25
+ const normalizedValue = value ?? '(empty)';
26
+ countMap[normalizedValue] = (countMap[normalizedValue] || 0) + 1;
27
+ }
19
28
  });
20
29
 
21
30
  return {
@@ -150,8 +159,18 @@ export function applyFilters(data, activeFilters) {
150
159
  // Value-based filter (OR logic within column)
151
160
  if (filterValue.length === 0) continue;
152
161
  const itemValue = item[columnKey];
153
- const normalizedItemValue = itemValue ?? '(empty)';
154
- if (!filterValue.includes(normalizedItemValue)) return false;
162
+
163
+ if (Array.isArray(itemValue)) {
164
+ // array value - check if any element matches the filter values
165
+ const hasMatch = itemValue.some((v) =>
166
+ filterValue.includes(String(v ?? ''))
167
+ );
168
+ if (!hasMatch) return false;
169
+ } else {
170
+ // scalar value - treat null/undefined as '(empty)'
171
+ const normalizedItemValue = itemValue ?? '(empty)';
172
+ if (!filterValue.includes(normalizedItemValue)) return false;
173
+ }
155
174
  } else if (typeof filterValue === 'object') {
156
175
  // Date / datetime range filter
157
176
  const { from, to } = filterValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhangt58/svelte-vtable",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "A Svelte 5 library for virtualized data tables with sorting, selection, and pagination controls.",
5
5
  "type": "module",
6
6
  "sideEffects": [