@gct-paas/word 0.1.10 → 0.1.11

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.
@@ -7,18 +7,10 @@ type InsertFieldCommandOptions = CommandPayloadMap['insertField'];
7
7
  export declare class InsertField extends CommandBase<'insertField'> {
8
8
  constructor(doc: Doc, payload: InsertFieldCommandOptions);
9
9
  protected execute(): Promise<PostCommandContext>;
10
- /**
11
- * 处理折叠状态下的图片插入
12
- */
13
- private handleCollapseImage;
14
10
  /**
15
11
  * 处理折叠状态下的文本(字段)插入
16
12
  */
17
13
  private handleCollapseText;
18
- /**
19
- * 处理选区下的图片插入
20
- */
21
- private handleSelectionImage;
22
14
  /**
23
15
  * 处理选区下的文本(字段)插入
24
16
  */
@@ -18,6 +18,7 @@ export declare class LayoutManager {
18
18
  * 处理表格分页
19
19
  */
20
20
  private handleTablePagination;
21
+ private getHandler;
21
22
  /**
22
23
  * 布局段落级别的 run(处理分页和换行)
23
24
  */
@@ -1,5 +1,23 @@
1
- import { WrField } from '../../model/document';
1
+ import { WrText } from '../../model/document';
2
2
  import { LayoutContext } from '../LayoutContext';
3
+ type ValueType = string | number | undefined | null;
4
+ type WidgetOption = {
5
+ value: any;
6
+ label: string;
7
+ };
3
8
  export declare class FieldHandler {
4
- static layout(context: LayoutContext, wr: WrField): void;
9
+ static getValue(context: LayoutContext, wr: WrText): ValueType;
10
+ static hasValue(value: ValueType): boolean;
11
+ static layout(context: LayoutContext, wr: WrText): void;
12
+ static getId(context: LayoutContext, wr: WrText): string;
13
+ static layoutRun(context: LayoutContext, wr: WrText): void;
14
+ private static addOptionSpacing;
15
+ private static addOptionLabel;
16
+ private static addOptionIcon;
17
+ static layoutWidgetOption(context: LayoutContext, wr: WrText, option: WidgetOption, optionIndex: number): void;
18
+ static layoutWidgetOptions(context: LayoutContext, wr: WrText): void;
19
+ static layoutWidgetLabel(context: LayoutContext, wr: WrText): void;
20
+ static layoutWidgetInput(context: LayoutContext, wr: WrText): void;
21
+ static layoutWidgetImage(context: LayoutContext, wr: WrText): void;
5
22
  }
23
+ export {};
@@ -7,6 +7,4 @@ import { LayoutContext } from '../LayoutContext';
7
7
  export declare class ImageHandler {
8
8
  static emuToPixels(emu: number): number;
9
9
  static layout(context: LayoutContext, wr: WrImage): void;
10
- static layoutRun(context: LayoutContext, wr: WrImage): void;
11
- static layoutWidget(context: LayoutContext, wr: WrImage): void;
12
10
  }
@@ -1,27 +1,6 @@
1
1
  import { WrText } from '../../model/document';
2
2
  import { LayoutContext } from '../LayoutContext';
3
- /**
4
- * 文本 Run 布局策略
5
- * 负责文本的测量和布局(逐字符处理)
6
- */
7
- type ValueType = string | number | undefined | null;
8
- type WidgetOption = {
9
- value: any;
10
- label: string;
11
- };
12
3
  export declare class TextHandler {
13
- static getValue(context: LayoutContext, wr: WrText): ValueType;
14
- static hasValue(value: ValueType): boolean;
15
- static layout(context: LayoutContext, wr: WrText): void;
16
4
  static getId(context: LayoutContext, wr: WrText): string;
17
- static layoutRun(context: LayoutContext, wr: WrText): void;
18
- private static addOptionSpacing;
19
- private static addOptionLabel;
20
- private static addOptionIcon;
21
- static layoutWidgetOption(context: LayoutContext, wr: WrText, option: WidgetOption, optionIndex: number): void;
22
- static layoutWidgetOptions(context: LayoutContext, wr: WrText): void;
23
- static layoutWidgetLabel(context: LayoutContext, wr: WrText): void;
24
- static layoutWidgetInput(context: LayoutContext, wr: WrText): void;
25
- static layoutWidget(context: LayoutContext, wr: WrText): void;
5
+ static layout(context: LayoutContext, wr: WrText): void;
26
6
  }
27
- export {};
@@ -2,7 +2,6 @@ import { RawElement } from '../types/raw';
2
2
  import { Wp } from './Wp';
3
3
  import { Wimages } from '../images';
4
4
  import { ModelNode, ModelNodeOptions } from '../base';
5
- import { WidgetMeta } from '../../widget/widget-meta';
6
5
  import { WrPr } from './WrPr';
7
6
  type drawingData = {
8
7
  id: string;
@@ -21,13 +20,9 @@ export declare class WrImage extends ModelNode {
21
20
  parent?: Wp;
22
21
  rPr?: WrPr;
23
22
  drawing?: drawingData;
24
- valuePath?: string;
25
- widgetMeta?: WidgetMeta;
26
23
  constructor(options: ModelNodeOptions & {
27
24
  rPr?: WrPr;
28
25
  drawing?: drawingData;
29
- valuePath?: string;
30
- widgetMeta?: WidgetMeta;
31
26
  });
32
27
  /**
33
28
  * 调整图片尺寸
@@ -1,5 +1,4 @@
1
1
  import { LayoutNode, LayoutNodeOptions } from '../base';
2
- import { WrText } from '../../model/document';
3
2
  import { TextStyle } from '../../model/types/style';
4
3
  import { default as Konva } from 'konva';
5
4
  import { Doc } from '../Doc';
@@ -99,10 +98,4 @@ export declare class TextRun extends LayoutNode implements ITextRun {
99
98
  * @returns TextRun 的样式属性
100
99
  */
101
100
  static textStyle2LayoutStyle(textStyle: TextStyle): Partial<TextRun>;
102
- /**
103
- * @deprecated 使用 textStyle2LayoutStyle 代替
104
- * 将 document 模型的样式转换为 Layout 层的样式的文本样式
105
- * @returns TextRun 的样式属性
106
- */
107
- static modelStyle2LayoutStyle(rPr: WrText['rPr']): Partial<TextRun>;
108
101
  }
package/dist/index.es.js CHANGED
@@ -1394,14 +1394,10 @@ class WrImage extends ModelNode {
1394
1394
  rPr;
1395
1395
  // 直接使用 WrPr 实例,保持原始 XML 结构
1396
1396
  drawing;
1397
- valuePath;
1398
- widgetMeta;
1399
1397
  constructor(options2) {
1400
1398
  super(options2);
1401
1399
  this.rPr = options2.rPr;
1402
1400
  this.drawing = options2.drawing;
1403
- this.valuePath = options2.valuePath;
1404
- this.widgetMeta = options2.widgetMeta;
1405
1401
  }
1406
1402
  /**
1407
1403
  * 调整图片尺寸
@@ -1496,9 +1492,9 @@ class WrImage extends ModelNode {
1496
1492
  const wr = new WrImage({
1497
1493
  attrs: json["@attrs"],
1498
1494
  rPr,
1499
- drawing,
1500
- valuePath: json.valuePath,
1501
- widgetMeta: json.widgetMeta
1495
+ drawing
1496
+ // valuePath: json.valuePath,
1497
+ // widgetMeta: json.widgetMeta,
1502
1498
  });
1503
1499
  return wr;
1504
1500
  }
@@ -1523,12 +1519,6 @@ class WrImage extends ModelNode {
1523
1519
  "@attrs": this.attrs,
1524
1520
  elements: elements.length > 0 ? elements : void 0
1525
1521
  };
1526
- if (this.widgetMeta) {
1527
- result.widgetMeta = this.widgetMeta;
1528
- }
1529
- if (this.valuePath) {
1530
- result.valuePath = this.valuePath;
1531
- }
1532
1522
  return result;
1533
1523
  }
1534
1524
  /**
@@ -8453,53 +8443,9 @@ class InsertField extends CommandBase {
8453
8443
  if (!widgetMeta) return null;
8454
8444
  const cursor2 = this.doc.cursorManager;
8455
8445
  const isCollapsed = cursor2.isCollapsed();
8456
- if (widgetMeta.type === "fw:image" || widgetMeta.type === "fw:signature") {
8457
- return isCollapsed ? this.handleCollapseImage() : this.handleSelectionImage();
8458
- } else {
8459
- return isCollapsed ? this.handleCollapseText() : this.handleSelectionText();
8460
- }
8446
+ return isCollapsed ? this.handleCollapseText() : this.handleSelectionText();
8461
8447
  }
8462
8448
  // ========== Private Methods - Collapse Cases ==========
8463
- /**
8464
- * 处理折叠状态下的图片插入
8465
- */
8466
- handleCollapseImage() {
8467
- const cursor2 = this.doc.cursorManager;
8468
- const { nodeId, offset: offset2, side } = cursor2.getCursor();
8469
- const { valuePath, widgetMeta } = this.payload;
8470
- const mapper = this.doc.layoutMapper;
8471
- const run = mapper.getLayoutNodeById(nodeId);
8472
- const wp = mapper.getModelNodeById(run.parent.modelRef.id);
8473
- const wr = new WrImage({ valuePath, widgetMeta });
8474
- if (!run.isPlaceholderRun) {
8475
- if (run.isWidgetRun) {
8476
- const hitwr = mapper.getModelNodeByLayoutId(run.id);
8477
- if (side === "before") {
8478
- wp.insertBefore(hitwr, wr);
8479
- } else {
8480
- wp.insertAfter(hitwr, wr);
8481
- }
8482
- } else {
8483
- const result = CommandBase.splitRunAt(this.doc, {
8484
- id: nodeId,
8485
- offset: offset2,
8486
- side
8487
- });
8488
- if (result.modelBefore) {
8489
- result.modelParent.insertAfter(result.modelBefore, wr);
8490
- } else if (result.modelAfter) {
8491
- result.modelParent.insertBefore(result.modelAfter, wr);
8492
- }
8493
- }
8494
- } else {
8495
- wp.appendChild(wr);
8496
- }
8497
- return {
8498
- wr,
8499
- pos: -1,
8500
- side: "before"
8501
- };
8502
- }
8503
8449
  /**
8504
8450
  * 处理折叠状态下的文本(字段)插入
8505
8451
  */
@@ -8510,7 +8456,7 @@ class InsertField extends CommandBase {
8510
8456
  const mapper = this.doc.layoutMapper;
8511
8457
  const run = mapper.getLayoutNodeById(nodeId);
8512
8458
  const wp = mapper.getModelNodeById(run.parent.modelRef.id);
8513
- const wr = new WrText({ text: "X", valuePath, widgetMeta });
8459
+ const wr = new WrText({ text: valuePath, valuePath, widgetMeta });
8514
8460
  if (!this.validateFieldPath(valuePath, wp)) {
8515
8461
  console.warn("字段路径不合法,无法插入字段", valuePath);
8516
8462
  return null;
@@ -8545,12 +8491,6 @@ class InsertField extends CommandBase {
8545
8491
  };
8546
8492
  }
8547
8493
  // ========== Private Methods - Selection Cases ==========
8548
- /**
8549
- * 处理选区下的图片插入
8550
- */
8551
- handleSelectionImage() {
8552
- return null;
8553
- }
8554
8494
  /**
8555
8495
  * 处理选区下的文本(字段)插入
8556
8496
  */
@@ -9548,14 +9488,14 @@ class SetStyleBase extends CommandBase {
9548
9488
  models.forEach((m) => {
9549
9489
  if (m.children) {
9550
9490
  m.children.forEach((wr) => {
9551
- if (wr.type === "element") {
9491
+ if (wr.name === "w:r" && wr.type === "element") {
9552
9492
  wrTexts.push(wr);
9553
9493
  }
9554
9494
  });
9555
9495
  } else {
9556
9496
  const extractFromNode = (node) => {
9557
9497
  if (node && typeof node === "object") {
9558
- if (node.type === "text") {
9498
+ if (node.name === "w:r" && node.type === "element") {
9559
9499
  wrTexts.push(node);
9560
9500
  } else if ("children" in node && Array.isArray(node.children)) {
9561
9501
  node.children.forEach(extractFromNode);
@@ -10349,41 +10289,6 @@ class TextRun extends LayoutNode {
10349
10289
  if (textStyle.highlight !== void 0) ;
10350
10290
  return layoutStyle;
10351
10291
  }
10352
- /**
10353
- * @deprecated 使用 textStyle2LayoutStyle 代替
10354
- * 将 document 模型的样式转换为 Layout 层的样式的文本样式
10355
- * @returns TextRun 的样式属性
10356
- */
10357
- static modelStyle2LayoutStyle(rPr) {
10358
- if (!rPr) return {};
10359
- const layoutStyle = {};
10360
- if (rPr.sz !== void 0) {
10361
- const fontSizeInPt = rPr.sz / 2;
10362
- layoutStyle.fontSize = fontSizeInPt * 96 / 72;
10363
- }
10364
- if (rPr.rFonts?.ascii) {
10365
- layoutStyle.fontFamily = rPr.rFonts.ascii;
10366
- }
10367
- if (rPr.color) {
10368
- layoutStyle.color = normalizeColor(rPr.color, DEFAULT_TEXT_COLOR);
10369
- }
10370
- if (rPr.b !== void 0) {
10371
- layoutStyle.bold = rPr.b;
10372
- }
10373
- if (rPr.i !== void 0) {
10374
- layoutStyle.italic = rPr.i;
10375
- }
10376
- if (rPr.u !== void 0 && rPr.u !== "none") {
10377
- layoutStyle.underline = true;
10378
- }
10379
- if (rPr.strike !== void 0) {
10380
- layoutStyle.strike = rPr.strike;
10381
- }
10382
- if (rPr.spacing !== void 0) {
10383
- layoutStyle.letterSpacing = rPr.spacing / 20;
10384
- }
10385
- return layoutStyle;
10386
- }
10387
10292
  }
10388
10293
  class Paragraph extends LayoutGroup {
10389
10294
  type = "paragraph";
@@ -10759,23 +10664,6 @@ class Section {
10759
10664
  ].join("\n");
10760
10665
  }
10761
10666
  }
10762
- class TextWidget extends TextRun {
10763
- widgetMeta;
10764
- valuePath;
10765
- isEmptyPlaceholder = false;
10766
- isIconPlaceholder = false;
10767
- isSpacePlaceholder = false;
10768
- widgetOption;
10769
- constructor(options2) {
10770
- super(options2);
10771
- this.widgetMeta = options2.widgetMeta;
10772
- this.valuePath = options2.valuePath;
10773
- this.isEmptyPlaceholder = options2.isEmptyPlaceholder ?? false;
10774
- this.isIconPlaceholder = options2.isIconPlaceholder ?? false;
10775
- this.isSpacePlaceholder = options2.isSpacePlaceholder ?? false;
10776
- this.widgetOption = options2.widgetOption;
10777
- }
10778
- }
10779
10667
  class LayoutContext {
10780
10668
  type = "page";
10781
10669
  doc;
@@ -10917,6 +10805,98 @@ class LayoutContext {
10917
10805
  return path2.replace(/\[n\]/g, `[${dataIndex}]`);
10918
10806
  }
10919
10807
  }
10808
+ class TextHandler {
10809
+ static getId(context, wr) {
10810
+ let id = wr.id;
10811
+ if (typeof context.cell?.subRenderer?.dataIndex === "number") {
10812
+ id = `${wr.id}@${context.cell.subRenderer.dataIndex}`;
10813
+ }
10814
+ return id;
10815
+ }
10816
+ static layout(context, wr) {
10817
+ let text = wr.text;
10818
+ const textStyle = TextStyleResolver.resolve(wr.rPr, context.doc.model?.styles);
10819
+ const layoutStyle = TextRun.textStyle2LayoutStyle(textStyle);
10820
+ const fontSize = layoutStyle.fontSize ?? DEFAULT_FONT_SIZE;
10821
+ const chars = text.split("");
10822
+ let doc = context.doc;
10823
+ chars.forEach((char, charIndex) => {
10824
+ const { width, height, ascent, descent } = TextRun.measureText({
10825
+ text: char,
10826
+ fontSize
10827
+ });
10828
+ const run = new TextRun({
10829
+ doc,
10830
+ width,
10831
+ height,
10832
+ ascent,
10833
+ descent,
10834
+ text: char,
10835
+ isComposition: wr.isComposition ?? false,
10836
+ modelRef: {
10837
+ id: this.getId(context, wr),
10838
+ start: charIndex,
10839
+ end: charIndex
10840
+ },
10841
+ style: layoutStyle
10842
+ });
10843
+ context.ensureParagraphSpace(width, height * run.lineHeight);
10844
+ run.x = context.getRunX();
10845
+ context.addRun(run);
10846
+ });
10847
+ }
10848
+ }
10849
+ class ImageRun extends LayoutNode {
10850
+ component = BuiltinComponentTypeConst.InlineImage;
10851
+ src = "";
10852
+ /** 是否保持等比 */
10853
+ keepAspect = true;
10854
+ constructor(options2) {
10855
+ super(options2);
10856
+ this.src = options2.src;
10857
+ }
10858
+ }
10859
+ class ImageHandler {
10860
+ static emuToPixels(emu) {
10861
+ return UnitConverter.emuToPixel(emu);
10862
+ }
10863
+ static layout(context, wr) {
10864
+ if (!wr.drawing) return;
10865
+ const width = this.emuToPixels(wr.drawing.width);
10866
+ const height = this.emuToPixels(wr.drawing.height);
10867
+ let doc = context.doc;
10868
+ context.ensureParagraphSpace(width, height);
10869
+ const run = new ImageRun({
10870
+ doc,
10871
+ width,
10872
+ height,
10873
+ x: context.getRunX(),
10874
+ y: 0,
10875
+ src: doc.model.images.getImageUrlById(wr.drawing.embedId),
10876
+ modelRef: {
10877
+ id: wr.id
10878
+ }
10879
+ });
10880
+ context.addRun(run);
10881
+ }
10882
+ }
10883
+ class TextWidget extends TextRun {
10884
+ widgetMeta;
10885
+ valuePath;
10886
+ isEmptyPlaceholder = false;
10887
+ isIconPlaceholder = false;
10888
+ isSpacePlaceholder = false;
10889
+ widgetOption;
10890
+ constructor(options2) {
10891
+ super(options2);
10892
+ this.widgetMeta = options2.widgetMeta;
10893
+ this.valuePath = options2.valuePath;
10894
+ this.isEmptyPlaceholder = options2.isEmptyPlaceholder ?? false;
10895
+ this.isIconPlaceholder = options2.isIconPlaceholder ?? false;
10896
+ this.isSpacePlaceholder = options2.isSpacePlaceholder ?? false;
10897
+ this.widgetOption = options2.widgetOption;
10898
+ }
10899
+ }
10920
10900
  function getDefaultExportFromCjs(x2) {
10921
10901
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
10922
10902
  }
@@ -11292,7 +11272,17 @@ function formatDateTimeHook(props, value) {
11292
11272
  ]);
11293
11273
  return formatDateTime(formats, value);
11294
11274
  }
11295
- class TextHandler {
11275
+ class ImageWidget extends ImageRun {
11276
+ valuePath;
11277
+ widgetMeta;
11278
+ constructor(options2) {
11279
+ super(options2);
11280
+ this.src = options2.src;
11281
+ this.valuePath = options2.valuePath;
11282
+ this.widgetMeta = options2.widgetMeta;
11283
+ }
11284
+ }
11285
+ class FieldHandler {
11296
11286
  static getValue(context, wr) {
11297
11287
  if (!wr.valuePath) return void 0;
11298
11288
  return context.doc.dataManager.getLabel(wr.valuePath);
@@ -11301,10 +11291,18 @@ class TextHandler {
11301
11291
  return value !== void 0 && value !== null;
11302
11292
  }
11303
11293
  static layout(context, wr) {
11304
- if (wr.widgetMeta) {
11305
- this.layoutWidget(context, wr);
11294
+ if (context.doc.mode === DocModeTypeConst.Print) {
11295
+ this.layoutWidgetLabel(context, wr);
11306
11296
  } else {
11307
- this.layoutRun(context, wr);
11297
+ if (wr.widgetMeta?.props?.renderComp === "checkbox") {
11298
+ this.layoutWidgetOptions(context, wr);
11299
+ } else if (wr.widgetMeta?.props?.renderComp === "radio") {
11300
+ this.layoutWidgetOptions(context, wr);
11301
+ } else if (wr.widgetMeta?.type === "fw:image") {
11302
+ this.layoutWidgetImage(context, wr);
11303
+ } else {
11304
+ this.layoutWidgetInput(context, wr);
11305
+ }
11308
11306
  }
11309
11307
  }
11310
11308
  static getId(context, wr) {
@@ -11494,8 +11492,9 @@ class TextHandler {
11494
11492
  if (!this.hasValue(label)) {
11495
11493
  label = "--";
11496
11494
  }
11497
- const style = TextRun.modelStyle2LayoutStyle(wr.effectiveRPr);
11498
- const fontSize = style.fontSize ?? DEFAULT_FONT_SIZE;
11495
+ const textStyle = TextStyleResolver.resolve(wr.rPr, context.doc.model?.styles);
11496
+ const layoutStyle = TextRun.textStyle2LayoutStyle(textStyle);
11497
+ const fontSize = layoutStyle.fontSize ?? DEFAULT_FONT_SIZE;
11499
11498
  const chars = String(label).split("");
11500
11499
  let doc = context.doc;
11501
11500
  chars.forEach((char, charIndex) => {
@@ -11536,8 +11535,9 @@ class TextHandler {
11536
11535
  label = wr.widgetMeta?.props?.placeholder || wr.widgetMeta?.extra?.biz?.fieldIdentity?.label || "--";
11537
11536
  isEmptyPlaceholder = true;
11538
11537
  }
11539
- const style = TextRun.modelStyle2LayoutStyle(wr.effectiveRPr);
11540
- const fontSize = style.fontSize ?? DEFAULT_FONT_SIZE;
11538
+ const textStyle = TextStyleResolver.resolve(wr.rPr, context.doc.model?.styles);
11539
+ const layoutStyle = TextRun.textStyle2LayoutStyle(textStyle);
11540
+ const fontSize = layoutStyle.fontSize ?? DEFAULT_FONT_SIZE;
11541
11541
  const chars = String(label).split("");
11542
11542
  let doc = context.doc;
11543
11543
  chars.forEach((char, charIndex) => {
@@ -11566,70 +11566,7 @@ class TextHandler {
11566
11566
  context.addRun(run);
11567
11567
  });
11568
11568
  }
11569
- static layoutWidget(context, wr) {
11570
- if (context.doc.mode === DocModeTypeConst.Print) {
11571
- this.layoutWidgetLabel(context, wr);
11572
- } else {
11573
- if (wr.widgetMeta?.props?.renderComp === "checkbox") {
11574
- this.layoutWidgetOptions(context, wr);
11575
- } else if (wr.widgetMeta?.props?.renderComp === "radio") {
11576
- this.layoutWidgetOptions(context, wr);
11577
- } else {
11578
- this.layoutWidgetInput(context, wr);
11579
- }
11580
- }
11581
- }
11582
- }
11583
- class ImageRun extends LayoutNode {
11584
- component = BuiltinComponentTypeConst.InlineImage;
11585
- src = "";
11586
- /** 是否保持等比 */
11587
- keepAspect = true;
11588
- constructor(options2) {
11589
- super(options2);
11590
- this.src = options2.src;
11591
- }
11592
- }
11593
- class ImageWidget extends ImageRun {
11594
- valuePath;
11595
- widgetMeta;
11596
- constructor(options2) {
11597
- super(options2);
11598
- this.src = options2.src;
11599
- this.valuePath = options2.valuePath;
11600
- this.widgetMeta = options2.widgetMeta;
11601
- }
11602
- }
11603
- class ImageHandler {
11604
- static emuToPixels(emu) {
11605
- return UnitConverter.emuToPixel(emu);
11606
- }
11607
- static layout(context, wr) {
11608
- if (wr.widgetMeta) {
11609
- this.layoutWidget(context, wr);
11610
- } else {
11611
- this.layoutRun(context, wr);
11612
- }
11613
- }
11614
- static layoutRun(context, wr) {
11615
- const width = this.emuToPixels(wr.drawing.width);
11616
- const height = this.emuToPixels(wr.drawing.height);
11617
- let doc = context.doc;
11618
- context.ensureParagraphSpace(width, height);
11619
- const run = new ImageRun({
11620
- doc,
11621
- width,
11622
- height,
11623
- x: context.getRunX(),
11624
- y: 0,
11625
- src: doc.model.images.getImageUrlById(wr.drawing.embedId),
11626
- modelRef: {
11627
- id: wr.id
11628
- }
11629
- });
11630
- context.addRun(run);
11631
- }
11632
- static layoutWidget(context, wr) {
11569
+ static layoutWidgetImage(context, wr) {
11633
11570
  let doc = context.doc;
11634
11571
  let images = context.doc.dataManager.get(wr.valuePath);
11635
11572
  if (images) {
@@ -11685,68 +11622,6 @@ class ImageHandler {
11685
11622
  }
11686
11623
  }
11687
11624
  }
11688
- class FieldHandler {
11689
- // static getValue(context: LayoutContext, wr: WrField): ValueType {
11690
- // if (!wr.valuePath) return undefined;
11691
- // return context.doc.dataManager.getLabel(wr.valuePath);
11692
- // }
11693
- // static hasValue(value: ValueType): boolean {
11694
- // return value !== undefined && value !== null;
11695
- // }
11696
- static layout(context, wr) {
11697
- const label = wr.widgetMeta?.extra?.biz?.fieldIdentity?.label || "--";
11698
- const chars = label.split("");
11699
- let doc = context.doc;
11700
- const images = [
11701
- // 'kunl0vx/fm_ahkazouo/i3JJ2ND3euDIJ8Hd/content-empty.png',
11702
- // 'kunl0vx/fm_ahkazouo/Q9gu3hrBcLdeGzkv/image1.jpeg',
11703
- // 'kunl0vx/fm_ahkazouo/i3JJ2ND3euDIJ8Hd/content-empty.png',
11704
- // 'kunl0vx/fm_ahkazouo/Q9gu3hrBcLdeGzkv/image1.jpeg',
11705
- ];
11706
- images.forEach((image) => {
11707
- const width = 100;
11708
- const height = 80;
11709
- context.ensureParagraphSpace(width, height);
11710
- const run = new ImageRun({
11711
- doc,
11712
- width,
11713
- height,
11714
- x: context.getRunX(),
11715
- y: 0,
11716
- src: image,
11717
- modelRef: {
11718
- id: wr.id
11719
- }
11720
- });
11721
- context.addRun(run);
11722
- });
11723
- chars.forEach((char, charIndex) => {
11724
- const { width, height, ascent, descent } = TextRun.measureText({
11725
- text: char,
11726
- fontSize: 16
11727
- });
11728
- const run = new TextWidget({
11729
- doc,
11730
- width,
11731
- height,
11732
- ascent,
11733
- descent,
11734
- text: char,
11735
- modelRef: {
11736
- id: wr.id,
11737
- start: charIndex,
11738
- end: charIndex
11739
- },
11740
- widgetMeta: wr.widgetMeta,
11741
- valuePath: context.getValuePath(wr.valuePath),
11742
- isEmptyPlaceholder: true
11743
- });
11744
- context.ensureParagraphSpace(width, height * run.lineHeight);
11745
- run.x = context.getRunX();
11746
- context.addRun(run);
11747
- });
11748
- }
11749
- }
11750
11625
  class TableRow extends LayoutGroup {
11751
11626
  component = BuiltinComponentTypeConst.TableRow;
11752
11627
  constructor(options2) {
@@ -12575,7 +12450,6 @@ class LayoutManager {
12575
12450
  this.layoutHandlers = /* @__PURE__ */ new Map();
12576
12451
  this.layoutHandlers.set("text", TextHandler);
12577
12452
  this.layoutHandlers.set("image", ImageHandler);
12578
- this.layoutHandlers.set("field", FieldHandler);
12579
12453
  this.pageContext = new LayoutContext({
12580
12454
  type: "page",
12581
12455
  doc: this.doc
@@ -12703,11 +12577,18 @@ class LayoutManager {
12703
12577
  }
12704
12578
  }
12705
12579
  }
12580
+ getHandler = (run) => {
12581
+ if ("widgetMeta" in run && run.widgetMeta) {
12582
+ return FieldHandler;
12583
+ } else {
12584
+ return this.layoutHandlers.get(run.handler);
12585
+ }
12586
+ };
12706
12587
  /**
12707
12588
  * 布局段落级别的 run(处理分页和换行)
12708
12589
  */
12709
12590
  layoutRun(context, run) {
12710
- const handler = this.layoutHandlers.get(run.handler);
12591
+ const handler = this.getHandler(run);
12711
12592
  if (!handler) {
12712
12593
  console.warn(`Unknown run type in paragraph: ${run.handler}`);
12713
12594
  return;
@@ -23430,7 +23311,7 @@ const _sfc_main$2e = /* @__PURE__ */ defineComponent({
23430
23311
  }
23431
23312
  });
23432
23313
  const DialogContainer = /* @__PURE__ */ _export_sfc(_sfc_main$2e, [["__scopeId", "data-v-89fa975a"]]);
23433
- const apiConfig$1 = [
23314
+ const apiConfig$2 = [
23434
23315
  {
23435
23316
  name: "appBranch",
23436
23317
  entityName: "app-branch",
@@ -31259,7 +31140,7 @@ const apiConfig$1 = [
31259
31140
  ]
31260
31141
  }
31261
31142
  ];
31262
- const apiConfig = [
31143
+ const apiConfig$1 = [
31263
31144
  {
31264
31145
  name: "agent",
31265
31146
  entityName: "agent",
@@ -37827,6 +37708,399 @@ const apiConfig = [
37827
37708
  ]
37828
37709
  }
37829
37710
  ];
37711
+ const apiConfig = [
37712
+ {
37713
+ name: "auth",
37714
+ entityName: "auth",
37715
+ apis: [
37716
+ {
37717
+ mode: "post",
37718
+ method: "postTestConnect",
37719
+ path: "test/connect",
37720
+ hasData: true
37721
+ },
37722
+ {
37723
+ mode: "get",
37724
+ method: "getTestConnectOnce",
37725
+ path: "test/connect/once",
37726
+ hasQuery: true
37727
+ },
37728
+ {
37729
+ mode: "post",
37730
+ method: "postTestRequestService",
37731
+ path: "test/request/service",
37732
+ hasData: true
37733
+ }
37734
+ ]
37735
+ },
37736
+ {
37737
+ name: "camel",
37738
+ entityName: "camel",
37739
+ apis: [
37740
+ {
37741
+ mode: "post",
37742
+ method: "postCreate",
37743
+ path: "create"
37744
+ },
37745
+ {
37746
+ mode: "post",
37747
+ method: "postDebug",
37748
+ path: "debug",
37749
+ hasData: true
37750
+ },
37751
+ {
37752
+ mode: "post",
37753
+ method: "postDestory",
37754
+ path: "destory",
37755
+ hasQuery: true
37756
+ },
37757
+ {
37758
+ mode: "post",
37759
+ method: "postFetchMissingParams",
37760
+ path: "fetchMissingParams",
37761
+ hasQuery: true
37762
+ },
37763
+ {
37764
+ mode: "post",
37765
+ method: "postLoad",
37766
+ path: "load"
37767
+ },
37768
+ {
37769
+ mode: "get",
37770
+ method: "getRoutes",
37771
+ path: "routes"
37772
+ },
37773
+ {
37774
+ mode: "get",
37775
+ method: "getSchema",
37776
+ path: "schema",
37777
+ hasQuery: true
37778
+ }
37779
+ ]
37780
+ },
37781
+ {
37782
+ name: "category",
37783
+ entityName: "category",
37784
+ apis: [
37785
+ {
37786
+ mode: "post",
37787
+ method: "postFlow",
37788
+ path: "flow",
37789
+ hasData: true
37790
+ }
37791
+ ]
37792
+ },
37793
+ {
37794
+ name: "connectorConfig",
37795
+ entityName: "connector-config",
37796
+ apis: [
37797
+ {
37798
+ mode: "post",
37799
+ method: "post",
37800
+ path: "",
37801
+ hasData: true
37802
+ },
37803
+ {
37804
+ mode: "delete",
37805
+ method: "delete",
37806
+ path: "",
37807
+ hasQuery: true
37808
+ },
37809
+ {
37810
+ mode: "get",
37811
+ method: "getByAppid",
37812
+ path: "by/appid",
37813
+ hasQuery: true
37814
+ },
37815
+ {
37816
+ mode: "post",
37817
+ method: "postExport",
37818
+ path: "export"
37819
+ },
37820
+ {
37821
+ mode: "get",
37822
+ method: "getFindAppByConnectorId",
37823
+ path: "findAppByConnectorId",
37824
+ hasQuery: true
37825
+ },
37826
+ {
37827
+ mode: "post",
37828
+ method: "postImport",
37829
+ path: "import",
37830
+ hasQuery: true
37831
+ },
37832
+ {
37833
+ mode: "get",
37834
+ method: "getInfo",
37835
+ path: "info",
37836
+ hasQuery: true
37837
+ },
37838
+ {
37839
+ mode: "get",
37840
+ method: "getList",
37841
+ path: "list"
37842
+ },
37843
+ {
37844
+ mode: "get",
37845
+ method: "getPageList",
37846
+ path: "page/list",
37847
+ hasQuery: true
37848
+ },
37849
+ {
37850
+ mode: "put",
37851
+ method: "putId",
37852
+ path: "",
37853
+ hasPathParams: true,
37854
+ hasData: true
37855
+ }
37856
+ ]
37857
+ },
37858
+ {
37859
+ name: "connectorLog",
37860
+ entityName: "connector-log",
37861
+ apis: [
37862
+ {
37863
+ mode: "delete",
37864
+ method: "delete",
37865
+ path: ""
37866
+ },
37867
+ {
37868
+ mode: "get",
37869
+ method: "getInfo",
37870
+ path: "info",
37871
+ hasQuery: true
37872
+ },
37873
+ {
37874
+ mode: "get",
37875
+ method: "getList",
37876
+ path: "list"
37877
+ },
37878
+ {
37879
+ mode: "post",
37880
+ method: "postPageList",
37881
+ path: "page/list",
37882
+ hasQuery: true,
37883
+ hasData: true
37884
+ }
37885
+ ]
37886
+ },
37887
+ {
37888
+ name: "flowApp",
37889
+ entityName: "flow-app",
37890
+ apis: [
37891
+ {
37892
+ mode: "post",
37893
+ method: "post",
37894
+ path: "",
37895
+ hasData: true
37896
+ },
37897
+ {
37898
+ mode: "delete",
37899
+ method: "delete",
37900
+ path: "",
37901
+ hasQuery: true
37902
+ },
37903
+ {
37904
+ mode: "get",
37905
+ method: "getInfo",
37906
+ path: "info",
37907
+ hasQuery: true
37908
+ },
37909
+ {
37910
+ mode: "get",
37911
+ method: "getList",
37912
+ path: "list"
37913
+ },
37914
+ {
37915
+ mode: "get",
37916
+ method: "getPageList",
37917
+ path: "page/list",
37918
+ hasQuery: true
37919
+ },
37920
+ {
37921
+ mode: "put",
37922
+ method: "putId",
37923
+ path: "",
37924
+ hasPathParams: true,
37925
+ hasData: true
37926
+ }
37927
+ ]
37928
+ },
37929
+ {
37930
+ name: "flowCategory",
37931
+ entityName: "flow-category",
37932
+ apis: [
37933
+ {
37934
+ mode: "post",
37935
+ method: "post",
37936
+ path: "",
37937
+ hasData: true
37938
+ },
37939
+ {
37940
+ mode: "delete",
37941
+ method: "delete",
37942
+ path: "",
37943
+ hasQuery: true
37944
+ },
37945
+ {
37946
+ mode: "post",
37947
+ method: "postDrag",
37948
+ path: "drag",
37949
+ hasData: true
37950
+ },
37951
+ {
37952
+ mode: "get",
37953
+ method: "getInfo",
37954
+ path: "info",
37955
+ hasQuery: true
37956
+ },
37957
+ {
37958
+ mode: "get",
37959
+ method: "getList",
37960
+ path: "list",
37961
+ hasQuery: true
37962
+ },
37963
+ {
37964
+ mode: "get",
37965
+ method: "getListComplete",
37966
+ path: "listComplete",
37967
+ hasQuery: true
37968
+ },
37969
+ {
37970
+ mode: "get",
37971
+ method: "getPageList",
37972
+ path: "page/list",
37973
+ hasQuery: true
37974
+ },
37975
+ {
37976
+ mode: "put",
37977
+ method: "putId",
37978
+ path: "",
37979
+ hasPathParams: true,
37980
+ hasData: true
37981
+ }
37982
+ ]
37983
+ },
37984
+ {
37985
+ name: "flowExt",
37986
+ entityName: "flow-ext",
37987
+ apis: [
37988
+ {
37989
+ mode: "post",
37990
+ method: "post",
37991
+ path: "",
37992
+ hasData: true
37993
+ },
37994
+ {
37995
+ mode: "delete",
37996
+ method: "delete",
37997
+ path: "",
37998
+ hasQuery: true
37999
+ },
38000
+ {
38001
+ mode: "get",
38002
+ method: "getFindByFuuid",
38003
+ path: "findByFuuid",
38004
+ hasQuery: true
38005
+ },
38006
+ {
38007
+ mode: "get",
38008
+ method: "getInfo",
38009
+ path: "info",
38010
+ hasQuery: true
38011
+ },
38012
+ {
38013
+ mode: "get",
38014
+ method: "getList",
38015
+ path: "list"
38016
+ },
38017
+ {
38018
+ mode: "get",
38019
+ method: "getPageList",
38020
+ path: "page/list",
38021
+ hasQuery: true
38022
+ },
38023
+ {
38024
+ mode: "get",
38025
+ method: "getValidCron",
38026
+ path: "validCron",
38027
+ hasQuery: true
38028
+ },
38029
+ {
38030
+ mode: "put",
38031
+ method: "putId",
38032
+ path: "",
38033
+ hasPathParams: true,
38034
+ hasData: true
38035
+ }
38036
+ ]
38037
+ },
38038
+ {
38039
+ name: "flow",
38040
+ entityName: "flow",
38041
+ apis: [
38042
+ {
38043
+ mode: "post",
38044
+ method: "postExport",
38045
+ path: "export"
38046
+ },
38047
+ {
38048
+ mode: "post",
38049
+ method: "postImport",
38050
+ path: "import",
38051
+ hasQuery: true
38052
+ },
38053
+ {
38054
+ mode: "get",
38055
+ method: "getListCategoryOnline",
38056
+ path: "list/category/online",
38057
+ hasQuery: true
38058
+ },
38059
+ {
38060
+ mode: "get",
38061
+ method: "getListOnline",
38062
+ path: "list/online",
38063
+ hasQuery: true
38064
+ },
38065
+ {
38066
+ mode: "get",
38067
+ method: "getPageList",
38068
+ path: "page/list",
38069
+ hasQuery: true
38070
+ },
38071
+ {
38072
+ mode: "put",
38073
+ method: "putFuuid",
38074
+ path: "{fuuid}",
38075
+ hasPathParams: true,
38076
+ hasData: true
38077
+ }
38078
+ ]
38079
+ },
38080
+ {
38081
+ name: "runtime",
38082
+ entityName: "runtime",
38083
+ apis: [
38084
+ {
38085
+ mode: "get",
38086
+ method: "getDestroyContext",
38087
+ path: "destroyContext",
38088
+ hasQuery: true
38089
+ },
38090
+ {
38091
+ mode: "get",
38092
+ method: "getRandomId",
38093
+ path: "randomId"
38094
+ },
38095
+ {
38096
+ mode: "post",
38097
+ method: "postValidWebSocketAndRunToSpecNode",
38098
+ path: "validWebSocketAndRunToSpecNode",
38099
+ hasData: true
38100
+ }
38101
+ ]
38102
+ }
38103
+ ];
37830
38104
  var pathBrowserify;
37831
38105
  var hasRequiredPathBrowserify;
37832
38106
  function requirePathBrowserify() {
@@ -41239,8 +41513,9 @@ class ApiManage {
41239
41513
  }
41240
41514
  }
41241
41515
  const api = {
41242
- apaas: new ApiManage("/gct-apaas/api", apiConfig$1),
41243
- platform: new ApiManage("/gct-platform/api", apiConfig)
41516
+ apaas: new ApiManage("/gct-apaas/api", apiConfig$2),
41517
+ platform: new ApiManage("/gct-platform/api", apiConfig$1),
41518
+ ipaas: new ApiManage("/gct-ipaas/api", apiConfig)
41244
41519
  };
41245
41520
  async function addSubModelsToFieldScope(modelKey, ctx) {
41246
41521
  if (!ctx?.runtime?.fieldScope) {
@@ -51135,8 +51410,7 @@ const manifest$r = {
51135
51410
  propsSchema: "schema:field-sign",
51136
51411
  defaultProps: {
51137
51412
  ...commonDefaultProps,
51138
- ...signFieldDefaultProps,
51139
- renderComp: "file"
51413
+ ...signFieldDefaultProps
51140
51414
  }
51141
51415
  };
51142
51416
  const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -51300,8 +51574,7 @@ const manifest$j = {
51300
51574
  propsSchema: "schema:field-file",
51301
51575
  defaultProps: {
51302
51576
  ...commonDefaultProps,
51303
- ...fileFieldDefaultProps,
51304
- renderComp: "file"
51577
+ ...fileFieldDefaultProps
51305
51578
  }
51306
51579
  };
51307
51580
  const __vite_glob_0_28 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -51323,8 +51596,7 @@ const manifest$i = {
51323
51596
  propsSchema: "schema:field-file",
51324
51597
  defaultProps: {
51325
51598
  ...commonDefaultProps,
51326
- ...fileFieldDefaultProps,
51327
- renderComp: "file"
51599
+ ...fileFieldDefaultProps
51328
51600
  }
51329
51601
  };
51330
51602
  const __vite_glob_0_29 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -51440,8 +51712,7 @@ const manifest$d = {
51440
51712
  propsSchema: "schema:field-sign",
51441
51713
  defaultProps: {
51442
51714
  ...commonDefaultProps,
51443
- ...signFieldDefaultProps,
51444
- renderComp: "file"
51715
+ ...signFieldDefaultProps
51445
51716
  }
51446
51717
  };
51447
51718
  const __vite_glob_0_34 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",