@svgrid/enterprise 3.1.0 → 3.1.2

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 (78) hide show
  1. package/dist/SvSheet.svelte +93 -8
  2. package/dist/cdn/svgrid-enterprise.svelte-external.js +9339 -9077
  3. package/dist/designer/assets/{GridMenus-8gTNssgV.js → GridMenus-DGZJKFvX.js} +1 -1
  4. package/dist/designer/assets/SvGrid.helpers-DE5mmORW.js +1 -0
  5. package/dist/designer/assets/{SvGridCellEditor-DMoWJjEI.js → SvGridCellEditor-C7NWcnNC.js} +1 -1
  6. package/dist/designer/assets/{SvGridChart-Cy1ATrWh.js → SvGridChart-Fg43Yi0M.js} +2 -2
  7. package/dist/designer/assets/{SvGridChartBuilder-eQ3mn0L9.js → SvGridChartBuilder-BqGuA3yU.js} +1 -1
  8. package/dist/designer/assets/{SvGridChartPanel-CATdVc9X.js → SvGridChartPanel-BsiXRAnx.js} +3 -3
  9. package/dist/designer/assets/{SvGridChartView-CmsZtCED.js → SvGridChartView-BgttK0tR.js} +1 -1
  10. package/dist/designer/assets/{SvListBox-BDS66lmZ.js → SvListBox-v2jm0-vf.js} +1 -1
  11. package/dist/designer/assets/cell-formatting-BWrW_O0n.js +1 -0
  12. package/dist/designer/assets/{chart-Cn7MnNqA.js → chart-BIl-dIRv.js} +1 -1
  13. package/dist/designer/assets/{chart-panel-messages-Dz7PTIqT.js → chart-panel-messages-4cF2vw7L.js} +1 -1
  14. package/dist/designer/assets/{chart-summary-BD1qYB2R.js → chart-summary-B7bTtSCC.js} +1 -1
  15. package/dist/designer/assets/{chart-trend-B8xr5LuD.js → chart-trend-CLsn5Hgd.js} +1 -1
  16. package/dist/designer/assets/export-format-DGscOjS9.js +6 -0
  17. package/dist/designer/assets/{index-BSjv6Qec.js → index-V_cMXdxt.js} +314 -314
  18. package/dist/designer/assets/index-l21iGkpF.css +1 -0
  19. package/dist/designer/assets/src-Mu7AGqT8.js +58 -0
  20. package/dist/designer/assets/validate-YxSrBF1H.js +1 -0
  21. package/dist/designer/index.html +12 -12
  22. package/dist/export-ooxml.d.ts +10 -0
  23. package/dist/export-ooxml.js +22 -5
  24. package/dist/import.js +11 -2
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.js +1 -1
  27. package/dist/node/studio.js +236 -132
  28. package/dist/server/index.d.ts +1 -0
  29. package/dist/server/index.js +1 -0
  30. package/dist/server/server-row-model.d.ts +9 -0
  31. package/dist/server/server-row-model.js +120 -3
  32. package/dist/server/worker-data-source.d.ts +62 -0
  33. package/dist/server/worker-data-source.js +133 -0
  34. package/dist/sheet/objects.d.ts +47 -0
  35. package/dist/sheet/objects.js +33 -0
  36. package/dist/studio/cli.js +55 -1
  37. package/dist/studio/emit-project.js +8 -3
  38. package/dist/studio/init-flow.d.ts +6 -1
  39. package/dist/studio/init-flow.js +43 -2
  40. package/dist/studio/scaffold-app.d.ts +6 -0
  41. package/dist/studio/scaffold-app.js +5 -3
  42. package/dist/studio/scaffold.js +29 -12
  43. package/dist/sveltekit/in-memory.d.ts +21 -1
  44. package/dist/sveltekit/in-memory.js +153 -105
  45. package/dist/sveltekit/index.d.ts +1 -1
  46. package/dist/version.d.ts +14 -1
  47. package/dist/version.js +14 -1
  48. package/dist/wc/{GridMenus-By9vPuq0.js → GridMenus-6_fF5jIm.js} +2 -2
  49. package/dist/wc/{SvGrid.helpers-BdVDtjUm.js → SvGrid.helpers-zBkDTryR.js} +36 -37
  50. package/dist/wc/{SvGridCellEditor-Bnf1Kr5C.js → SvGridCellEditor-CzUKEbkI.js} +1 -1
  51. package/dist/wc/{SvGridChart-BqUJh2pG.js → SvGridChart-C6UvNIbN.js} +3 -3
  52. package/dist/wc/{SvGridChartBuilder-CGycC5cn.js → SvGridChartBuilder-ikf_5LyW.js} +3 -3
  53. package/dist/wc/{SvGridChartPanel-CRnizsHD.js → SvGridChartPanel-Dc_jj7B-.js} +4 -4
  54. package/dist/wc/{SvGridChartView-D1pa_xMy.js → SvGridChartView-thkznAOb.js} +2 -2
  55. package/dist/wc/{cell-formatting-CBfgahv1.js → cell-formatting-hb3vzxhJ.js} +27 -5
  56. package/dist/wc/{chart-6OXlybVT.js → chart-CV5D7_k8.js} +1 -1
  57. package/dist/wc/{chart-summary-2m3ia1-n.js → chart-summary-DGx0QhJa.js} +1 -1
  58. package/dist/wc/{chart-trend-CQOQtTMl.js → chart-trend-BIRH_xH8.js} +1 -1
  59. package/dist/wc/sv-sheet-element.js +7454 -7352
  60. package/dist/wc/{svelte-virtualizer.svelte-CXtQy2TQ.js → svelte-virtualizer.svelte-Du4tjrIP.js} +7 -3
  61. package/dist/wc/{validate-BqDthkNr.js → validate-JAuMsk6Z.js} +36 -36
  62. package/dist/worker/columnar.d.ts +42 -0
  63. package/dist/worker/columnar.js +410 -0
  64. package/dist/worker/index.d.ts +12 -0
  65. package/dist/worker/index.js +12 -0
  66. package/dist/worker/infer-schema.d.ts +21 -0
  67. package/dist/worker/infer-schema.js +34 -0
  68. package/dist/worker/protocol.d.ts +73 -0
  69. package/dist/worker/protocol.js +14 -0
  70. package/dist/worker/serve.d.ts +44 -0
  71. package/dist/worker/serve.js +100 -0
  72. package/package.json +7 -3
  73. package/dist/designer/assets/SvGrid.helpers-BgT-gnCo.js +0 -1
  74. package/dist/designer/assets/cell-formatting-BbubJTVz.js +0 -1
  75. package/dist/designer/assets/export-format-DGckmgKr.js +0 -6
  76. package/dist/designer/assets/index-_JVFxt02.css +0 -1
  77. package/dist/designer/assets/src-DUQ4xE3x.js +0 -58
  78. package/dist/designer/assets/validate-C3B8QKsM.js +0 -1
