@canvas-components/react-print-design 0.1.1 → 0.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/README.md +11 -1
- package/dist/index.cjs +1483 -304
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +1485 -306
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { CSSProperties } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { PrintDesignDocument, PrintDesignOptions, PrintDesignSelection, PrintDesign } from '@canvas-components/print-design';
|
|
4
|
+
|
|
5
|
+
/** 按需读取预览所需的完整文档与数据,设计阶段可只传入样本。 */
|
|
6
|
+
type PrintPreviewDataLoader = (document: PrintDesignDocument, options: {
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
onProgress?: (completed: number, total: number) => void;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
document: PrintDesignDocument;
|
|
11
|
+
data: Record<string, unknown>;
|
|
12
|
+
}>;
|
|
4
13
|
|
|
5
14
|
/** React 打印设计器属性。传入 document 时可使用受控文档模式。 */
|
|
6
15
|
interface ReactPrintDesignProps extends Omit<PrintDesignOptions, "onChange" | "onSelectionChange" | "onActivePageChange"> {
|
|
@@ -18,6 +27,8 @@ interface ReactPrintDesignProps extends Omit<PrintDesignOptions, "onChange" | "o
|
|
|
18
27
|
storeKey?: string;
|
|
19
28
|
/** 传入数据的结构标识;变更后旧模板版本标记为失效。 */
|
|
20
29
|
dataFormatKey?: string;
|
|
30
|
+
/** 点击预览或输出时异步读取完整数据,设计阶段只需传入样本。 */
|
|
31
|
+
loadPreviewData?: PrintPreviewDataLoader;
|
|
21
32
|
/** 不可删除的内置模板;未传入时使用初始 document。 */
|
|
22
33
|
defaultTemplates?: readonly PrintDesignDocument[];
|
|
23
34
|
/** 弹窗关闭操作,传入时在工具栏右侧显示关闭按钮。 */
|
|
@@ -56,4 +67,4 @@ declare function isPrintDesignDocumentCompatible(document: PrintDesignDocument,
|
|
|
56
67
|
/** 当前输入与保存版本的数据格式不一致时判定为失效。 */
|
|
57
68
|
declare function isPrintDesignTemplateInvalid(version: PrintDesignTemplateVersion, dataFormat?: string, data?: Record<string, unknown>): boolean;
|
|
58
69
|
|
|
59
|
-
export { type PrintDesignTemplateVersion, ReactPrintDesign, type ReactPrintDesignProps, getPrintDesignDataFormat, isPrintDesignDocumentCompatible, isPrintDesignTemplateInvalid, readPrintDesignTemplates };
|
|
70
|
+
export { type PrintDesignTemplateVersion, type PrintPreviewDataLoader, ReactPrintDesign, type ReactPrintDesignProps, getPrintDesignDataFormat, isPrintDesignDocumentCompatible, isPrintDesignTemplateInvalid, readPrintDesignTemplates };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { CSSProperties } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { PrintDesignDocument, PrintDesignOptions, PrintDesignSelection, PrintDesign } from '@canvas-components/print-design';
|
|
4
|
+
|
|
5
|
+
/** 按需读取预览所需的完整文档与数据,设计阶段可只传入样本。 */
|
|
6
|
+
type PrintPreviewDataLoader = (document: PrintDesignDocument, options: {
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
onProgress?: (completed: number, total: number) => void;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
document: PrintDesignDocument;
|
|
11
|
+
data: Record<string, unknown>;
|
|
12
|
+
}>;
|
|
4
13
|
|
|
5
14
|
/** React 打印设计器属性。传入 document 时可使用受控文档模式。 */
|
|
6
15
|
interface ReactPrintDesignProps extends Omit<PrintDesignOptions, "onChange" | "onSelectionChange" | "onActivePageChange"> {
|
|
@@ -18,6 +27,8 @@ interface ReactPrintDesignProps extends Omit<PrintDesignOptions, "onChange" | "o
|
|
|
18
27
|
storeKey?: string;
|
|
19
28
|
/** 传入数据的结构标识;变更后旧模板版本标记为失效。 */
|
|
20
29
|
dataFormatKey?: string;
|
|
30
|
+
/** 点击预览或输出时异步读取完整数据,设计阶段只需传入样本。 */
|
|
31
|
+
loadPreviewData?: PrintPreviewDataLoader;
|
|
21
32
|
/** 不可删除的内置模板;未传入时使用初始 document。 */
|
|
22
33
|
defaultTemplates?: readonly PrintDesignDocument[];
|
|
23
34
|
/** 弹窗关闭操作,传入时在工具栏右侧显示关闭按钮。 */
|
|
@@ -56,4 +67,4 @@ declare function isPrintDesignDocumentCompatible(document: PrintDesignDocument,
|
|
|
56
67
|
/** 当前输入与保存版本的数据格式不一致时判定为失效。 */
|
|
57
68
|
declare function isPrintDesignTemplateInvalid(version: PrintDesignTemplateVersion, dataFormat?: string, data?: Record<string, unknown>): boolean;
|
|
58
69
|
|
|
59
|
-
export { type PrintDesignTemplateVersion, ReactPrintDesign, type ReactPrintDesignProps, getPrintDesignDataFormat, isPrintDesignDocumentCompatible, isPrintDesignTemplateInvalid, readPrintDesignTemplates };
|
|
70
|
+
export { type PrintDesignTemplateVersion, type PrintPreviewDataLoader, ReactPrintDesign, type ReactPrintDesignProps, getPrintDesignDataFormat, isPrintDesignDocumentCompatible, isPrintDesignTemplateInvalid, readPrintDesignTemplates };
|