@gct-paas/word 0.1.18 → 0.1.20

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 (33) hide show
  1. package/dist/base/calendar/src/calendar.vue.d.ts +6 -4
  2. package/dist/base/calendar/src/time.vue.d.ts +1 -0
  3. package/dist/core/command/commands/Backspace.d.ts +2 -0
  4. package/dist/core/command/commands/MergeCells.d.ts +7 -1
  5. package/dist/core/command/commands/SetDataGroup2D.d.ts +3 -11
  6. package/dist/core/command/commands/UnmergeCells.d.ts +7 -1
  7. package/dist/core/interaction/InteractionController.d.ts +1 -0
  8. package/dist/core/interaction/types.d.ts +1 -0
  9. package/dist/core/interaction/useInteraction.d.ts +1 -0
  10. package/dist/core/layout/handlers/fields/BaseHandler.d.ts +1 -1
  11. package/dist/core/model/base/ModelGroup.d.ts +6 -0
  12. package/dist/core/model/document/Wtc.d.ts +1 -0
  13. package/dist/core/model/document/Wtr.d.ts +2 -2
  14. package/dist/core/model/document/WtrPr.d.ts +13 -1
  15. package/dist/core/view/TableRow.d.ts +3 -0
  16. package/dist/core/view/utils/TextUtil.d.ts +17 -0
  17. package/dist/index.es.js +1481 -866
  18. package/dist/runtime/canvas/__common__/context-menu/index.type.d.ts +3 -0
  19. package/dist/runtime/canvas/__common__/context-menu/index.vue.d.ts +2 -1
  20. package/dist/runtime/canvas/__common__/context-menu/table-menu.vue.d.ts +6 -1
  21. package/dist/runtime/canvas/doc-layout.vue.d.ts +3 -1
  22. package/dist/runtime/canvas/table/utils/useTableSelection.d.ts +1 -0
  23. package/dist/runtime/designer/main/editable-canvas.vue.d.ts +3 -1
  24. package/dist/runtime/renderer/main/preview-canvas.vue.d.ts +3 -1
  25. package/dist/sdk/doc-runtime/composables/useDocOperations.d.ts +6 -0
  26. package/dist/sdk/engine/index.d.ts +1 -1
  27. package/dist/sdk/types/index.d.ts +8 -1
  28. package/dist/sdk/vue/layouts/doc-design-layout.vue.d.ts +2 -1
  29. package/dist/sdk/vue/layouts/doc-render-layout.vue.d.ts +3 -1
  30. package/dist/utils/composables/useDragLine.d.ts +18 -0
  31. package/dist/utils/func/form.d.ts +5 -0
  32. package/dist/word.css +343 -292
  33. package/package.json +1 -1
@@ -8,15 +8,17 @@ type __VLS_Props = {
8
8
  minDate?: string | number | Date;
9
9
  maxDate?: string | number | Date;
10
10
  timeFormat?: 'HH:mm:ss' | 'HH:mm' | 'HH';
11
+ showClearBtn?: boolean;
11
12
  };
