@gct-paas/word 0.1.13 → 0.1.14

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.
@@ -63,8 +63,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
63
63
  onChange?: ((val: string | number | (string | number)[], item?: DropdownOption | undefined) => any) | undefined;
64
64
  "onUpdate:modelValue"?: ((val: string | number | (string | number)[]) => any) | undefined;
65
65
  }>, {
66
- placeholder: string;
67
66
  options: DropdownOption[];
67
+ placeholder: string;
68
68
  popperWidth: number;
69
69
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
70
70
  dropdownRef: import('vue').CreateComponentPublicInstanceWithMixins<Record<string, any> & {}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, false, {}, {}, {}, {}, string, {}, any, import('vue').ComponentProvideOptions, {
@@ -5,6 +5,7 @@ export declare class InputComposition {
5
5
  private modelType?;
6
6
  private wrid?;
7
7
  private cloneNode?;
8
+ private widgetCloneNode?;
8
9
  constructor(doc: Doc, text: string);
9
10
  create(text: string): void;
10
11
  update(text: string): {
@@ -15,7 +16,7 @@ export declare class InputComposition {
15
16
  beforeDestroy(text: string): {
16
17
  nodeId: string;
17
18
  offset: number;
18
- side: "before" | "after";
19
+ side: any;
19
20
  } | null;
20
21
  destroy(): void;
21
22
  }
@@ -40,6 +40,7 @@ export declare abstract class CommandBase<T extends CommandType = CommandType> i
40
40
  payload?: CommandPayloadMap[T];
41
41
  private snapshot?;
42
42
  protected postCommandContext: PostCommandContext;
43
+ private commandRaf;
43
44
  /** 终止指令 */
44
45
  isTerminated: boolean;
45
46
  /** 重新刷新布局 */
@@ -4,6 +4,7 @@ export { usePagesToPdf } from './sdk/usePagesToPdf';
4
4
  export { useInteraction } from './interaction/useInteraction';
5
5
  export { formulaUtils } from './utils/calculate-formula';
6
6
  export { resolveWidgetState } from './widget/widget-state';
7
+ export { validateTextWidgetMarker } from './layout/logic/LayoutBuilder';
7
8
  export { CommandType } from './command/types';
8
9
  export { ModelConverter } from './model';
9
10
  export { DocumentEventBridge } from './event/DocumentEventBridge';
@@ -15,6 +15,7 @@ export declare class BaseHandler {
15
15
  label: string;
16
16
  type: 'placeholder' | 'fieldName' | 'noneLabel' | 'default';
17
17
  };
18
+ static formatDateTimeValue(ctx: HandlerContext, valuePath: string): any;
18
19
  /**
19
20
  * 渲染组件值 label -> value
20
21
  * @param ctx
@@ -63,5 +64,15 @@ export declare class BaseHandler {
63
64
  };
64
65
  extra?: Partial<TextWidget>;
65
66
  }): void;
67
+ /**
68
+ * 渲染时增加文本
69
+ * @param payload
70
+ */
71
+ static addFieldMarker(payload: {
72
+ ctx: HandlerContext;
73
+ fontSize: number;
74
+ extra?: Partial<TextWidget>;
75
+ position: 'left' | 'right';
76
+ }): void;
66
77
  }
67
78
  export {};
@@ -1,4 +1,5 @@
1
1
  import { BuiltinComponentType } from '../../constants';
2
+ import { TextWidget } from '../../view/runs/TextWidget';
2
3
  import { Page } from '../../view/Page';
3
4
  import { BaseMetaNode, LineInfo } from '../types';
4
5
  export declare function buildLayoutMeta(pages: Page[]): {
@@ -12,5 +13,16 @@ export declare function buildLayoutMeta(pages: Page[]): {
12
13
  export declare function isAtom(component: BuiltinComponentType): boolean;
13
14
  /** 判断是否为占位符文本原子节点 */
14
15
  export declare function isPlaceholderNode(node: any): boolean;
15
- /** 判断是否点击是组件节点 */
16
- export declare function isClickSelectAllNode(node: BaseMetaNode): boolean;
16
+ /**
17
+ * 判断是否点击是组件节点
18
+ * @param node - 节点
19
+ * @param checkMarker - 是否需要校验 widgetFieldLeftMarker / RightMarker,默认 true
20
+ */
21
+ export declare function isClickSelectAllNode(node: BaseMetaNode, checkMarker?: boolean): boolean;
22
+ /**
23
+ * 校验文本组件是否符合选中规则
24
+ * @param raw - 文本组件原始数据
25
+ * @param checkMarker - 是否校验左右标记位
26
+ * @returns 符合规则返回 true,否则返回 false
27
+ */
28
+ export declare function validateTextWidgetMarker(raw: TextWidget, checkMarker: boolean): boolean;
@@ -48,4 +48,16 @@ export declare class Wp extends ModelGroup {
48
48
  * - newWp 被插入到 this 的后面(在父容器中)
49
49
  */
50
50
  splitAt(index: number): [Wp | null, Wp | null];
51
+ /**
52
+ * 确保 rPr 实例存在,如果不存在则创建一个新的 WrPr 实例
53
+ */
54
+ private ensurePPr;
55
+ /**
56
+ * 设置段落对齐方式
57
+ * @param alignment 对齐方式 ('left' | 'center' | 'right' | 'justify' 等)
58
+ *
59
+ * @example
60
+ * wp.setAlignment('center');
61
+ */
62
+ setAlignment(alignment: string): void;
51
63
  }
@@ -87,6 +87,19 @@ export declare class WpPr extends ModelNode {
87
87
  * wpPr.setElement({ name: 'w:pStyle', type: 'element', '@attrs': { 'w:val': 'Heading1' } });
88
88
  */
89
89
  setElement(element: RawElement): void;
90
+ /**
91
+ * 设置或更新指定元素的属性值
92
+ * 如果元素不存在则创建,如果属性已存在则更新
93
+ *
94
+ * @param elementName - 元素名称,如 'w:jc'、'w:ind'
95
+ * @param attrName - 属性名称,如 'w:val'、'w:left'
96
+ * @param value - 属性值
97
+ *
98
+ * @example
99
+ * wpPr.setAttr('w:jc', 'w:val', 'center'); // 设置对齐方式为居中
100
+ * wpPr.setAttr('w:ind', 'w:left', '720'); // 设置左缩进
101
+ */
102
+ setAttr(elementName: string, attrName: string, value: string): void;
90
103
  /**
91
104
  * 删除指定名称的子元素
92
105
  *
@@ -20,6 +20,8 @@ export interface ITextWidget extends ITextRun {
20
20
  index: number;
21
21
  value: string;
22
22
  };
23
+ widgetFieldLeftMarker?: boolean;
24
+ widgetFieldRightMarker?: boolean;
23
25
  }
24
26
  export interface TextWidgetOptions extends TextRunOptions {
25
27
  /** 组件元数据 */
@@ -32,6 +34,8 @@ export interface TextWidgetOptions extends TextRunOptions {
32
34
  isSpacePlaceholder?: boolean;
33
35
  widgetOption?: ITextWidget['widgetOption'];
34
36
  widgetFileItem?: ITextWidget['widgetFileItem'];
37
+ widgetFieldLeftMarker?: boolean;
38
+ widgetFieldRightMarker?: boolean;
35
39
  }
36
40
  export declare class TextWidget extends TextRun implements ITextWidget {
37
41
  widgetMeta: WidgetMeta;
@@ -39,6 +43,8 @@ export declare class TextWidget extends TextRun implements ITextWidget {
39
43
  isEmptyPlaceholder: boolean;
40
44
  isIconPlaceholder: boolean;
41
45
  isSpacePlaceholder: boolean;
46
+ widgetFieldLeftMarker?: boolean;
47
+ widgetFieldRightMarker?: boolean;
42
48
  widgetOption?: ITextWidget['widgetOption'];
43
49
  widgetFileItem?: ITextWidget['widgetFileItem'];
44
50
  constructor(options: TextWidgetOptions);
@@ -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' | 'render:gct-signature';
3
+ export type ExternalNodeType = 'render:gct-placeholder' | 'render:gct-control' | 'render:gct-space' | 'render:gct-text' | 'render:gct-image' | 'render:gct-signature' | 'render:gct-leftMarker' | 'render:gct-rightMarker';
4
4
  /** 渲染节点集合 */
5
5
  export interface FieldNodeRenderers {
6
6
  /** 暗提示节点 */
@@ -11,4 +11,8 @@ export interface FieldNodeRenderers {
11
11
  space: ExternalNodeType;
12
12
  /** 文本节点 */
13
13
  text: ExternalNodeType;
14
+ /** 字段左侧框选标记 */
15
+ leftMarker: ExternalNodeType;
16
+ /** 字段右侧框选标记 */
17
+ rightMarker: ExternalNodeType;
14
18
  }