@canvas-components/print-design-plugin 0.0.0-stage → 0.1.4

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 canvas-components contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,49 @@
1
- # Temporary Holding Version
1
+ # 打印设计插件包
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 同一个包提供两个代码入口和一个样式入口:
4
+
5
+ - `@canvas-components/print-design-plugin/native`:原生组件注册表,供 Canvas/HTML 打印端使用,不加载 React。
6
+ - `@canvas-components/print-design-plugin/react`:左侧菜单、元素创建、右侧属性与数据编辑配置;同时包含原生注册表,供 React 设计器使用。
7
+ - `@canvas-components/print-design-plugin/style.css`:React 插件的专用界面样式,使用设计器时由宿主显式导入。
8
+
9
+ ## 在 React 设计器中使用
10
+
11
+ 从包根导入样式;只导入 `/react` 不会自动加载插件面板样式。一个应用入口导入一次即可,独立打印服务只使用 `/native`,不需要 CSS。
12
+
13
+ ```tsx
14
+ import "@canvas-components/print-design-plugin/style.css";
15
+ import { ReactPrintDesign } from "@canvas-components/react-print-design";
16
+ import { builtinPrintDesignPlugins } from "@canvas-components/print-design-plugin/react";
17
+
18
+ export function PrintEditor() {
19
+ return (
20
+ <div style={{ height: 720 }}>
21
+ <ReactPrintDesign
22
+ componentRegistry={builtinPrintDesignPlugins.componentRegistry}
23
+ componentFactories={builtinPrintDesignPlugins.componentFactories}
24
+ componentMenu={builtinPrintDesignPlugins.componentMenu}
25
+ propertySections={builtinPrintDesignPlugins.propertySections}
26
+ contextMenus={builtinPrintDesignPlugins.contextMenus}
27
+ tools={builtinPrintDesignPlugins.tools}
28
+ pluginCatalog={builtinPrintDesignPlugins.pluginCatalog}
29
+ />
30
+ </div>
31
+ );
32
+ }
33
+ ```
34
+
35
+ 第三方组件通过 `registerPrintDesignPluginPackages` 与内置注册表合并,再将返回的同名字段传给设计器;独立打印端使用同版本的 `componentRegistry`。完整接入示例见[当前版本示例](../print-design/docs/plugins/v0.1.8/example.tsx)。
36
+
37
+ ## 插件编写指南
38
+
39
+ 按项目安装的 `@canvas-components/print-design` 版本选择指南,当前核心包为 `0.1.8`:
40
+
41
+ - [人工编写指南](../print-design/docs/plugins/v0.1.8/personal.md):组件模型、必选与可选方法、右侧属性、工具和宿主接入。
42
+ - [AI 编写指南](../print-design/docs/plugins/v0.1.8/ai.md):任务输入、实现顺序和交付检查。
43
+ - [可编译组件与工具示例](../print-design/docs/plugins/v0.1.8/example.tsx);其他版本见[指南索引](../print-design/docs/plugins/README.md)。
44
+
45
+ `src/plugins/` 下每种内置组件一个目录,例如 `text/`、`table/`、`pivot-table/`。每个目录的 `native.ts` 声明原生输出能力,`menu.ts` 声明左侧菜单入口和预设,`factory.ts` 创建默认元素,`properties.ts` 可声明右侧属性分组,`react.ts` 汇合创建器与编辑能力;包入口只负责汇总与注册。新增组件时先建独立目录,再将其加入两个入口的清单。
46
+
47
+ 组件实现按实际职责放入 `data/`、`layout/`、`rendering/`、`interaction/`,测试与实现同目录;无需的子目录可以省略。表格插件的具体划分见 [`src/plugins/table/README.md`](src/plugins/table/README.md),整体约定见[插件化计划](../../plan/2610241259-print-design-plugin-components.md)。
48
+
49
+ 组件专属的绘制、数据、分页和交互逻辑由本包各插件目录实现。`print-design` 核心只负责通用文档模型、分页、Canvas/HTML 调度和组件注册分发;核心默认组件注册表为空,未注册的组件会明确报错。复杂字段控件可复用 `react-print-design` 的通用能力。核心包不反向依赖本包或 React。