@svgrid/grid 2.6.21 → 2.6.23

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.
Files changed (151) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +22 -0
  3. package/dist/GridMenus.svelte +201 -18
  4. package/dist/SvAutoComplete.svelte +4 -0
  5. package/dist/SvComboBox.svelte +5 -1
  6. package/dist/SvDateRangeInput.svelte +25 -3
  7. package/dist/SvDropDownList.svelte +4 -0
  8. package/dist/SvForm.svelte +8 -8
  9. package/dist/SvGrid.controller.svelte.d.ts +61 -9
  10. package/dist/SvGrid.controller.svelte.js +363 -123
  11. package/dist/SvGrid.css +222 -1
  12. package/dist/SvGrid.helpers.d.ts +55 -0
  13. package/dist/SvGrid.helpers.js +83 -0
  14. package/dist/SvGrid.svelte +255 -56
  15. package/dist/SvGrid.types.d.ts +146 -1
  16. package/dist/SvGridCellEditor.svelte +99 -17
  17. package/dist/SvGridSelect.svelte +6 -2
  18. package/dist/SvGridSelect.svelte.d.ts +1 -1
  19. package/dist/SvListBox.svelte +8 -0
  20. package/dist/SvMultiSelect.svelte +6 -2
  21. package/dist/SvMultiSelect.svelte.d.ts +1 -1
  22. package/dist/SvNumberInput.svelte +4 -0
  23. package/dist/SvRichCell.svelte +125 -0
  24. package/dist/SvRichCell.svelte.d.ts +15 -0
  25. package/dist/SvTextArea.svelte +5 -1
  26. package/dist/SvTreeSelect.svelte +6 -2
  27. package/dist/SvTreeSelect.svelte.d.ts +1 -1
  28. package/dist/builtin-editors.d.ts +2 -2
  29. package/dist/builtin-editors.js +19 -3
  30. package/dist/cdn/GridMenus-BzWXQjv3.js +600 -0
  31. package/dist/cdn/GridMenus-xr_rHx8F.js +601 -0
  32. package/dist/cdn/SvDateRangeInput-CaOuMs8O.js +198 -0
  33. package/dist/cdn/SvDateRangeInput-DMLKmGEc.js +199 -0
  34. package/dist/cdn/SvDateTimePicker-CCbDZNZB.js +816 -0
  35. package/dist/cdn/SvDateTimePicker-sonaH0oh.js +812 -0
  36. package/dist/cdn/SvGridCellEditor-BAPSC7EL.js +550 -0
  37. package/dist/cdn/SvGridCellEditor-BwzmUWtL.js +549 -0
  38. package/dist/cdn/column-resize-DsfNXMom.js +102 -0
  39. package/dist/cdn/date-format-BNii4zeD.js +1393 -0
  40. package/dist/cdn/date-format-BnnHlqGw.js +1395 -0
  41. package/dist/cdn/{editor-registry-CiI0xlKg.js → editor-registry-BhgE3S84.js} +51 -25
  42. package/dist/cdn/row-resize-BRcimkUT.js +95 -0
  43. package/dist/cdn/{src-DBel9wRZ.js → src-DGo7IHug.js} +10017 -9488
  44. package/dist/cdn/{src-BYq-qyrp.js → src-skQN5eqh.js} +7829 -7300
  45. package/dist/cdn/svgrid.js +14 -10
  46. package/dist/cdn/svgrid.svelte-external.js +14 -10
  47. package/dist/cell-values.d.ts +16 -0
  48. package/dist/cell-values.js +28 -0
  49. package/dist/clipboard.d.ts +22 -0
  50. package/dist/clipboard.js +405 -27
  51. package/dist/column-groups.js +1 -1
  52. package/dist/column-resize.d.ts +46 -0
  53. package/dist/column-resize.js +205 -0
  54. package/dist/columns.d.ts +0 -3
  55. package/dist/columns.js +0 -57
  56. package/dist/core.d.ts +19 -4
  57. package/dist/core.js +460 -119
  58. package/dist/editing.js +12 -7
  59. package/dist/editors/cell-editors.d.ts +11 -0
  60. package/dist/editors/cell-editors.js +18 -1
  61. package/dist/filtering/excel-filters.js +28 -0
  62. package/dist/grid-messages.d.ts +15 -0
  63. package/dist/grid-messages.js +15 -0
  64. package/dist/group-display.d.ts +1 -1
  65. package/dist/index.d.ts +6 -1
  66. package/dist/index.js +10 -0
  67. package/dist/list-option.d.ts +6 -0
  68. package/dist/menus.js +41 -8
  69. package/dist/row-resize.d.ts +11 -0
  70. package/dist/row-resize.js +7 -1
  71. package/dist/sanitize-html.d.ts +37 -0
  72. package/dist/sanitize-html.js +234 -0
  73. package/dist/selection-bar-view.svelte.d.ts +25 -0
  74. package/dist/selection-bar-view.svelte.js +13 -0
  75. package/dist/selection.d.ts +2 -1
  76. package/dist/selection.js +133 -8
  77. package/dist/spreadsheet.d.ts +1 -1
  78. package/dist/spreadsheet.js +1 -1
  79. package/package.json +1 -1
  80. package/src/GridMenus.svelte +201 -18
  81. package/src/SvAutoComplete.svelte +4 -0
  82. package/src/SvComboBox.svelte +5 -1
  83. package/src/SvDateRangeInput.svelte +25 -3
  84. package/src/SvDropDownList.svelte +4 -0
  85. package/src/SvForm.svelte +8 -8
  86. package/src/SvGrid.controller.svelte.ts +404 -133
  87. package/src/SvGrid.css +222 -1
  88. package/src/SvGrid.helpers.ts +87 -0
  89. package/src/SvGrid.svelte +255 -56
  90. package/src/SvGrid.types.ts +153 -1
  91. package/src/SvGridCellEditor.svelte +99 -17
  92. package/src/SvGridSelect.svelte +6 -2
  93. package/src/SvListBox.svelte +8 -0
  94. package/src/SvMultiSelect.svelte +6 -2
  95. package/src/SvNumberInput.svelte +4 -0
  96. package/src/SvRichCell.svelte +125 -0
  97. package/src/SvTextArea.svelte +5 -1
  98. package/src/SvTreeSelect.svelte +6 -2
  99. package/src/builtin-editors.test.ts +18 -1
  100. package/src/builtin-editors.ts +19 -3
  101. package/src/cell-values.ts +30 -0
  102. package/src/clipboard.test.ts +93 -20
  103. package/src/clipboard.ts +433 -33
  104. package/src/column-groups.ts +1 -1
  105. package/src/column-resize.test.ts +381 -0
  106. package/src/column-resize.ts +227 -0
  107. package/src/columns.test.ts +0 -103
  108. package/src/columns.ts +0 -58
  109. package/src/core.aggregate.test.ts +134 -0
  110. package/src/core.filter.test.ts +156 -0
  111. package/src/core.grouping.test.ts +146 -0
  112. package/src/core.row-shape.test.ts +119 -0
  113. package/src/core.rowmodel-cache.test.ts +121 -0
  114. package/src/core.sort.test.ts +293 -0
  115. package/src/core.ts +516 -119
  116. package/src/date-string-column.test.ts +87 -0
  117. package/src/editing.test.ts +25 -0
  118. package/src/editing.ts +12 -9
  119. package/src/editor-block-prop.test.ts +132 -0
  120. package/src/editors/cell-editors.ts +27 -1
  121. package/src/filtering/excel-filters.ts +30 -0
  122. package/src/filtering/normalize-fast-path.test.ts +104 -0
  123. package/src/grid-messages.ts +34 -0
  124. package/src/group-display.ts +1 -1
  125. package/src/index.ts +25 -1
  126. package/src/list-option.ts +6 -0
  127. package/src/menus.test.ts +43 -0
  128. package/src/menus.ts +38 -8
  129. package/src/move-cells.test.ts +850 -0
  130. package/src/number-editor-literal.test.ts +84 -0
  131. package/src/number-editor.grid.test.ts +160 -0
  132. package/src/resize-props.test.ts +361 -0
  133. package/src/row-resize.test.ts +31 -0
  134. package/src/row-resize.ts +21 -3
  135. package/src/sanitize-html.test.ts +182 -0
  136. package/src/sanitize-html.ts +235 -0
  137. package/src/selection-bar-view.svelte.ts +36 -0
  138. package/src/selection.test.ts +157 -0
  139. package/src/selection.ts +135 -8
  140. package/src/spreadsheet.ts +1 -1
  141. package/src/svgrid.filter-menu-listbox.svelte.test.ts +56 -10
  142. package/src/svgrid.in-suggest-snapshot.svelte.test.ts +91 -0
  143. package/src/svgrid.menu-scroll-close.test.ts +204 -0
  144. package/src/svgrid.selection-bar-seam.test.ts +185 -0
  145. package/src/svgrid.upsell-license.test.ts +117 -0
  146. package/dist/cdn/GridMenus-BfTAKn84.js +0 -488
  147. package/dist/cdn/GridMenus-C3bJd7w8.js +0 -489
  148. package/dist/cdn/SvDateTimePicker-CHnUkWcH.js +0 -2206
  149. package/dist/cdn/SvDateTimePicker-CRQH_U7E.js +0 -2201
  150. package/dist/cdn/SvGridCellEditor-BGUCzuPB.js +0 -523
  151. package/dist/cdn/SvGridCellEditor-G8IMWIws.js +0 -522
