@svgrid/enterprise 1.1.0 → 1.2.0

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.
package/package.json CHANGED
@@ -1,72 +1,84 @@
1
- {
2
- "name": "@svgrid/enterprise",
3
- "version": "1.1.0",
4
- "description": "Pro feature pack for sv-grid: data export (Excel, PDF, CSV, TSV, HTML), import (xlsx, CSV, TSV, JSON), pivot table + designer, AI assistant (BYO model), and printing. Requires a paid license key.",
5
- "license": "SEE LICENSE IN LICENSE",
6
- "author": "jQWidgets <sales@jqwidgets.com>",
7
- "homepage": "https://svgrid.com/pricing",
8
- "type": "module",
9
- "exports": {
10
- ".": {
11
- "types": "./src/index.ts",
12
- "svelte": "./src/index.ts",
13
- "import": "./src/index.ts"
14
- },
15
- "./export": {
16
- "types": "./src/export.ts",
17
- "svelte": "./src/export.ts",
18
- "import": "./src/export.ts"
19
- },
20
- "./print": {
21
- "types": "./src/print.ts",
22
- "svelte": "./src/print.ts",
23
- "import": "./src/print.ts"
24
- },
25
- "./ai": {
26
- "types": "./src/ai.ts",
27
- "svelte": "./src/ai.ts",
28
- "import": "./src/ai.ts"
29
- },
30
- "./import": {
31
- "types": "./src/import.ts",
32
- "svelte": "./src/import.ts",
33
- "import": "./src/import.ts"
34
- },
35
- "./pivot": {
36
- "types": "./src/pivot.ts",
37
- "svelte": "./src/pivot.ts",
38
- "import": "./src/pivot.ts"
39
- },
40
- "./package.json": "./package.json"
41
- },
42
- "files": [
43
- "src",
44
- "README.md",
45
- "LICENSE"
46
- ],
47
- "scripts": {
48
- "test": "vitest run",
49
- "test:types": "tsc -p tsconfig.json --noEmit"
50
- },
51
- "peerDependencies": {
52
- "svelte": "^5.0.0",
53
- "@svgrid/grid": "workspace:*",
54
- "jszip": "^3.10.0",
55
- "pdfmake": "^0.2.0"
56
- },
57
- "peerDependenciesMeta": {
58
- "jszip": {
59
- "optional": true
60
- },
61
- "pdfmake": {
62
- "optional": true
63
- }
64
- },
65
- "devDependencies": {
66
- "jszip": "^3.10.1",
67
- "pdfmake": "^0.2.10",
68
- "svelte": "^5.55.5",
69
- "@svgrid/grid": "workspace:*",
70
- "typescript": "6.0.3"
71
- }
1
+ {
2
+ "name": "@svgrid/enterprise",
3
+ "version": "1.2.0",
4
+ "description": "Pro feature pack for sv-grid: data export (Excel, PDF, CSV, TSV, HTML), import (xlsx, CSV, TSV, JSON), pivot table + designer, AI assistant (BYO model), and printing. Requires a paid license key.",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "author": "jQWidgets <sales@jqwidgets.com>",
7
+ "homepage": "https://svgrid.com/pricing",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./src/index.ts",
12
+ "svelte": "./src/index.ts",
13
+ "import": "./src/index.ts"
14
+ },
15
+ "./export": {
16
+ "types": "./src/export.ts",
17
+ "svelte": "./src/export.ts",
18
+ "import": "./src/export.ts"
19
+ },
20
+ "./print": {
21
+ "types": "./src/print.ts",
22
+ "svelte": "./src/print.ts",
23
+ "import": "./src/print.ts"
24
+ },
25
+ "./ai": {
26
+ "types": "./src/ai.ts",
27
+ "svelte": "./src/ai.ts",
28
+ "import": "./src/ai.ts"
29
+ },
30
+ "./import": {
31
+ "types": "./src/import.ts",
32
+ "svelte": "./src/import.ts",
33
+ "import": "./src/import.ts"
34
+ },
35
+ "./pivot": {
36
+ "types": "./src/pivot.ts",
37
+ "svelte": "./src/pivot.ts",
38
+ "import": "./src/pivot.ts"
39
+ },
40
+ "./cdn/svelte-external": {
41
+ "import": "./dist/cdn/svgrid-enterprise.svelte-external.js",
42
+ "default": "./dist/cdn/svgrid-enterprise.svelte-external.js"
43
+ },
44
+ "./package.json": "./package.json"
45
+ },
46
+ "unpkg": "./dist/cdn/svgrid-enterprise.svelte-external.js",
47
+ "jsdelivr": "./dist/cdn/svgrid-enterprise.svelte-external.js",
48
+ "files": [
49
+ "src",
50
+ "dist",
51
+ "README.md",
52
+ "LICENSE"
53
+ ],
54
+ "scripts": {
55
+ "test": "vitest run",
56
+ "test:types": "tsc -p tsconfig.json --noEmit",
57
+ "build": "node ./scripts/build-cdn.mjs",
58
+ "build:cdn": "node ./scripts/build-cdn.mjs",
59
+ "prepublishOnly": "node ./scripts/build-cdn.mjs"
60
+ },
61
+ "peerDependencies": {
62
+ "svelte": "^5.0.0",
63
+ "@svgrid/grid": "workspace:*",
64
+ "jszip": "^3.10.0",
65
+ "pdfmake": "^0.2.0"
66
+ },
67
+ "peerDependenciesMeta": {
68
+ "jszip": {
69
+ "optional": true
70
+ },
71
+ "pdfmake": {
72
+ "optional": true
73
+ }
74
+ },
75
+ "devDependencies": {
76
+ "@sveltejs/vite-plugin-svelte": "^7.0.0",
77
+ "jszip": "^3.10.1",
78
+ "pdfmake": "^0.2.10",
79
+ "svelte": "^5.55.5",
80
+ "@svgrid/grid": "workspace:*",
81
+ "typescript": "6.0.3",
82
+ "vite": "^8.0.10"
83
+ }
72
84
  }
