@gct-paas/word 0.1.74-beta.4 → 0.1.74-beta.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.
@@ -1,66 +1,74 @@
1
1
  /**
2
- * 字段交互态配色(Canvas 渲染使用)。
3
- * Less 侧见 field-state.less,修改时请同步两处。
2
+ * 字段态配色 —— 唯一数据源(Canvas / PDF / 布局)。
3
+ *
4
+ * DOM 控件(input / select)另见 field-state.less,仅保留 DOM 用到的子集;
5
+ * 改色时以本文件为准,并同步 less 中同语义变量。
6
+ *
7
+ * 空值占位 / 括号 [](填报,同色):
8
+ * 可编辑 editable.placeholderColor / marker.default
9
+ * 必填 required.placeholderColor
10
+ * 只读 readonly.placeholderColor / marker.readonly
11
+ * 必填+只读 requiredReadonly.placeholderColor / color + background
12
+ * 禁用 disabled.color / marker.disabled
4
13
  */
5
14
  export declare const FieldStateColors: {
6
- /** 可编辑:浅蓝底 */
7
- readonly editableBg: "#F2F8FE";
8
- readonly editableBgActive: "rgba(147, 197, 253, 0.4)";
9
- readonly editableLine: "#999999";
10
- /** 暗提示(空值占位文字) */
11
- readonly editablePlaceholderText: "#b8b8b8";
12
- readonly readonlyPlaceholderText: "#b0b0b0";
13
- readonly printPlaceholderText: "#b8b8b8";
14
- /** 只读:灰底 + 灰边框,与可编辑蓝底形成对比 */
15
- readonly readonlyBg: "#f5f6f8";
16
- readonly readonlyBgActive: "#eff1f4";
17
- readonly readonlyBorder: "#d9d9d9";
18
- readonly readonlyLine: "#bfbfbf";
19
- readonly readonlyText: "rgba(0, 0, 0, 0.65)";
20
- /** 填报只读 - 有值文本(gct-text-render) */
21
- readonly readonlyValueBg: "#f0f2f5";
22
- readonly readonlyValueBgActive: "#e8ebf0";
23
- readonly readonlyValueText: "rgba(0, 0, 0, 0.78)";
24
- readonly readonlyValueLine: "#adb5bd";
25
- /** 填报只读 - 空值占位(gct-placeholder-render) */
26
- readonly readonlyPlaceholderBg: "#f5f7fa";
27
- readonly readonlyPlaceholderBgActive: "#eef1f5";
28
- readonly readonlyPlaceholderLine: "#c4c9d0";
29
- /** 详情页普通字符底色 */
30
- readonly printBg: "transparent";
31
- /** 详情页字段底色 */
32
- readonly printFieldBg: "#E8F3FF";
33
- /** 详情页字段校验失败底色 */
34
- readonly printFieldErrorBg: "#FEECED";
35
- /** 字段括号 [] 颜色 */
36
- readonly markerDefault: "#000000";
37
- readonly markerReadonly: "#8c8c8c";
38
- readonly markerDisabled: "#c9c9c9";
39
- /** 只读选中态(checkbox / radio) */
40
- readonly readonlyCheckedBorder: "#91caff";
41
- readonly readonlyCheckedBg: "#e6f4ff";
42
- readonly readonlyCheckedFill: "#69b1ff";
15
+ /** 字段括号 []:默认可编辑黑;只读/禁用见下;必填 / 必填+只读复用对应 placeholderColor */
16
+ readonly marker: {
17
+ readonly default: "#1A1D23";
18
+ readonly readonly: "#8c8c8c";
19
+ readonly disabled: "#C6C6C6";
20
+ };
21
+ /** 可编辑 */
22
+ readonly editable: {
23
+ readonly background: "#E8F3FF";
24
+ readonly placeholderColor: "#8B8B8B";
25
+ };
26
+ /** 必填 */
27
+ readonly required: {
28
+ readonly placeholderColor: "#F54547";
29
+ readonly background: "#FEECED";
30
+ };
43
31
  /** 禁用 */
44
- readonly disabledBg: "#f5f5f5";
45
- readonly disabledBgActive: "#f0f0f0";
46
- readonly disabledText: "#c9c9c9";
47
- readonly disabledLine: "#c9c9c9";
48
- readonly disabledFill: "rgba(0, 0, 0, 0.04)";
49
- /** 字段变更(批注高亮字色) */
50
- readonly fieldChangeText: "#FF9442";
32
+ readonly disabled: {
33
+ readonly background: "#F1F2F5";
34
+ readonly color: "#C6C6C6";
35
+ };
36
+ /** 必填 + 只读(他岗字段,弱提示:字色 + 底色) */
37
+ readonly requiredReadonly: {
38
+ readonly placeholderColor: "#FAA9AA";
39
+ readonly color: "#FAA9AA";
40
+ readonly background: "#FFF4F4";
41
+ };
42
+ /** 只读 */
43
+ readonly readonly: {
44
+ readonly background: "#f5f6f8";
45
+ readonly border: "#d9d9d9";
46
+ /** DOM overlay / 下拉等 */
47
+ readonly color: "rgba(0, 0, 0, 0.65)";
48
+ readonly placeholderColor: "#b0b0b0";
49
+ readonly valueColor: "rgba(0, 0, 0, 0.78)";
50
+ };
51
+ /** 详情页 / 打印 */
52
+ readonly print: {
53
+ /** run 级底(字段组底由 fieldBackground 绘制) */
54
+ readonly background: "transparent";
55
+ readonly fieldBackground: "#E8F3FF";
56
+ readonly fieldErrorBackground: "#FEECED";
57
+ readonly placeholderColor: "#b8b8b8";
58
+ };
51
59
  /** 校验失败 */
52
- readonly validationErrorText: "#ff4d4f";
53
- readonly validationErrorLine: "#ff4d4f";
54
- readonly validationErrorBg: "#fff2f2";
55
- /** 禁用态校验失败 */
56
- readonly validationErrorDisabledText: "#ff7072";
57
- readonly validationErrorDisabledLine: "#ff8a8c";
58
- readonly validationErrorDisabledBg: "#f5f5f5";
59
- readonly validationErrorDisabledBgActive: "#f0f0f0";
60
+ readonly validation: {
61
+ readonly color: "#ff4d4f";
62
+ readonly background: "#fff2f2";
63
+ readonly disabledColor: "#ff7072";
64
+ readonly disabledBackground: "#f5f5f5";
65
+ };
66
+ /** 字段变更批注字色 */
67
+ readonly fieldChange: "#FF9442";
60
68
  };
