@svgrid/enterprise 3.1.28 → 3.1.30

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 (54) hide show
  1. package/dist/SvSheet.svelte +16 -0
  2. package/dist/cdn/{smart.export-D9FF4wAB.js → smart.export-0xDkly3x.js} +79 -63
  3. package/dist/cdn/svgrid-enterprise.svelte-external.js +45 -11
  4. package/dist/designer/assets/GridFind-MbmnQGp-.js +1 -0
  5. package/dist/designer/assets/{GridFooter-EyLg77jG.js → GridFooter-D0Ijrfs8.js} +1 -1
  6. package/dist/designer/assets/{GridMenus-BAgfpDd-.js → GridMenus-CYhdG48A.js} +1 -1
  7. package/dist/designer/assets/{SvGrid.helpers-DHkH3mHW.js → SvGrid.helpers-D0c-xJC6.js} +1 -1
  8. package/dist/designer/assets/{SvGridCellEditor-BHxH4b5h.js → SvGridCellEditor-sD6veY1r.js} +1 -1
  9. package/dist/designer/assets/{SvGridChart-DzCeEdlb.js → SvGridChart-BWFqs-48.js} +2 -2
  10. package/dist/designer/assets/{SvGridChartBuilder-CsXVVKvA.js → SvGridChartBuilder-CDkpH3a8.js} +1 -1
  11. package/dist/designer/assets/{SvGridChartPanel-Dj3IxTS2.js → SvGridChartPanel-CZUMJSNR.js} +3 -3
  12. package/dist/designer/assets/{SvGridChartView-Dwm4hxbW.js → SvGridChartView-B28YSGtz.js} +1 -1
  13. package/dist/designer/assets/aligned-grids-5VO4w2pq.js +1 -0
  14. package/dist/designer/assets/cell-formatting-CDP4IvHm.js +1 -0
  15. package/dist/designer/assets/{chart-Bmu-KAet.js → chart-SJcjQYZM.js} +1 -1
  16. package/dist/designer/assets/{chart-panel-messages-B3y8y3kL.js → chart-panel-messages-CsNPT3N0.js} +1 -1
  17. package/dist/designer/assets/{chart-summary-DxE0R2Bk.js → chart-summary-J7yVJWNx.js} +1 -1
  18. package/dist/designer/assets/{chart-trend-_gDVw3bP.js → chart-trend-CWfxPKk7.js} +1 -1
  19. package/dist/designer/assets/{export-format-NYxEY-0Y.js → export-format-jeYUruAF.js} +1 -1
  20. package/dist/designer/assets/{index-DPk7cZrl.js → index-3fRmx34y.js} +320 -320
  21. package/dist/designer/assets/index-BsdMTCRO.css +1 -0
  22. package/dist/designer/assets/{smart.export-CDCwbFH4.js → smart.export-AxSFVWeW.js} +7 -9
  23. package/dist/designer/assets/src-CFy7Oo-M.js +60 -0
  24. package/dist/designer/assets/sv-grid-scrollbar-Kxa7izux.js +109 -0
  25. package/dist/designer/index.html +12 -12
  26. package/dist/install.d.ts +3 -2
  27. package/dist/node/studio.js +3 -3
  28. package/dist/pivot.js +39 -5
  29. package/dist/print.d.ts +7 -1
  30. package/dist/print.js +6 -0
  31. package/dist/smart.export.js +1 -1
  32. package/dist/studio/ui-components.generated.js +1 -1
  33. package/dist/version.d.ts +2 -2
  34. package/dist/version.js +2 -2
  35. package/dist/wc/GridFind-DwjTaDqf.js +39 -0
  36. package/dist/wc/{GridFooter-CKC4L36O.js → GridFooter-H6Ltxqk9.js} +1 -1
  37. package/dist/wc/{GridMenus-BIQXB6a7.js → GridMenus-lyPYfbvF.js} +1 -1
  38. package/dist/wc/{SvGrid.helpers-tk7gWxcT.js → SvGrid.helpers-DovOhyhU.js} +1 -1
  39. package/dist/wc/{SvGridCellEditor-CZwhQx0a.js → SvGridCellEditor-9xR6C567.js} +1 -1
  40. package/dist/wc/{SvGridChart-DcfmVvzB.js → SvGridChart-CIdaCZQF.js} +3 -3
  41. package/dist/wc/{SvGridChartBuilder-1Z69mxbM.js → SvGridChartBuilder-DGlcVTiE.js} +3 -3
  42. package/dist/wc/{SvGridChartPanel-BaVsa-T-.js → SvGridChartPanel-NTMcrVyb.js} +4 -4
  43. package/dist/wc/{SvGridChartView-LEC8ZNeU.js → SvGridChartView-CNvBZnda.js} +2 -2
  44. package/dist/wc/aligned-grids-B0ZfULOR.js +57 -0
  45. package/dist/wc/{cell-formatting-5uEa4Y_0.js → cell-formatting-B2BDgY-k.js} +28 -10
  46. package/dist/wc/{chart-CznMeoM7.js → chart-j-Izih1o.js} +1 -1
  47. package/dist/wc/{chart-summary-COWSPw1p.js → chart-summary-DLWgESJJ.js} +1 -1
  48. package/dist/wc/{chart-trend-Dcn6jrAS.js → chart-trend-C8hVsyFi.js} +1 -1
  49. package/dist/wc/sv-sheet-element.js +10274 -10270
  50. package/package.json +3 -3
  51. package/dist/designer/assets/cell-formatting-JoxA0t65.js +0 -1
  52. package/dist/designer/assets/index-BU3ieI05.css +0 -1
  53. package/dist/designer/assets/src-sFRH_up7.js +0 -60
  54. package/dist/designer/assets/sv-grid-scrollbar-B9N6Wuj0.js +0 -109