12
13
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
13
- change: (value: Date) => any;
14
- "update:modelValue": (value: Date) => any;
14
+ change: (value: Date | null) => any;
15
+ "update:modelValue": (value: Date | null) => any;
15
16
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
16
- onChange?: ((value: Date) => any) | undefined;
17
- "onUpdate:modelValue"?: ((value: Date) => any) | undefined;
17
+ onChange?: ((value: Date | null) => any) | undefined;
18
+ "onUpdate:modelValue"?: ((value: Date | null) => any) | undefined;
18
19
  }>, {
19
20
  mode: "datetime" | "date";
21
+ showClearBtn: boolean;
20
22
  weekStart: number;
21
23
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
22
24
  export default _default;
@@ -2,6 +2,7 @@ type __VLS_Props = {
2
2
  modelValue: string | undefined;
3
3
  disabled?: boolean;
4
4
  format?: 'HH:mm:ss' | 'HH:mm' | 'HH';
5
+ showClearBtn?: boolean;
5
6
  disabledTime?: () => {
6
7
  disabledHours?: () => number[];
7
8
  disabledMinutes?: (hour: number) => number[];
@@ -30,6 +30,8 @@ export declare class Backspace extends CommandBase<'backspace'> {
30
30
  * 处理组件 run 的删除
31
31
  */
32
32
  private handleWidgetRun;
33
+ /** 处理悬浮 run 的删除 */
34
+ private handleOverlayPageWidgetRun;
33
35
  /**
34
36
  * 处理位置 >= 0 的删除情况
35
37
  */
@@ -1,12 +1,18 @@
1
1
  import { CommandBase } from '../base/CommandBase';
2
2
  import { Doc } from '../../view/Doc';
3
- import { WrText } from '../../model/document';
3
+ import { Wp, WrText } from '../../model/document';
4
4
  import { CommandPayloadMap } from '../types';
5
5
  export declare class MergeCells extends CommandBase<'mergeCells'> {
6
6
  constructor(doc: Doc, payload?: CommandPayloadMap['mergeCells']);
7
7
  protected execute(): Promise<{
8
+ wp: Wp;
9
+ pos: number;
10
+ side: string;
11
+ wr?: undefined;
12
+ } | {
8
13
  wr: WrText | undefined;
9
14
  pos: number;
10
15
  side: string;
16
+ wp?: undefined;
11
17
  } | null>;
12
18
  }
@@ -1,7 +1,7 @@
1
1
  import { CommandBase, PostCommandContext } from '../base/CommandBase';
2
2
  import { Doc } from '../../view/Doc';
3
3
  import { Wtc } from '../../model/document';
4
- import { CheckTableRegion, _2DTableRegion, Region } from '../../model/logic';
4
+ import { CheckTableRegion, _2DTableRegion } from '../../model/logic';
5
5
  import { CommandPayloadMap } from '../types';
6
6
  type DataGroup2DSubTableRegion = CheckTableRegion | _2DTableRegion;
7
7
  export declare class SetDataGroup2D extends CommandBase<'setDataGroup2D'> {
@@ -9,17 +9,9 @@ export declare class SetDataGroup2D extends CommandBase<'setDataGroup2D'> {
9
9
  protected execute(): Promise<PostCommandContext>;
10
10
  /**
11
11
  *
12
- * @param startCell
13
- * @param endCell
12
+ * @param cellList
14
13
  * @returns
15
14
  */
16
- protected getSubTableRegion(startCell: Wtc, endCell: Wtc): DataGroup2DSubTableRegion | undefined;
17
- /**
18
- * 获取公共区域
19
- * @param startCell
20
- * @param endCell
21
- * @returns
22
- */
23
- protected getRegion(startCell: Wtc, endCell: Wtc): Region | undefined;
15
+ protected getSubTableRegion(cellList: Wtc[]): DataGroup2DSubTableRegion | undefined;
24
16
  }
25
17
  export {};
@@ -1,12 +1,18 @@
1
1
  import { CommandBase } from '../base/CommandBase';
2
2
  import { Doc } from '../../view/Doc';
3
- import { WrText } from '../../model/document';
3
+ import { Wp, WrText } from '../../model/document';
4
4
  import { CommandPayloadMap } from '../types';
5
5
  export declare class UnmergeCells extends CommandBase<'unmergeCells'> {
6
6
  constructor(doc: Doc, payload?: CommandPayloadMap['unmergeCells']);
7
7
  protected execute(): Promise<{
8
+ wp: Wp;
9
+ pos: number;
10
+ side: string;
11
+ wr?: undefined;
12
+ } | {
8
13
  wr: WrText | undefined;
9
14
  pos: number;
10
15
  side: string;
16
+ wp?: undefined;
11
17
  } | null | undefined>;
12
18
  }
@@ -7,6 +7,7 @@ export declare class InteractionController {
7
7
  onSelectTableRow(payload: {
8
8
  id: string;
9
9
  index: number;
10
+ realRowIndex: number;
10
11
  }): void;
11
12
  onSelectTableCol(payload: {
12
13
  id: string;
@@ -3,6 +3,7 @@ export type ITableSelection = {
3
3
  tableId: string;
4
4
  axis: 'row' | 'col' | 'all';
5
5
  index: number;
6
+ realRowIndex?: number;
6
7
  } | null;
7
8
  export type InteractionState = {
8
9
  /** 表格选择(行 / 列 / 全选) */
@@ -5,6 +5,7 @@ export declare function useInteraction(docRef: Ref<Doc | null>): {
5
5
  readonly tableId: string;
6
6
  readonly axis: "row" | "col" | "all";
7
7
  readonly index: number;
8
+ readonly realRowIndex?: number | undefined;
8
9
  } | null | undefined;
9
10
  readonly activeTableId?: string | undefined;
10
11
  readonly dragHoverId?: string | undefined;
@@ -20,7 +20,7 @@ export declare class BaseHandler {
20
20
  label: string;
21
21
  type: 'placeholder' | 'fieldName' | 'noneLabel' | 'default';
22
22
  };
23
- static formatDateTimeValue(ctx: HandlerContext, valuePath: string): any;
23
+ static formatFieldValue(ctx: HandlerContext, valuePath: string): any;
24
24
  /**
25
25
  * 渲染组件值 label -> value
26
26
  * @param ctx
@@ -1,5 +1,6 @@
1
1
  import { ModelNode, ModelNodeOptions } from './ModelNode';
2
2
  import { RawElement } from '../types/raw';
3
+ import { Wp } from '../document/Wp';
3
4
  export interface ModelGroupOptions<T = ModelNode | RawElement> extends ModelNodeOptions {
4
5
  children?: T[];
5
6
  }
@@ -52,6 +53,11 @@ export declare abstract class ModelGroup<T = ModelNode | RawElement> extends Mod
52
53
  * @returns 第一个子节点,如果没有子节点则返回 undefined
53
54
  */
54
55
  getFirstChild(): T | undefined;
56
+ /**
57
+ * 深度优先查找第一个段落节点(w:p)
58
+ * @returns 第一个 Wp,如果未找到则返回 undefined
59
+ */
60
+ getFirstWp(): Wp | undefined;
55
61
  /**
56
62
  * 获取最后一个子节点
57
63
  * @returns 最后一个子节点,如果没有子节点则返回 undefined
@@ -89,6 +89,7 @@ export declare class Wtc extends ModelGroup {
89
89
  * @description 保留第一个段落,删除其他段落,使单元格恢复到初始状态
90
90
  */
91
91
  empty(): void;
92
+ clearFieldRuns(): void;
92
93
  /**
93
94
  * 从 XML JSON 创建单元格(返回数组,因为 colspan 会产生多个单元格)
94
95
  */
@@ -2,8 +2,8 @@ import { RawElement } from '../types/raw';
2
2
  import { Wtbl } from './Wtbl';
3
3
  import { Wtc } from './Wtc';
4
4
  import { ModelGroup, ModelGroupOptions } from '../base';
5
- import { WtrPr } from './WtrPr';
6
- type RowHeightRule = 'auto' | 'atLeast' | 'exact';
5
+ import { WtrPr, WtrHeightRule } from './WtrPr';
6
+ type RowHeightRule = WtrHeightRule;
7
7
  /**
8
8
  * w:tr 表格行
9
9
  */
@@ -1,5 +1,11 @@
1
1
  import { RawElement } from '../types/raw';
2
2
  import { ModelNode, ModelNodeOptions } from '../base';
3
+ export type WtrHeightRule = 'auto' | 'atLeast' | 'exact';
4
+ type ToXmlJsonOptions = {
5
+ rowHeight?: number;
6
+ rowHeightRule?: WtrHeightRule;
7
+ syncRowHeight?: boolean;
8
+ };
3
9
  export declare class WtrPr extends ModelNode {
4
10
  /** 节点名称 */
5
11
  name: 'w:trPr';
@@ -21,7 +27,7 @@ export declare class WtrPr extends ModelNode {
21
27
  *
22
28
  * @returns RawElement 格式的 XML JSON
23
29
  */
24
- toXmlJson(): RawElement;
30
+ toXmlJson(options?: ToXmlJsonOptions): RawElement;
25
31
  /**
26
32
  * 获取指定名称的子元素
27
33
  *
@@ -51,5 +57,11 @@ export declare class WtrPr extends ModelNode {
51
57
  * wpPr.removeElement('w:keepNext');
52
58
  */
53
59
  removeElement(name: string): boolean;
60
+ getRowHeight(): {
61
+ rowHeight?: number;
62
+ rowHeightRule?: WtrHeightRule;
63
+ };
64
+ setRowHeight(rowHeight?: number, rowHeightRule?: WtrHeightRule): void;
54
65
  static fromTemplate(): WtrPr;
55
66
  }
67
+ export {};
@@ -4,11 +4,14 @@ import { TableCell } from './TableCell';
4
4
  import { Wtr } from '../model/document';
5
5
  export interface TableRowOptions extends LayoutGroupOptions {
6
6
  allowRowSplit?: boolean;
7
+ /** 记录该行在原始模型表格中的真实行索引(全局索引) */
8
+ realRowIndex?: number;
7
9
  }
8
10
  export declare class TableRow extends LayoutGroup<TableCell> {
9
11
  component: "tableRow";
10
12
  parent: Table;
11
13
  allowRowSplit: boolean;
14
+ realRowIndex: number;
12
15
  constructor(options: TableRowOptions);
13
16
  get width(): number;
14
17
  get height(): number;
@@ -4,6 +4,10 @@ export declare class TextUtil {
4
4
  private static readonly FONT_METRICS_CACHE_LIMIT;
5
5
  /** 布局大小缓存限制 */
6
6
  private static readonly LAYOUT_SIZE_CACHE_LIMIT;
7
+ /** 东亚常见全宽字符块 */
8
+ private static readonly EAST_ASIAN_FULL_WIDTH_REGEX;
9
+ /** 表单/文档中常见的几何符号 */
10
+ private static readonly FULL_WIDTH_SYMBOL_REGEX;
7
11
  private static fontMetricsCache;
8
12
  private static layoutSizeCache;
9
13
  /**
@@ -12,6 +16,19 @@ export declare class TextUtil {
12
16
  * @returns
13
17
  */
14
18
  static isHanChar(char: string): boolean;
19
+ /**
20
+ * 验证是否为应按 1em 处理的全宽单字符
21
+ * @param char
22
+ * @returns
23
+ */
24
+ static isFullWidthChar(char: string): boolean;
25
+ /**
26
+ * 生成文本度量缓存键
27
+ * @param payload
28
+ * @param includeText
29
+ * @returns
30
+ */
31
+ private static getMeasureCacheKey;
15
32
  /**
16
33
  * 计算度量 - 基于 JSON 序列化的缓存(LRU)
17
34
  * 将最终的 config 序列化为缓存键,相同配置直接返回缓存结果