61
69
  /** 详情页字段内容四周内边距 */
62
70
  export declare const PRINT_FIELD_PAD = 2;
63
71
  /** 详情页相邻字段背景间距 */
64
72
  export declare const PRINT_FIELD_GAP = 2;
65
- /** 详情页字段空值占位尺寸 */
66
- export declare const PRINT_EMPTY_FIELD_SIZE = 20;
73
+ /** 详情页字段空值占位尺寸(默认字号 + MEASURE_LINE_HEIGHT 1.1 下字高) */
74
+ export declare const PRINT_EMPTY_FIELD_SIZE = 21;
@@ -5,6 +5,9 @@ type __VLS_Props = {
5
5
  declare function __VLS_template(): {
6
6
  attrs: Partial<{}>;
7
7
  slots: {
8
+ expandIcon?(_: {
9
+ open: boolean;
10
+ }): any;
8
11
  default?(_: {}): any;
9
12
  };
10
13
  refs: {
@@ -1,7 +1,7 @@
1
1
  import { IEmptyProps } from './empty';
2
2
  declare const _default: import('vue').DefineComponent<IEmptyProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<IEmptyProps> & Readonly<{}>, {
3
- width: number | string;
4
3
  height: number | string;
4
+ width: number | string;
5
5
  tip: string;
6
6
  iconSrc: string;
7
7
  iconHeight: number | string;
@@ -6,8 +6,8 @@ declare const _default: import('vue').DefineComponent<IUploadProps, {}, {}, {},
6
6
  onChange?: ((...args: any[]) => any) | undefined;
7
7
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
8
8
  }>, {
9
- width: string;
10
9
  height: string;
10
+ width: string;
11
11
  tip: string;
12
12
  accept: string;
13
13
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
@@ -66,12 +66,12 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
66
66
  getRef: import('vue').Ref<any, any>;
67
67
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
68
68
  edit: (option: DropdownOption) => any;
69
- click: () => any;
69
+ click: (evt: any) => any;
70
70
  change: (val: string | number | (string | number)[], item?: DropdownOption | undefined) => any;
71
71
  "update:modelValue": (val: string | number | (string | number)[]) => any;
72
72
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
73
73
  onEdit?: ((option: DropdownOption) => any) | undefined;
74
- onClick?: (() => any) | undefined;
74
+ onClick?: ((evt: any) => any) | undefined;
75
75
  onChange?: ((val: string | number | (string | number)[], item?: DropdownOption | undefined) => any) | undefined;
76
76
  "onUpdate:modelValue"?: ((val: string | number | (string | number)[]) => any) | undefined;
77
77
  }>, {
@@ -7,8 +7,28 @@ type __VLS_Props = {
7
7
  readonly?: boolean;
8
8
  allowClear?: boolean;
9
9
  popperWidth?: number;
10
+ /** 是否需要分组展示 */
11
+ grouped?: boolean;
10
12
  };
11
- declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
13
+ declare function __VLS_template(): {
14
+ attrs: Partial<{}>;
15
+ slots: {
16
+ option?(_: {
17
+ option: DropdownOption;
18
+ }): any;
19
+ 'gct-ss-option-icon'?(_: {
20
+ option: DropdownOption;
21
+ }): any;
22
+ };
23
+ refs: {
24
+ rootRef: HTMLDivElement;
25
+ inputRef: HTMLInputElement;
26
+ dropdownRef: HTMLDivElement;
27
+ };
28
+ rootEl: HTMLDivElement;
29
+ };
30
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
31
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
12
32
  change: (val?: string | number | undefined, item?: DropdownOption | undefined) => any;
13
33
  "update:modelValue": (val?: string | number | undefined) => any;
14
34
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
@@ -19,10 +39,17 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
19
39
  disabled: boolean;
20
40
  options: DropdownOption[];
21
41
  placeholder: string;
42
+ grouped: boolean;
22
43
  allowClear: boolean;
23
44
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
24
45
  rootRef: HTMLDivElement;
25
46
  inputRef: HTMLInputElement;
26
47
  dropdownRef: HTMLDivElement;
27
48
  }, HTMLDivElement>;
49
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
28
50
  export default _default;
51
+ type __VLS_WithTemplateSlots<T, S> = T & {
52
+ new (): {
53
+ $slots: S;
54
+ };
55
+ };
@@ -30,7 +30,13 @@ export interface ContainLayout extends ImageSize {
30
30
  }
31
31
  /** object-fit: contain —— 等比缩放到目标框内并居中,保证完整显示 */
32
32
  export declare function computeContainLayout(natural: ImageSize, box: ImageSize): ContainLayout;
33
- /** 将签名姓名绘制为图片 DataURL */
34
- export declare function createSignatureImageDataUrl(name: string, width: number, height: number): string;
35
- /** 创建签名图片 */
36
- export declare function createSignatureImage(name: string, width: number, height: number): Promise<unknown>;
33
+ /**
34
+ * 在目标框内等比缩放(contain),不压缩、不拉伸
35
+ */
36
+ export declare function computeContainDisplaySize(natural: ImageSize, box: ImageSize): ImageSize;
37
+ /**
38
+ * 创建无图签名兜底图(用户名 + 电子签名 + 验证日期)
39
+ * 按字段宽高绘制,显示框设多大,字就按多大排
40
+ */
41
+ export declare function createSignatureImageDataUrl(name: string, width?: number, height?: number, time?: number | string): string;
42
+ export declare function createSignatureImage(name: string, width?: number, height?: number, time?: number | string): Promise<HTMLImageElement>;
@@ -27,7 +27,9 @@ export declare const DEFAULT_PAGE_PADDING: [number, number, number, number];
27
27
  export declare const DEFAULT_CELL_PADDING: [number, number, number, number];
28
28
  export declare const DEFAULT_FONT_SIZE = 16;
29
29
  /** 默认黑体 */
30
- export declare const DEFAULT_LINE_HEIGHT = 1.6;
30
+ export declare const DEFAULT_LINE_HEIGHT = 1.5715;
31
+ /** Konva 度量 lineHeight(仅量字盒,不含段落 DEFAULT_LINE_HEIGHT) */
32
+ export declare const MEASURE_LINE_HEIGHT = 1.1;
31
33
  /** 图片 / 签名行高,略高于内容,避免贴行又不过松 */
32
34
  export declare const IMAGE_LINE_HEIGHT = 1.1;
33
35
  export declare const DEFAULT_FONT_FAMILY = "\"Noto Sans SC\", \"NotoSansSC\", \"\u9ED1\u4F53\", \"SimHei\", sans-serif";
@@ -58,8 +58,8 @@ export declare class Page extends LayoutGroup<PageChild> implements IContainerMe
58
58
  */
59
59
  get contentMaxHeight(): number;
60
60
  /**
61
- * 获取当前页面所有子元素的总高度
62
- * 累加段落、表格等子组件的高度
61
+ * 获取当前页面正文实际占用高度
62
+ * 按段落、表格等子组件的底边计算,包含显式块间距
63
63
  */
64
64
  getContentHeight(): number;
65
65
  /** 获取当前是第几页 */
@@ -1,4 +1,12 @@
1
1
  import { LayoutNode, LayoutNodeOptions } from './LayoutNode';
2
+ type PositionedLayoutNode = Pick<LayoutNode, 'y' | 'height'>;
3
+ /**
4
+ * 按子节点的实际底边计算内容占位高度。
5
+ *
6
+ * 子节点可能带有块级间距形成的 y 偏移;仅累加 height 会漏掉这些间距,
7
+ * 导致后续文档流插入到已有内容之间。
8
+ */
9
+ export declare function measureLayoutContentHeight(children: readonly PositionedLayoutNode[]): number;
2
10
  /**
3
11
  * 布局容器配置
4
12
  */
@@ -68,6 +76,8 @@ export declare abstract class LayoutGroup<T extends LayoutNode = LayoutNode> ext
68
76
  * 获取子节点数量
69
77
  */
70
78
  getChildCount(): number;
79
+ /** 获取所有子节点在当前容器中实际占用的纵向高度。 */
80
+ protected getChildrenContentHeight(): number;
71
81
  /**
72
82
  * 获取第一个子节点
73
83
  */
@@ -109,3 +119,4 @@ export declare abstract class LayoutGroup<T extends LayoutNode = LayoutNode> ext
109
119
  */
110
120
  filterChildren(predicate: (child: T) => boolean): T[];
111
121
  }
122
+ export {};
@@ -10,6 +10,8 @@ export interface IImageWidget extends IImageRun {
10
10
  /** 组件元数据 */
11
11
  widgetMeta?: WidgetMeta;
12
12
  signature?: string;
13
+ /** 无图签名时的验证时间 */
14
+ signTime?: number;
13
15
  pageWidgetMeta?: Record<string, any>;
14
16
  dataSlotIndex?: DataSlotIndex;
15
17
  }
@@ -19,6 +21,7 @@ export interface ImageWidgetOptions extends ImageRunOptions {
19
21
  /** 组件元数据 */
20
22
  widgetMeta?: WidgetMeta;
21
23
  signature?: string;
24
+ signTime?: number;
22
25
  pageWidgetMeta?: IImageWidget['pageWidgetMeta'];
23
26
  dataSlotIndex?: DataSlotIndex;
24
27
  }
@@ -30,6 +33,7 @@ export declare class ImageWidget extends ImageRun implements IImageWidget {
30
33
  valuePath?: string;
31
34
  widgetMeta?: WidgetMeta;
32
35
  signature?: string;
36
+ signTime?: number;
33
37
  pageWidgetMeta?: IImageWidget['pageWidgetMeta'];
34
38
  dataSlotIndex?: DataSlotIndex;
35
39
  constructor(options: ImageWidgetOptions);
@@ -66,17 +66,9 @@ export declare class TextUtil {
66
66
  * @returns
67
67
  */
68
68
  private static getMeasureCacheKey;
69
- /** 历史默认西文栈:仅黑体垂直定位参照,保持与旧版观感一致 */
70
- private static readonly VERTICAL_METRICS_REF_FONT;
71
- /**
72
- * 是否为文档黑体(Noto Sans SC);宋体/楷体不走 Roboto 垂直参照
73
- */
74
- private static isHeitiDocumentFontFamily;
75
69
  /**
76
70
  * 计算字体度量 ascent / descent
77
- *
78
- * 黑体:用 Roboto 栈的 'Hg' + actualBoundingBox 做垂直定位(接近旧默认观感)。
79
- * 宋体/楷体/其它:用自身字体度量。
71
+ * 与屏显/PDF 绘制字体一致,直接用文档 fontFamily 度量(黑体为 Noto Sans SC)。
80
72
  */
81
73
  static getFontMetrics(payload: Konva.TextConfig): {
82
74
  ascent: number;