@gct-paas/word 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.
Files changed (31) hide show
  1. package/dist/base/utils/image-size-util.d.ts +2 -0
  2. package/dist/core/constants/index.d.ts +1 -0
  3. package/dist/core/cursor/logic/getCursorTextRawList.d.ts +2 -0
  4. package/dist/core/cursor/logic/index.d.ts +1 -0
  5. package/dist/core/event/types.d.ts +1 -1
  6. package/dist/core/interaction/useInteraction.d.ts +0 -1
  7. package/dist/core/layout/LayoutContext.d.ts +1 -0
  8. package/dist/core/layout/handlers/FieldHandler.d.ts +3 -0
  9. package/dist/core/layout/handlers/fields/image.d.ts +1 -0
  10. package/dist/core/layout/handlers/fields/signature.d.ts +1 -0
  11. package/dist/core/model/document/WrField.d.ts +3 -126
  12. package/dist/core/view/Doc.d.ts +5 -0
  13. package/dist/core/view/runs/ImageWidget.d.ts +3 -0
  14. package/dist/domain/active/active-types.d.ts +0 -1
  15. package/dist/domain/widget/component-type.d.ts +1 -1
  16. package/dist/index.d.ts +2 -0
  17. package/dist/index.es.js +2053 -1297
  18. package/dist/runtime/_register_/composables/panel/useActivePanel.d.ts +1 -2
  19. package/dist/runtime/canvas/table/design/table-structure-overlay/dynamic-label.vue.d.ts +1 -0
  20. package/dist/runtime/canvas/table/utils/useTableSelection.d.ts +0 -1
  21. package/dist/runtime/designer/ribbon/common/button-icon.vue.d.ts +3 -2
  22. package/dist/runtime/designer/ribbon/constant/font.d.ts +1 -1
  23. package/dist/runtime/factories/useDocumentFactory.d.ts +2 -0
  24. package/dist/runtime/factories/useFormValidator.d.ts +3 -0
  25. package/dist/runtime/interface/utils.d.ts +2 -0
  26. package/dist/runtime/renderer/doc-render-layout.vue.d.ts +58 -2
  27. package/dist/runtime/renderer/main/preview-canvas.vue.d.ts +3 -1
  28. package/dist/word.css +156 -146
  29. package/package.json +1 -1
  30. package/dist/runtime/designer/ribbon/components/bullet-point-select.vue.d.ts +0 -73
  31. package/dist/runtime/designer/ribbon/components/multistage-no-select.vue.d.ts +0 -73