package/src/export.ts CHANGED
@@ -126,6 +126,30 @@ export type ExportOptions<TData> = {
126
126
  * Mutually exclusive with `groupBy`. xlsx only.
127
127
  */
128
128
  hierarchical?: boolean
129
+ /**
130
+ * Merged cells to write into the sheet (xlsx / pdf). Each entry spans
131
+ * `colSpan` columns and `rowSpan` rows starting at the given zero-based
132
+ * **body** row / column index (the header row is not counted). Mirrors the
133
+ * grid's own `MergeSpec` shape closely, so grid merges map straight through -
134
+ * convert a `MergeSpec` (`{ rowIndex, columnId, rowspan, colspan }`) by
135
+ * resolving `columnId` to its column index. Mutually exclusive with
136
+ * `groupBy` / `hierarchical`.
137
+ */
138
+ merges?: ReadonlyArray<ExportMerge>
139
+ }
140
+
141
+ /**
142
+ * A merged cell region for {@link ExportOptions.merges}. `row` / `col` are
143
+ * zero-based indices into the exported body (header excluded). A cell that
144
+ * spans two columns to the right is `{ row, col, colSpan: 2 }`.
145
+ */
146
+ export type ExportMerge = {
147
+ row: number
148
+ col: number
149
+ /** Columns to span (default 1). */
150
+ colSpan?: number
151
+ /** Rows to span (default 1). */
152
+ rowSpan?: number
129
153
  }
130
154
 
131
155
  let exporterCtorPromise: Promise<
@@ -398,6 +422,19 @@ function buildExporterOptions<TData>(
398
422
  // hierarchical through here and groupBy through the constructor call
399
423
  // site in exportGrid.
400
424
  if (opts.hierarchical) out.hierarchical = true
425
+ // Merged cells: translate the friendly {row, col, rowSpan, colSpan} shape to
426
+ // Smart's native {cell: [row, col], rowspan, colspan}. Skip 1x1 "merges"
427
+ // (nothing to span). Ignored when grouping/hierarchy owns the row layout.
428
+ if (opts.merges?.length && !opts.groupBy?.length && !opts.hierarchical) {
429
+ const mergedCells = opts.merges
430
+ .map((m) => ({
431
+ cell: [m.row, m.col],
432
+ rowspan: Math.max(1, Math.floor(m.rowSpan ?? 1)),
433
+ colspan: Math.max(1, Math.floor(m.colSpan ?? 1)),
434
+ }))
435
+ .filter((m) => m.rowspan > 1 || m.colspan > 1)
436
+ if (mergedCells.length) out.mergedCells = mergedCells
437
+ }
401
438
  return out
402
439
  }
403
440
 
package/src/pivot.ts CHANGED
@@ -238,7 +238,7 @@ function buildColumnTree<TFeatures extends TableFeatures>(
238
238
  const headerCol: ColumnDef<TFeatures, PivotRow> = {
239
239
  id: '__pivotRowHeader',
240
240
  header: rowHeaderLabel,
241
- accessorFn: (row) => row.__pivotLabel,
241
+ fieldFn: (row) => row.__pivotLabel,
242
242
  width: 240,
243
243
  }
244
244
 
@@ -252,7 +252,7 @@ function buildColumnTree<TFeatures extends TableFeatures>(
252
252
  return {
253
253
  id,
254
254
  header: label,
255
- accessorFn: (row) => row[id],
255
+ fieldFn: (row) => row[id],
256
256
  format: value.format,
257
257
  width: 130,
258
258
  } as ColumnDef<TFeatures, PivotRow>
@@ -283,7 +283,7 @@ function buildColumnTree<TFeatures extends TableFeatures>(
283
283
  return {
284
284
  id,
285
285
  header: label,
286
- accessorFn: (row) => row[id],
286
+ fieldFn: (row) => row[id],
287
287
  format: value.format,
288
288
  width: 140,
289
289
  } as ColumnDef<TFeatures, PivotRow>