@canvas-components/print-design 0.1.11 → 0.1.12
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 +2 -0
- package/dist/index.cjs +419 -224
- package/dist/index.d.cts +44 -13
- package/dist/index.d.ts +44 -13
- package/dist/index.js +419 -220
- package/package.json +2 -2
- package/dist/font-assets/Arimo-Bold.ttf +0 -0
- package/dist/font-assets/Arimo-OFL.txt +0 -93
- package/dist/font-assets/Arimo-Regular.ttf +0 -0
- package/dist/font-assets/NotoSansSC-Bold.ttf +0 -0
- package/dist/font-assets/NotoSansSC-Regular.ttf +0 -0
- package/dist/font-assets/OFL.txt +0 -93
- package/dist/font-assets/Tinos-Bold.ttf +0 -0
- package/dist/font-assets/Tinos-OFL.txt +0 -93
- package/dist/font-assets/Tinos-Regular.ttf +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1153,12 +1153,17 @@ interface PrintDesignInlineTextPresentation extends PrintDesignElementBase {
|
|
|
1153
1153
|
fontSize?: number;
|
|
1154
1154
|
fontFamily?: string;
|
|
1155
1155
|
fontWeight?: string;
|
|
1156
|
+
fontStyle?: "normal" | "italic";
|
|
1156
1157
|
color?: string;
|
|
1157
1158
|
textAlign?: CanvasTextAlign | "justify" | "distributed";
|
|
1158
1159
|
/** 文字排列方向。 */
|
|
1159
1160
|
textDirection?: "horizontal" | "vertical";
|
|
1160
1161
|
verticalAlign?: "top" | "middle" | "bottom";
|
|
1161
1162
|
lineHeight?: number;
|
|
1163
|
+
/** 编辑浮层使用的通用段落缩进呈现信息。 */
|
|
1164
|
+
indentMode?: "none" | "firstLine" | "hanging";
|
|
1165
|
+
indentValue?: number;
|
|
1166
|
+
indentUnit?: "char" | "mm" | "cm" | "in" | "pt" | "px";
|
|
1162
1167
|
/** 编辑时按当前文本解析字号;由插件提供。 */
|
|
1163
1168
|
resolveFontSize?: (text: string) => number;
|
|
1164
1169
|
}
|
|
@@ -1243,6 +1248,10 @@ interface PrintDesignOptions {
|
|
|
1243
1248
|
onPathDrawingChange?: (elementId: string | null) => void;
|
|
1244
1249
|
/** 当前活动页变化回调。 */
|
|
1245
1250
|
onActivePageChange?: (pageId: string) => void;
|
|
1251
|
+
/** 元素双击时交由框架编辑层处理;返回 true 表示已接管。 */
|
|
1252
|
+
onElementDoubleClick?: (element: PrintDesignElement, pageId: string) => boolean;
|
|
1253
|
+
/** 框架内联编辑时由浮层绘制该元素,Canvas 暂时隐藏原图形。 */
|
|
1254
|
+
inlineEditingElementId?: string;
|
|
1246
1255
|
/** 初始画布缩放比例。@default 1 */
|
|
1247
1256
|
zoom?: number;
|
|
1248
1257
|
/** 只读模式。 */
|
|
@@ -1301,6 +1310,15 @@ interface PrintDesignOptions {
|
|
|
1301
1310
|
showMeasurements?: boolean;
|
|
1302
1311
|
/** 缩放过渡时长,单位毫秒;0 表示关闭。@default 180 */
|
|
1303
1312
|
zoomDuration?: number;
|
|
1313
|
+
/** 方向键移动组件的基础步长,单位毫米;长按逐渐加速。@default 1 */
|
|
1314
|
+
keyboardMoveStep?: number;
|
|
1315
|
+
/** 长按方向键连续移动时是否逐渐加速。@default false */
|
|
1316
|
+
keyboardMoveAcceleration?: boolean;
|
|
1317
|
+
/** 可选键盘移动策略;由宿主工具插件计算每次按键的毫米位移。 */
|
|
1318
|
+
keyboardMove?: (event: KeyboardEvent, heldMs: number) => {
|
|
1319
|
+
dx: number;
|
|
1320
|
+
dy: number;
|
|
1321
|
+
} | null;
|
|
1304
1322
|
/** 调试辅助层配置;传入 true 显示元素边界、选区和命中目标。 */
|
|
1305
1323
|
debug?: boolean | PrintDesignDebugOptions;
|
|
1306
1324
|
/** 当前设计器实例已注册工具贡献的调试区域,仅用于设计画布。 */
|
|
@@ -1933,6 +1951,17 @@ declare abstract class PrintDesignRenderer extends PrintDesignTextEditing {
|
|
|
1933
1951
|
|
|
1934
1952
|
/** 负责选择、拖拽、缩放、键盘和光标交互。 */
|
|
1935
1953
|
declare abstract class PrintDesignInteraction extends PrintDesignRenderer {
|
|
1954
|
+
private keyboardMoveSession;
|
|
1955
|
+
/** 长按期间只重绘画布,避免每帧提交文档并通知 React。 */
|
|
1956
|
+
private applyKeyboardMove;
|
|
1957
|
+
/** 按真实帧间隔连续移动,系统重复按键只更新当前修饰键状态。 */
|
|
1958
|
+
private advanceKeyboardMove;
|
|
1959
|
+
/** 松开按键时将整段连续移动合并为一条撤销记录。 */
|
|
1960
|
+
private finishKeyboardMove;
|
|
1961
|
+
/** 松键后继续补完当前位移的短暂过渡。 */
|
|
1962
|
+
private releaseKeyboardMove;
|
|
1963
|
+
/** 按页面毫米坐标平移选中组件;一次操作只生成一条撤销记录。 */
|
|
1964
|
+
moveSelectedElements(dx: number, dy: number): this;
|
|
1936
1965
|
/** 尺寸更新后的组件布局模式由注册项维护。 */
|
|
1937
1966
|
private notifyComponentResized;
|
|
1938
1967
|
/** 由注册组件提供描点几何,内置注册项保留旧入口的默认能力。 */
|
|
@@ -2009,6 +2038,7 @@ declare abstract class PrintDesignInteraction extends PrintDesignRenderer {
|
|
|
2009
2038
|
private updateCursor;
|
|
2010
2039
|
protected handleKeyDown: (event: KeyboardEvent) => void;
|
|
2011
2040
|
protected handleKeyUp: (event: KeyboardEvent) => void;
|
|
2041
|
+
protected handleBlur: () => void;
|
|
2012
2042
|
private removeSelectedGuide;
|
|
2013
2043
|
protected normalizeSelectedGuide(): void;
|
|
2014
2044
|
protected handleWheel: (event: WheelEvent) => void;
|
|
@@ -2140,6 +2170,11 @@ declare class PrintDesign extends PrintDesignActions {
|
|
|
2140
2170
|
x: number;
|
|
2141
2171
|
y: number;
|
|
2142
2172
|
} | null;
|
|
2173
|
+
/** 将当前页面的毫米坐标转换为浏览器视口坐标。 */
|
|
2174
|
+
pageToClientPoint(x: number, y: number): {
|
|
2175
|
+
x: number;
|
|
2176
|
+
y: number;
|
|
2177
|
+
};
|
|
2143
2178
|
/** 获取当前页元素在浏览器视口中的包围盒,包含旋转后的占用范围。 */
|
|
2144
2179
|
getElementClientRect(elementId: string): {
|
|
2145
2180
|
left: number;
|
|
@@ -2207,7 +2242,7 @@ interface PrintDesignAgentToolDefinition {
|
|
|
2207
2242
|
/** Agent 仅通过设计器公开命令访问画布,写入保留撤销历史。 */
|
|
2208
2243
|
interface PrintDesignAgentApi {
|
|
2209
2244
|
tools: readonly PrintDesignAgentToolDefinition[];
|
|
2210
|
-
call(name: string, input: unknown): unknown
|
|
2245
|
+
call(name: string, input: unknown): unknown | Promise<unknown>;
|
|
2211
2246
|
}
|
|
2212
2247
|
/** 宿主提供已注册组件的创建能力,核心 API 不依赖任何框架适配层。 */
|
|
2213
2248
|
interface PrintDesignAgentComponentCatalog {
|
|
@@ -2217,6 +2252,7 @@ interface PrintDesignAgentComponentCatalog {
|
|
|
2217
2252
|
agentCommands?: readonly {
|
|
2218
2253
|
name: string;
|
|
2219
2254
|
description: string;
|
|
2255
|
+
parameters?: Record<string, unknown>;
|
|
2220
2256
|
}[];
|
|
2221
2257
|
}[];
|
|
2222
2258
|
create(type: string, preset?: string): PrintDesignElementBase;
|
|
@@ -2227,6 +2263,7 @@ declare const printDesignAgentTools: readonly PrintDesignAgentToolDefinition[];
|
|
|
2227
2263
|
declare function createPrintDesignAgentApi(getInstance: () => PrintDesign | null, options?: {
|
|
2228
2264
|
readonly?: () => boolean;
|
|
2229
2265
|
componentCatalog?: PrintDesignAgentComponentCatalog;
|
|
2266
|
+
displayUnit?: () => PrintDesignUnit;
|
|
2230
2267
|
}): PrintDesignAgentApi;
|
|
2231
2268
|
|
|
2232
2269
|
/** 核心默认注册表为空,具体组件由插件显式注册。 */
|
|
@@ -2264,16 +2301,10 @@ declare function resolvePrintDesignPageVisible(page: Pick<PrintDesignPage, "visi
|
|
|
2264
2301
|
/** 按静态开关或绑定字段决定组件是否参与预览和打印。 */
|
|
2265
2302
|
declare function resolvePrintDesignElementVisible(element: PrintDesignElementBase, data?: Record<string, unknown>): boolean;
|
|
2266
2303
|
|
|
2267
|
-
/**
|
|
2268
|
-
declare const PRINT_DESIGN_DEFAULT_FONT_FAMILY = "
|
|
2269
|
-
/**
|
|
2270
|
-
declare function
|
|
2271
|
-
/** 获取随核心包发布的默认西文字体资源。 */
|
|
2272
|
-
declare function getPrintDesignLatinFontUrl(weight: 400 | 700): string;
|
|
2273
|
-
/** 获取用于匹配 Times New Roman 的可嵌入 PDF 衬线字体。 */
|
|
2274
|
-
declare function getPrintDesignSerifFontUrl(weight: 400 | 700): string;
|
|
2275
|
-
/** 在 Canvas 正式输出前加载与打印 HTML 相同的中文回退字体。 */
|
|
2276
|
-
declare function preparePrintDesignDefaultFonts(ownerDocument?: Document): Promise<void>;
|
|
2304
|
+
/** 未指定字体时使用浏览器和操作系统提供的无衬线字体。 */
|
|
2305
|
+
declare const PRINT_DESIGN_DEFAULT_FONT_FAMILY = "Arial, sans-serif";
|
|
2306
|
+
/** 为单独指定的字体补上浏览器无衬线回退。 */
|
|
2307
|
+
declare function resolvePrintDesignFontFamily(family?: string): string;
|
|
2277
2308
|
|
|
2278
2309
|
/** `debug: true` 使用的默认调试配置。 */
|
|
2279
2310
|
declare const DEFAULT_PRINT_DESIGN_DEBUG_OPTIONS: {
|
|
@@ -2304,6 +2335,6 @@ interface PrintDesignRecordCollection {
|
|
|
2304
2335
|
/** 识别包含记录数组的对象,不把普通对象当作数据行。 */
|
|
2305
2336
|
declare function isPrintDesignRecordCollection(value: unknown): value is PrintDesignRecordCollection;
|
|
2306
2337
|
|
|
2307
|
-
var version = "0.1.
|
|
2338
|
+
var version = "0.1.12";
|
|
2308
2339
|
|
|
2309
|
-
export { DEFAULT_PRINT_DESIGN_DEBUG_OPTIONS, type ElementDrawContext, PRINT_DESIGN_CSS_DPI, PRINT_DESIGN_DEFAULT_FONT_FAMILY, PRINT_DESIGN_MM_PER_INCH, PRINT_DESIGN_SCHEMA_VERSION, PRINT_DESIGN_UNIT_MM, version as PRINT_DESIGN_VERSION, PrintDesign, type PrintDesignAgentApi, type PrintDesignAgentComponentCatalog, type PrintDesignAgentToolDefinition, type PrintDesignComponentBoundaryResize, type PrintDesignComponentCellContextTarget, type PrintDesignComponentCellEditor, type PrintDesignComponentCellHit, type PrintDesignComponentCellSelection, type PrintDesignComponentCellSelectionBehavior, type PrintDesignComponentCellSelectionContext, type PrintDesignComponentCellSelectionState, type PrintDesignComponentClickContext, type PrintDesignComponentCommands, type PrintDesignComponentConnection, type PrintDesignComponentCrop, type PrintDesignComponentDebugContext, type PrintDesignComponentDebugRegion, type PrintDesignComponentEditHandleContext, type PrintDesignComponentHandleContext, type PrintDesignComponentHandleDrag, type PrintDesignComponentHitContext, type PrintDesignComponentPathDrawing, type PrintDesignComponentPointerContext, type PrintDesignComponentPointerStroke, PrintDesignComponentRegistry, type PrintDesignComponentRenderer, type PrintDesignComponentResource, type PrintDesignComponentSelectionContext, type PrintDesignComponentSelector, type PrintDesignComponentSelectorDrawContext, type PrintDesignComponentSourceCreate, type PrintDesignConnectionAnchorContext, type PrintDesignConnectionCreateHandle, type PrintDesignCropRect, type PrintDesignDataField, type PrintDesignDebugOptions, type PrintDesignDocument, type PrintDesignElement, type PrintDesignElementBase, type PrintDesignElementTypeMap, type PrintDesignExportOptions, type PrintDesignHtmlOptions, type PrintDesignInlineTextEditor, type PrintDesignInlineTextPresentation, type PrintDesignLayerAlignment, type PrintDesignLayerNode, type PrintDesignOptions, type PrintDesignOrientation, type PrintDesignPage, type PrintDesignPageMargins, type PrintDesignPluginRenderer, type PrintDesignRecordCollection, type PrintDesignSelection, type PrintDesignToolDebugContribution, type PrintDesignToolDebugRegion, type PrintDesignUnit, type TransformPoint, buildPrintDesignLayerTree, builtinPrintDesignComponentRegistry, canvasPointToPageMillimeters, clonePrintDesignDocument, createPrintDesignAgentApi, createPrintDesignDocument, createPrintDesignId, createPrintDesignPage, createPrintDesignPrintFrame, cssColor, cssFont, cssNumber, definePrintDesignComponentRenderer, definePrintDesignPluginRenderer, drawPrintDesignElement, drawPrintDesignPage, elementTransformCss, elementTransformHomography, escapeHtml, formatDisplayUnit, fromDisplayUnit, getPrintDesignAlignmentUnits, getPrintDesignDataFields,
|
|
2340
|
+
export { DEFAULT_PRINT_DESIGN_DEBUG_OPTIONS, type ElementDrawContext, PRINT_DESIGN_CSS_DPI, PRINT_DESIGN_DEFAULT_FONT_FAMILY, PRINT_DESIGN_MM_PER_INCH, PRINT_DESIGN_SCHEMA_VERSION, PRINT_DESIGN_UNIT_MM, version as PRINT_DESIGN_VERSION, PrintDesign, type PrintDesignAgentApi, type PrintDesignAgentComponentCatalog, type PrintDesignAgentToolDefinition, type PrintDesignComponentBoundaryResize, type PrintDesignComponentCellContextTarget, type PrintDesignComponentCellEditor, type PrintDesignComponentCellHit, type PrintDesignComponentCellSelection, type PrintDesignComponentCellSelectionBehavior, type PrintDesignComponentCellSelectionContext, type PrintDesignComponentCellSelectionState, type PrintDesignComponentClickContext, type PrintDesignComponentCommands, type PrintDesignComponentConnection, type PrintDesignComponentCrop, type PrintDesignComponentDebugContext, type PrintDesignComponentDebugRegion, type PrintDesignComponentEditHandleContext, type PrintDesignComponentHandleContext, type PrintDesignComponentHandleDrag, type PrintDesignComponentHitContext, type PrintDesignComponentPathDrawing, type PrintDesignComponentPointerContext, type PrintDesignComponentPointerStroke, PrintDesignComponentRegistry, type PrintDesignComponentRenderer, type PrintDesignComponentResource, type PrintDesignComponentSelectionContext, type PrintDesignComponentSelector, type PrintDesignComponentSelectorDrawContext, type PrintDesignComponentSourceCreate, type PrintDesignConnectionAnchorContext, type PrintDesignConnectionCreateHandle, type PrintDesignCropRect, type PrintDesignDataField, type PrintDesignDebugOptions, type PrintDesignDocument, type PrintDesignElement, type PrintDesignElementBase, type PrintDesignElementTypeMap, type PrintDesignExportOptions, type PrintDesignHtmlOptions, type PrintDesignInlineTextEditor, type PrintDesignInlineTextPresentation, type PrintDesignLayerAlignment, type PrintDesignLayerNode, type PrintDesignOptions, type PrintDesignOrientation, type PrintDesignPage, type PrintDesignPageMargins, type PrintDesignPluginRenderer, type PrintDesignRecordCollection, type PrintDesignSelection, type PrintDesignToolDebugContribution, type PrintDesignToolDebugRegion, type PrintDesignUnit, type TransformPoint, buildPrintDesignLayerTree, builtinPrintDesignComponentRegistry, canvasPointToPageMillimeters, clonePrintDesignDocument, createPrintDesignAgentApi, createPrintDesignDocument, createPrintDesignId, createPrintDesignPage, createPrintDesignPrintFrame, cssColor, cssFont, cssNumber, definePrintDesignComponentRenderer, definePrintDesignPluginRenderer, drawPrintDesignElement, drawPrintDesignPage, elementTransformCss, elementTransformHomography, escapeHtml, formatDisplayUnit, fromDisplayUnit, getPrintDesignAlignmentUnits, getPrintDesignDataFields, getPrintDesignElementDataConfig, getPrintDesignPageSize, getSelectionRect, hitTestPrintDesignPage, inverseTransformPoint, isPrintDesignColorValue, isPrintDesignRecordCollection, materializePrintDesignDocument, millimetersToPixels, paginatePrintDesignDocument, parsePrintDesignDocument, pixelsToMillimeters, preparePrintDesignCanvasPage, printDesignAgentTools, printPrintDesignHtml, printPrintDesignHtmlInFrame, projectTransformPoint, renderPrintDesignHtmlFrame, renderPrintDesignPageToCanvas, resolveDesignText, resolvePrintDesignBinding, resolvePrintDesignDataPath, resolvePrintDesignDebugOptions, resolvePrintDesignElementData, resolvePrintDesignElementVisible, resolvePrintDesignFontFamily, resolvePrintDesignPageVisible, rotatePoint, serializePrintDesignDocument, stringifyPrintDesignBinding, toDisplayUnit, transformPrintDesignToHtml, transformPrintDesignToHtmlAsync, transformPrintDesignToHtmlBatches, transformRect };
|
package/dist/index.d.ts
CHANGED
|
@@ -1153,12 +1153,17 @@ interface PrintDesignInlineTextPresentation extends PrintDesignElementBase {
|
|
|
1153
1153
|
fontSize?: number;
|
|
1154
1154
|
fontFamily?: string;
|
|
1155
1155
|
fontWeight?: string;
|
|
1156
|
+
fontStyle?: "normal" | "italic";
|
|
1156
1157
|
color?: string;
|
|
1157
1158
|
textAlign?: CanvasTextAlign | "justify" | "distributed";
|
|
1158
1159
|
/** 文字排列方向。 */
|
|
1159
1160
|
textDirection?: "horizontal" | "vertical";
|
|
1160
1161
|
verticalAlign?: "top" | "middle" | "bottom";
|
|
1161
1162
|
lineHeight?: number;
|
|
1163
|
+
/** 编辑浮层使用的通用段落缩进呈现信息。 */
|
|
1164
|
+
indentMode?: "none" | "firstLine" | "hanging";
|
|
1165
|
+
indentValue?: number;
|
|
1166
|
+
indentUnit?: "char" | "mm" | "cm" | "in" | "pt" | "px";
|
|
1162
1167
|
/** 编辑时按当前文本解析字号;由插件提供。 */
|
|
1163
1168
|
resolveFontSize?: (text: string) => number;
|
|
1164
1169
|
}
|
|
@@ -1243,6 +1248,10 @@ interface PrintDesignOptions {
|
|
|
1243
1248
|
onPathDrawingChange?: (elementId: string | null) => void;
|
|
1244
1249
|
/** 当前活动页变化回调。 */
|
|
1245
1250
|
onActivePageChange?: (pageId: string) => void;
|
|
1251
|
+
/** 元素双击时交由框架编辑层处理;返回 true 表示已接管。 */
|
|
1252
|
+
onElementDoubleClick?: (element: PrintDesignElement, pageId: string) => boolean;
|
|
1253
|
+
/** 框架内联编辑时由浮层绘制该元素,Canvas 暂时隐藏原图形。 */
|
|
1254
|
+
inlineEditingElementId?: string;
|
|
1246
1255
|
/** 初始画布缩放比例。@default 1 */
|
|
1247
1256
|
zoom?: number;
|
|
1248
1257
|
/** 只读模式。 */
|
|
@@ -1301,6 +1310,15 @@ interface PrintDesignOptions {
|
|
|
1301
1310
|
showMeasurements?: boolean;
|
|
1302
1311
|
/** 缩放过渡时长,单位毫秒;0 表示关闭。@default 180 */
|
|
1303
1312
|
zoomDuration?: number;
|
|
1313
|
+
/** 方向键移动组件的基础步长,单位毫米;长按逐渐加速。@default 1 */
|
|
1314
|
+
keyboardMoveStep?: number;
|
|
1315
|
+
/** 长按方向键连续移动时是否逐渐加速。@default false */
|
|
1316
|
+
keyboardMoveAcceleration?: boolean;
|
|
1317
|
+
/** 可选键盘移动策略;由宿主工具插件计算每次按键的毫米位移。 */
|
|
1318
|
+
keyboardMove?: (event: KeyboardEvent, heldMs: number) => {
|
|
1319
|
+
dx: number;
|
|
1320
|
+
dy: number;
|
|
1321
|
+
} | null;
|
|
1304
1322
|
/** 调试辅助层配置;传入 true 显示元素边界、选区和命中目标。 */
|
|
1305
1323
|
debug?: boolean | PrintDesignDebugOptions;
|
|
1306
1324
|
/** 当前设计器实例已注册工具贡献的调试区域,仅用于设计画布。 */
|
|
@@ -1933,6 +1951,17 @@ declare abstract class PrintDesignRenderer extends PrintDesignTextEditing {
|
|
|
1933
1951
|
|
|
1934
1952
|
/** 负责选择、拖拽、缩放、键盘和光标交互。 */
|
|
1935
1953
|
declare abstract class PrintDesignInteraction extends PrintDesignRenderer {
|
|
1954
|
+
private keyboardMoveSession;
|
|
1955
|
+
/** 长按期间只重绘画布,避免每帧提交文档并通知 React。 */
|
|
1956
|
+
private applyKeyboardMove;
|
|
1957
|
+
/** 按真实帧间隔连续移动,系统重复按键只更新当前修饰键状态。 */
|
|
1958
|
+
private advanceKeyboardMove;
|
|
1959
|
+
/** 松开按键时将整段连续移动合并为一条撤销记录。 */
|
|
1960
|
+
private finishKeyboardMove;
|
|
1961
|
+
/** 松键后继续补完当前位移的短暂过渡。 */
|
|
1962
|
+
private releaseKeyboardMove;
|
|
1963
|
+
/** 按页面毫米坐标平移选中组件;一次操作只生成一条撤销记录。 */
|
|
1964
|
+
moveSelectedElements(dx: number, dy: number): this;
|
|
1936
1965
|
/** 尺寸更新后的组件布局模式由注册项维护。 */
|
|
1937
1966
|
private notifyComponentResized;
|
|
1938
1967
|
/** 由注册组件提供描点几何,内置注册项保留旧入口的默认能力。 */
|
|
@@ -2009,6 +2038,7 @@ declare abstract class PrintDesignInteraction extends PrintDesignRenderer {
|
|
|
2009
2038
|
private updateCursor;
|
|
2010
2039
|
protected handleKeyDown: (event: KeyboardEvent) => void;
|
|
2011
2040
|
protected handleKeyUp: (event: KeyboardEvent) => void;
|
|
2041
|
+
protected handleBlur: () => void;
|
|
2012
2042
|
private removeSelectedGuide;
|
|
2013
2043
|
protected normalizeSelectedGuide(): void;
|
|
2014
2044
|
protected handleWheel: (event: WheelEvent) => void;
|
|
@@ -2140,6 +2170,11 @@ declare class PrintDesign extends PrintDesignActions {
|
|
|
2140
2170
|
x: number;
|
|
2141
2171
|
y: number;
|
|
2142
2172
|
} | null;
|
|
2173
|
+
/** 将当前页面的毫米坐标转换为浏览器视口坐标。 */
|
|
2174
|
+
pageToClientPoint(x: number, y: number): {
|
|
2175
|
+
x: number;
|
|
2176
|
+
y: number;
|
|
2177
|
+
};
|
|
2143
2178
|
/** 获取当前页元素在浏览器视口中的包围盒,包含旋转后的占用范围。 */
|
|
2144
2179
|
getElementClientRect(elementId: string): {
|
|
2145
2180
|
left: number;
|
|
@@ -2207,7 +2242,7 @@ interface PrintDesignAgentToolDefinition {
|
|
|
2207
2242
|
/** Agent 仅通过设计器公开命令访问画布,写入保留撤销历史。 */
|
|
2208
2243
|
interface PrintDesignAgentApi {
|
|
2209
2244
|
tools: readonly PrintDesignAgentToolDefinition[];
|
|
2210
|
-
call(name: string, input: unknown): unknown
|
|
2245
|
+
call(name: string, input: unknown): unknown | Promise<unknown>;
|
|
2211
2246
|
}
|
|
2212
2247
|
/** 宿主提供已注册组件的创建能力,核心 API 不依赖任何框架适配层。 */
|
|
2213
2248
|
interface PrintDesignAgentComponentCatalog {
|
|
@@ -2217,6 +2252,7 @@ interface PrintDesignAgentComponentCatalog {
|
|
|
2217
2252
|
agentCommands?: readonly {
|
|
2218
2253
|
name: string;
|
|
2219
2254
|
description: string;
|
|
2255
|
+
parameters?: Record<string, unknown>;
|
|
2220
2256
|
}[];
|
|
2221
2257
|
}[];
|
|
2222
2258
|
create(type: string, preset?: string): PrintDesignElementBase;
|
|
@@ -2227,6 +2263,7 @@ declare const printDesignAgentTools: readonly PrintDesignAgentToolDefinition[];
|
|
|
2227
2263
|
declare function createPrintDesignAgentApi(getInstance: () => PrintDesign | null, options?: {
|
|
2228
2264
|
readonly?: () => boolean;
|
|
2229
2265
|
componentCatalog?: PrintDesignAgentComponentCatalog;
|
|
2266
|
+
displayUnit?: () => PrintDesignUnit;
|
|
2230
2267
|
}): PrintDesignAgentApi;
|
|
2231
2268
|
|
|
2232
2269
|
/** 核心默认注册表为空,具体组件由插件显式注册。 */
|
|
@@ -2264,16 +2301,10 @@ declare function resolvePrintDesignPageVisible(page: Pick<PrintDesignPage, "visi
|
|
|
2264
2301
|
/** 按静态开关或绑定字段决定组件是否参与预览和打印。 */
|
|
2265
2302
|
declare function resolvePrintDesignElementVisible(element: PrintDesignElementBase, data?: Record<string, unknown>): boolean;
|
|
2266
2303
|
|
|
2267
|
-
/**
|
|
2268
|
-
declare const PRINT_DESIGN_DEFAULT_FONT_FAMILY = "
|
|
2269
|
-
/**
|
|
2270
|
-
declare function
|
|
2271
|
-
/** 获取随核心包发布的默认西文字体资源。 */
|
|
2272
|
-
declare function getPrintDesignLatinFontUrl(weight: 400 | 700): string;
|
|
2273
|
-
/** 获取用于匹配 Times New Roman 的可嵌入 PDF 衬线字体。 */
|
|
2274
|
-
declare function getPrintDesignSerifFontUrl(weight: 400 | 700): string;
|
|
2275
|
-
/** 在 Canvas 正式输出前加载与打印 HTML 相同的中文回退字体。 */
|
|
2276
|
-
declare function preparePrintDesignDefaultFonts(ownerDocument?: Document): Promise<void>;
|
|
2304
|
+
/** 未指定字体时使用浏览器和操作系统提供的无衬线字体。 */
|
|
2305
|
+
declare const PRINT_DESIGN_DEFAULT_FONT_FAMILY = "Arial, sans-serif";
|
|
2306
|
+
/** 为单独指定的字体补上浏览器无衬线回退。 */
|
|
2307
|
+
declare function resolvePrintDesignFontFamily(family?: string): string;
|
|
2277
2308
|
|
|
2278
2309
|
/** `debug: true` 使用的默认调试配置。 */
|
|
2279
2310
|
declare const DEFAULT_PRINT_DESIGN_DEBUG_OPTIONS: {
|
|
@@ -2304,6 +2335,6 @@ interface PrintDesignRecordCollection {
|
|
|
2304
2335
|
/** 识别包含记录数组的对象,不把普通对象当作数据行。 */
|
|
2305
2336
|
declare function isPrintDesignRecordCollection(value: unknown): value is PrintDesignRecordCollection;
|
|
2306
2337
|
|
|
2307
|
-
var version = "0.1.
|
|
2338
|
+
var version = "0.1.12";
|
|
2308
2339
|
|
|
2309
|
-
export { DEFAULT_PRINT_DESIGN_DEBUG_OPTIONS, type ElementDrawContext, PRINT_DESIGN_CSS_DPI, PRINT_DESIGN_DEFAULT_FONT_FAMILY, PRINT_DESIGN_MM_PER_INCH, PRINT_DESIGN_SCHEMA_VERSION, PRINT_DESIGN_UNIT_MM, version as PRINT_DESIGN_VERSION, PrintDesign, type PrintDesignAgentApi, type PrintDesignAgentComponentCatalog, type PrintDesignAgentToolDefinition, type PrintDesignComponentBoundaryResize, type PrintDesignComponentCellContextTarget, type PrintDesignComponentCellEditor, type PrintDesignComponentCellHit, type PrintDesignComponentCellSelection, type PrintDesignComponentCellSelectionBehavior, type PrintDesignComponentCellSelectionContext, type PrintDesignComponentCellSelectionState, type PrintDesignComponentClickContext, type PrintDesignComponentCommands, type PrintDesignComponentConnection, type PrintDesignComponentCrop, type PrintDesignComponentDebugContext, type PrintDesignComponentDebugRegion, type PrintDesignComponentEditHandleContext, type PrintDesignComponentHandleContext, type PrintDesignComponentHandleDrag, type PrintDesignComponentHitContext, type PrintDesignComponentPathDrawing, type PrintDesignComponentPointerContext, type PrintDesignComponentPointerStroke, PrintDesignComponentRegistry, type PrintDesignComponentRenderer, type PrintDesignComponentResource, type PrintDesignComponentSelectionContext, type PrintDesignComponentSelector, type PrintDesignComponentSelectorDrawContext, type PrintDesignComponentSourceCreate, type PrintDesignConnectionAnchorContext, type PrintDesignConnectionCreateHandle, type PrintDesignCropRect, type PrintDesignDataField, type PrintDesignDebugOptions, type PrintDesignDocument, type PrintDesignElement, type PrintDesignElementBase, type PrintDesignElementTypeMap, type PrintDesignExportOptions, type PrintDesignHtmlOptions, type PrintDesignInlineTextEditor, type PrintDesignInlineTextPresentation, type PrintDesignLayerAlignment, type PrintDesignLayerNode, type PrintDesignOptions, type PrintDesignOrientation, type PrintDesignPage, type PrintDesignPageMargins, type PrintDesignPluginRenderer, type PrintDesignRecordCollection, type PrintDesignSelection, type PrintDesignToolDebugContribution, type PrintDesignToolDebugRegion, type PrintDesignUnit, type TransformPoint, buildPrintDesignLayerTree, builtinPrintDesignComponentRegistry, canvasPointToPageMillimeters, clonePrintDesignDocument, createPrintDesignAgentApi, createPrintDesignDocument, createPrintDesignId, createPrintDesignPage, createPrintDesignPrintFrame, cssColor, cssFont, cssNumber, definePrintDesignComponentRenderer, definePrintDesignPluginRenderer, drawPrintDesignElement, drawPrintDesignPage, elementTransformCss, elementTransformHomography, escapeHtml, formatDisplayUnit, fromDisplayUnit, getPrintDesignAlignmentUnits, getPrintDesignDataFields,
|
|
2340
|
+
export { DEFAULT_PRINT_DESIGN_DEBUG_OPTIONS, type ElementDrawContext, PRINT_DESIGN_CSS_DPI, PRINT_DESIGN_DEFAULT_FONT_FAMILY, PRINT_DESIGN_MM_PER_INCH, PRINT_DESIGN_SCHEMA_VERSION, PRINT_DESIGN_UNIT_MM, version as PRINT_DESIGN_VERSION, PrintDesign, type PrintDesignAgentApi, type PrintDesignAgentComponentCatalog, type PrintDesignAgentToolDefinition, type PrintDesignComponentBoundaryResize, type PrintDesignComponentCellContextTarget, type PrintDesignComponentCellEditor, type PrintDesignComponentCellHit, type PrintDesignComponentCellSelection, type PrintDesignComponentCellSelectionBehavior, type PrintDesignComponentCellSelectionContext, type PrintDesignComponentCellSelectionState, type PrintDesignComponentClickContext, type PrintDesignComponentCommands, type PrintDesignComponentConnection, type PrintDesignComponentCrop, type PrintDesignComponentDebugContext, type PrintDesignComponentDebugRegion, type PrintDesignComponentEditHandleContext, type PrintDesignComponentHandleContext, type PrintDesignComponentHandleDrag, type PrintDesignComponentHitContext, type PrintDesignComponentPathDrawing, type PrintDesignComponentPointerContext, type PrintDesignComponentPointerStroke, PrintDesignComponentRegistry, type PrintDesignComponentRenderer, type PrintDesignComponentResource, type PrintDesignComponentSelectionContext, type PrintDesignComponentSelector, type PrintDesignComponentSelectorDrawContext, type PrintDesignComponentSourceCreate, type PrintDesignConnectionAnchorContext, type PrintDesignConnectionCreateHandle, type PrintDesignCropRect, type PrintDesignDataField, type PrintDesignDebugOptions, type PrintDesignDocument, type PrintDesignElement, type PrintDesignElementBase, type PrintDesignElementTypeMap, type PrintDesignExportOptions, type PrintDesignHtmlOptions, type PrintDesignInlineTextEditor, type PrintDesignInlineTextPresentation, type PrintDesignLayerAlignment, type PrintDesignLayerNode, type PrintDesignOptions, type PrintDesignOrientation, type PrintDesignPage, type PrintDesignPageMargins, type PrintDesignPluginRenderer, type PrintDesignRecordCollection, type PrintDesignSelection, type PrintDesignToolDebugContribution, type PrintDesignToolDebugRegion, type PrintDesignUnit, type TransformPoint, buildPrintDesignLayerTree, builtinPrintDesignComponentRegistry, canvasPointToPageMillimeters, clonePrintDesignDocument, createPrintDesignAgentApi, createPrintDesignDocument, createPrintDesignId, createPrintDesignPage, createPrintDesignPrintFrame, cssColor, cssFont, cssNumber, definePrintDesignComponentRenderer, definePrintDesignPluginRenderer, drawPrintDesignElement, drawPrintDesignPage, elementTransformCss, elementTransformHomography, escapeHtml, formatDisplayUnit, fromDisplayUnit, getPrintDesignAlignmentUnits, getPrintDesignDataFields, getPrintDesignElementDataConfig, getPrintDesignPageSize, getSelectionRect, hitTestPrintDesignPage, inverseTransformPoint, isPrintDesignColorValue, isPrintDesignRecordCollection, materializePrintDesignDocument, millimetersToPixels, paginatePrintDesignDocument, parsePrintDesignDocument, pixelsToMillimeters, preparePrintDesignCanvasPage, printDesignAgentTools, printPrintDesignHtml, printPrintDesignHtmlInFrame, projectTransformPoint, renderPrintDesignHtmlFrame, renderPrintDesignPageToCanvas, resolveDesignText, resolvePrintDesignBinding, resolvePrintDesignDataPath, resolvePrintDesignDebugOptions, resolvePrintDesignElementData, resolvePrintDesignElementVisible, resolvePrintDesignFontFamily, resolvePrintDesignPageVisible, rotatePoint, serializePrintDesignDocument, stringifyPrintDesignBinding, toDisplayUnit, transformPrintDesignToHtml, transformPrintDesignToHtmlAsync, transformPrintDesignToHtmlBatches, transformRect };
|