@@ -99,7 +99,7 @@
99
99
  import SvSheetLink from './SvSheetLink.svelte'
100
100
  import SvSheetTable from './SvSheetTable.svelte'
101
101
  import {
102
- chartSpecOf, chartFromRange, copyObject, objectId,
102
+ chartSpecOf, chartFromRange, copyObject, objectId, paneOf, paneClip,
103
103
  type SheetObject, type SheetChartObject, type ObjectAnchor,
104
104
  } from './sheet/objects'
105
105
  import {
@@ -1806,8 +1806,16 @@
1806
1806
  const activeObjects = $derived.by(() => { void version; return objectsNow() })
1807
1807
  let selectedObject = $state<string | null>(null)
1808
1808
  let chartSetup = $state<SheetChartObject | null>(null)
1809
- /** Where each object sits in the layer right now, by id. */
1810
- let objectBoxes = $state<Record<string, { left: number; top: number; width: number; height: number }>>({})
1809
+ /**
1810
+ * Where each object sits in the layer right now, by id. `frozen` is true
1811
+ * for one hung from a frozen cell, which is drawn over the frozen panes;
1812
+ * `clip` is the CSS clip-path that cuts it to its pane, or null when
1813
+ * nothing of it is cut.
1814
+ */
1815
+ type ObjectBox = { left: number; top: number; width: number; height: number; frozen: boolean; clip: string | null }
1816
+ let objectBoxes = $state<Record<string, ObjectBox>>({})
1817
+ /** The object being dragged, drawn whole and on top until it is dropped. */
1818
+ let draggingObject = $state<string | null>(null)
1811
1819
  let dragging: { id: string; kind: 'move' | 'resize'; x: number; y: number; anchor: ObjectAnchor } | null = null
1812
1820
  let imageInput = $state<HTMLInputElement | null>(null)
1813
1821
 
@@ -2444,22 +2452,68 @@
2444
2452
  return sheetIsRtl() ? b.right - start : b.left + start
2445
2453
  }
2446
2454
 
