@agile-team/mach-table 0.23.0 → 0.24.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/README.md +18 -110
- package/dist/adapter.cjs +1 -0
- package/dist/adapter.d.cts +384 -0
- package/dist/adapter.d.ts +384 -0
- package/dist/adapter.js +1 -0
- package/dist/configuration-BQ5WYIdm.d.cts +57 -0
- package/dist/configuration-CIdNt43y.d.ts +57 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +10 -1494
- package/dist/index.d.ts +10 -1494
- package/dist/index.js +5 -5
- package/dist/{worker-DsFc5zec.d.cts → options-CnUx414l.d.cts} +975 -1088
- package/dist/{worker-DsFc5zec.d.ts → options-CnUx414l.d.ts} +975 -1088
- package/dist/worker.d.cts +47 -1
- package/dist/worker.d.ts +47 -1
- package/package.json +12 -2
package/dist/worker.d.cts
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
import { ai as GridDataProcessorRequest, ag as GridDataProcessor, aj as GridDataProcessorResult } from './options-CnUx414l.cjs';
|
|
2
|
+
export { ah as GridDataProcessorColumn, ak as GridDataProcessorRow } from './options-CnUx414l.cjs';
|
|
3
|
+
|
|
4
|
+
type GridDataProcessorPayload<TData = any> = Omit<GridDataProcessorRequest<TData>, "signal">;
|
|
5
|
+
interface GridWorkerProcessMessage<TData = any> {
|
|
6
|
+
type: "mach-table:process";
|
|
7
|
+
requestId: number;
|
|
8
|
+
payload: GridDataProcessorPayload<TData>;
|
|
9
|
+
}
|
|
10
|
+
interface GridWorkerCancelMessage {
|
|
11
|
+
type: "mach-table:cancel";
|
|
12
|
+
requestId: number;
|
|
13
|
+
}
|
|
14
|
+
type GridWorkerRequestMessage<TData = any> = GridWorkerProcessMessage<TData> | GridWorkerCancelMessage;
|
|
15
|
+
type GridWorkerResponseMessage = {
|
|
16
|
+
type: "mach-table:result";
|
|
17
|
+
requestId: number;
|
|
18
|
+
rowIds: readonly string[];
|
|
19
|
+
} | {
|
|
20
|
+
type: "mach-table:error";
|
|
21
|
+
requestId: number;
|
|
22
|
+
message: string;
|
|
23
|
+
};
|
|
24
|
+
interface WorkerDataProcessorOptions {
|
|
25
|
+
/** Terminate the lazily-created worker when the grid is destroyed. Defaults to true. */
|
|
26
|
+
terminateOnDestroy?: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface FieldDataProcessorOptions {
|
|
29
|
+
/** Cooperative cancellation/yield granularity. Defaults to 2,000 rows. */
|
|
30
|
+
yieldEvery?: number;
|
|
31
|
+
isCancelled?: () => boolean;
|
|
32
|
+
}
|
|
33
|
+
/** Built-in serializable field-path processor intended to run inside an application Worker. */
|
|
34
|
+
declare function processFieldDataRequest<TData = any>(request: GridDataProcessorPayload<TData>, options?: FieldDataProcessorOptions): Promise<GridDataProcessorResult>;
|
|
35
|
+
interface GridDataWorkerScope {
|
|
36
|
+
addEventListener(type: "message", listener: (event: MessageEvent<GridWorkerRequestMessage>) => void): void;
|
|
37
|
+
postMessage(message: GridWorkerResponseMessage): void;
|
|
38
|
+
}
|
|
39
|
+
/** Installs the standard field-path protocol in a dedicated Worker module. */
|
|
40
|
+
declare function installGridDataWorker(scope: GridDataWorkerScope): void;
|
|
41
|
+
/**
|
|
42
|
+
* Adapts a dedicated Web Worker to GridDataProcessor without Blob URLs or eval.
|
|
43
|
+
* The host controls the worker URL, keeping CSP and bundler behavior explicit.
|
|
44
|
+
*/
|
|
45
|
+
declare function createWorkerDataProcessor<TData = any>(createWorker: () => Worker, options?: WorkerDataProcessorOptions): GridDataProcessor<TData>;
|
|
46
|
+
|
|
47
|
+
export { type FieldDataProcessorOptions, GridDataProcessor, type GridDataProcessorPayload, GridDataProcessorRequest, GridDataProcessorResult, type GridDataWorkerScope, type GridWorkerCancelMessage, type GridWorkerProcessMessage, type GridWorkerRequestMessage, type GridWorkerResponseMessage, type WorkerDataProcessorOptions, createWorkerDataProcessor, installGridDataWorker, processFieldDataRequest };
|
package/dist/worker.d.ts
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
import { ai as GridDataProcessorRequest, ag as GridDataProcessor, aj as GridDataProcessorResult } from './options-CnUx414l.js';
|
|
2
|
+
export { ah as GridDataProcessorColumn, ak as GridDataProcessorRow } from './options-CnUx414l.js';
|
|
3
|
+
|
|
4
|
+
type GridDataProcessorPayload<TData = any> = Omit<GridDataProcessorRequest<TData>, "signal">;
|
|
5
|
+
interface GridWorkerProcessMessage<TData = any> {
|
|
6
|
+
type: "mach-table:process";
|
|
7
|
+
requestId: number;
|
|
8
|
+
payload: GridDataProcessorPayload<TData>;
|
|
9
|
+
}
|
|
10
|
+
interface GridWorkerCancelMessage {
|
|
11
|
+
type: "mach-table:cancel";
|
|
12
|
+
requestId: number;
|
|
13
|
+
}
|
|
14
|
+
type GridWorkerRequestMessage<TData = any> = GridWorkerProcessMessage<TData> | GridWorkerCancelMessage;
|
|
15
|
+
type GridWorkerResponseMessage = {
|
|
16
|
+
type: "mach-table:result";
|
|
17
|
+
requestId: number;
|
|
18
|
+
rowIds: readonly string[];
|
|
19
|
+
} | {
|
|
20
|
+
type: "mach-table:error";
|
|
21
|
+
requestId: number;
|
|
22
|
+
message: string;
|
|
23
|
+
};
|
|
24
|
+
interface WorkerDataProcessorOptions {
|
|
25
|
+
/** Terminate the lazily-created worker when the grid is destroyed. Defaults to true. */
|
|
26
|
+
terminateOnDestroy?: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface FieldDataProcessorOptions {
|
|
29
|
+
/** Cooperative cancellation/yield granularity. Defaults to 2,000 rows. */
|
|
30
|
+
yieldEvery?: number;
|
|
31
|
+
isCancelled?: () => boolean;
|
|
32
|
+
}
|
|
33
|
+
/** Built-in serializable field-path processor intended to run inside an application Worker. */
|
|
34
|
+
declare function processFieldDataRequest<TData = any>(request: GridDataProcessorPayload<TData>, options?: FieldDataProcessorOptions): Promise<GridDataProcessorResult>;
|
|
35
|
+
interface GridDataWorkerScope {
|
|
36
|
+
addEventListener(type: "message", listener: (event: MessageEvent<GridWorkerRequestMessage>) => void): void;
|
|
37
|
+
postMessage(message: GridWorkerResponseMessage): void;
|
|
38
|
+
}
|
|
39
|
+
/** Installs the standard field-path protocol in a dedicated Worker module. */
|
|
40
|
+
declare function installGridDataWorker(scope: GridDataWorkerScope): void;
|
|
41
|
+
/**
|
|
42
|
+
* Adapts a dedicated Web Worker to GridDataProcessor without Blob URLs or eval.
|
|
43
|
+
* The host controls the worker URL, keeping CSP and bundler behavior explicit.
|
|
44
|
+
*/
|
|
45
|
+
declare function createWorkerDataProcessor<TData = any>(createWorker: () => Worker, options?: WorkerDataProcessorOptions): GridDataProcessor<TData>;
|
|
46
|
+
|
|
47
|
+
export { type FieldDataProcessorOptions, GridDataProcessor, type GridDataProcessorPayload, GridDataProcessorRequest, GridDataProcessorResult, type GridDataWorkerScope, type GridWorkerCancelMessage, type GridWorkerProcessMessage, type GridWorkerRequestMessage, type GridWorkerResponseMessage, type WorkerDataProcessorOptions, createWorkerDataProcessor, installGridDataWorker, processFieldDataRequest };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agile-team/mach-table",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Enterprise-grade, framework-agnostic TypeScript data grid with virtualization, editing, grouping and extensibility",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-grid",
|
|
@@ -43,6 +43,16 @@
|
|
|
43
43
|
"default": "./dist/index.cjs"
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
+
"./adapter": {
|
|
47
|
+
"import": {
|
|
48
|
+
"types": "./dist/adapter.d.ts",
|
|
49
|
+
"default": "./dist/adapter.js"
|
|
50
|
+
},
|
|
51
|
+
"require": {
|
|
52
|
+
"types": "./dist/adapter.d.cts",
|
|
53
|
+
"default": "./dist/adapter.cjs"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
46
56
|
"./worker": {
|
|
47
57
|
"import": {
|
|
48
58
|
"types": "./dist/worker.d.ts",
|
|
@@ -71,5 +81,5 @@
|
|
|
71
81
|
"test": "vitest run",
|
|
72
82
|
"test:coverage": "vitest run --coverage"
|
|
73
83
|
},
|
|
74
|
-
"readme": "<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ChenyCHENYU/MachTable/main/assets/mach-table-logo.svg\" alt=\"MachTable\" width=\"760\" />\n</p>\n\n# @agile-team/mach-table\n\
|
|
84
|
+
"readme": "<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ChenyCHENYU/MachTable/main/assets/mach-table-logo.svg\" alt=\"MachTable\" width=\"760\" />\n</p>\n\n# @agile-team/mach-table\n\nMachTable 0.24 的框架无关 TypeScript Core:零运行时依赖,提供行列双虚拟化、领域化 API、单元格/整行编辑、树与分组、随机访问远程数据、状态持久化和可诊断扩展系统。\n\n```bash\npnpm add @agile-team/mach-table\n```\n\n```ts\nimport { createGrid } from \"@agile-team/mach-table\";\nimport \"@agile-team/mach-table/styles/mach-table.css\";\n\nconst api = createGrid(document.querySelector(\"#grid\")!, {\n columnDefs: [\n { field: \"id\", headerName: \"ID\", width: 120 },\n { field: \"name\", headerName: \"名称\", flex: 1, editable: true }\n ],\n rowData: [{ id: \"1\", name: \"MachTable\" }],\n rowKey: \"id\",\n enableColumnResize: true,\n persistence: { key: \"tenant:user:customers\", sections: [\"columns\"] }\n});\n\napi.batch((grid) => {\n grid.rows.transact({ update: [{ id: \"1\", name: \"Updated\" }] });\n grid.columns.setVisible(\"internalNote\", false);\n grid.view.refreshCells({ rowIds: [\"1\"] });\n});\n\nconst saved = await api.editing.save(orderApi.saveChanges);\nconsole.table(saved.conflicts);\nconsole.info(api.diagnostics.get());\n\n// 原生宿主卸载时必须销毁;Vue/React 适配器会自动处理。\napi.destroy();\n```\n\n公共命令按 `rows`、`columns`、`selection`、`editing`、`filtering`、`sorting`、`pagination`、`hierarchy`、`view`、`state`、`io`、`diagnostics` 划分。完整签名见 [GridApi](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/api/grid-api.md)。\n\n大型本地数据 Worker 使用独立入口:\n\n```ts\nimport { createWorkerDataProcessor } from \"@agile-team/mach-table/worker\";\n```\n\nVue/React 项目请只安装对应适配包,它会自动安装并重导出 Core:\n\n- [@agile-team/mach-table-vue](https://www.npmjs.com/package/@agile-team/mach-table-vue)\n- [@agile-team/mach-table-react](https://www.npmjs.com/package/@agile-team/mach-table-react)\n\n文档:[快速开始](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/getting-started.md) · [企业接入](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/enterprise-integration.md) · [API](https://github.com/ChenyCHENYU/MachTable/tree/main/docs/api)\n\nSource-available © ChenyCHENYU (Agile Team). 任何使用均须事先取得书面授权。详见 [LICENSE](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSE) 与[授权流程](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSING.md)。\n"
|
|
75
85
|
}
|