simplesvelte 2.2.12 → 2.2.14

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.
@@ -106,7 +106,7 @@
106
106
 
107
107
  // For multiple selection, work with current array state
108
108
  const currentValue = Array.isArray(normalizedValue) ? normalizedValue : []
109
-
109
+
110
110
  if (currentValue.includes(itemValue)) {
111
111
  value = currentValue.filter((v) => v !== itemValue)
112
112
  } else {
@@ -191,14 +191,16 @@
191
191
  return result
192
192
  })
193
193
  // Display text for the input placeholder/value
194
+ // Using $state.eager to ensure immediate UI feedback when selection changes
194
195
  let displayText = $derived.by(() => {
195
196
  if (multiple) {
196
- const count = selectedItems.length
197
+ const count = $state.eager(selectedItems.length)
197
198
  if (count === 0) return placeholder
198
199
  if (count === 1) return selectedItems[0].label
199
200
  return `${count} items selected`
200
201
  }
201
- return selectedItem ? selectedItem.label : placeholder
202
+ const item = $state.eager(selectedItem)
203
+ return item ? item.label : placeholder
202
204
  })
203
205
  let searchEL: HTMLInputElement | undefined = $state(undefined)
204
206
 
@@ -268,10 +268,22 @@ function normalizeRequest(request, skipPatterns) {
268
268
  ...request,
269
269
  // Normalize filter model
270
270
  filterModel: request.filterModel,
271
- // Normalize group keys
271
+ // Normalize group keys - but respect skipNormalization patterns
272
272
  groupKeys: request.groupKeys.map((key, index) => {
273
273
  const col = request.rowGroupCols[index];
274
274
  const fieldName = col?.field || col?.id;
275
+ // Check if this field should skip normalization
276
+ if (fieldName && skipPatterns) {
277
+ const shouldSkip = skipPatterns.some((pattern) => {
278
+ if (typeof pattern === 'string') {
279
+ return fieldName === pattern;
280
+ }
281
+ return pattern.test(fieldName);
282
+ });
283
+ if (shouldSkip) {
284
+ return key; // Return original key without normalization
285
+ }
286
+ }
275
287
  return normalizeValue(key, fieldName, skipPatterns);
276
288
  }),
277
289
  };
@@ -433,12 +445,28 @@ function applyDateFilter(where, field, filter) {
433
445
  if (/^\d{4}-\d{2}-\d{2}$/.test(dateFrom)) {
434
446
  dateFrom = new Date(dateFrom + 'T00:00:00.000Z').toISOString();
435
447
  }
448
+ // If it's a date with space-separated time (YYYY-MM-DD HH:MM:SS), convert to ISO format
449
+ else if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(dateFrom)) {
450
+ dateFrom = new Date(dateFrom.replace(' ', 'T') + '.000Z').toISOString();
451
+ }
452
+ // If it's already a valid date string, ensure it's in ISO format
453
+ else if (isDateString(dateFrom)) {
454
+ dateFrom = new Date(dateFrom).toISOString();
455
+ }
436
456
  }
437
457
  if (dateTo && typeof dateTo === 'string') {
438
458
  // If it's just a date (YYYY-MM-DD), convert to end of day in ISO format
439
459
  if (/^\d{4}-\d{2}-\d{2}$/.test(dateTo)) {
440
460
  dateTo = new Date(dateTo + 'T23:59:59.999Z').toISOString();
441
461
  }
462
+ // If it's a date with space-separated time (YYYY-MM-DD HH:MM:SS), convert to ISO format
463
+ else if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(dateTo)) {
464
+ dateTo = new Date(dateTo.replace(' ', 'T') + '.000Z').toISOString();
465
+ }
466
+ // If it's already a valid date string, ensure it's in ISO format
467
+ else if (isDateString(dateTo)) {
468
+ dateTo = new Date(dateTo).toISOString();
469
+ }
442
470
  }
443
471
  switch (type) {
444
472
  case 'equals':
@@ -478,9 +506,14 @@ function applyDateFilter(where, field, filter) {
478
506
  */
479
507
  function applySetFilter(where, field, filter) {
480
508
  const values = filter.values;
481
- // Empty values array means no filter selected - skip this filter entirely
482
- if (!values || values.length === 0)
509
+ // If values array doesn't exist, skip this filter entirely (no filter applied)
510
+ if (!values)
483
511
  return;
512
+ // If values array is empty, user explicitly selected nothing - return no results
513
+ if (values.length === 0) {
514
+ where[field] = { in: [] };
515
+ return;
516
+ }
484
517
  // Check if this is a boolean filter
485
518
  const booleanValues = new Set(['Yes', 'No', 'true', 'false', true, false]);
486
519
  const isBooleanFilter = values.every((v) => booleanValues.has(v));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simplesvelte",
3
- "version": "2.2.12",
3
+ "version": "2.2.14",
4
4
  "scripts": {
5
5
  "dev": "bun vite dev",
6
6
  "build": "bun vite build && bun run prepack",
@@ -35,32 +35,32 @@
35
35
  "sweetalert2": "^11.25.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@eslint/compat": "^1.4.0",
39
- "@eslint/js": "^9.38.0",
38
+ "@eslint/compat": "^1.4.1",
39
+ "@eslint/js": "^9.39.0",
40
40
  "@sveltejs/adapter-cloudflare": "^7.2.4",
41
- "@sveltejs/kit": "^2.47.2",
41
+ "@sveltejs/kit": "^2.48.4",
42
42
  "@sveltejs/package": "^2.5.4",
43
43
  "@sveltejs/vite-plugin-svelte": "^6.2.1",
44
- "@tailwindcss/cli": "^4.1.14",
45
- "@tailwindcss/vite": "^4.1.14",
44
+ "@tailwindcss/cli": "^4.1.16",
45
+ "@tailwindcss/vite": "^4.1.16",
46
46
  "@testing-library/svelte": "^5.2.8",
47
47
  "@testing-library/user-event": "^14.6.1",
48
- "daisyui": "^5.3.7",
49
- "eslint": "^9.38.0",
48
+ "daisyui": "^5.4.2",
49
+ "eslint": "^9.39.0",
50
50
  "eslint-config-prettier": "^10.1.8",
51
- "eslint-plugin-svelte": "^3.12.5",
52
- "globals": "^16.4.0",
53
- "jsdom": "^27.0.1",
51
+ "eslint-plugin-svelte": "^3.13.0",
52
+ "globals": "^16.5.0",
53
+ "jsdom": "^27.1.0",
54
54
  "prettier": "^3.6.2",
55
55
  "prettier-plugin-svelte": "^3.4.0",
56
56
  "prettier-plugin-tailwindcss": "^0.6.14",
57
- "publint": "^0.3.14",
58
- "svelte": "^5.41.0",
57
+ "publint": "^0.3.15",
58
+ "svelte": "^5.43.2",
59
59
  "svelte-check": "^4.3.3",
60
- "tailwindcss": "^4.1.14",
60
+ "tailwindcss": "^4.1.16",
61
61
  "typescript": "^5.9.3",
62
- "typescript-eslint": "^8.46.1",
63
- "vite": "^7.1.11",
62
+ "typescript-eslint": "^8.46.3",
63
+ "vite": "^7.1.12",
64
64
  "vitest": "^3.2.4"
65
65
  },
66
66
  "keywords": [