@gct-paas/word 0.1.19 → 0.1.21

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.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, useSlots, computed, createElementBlock, openBlock, normalizeClass, createCommentVNode, createElementVNode, unref, renderSlot, cloneVNode, provide, Fragment, renderList, createBlock, resolveDynamicComponent, inject, reactive, watch, nextTick, createVNode, withCtx, toDisplayString, createTextVNode, ref, withModifiers, Transition, withDirectives, vShow, onBeforeMount, normalizeStyle, mergeProps, onMounted, TransitionGroup, render, isVNode, onBeforeUnmount, Teleport, createApp, h as h$1, getCurrentInstance, onUnmounted, resolveComponent, isRef, withKeys, useCssVars, mergeModels, useModel, readonly, shallowRef, defineAsyncComponent, Suspense, normalizeProps, guardReactiveProps, toRef, getCurrentScope, onScopeDispose, toValue, watchEffect, createStaticVNode, createSlots, toRaw, vModelText } from "vue";
1
+ import { defineComponent, useSlots, computed, createElementBlock, openBlock, normalizeClass, createCommentVNode, createElementVNode, unref, renderSlot, cloneVNode, provide, Fragment, renderList, createBlock, resolveDynamicComponent, inject, reactive, watch, nextTick, createVNode, withCtx, toDisplayString, createTextVNode, ref, withModifiers, Transition, withDirectives, vShow, onBeforeMount, normalizeStyle, mergeProps, getCurrentInstance, onMounted, TransitionGroup, render, isVNode, onBeforeUnmount, Teleport, createApp, h as h$1, onUnmounted, resolveComponent, isRef, withKeys, useCssVars, mergeModels, useModel, readonly, shallowRef, defineAsyncComponent, Suspense, normalizeProps, guardReactiveProps, toRef, getCurrentScope, onScopeDispose, toValue, watchEffect, createStaticVNode, createSlots, toRaw, vModelText } from "vue";
2
2
  import FloatingVue, { PopperWrapper } from "floating-vue";
3
3
  import VueKonva from "vue-konva";
4
4
  import Konva from "konva";
@@ -22767,6 +22767,16 @@ class Wtc extends ModelGroup {
22767
22767
  p?.clearChildren();
22768
22768
  this.children = p ? [p] : [];
22769
22769
  }
22770
+ clearFieldRuns() {
22771
+ this.contents.forEach((paragraph) => {
22772
+ for (let i = paragraph.children.length - 1; i >= 0; i--) {
22773
+ const child = paragraph.children[i];
22774
+ if (child?.name === "w:r" && child?.widgetMeta && child?.widgetMeta?.field?.subFieldKey) {
22775
+ paragraph.removeChildAt(i);
22776
+ }
22777
+ }
22778
+ });
22779
+ }
22770
22780
  /**
22771
22781
  * 从 XML JSON 创建单元格(返回数组,因为 colspan 会产生多个单元格)
22772
22782
  */
@@ -23580,6 +23590,7 @@ class CheckTableRegion extends Region {
23580
23590
  endRowIdx: this.itemRegion.end.row,
23581
23591
  endColIdx: this.itemRegion.end.col,
23582
23592
  callback: (cell) => {
23593
+ cell.clearFieldRuns();
23583
23594
  cell.dataGroup2DId = void 0;
23584
23595
  }
23585
23596
  });
@@ -23680,6 +23691,7 @@ class _2DTableRegion extends Region {
23680
23691
  endRowIdx: this.itemRegion.end.row,
23681
23692
  endColIdx: this.itemRegion.end.col,
23682
23693
  callback: (cell) => {
23694
+ cell.clearFieldRuns();
23683
23695
  cell.dataGroup2DId = void 0;
23684
23696
  }
23685
23697
  });
@@ -23779,6 +23791,7 @@ class BoundedRegion extends Region {
23779
23791
  endRowIdx: this.itemRegion.end.row,
23780
23792
  endColIdx: this.itemRegion.end.col,
23781
23793
  callback: (cell) => {
23794
+ cell.clearFieldRuns();
23782
23795
  cell.boundedItemId = void 0;
23783
23796
  }
23784
23797
  });
@@ -24548,15 +24561,19 @@ class WtblRegionManager {
24548
24561
  endColIdx: end.col,
24549
24562
  callback: (cell) => {
24550
24563
  if (isRepeating) {
24564
+ cell.clearFieldRuns();
24551
24565
  cell.repeatingId = void 0;
24552
24566
  cell.dataGroup2DId = void 0;
24553
24567
  } else if (is2DTable) {
24568
+ cell.clearFieldRuns();
24554
24569
  cell._2DTableId = void 0;
24555
24570
  cell.dataGroup2DId = void 0;
24556
24571
  } else if (isBounded) {
24572
+ cell.clearFieldRuns();
24557
24573
  cell.boundedId = void 0;
24558
24574
  cell.boundedItemId = void 0;
24559
24575
  } else if (isCheckTable) {
24576
+ cell.clearFieldRuns();
24560
24577
  cell.checkTableId = void 0;
24561
24578
  cell.dataGroup2DId = void 0;
24562
24579
  } else if (isThead) {
@@ -29622,12 +29639,18 @@ class InsertTable extends CommandBase {
29622
29639
  const wp = mapper.getModelNodeById(run.parent.modelRef.id);
29623
29640
  let targetIndex = 0;
29624
29641
  if (!run.isPlaceholderRun) {
29625
- const result = CommandBase.splitRunAt(this.doc, {
29626
- id: nodeId,
29627
- offset: offset2,
29628
- side
29629
- });
29630
- targetIndex = result.modelIndex;
29642
+ if (run.isWidgetRun || run.isPageWidgetRun) {
29643
+ const hitwr = mapper.getModelNodeByLayoutId(run.id);
29644
+ let wrIndex = wp.children.findIndex((r) => r.id === hitwr.id);
29645
+ targetIndex = ++wrIndex;
29646
+ } else {
29647
+ const result = CommandBase.splitRunAt(this.doc, {
29648
+ id: nodeId,
29649
+ offset: offset2,
29650
+ side
29651
+ });
29652
+ targetIndex = result.modelIndex;
29653
+ }
29631
29654
  }
29632
29655
  const [beforeWp, afterWp] = wp.splitAt(targetIndex);
29633
29656
  if (wp.parent.name === "w:body") {
@@ -29641,6 +29664,12 @@ class InsertTable extends CommandBase {
29641
29664
  } else if (afterWp) {
29642
29665
  wp.parent.insertBefore(afterWp, table);
29643
29666
  }
29667
+ const firstWp = table.getFirstWp();
29668
+ return {
29669
+ wp: firstWp,
29670
+ pos: 0,
29671
+ side: "after"
29672
+ };
29644
29673
  }
29645
29674
  } else {
29646
29675
  const { mode, models } = CommandBase.getSelectionResult(this.doc, cursor.getSelection());
@@ -30377,7 +30406,7 @@ const _hoisted_4$N = { class: "text" };
30377
30406
  const _hoisted_5$C = { class: "gct-dtp-head" };
30378
30407
  const _hoisted_6$r = { class: "gct-dtp-rows-wrapper" };
30379
30408
  const _hoisted_7$n = ["onClick"];
30380
- const _hoisted_8$j = { class: "dtp-day-label" };
30409
+ const _hoisted_8$i = { class: "dtp-day-label" };
30381
30410
  const _hoisted_9$b = {
30382
30411
  key: 0,
30383
30412
  class: "gct-date-footer"
@@ -30612,7 +30641,7 @@ const _sfc_main$3r = /* @__PURE__ */ defineComponent({
30612
30641
  class: normalizeClass(dayClasses(day)),
30613
30642
  onClick: ($event) => onSelectDay(day)
30614
30643
  }, [
30615
- createElementVNode("div", _hoisted_8$j, toDisplayString(day.label), 1)
30644
+ createElementVNode("div", _hoisted_8$i, toDisplayString(day.label), 1)
30616
30645
  ], 10, _hoisted_7$n);
30617
30646
  }), 128))
30618
30647
  ]);
