@canvas-components/print-design-plugin 0.1.5 → 0.1.6
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/list-table-print.d.cts +129 -2
- package/dist/list-table-print.d.ts +129 -2
- package/package.json +5 -7
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import * as _canvas_components_print_design from '@canvas-components/print-design';
|
|
2
|
+
import { PrintDesignComponentRegistry, PrintDesignDocument } from '@canvas-components/print-design';
|
|
2
3
|
import { P as PrintDesignNativePlugin } from './model-BwhSanYM.cjs';
|
|
3
4
|
import * as _canvas_components_react_print_design from '@canvas-components/react-print-design';
|
|
5
|
+
import { ReactPrintDesignProps, PrintDesignTemplateVersion } from '@canvas-components/react-print-design';
|
|
4
6
|
import * as react from 'react';
|
|
5
|
-
import {
|
|
7
|
+
import { ComponentType, ReactNode } from 'react';
|
|
8
|
+
import { ListTableExportSummarySettings, ListTableExportColumnChoice, ListTableExportSettings, HeaderContextMenuConfig } from '@canvas-components/list-table';
|
|
9
|
+
import { BrowserPrintColumn, BrowserPrintPaperSize } from '@canvas-components/print';
|
|
6
10
|
import '@canvas-components/barcode';
|
|
7
11
|
import '@canvas-components/qrcode';
|
|
8
12
|
|
|
@@ -33,6 +37,129 @@ declare function createListTablePrintMenu(context: ListTablePrintMenuContext): {
|
|
|
33
37
|
})[];
|
|
34
38
|
};
|
|
35
39
|
|
|
40
|
+
interface PrintColumn extends BrowserPrintColumn {
|
|
41
|
+
summaryType?: ListTableExportSummarySettings["type"];
|
|
42
|
+
showTypePrefix?: "yes" | "no";
|
|
43
|
+
precision?: number;
|
|
44
|
+
roundingMode?: ListTableExportSummarySettings["roundingMode"];
|
|
45
|
+
preserveTrailingZeros?: "yes" | "no";
|
|
46
|
+
summaryTitle?: string;
|
|
47
|
+
}
|
|
48
|
+
interface PrintSettings {
|
|
49
|
+
version: 2;
|
|
50
|
+
presetName?: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
subtitle?: string;
|
|
53
|
+
titleFontSize?: number;
|
|
54
|
+
subtitleFontSize?: number;
|
|
55
|
+
columns: PrintColumn[];
|
|
56
|
+
selectedKeys: string[];
|
|
57
|
+
rowsPerPage: number;
|
|
58
|
+
rowHeight?: number;
|
|
59
|
+
autoCalculateRowsPerPage?: boolean;
|
|
60
|
+
autoCalculateColumnWidths?: boolean;
|
|
61
|
+
includeSummary?: boolean;
|
|
62
|
+
summaryPosition?: "every-page" | "last-page";
|
|
63
|
+
showPageNumbers?: boolean;
|
|
64
|
+
pageNumberPosition?: "left" | "center" | "right";
|
|
65
|
+
showPrintTime?: boolean;
|
|
66
|
+
printTimePosition?: "left" | "center" | "right";
|
|
67
|
+
pageMargins?: {
|
|
68
|
+
top: number;
|
|
69
|
+
right: number;
|
|
70
|
+
bottom: number;
|
|
71
|
+
left: number;
|
|
72
|
+
};
|
|
73
|
+
paperSize?: BrowserPrintPaperSize;
|
|
74
|
+
orientation?: "portrait" | "landscape";
|
|
75
|
+
useCellBorders?: boolean;
|
|
76
|
+
borderColor?: string;
|
|
77
|
+
textColor?: string;
|
|
78
|
+
headerBackgroundColor?: string;
|
|
79
|
+
summaryBackgroundColor?: string;
|
|
80
|
+
showSectionDividers?: boolean;
|
|
81
|
+
sectionDividerTopSpacing?: number;
|
|
82
|
+
sectionDividerBottomSpacing?: number;
|
|
83
|
+
formItemSpacing?: number;
|
|
84
|
+
}
|
|
85
|
+
/** 打印列预设只需指定列键;宽度、对齐和超宽处理均可选。 */
|
|
86
|
+
type ReactListTablePrintColumnConfig = Pick<BrowserPrintColumn, "key"> & Partial<Omit<PrintColumn, "key">>;
|
|
87
|
+
/** 打印预设的可配置项;未提供的字段使用打印默认值。 */
|
|
88
|
+
type ReactListTablePrintConfig = Partial<Omit<PrintSettings, "version" | "presetName" | "columns" | "selectedKeys">> & {
|
|
89
|
+
columns?: readonly ReactListTablePrintColumnConfig[];
|
|
90
|
+
selectedKeys?: readonly string[];
|
|
91
|
+
};
|
|
92
|
+
/** 供 ReactListTable 打印弹窗选择的命名预设。名称应保持唯一。 */
|
|
93
|
+
interface ReactListTablePrintPreset {
|
|
94
|
+
name: string;
|
|
95
|
+
config: ReactListTablePrintConfig;
|
|
96
|
+
}
|
|
97
|
+
interface PrintSource {
|
|
98
|
+
columns: BrowserPrintColumn[];
|
|
99
|
+
rows: string[][];
|
|
100
|
+
summaryRow?: string[];
|
|
101
|
+
summaryColumns?: ListTableExportColumnChoice[];
|
|
102
|
+
getSummaryRow?: (settings: ListTableExportSettings) => Promise<string[]>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** 宿主插件贡献给表格右键菜单的子菜单项。 */
|
|
106
|
+
interface ReactListTableHostMenuItem {
|
|
107
|
+
key: string;
|
|
108
|
+
label: string;
|
|
109
|
+
disabled?: boolean;
|
|
110
|
+
onClick?: () => void;
|
|
111
|
+
}
|
|
112
|
+
/** 宿主插件的右键菜单描述。 */
|
|
113
|
+
interface ReactListTableHostMenu {
|
|
114
|
+
label: string;
|
|
115
|
+
items: readonly ReactListTableHostMenuItem[];
|
|
116
|
+
}
|
|
117
|
+
/** 当前表格实例提供的打印菜单上下文。 */
|
|
118
|
+
interface ReactListTablePrintMenuContext {
|
|
119
|
+
canPrint: boolean;
|
|
120
|
+
templates: readonly {
|
|
121
|
+
key: string;
|
|
122
|
+
label: string;
|
|
123
|
+
disabled?: boolean;
|
|
124
|
+
}[];
|
|
125
|
+
onPrintTemplate: (key: string) => void;
|
|
126
|
+
onDirectPrint: () => void;
|
|
127
|
+
onPrintDesign: () => void;
|
|
128
|
+
}
|
|
129
|
+
/** 每个表格实例传给宿主插件的请求与界面能力。 */
|
|
130
|
+
interface ReactListTablePrintHostProps {
|
|
131
|
+
integration: ReactListTablePrintIntegration;
|
|
132
|
+
request: HeaderContextMenuConfig | null;
|
|
133
|
+
portalContainer: HTMLElement;
|
|
134
|
+
storeKey?: string;
|
|
135
|
+
presets?: readonly ReactListTablePrintPreset[];
|
|
136
|
+
templates?: readonly PrintDesignDocument[];
|
|
137
|
+
pagesPerBatch?: number;
|
|
138
|
+
children: (menu: ReactListTableHostMenu | null) => ReactNode;
|
|
139
|
+
}
|
|
140
|
+
/** 表格右键打印设计所需的同版本原生与 React 插件能力。 */
|
|
141
|
+
interface ReactListTablePrintIntegration {
|
|
142
|
+
id: string;
|
|
143
|
+
version: string;
|
|
144
|
+
componentRegistry: PrintDesignComponentRegistry;
|
|
145
|
+
editor: Required<Pick<ReactPrintDesignProps, "componentFactories" | "componentMenu" | "propertySections" | "contextMenus" | "tools" | "pluginCatalog">>;
|
|
146
|
+
createMenu: (context: ReactListTablePrintMenuContext) => ReactListTableHostMenu;
|
|
147
|
+
readTemplates: (storeKey: string) => Promise<PrintDesignTemplateVersion[]>;
|
|
148
|
+
createTemplateChoices: (options: {
|
|
149
|
+
presets?: readonly {
|
|
150
|
+
name: string;
|
|
151
|
+
}[];
|
|
152
|
+
documents?: readonly {
|
|
153
|
+
name: string;
|
|
154
|
+
}[];
|
|
155
|
+
saved: readonly PrintDesignTemplateVersion[];
|
|
156
|
+
}) => readonly {
|
|
157
|
+
key: string;
|
|
158
|
+
label: string;
|
|
159
|
+
}[];
|
|
160
|
+
Host: ComponentType<ReactListTablePrintHostProps>;
|
|
161
|
+
}
|
|
162
|
+
|
|
36
163
|
/** 为每个表格实例隔离打印模板、设计弹窗和直接打印任务。 */
|
|
37
164
|
declare function ListTablePrintHost(props: ReactListTablePrintHostProps): react.JSX.Element;
|
|
38
165
|
|
|
@@ -118,4 +245,4 @@ declare const builtinListTablePrintIntegration: Readonly<{
|
|
|
118
245
|
Host: typeof ListTablePrintHost;
|
|
119
246
|
}>;
|
|
120
247
|
|
|
121
|
-
export { builtinListTablePrintIntegration };
|
|
248
|
+
export { type PrintColumn, type PrintSettings, type PrintSource, type ReactListTableHostMenu, type ReactListTableHostMenuItem, type ReactListTablePrintColumnConfig, type ReactListTablePrintConfig, type ReactListTablePrintHostProps, type ReactListTablePrintIntegration, type ReactListTablePrintMenuContext, type ReactListTablePrintPreset, builtinListTablePrintIntegration };
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import * as _canvas_components_print_design from '@canvas-components/print-design';
|
|
2
|
+
import { PrintDesignComponentRegistry, PrintDesignDocument } from '@canvas-components/print-design';
|
|
2
3
|
import { P as PrintDesignNativePlugin } from './model-BwhSanYM.js';
|
|
3
4
|
import * as _canvas_components_react_print_design from '@canvas-components/react-print-design';
|
|
5
|
+
import { ReactPrintDesignProps, PrintDesignTemplateVersion } from '@canvas-components/react-print-design';
|
|
4
6
|
import * as react from 'react';
|
|
5
|
-
import {
|
|
7
|
+
import { ComponentType, ReactNode } from 'react';
|
|
8
|
+
import { ListTableExportSummarySettings, ListTableExportColumnChoice, ListTableExportSettings, HeaderContextMenuConfig } from '@canvas-components/list-table';
|
|
9
|
+
import { BrowserPrintColumn, BrowserPrintPaperSize } from '@canvas-components/print';
|
|
6
10
|
import '@canvas-components/barcode';
|
|
7
11
|
import '@canvas-components/qrcode';
|
|
8
12
|
|
|
@@ -33,6 +37,129 @@ declare function createListTablePrintMenu(context: ListTablePrintMenuContext): {
|
|
|
33
37
|
})[];
|
|
34
38
|
};
|
|
35
39
|
|
|
40
|
+
interface PrintColumn extends BrowserPrintColumn {
|
|
41
|
+
summaryType?: ListTableExportSummarySettings["type"];
|
|
42
|
+
showTypePrefix?: "yes" | "no";
|
|
43
|
+
precision?: number;
|
|
44
|
+
roundingMode?: ListTableExportSummarySettings["roundingMode"];
|
|
45
|
+
preserveTrailingZeros?: "yes" | "no";
|
|
46
|
+
summaryTitle?: string;
|
|
47
|
+
}
|
|
48
|
+
interface PrintSettings {
|
|
49
|
+
version: 2;
|
|
50
|
+
presetName?: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
subtitle?: string;
|
|
53
|
+
titleFontSize?: number;
|
|
54
|
+
subtitleFontSize?: number;
|
|
55
|
+
columns: PrintColumn[];
|
|
56
|
+
selectedKeys: string[];
|
|
57
|
+
rowsPerPage: number;
|
|
58
|
+
rowHeight?: number;
|
|
59
|
+
autoCalculateRowsPerPage?: boolean;
|
|
60
|
+
autoCalculateColumnWidths?: boolean;
|
|
61
|
+
includeSummary?: boolean;
|
|
62
|
+
summaryPosition?: "every-page" | "last-page";
|
|
63
|
+
showPageNumbers?: boolean;
|
|
64
|
+
pageNumberPosition?: "left" | "center" | "right";
|
|
65
|
+
showPrintTime?: boolean;
|
|
66
|
+
printTimePosition?: "left" | "center" | "right";
|
|
67
|
+
pageMargins?: {
|
|
68
|
+
top: number;
|
|
69
|
+
right: number;
|
|
70
|
+
bottom: number;
|
|
71
|
+
left: number;
|
|
72
|
+
};
|
|
73
|
+
paperSize?: BrowserPrintPaperSize;
|
|
74
|
+
orientation?: "portrait" | "landscape";
|
|
75
|
+
useCellBorders?: boolean;
|
|
76
|
+
borderColor?: string;
|
|
77
|
+
textColor?: string;
|
|
78
|
+
headerBackgroundColor?: string;
|
|
79
|
+
summaryBackgroundColor?: string;
|
|
80
|
+
showSectionDividers?: boolean;
|
|
81
|
+
sectionDividerTopSpacing?: number;
|
|
82
|
+
sectionDividerBottomSpacing?: number;
|
|
83
|
+
formItemSpacing?: number;
|
|
84
|
+
}
|
|
85
|
+
/** 打印列预设只需指定列键;宽度、对齐和超宽处理均可选。 */
|
|
86
|
+
type ReactListTablePrintColumnConfig = Pick<BrowserPrintColumn, "key"> & Partial<Omit<PrintColumn, "key">>;
|
|
87
|
+
/** 打印预设的可配置项;未提供的字段使用打印默认值。 */
|
|
88
|
+
type ReactListTablePrintConfig = Partial<Omit<PrintSettings, "version" | "presetName" | "columns" | "selectedKeys">> & {
|
|
89
|
+
columns?: readonly ReactListTablePrintColumnConfig[];
|
|
90
|
+
selectedKeys?: readonly string[];
|
|
91
|
+
};
|
|
92
|
+
/** 供 ReactListTable 打印弹窗选择的命名预设。名称应保持唯一。 */
|
|
93
|
+
interface ReactListTablePrintPreset {
|
|
94
|
+
name: string;
|
|
95
|
+
config: ReactListTablePrintConfig;
|
|
96
|
+
}
|
|
97
|
+
interface PrintSource {
|
|
98
|
+
columns: BrowserPrintColumn[];
|
|
99
|
+
rows: string[][];
|
|
100
|
+
summaryRow?: string[];
|
|
101
|
+
summaryColumns?: ListTableExportColumnChoice[];
|
|
102
|
+
getSummaryRow?: (settings: ListTableExportSettings) => Promise<string[]>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** 宿主插件贡献给表格右键菜单的子菜单项。 */
|
|
106
|
+
interface ReactListTableHostMenuItem {
|
|
107
|
+
key: string;
|
|
108
|
+
label: string;
|
|
109
|
+
disabled?: boolean;
|
|
110
|
+
onClick?: () => void;
|
|
111
|
+
}
|
|
112
|
+
/** 宿主插件的右键菜单描述。 */
|
|
113
|
+
interface ReactListTableHostMenu {
|
|
114
|
+
label: string;
|
|
115
|
+
items: readonly ReactListTableHostMenuItem[];
|
|
116
|
+
}
|
|
117
|
+
/** 当前表格实例提供的打印菜单上下文。 */
|
|
118
|
+
interface ReactListTablePrintMenuContext {
|
|
119
|
+
canPrint: boolean;
|
|
120
|
+
templates: readonly {
|
|
121
|
+
key: string;
|
|
122
|
+
label: string;
|
|
123
|
+
disabled?: boolean;
|
|
124
|
+
}[];
|
|
125
|
+
onPrintTemplate: (key: string) => void;
|
|
126
|
+
onDirectPrint: () => void;
|
|
127
|
+
onPrintDesign: () => void;
|
|
128
|
+
}
|
|
129
|
+
/** 每个表格实例传给宿主插件的请求与界面能力。 */
|
|
130
|
+
interface ReactListTablePrintHostProps {
|
|
131
|
+
integration: ReactListTablePrintIntegration;
|
|
132
|
+
request: HeaderContextMenuConfig | null;
|
|
133
|
+
portalContainer: HTMLElement;
|
|
134
|
+
storeKey?: string;
|
|
135
|
+
presets?: readonly ReactListTablePrintPreset[];
|
|
136
|
+
templates?: readonly PrintDesignDocument[];
|
|
137
|
+
pagesPerBatch?: number;
|
|
138
|
+
children: (menu: ReactListTableHostMenu | null) => ReactNode;
|
|
139
|
+
}
|
|
140
|
+
/** 表格右键打印设计所需的同版本原生与 React 插件能力。 */
|
|
141
|
+
interface ReactListTablePrintIntegration {
|
|
142
|
+
id: string;
|
|
143
|
+
version: string;
|
|
144
|
+
componentRegistry: PrintDesignComponentRegistry;
|
|
145
|
+
editor: Required<Pick<ReactPrintDesignProps, "componentFactories" | "componentMenu" | "propertySections" | "contextMenus" | "tools" | "pluginCatalog">>;
|
|
146
|
+
createMenu: (context: ReactListTablePrintMenuContext) => ReactListTableHostMenu;
|
|
147
|
+
readTemplates: (storeKey: string) => Promise<PrintDesignTemplateVersion[]>;
|
|
148
|
+
createTemplateChoices: (options: {
|
|
149
|
+
presets?: readonly {
|
|
150
|
+
name: string;
|
|
151
|
+
}[];
|
|
152
|
+
documents?: readonly {
|
|
153
|
+
name: string;
|
|
154
|
+
}[];
|
|
155
|
+
saved: readonly PrintDesignTemplateVersion[];
|
|
156
|
+
}) => readonly {
|
|
157
|
+
key: string;
|
|
158
|
+
label: string;
|
|
159
|
+
}[];
|
|
160
|
+
Host: ComponentType<ReactListTablePrintHostProps>;
|
|
161
|
+
}
|
|
162
|
+
|
|
36
163
|
/** 为每个表格实例隔离打印模板、设计弹窗和直接打印任务。 */
|
|
37
164
|
declare function ListTablePrintHost(props: ReactListTablePrintHostProps): react.JSX.Element;
|
|
38
165
|
|
|
@@ -118,4 +245,4 @@ declare const builtinListTablePrintIntegration: Readonly<{
|
|
|
118
245
|
Host: typeof ListTablePrintHost;
|
|
119
246
|
}>;
|
|
120
247
|
|
|
121
|
-
export { builtinListTablePrintIntegration };
|
|
248
|
+
export { type PrintColumn, type PrintSettings, type PrintSource, type ReactListTableHostMenu, type ReactListTableHostMenuItem, type ReactListTablePrintColumnConfig, type ReactListTablePrintConfig, type ReactListTablePrintHostProps, type ReactListTablePrintIntegration, type ReactListTablePrintMenuContext, type ReactListTablePrintPreset, builtinListTablePrintIntegration };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canvas-components/print-design-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Native and React plugin bundle for print design.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"pnpm": ">=9.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@canvas-components/barcode": "0.2.3",
|
|
50
|
-
"@canvas-components/chart": "0.3.9",
|
|
51
49
|
"@canvas-components/icons": "0.1.2",
|
|
50
|
+
"@canvas-components/chart": "0.3.9",
|
|
51
|
+
"@canvas-components/barcode": "0.2.3",
|
|
52
52
|
"@canvas-components/print": "0.1.1",
|
|
53
53
|
"@canvas-components/print-design": "0.1.10",
|
|
54
54
|
"@canvas-components/qrcode": "0.2.3",
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@canvas-components/list-table": ">=0.3.44",
|
|
59
59
|
"@canvas-components/react-components": ">=0.1.0",
|
|
60
|
-
"@canvas-components/react-list-table": ">=0.3.58",
|
|
61
60
|
"@canvas-components/react-print-design": ">=0.1.15",
|
|
62
61
|
"react": ">=16.8.0",
|
|
63
62
|
"react-dom": ">=16.8.0"
|
|
@@ -86,9 +85,8 @@
|
|
|
86
85
|
"react": "^18.3.1",
|
|
87
86
|
"react-dom": "^18.3.1",
|
|
88
87
|
"@canvas-components/list-table": "0.3.44",
|
|
89
|
-
"@canvas-components/react-
|
|
90
|
-
"@canvas-components/react-
|
|
91
|
-
"@canvas-components/react-print-design": "0.1.15"
|
|
88
|
+
"@canvas-components/react-print-design": "0.1.15",
|
|
89
|
+
"@canvas-components/react-components": "0.3.25"
|
|
92
90
|
},
|
|
93
91
|
"scripts": {
|
|
94
92
|
"build": "pnpm run check:boundaries && tsup --config tsup.config.ts",
|