2455
+ /**
2456
+ * Where the panes meet, in the layer's frame: the scrolling cells begin at
2457
+ * `start` (past the frozen columns, or the row numbers) and `top` (under
2458
+ * the frozen rows, or the header), and the sheet's window ends at `end`
2459
+ * and `bottom`. Read from the grid's own sticky cells, which sit still
2460
+ * while the sheet scrolls.
2461
+ */
2462
+ function paneEdges(host: HTMLElement, b: DOMRect) {
2463
+ const grid = host.querySelector<HTMLElement>('.sv-grid-container')
2464
+ if (!grid) return null
2465
+ const g = grid.getBoundingClientRect()
2466
+ const rtl = sheetIsRtl()
2467
+ const endOf = (r: DOMRect) => (rtl ? b.right - r.left : r.right - b.left)
2468
+ // The row numbers and the frozen columns, from the first row's cells
2469
+ // rather than the header's, which View > Headings can hide.
2470
+ let start = startOf(g, b)
2471
+ const row = grid.querySelector('td[data-svgrid-row]')?.parentElement
2472
+ for (const el of row?.querySelectorAll<HTMLElement>('td[data-pinned="left"], td.sv-grid-row-number-cell') ?? []) {
2473
+ const r = el.getBoundingClientRect()
2474
+ if (r.width) start = Math.max(start, endOf(r))
2475
+ }
2476
+ let top = g.top - b.top
2477
+ const head = grid.querySelector('.sv-grid-head')
2478
+ if (head) top = Math.max(top, head.getBoundingClientRect().bottom - b.top)
2479
+ for (const tr of grid.querySelectorAll('tr.sv-grid-row-frozen')) top = Math.max(top, tr.getBoundingClientRect().bottom - b.top)
2480
+ return { start, top, end: endOf(g), bottom: g.bottom - b.top, rtl }
2481
+ }
2482
+
2447
2483
  function measureObjects() {
2448
2484
  const host = gridHost
2449
2485
  const objects = objectsNow()
2450
2486
  if (!host || !objects.length) { objectBoxes = {}; return }
2451
2487
  const b = host.getBoundingClientRect()
2452
- const next: Record<string, { left: number; top: number; width: number; height: number }> = {}
2488
+ const edges = paneEdges(host, b)
2489
+ const freeze = doc.get(wb.active).freeze
2490
+ const next: Record<string, ObjectBox> = {}
2453
2491
  for (const object of objects) {
2454
2492
  const td = host.querySelector<HTMLElement>(`td[data-svgrid-row="${object.anchor.row}"][data-svgrid-col="${object.anchor.col}"]`)
2455
2493
  if (!td) continue
2456
2494
  const a = td.getBoundingClientRect()
2457
- next[object.id] = {
2495
+ const box = {
2458
2496
  left: startOf(a, b) + object.anchor.dx,
2459
2497
  top: a.top - b.top + object.anchor.dy,
2460
2498
  width: object.anchor.width,
2461
2499
  height: object.anchor.height,
2462
2500
  }
2501
+ // Each object stays with the pane of its anchor cell (#116): one hung
2502
+ // from a frozen cell is drawn over the frozen cells, the rest slide
2503
+ // under them, and every one is cut at its pane's edges.
2504
+ const pane = paneOf(object.anchor, freeze)
2505
+ let clip: string | null = null
2506
+ if (edges) {
2507
+ const cut = paneClip(pane, box, edges)
2508
+ if (cut.start || cut.top || cut.end || cut.bottom) {
2509
+ // An uncut side is left open by a few pixels, so the shadow and
2510
+ // the resize grip still show there.
2511
+ const side = (n: number) => (n > 0 ? `${n}px` : '-12px')
2512
+ const [left, right] = edges.rtl ? [cut.end, cut.start] : [cut.start, cut.end]
2513
+ clip = `inset(${side(cut.top)} ${side(right)} ${side(cut.bottom)} ${side(left)})`
2514
+ }
2515
+ }
2516
+ next[object.id] = { ...box, frozen: pane !== 'body', clip }
2463
2517
  }
2464
2518
  objectBoxes = next
2465
2519
  }
@@ -2543,6 +2597,9 @@
2543
2597
  // Moved live in the layer only; the document hears about it on release.
2544
2598
  const box = objectBoxes[drag.id]
2545
2599
  if (!box) return
2600
+ // Drawn whole and over the frozen panes while it moves, so it can be
2601
+ // carried across a pane edge; cut to its new pane once it lands.
2602
+ if ((dx || dy) && draggingObject !== drag.id) draggingObject = drag.id
2546
2603
  objectBoxes = {
2547
2604
  ...objectBoxes,
2548
2605
  [drag.id]: drag.kind === 'move'
@@ -2550,10 +2607,18 @@
2550
2607
  : { ...box, width: Math.max(80, drag.anchor.width + (sheetIsRtl() ? -dx : dx)), height: Math.max(60, drag.anchor.height + dy) },
2551
2608
  }
2552
2609
  }