@@ -0,0 +1,109 @@
1
+ var e=16,t=`http://www.w3.org/2000/svg`;function n(){let e=document.createElementNS(t,`svg`);e.setAttribute(`viewBox`,`0 0 24 24`),e.setAttribute(`fill`,`none`),e.setAttribute(`stroke`,`currentColor`),e.setAttribute(`stroke-width`,`3`),e.setAttribute(`stroke-linecap`,`round`),e.setAttribute(`stroke-linejoin`,`round`);let n=document.createElementNS(t,`path`);return n.setAttribute(`d`,`M6 9l6 6 6-6`),e.appendChild(n),e}var r=`
2
+ :host {
3
+ display: flex;
4
+ user-select: none;
5
+ background: var(--sg-scrollbar-bg, #eef2f8);
6
+ /* The 1px separator is drawn on the INNER edge only (the edge facing
7
+ the grid body) via the orientation rules below. A full inset box
8
+ here doubled up with the grid's own frame border on the outer edge,
9
+ reading as a 2px border - most visible in dense-gridline themes
10
+ like Excel, which should show a single 1px line. */
11
+ /* Start hidden + non-interactive - viewport/content sizes are 0 until
12
+ after the first layout pass, so without this default the scrollbar
13
+ paints visible for one frame and then JS hides it on mount. That
14
+ flicker is what shows up as a "flashing horizontal scrollbar"
15
+ every time a demo first renders. updateGeometry() switches us to
16
+ opacity 1 the moment the grid genuinely has overflow. */
17
+ opacity: 0;
18
+ pointer-events: none;
19
+ transition: opacity 120ms ease;
20
+ }
21
+ :host([orientation="vertical"]) {
22
+ flex-direction: column;
23
+ width: ${e}px;
24
+ /* LTR: vertical scrollbar sits at the right, inner edge is the left. */
25
+ box-shadow: inset 1px 0 0 0 var(--sg-scrollbar-border, rgba(15, 23, 42, 0.04));
26
+ }
27
+ :host([orientation="vertical"]:dir(rtl)) {
28
+ /* RTL flips the scrollbar to the left, so the inner edge is the right. */
29
+ box-shadow: inset -1px 0 0 0 var(--sg-scrollbar-border, rgba(15, 23, 42, 0.04));
30
+ }
31
+ :host([orientation="horizontal"]) {
32
+ flex-direction: row;
33
+ height: ${e}px;
34
+ /* Horizontal scrollbar sits at the bottom, inner edge is the top. */
35
+ box-shadow: inset 0 1px 0 0 var(--sg-scrollbar-border, rgba(15, 23, 42, 0.04));
36
+ }
37
+ .arrow {
38
+ flex: none;
39
+ display: flex;
40
+ align-items: center;
41
+ justify-content: center;
42
+ width: ${e}px;
43
+ height: ${e}px;
44
+ margin: 0;
45
+ padding: 0;
46
+ border: 0;
47
+ border-radius: 3px;
48
+ background: transparent;
49
+ color: var(--sg-scrollbar-arrow, #64748b);
50
+ cursor: pointer;
51
+ transition: background-color 100ms ease, color 100ms ease;
52
+ }
53
+ .arrow:hover {
54
+ background: var(--sg-scrollbar-arrow-hover-bg, #dde4ee);
55
+ color: var(--sg-scrollbar-arrow-hover, #1f2937);
56
+ }
57
+ .arrow:active {
58
+ background: var(--sg-scrollbar-arrow-active-bg, #c7d1df);
59
+ color: var(--sg-scrollbar-arrow-active, #0f172a);
60
+ }
61
+ .arrow:disabled {
62
+ color: var(--sg-scrollbar-arrow-disabled, #cbd5e1);
63
+ cursor: default;
64
+ }
65
+ .arrow:disabled:hover {
66
+ background: transparent;
67
+ }
68
+ .arrow svg {
69
+ width: 10px;
70
+ height: 10px;
71
+ display: block;
72
+ }
73
+ :host([orientation="vertical"]) .arrow-start svg {
74
+ transform: rotate(180deg);
75
+ }
76
+ :host([orientation="horizontal"]) .arrow-start svg {
77
+ transform: rotate(90deg);
78
+ }
79
+ :host([orientation="horizontal"]) .arrow-end svg {
80
+ transform: rotate(-90deg);
81
+ }
82
+ .track {
83
+ position: relative;
84
+ flex: 1 1 0;
85
+ min-width: 0;
86
+ min-height: 0;
87
+ }
88
+ .thumb {
89
+ position: absolute;
90
+ border-radius: var(--sg-scrollbar-thumb-radius, 6px);
91
+ background: var(--sg-scrollbar-thumb, #b1bccd);
92
+ cursor: pointer;
93
+ transition: background-color 100ms ease;
94
+ }
95
+ .thumb:hover {
96
+ background: var(--sg-scrollbar-thumb-hover, #8693a7);
97
+ }
98
+ .thumb:active {
99
+ background: var(--sg-scrollbar-thumb-active, #64748b);
100
+ }
101
+ :host([orientation="vertical"]) .thumb {
102
+ left: 3px;
103
+ right: 3px;
104
+ }
105
+ :host([orientation="horizontal"]) .thumb {
106
+ top: 3px;
107
+ bottom: 3px;
108
+ }
109
+ `,i=typeof HTMLElement<`u`?HTMLElement:class{},a=class e extends i{constructor(...e){super(...e),this.dragging=!1,this.dragStart=0,this.valueStart=0,this.holdTimer=null,this.resizeObserver=null,this.resizeFrame=0,this.trackLength=0,this.onArrowStartPointerDown=e=>{e.preventDefault(),this.startHold(-1)},this.onArrowEndPointerDown=e=>{e.preventDefault(),this.startHold(1)},this.stopHold=()=>{this.holdTimer!==null&&(clearTimeout(this.holdTimer),clearInterval(this.holdTimer),this.holdTimer=null)},this.onThumbPointerDown=e=>{e.preventDefault(),this.dragging=!0,this.dragStart=this.orientation===`vertical`?e.clientY:e.clientX,this.valueStart=this.value,document.addEventListener(`pointermove`,this.onPointerMove),document.addEventListener(`pointerup`,this.onPointerUp)},this.onTrackPointerDown=e=>{if(e.target===this.thumb)return;let t=this.track.getBoundingClientRect(),n=this.orientation===`vertical`?e.clientY-t.top:e.clientX-t.left,r=this.orientation===`vertical`?t.height:t.width,i=this.computeThumbSize(r),a=Math.max(r-i,1),o=Math.min(Math.max(n-i/2,0),a);this.emitScroll(o/a*this.maxValue)},this.onPointerMove=e=>{if(!this.dragging)return;let t=(this.orientation===`vertical`?e.clientY:e.clientX)-this.dragStart,n=this.track.getBoundingClientRect(),r=this.orientation===`vertical`?n.height:n.width,i=this.computeThumbSize(r),a=Math.max(r-i,1);this.emitScroll(this.valueStart+t/a*this.maxValue)},this.onPointerUp=()=>{this.dragging=!1,document.removeEventListener(`pointermove`,this.onPointerMove),document.removeEventListener(`pointerup`,this.onPointerUp)}}static get observedAttributes(){return[`orientation`,`viewport-size`,`content-size`,`value`,`step`]}connectedCallback(){if(this.shadowRoot)return;let e=this.attachShadow({mode:`open`}),t=document.createElement(`style`);t.textContent=r,this.startArrow=this.createArrow(`start`),this.endArrow=this.createArrow(`end`),this.track=document.createElement(`div`),this.track.className=`track`,this.thumb=document.createElement(`div`),this.thumb.className=`thumb`,this.track.appendChild(this.thumb),e.append(t,this.startArrow,this.track,this.endArrow),this.thumb.addEventListener(`pointerdown`,this.onThumbPointerDown),this.track.addEventListener(`pointerdown`,this.onTrackPointerDown),this.startArrow.addEventListener(`pointerdown`,this.onArrowStartPointerDown),this.endArrow.addEventListener(`pointerdown`,this.onArrowEndPointerDown);for(let e of[this.startArrow,this.endArrow])e.addEventListener(`pointerup`,this.stopHold),e.addEventListener(`pointerleave`,this.stopHold),e.addEventListener(`pointercancel`,this.stopHold);this.resizeObserver=new ResizeObserver(()=>{this.measureTrack(),!this.resizeFrame&&(this.resizeFrame=requestAnimationFrame(()=>{this.resizeFrame=0,this.render()}))}),this.resizeObserver.observe(this),this.render()}disconnectedCallback(){this.stopHold(),this.resizeFrame&&cancelAnimationFrame(this.resizeFrame),this.resizeFrame=0,this.resizeObserver?.disconnect(),this.resizeObserver=null,document.removeEventListener(`pointermove`,this.onPointerMove),document.removeEventListener(`pointerup`,this.onPointerUp)}attributeChangedCallback(){this.render()}get orientation(){return this.getAttribute(`orientation`)===`horizontal`?`horizontal`:`vertical`}get viewportSize(){return Number(this.getAttribute(`viewport-size`)||`0`)}get contentSize(){return Number(this.getAttribute(`content-size`)||`0`)}get value(){return Number(this.getAttribute(`value`)||`0`)}get step(){let e=Number(this.getAttribute(`step`)||`40`);return e>0?e:40}get maxValue(){return Math.max(this.contentSize-this.viewportSize,0)}measureTrack(){if(!this.track)return;let e=this.track.getBoundingClientRect();this.trackLength=this.orientation===`vertical`?e.height:e.width}getTrackLength(){return this.trackLength>0?this.trackLength:Math.max(this.viewportSize-32,1)}static setStyle(e,t,n){e.style[t]!==n&&(e.style[t]=n)}computeThumbSize(e){if(this.contentSize<=0||this.viewportSize<=0||e<=0)return 0;let t=Math.min(this.viewportSize/this.contentSize,1);return Math.max(20,t*e)}createArrow(e){let t=document.createElement(`button`);return t.type=`button`,t.className=`arrow arrow-${e}`,t.setAttribute(`aria-label`,e===`start`?`Scroll back`:`Scroll forward`),t.appendChild(n()),t}startHold(e){this.stopHold();let t=()=>this.emitScroll(this.value+e*this.step);t(),this.holdTimer=setTimeout(()=>{this.holdTimer=setInterval(t,50)},280)}emitScroll(e){let t=Math.min(Math.max(e,0),this.maxValue);this.dispatchEvent(new CustomEvent(`scroll-change`,{detail:{value:t},bubbles:!0,composed:!0}))}render(){if(!this.shadowRoot)return;let t=e.setStyle,n=this.viewportSize,r=this.contentSize<=n||n<=0;t(this,`opacity`,r?`0`:`1`),t(this,`pointerEvents`,r?`none`:`auto`);let i=this.getTrackLength(),a=this.computeThumbSize(i),o=this.maxValue,s=(o>0?this.value/o:0)*Math.max(i-a,0);this.orientation===`vertical`?(t(this.thumb,`height`,`${a}px`),t(this.thumb,`transform`,`translateY(${s}px)`)):(t(this.thumb,`width`,`${a}px`),t(this.thumb,`transform`,`translateX(${s}px)`)),this.startArrow.disabled=r||this.value<=0,this.endArrow.disabled=r||this.value>=o}};typeof window<`u`&&!customElements.get(`sv-grid-scrollbar`)&&customElements.define(`sv-grid-scrollbar`,a);
@@ -4,19 +4,19 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>SvGrid Studio - Designer</title>
7
- <script type="module" crossorigin src="./assets/index-DPk7cZrl.js"></script>
7
+ <script type="module" crossorigin src="./assets/index-3fRmx34y.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-Dd_uD5pT.js">
9
9
  <link rel="modulepreload" crossorigin href="./assets/disclose-version-CIm4S9xS.js">
