@svgrid/enterprise 3.1.1 → 3.1.3
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/dist/SvSheet.svelte +7 -1
- package/dist/cdn/svgrid-enterprise.svelte-external.js +10535 -10333
- package/dist/designer/assets/{index-DkhD2kIe.js → index-CScGnzuX.js} +312 -312
- package/dist/designer/assets/{src-Mu7AGqT8.js → src-DL33yzkY.js} +3 -3
- package/dist/designer/assets/validate-YxSrBF1H.js +1 -0
- package/dist/designer/index.html +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/license.js +2 -2
- package/dist/node/studio.js +16 -4
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/server-row-model.d.ts +9 -0
- package/dist/server/server-row-model.js +120 -3
- package/dist/server/worker-data-source.d.ts +62 -0
- package/dist/server/worker-data-source.js +133 -0
- package/dist/studio/emit-project.js +8 -3
- package/dist/sveltekit/in-memory.d.ts +21 -1
- package/dist/sveltekit/in-memory.js +153 -105
- package/dist/sveltekit/index.d.ts +1 -1
- package/dist/version.d.ts +14 -1
- package/dist/version.js +14 -1
- package/dist/watermark.js +6 -3
- package/dist/wc/sv-sheet-element.js +18 -13
- package/dist/wc/{validate-BqDthkNr.js → validate-JAuMsk6Z.js} +36 -36
- package/dist/worker/columnar.d.ts +42 -0
- package/dist/worker/columnar.js +410 -0
- package/dist/worker/index.d.ts +12 -0
- package/dist/worker/index.js +12 -0
- package/dist/worker/infer-schema.d.ts +21 -0
- package/dist/worker/infer-schema.js +34 -0
- package/dist/worker/protocol.d.ts +73 -0
- package/dist/worker/protocol.js +14 -0
- package/dist/worker/serve.d.ts +44 -0
- package/dist/worker/serve.js +100 -0
- package/package.json +7 -3
- package/dist/designer/assets/validate-C3B8QKsM.js +0 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { createColumnarDataSource } from './columnar.js';
|
|
2
|
+
import { inferSchemaFromRows } from './infer-schema.js';
|
|
3
|
+
import { CHANNEL, isChannelMessage, toWorkerError, } from './protocol.js';
|
|
4
|
+
export function serveWorkerDataSource(options = {}) {
|
|
5
|
+
const scope = options.scope ?? globalThis;
|
|
6
|
+
let source = null;
|
|
7
|
+
let disposed = false;
|
|
8
|
+
const queue = [];
|
|
9
|
+
let scheduled = false;
|
|
10
|
+
// Whether a column is still waiting to be indexed in idle time.
|
|
11
|
+
let warming = false;
|
|
12
|
+
const post = (message) => {
|
|
13
|
+
if (!disposed)
|
|
14
|
+
scope.postMessage(message);
|
|
15
|
+
};
|
|
16
|
+
function install(rows, schema, idField) {
|
|
17
|
+
const resolved = schema ??
|
|
18
|
+
options.schema ??
|
|
19
|
+
inferSchemaFromRows(rows, { idField: idField ?? options.idField });
|
|
20
|
+
source = createColumnarDataSource(rows, resolved);
|
|
21
|
+
warming = true;
|
|
22
|
+
post({ channel: CHANNEL, kind: 'ready', rowCount: rows.length });
|
|
23
|
+
schedule();
|
|
24
|
+
}
|
|
25
|
+
function schedule() {
|
|
26
|
+
if (scheduled || disposed || !source || (queue.length === 0 && !warming))
|
|
27
|
+
return;
|
|
28
|
+
scheduled = true;
|
|
29
|
+
setTimeout(drain, 0);
|
|
30
|
+
}
|
|
31
|
+
async function drain() {
|
|
32
|
+
scheduled = false;
|
|
33
|
+
if (!source || disposed)
|
|
34
|
+
return;
|
|
35
|
+
const call = queue.shift();
|
|
36
|
+
if (!call) {
|
|
37
|
+
// Idle: index one more column, then look at the queue again.
|
|
38
|
+
warming = source.warm();
|
|
39
|
+
schedule();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const method = source[call.method];
|
|
44
|
+
const value = await method(...call.args);
|
|
45
|
+
post({ channel: CHANNEL, kind: 'result', id: call.id, ok: true, value });
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
post({ channel: CHANNEL, kind: 'result', id: call.id, ok: false, error: toWorkerError(error) });
|
|
49
|
+
}
|
|
50
|
+
// A write drops the columns; index them again once the queue is empty.
|
|
51
|
+
if (call.method !== 'getRows' && call.method !== 'getAggregate')
|
|
52
|
+
warming = true;
|
|
53
|
+
schedule();
|
|
54
|
+
}
|
|
55
|
+
function onMessage(event) {
|
|
56
|
+
const message = event.data;
|
|
57
|
+
if (disposed || !isChannelMessage(message))
|
|
58
|
+
return;
|
|
59
|
+
switch (message.kind) {
|
|
60
|
+
case 'load':
|
|
61
|
+
try {
|
|
62
|
+
install(message.rows, message.schema, message.idField);
|
|
63
|
+
post({ channel: CHANNEL, kind: 'result', id: message.id, ok: true, value: message.rows.length });
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
post({ channel: CHANNEL, kind: 'result', id: message.id, ok: false, error: toWorkerError(error) });
|
|
67
|
+
}
|
|
68
|
+
break;
|
|
69
|
+
case 'call':
|
|
70
|
+
queue.push({ id: message.id, method: message.method, args: message.args });
|
|
71
|
+
schedule();
|
|
72
|
+
break;
|
|
73
|
+
case 'cancel': {
|
|
74
|
+
// No reply: the client rejected the call when it sent this.
|
|
75
|
+
const at = queue.findIndex((c) => c.id === message.id);
|
|
76
|
+
if (at >= 0)
|
|
77
|
+
queue.splice(at, 1);
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
scope.addEventListener('message', onMessage);
|
|
83
|
+
scope.start?.();
|
|
84
|
+
if (options.rows !== undefined) {
|
|
85
|
+
const rows = options.rows;
|
|
86
|
+
Promise.resolve()
|
|
87
|
+
.then(() => (typeof rows === 'function' ? rows() : rows))
|
|
88
|
+
.then((loaded) => {
|
|
89
|
+
if (!disposed)
|
|
90
|
+
install(loaded);
|
|
91
|
+
}, (error) => post({ channel: CHANNEL, kind: 'failed', error: toWorkerError(error) }));
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
dispose() {
|
|
95
|
+
disposed = true;
|
|
96
|
+
queue.length = 0;
|
|
97
|
+
scope.removeEventListener('message', onMessage);
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "commercial",
|
|
5
5
|
"url": "https://svgrid.com/pricing"
|
|
6
6
|
},
|
|
7
|
-
"version": "3.1.
|
|
7
|
+
"version": "3.1.3",
|
|
8
8
|
"description": "Enterprise feature pack for SvGrid: the server-side row model (lazy grouping, tree, pivot, transactions, selection across unloaded rows), Excel (xlsx) and PDF export, Excel/CSV/JSON import, pivot tables with a drag-and-drop designer, paginated print, Kanban board and scheduler renderers, no-code alerts and batch editing. CSV, TSV and JSON export are already free in @svgrid/grid. Requires a paid license key.",
|
|
9
9
|
"license": "SEE LICENSE IN LICENSE",
|
|
10
10
|
"author": "jQWidgets <sales@jqwidgets.com>",
|
|
@@ -57,6 +57,10 @@
|
|
|
57
57
|
"svelte": "./dist/server/index.js",
|
|
58
58
|
"import": "./dist/server/index.js"
|
|
59
59
|
},
|
|
60
|
+
"./worker": {
|
|
61
|
+
"types": "./dist/worker/index.d.ts",
|
|
62
|
+
"import": "./dist/worker/index.js"
|
|
63
|
+
},
|
|
60
64
|
"./license": {
|
|
61
65
|
"types": "./dist/license.d.ts",
|
|
62
66
|
"svelte": "./dist/license.js",
|
|
@@ -101,7 +105,7 @@
|
|
|
101
105
|
"jszip": "^3.10.0",
|
|
102
106
|
"pdfmake": "^0.2.0",
|
|
103
107
|
"svelte": "^5.0.0",
|
|
104
|
-
"@svgrid/grid": "^3.0.
|
|
108
|
+
"@svgrid/grid": "^3.0.8"
|
|
105
109
|
},
|
|
106
110
|
"peerDependenciesMeta": {
|
|
107
111
|
"jszip": {
|
|
@@ -119,7 +123,7 @@
|
|
|
119
123
|
"svelte": "^5.55.5",
|
|
120
124
|
"typescript": "6.0.3",
|
|
121
125
|
"vite": "^8.2.1",
|
|
122
|
-
"@svgrid/grid": "^3.0.
|
|
126
|
+
"@svgrid/grid": "^3.0.8"
|
|
123
127
|
},
|
|
124
128
|
"repository": {
|
|
125
129
|
"type": "git",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./server-block-cache-CXJKkJpy.js";var t=10,n=`https://svgrid.com/docs/getting-started/3-data-and-columns/`;function r(e,t=[]){for(let n of e)n.columns?.length?r(n.columns,t):t.push(n);return t}function i(i){let o=[],s=r(i.columns??[]),c=[];for(let n of i.data??[]){if(c.length>=t)break;e(n)||c.push(n)}if(c.length&&!i.serverGroup){let e=new Set;for(let t of c)if(t&&typeof t==`object`)for(let n of Object.keys(t))e.add(n);for(let t of s){let r=t.field;if(!r||t.fieldFn||e.has(r))continue;let i=a(r,[...e]);o.push(`[svgrid] Column field "${r}" does not exist on your row data, so that column renders empty.${i?` Did you mean "${i}"?`:``} Available keys: ${[...e].slice(0,12).join(`, `)}. See ${n}`)}}let l=new Map;for(let e of s){let t=e.id??e.field;t&&l.set(t,(l.get(t)??0)+1)}for(let[e,t]of l)t>1&&o.push(`[svgrid] ${t} columns share the id "${e}". Column state (sorting, filtering, pinning, width) is keyed by id, so they will act as one. Give each an explicit \`id\`. See ${n}`);let u=i.pageable===void 0&&i.showPagination===void 0;i.pageSize!==void 0&&u&&o.push("[svgrid] `pageSize` is set but pagination was never turned on, so it has no effect and every row renders. Add `pageable` to switch the pager on."),!(i.sortable===!0||i.features?.rowSortingFeature)&&s.some(e=>e.sortable===!0)&&o.push("[svgrid] A column sets `sortable: true`, but sorting is not enabled on the grid, so its header does nothing. Add `sortable` to <SvGrid> (it registers the sorting feature for you).");let d=new Set;for(let e of s){let t=e.id??e.field;t&&d.add(t)}for(let e of i.groupBy??[]){if(d.has(e))continue;let t=a(e,[...d]);o.push(`[svgrid] \`groupBy\` refers to column "${e}", which does not exist, so that grouping level is ignored.${t?` Did you mean "${t}"?`:``} Column ids: ${[...d].slice(0,12).join(`, `)}`)}let f=i.treeData?.column;if(f&&!d.has(f)&&o.push(`[svgrid] \`treeData.column\` refers to column "${f}", which does not exist, so the expander falls back to the first visible column.`),c.length&&i.treeData){let e=new Set;for(let t of c)if(t&&typeof t==`object`)for(let n of Object.keys(t))e.add(n);let t=i.treeData.parentField;if(t&&!e.has(t)){let n=a(t,[...e]);o.push(`[svgrid] \`treeData.parentField\` is "${t}", which is not on your row data, so every row becomes a root and no hierarchy appears.${n?` Did you mean "${n}"?`:``}`)}let n=i.treeData.idField;n&&!e.has(n)&&o.push(`[svgrid] \`treeData.idField\` is "${n}", which is not on your row data, so parent lookups cannot match and the tree stays flat.`)}return i.gantt&&i.treeData&&o.push("[svgrid] `gantt` and `treeData` are both set. The Gantt builds its own work-breakdown tree from `gantt.parentField` and needs every descendant row, but `treeData` hides collapsed children from the view, so summary bars will under-report. Remove `treeData` and set `gantt.parentField` instead."),(i.initialColumnPinning?.left?.length??0)+(i.initialColumnPinning?.right?.length??0)>0&&i.columnVirtualization!==!1&&o.push("[svgrid] `initialColumnPinning` is set while column virtualization is on (its default), so the pinned columns will not stick - the virtualizer recycles column nodes. Add `columnVirtualization={false}`."),i.externalPagination===!0&&i.rowCount===void 0&&o.push("[svgrid] `externalPagination` is on but `rowCount` is not set, so the pager cannot know how many pages exist. Pass the server total as `rowCount`."),i.externalSort===!0&&!i.onSortingChange&&o.push("[svgrid] `externalSort` is on but there is no `onSortingChange` handler, so clicking a header changes nothing - the grid stopped sorting and nobody is listening. Add `onSortingChange` and re-fetch in your handler."),i.externalFilter===!0&&!i.onFiltersChange&&o.push("[svgrid] `externalFilter` is on but there is no `onFiltersChange` handler, so filtering the grid changes nothing. Add `onFiltersChange` and re-fetch in your handler."),o}function a(e,t){let n,r=1/0;for(let i of t){let t=o(e.toLowerCase(),i.toLowerCase());t<r&&(r=t,n=i)}let i=Math.min(3,Math.floor(e.length/3)+1);return r<=i?n:void 0}function o(e,t){if(e===t)return 0;let n=Array(t.length+1);for(let e=0;e<=t.length;e++)n[e]=e;for(let r=1;r<=e.length;r++){let i=n[0];n[0]=r;for(let a=1;a<=t.length;a++){let o=Math.min(n[a]+1,n[a-1]+1,i+(e[r-1]===t[a-1]?0:1));i=n[a],n[a]=o}}return n[t.length]}export{i as validateGridConfig};
|