@@ -16,3 +16,5 @@ export interface ImageSizeOptions {
16
16
  * 根据图片原始尺寸 + 配置,计算最终显示尺寸
17
17
  */
18
18
  export declare function computeImageDisplaySize(natural: ImageSize, opts?: ImageSizeOptions): ImageSize;
19
+ /** 创建签名图片 */
20
+ export declare function createSignatureImage(name: string, width: number, height: number): Promise<unknown>;
@@ -53,5 +53,6 @@ export declare const DEFAULT_PAGE_SIZE: {
53
53
  export declare const DEFAULT_PAGE_PADDING: [number, number, number, number];
54
54
  export declare const DEFAULT_CELL_PADDING: [number, number, number, number];
55
55
  export declare const DEFAULT_FONT_SIZE = 16;
56
+ export declare const DEFAULT_FONT_FAMILY = "Roboto,RobotoDraft,Helvetica,Arial,sans-serif";
56
57
  export declare const DEFAULT_TEXT_COLOR = "black";
57
58
  export declare const ZERO_WIDTH_SPACE = "\u200B";
@@ -0,0 +1,2 @@
1
+ import { Doc } from '../../view/Doc';
2
+ export declare const getCursorTextRawList: (doc: Doc, cursorEventType: string) => any[];
@@ -2,6 +2,7 @@ import { Doc } from '../../view/Doc';
2
2
  import { HitIntentResult, HitResult } from '../hit/types';
3
3
  import { ICursorPosition } from '../types/cursor';
4
4
  export { getCursorCoords } from './getCursorCoords';
5
+ export { getCursorTextRawList } from './getCursorTextRawList';
5
6
  export { getSelectionRects } from './getSelectionRects';
6
7
  export { getSelectLinesInfo } from './selectionAnalyzer';
7
8
  export { getImmediateNeighborNode, findFirstAtomBeyond, isAtBoundaryOfNode, findTargetLineId, locateByX, } from './layoutNavigation';
@@ -65,4 +65,4 @@ export type MoveOpts = Pick<KeydownOpts, 'dir' | 'shift' | 'ctrl'>;
65
65
  * 定义了系统中所有需要进行分发/调度的事件类型标识
66
66
  */
67
67
  export type DispatchEventType = 'ime:compositionstart' | 'ime:compositionupdate' | 'ime:compositionend' | 'ime:input' | 'ime:paste' | 'ime:focus' | 'ime:blur' | 'ime:keydown' | 'caret:locate' | 'konva:click' | 'konva:dragstart' | 'konva:dragmove' | 'konva:dragend' | 'konva:contextmenu' | 'inter:str' | 'inter:stc' | 'inter:stall' | 'inter:active' | 'inter:chg-hmid';
68
- export type EventBusType = 'autoScroll:start' | 'autoScroll:move' | 'autoScroll:stop' | 'caret:changed' | 'caret:requestScroll' | 'cursor:change' | 'tableSelection:change' | 'dragHoverId:change' | 'hoverModelId:change' | 'focusModelId:change' | 'panelData:change';
68
+ export type EventBusType = 'autoScroll:start' | 'autoScroll:move' | 'autoScroll:stop' | 'caret:changed' | 'caret:requestScroll' | 'cursor:change' | 'cursor:changed' | 'tableSelection:change' | 'dragHoverId:change' | 'hoverModelId:change' | 'focusModelId:change' | 'panelData:change';
@@ -15,7 +15,6 @@ export declare function useInteraction(publicDocApi: Ref<EnginePublic | null>):
15
15
  readonly widgetId?: string | undefined;
16
16
  readonly modelId?: string | undefined;
17
17
  readonly context: {
18
- readonly pageName?: string | undefined;
19
18
  readonly mainModelKey?: string | undefined;
20
19
  readonly subFieldKey?: string | undefined;
21
20
  readonly regionId?: string | undefined;
@@ -32,6 +32,7 @@ export declare class LayoutContext {
32
32
  ensureCellParagraphSpace(itemWidth: number): void;
33
33
  ensurePageParagraphSpace(itemWidth: number, itemHeight: number): void;
34
34
  ensureParagraphSpace(itemWidth: number, itemHeight: number): void;
35
+ insertLineBreak(): void;
35
36
  createNewPage(payload?: Partial<PageOptions>): Page;
36
37
  createNewParagraph(y?: number): Paragraph;
37
38
  resetModelRef(id: string): void;
@@ -15,9 +15,12 @@ export declare class FieldHandler {
15
15
  private static addOptionLabel;
16
16
  private static addOptionIcon;
17
17
  static layoutWidgetOption(context: LayoutContext, wr: WrText, option: WidgetOption, optionIndex: number): void;
18
+ static isVerticalLayout(wr: WrText): boolean;
18
19
  static layoutWidgetOptions(context: LayoutContext, wr: WrText): void;
19
20
  static layoutWidgetLabel(context: LayoutContext, wr: WrText): void;
21
+ static getNoValueLabel(wr: WrText): string;
20
22
  static layoutWidgetInput(context: LayoutContext, wr: WrText): void;
21
23
  static layoutWidgetImage(context: LayoutContext, wr: WrText): void;
24
+ static layoutWidgetSignature(context: LayoutContext, wr: WrText): void;
22
25
  }
23
26
  export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,131 +1,8 @@
1
- import { Wp } from './Wp';
2
- import { TextStyle, RawElement, WordHighlight } from '../types';
3
- import { WidgetMeta } from '../../widget/widget-meta';
4
- import { WrPr } from './WrPr';
5
- import { ModelNode, ModelNodeOptions } from '../base';
6
- type IElement = ModelNode | RawElement;
7
- /**
8
- * 文本块实例类
9
- */
10
- export declare class WrField extends ModelNode {
11
- name: 'w:r';
12
- type: "element";
13
- handler: "field";
14
- /** 父节点引用 */
15
- parent?: Wp;
16
- rPr?: WrPr;
17
- text: string;
18
- isComposition?: boolean;
19
- isPlaceholder?: boolean;
20
- elements?: IElement[];
21
- widgetMeta?: WidgetMeta;
22
- valuePath?: string;
23
- constructor(options: ModelNodeOptions & {
24
- text: string;
25
- rPr?: WrPr;
26
- elements?: IElement[];
27
- isComposition?: boolean;
28
- isPlaceholder?: boolean;
29
- widgetMeta?: WidgetMeta;
30
- valuePath?: string;
31
- });
32
- /**
33
- * 在指定位置插入文本
34
- * @param text 要插入的文本
35
- * @param position 插入位置,默认在末尾
36
- */
37
- insertText(text: string, position?: number): void;
38
- /**
39
- * 删除指定范围的文本
40
- * @param start 开始位置
41
- * @param length 删除长度,默认为 1
42
- */
43
- deleteText(start: number, length?: number): void;
44
- /**
45
- * 替换指定范围的文本
46
- * @param start 开始位置
47
- * @param length 替换长度
48
- * @param newText 新文本
49
- */
50
- replaceText(start: number, length: number, newText: string): void;
51
- /**
52
- * 确保 rPr 实例存在,如果不存在则创建一个新的 WrPr 实例
53
- */
54
- private ensureRPr;
55
- /**
56
- * 设置高亮
57
- * @param highlight 颜色值(hex 格式,如 '#ff0000')
58
- */
59
- setHighlight(highlight: WordHighlight): void;
60
- /**
61
- * 设置文本颜色
62
- * @param color 颜色值(hex 格式,如 '#ff0000')
63
- */
64
- setColor(color: string): void;
65
- /**
66
- * 设置文本加粗
67
- * @param bold 是否加粗
68
- */
69
- setBold(bold: boolean): void;
70
- /**
71
- * 设置文本斜体
72
- * @param italic 是否斜体
73
- */
74
- setItalic(italic: boolean): void;
75
- /**
76
- * 设置文本下划线
77
- * @param underline 下划线类型('none' | 'single' | 'double' 等)
78
- */
79
- setUnderline(underline?: string): void;
80
- /**
81
- * 设置文本删除线
82
- * @param strike 是否删除线
83
- */
84
- setStrike(strike: boolean): void;
85
- /**
86
- * 设置字体
87
- * @param fontFamily 字体名称
88
- */
89
- setFont(fontFamily: string): void;
90
- /**
91
- * 设置字号
92
- * @param fontSize 字号大小(半磅单位)
93
- */
94
- setFontSize(fontSize: number): void;
95
- /**
96
- * 设置样式
97
- * @param styleUpdates 要更新的样式对象(只更新指定的属性)
98
- */
99
- updateStyle(styleUpdates: Partial<TextStyle>): void;
100
- /**
101
- * 在指定字符位置拆分文本节点
102
- * @param index 拆分位置(在此字符之前分割)
103
- * @returns 返回 [beforeText, afterText],边界情况返回 null
104
- * @example
105
- * const text = new WrText('Hello World');
106
- * const [before, after] = text.splitAt(5);
107
- * // before: WrText('Hello'),after: WrText(' World')
108
- * const [n, all] = text.splitAt(0);
109
- * // n 为 null,all 为 this(无分割)
110
- */
111
- splitAt(index: number): [WrText | null, WrText | null];
112
- /**
113
- * 从原始 XML JSON 转换为 WrText 实例
114
- * @param json w:r XML JSON 对象
115
- * @returns WrText 实例
116
- */
1
+ import { RawElement } from '../types';
2
+ import { WrText } from './WrText';
3
+ export declare class WrField extends WrText {
117
4
  static fromXmlJson(json: RawElement & {
118
5
  valuePath?: string;
119
6
  widgetMeta?: any;
120
7
  }): WrField;
121
- /**
122
- * 将实例转换为 XML JSON 格式
123
- * 结构:w:r
124
- * ├── w:rPr(如果存在)
125
- * ├── w:t(文本内容)
126
- * └── 其他元素
127
- * @returns XML JSON 对象
128
- */
129
- toXmlJson(): RawElement;
130
8
  }
131
- export {};
@@ -14,6 +14,7 @@ import { DocModel } from '../model';
14
14
  export interface DocInitOptions {
15
15
  mode?: DocModeType;
16
16
  model?: DocModel;
17
+ preview?: boolean;
17
18
  mainModelKey: ModelKey;
18
19
  pageSize?: {
19
20
  width: number;
@@ -25,7 +26,10 @@ export interface DocInitOptions {
25
26
  }
26
27
  export declare class Doc {
27
28
  id: string;
29
+ /** 渲染模式 */
28
30
  mode: DocModeType;
31
+ /** 是否是预览模式 */
32
+ preview: boolean;
29
33
  model?: DocModel;
30
34
  sections: Section[];
31
35
  pages: Page[];
@@ -71,6 +75,7 @@ export declare class Doc {
71
75
  getFirstPage(): Page | null;
72
76
  getLastPage(): Page | null;
73
77
  setModel(model: DocModel): void;
78
+ setMode(modeType: DocModeType): void;
74
79
  /** 触发布局计算 */
75
80
  layout(): void;
76
81
  /** 渲染文档 */
@@ -8,12 +8,14 @@ export interface IImageWidget extends IImageRun {
8
8
  valuePath: string;
9
9
  /** 组件元数据 */
10
10
  widgetMeta: WidgetMeta;
11
+ signature?: string;
11
12
  }
12
13
  export interface ImageWidgetOptions extends ImageRunOptions {
13
14
  /** 值路径 */
14
15
  valuePath: string;
15
16
  /** 组件元数据 */
16
17
  widgetMeta: WidgetMeta;
18
+ signature?: string;
17
19
  }
18
20
  /**
19
21
  * 图片运行类
@@ -22,5 +24,6 @@ export interface ImageWidgetOptions extends ImageRunOptions {
22
24
  export declare class ImageWidget extends ImageRun implements IImageWidget {
23
25
  valuePath: string;
24
26
  widgetMeta: WidgetMeta;
27
+ signature?: string;
25
28
  constructor(options: ImageWidgetOptions);
26
29
  }
@@ -19,7 +19,6 @@ export type PanelType =
19
19
  /** 组件 */
20
20
  | 'panel:widget';
21
21
  type ActiveContext = {
22
- pageName: string;
23
22
  mainModelKey: string;
24
23
  subFieldKey: string | undefined;
25
24
  regionId: string;
@@ -1,6 +1,6 @@
1
1
  export type ExternalComponentType = 'fw:input' | 'fw:number' | 'fw:double' | 'fw:enum' | 'fw:enum-multiple' | 'fw:date-time' | 'fw:date' | 'fw:time' | 'fw:select' | 'fw:select-multiple' | 'fw:tree-select' | 'fw:tree-select-multiple' | 'fw:table-select' | 'fw:rdo-table-select' | 'fw:signature' | 'fw:image' | 'fw:file' | 'pw:image' | 'pw:barcode' | 'pw:qrcode' | 'pw:diagonal' | 'pw:serialnumber';
2
2
  /** 渲染组件标识 后续支持自定义组件 */
3
- export type ExternalNodeType = 'render:gct-placeholder' | 'render:gct-control' | 'render:gct-space' | 'render:gct-text' | 'render:gct-image';
3
+ export type ExternalNodeType = 'render:gct-placeholder' | 'render:gct-control' | 'render:gct-space' | 'render:gct-text' | 'render:gct-image' | 'render:gct-signature';
4
4
  /** 渲染节点集合 */
5
5
  export interface FieldNodeRenderers {
6
6
  /** 暗提示节点 */
package/dist/index.d.ts CHANGED
@@ -4,5 +4,7 @@ export { default as DocRenderLayout } from './runtime/renderer/doc-render-layout
4
4
  export { GctLayout } from './base';
5
5
  export { registerEdhrSuite } from './suites/edhr';
6
6
  export { useDocEngine } from './runtime/useDocEngine';
7
+ export { getSubmitFormData } from './runtime/interface/utils';
8
+ export { validateAllFields } from './runtime/factories/useFormValidator';
7
9
  export * from './setup';
8
10
  export type { DocModeType, CompleteComponentType, BuiltinComponentType } from './core';