10
- <link rel="modulepreload" crossorigin href="./assets/cell-formatting-JoxA0t65.js">
10
+ <link rel="modulepreload" crossorigin href="./assets/cell-formatting-CDP4IvHm.js">
11
11
  <link rel="modulepreload" crossorigin href="./assets/conditional-formatting-MDWbF8_Y.js">
12
12
  <link rel="modulepreload" crossorigin href="./assets/csv-injection-C4a0uulO.js">
13
- <link rel="modulepreload" crossorigin href="./assets/export-format-NYxEY-0Y.js">
13
+ <link rel="modulepreload" crossorigin href="./assets/export-format-jeYUruAF.js">
14
14
  <link rel="modulepreload" crossorigin href="./assets/column-types-Bl5R-97G.js">
15
15
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-HclGiUj8.js">
16
- <link rel="modulepreload" crossorigin href="./assets/src-sFRH_up7.js">
17
- <link rel="modulepreload" crossorigin href="./assets/sv-grid-scrollbar-B9N6Wuj0.js">
16
+ <link rel="modulepreload" crossorigin href="./assets/src-CFy7Oo-M.js">
17
+ <link rel="modulepreload" crossorigin href="./assets/sv-grid-scrollbar-Kxa7izux.js">
18
18
  <link rel="modulepreload" crossorigin href="./assets/grid-extension.svelte-G1ng0xd2.js">