package/src/menus.test.ts CHANGED
@@ -30,6 +30,11 @@ function makeCtx(overrides: any = {}) {
30
30
  commentDraft: '',
31
31
  noteOverrides: {},
32
32
  columnMenuFacetValues: [],
33
+ // The values currently SHOWN, i.e. after the search box narrows the list.
34
+ // Equal to `columnMenuFacetValues` when nothing is typed; the facet
35
+ // select-all reads both to tell "all" from "all results" apart.
36
+ columnMenuVisibleFacets: overrides.columnMenuVisibleFacets ??
37
+ overrides.columnMenuFacetValues ?? [],
33
38
  showColumnFiltersEffective: true,
34
39
  showFilterRowEffective: false,
35
40
  scrollContainer: null,
@@ -429,6 +434,44 @@ describe('createMenus - facet checkboxes', () => {
429
434
  m.toggleAllFacets('team') // was subset -> remove filter (all)
430
435
  expect(ctx.valueFilters.team).toBeUndefined()
431
436
  })
437
+
438
+ describe('with a search query narrowing the list', () => {
439
+ // "Select all" means the RESULTS while a query is typed, the way it does
440
+ // in a spreadsheet. It used to mean the whole column regardless: with
441
+ // everything ticked (the default) it read as "on" and the click cleared
442
+ // the entire selection instead of keeping the matches.
443
+ const searched = (extra: any = {}) =>
444
+ makeCtx({
445
+ columnMenuFacetValues: ['Ada', 'Alan', 'Bram'],
446
+ columnMenuVisibleFacets: ['Ada', 'Alan'],
447
+ ...extra,
448
+ })
449
+
450
+ it('selects only the matches instead of clearing everything', () => {
451
+ const ctx = searched()
452
+ const m = createMenus(ctx)
453
+ // Default state is "all ticked", so the box shows checked for the
454
+ // matches; clicking it unticks THEM and leaves the rest alone.
455
+ expect(m.isAllFacetsChecked('team')).toBe(true)
456
+ m.toggleAllFacets('team')
457
+ expect([...ctx.valueFilters.team].sort()).toEqual(['Bram'])
458
+ })
459
+
460
+ it('ticking it back adds the matches to the existing selection', () => {
461
+ const ctx = searched({ valueFilters: { team: new Set(['Bram']) } })
462
+ const m = createMenus(ctx)
463
+ expect(m.isAllFacetsChecked('team')).toBe(false)
464
+ m.toggleAllFacets('team')
465
+ expect([...ctx.valueFilters.team].sort()).toEqual(['Ada', 'Alan', 'Bram'])
466
+ })
467
+
468
+ it('reports checked only when every match is selected', () => {
469
+ const partial = searched({ valueFilters: { team: new Set(['Ada']) } })
470
+ expect(createMenus(partial).isAllFacetsChecked('team')).toBe(false)
471
+ const both = searched({ valueFilters: { team: new Set(['Ada', 'Alan']) } })
472
+ expect(createMenus(both).isAllFacetsChecked('team')).toBe(true)
473
+ })
474
+ })
432
475
  })