@@ -30831,7 +30860,7 @@ const _hoisted_7$m = {
30831
30860
  key: 1,
30832
30861
  class: "divider"
30833
30862
  };
30834
- const _hoisted_8$i = ["onClick"];
30863
+ const _hoisted_8$h = ["onClick"];
30835
30864
  const _hoisted_9$a = { class: "option-right" };
30836
30865
  const _hoisted_10$7 = { class: "title" };
30837
30866
  const _sfc_main$3m = /* @__PURE__ */ defineComponent({
@@ -31019,7 +31048,7 @@ const _sfc_main$3m = /* @__PURE__ */ defineComponent({
31019
31048
  })) : createCommentVNode("", true)
31020
31049
  ])
31021
31050
  ], 64))
31022
- ], 10, _hoisted_8$i);
31051
+ ], 10, _hoisted_8$h);
31023
31052
  }), 128))
31024
31053
  ])
31025
31054
  ]),
@@ -31375,7 +31404,7 @@ const _hoisted_1$29 = {
31375
31404
  key: 0,
31376
31405
  class: "gct-input-prepend-icon"
31377
31406
  };
31378
- const _hoisted_2$1n = ["id", "type", "value", "placeholder", "disabled", "readonly", "maxlength", "autocomplete", "autofocus", "name", "spellcheck"];
31407
+ const _hoisted_2$1n = ["id", "name", "type", "value", "placeholder", "disabled", "readonly", "maxlength", "autocomplete", "autofocus", "spellcheck"];
31379
31408
  const _hoisted_3$12 = {
31380
31409
  key: 1,
31381
31410
  class: "gct-input-clear-icon-default"
@@ -31413,7 +31442,7 @@ const _sfc_main$3g = /* @__PURE__ */ defineComponent({
31413
31442
  showPasswordToggle: { type: Boolean, default: true },
31414
31443
  maxLength: { default: void 0 },
31415
31444
  autofocus: { type: Boolean, default: false },
31416
- autocomplete: { default: "off" },
31445
+ autocomplete: { default: void 0 },
31417
31446
  name: { default: "" },
31418
31447
  rows: { default: 3 },
31419
31448
  bordered: { type: Boolean, default: true },
@@ -31427,12 +31456,14 @@ const _sfc_main$3g = /* @__PURE__ */ defineComponent({
31427
31456
  const props = __props;
31428
31457
  const emit = __emit;
31429
31458
  const inputRef = ref(null);
31459
+ const componentUid = getCurrentInstance()?.uid ?? Date.now();
31430
31460
  const inputClasses = computed(() => ({
31431
31461
  "gct-input-lg": props.size === "large",
31432
31462
  "gct-input-sm": props.size === "small",
31433
31463
  "gct-input-disabled": props.disabled,
31434
31464
  "gct-input-readonly": props.readonly,
31435
- "gct-input-borderless": !props.bordered
31465
+ "gct-input-borderless": !props.bordered,
31466
+ "gct-input-password-masked": props.type === "password"
31436
31467
  }));
31437
31468
  const wrapperClasses = computed(() => ({
31438
31469
  "gct-input-wrapper-disabled": props.disabled
@@ -31447,6 +31478,27 @@ const _sfc_main$3g = /* @__PURE__ */ defineComponent({
31447
31478
  const inputStyle = computed(() => ({
31448
31479
  ...props.type === "textarea" && props.showCount ? { paddingBottom: "24px" } : {}
31449
31480
  }));
31481
+ const realType = computed(() => {
31482
+ if (props.type === "password") {
31483
+ return "text";
31484
+ }
31485
+ return props.type;
31486
+ });
31487
+ const resolvedAutocomplete = computed(() => {
31488
+ if (props.autocomplete) {
31489
+ return props.autocomplete;
31490
+ }
31491
+ return props.type === "password" ? "one-time-code" : "off";
31492
+ });
31493
+ const resolvedInputName = computed(() => {
31494
+ if (props.name) {
31495
+ return props.name;
31496
+ }
31497
+ if (props.id) {
31498
+ return props.id;
31499
+ }
31500
+ return `gct-field-${componentUid}`;
31501
+ });
31450
31502
  const countValue = computed(() => {
31451
31503
  const value = props.modelValue ? String(props.modelValue) : "";
31452
31504
  return value.length;
@@ -31527,17 +31579,24 @@ const _sfc_main$3g = /* @__PURE__ */ defineComponent({
31527
31579
  ref_key: "inputRef",
31528
31580
  ref: inputRef,
31529
31581
  id: props.id,
31582
+ name: resolvedInputName.value,
31530
31583
  class: normalizeClass(["gct-input", inputClasses.value]),
31531
31584
  style: normalizeStyle(inputStyle.value),
31532
- type: props.type,
31585
+ type: realType.value,
31533
31586
  value: props.modelValue,
31534
31587
  placeholder: props.placeholder,
31535
31588
  disabled: props.disabled,
31536
31589
  readonly: props.readonly,
31537
31590
  maxlength: props.maxLength,
31538
- autocomplete: props.autocomplete,
31591
+ autocomplete: resolvedAutocomplete.value,
31592
+ autocapitalize: "off",
31593
+ autocorrect: "off",
31594
+ "aria-autocomplete": "none",
31595
+ "data-form-type": "other",
31596
+ "data-lpignore": "true",
31597
+ "data-1p-ignore": "true",
31598
+ "data-bwignore": "true",
31539
31599
  autofocus: props.autofocus,
31540
- name: props.name,
31541
31600
  spellcheck: props.spellcheck,
31542
31601
  onInput: handleInput,
31543
31602
  onChange: handleChange,
@@ -31572,7 +31631,7 @@ const _sfc_main$3g = /* @__PURE__ */ defineComponent({
31572
31631
  };
31573
31632
  }
31574
31633
  });
31575
- const GctInput = /* @__PURE__ */ _export_sfc(_sfc_main$3g, [["__scopeId", "data-v-6fcf124f"]]);
31634
+ const GctInput = /* @__PURE__ */ _export_sfc(_sfc_main$3g, [["__scopeId", "data-v-c407ada7"]]);
31576
31635
  var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE = 1e14, LOG_BASE = 14, MAX_SAFE_INTEGER = 9007199254740991, POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], SQRT_BASE = 1e7, MAX = 1e9;
31577
31636
  function clone(configObject) {
31578
31637
  var div, convertBase, parseNumeric, P2 = BigNumber2.prototype = { constructor: BigNumber2, toString: null, valueOf: null }, ONE = new BigNumber2(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
@@ -34708,7 +34767,7 @@ const _hoisted_5$x = {
34708
34767
  };
34709
34768
  const _hoisted_6$n = ["title"];
34710
34769
  const _hoisted_7$j = { class: "selection-tag-content" };
34711
- const _hoisted_8$h = {
34770
+ const _hoisted_8$g = {
34712
34771
  key: 2,
34713
34772
  class: "placeholder"
34714
34773
  };
@@ -34935,7 +34994,7 @@ const _sfc_main$35 = /* @__PURE__ */ defineComponent({
34935
34994
  }, null, 8, ["onClick"])
34936
34995
  ]);
34937
34996
  }), 128)) : createCommentVNode("", true),
34938
- !selectedOptions.value.length ? (openBlock(), createElementBlock("div", _hoisted_8$h, toDisplayString(__props.placeholder), 1)) : createCommentVNode("", true),
34997
+ !selectedOptions.value.length ? (openBlock(), createElementBlock("div", _hoisted_8$g, toDisplayString(__props.placeholder), 1)) : createCommentVNode("", true),
34939
34998
  !__props.multiple && !__props.noArrow ? (openBlock(), createBlock(unref(GctIcon), {
34940
34999
  key: 3,
34941
35000
  class: "change-icon",
@@ -37508,7 +37567,12 @@ class ResizeCol extends CommandBase {
37508
37567
  );
37509
37568
  }
37510
37569
  table.resizeCol(colIndex, UnitConverter.pixelToDxa(width));
37511
- return null;
37570
+ const firstWp = table.getFirstWp();
37571
+ return {
37572
+ wp: firstWp,
37573
+ pos: 0,
37574
+ side: "after"
37575
+ };
37512
37576
  }
37513
37577
  }
37514
37578
  const __vite_glob_0_22$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -37577,7 +37641,12 @@ class ResizeRow extends CommandBase {
37577
37641
  );
37578
37642
  }
37579
37643
  table.resizeRow(rowIndex, UnitConverter.pixelToTwip(height));
37580
- return null;
37644
+ const firstWp = table.getFirstWp();
37645
+ return {
37646
+ wp: firstWp,
37647
+ pos: 0,
37648
+ side: "after"
37649
+ };
37581
37650
  }
37582
37651
  }
37583
37652
  const __vite_glob_0_25$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -37846,6 +37915,7 @@ class SetBoundedItem extends CommandBase {
37846
37915
  };
37847
37916
  const boundedRegion = this.getBoundedRegion(startCell, endCell);
37848
37917
  if (!boundedRegion) {
37918
+ GctMessage.warning("选区不在固定表范围内");
37849
37919
  throw new Error("Cells are not in a bounded region");
37850
37920
  }
37851
37921
  this.output = boundedRegion.setItemRegion({
@@ -37863,6 +37933,7 @@ class SetBoundedItem extends CommandBase {
37863
37933
  getBoundedRegion(startCell, endCell) {
37864
37934
  const region = this.getRegion(startCell, endCell);
37865
37935
  if (!region) {
37936
+ GctMessage.warning("选区超出子表范围");
37866
37937
  throw new Error("Cells are not in the same region");
37867
37938
  }
37868
37939
  return region.type === "bounded" ? region : void 0;
@@ -37946,6 +38017,7 @@ class SetDataGroup2D extends CommandBase {
37946
38017
  if (models.length === 0) return null;
37947
38018
  const startCell = models[0].model;
37948
38019
  const endCell = models[models.length - 1].model;
38020
+ const cellList = [...models.map((m) => m.model)];
37949
38021
  const start = {
37950
38022
  row: startCell.parent?.getCurrentIndex(),
37951
38023
  col: startCell.getCurrentIndex()
@@ -37954,7 +38026,7 @@ class SetDataGroup2D extends CommandBase {
37954
38026
  row: endCell.parent?.getCurrentIndex(),
37955
38027
  col: endCell.getCurrentIndex()
37956
38028
  };
37957
- const subTableRegion = this.getSubTableRegion(startCell, endCell);
38029
+ const subTableRegion = this.getSubTableRegion(cellList);
37958
38030
  if (!subTableRegion) {
37959
38031
  throw new Error("Cells are not in a sub table region supporting data-group-2d");
37960
38032
  }
@@ -37966,33 +38038,22 @@ class SetDataGroup2D extends CommandBase {
37966
38038
  }
37967
38039
  /**
37968
38040
  *
37969
- * @param startCell
37970
- * @param endCell
38041
+ * @param cellList
37971
38042
  * @returns
37972
38043
  */
37973
- getSubTableRegion(startCell, endCell) {
37974
- const region = this.getRegion(startCell, endCell);
38044
+ getSubTableRegion(cellList) {
38045
+ let region;
38046
+ cellList.some((cell) => {
38047
+ const r = cell.getRegion();
38048
+ if (r && ["check-table", "2d-table"].includes(r.type)) {
38049
+ region = r;
38050
+ return true;
38051
+ }
38052
+ });
37975
38053
  if (!region) {
37976
- throw new Error("Cells are not in the same region");
37977
- }
37978
- return ["check-table", "2d-table"].includes(region.type) ? region : void 0;
37979
- }
37980
- /**
37981
- * 获取公共区域
37982
- * @param startCell
37983
- * @param endCell
37984
- * @returns
37985
- */
37986
- getRegion(startCell, endCell) {
37987
- if (startCell === endCell) {
37988
- return startCell.getRegion();
37989
- }
37990
- const startRegion = startCell.getRegion();
37991
- const endRegion = endCell.getRegion();
37992
- if (startRegion && endRegion && startRegion === endRegion) {
37993
- return startRegion;
38054
+ throw new Error("No region found");
37994
38055
  }
37995
- return;
38056
+ return region;
37996
38057
  }
37997
38058
  }
37998
38059
  const __vite_glob_0_33$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -38129,11 +38190,7 @@ class SetPadding extends CommandBase {
38129
38190
  return null;
38130
38191
  }
38131
38192
  const [top, right, bottom, left] = padding;
38132
- section.margins ??= {};
38133
- section.margins.top = top;
38134
- section.margins.right = right;
38135
- section.margins.bottom = bottom;
38136
- section.margins.left = left;
38193
+ section.setMargins(top, bottom, left, right);
38137
38194
  return null;
38138
38195
  }
38139
38196
  }
@@ -38868,6 +38925,10 @@ class TextUtil {
38868
38925
  static FONT_METRICS_CACHE_LIMIT = 50;
38869
38926
  /** 布局大小缓存限制 */
38870
38927
  static LAYOUT_SIZE_CACHE_LIMIT = 100;
38928
+ /** 东亚常见全宽字符块 */
38929
+ static EAST_ASIAN_FULL_WIDTH_REGEX = /[\u3000-\u303F\u3040-\u30FF\u31F0-\u31FF\uFF01-\uFF60\uFFE0-\uFFE6]/u;
38930
+ /** 表单/文档中常见的几何符号 */
38931
+ static FULL_WIDTH_SYMBOL_REGEX = /[□■○●△▲▽▼◇◆◎※]/u;
38871
38932
  static fontMetricsCache = /* @__PURE__ */ new Map();
38872
38933
  static layoutSizeCache = /* @__PURE__ */ new Map();
38873
38934
  /**
@@ -38878,6 +38939,35 @@ class TextUtil {
38878
38939
  static isHanChar(char) {
38879
38940
  return new RegExp("\\p{Script=Han}", "u").test(char);
38880
38941
  }
38942
+ /**
38943
+ * 验证是否为应按 1em 处理的全宽单字符
38944
+ * @param char
38945
+ * @returns
38946
+ */
38947
+ static isFullWidthChar(char) {
38948
+ if ([...char].length !== 1) {
38949
+ return false;
38950
+ }
38951
+ return this.isHanChar(char) || this.EAST_ASIAN_FULL_WIDTH_REGEX.test(char) || this.FULL_WIDTH_SYMBOL_REGEX.test(char);
38952
+ }
38953
+ /**
38954
+ * 生成文本度量缓存键
38955
+ * @param payload
38956
+ * @param includeText
38957
+ * @returns
38958
+ */
38959
+ static getMeasureCacheKey(payload, includeText = true) {
38960
+ return JSON.stringify({
38961
+ text: includeText ? payload.text ?? "" : "",
38962
+ fontSize: payload.fontSize ?? "",
38963
+ fontFamily: payload.fontFamily ?? "",
38964
+ fontStyle: payload.fontStyle ?? "",
38965
+ fontVariant: payload.fontVariant ?? "",
38966
+ lineHeight: payload.lineHeight ?? "",
38967
+ padding: payload.padding ?? "",
38968
+ letterSpacing: payload.letterSpacing ?? ""
38969
+ });
38970
+ }
38881
38971
  /**
38882
38972
  * 计算度量 - 基于 JSON 序列化的缓存(LRU)
38883
38973
  * 将最终的 config 序列化为缓存键,相同配置直接返回缓存结果
@@ -38891,7 +38981,7 @@ class TextUtil {
38891
38981
  text: targetText,
38892
38982
  lineHeight: 1
38893
38983
  });
38894
- const cacheKey = `${config.fontSize}`;
38984
+ const cacheKey = this.getMeasureCacheKey(config, false);
38895
38985
  if (this.fontMetricsCache.has(cacheKey)) {
38896
38986
  const result2 = this.fontMetricsCache.get(cacheKey);
38897
38987
  this.fontMetricsCache.delete(cacheKey);
@@ -38917,16 +39007,17 @@ class TextUtil {
38917
39007
  * @returns
38918
39008
  */
38919
39009
  static getLayoutSize(payload) {
38920
- if (this.isHanChar(payload.text)) {
39010
+ if (this.isFullWidthChar(payload.text ?? "")) {
39011
+ const fontSize2 = payload.fontSize ?? 0;
38921
39012
  return {
38922
- width: payload.fontSize,
38923
- height: payload.fontSize
39013
+ width: fontSize2,
39014
+ height: fontSize2
38924
39015
  };
38925
39016
  }
38926
39017
  const config = Object.assign({}, payload, {
38927
39018
  lineHeight: 1
38928
39019
  });
38929
- const cacheKey = `${config.text}|${config.fontSize}`;
39020
+ const cacheKey = this.getMeasureCacheKey(config);
38930
39021
  if (this.layoutSizeCache.has(cacheKey)) {
38931
39022
  const result2 = this.layoutSizeCache.get(cacheKey);
38932
39023
  this.layoutSizeCache.delete(cacheKey);
@@ -40219,7 +40310,7 @@ let BaseHandler$1 = class BaseHandler {
40219
40310
  static getNoValueLabel(ctx) {
40220
40311
  const { context, wr } = ctx;
40221
40312
  if (context.doc.mode === DocModeTypeConst.Print) {
40222
- return { label: wr.widgetMeta?.props.emptySymbol ?? "--", type: "noneLabel" };
40313
+ return { label: wr.widgetMeta?.props.emptySymbol ?? "", type: "noneLabel" };
40223
40314
  } else {
40224
40315
  if (wr.widgetMeta?.props?.placeholder) {
40225
40316
  return {
@@ -42267,8 +42358,8 @@ class TableExpander {
42267
42358
  const tlr = itemRange.start.row;
42268
42359
  const tlc = itemRange.start.col;
42269
42360
  let dataIndex = 1;
42270
- let currentCol = itemRange.end.col + 1;
42271
42361
  let currentRow = itemRange.start.row;
42362
+ let currentCol = itemRange.end.col + 1;
42272
42363
  while (currentRow + itemHeight - 1 <= range3.end.row) {
42273
42364
  while (currentCol + itemWidth - 1 <= range3.end.col) {
42274
42365
  for (let r = currentRow; r < currentRow + itemHeight; r++) {
@@ -50874,7 +50965,8 @@ async function initializeDocumentEngine(props, payload, result) {
50874
50965
  handleInfo: {
50875
50966
  btnRenderModeType: result.btnModelType,
50876
50967
  bpmnType: result.bpmnType,
50877
- bpmnFieldAuthMap: result.bpmnFieldAuthMap
50968
+ bpmnFieldAuthMap: result.bpmnFieldAuthMap,
50969
+ initDocModelJson: JSON.stringify(docModel.toXmlJson())
50878
50970
  }
50879
50971
  };
50880
50972
  const doc = new Doc({
@@ -55119,7 +55211,7 @@ const _hoisted_4$E = ["onMousedown"];
55119
55211
  const _hoisted_5$u = { class: "row-headers" };
55120
55212
  const _hoisted_6$m = ["onMouseenter"];
55121
55213
  const _hoisted_7$i = ["onClick"];
55122
- const _hoisted_8$g = ["onMousedown"];
55214
+ const _hoisted_8$f = ["onMousedown"];
55123
55215
  const _sfc_main$2B = /* @__PURE__ */ defineComponent({
55124
55216
  __name: "index",
55125
55217
  props: {
@@ -55214,7 +55306,7 @@ const _sfc_main$2B = /* @__PURE__ */ defineComponent({
55214
55306
  e.stopPropagation();
55215
55307
  const start = axis === "col" ? e.clientX : e.clientY;
55216
55308
  const base = axis === "col" ? props.colWidths.slice(0, index2 + 1).reduce((a, b2) => a + b2, 0) : props.rows.slice(0, index2 + 1).reduce((a, r) => a + r.height, 0);
55217
- dragging.value = { axis, index: index2, realRowIndex: row.realRowIndex, start, base };
55309
+ dragging.value = { axis, index: index2, realRowIndex: row?.realRowIndex, start, base };
55218
55310
  axis === "col" ? guideColX.value = base : guideRowY.value = base;
55219
55311
  document.addEventListener("mousemove", onResizeMove);
55220
55312
  document.addEventListener("mouseup", onResizeUp);
@@ -55463,7 +55555,7 @@ const _sfc_main$2B = /* @__PURE__ */ defineComponent({
55463
55555
  width: `${__props.tableWidth}px`
55464
55556
  }),
55465
55557
  onMousedown: ($event) => onResizeMouseDown("row", rowIndex, $event, row)
55466
- }, null, 46, _hoisted_8$g)
55558
+ }, null, 46, _hoisted_8$f)
55467
55559
  ]);
55468
55560
  }), 128))
55469
55561
  ])
@@ -55472,7 +55564,7 @@ const _sfc_main$2B = /* @__PURE__ */ defineComponent({
55472
55564
  };
55473
55565
  }
55474
55566
  });
55475
- const TableActionOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$2B, [["__scopeId", "data-v-47aab70a"]]);
55567
+ const TableActionOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$2B, [["__scopeId", "data-v-c40eef9f"]]);
55476
55568
  const _sfc_main$2A = /* @__PURE__ */ defineComponent({
55477
55569
  __name: "table-guide-line",
55478
55570
  props: {
@@ -55708,7 +55800,7 @@ const _hoisted_4$D = { class: "insert-row-item" };
55708
55800
  const _hoisted_5$t = { class: "insert-row-item" };
55709
55801
  const _hoisted_6$l = { class: "sub-table-btn" };
55710
55802
  const _hoisted_7$h = { class: "sub-table-action-bar" };
55711
- const _hoisted_8$f = { class: "sub-table-btn" };
55803
+ const _hoisted_8$e = { class: "sub-table-btn" };
55712
55804
  const _sfc_main$2x = /* @__PURE__ */ defineComponent({
55713
55805
  __name: "sub-table-action",
55714
55806
  props: {
@@ -55877,7 +55969,7 @@ const _sfc_main$2x = /* @__PURE__ */ defineComponent({
55877
55969
  ]),
55878
55970
  default: withCtx(() => [
55879
55971
  createElementVNode("div", _hoisted_7$h, [
55880
- createElementVNode("div", _hoisted_8$f, [
55972
+ createElementVNode("div", _hoisted_8$e, [
55881
55973
  createVNode(unref(GctIcon), {
55882
55974
  icon: "icon-neibuyingyong",
55883
55975
  color: "#5378ff"
@@ -56414,6 +56506,14 @@ function useDocOperations(docRef) {
56414
56506
  function getDoc() {
56415
56507
  return docRef.value ?? null;
56416
56508
  }
56509
+ function buildSaveCheckpoint() {
56510
+ const doc = getDoc();
56511
+ if (!doc) return null;
56512
+ return {
56513
+ interfaceModel: doc.docRuntimeMeta.handleInfo.initDocModelJson,
56514
+ currentModel: JSON.stringify(exportModel())
56515
+ };
56516
+ }
56417
56517
  async function validate() {
56418
56518
  const doc = getDoc();
56419
56519
  if (!doc) return null;
@@ -56467,13 +56567,27 @@ function useDocOperations(docRef) {
56467
56567
  focus: ids.length ? `root::${firstPage.id}` : null
56468
56568
  });
56469
56569
  }
56570
+ function getUnsavedChanges() {
56571
+ const currentCheckpoint = buildSaveCheckpoint();
56572
+ if (!currentCheckpoint) {
56573
+ return { dirty: false };
56574
+ }
56575
+ const changedScopes = [];
56576
+ if (!isEqual(currentCheckpoint.currentModel, currentCheckpoint.interfaceModel)) {
56577
+ changedScopes.push("model");
56578
+ }
56579
+ return {
56580
+ dirty: changedScopes.length > 0
56581
+ };
56582
+ }
56470
56583
  return {
56471
56584
  validate,
56472
56585
  exportModel,
56473
56586
  getDocumentAttachmentPaths,
56474
56587
  enterBaseline,
56475
56588
  computeBaselineChanges,
56476
- setAnnotation
56589
+ setAnnotation,
56590
+ getUnsavedChanges
56477
56591
  };
56478
56592
  }
56479
56593
  function useDocController(factory2, ops) {
@@ -56540,6 +56654,9 @@ function useDocController(factory2, ops) {
56540
56654
  computeBaselineChanges(ctx) {
56541
56655
  return ops.computeBaselineChanges(ctx);
56542
56656
  },
56657
+ getUnsavedChanges() {
56658
+ return ops.getUnsavedChanges();
56659
+ },
56543
56660
  setAnnotation(ids, list) {
56544
56661
  ops.setAnnotation(ids, list);
56545
56662
  }
@@ -57500,7 +57617,7 @@ const _hoisted_4$C = ["onClick"];
57500
57617
  const _hoisted_5$s = { class: "color-content-standard" };
57501
57618
  const _hoisted_6$k = { class: "items" };
57502
57619
  const _hoisted_7$g = ["onClick"];
57503
- const _hoisted_8$e = { class: "color-content-used" };
57620
+ const _hoisted_8$d = { class: "color-content-used" };
57504
57621
  const _hoisted_9$9 = { class: "items" };
57505
57622
  const _hoisted_10$6 = ["onClick"];
57506
57623
  const _hoisted_11$4 = {
@@ -57611,7 +57728,7 @@ const _sfc_main$2o = /* @__PURE__ */ defineComponent({
57611
57728
  }), 256))
57612
57729
  ])
57613
57730
  ]),
57614
- createElementVNode("div", _hoisted_8$e, [
57731
+ createElementVNode("div", _hoisted_8$d, [
57615
57732
  _cache[5] || (_cache[5] = createElementVNode("div", { class: "title" }, "已使用字体颜色", -1)),
57616
57733
  createElementVNode("div", _hoisted_9$9, [
57617
57734
  unref(colorUtils).standard.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(colorUtils).standard, (c2, idx) => {
@@ -58724,7 +58841,7 @@ const _hoisted_5$p = {
58724
58841
  };
58725
58842
  const _hoisted_6$i = { class: "field-list" };
58726
58843
  const _hoisted_7$e = ["draggable", "onDragstart"];
58727
- const _hoisted_8$d = ["innerHTML", "title"];
58844
+ const _hoisted_8$c = ["innerHTML", "title"];
58728
58845
  const _hoisted_9$8 = {
58729
58846
  key: 1,
58730
58847
  class: "empty"
@@ -58846,7 +58963,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
58846
58963
  class: "field-title",
58847
58964
  innerHTML: f.highlightName || f.field.name,
58848
58965
  title: f.field.name
58849
- }, null, 8, _hoisted_8$d)
58966
+ }, null, 8, _hoisted_8$c)
58850
58967
  ], 40, _hoisted_7$e);
58851
58968
  }), 128))
58852
58969
  ])
@@ -59654,9 +59771,18 @@ const _hoisted_3$K = { class: "item-suffix" };
59654
59771
  const _hoisted_4$x = { class: "item-suffix" };
59655
59772
  const _sfc_main$28 = /* @__PURE__ */ defineComponent({
59656
59773
  __name: "table-menu",
59774
+ props: {
59775
+ table: {},
59776
+ tableRow: {},
59777
+ tableCell: {}
59778
+ },
59657
59779
  setup(__props) {
59658
59780
  const { docInst } = useDocPubApiContext();
59659
59781
  const { interaction } = useTableSelection();
59782
+ const props = __props;
59783
+ const tableId = props.table?.id;
59784
+ const rowIndex = props.tableRow?.pathIndex.at(-1);
59785
+ const colIndex = props.tableCell?.pathIndex.at(-1);
59660
59786
  const insertBeforeColCount = ref(1);
59661
59787
  const insertAfterColCount = ref(1);
59662
59788
  const insertBeforeRowCount = ref(1);
@@ -59683,35 +59809,35 @@ const _sfc_main$28 = /* @__PURE__ */ defineComponent({
59683
59809
  const handleAction = (type4, options) => {
59684
59810
  switch (type4) {
59685
59811
  case "add-col":
59686
- if (!interaction.tableSelection) return;
59812
+ if (!tableId || colIndex === void 0) return;
59687
59813
  docInst?.value?.execute(CommandType.insertCol, {
59688
- tableId: interaction.tableSelection.tableId,
59689
- colIndex: interaction.tableSelection.index,
59814
+ tableId,
59815
+ colIndex,
59690
59816
  position: options,
59691
59817
  count: options === "before" ? insertBeforeColCount.value : insertAfterColCount.value
59692
59818
  });
59693
59819
  break;
59694
59820
  case "delete-col":
59695
- if (!interaction.tableSelection) return;
59821
+ if (!tableId || colIndex === void 0) return;
59696
59822
  docInst.value.execute(CommandType.deleteCol, {
59697
- tableId: interaction.tableSelection.tableId,
59698
- colIndex: interaction.tableSelection.index
59823
+ tableId,
59824
+ colIndex
59699
59825
  });
59700
59826
  break;
59701
59827
  case "add-row":
59702
- if (!interaction.tableSelection) return;
59828
+ if (!tableId || rowIndex === void 0) return;
59703
59829
  docInst?.value?.execute(CommandType.insertRow, {
59704
- tableId: interaction.tableSelection.tableId,
59705
- rowIndex: interaction.tableSelection.realRowIndex || interaction.tableSelection.index,
59830
+ tableId,
59831
+ rowIndex,
59706
59832
  position: options,
59707
59833
  count: options === "before" ? insertBeforeRowCount.value : insertAfterRowCount.value
59708
59834
  });
59709
59835
  break;
59710
59836
  case "delete-row":
59711
- if (!interaction.tableSelection) return;
59837
+ if (!tableId || rowIndex === void 0) return;
59712
59838
  docInst?.value?.execute(CommandType.deleteRow, {
59713
- tableId: interaction.tableSelection.tableId,
59714
- rowIndex: interaction.tableSelection.realRowIndex || interaction.tableSelection.index
59839
+ tableId,
59840
+ rowIndex
59715
59841
  });
59716
59842
  break;
59717
59843
  case "data-group":
@@ -59866,7 +59992,7 @@ const _sfc_main$28 = /* @__PURE__ */ defineComponent({
59866
59992
  };
59867
59993
  }
59868
59994
  });
59869
- const TableMenu = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__scopeId", "data-v-2e53d82b"]]);
59995
+ const TableMenu = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__scopeId", "data-v-05c3a67d"]]);
59870
59996
  const OFFSET = 4;
59871
59997
  const _sfc_main$27 = /* @__PURE__ */ defineComponent({
59872
59998
  __name: "index",
@@ -59878,16 +60004,31 @@ const _sfc_main$27 = /* @__PURE__ */ defineComponent({
59878
60004
  };
59879
60005
  const menuVisible = ref(false);
59880
60006
  const pos = ref({ x: 0, y: 0 });
60007
+ const contextMenuRef = ref(null);
60008
+ const menuProps = ref({});
59881
60009
  const menuComponent = ref(null);
59882
- const menuRef = ref(null);
59883
60010
  const show = (params) => {
59884
- const { x: x2, y: y2, type: type4 } = params;
60011
+ const {
60012
+ x: x2,
60013
+ y: y2,
60014
+ type: type4,
60015
+ table,
60016
+ tableRow,
60017
+ tableCell
60018
+ } = params;
60019
+ if (type4 === "table") {
60020
+ menuProps.value = {
60021
+ table,
60022
+ tableRow,
60023
+ tableCell
60024
+ };
60025
+ }
59885
60026
  pos.value = { x: x2, y: y2 };
59886
60027
  menuComponent.value = menuMap[type4];
59887
60028
  menuVisible.value = true;
59888
60029
  nextTick(() => {
59889
- if (!menuRef.value) return;
59890
- const { x: x22, y: y22, width, height } = menuRef.value.getBoundingClientRect();
60030
+ if (!contextMenuRef.value) return;
60031
+ const { x: x22, y: y22, width, height } = contextMenuRef.value.getBoundingClientRect();
59891
60032
  const { innerWidth, innerHeight } = window;
59892
60033
  const right = x22 + width;
59893
60034
  const bottom = y22 + height;
@@ -59898,29 +60039,30 @@ const _sfc_main$27 = /* @__PURE__ */ defineComponent({
59898
60039
  });
59899
60040
  };
59900
60041
  const container2 = document.querySelector(".render-container");
59901
- const closeMenu = () => {
60042
+ const hide = () => {
59902
60043
  menuVisible.value = false;
59903
60044
  };
59904
60045
  onMounted(() => {
59905
- window.addEventListener("click", closeMenu);
59906
- container2?.addEventListener("scroll", closeMenu);
60046
+ window.addEventListener("click", hide);
60047
+ container2?.addEventListener("scroll", hide);
59907
60048
  });
59908
60049
  onBeforeUnmount(() => {
59909
- window.removeEventListener("click", closeMenu);
59910
- container2?.removeEventListener("scroll", closeMenu);
60050
+ window.removeEventListener("click", hide);
60051
+ container2?.removeEventListener("scroll", hide);
59911
60052
  });
59912
60053
  __expose({
59913
- show
60054
+ show,
60055
+ hide
59914
60056
  });
59915
60057
  return (_ctx, _cache) => {
59916
60058
  return menuVisible.value ? (openBlock(), createElementBlock("div", {
59917
60059
  key: 0,
59918
- ref_key: "menuRef",
59919
- ref: menuRef,
60060
+ ref_key: "contextMenuRef",
60061
+ ref: contextMenuRef,
59920
60062
  class: "context-menu",
59921
60063
  style: normalizeStyle({ left: pos.value.x + "px", top: pos.value.y + "px" })
59922
60064
  }, [
59923
- (openBlock(), createBlock(resolveDynamicComponent(menuComponent.value)))
60065
+ (openBlock(), createBlock(resolveDynamicComponent(menuComponent.value), normalizeProps(guardReactiveProps(menuProps.value)), null, 16))
59924
60066
  ], 4)) : createCommentVNode("", true);
59925
60067
  };
59926
60068
  }
@@ -60115,7 +60257,7 @@ const _hoisted_5$m = {
60115
60257
  };
60116
60258
  const _hoisted_6$g = { class: "cl__user" };
60117
60259
  const _hoisted_7$c = ["dateTime"];
60118
- const _hoisted_8$c = {
60260
+ const _hoisted_8$b = {
60119
60261
  key: 0,
60120
60262
  class: "cl__row"
60121
60263
  };
@@ -60238,7 +60380,7 @@ const _sfc_main$24 = /* @__PURE__ */ defineComponent({
60238
60380
  dateTime: __props.data.time
60239
60381
  }, toDisplayString(__props.data.time), 9, _hoisted_7$c)
60240
60382
  ]),
60241
- __props.data.reason ? (openBlock(), createElementBlock("div", _hoisted_8$c, [
60383
+ __props.data.reason ? (openBlock(), createElementBlock("div", _hoisted_8$b, [
60242
60384
  createElementVNode("div", {
60243
60385
  class: normalizeClass(["cl__label", __props.data.changeType])
60244
60386
  }, toDisplayString(getReasonLabel(__props.data.changeType)) + ":", 3),
@@ -60463,19 +60605,33 @@ const _sfc_main$22 = /* @__PURE__ */ defineComponent({
60463
60605
  };
60464
60606
  const handleKonvaContextMenu = (e) => {
60465
60607
  e.evt.preventDefault();
60466
- const { clientX: x2, clientY: y2 } = e.evt;
60467
- const componentTypes = getParentIds(e.target).map((id) => docInst.value.layoutMapper.dataCenter.get(id)?.component);
60468
- const isInTable = componentTypes.some((t) => ["table", "tableCell"].includes(t));
60469
- if (!isInTable) return;
60470
- const map2 = {
60608
+ const closestParentId = getParentIds(e.target)[0];
60609
+ if (!closestParentId) return;
60610
+ const pathIdList = docInst.value.layoutMapper.dataCenter.get(closestParentId)?.path;
60611
+ if (!pathIdList) return;
60612
+ const nodeList = pathIdList.map((id) => id ? docInst.value.layoutMapper.dataCenter.get(id) : void 0);
60613
+ const nodeTypes = nodeList.map((n) => n?.component);
60614
+ const isInTable = nodeTypes.some((t) => ["table", "tableRow", "tableCell"].includes(t));
60615
+ const table = nodeList.find((n) => n?.component === "table");
60616
+ const tableRow = nodeList.find((n) => n?.component === "tableRow");
60617
+ const tableCell = nodeList.find((n) => n?.component === "tableCell");
60618
+ if (!isInTable) {
60619
+ contextMenuRef.value.hide();
60620
+ return;
60621
+ }
60622
+ const visibleMap = {
60471
60623
  table: isInTable
60472
60624
  };
60473
- const type4 = Object.entries(map2).find(([, isTrue]) => isTrue)[0];
60625
+ const { clientX: x2, clientY: y2 } = e.evt;
60626
+ const type4 = Object.entries(visibleMap).find(([, isTrue]) => isTrue)[0];
60474
60627
  docInst.value.eventManager.dispatchCustom("konva:contextmenu", {
60475
60628
  contextMenuRef,
60476
60629
  x: x2,
60477
60630
  y: y2,
60478
- type: type4
60631
+ type: type4,
60632
+ table,
60633
+ tableRow,
60634
+ tableCell
60479
60635
  });
60480
60636
  };
60481
60637
  function getPagesDataURL() {
@@ -60592,7 +60748,7 @@ const _sfc_main$22 = /* @__PURE__ */ defineComponent({
60592
60748
  };
60593
60749
  }
60594
60750
  });
60595
- const DocLayout = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__scopeId", "data-v-ddab7707"]]);
60751
+ const DocLayout = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__scopeId", "data-v-fcaa8330"]]);
60596
60752
  const _sfc_main$21 = /* @__PURE__ */ defineComponent({
60597
60753
  __name: "editable-canvas",
60598
60754
  props: {
@@ -60740,26 +60896,85 @@ const useDocDesignLayoutProps = () => {
60740
60896
  injectProps
60741
60897
  };
60742
60898
  };
60743
- const _hoisted_1$1s = { class: "doc-design-layout" };
60744
- const _hoisted_2$W = { class: "design-body" };
60745
- const _hoisted_3$H = {
60899
+ var COLUMNS_TYPE = /* @__PURE__ */ ((COLUMNS_TYPE2) => {
60900
+ COLUMNS_TYPE2["LEFT"] = "left";
60901
+ COLUMNS_TYPE2["CENTER"] = "center";
60902
+ COLUMNS_TYPE2["RIGHT"] = "right";
60903
+ COLUMNS_TYPE2["TOP"] = "top";
60904
+ COLUMNS_TYPE2["BOTTOM"] = "bottom";
60905
+ return COLUMNS_TYPE2;
60906
+ })(COLUMNS_TYPE || {});
60907
+ const REVERSE_TYPES = [
60908
+ "right",
60909
+ "bottom"
60910
+ /* BOTTOM */
60911
+ ];
60912
+ function useDragLine(startValue, rowType, config = {}) {
60913
+ const { minValue = 10 } = config;
60914
+ const startMove = ref(startValue);
60915
+ let containerSize = 2e3;
60916
+ let lastClient = 0;
60917
+ const isVertical = rowType === "top" || rowType === "bottom";
60918
+ const isReverse = REVERSE_TYPES.includes(rowType);
60919
+ const clientKey = isVertical ? "clientY" : "clientX";
60920
+ const sizeKey = isVertical ? "offsetHeight" : "offsetWidth";
60921
+ function normalizeValue2(value) {
60922
+ return isReverse ? containerSize - value : value;
60923
+ }
60924
+ function clamp(value) {
60925
+ return Math.min(Math.max(value, minValue), containerSize - minValue);
60926
+ }
60927
+ function moveHandle(client) {
60928
+ const delta = client - lastClient;
60929
+ const nextValue = normalizeValue2(normalizeValue2(startMove.value) + delta);
60930
+ startMove.value = clamp(nextValue);
60931
+ lastClient = client;
60932
+ }
60933
+ function moveDomDown(event, el, onMouseUp) {
60934
+ containerSize = el[sizeKey];
60935
+ lastClient = event[clientKey];
60936
+ event.preventDefault();
60937
+ const handleMouseMove = (e) => {
60938
+ moveHandle(e[clientKey]);
60939
+ };
60940
+ const handleMouseUp = () => {
60941
+ document.removeEventListener("mousemove", handleMouseMove);
60942
+ document.removeEventListener("mouseup", handleMouseUp);
60943
+ onMouseUp?.();
60944
+ };
60945
+ document.addEventListener("mousemove", handleMouseMove);
60946
+ document.addEventListener("mouseup", handleMouseUp);
60947
+ }
60948
+ const start = computed({
60949
+ get: () => clamp(startMove.value),
60950
+ set: (value) => {
60951
+ startMove.value = clamp(value);
60952
+ }
60953
+ });
60954
+ return {
60955
+ moveDomDown,
60956
+ start
60957
+ };
60958
+ }
60959
+ const _hoisted_1$1s = { class: "design-body" };
60960
+ const _hoisted_2$W = {
60746
60961
  class: "design-main",
60747
60962
  ref: "scrollRef"
60748
60963
  };
60749
- const _hoisted_4$u = {
60964
+ const _hoisted_3$H = {
60750
60965
  key: 1,
60751
60966
  class: "empty-container"
60752
60967
  };
60753
- const _hoisted_5$l = {
60968
+ const _hoisted_4$u = {
60754
60969
  key: 0,
60755
60970
  class: "right-container"
60756
60971
  };
60757
- const _hoisted_6$f = {
60972
+ const _hoisted_5$l = {
60758
60973
  key: 1,
60759
60974
  class: "design-footer"
60760
60975
  };
60976
+ const _hoisted_6$f = { style: { "padding": "0 12px" } };
60761
60977
  const _hoisted_7$b = { style: { "padding": "0 12px" } };
60762
- const _hoisted_8$b = { style: { "padding": "0 12px" } };
60763
60978
  const _sfc_main$20 = /* @__PURE__ */ defineComponent({
60764
60979
  __name: "doc-design-layout",
60765
60980
  props: {
@@ -60769,8 +60984,23 @@ const _sfc_main$20 = /* @__PURE__ */ defineComponent({
60769
60984
  const props = __props;
60770
60985
  const { provideProps } = useDocDesignLayoutProps();
60771
60986
  const { docInst, docInfo, loading, hasData, hasPages } = useDocPubApiContext();
60772
- const formTmplC = useFormTmplConfig().injectController();
60773
60987
  provideProps(props);
60988
+ const formTmplC = useFormTmplConfig().injectController();
60989
+ const layoutRef = ref();
60990
+ const { start: rightWidth, moveDomDown: rightMoveDomDown } = useDragLine(
60991
+ 348,
60992
+ COLUMNS_TYPE.RIGHT,
60993
+ {
60994
+ minValue: 348
60995
+ }
60996
+ );
60997
+ const handleMouseDown = (e) => {
60998
+ if (!layoutRef.value) return;
60999
+ rightMoveDomDown(e, layoutRef.value);
61000
+ };
61001
+ const isPreview = computed(() => {
61002
+ return docInst.value?.preview ?? false;
61003
+ });
60774
61004
  const {
60775
61005
  open: handleUploadFile,
60776
61006
  onChange: onFileUpload,
@@ -60779,10 +61009,7 @@ const _sfc_main$20 = /* @__PURE__ */ defineComponent({
60779
61009
  multiple: false,
60780
61010
  accept: ".docx"
60781
61011
  });
60782
- const isPreview = computed(() => {
60783
- return docInst.value?.preview ?? false;
60784
- });
60785
- const onImportTemplate = (payload) => {
61012
+ const onImportTemplate = () => {
60786
61013
  handleUploadFile();
60787
61014
  };
60788
61015
  const onImportData = (mainData) => {
@@ -60794,11 +61021,10 @@ const _sfc_main$20 = /* @__PURE__ */ defineComponent({
60794
61021
  if (!file) return;
60795
61022
  try {
60796
61023
  const res = await serviceUtil.parseFile(file);
60797
- if (res) {
60798
- const json = JSON.parse(res);
60799
- const docModel = ModelConverter.toModel(json);
60800
- docInst.value?.setModel(docModel);
60801
- }
61024
+ if (!res) return;
61025
+ const json = JSON.parse(res);
61026
+ const docModel = ModelConverter.toModel(json);
61027
+ docInst.value?.setModel(docModel);
60802
61028
  } finally {
60803
61029
  reset();
60804
61030
  }
@@ -60806,9 +61032,8 @@ const _sfc_main$20 = /* @__PURE__ */ defineComponent({
60806
61032
  watch(
60807
61033
  () => docInst.value?.docRuntimeMeta.id,
60808
61034
  (tmplId) => {
60809
- if (tmplId) {
60810
- formTmplC.init({ tmplId });
60811
- }
61035
+ if (!tmplId) return;
61036
+ formTmplC.init({ tmplId });
60812
61037
  },
60813
61038
  {
60814
61039
  immediate: true
@@ -60824,15 +61049,19 @@ const _sfc_main$20 = /* @__PURE__ */ defineComponent({
60824
61049
  "has-data": unref(hasData)
60825
61050
  }, {
60826
61051
  default: withCtx(() => [
60827
- createElementVNode("div", _hoisted_1$1s, [
61052
+ createElementVNode("div", {
61053
+ class: "doc-design-layout",
61054
+ ref_key: "layoutRef",
61055
+ ref: layoutRef
61056
+ }, [
60828
61057
  !isPreview.value ? (openBlock(), createBlock(Ribbon, { key: 0 })) : createCommentVNode("", true),
60829
- createElementVNode("div", _hoisted_2$W, [
60830
- _cache[0] || (_cache[0] = createElementVNode("aside", { class: "design-sidebar left" }, null, -1)),
60831
- createElementVNode("section", _hoisted_3$H, [
61058
+ createElementVNode("div", _hoisted_1$1s, [
61059
+ _cache[1] || (_cache[1] = createElementVNode("aside", { class: "design-sidebar left" }, null, -1)),
61060
+ createElementVNode("section", _hoisted_2$W, [
60832
61061
  unref(docInfo) && unref(hasPages) ? (openBlock(), createBlock(EditableCanvas, {
60833
61062
  key: 0,
60834
61063
  pages: unref(docInfo).pages
60835
- }, null, 8, ["pages"])) : (openBlock(), createElementBlock("div", _hoisted_4$u, [
61064
+ }, null, 8, ["pages"])) : (openBlock(), createElementBlock("div", _hoisted_3$H, [
60836
61065
  createVNode(unref(GctEmpty), {
60837
61066
  iconSrc: unref(emptyPng),
60838
61067
  iconHeight: 120
@@ -60841,28 +61070,34 @@ const _sfc_main$20 = /* @__PURE__ */ defineComponent({
60841
61070
  ], 512),
60842
61071
  createElementVNode("aside", {
60843
61072
  class: "design-sidebar right",
60844
- style: normalizeStyle({ width: isPreview.value ? "0px" : "348px" })
61073
+ style: normalizeStyle({
61074
+ width: isPreview.value ? "0px" : `${unref(rightWidth)}px`
61075
+ })
60845
61076
  }, [
60846
- !isPreview.value ? (openBlock(), createElementBlock("div", _hoisted_5$l, [
61077
+ !isPreview.value ? (openBlock(), createElementBlock("div", _hoisted_4$u, [
61078
+ createElementVNode("div", {
61079
+ class: "divider",
61080
+ onMousedown: _cache[0] || (_cache[0] = (e) => handleMouseDown(e))
61081
+ }, null, 32),
60847
61082
  createVNode(Toolkit),
60848
61083
  createVNode(Panel)
60849
61084
  ])) : createCommentVNode("", true)
60850
61085
  ], 4)
60851
61086
  ]),
60852
- !isPreview.value ? (openBlock(), createElementBlock("footer", _hoisted_6$f, [
61087
+ !isPreview.value ? (openBlock(), createElementBlock("footer", _hoisted_5$l, [
60853
61088
  createElementVNode("div", null, [
60854
- createElementVNode("span", _hoisted_7$b, "布局刷新次数:" + toDisplayString(unref(docInfo).updateTick), 1),
60855
- createElementVNode("span", _hoisted_8$b, "模式:" + toDisplayString(unref(docInst)?.modeLabel), 1)
61089
+ createElementVNode("span", _hoisted_6$f, " 布局刷新次数:" + toDisplayString(unref(docInfo).updateTick), 1),
61090
+ createElementVNode("span", _hoisted_7$b, " 模式:" + toDisplayString(unref(docInst)?.modeLabel), 1)
60856
61091
  ])
60857
61092
  ])) : createCommentVNode("", true)
60858
- ])
61093
+ ], 512)
60859
61094
  ]),
60860
61095
  _: 1
60861
61096
  }, 8, ["loading", "has-data"]);
60862
61097
  };
60863
61098
  }
60864
61099
  });
60865
- const docDesignLayout = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__scopeId", "data-v-90a572b9"]]);
61100
+ const docDesignLayout = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__scopeId", "data-v-e6b0dcfe"]]);
60866
61101
  function convertPxToPaperSize(pageSize, customSize) {
60867
61102
  if (pageSize === PageSizeEnumConst.A3) {
60868
61103
  return {
@@ -60951,12 +61186,12 @@ function usePrint() {
60951
61186
  size: ${paperSize.size} ${isGlobalLandscape ? "landscape" : "portrait"};
60952
61187
  }
60953
61188
 
60954
- .print-page{
61189
+ .print-page {
60955
61190
  position:relative;
60956
61191
  overflow:hidden;
60957
61192
 
60958
- width:${paperSize.width};
60959
- height:${paperSize.height};
61193
+ width:${isGlobalLandscape ? paperSize.height : paperSize.width};
61194
+ height:${isGlobalLandscape ? paperSize.width : paperSize.height};
60960
61195
 
60961
61196
  page-break-after:always;
60962
61197
  break-after:page;
@@ -60983,8 +61218,8 @@ function usePrint() {
60983
61218
  left:50%;
60984
61219
  top:50%;
60985
61220
 
60986
- width:${paperSize.height};
60987
- height:${paperSize.width};
61221
+ width:${isGlobalLandscape ? paperSize.width : paperSize.height};
61222
+ height:${isGlobalLandscape ? paperSize.height : paperSize.width};
60988
61223
 
60989
61224
  transform:translate(-50%, -50%) rotate(90deg);
60990
61225
  transform-origin:center center;
@@ -64146,9 +64381,9 @@ const _sfc_main$1N = /* @__PURE__ */ defineComponent({
64146
64381
  const modelKey = getLastSegment(fieldMeta.fieldData.modelLink);
64147
64382
  const fieldKey = getLastSegment(fieldMeta.fieldData.fieldLink);
64148
64383
  const fieldInfo = modelKey && fieldKey ? designCtx.runtime.getFieldList(modelKey)?.find((f) => f.key === fieldKey) ?? null : null;
64149
- const path2 = fieldInfo?.name ? `\${${fieldInfo.name}}` : fieldMeta.fieldData?.valuePath;
64384
+ const path2 = fieldMeta.fieldData?.valuePath;
64150
64385
  if (isDesignMode.value) {
64151
- return path2;
64386
+ return fieldInfo?.name ? `\${${fieldInfo.name}}` : path2;
64152
64387
  }
64153
64388
  if (path2) {
64154
64389
  const runtimePath = replacePathIndexPlaceholder(props.widget.dataIndex, path2);
@@ -68417,7 +68652,7 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
68417
68652
  src: unref(svgAI),
68418
68653
  class: "item-icon"
68419
68654
  }, null, 8, _hoisted_3$r),
68420
- _cache[3] || (_cache[3] = createElementVNode("div", { class: "item-name" }, "AI识别", -1))
68655
+ _cache[3] || (_cache[3] = createElementVNode("div", { class: "item-name" }, "OCR图像识别", -1))
68421
68656
  ])
68422
68657
  ])
68423
68658
  ]),
@@ -68442,7 +68677,7 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
68442
68677
  };
68443
68678
  }
68444
68679
  });
68445
- const AddTmplBtn = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["__scopeId", "data-v-12a2ed97"]]);
68680
+ const AddTmplBtn = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["__scopeId", "data-v-25c2d428"]]);
68446
68681
  const _hoisted_1$14 = { class: "remove-icon" };
68447
68682
  const _sfc_main$1e = /* @__PURE__ */ defineComponent({
68448
68683
  __name: "remove-icon",
@@ -68480,7 +68715,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
68480
68715
  };
68481
68716
  const type2Title = {
68482
68717
  [DeviceLink.TmplTypeEnum.DEVICE_INTERCONNECTION]: "设备互联",
68483
- [DeviceLink.TmplTypeEnum.AI_OCR]: "AI识别"
68718
+ [DeviceLink.TmplTypeEnum.AI_OCR]: "OCR图像识别"
68484
68719
  };
68485
68720
  const emit = __emit;
68486
68721
  return (_ctx, _cache) => {
@@ -68505,7 +68740,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
68505
68740
  };
68506
68741
  }
68507
68742
  });
68508
- const TmplCard = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["__scopeId", "data-v-5692840b"]]);
68743
+ const TmplCard = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["__scopeId", "data-v-5eca0a1c"]]);
68509
68744
  const _hoisted_1$12 = { class: "device-field-status" };
68510
68745
  const _hoisted_2$B = { class: "device-field-status__item-label" };
68511
68746
  const _hoisted_3$p = { class: "device-field-status__item-value" };