19
- <link rel="modulepreload" crossorigin href="./assets/SvGrid.helpers-DHkH3mHW.js">
19
+ <link rel="modulepreload" crossorigin href="./assets/SvGrid.helpers-D0c-xJC6.js">
20
20
  <link rel="modulepreload" crossorigin href="./assets/editor-contract-Bpoa7A5g.js">
21
21
  <link rel="modulepreload" crossorigin href="./assets/date-format-B8JbEtIG.js">
22
22
  <link rel="modulepreload" crossorigin href="./assets/list-option-BP_dWS66.js">
@@ -30,12 +30,12 @@
30
30
  <link rel="modulepreload" crossorigin href="./assets/focus-trap-V2-6Fy9I.js">
31
31
  <link rel="modulepreload" crossorigin href="./assets/SvTabs-2mHC6oaz.js">
32
32
  <link rel="modulepreload" crossorigin href="./assets/SvMenuList-Dgq2D5VN.js">
33
- <link rel="modulepreload" crossorigin href="./assets/chart-trend-_gDVw3bP.js">
34
- <link rel="modulepreload" crossorigin href="./assets/chart-Bmu-KAet.js">
33
+ <link rel="modulepreload" crossorigin href="./assets/chart-trend-CWfxPKk7.js">
34
+ <link rel="modulepreload" crossorigin href="./assets/chart-SJcjQYZM.js">
35
35
  <link rel="modulepreload" crossorigin href="./assets/chart-export-Dqq_eHRq.js">