2610
+ /** A drag the browser took back (a touch turned into a scroll): nothing moves. */
2611
+ function onObjectPointerCancel() {
2612
+ dragging = null
2613
+ draggingObject = null
2614
+ measureObjects()
2615
+ }
2553
2616
  function onObjectPointerUp(event: PointerEvent) {
2554
2617
  const drag = dragging
2555
2618
  dragging = null
2556
2619
  if (!drag) return
2620
+ // Cut to its pane again from where it landed, once the move is in.
2621
+ if (draggingObject) { draggingObject = null; void tick().then(measureObjects) }
2557
2622
  const object = objectsNow().find((o) => o.id === drag.id)
2558
2623
  const box = objectBoxes[drag.id]
2559
2624
  if (!object || !box) return
@@ -6360,7 +6425,10 @@
6360
6425
  {/if}
6361
6426
  {#if activeObjects.length}
6362
6427
  <!-- Excel's floating objects: each anchored to a cell, drawn over the
6363
- rendered ones, moved by a drag and resized by the corner. -->
6428
+ rendered ones, moved by a drag and resized by the corner. Each
6429
+ keeps to the pane of its anchor cell: `frozen` lifts one hung from
6430
+ a frozen cell over the frozen cells, and `clip` cuts every one at
6431
+ its pane's edges. -->
6364
6432
  <div class="sheet-object-layer">
6365
6433
  {#each activeObjects as object (object.id)}
6366
6434
  {@const box = objectBoxes[object.id]}
@@ -6369,15 +6437,19 @@
6369
6437
  <div
6370
6438
  class="sheet-object"
6371
6439
  class:selected={selectedObject === object.id}
6440
+ class:frozen={box.frozen}
6441
+ class:dragging={draggingObject === object.id}
6372
6442
  role="figure"
6373
6443
  aria-label={object.kind === 'chart' ? t('chartObject') : object.alt || t('pictureObject')}
6374
6444
  style:inset-inline-start="{box.left}px"
6375
6445
  style:top="{box.top}px"
6376
6446
  style:width="{box.width}px"
6377
6447
  style:height="{box.height}px"
6448
+ style:clip-path={draggingObject === object.id ? null : box.clip}
6378
6449
  onpointerdown={(event) => onObjectPointerDown(event, object, 'move')}
6379
6450
  onpointermove={onObjectPointerMove}
6380
6451
  onpointerup={onObjectPointerUp}
6452
+ onpointercancel={onObjectPointerCancel}
6381
6453
  ondblclick={() => { if (object.kind === 'chart') chartSetup = object }}
6382
6454
  >
6383
6455
  {#if object.kind === 'chart'}
@@ -6397,6 +6469,7 @@
6397
6469
  onpointerdown={(event) => onObjectPointerDown(event, object, 'resize')}
6398
6470
  onpointermove={onObjectPointerMove}
6399
6471
  onpointerup={onObjectPointerUp}
6472
+ onpointercancel={onObjectPointerCancel}
6400
6473
  ></span>
6401
6474
  {/if}
6402
6475
  </div>
@@ -7002,15 +7075,25 @@
7002
7075
  .sheet-cell-anchor .box { display: inline-block; }
7003
7076
  .sheet-file-input { display: none; }
7004
7077
  /* The object layer: charts and pictures over the cells. The layer itself
7005
- lets the pointer through, each object catches it. */
7078
+ lets the pointer through, each object catches it. No z-index on the
7079
+ layer, so it makes no stacking context and each object is stacked
7080
+ against the grid's sticky cells on its own: an object in the scrolling
7081
+ pane under the frozen cells (z-index 30) and the frozen rows (31), one
7082
+ hung from a frozen cell over them, and all under the header (35).
7083
+ `overflow: clip` because an object's clip-path hides the part below the
7084
+ sheet's window but still counts as scrollable overflow: a chart hanging
7085
+ past the bottom made the page taller, and scrolling the sheet shrank it
7086
+ again, so a scrolled page jumped. `clip` rather than `hidden` keeps the
7087
+ layer from becoming a scroll container. */
7006
7088
  .sheet-object-layer {
7007
7089
  position: absolute;
7008
7090
  inset: 0;
7009
- z-index: 7;
7091
+ overflow: clip;
7010
7092
  pointer-events: none;
7011
7093
  }
7012
7094
  .sheet-object {
7013
7095
  position: absolute;
7096
+ z-index: 7;
7014
7097
  pointer-events: auto;
7015
7098
  background: var(--sg-bg, #fff);
7016
7099
  border: 1px solid var(--sg-border, #d1d1d1);
@@ -7020,6 +7103,8 @@
7020
7103
  cursor: move;
7021
7104
  touch-action: none;
7022
7105
  }
7106
+ .sheet-object.frozen { z-index: 32; }
7107
+ .sheet-object.dragging { z-index: 33; }
7023
7108
  .sheet-object.selected {
7024
7109
  border-color: var(--sg-accent, #107c41);
7025
7110
  box-shadow: 0 0 0 1px var(--sg-accent, #107c41), 0 2px 8px rgb(0 0 0 / 16%);