433
476
 
434
477
  describe('createMenus - clearColumnFilter', () => {
package/src/menus.ts CHANGED
@@ -151,7 +151,7 @@ export function createMenus<
151
151
  function openChooseColumns(event: MouseEvent) {
152
152
  event.stopPropagation();
153
153
  // Submenu behavior: keep the parent operations menu open and float the
154
- // Choose Columns panel out to the right of it (AG-Grid style). Falls
154
+ // Choose Columns panel out to the right of it, submenu-style. Falls
155
155
  // back to below the item if the popover would clip the viewport.
156
156
  const trigger = event.currentTarget as HTMLElement;
157
157
  const menuEl = trigger.closest(".sv-grid-menu") as HTMLElement | null;
@@ -294,19 +294,49 @@ export function createMenus<
294
294
  ctx.valueFilters = { ...ctx.valueFilters, [columnId]: new Set(next) };
295
295
  }
296
296
 
297
+ /**
298
+ * With a search query typed, "select all" means the RESULTS - the same thing
299
+ * it means in a spreadsheet. It used to mean the whole column regardless, so
300
+ * the standard flow (type a query, tick select-all, get just the matches)
301
+ * cleared the entire selection instead: `isAllFacetsChecked` saw every value
302
+ * ticked, read that as "on", and turned everything off.
303
+ */
297
304
  function isAllFacetsChecked(columnId: string) {
298
305
  const selected = ctx.valueFilters[columnId];
299
- return !selected || selected.size >= ctx.columnMenuFacetValues.length;
306
+ const visible = ctx.columnMenuVisibleFacets as Array<string>;
307
+ const searching = visible.length !== ctx.columnMenuFacetValues.length;
308
+ if (!selected) return true;
309
+ if (searching) return visible.every((value) => selected.has(value));
310
+ return selected.size >= ctx.columnMenuFacetValues.length;
300
311
  }
301
312
 
302
313
  function toggleAllFacets(columnId: string) {
303
- if (isAllFacetsChecked(columnId)) {
304
- ctx.valueFilters = { ...ctx.valueFilters, [columnId]: new Set<string>() };
305
- } else {
306
- const copy = { ...ctx.valueFilters };
307
- delete copy[columnId];
308
- ctx.valueFilters = copy;
314
+ const visible = ctx.columnMenuVisibleFacets as Array<string>;
315
+ const all = ctx.columnMenuFacetValues as Array<string>;
316
+ const searching = visible.length !== all.length;
317
+ const on = isAllFacetsChecked(columnId);
318
+
319
+ if (!searching) {
320
+ if (on) {
321
+ ctx.valueFilters = { ...ctx.valueFilters, [columnId]: new Set<string>() };
322
+ } else {
323
+ const copy = { ...ctx.valueFilters };
324
+ delete copy[columnId];
325
+ ctx.valueFilters = copy;
326
+ }
327
+ return;
328
+ }
329
+ // Searching: add or remove just the matches, leaving the rest of the
330
+ // selection alone. An absent entry means "everything", so it has to be
331
+ // materialized before a subtraction can mean anything.
332
+ const current = ctx.valueFilters[columnId]
333
+ ? new Set<string>(ctx.valueFilters[columnId])
334
+ : new Set<string>(all);
335
+ for (const value of visible) {
336
+ if (on) current.delete(value);
337
+ else current.add(value);
309
338
  }
339
+ ctx.valueFilters = { ...ctx.valueFilters, [columnId]: current };
310
340
  }
311
341
 
312
342
  function clearColumnFilter(columnId: string) {