36
- <link rel="modulepreload" crossorigin href="./assets/SvGridChart-DzCeEdlb.js">
37
- <link rel="modulepreload" crossorigin href="./assets/chart-panel-messages-B3y8y3kL.js">
38
- <link rel="modulepreload" crossorigin href="./assets/SvGridChartPanel-Dj3IxTS2.js">
36
+ <link rel="modulepreload" crossorigin href="./assets/SvGridChart-BWFqs-48.js">
37
+ <link rel="modulepreload" crossorigin href="./assets/chart-panel-messages-CsNPT3N0.js">
38
+ <link rel="modulepreload" crossorigin href="./assets/SvGridChartPanel-CZUMJSNR.js">
39
39
  <link rel="modulepreload" crossorigin href="./assets/sparkline-C-NcnB2i.js">
40
40
  <link rel="modulepreload" crossorigin href="./assets/server-block-cache-CXJKkJpy.js">
41
41
  <link rel="stylesheet" crossorigin href="./assets/date-format-DKS-z0xS.css">
@@ -47,7 +47,7 @@
47
47
  <link rel="stylesheet" crossorigin href="./assets/SvMenuList-DJ47ba1h.css">
48
48
  <link rel="stylesheet" crossorigin href="./assets/SvGridChart-BgLuPO7I.css">
49
49
  <link rel="stylesheet" crossorigin href="./assets/SvGridChartPanel-4Pc8y5yO.css">
50
- <link rel="stylesheet" crossorigin href="./assets/index-BU3ieI05.css">
50
+ <link rel="stylesheet" crossorigin href="./assets/index-BsdMTCRO.css">
51
51
  </head>
52
52
  <body>
53
53
  <div id="app"></div>
package/dist/install.d.ts CHANGED
@@ -47,8 +47,9 @@ export type EnterpriseGridApi<TFeatures extends TableFeatures, TData extends Row
47
47
  /** Copy the grid (view / selection / all) to the clipboard in a native text
48
48
  * format (default `tsv`, pastes into Excel / Sheets as columns). */
49
49
  copyExport(opts?: ClipboardExportOptions<TData>): Promise<void>;
50
- /** Open a printable view of the current visible rows in a new window. */
51
- print(opts?: PrintOptions<TData>): Promise<void>;
50
+ /** Open a printable view of the current visible rows in a new window.
51
+ * Resolves to the printable HTML; `{ open: false }` only returns it. */
52
+ print(opts?: PrintOptions<TData>): Promise<string>;
52
53
  /** Read an Excel / CSV / TSV / JSON file (or inline text) into typed
53
54
  * rows. Caller decides whether to commit into the grid or preview
54
55
  * the parsed result first via the returned `ImportResult`. */
@@ -9165,7 +9165,7 @@ var GENERATED_UI_SURFACE = {
9165
9165
  "key": "overscan",
9166
9166
  "label": "Overscan",
9167
9167
  "type": "number",
9168
- "description": "Extra rows rendered above and below the viewport, so fast scrolling does not reach empty space before the next batch renders. Defaults to 8. Raise it for very tall rows, lower it to trim DOM work.",
9168
+ "description": "Extra rows rendered above and below the viewport, so fast scrolling does not reach empty space before the next batch renders. Defaults to 8. Raise it for very tall rows, lower it to trim DOM work. The first paint after mount carries at most 2 of them, so the rows on screen appear sooner; the rest are added in the frame after that paint.",
9169
9169
  "group": "common"
9170
9170
  },
9171
9171
  {
@@ -16514,7 +16514,7 @@ function hasFieldConditions(schema) {
16514
16514
  *
16515
16515
  * `version.test.ts` asserts this matches `package.json`, so the two cannot drift.
16516
16516
  */
16517
- var SVGRID_VERSION = "3.1.28";
16517
+ var SVGRID_VERSION = "3.1.30";
16518
16518
  /**
16519
16519
  * The version of `@svgrid/grid`, which releases on its own line: enterprise is
16520
16520
  * on 3.1.x while the grid is on 3.0.x.
@@ -16527,7 +16527,7 @@ var SVGRID_VERSION = "3.1.28";
16527
16527
  *
16528
16528
  * `version.test.ts` asserts this matches packages/grid/package.json.
16529
16529
  */
16530
- var GRID_VERSION = "3.0.25";
16530
+ var GRID_VERSION = "3.0.27";
16531
16531
  //#endregion
16532
16532
  //#region src/studio/emit-project.ts
16533
16533
  var has = (blocks, kind) => blocks.some((b) => b.config.kind === kind);
package/dist/pivot.js CHANGED
@@ -163,12 +163,46 @@ function collectColLeafPaths(node, into) {
163
163
  */
164
164
  function computeRowValues(sourceRows, colLeafPaths, colFields, values, includeGrandTotalCol) {
165
165
  const result = {};
166
- // For each col-axis leaf path, filter the source rows to those matching
167
- // every dim value, then run each measure aggregator.
166
+ // The rows under each col-axis path, bucketed in one pass per path length.
167
+ // Filtering the rows again for every column leaf was rows x leaves for each
168
+ // row node: a 100,000-row pivot over Year x Month spent ~3 s there. A
169
+ // bucket keeps the rows in source order, as the filter did, so order-
170
+ // dependent aggregators see the same sequence.
171
+ const byLength = new Map();
172
+ const rowsAt = (path) => {
173
+ let root = byLength.get(path.length);
174
+ if (!root) {
175
+ root = new Map();
176
+ for (const r of sourceRows) {
177
+ let node = root;
178
+ for (let i = 0; i < path.length - 1; i += 1) {
179
+ const v = r[colFields[i]];
180
+ let next = node.get(v);
181
+ if (!next)
182
+ node.set(v, (next = new Map()));
183
+ node = next;
184
+ }
185
+ const v = r[colFields[path.length - 1]];
186
+ const list = node.get(v);
187
+ if (list)
188
+ list.push(r);
189
+ else
190
+ node.set(v, [r]);
191
+ }
192
+ byLength.set(path.length, root);
193
+ }
194
+ let node = root;
195
+ for (const value of path) {
196
+ node = node.get(value);
197
+ if (node === undefined)
198
+ return [];
199
+ }
200
+ return node;
201
+ };
202
+ // For each col-axis leaf path, the source rows matching every dim value,
203
+ // then each measure aggregator over them.
168
204
  for (const colPath of colLeafPaths) {
169
- const matched = colPath.length === 0
170
- ? sourceRows
171
- : sourceRows.filter((r) => colPath.every((value, i) => r[colFields[i]] === value));
205
+ const matched = colPath.length === 0 ? sourceRows : rowsAt(colPath);
172
206
  for (let i = 0; i < values.length; i += 1) {
173
207
  const value = values[i];
174
208
  const fn = resolveAgg(value.agg);
package/dist/print.d.ts CHANGED
@@ -29,5 +29,11 @@ export type PrintOptions<TData> = {
29
29
  /** Conditional formatting rules (same array as `<SvGrid conditionalFormats>`);
30
30
  * carried into the print view as cell background / color / bold + icons. */
31
31
  conditionalFormats?: ReadonlyArray<ConditionalFormat<TData>>;
32
+ /** Open the print window and its dialog. Default true. `false` only builds
33
+ * the document and returns it, for a preview pane or a test. */
34
+ open?: boolean;
32
35
  };
33
- export declare function printGrid<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>, opts?: PrintOptions<TData>): Promise<void>;
36
+ /** Print the grid: builds a printable HTML document of its rows, opens it in a
37
+ * new window and calls the browser's print dialog. Resolves to that document,
38
+ * so `{ open: false }` gives a printable view without a window or a dialog. */
39
+ export declare function printGrid<TFeatures extends TableFeatures, TData extends RowData>(api: SvGridApi<TFeatures, TData>, opts?: PrintOptions<TData>): Promise<string>;
package/dist/print.js CHANGED
@@ -2,6 +2,9 @@ import { assertEnterpriseLicensed } from './license.js';
2
2
  import { buildLinkResolver, projectRows, resolveColumns, resolveRowSource, } from './export.js';
3
3
  import { buildPrintDocument } from './export-print.js';
4
4
  import { buildConditionalResolver } from './export-conditional.js';
5
+ /** Print the grid: builds a printable HTML document of its rows, opens it in a
6
+ * new window and calls the browser's print dialog. Resolves to that document,
7
+ * so `{ open: false }` gives a printable view without a window or a dialog. */
5
8
  export async function printGrid(api, opts) {
6
9
  assertEnterpriseLicensed('Print');
7
10
  if (typeof window === 'undefined') {
@@ -36,6 +39,8 @@ export async function printGrid(api, opts) {
36
39
  cellLink: link,
37
40
  opts: docOpts,
38
41
  });
42
+ if (opts?.open === false)
43
+ return html;
39
44
  const w = window.open('', '_blank', 'width=900,height=700');
40
45
  if (!w) {
41
46
  throw new Error('@svgrid/enterprise: print() could not open a window - the browser blocked the popup');
@@ -58,4 +63,5 @@ export async function printGrid(api, opts) {
58
63
  // ignore - the listener path will have fired
59
64
  }
60
65
  }, 300);
66
+ return html;
61
67
  }