@gct-paas/word 0.1.33 → 0.1.34

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
@@ -17464,12 +17464,12 @@ const getFetch = (config) => {
17464
17464
  Response,
17465
17465
  fetch2
17466
17466
  ];
17467
- let len = seeds.length, i = len, seed2, target, map2 = seedCache;
17467
+ let len = seeds.length, i = len, seed2, target, map = seedCache;
17468
17468
  while (i--) {
17469
17469
  seed2 = seeds[i];
17470
- target = map2.get(seed2);
17471
- target === void 0 && map2.set(seed2, target = i ? /* @__PURE__ */ new Map() : factory(env));
17472
- map2 = target;
17470
+ target = map.get(seed2);
17471
+ target === void 0 && map.set(seed2, target = i ? /* @__PURE__ */ new Map() : factory(env));
17472
+ map = target;
17473
17473
  }
17474
17474
  return target;
17475
17475
  };
@@ -19033,11 +19033,11 @@ function copyObject(source, props, object4, customizer) {
19033
19033
  }
19034
19034
  return object4;
19035
19035
  }
19036
- var nativeMax$2 = Math.max;
19036
+ var nativeMax$1 = Math.max;
19037
19037
  function overRest(func, start, transform) {
19038
- start = nativeMax$2(start === void 0 ? func.length - 1 : start, 0);
19038
+ start = nativeMax$1(start === void 0 ? func.length - 1 : start, 0);
19039
19039
  return function() {
19040
- var args = arguments, index2 = -1, length = nativeMax$2(args.length - start, 0), array4 = Array(length);
19040
+ var args = arguments, index2 = -1, length = nativeMax$1(args.length - start, 0), array4 = Array(length);
19041
19041
  while (++index2 < length) {
19042
19042
  array4[index2] = args[start + index2];
19043
19043
  }
@@ -19344,8 +19344,8 @@ function isKeyable(value) {
19344
19344
  var type4 = typeof value;
19345
19345
  return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value !== "__proto__" : value === null;
19346
19346
  }
19347
- function getMapData(map2, key) {
19348
- var data = map2.__data__;
19347
+ function getMapData(map, key) {
19348
+ var data = map.__data__;
19349
19349
  return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
19350
19350
  }
19351
19351
  function mapCacheDelete(key) {
@@ -19877,9 +19877,9 @@ function equalArrays(array4, other, bitmask, customizer, equalFunc, stack) {
19877
19877
  stack["delete"](other);
19878
19878
  return result;
19879
19879
  }
19880
- function mapToArray(map2) {
19881
- var index2 = -1, result = Array(map2.size);
19882
- map2.forEach(function(value, key) {
19880
+ function mapToArray(map) {
19881
+ var index2 = -1, result = Array(map.size);
19882
+ map.forEach(function(value, key) {
19883
19883
  result[++index2] = [key, value];
19884
19884
  });
19885
19885
  return result;
@@ -20203,7 +20203,7 @@ var now = function() {
20203
20203
  return root.Date.now();
20204
20204
  };
20205
20205
  var FUNC_ERROR_TEXT = "Expected a function";
20206
- var nativeMax$1 = Math.max, nativeMin = Math.min;
20206
+ var nativeMax = Math.max, nativeMin = Math.min;
20207
20207
  function debounce(func, wait, options) {
20208
20208
  var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
20209
20209
  if (typeof func != "function") {
@@ -20213,7 +20213,7 @@ function debounce(func, wait, options) {
20213
20213
  if (isObject(options)) {
20214
20214
  leading = !!options.leading;
20215
20215
  maxing = "maxWait" in options;
20216
- maxWait = maxing ? nativeMax$1(toNumber(options.maxWait) || 0, wait) : maxWait;
20216
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
20217
20217
  trailing = "trailing" in options ? !!options.trailing : trailing;
20218
20218
  }
20219
20219
  function invokeFunc(time) {
@@ -20369,20 +20369,6 @@ function last(array4) {
20369
20369
  var length = array4 == null ? 0 : array4.length;
20370
20370
  return length ? array4[length - 1] : void 0;
20371
20371
  }
20372
- function baseMap(collection, iteratee) {
20373
- var index2 = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
20374
- baseEach(collection, function(value, key, collection2) {
20375
- result[++index2] = iteratee(value, key, collection2);
20376
- });
20377
- return result;
20378
- }
20379
- function map(collection, iteratee) {
20380
- var func = isArray(collection) ? arrayMap : baseMap;
20381
- return func(collection, baseIteratee(iteratee));
20382
- }
20383
- function flatMap(collection, iteratee) {
20384
- return baseFlatten(map(collection, iteratee));
20385
- }
20386
20372
  var objectProto$2 = Object.prototype;
20387
20373
  var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
20388
20374
  var groupBy$1 = createAggregator(function(result, value, key) {
@@ -20506,18 +20492,6 @@ function basePickBy(object4, paths, predicate) {
20506
20492
  }
20507
20493
  return result;
20508
20494
  }
20509
- function pickBy(object4, predicate) {
20510
- if (object4 == null) {
20511
- return {};
20512
- }
20513
- var props = arrayMap(getAllKeysIn(object4), function(prop) {
20514
- return [prop];
20515
- });
20516
- predicate = baseIteratee(predicate);
20517
- return basePickBy(object4, props, function(value, path2) {
20518
- return predicate(value, path2[0]);
20519
- });
20520
- }
20521
20495
  function basePick(object4, paths) {
20522
20496
  return basePickBy(object4, paths, function(value, path2) {
20523
20497
  return hasIn(object4, path2);
@@ -20529,23 +20503,6 @@ var pick = flatRest(function(object4, paths) {
20529
20503
  function set(object4, path2, value) {
20530
20504
  return object4 == null ? object4 : baseSet(object4, path2, value);
20531
20505
  }
20532
- var nativeMax = Math.max;
20533
- function unzip(array4) {
20534
- if (!(array4 && array4.length)) {
20535
- return [];
20536
- }
20537
- var length = 0;
20538
- array4 = arrayFilter(array4, function(group) {
20539
- if (isArrayLikeObject(group)) {
20540
- length = nativeMax(group.length, length);
20541
- return true;
20542
- }
20543
- });
20544
- return baseTimes(length, function(index2) {
20545
- return arrayMap(array4, baseProperty(index2));
20546
- });
20547
- }
20548
- var zip = baseRest(unzip);
20549
20506
  function fallbackUUID() {
20550
20507
  const bytes = new Uint8Array(16);
20551
20508
  crypto?.getRandomValues?.(bytes);
@@ -20604,12 +20561,26 @@ function generateValuePath(fieldLink, subFieldKey) {
20604
20561
  return `$.${fieldLink}`;
20605
20562
  }
20606
20563
  }
20564
+ function getLastSegment(str, separator = ".") {
20565
+ if (!str) return "";
20566
+ const index2 = str.lastIndexOf(separator);
20567
+ return index2 === -1 ? str : str.slice(index2 + 1);
20568
+ }
20607
20569
  function replacePathIndexPlaceholders(params) {
20608
- const { x: x2, y: y2, templatePath } = params;
20570
+ const { refPath, templatePath } = params;
20571
+ let n = params.n;
20572
+ let x2 = params.x;
20573
+ let y2 = params.y;
20574
+ if (refPath) {
20575
+ const indices = [...refPath.matchAll(/\[(\d+)\]/g)].map((m) => Number(m[1]));
20576
+ y2 ??= indices[0];
20577
+ x2 ??= indices[1] ?? indices[0];
20578
+ n ??= indices[0];
20579
+ }
20609
20580
  let path2 = templatePath;
20610
20581
  path2 = replacePathIndexPlaceholder(y2, path2, "n_y");
20611
20582
  path2 = replacePathIndexPlaceholder(x2, path2, "n_x");
20612
- path2 = replacePathIndexPlaceholder(x2, path2);
20583
+ path2 = replacePathIndexPlaceholder(n ?? x2, path2, "n");
20613
20584
  return path2;
20614
20585
  }
20615
20586
  function replacePathIndexPlaceholder(refPath, templatePath, placeholder = "n") {
@@ -20625,17 +20596,13 @@ function replacePathIndexPlaceholder(refPath, templatePath, placeholder = "n") {
20625
20596
  }
20626
20597
  return templatePath.replaceAll(`[${placeholder}]`, `[${index2}]`);
20627
20598
  }
20628
- function getLastSegment(str, separator = ".") {
20629
- if (!str) return "";
20630
- const index2 = str.lastIndexOf(separator);
20631
- return index2 === -1 ? str : str.slice(index2 + 1);
20632
- }
20633
20599
  function parseValuePath(valuePath) {
20634
20600
  if (!valuePath) {
20635
20601
  return {
20636
20602
  raw: "",
20637
20603
  normalized: "",
20638
20604
  fieldKey: "",
20605
+ fieldPath: "",
20639
20606
  isRoot: false,
20640
20607
  isSubTable: false,
20641
20608
  isLink: false,
@@ -20665,11 +20632,14 @@ function parseValuePath(valuePath) {
20665
20632
  raw: valuePath,
20666
20633
  normalized,
20667
20634
  fieldKey,
20635
+ fieldPath: fieldKey ? `$.${fieldKey}` : "",
20668
20636
  parentFieldKey,
20637
+ parentFieldPath: parentFieldKey ? `$.${parentFieldKey}` : "",
20669
20638
  isRoot: segments.length === 1,
20670
20639
  isSubTable: segments.length > 1,
20671
20640
  isLink,
20672
20641
  linkFieldKey,
20642
+ linkFieldPath: linkFieldKey ? `$.${linkFieldKey}` : "",
20673
20643
  hasIndex,
20674
20644
  segments
20675
20645
  };
@@ -20715,10 +20685,10 @@ function createRafOnce() {
20715
20685
  return { schedule, syncSchedule, cancel };
20716
20686
  }
20717
20687
  function listToTree(list, transform = (n) => n) {
20718
- const map2 = /* @__PURE__ */ new Map();
20688
+ const map = /* @__PURE__ */ new Map();
20719
20689
  const roots = [];
20720
20690
  list.forEach((item) => {
20721
- map2.set(item.value, item);
20691
+ map.set(item.value, item);
20722
20692
  item.children = [];
20723
20693
  });
20724
20694
  list.forEach((node) => {
@@ -20726,7 +20696,7 @@ function listToTree(list, transform = (n) => n) {
20726
20696
  if (!parentId || parentId === "ROOT") {
20727
20697
  roots.push(transform(node));
20728
20698
  } else {
20729
- const parent2 = map2.get(parentId);
20699
+ const parent2 = map.get(parentId);
20730
20700
  parent2?.children?.push(transform(node));
20731
20701
  }
20732
20702
  });
@@ -23580,6 +23550,17 @@ class SubTableHeaderRegion extends Region {
23580
23550
  });
23581
23551
  }
23582
23552
  }
23553
+ function resolveRegionValuePathKeys(valuePath) {
23554
+ const parsed = parseValuePath(valuePath);
23555
+ const subFieldKey = parsed.isLink ? parsed.parentFieldKey ?? "" : parsed.fieldKey;
23556
+ const linkFieldKey = parsed.linkFieldKey ?? "";
23557
+ return {
23558
+ subFieldKey,
23559
+ linkFieldKey,
23560
+ subValuePath: subFieldKey ? `$.${subFieldKey}` : "",
23561
+ linkValuePath: linkFieldKey ? `$.${linkFieldKey}` : ""
23562
+ };
23563
+ }
23583
23564
  class RepeatingRegion extends Region {
23584
23565
  type = "repeating";
23585
23566
  name;
@@ -23595,6 +23576,18 @@ class RepeatingRegion extends Region {
23595
23576
  }
23596
23577
  };
23597
23578
  }
23579
+ get subFieldKey() {
23580
+ return resolveRegionValuePathKeys(this.valuePath).subFieldKey;
23581
+ }
23582
+ get linkFieldKey() {
23583
+ return resolveRegionValuePathKeys(this.valuePath).linkFieldKey;
23584
+ }
23585
+ get subValuePath() {
23586
+ return resolveRegionValuePathKeys(this.valuePath).subValuePath;
23587
+ }
23588
+ get linkValuePath() {
23589
+ return resolveRegionValuePathKeys(this.valuePath).linkValuePath;
23590
+ }
23598
23591
  toJSON() {
23599
23592
  return {
23600
23593
  ...super.toJSON(),
@@ -23624,6 +23617,18 @@ class BoundedItemRegion extends Region {
23624
23617
  this.parent = options.parent;
23625
23618
  }
23626
23619
  }
23620
+ get subFieldKey() {
23621
+ return this.parent?.subFieldKey ?? "";
23622
+ }
23623
+ get linkFieldKey() {
23624
+ return this.parent?.linkFieldKey ?? "";
23625
+ }
23626
+ get subValuePath() {
23627
+ return this.parent?.subValuePath ?? "";
23628
+ }
23629
+ get linkValuePath() {
23630
+ return this.parent?.linkValuePath ?? "";
23631
+ }
23627
23632
  remove() {
23628
23633
  this.parent.removeItemRegion();
23629
23634
  }
@@ -23669,6 +23674,18 @@ class BoundedRegion extends Region {
23669
23674
  };
23670
23675
  this.itemRegion = options.itemRegion;
23671
23676
  }
23677
+ get subFieldKey() {
23678
+ return resolveRegionValuePathKeys(this.valuePath).subFieldKey;
23679
+ }
23680
+ get linkFieldKey() {
23681
+ return resolveRegionValuePathKeys(this.valuePath).linkFieldKey;
23682
+ }
23683
+ get subValuePath() {
23684
+ return resolveRegionValuePathKeys(this.valuePath).subValuePath;
23685
+ }
23686
+ get linkValuePath() {
23687
+ return resolveRegionValuePathKeys(this.valuePath).linkValuePath;
23688
+ }
23672
23689
  toJSON() {
23673
23690
  return {
23674
23691
  ...super.toJSON(),
@@ -23724,6 +23741,18 @@ class DataGroup2DRegion extends Region {
23724
23741
  this.parent = options.parent;
23725
23742
  }
23726
23743
  }
23744
+ get subFieldKey() {
23745
+ return this.parent?.subFieldKey ?? "";
23746
+ }
23747
+ get linkFieldKey() {
23748
+ return this.parent?.linkFieldKey ?? "";
23749
+ }
23750
+ get subValuePath() {
23751
+ return this.parent?.subValuePath ?? "";
23752
+ }
23753
+ get linkValuePath() {
23754
+ return this.parent?.linkValuePath ?? "";
23755
+ }
23727
23756
  remove() {
23728
23757
  this.parent.removeItemRegion();
23729
23758
  }
@@ -23747,17 +23776,16 @@ class LinkSubTableRegion extends Region {
23747
23776
  this.itemRegion = options.itemRegion;
23748
23777
  }
23749
23778
  get subFieldKey() {
23750
- const parsed = parseValuePath(this.valuePath);
23751
- return parsed.isLink ? parsed.parentFieldKey ?? "" : parsed.fieldKey;
23779
+ return resolveRegionValuePathKeys(this.valuePath).subFieldKey;
23752
23780
  }
23753
23781
  get linkFieldKey() {
23754
- return parseValuePath(this.valuePath).linkFieldKey ?? "";
23782
+ return resolveRegionValuePathKeys(this.valuePath).linkFieldKey;
23755
23783
  }
23756
23784
  get subValuePath() {
23757
- return this.subFieldKey ? `$.${this.subFieldKey}` : "";
23785
+ return resolveRegionValuePathKeys(this.valuePath).subValuePath;
23758
23786
  }
23759
23787
  get linkValuePath() {
23760
- return this.linkFieldKey ? `$.${this.linkFieldKey}` : "";
23788
+ return resolveRegionValuePathKeys(this.valuePath).linkValuePath;
23761
23789
  }
23762
23790
  toLinkSubTableJSON() {
23763
23791
  return {
@@ -24632,235 +24660,79 @@ class WtblRegionManager {
24632
24660
  }
24633
24661
  }
24634
24662
  }
24635
- const OUTLINE_BORDER_INSET = 1;
24636
- const borderConfig = {
24637
- outer: {
24638
- color: "rgb(128, 128, 128)",
24639
- width: 1
24640
- },
24641
- inner: {
24642
- color: "rgb(128, 128, 128)",
24643
- width: 1
24644
- },
24645
- guide: {
24646
- color: "#026AC8",
24647
- width: 2
24648
- }
24649
- };
24650
- const subThemeConfig = {
24651
- "fixed-table": {
24652
- label: "固定表",
24653
- color: "#309C41",
24654
- background: "rgba(48,156,65,0.1)",
24655
- labelBjColor: "rgba(48,156,65,0.8)"
24656
- },
24657
- "check-table": {
24658
- label: "检验表",
24659
- color: "#309C41",
24660
- background: "rgba(48,156,65,0.1)",
24661
- labelBjColor: "rgba(48,156,65,0.8)"
24662
- },
24663
- "dynamic-table": {
24664
- label: "动态表",
24665
- color: "#026AC8",
24666
- background: "rgba(2,106,200,0.1)",
24667
- labelBjColor: "rgba(2,106,200,0.8)"
24668
- },
24669
- "2d-table": {
24670
- label: "二维表",
24671
- color: "#026AC8",
24672
- background: "rgba(2,106,200,0.1)",
24673
- labelBjColor: "rgba(2,106,200,0.8)"
24674
- },
24675
- "table-header": {
24676
- label: "表头",
24677
- color: "rgba(245, 69, 71, 1)",
24678
- background: "rgba(245, 69, 71, 0.1)",
24679
- labelBjColor: "rgba(245, 69, 71, 0.8)"
24680
- },
24681
- "data-group": {
24682
- label: "数据分组",
24683
- color: "#F77E4A",
24684
- background: "rgba(247,126,74,0.1)",
24685
- labelBjColor: "rgba(247,126,74,0.8)"
24686
- },
24687
- "data-group-2d": {
24688
- label: "动态关联",
24689
- color: "#F77E4A",
24690
- background: "rgba(247,126,74,0.1)",
24691
- labelBjColor: "rgba(247,126,74,0.8)"
24692
- }
24693
- };
24694
- const getStyleByType = (type4) => {
24695
- const config = subThemeConfig[type4];
24663
+ function isLinkSubTableType(type4) {
24664
+ if (!type4) return false;
24665
+ return type4 === "2d-table" || type4 === "check-table";
24666
+ }
24667
+ function isLinkSubTableSubScopeZone(cellZone) {
24668
+ if (!cellZone) return false;
24669
+ return cellZone === "cross" || cellZone === "horizontal";
24670
+ }
24671
+ function getLinkSubTableCrossRange(region) {
24672
+ const { itemRegion } = region;
24673
+ if (!itemRegion) return void 0;
24696
24674
  return {
24697
- strokeColor: config?.color || "#000",
24698
- backgroundColor: config?.background || "transparent",
24699
- label: config?.label || "",
24700
- labelBjColor: config?.labelBjColor || "#666"
24675
+ start: {
24676
+ row: Math.max(region.start.row, itemRegion.start.row),
24677
+ col: Math.max(region.start.col, itemRegion.start.col)
24678
+ },
24679
+ end: {
24680
+ row: Math.min(region.end.row, itemRegion.end.row),
24681
+ col: Math.min(region.end.col, itemRegion.end.col)
24682
+ }
24701
24683
  };
24702
- };
24703
- const EPS = 1e-3;
24704
- function clipHLineByMerges(line, merges) {
24705
- let segments = [line];
24706
- merges.forEach((rect) => {
24707
- segments = segments.flatMap((seg) => {
24708
- const insideY = seg.y > rect.y + EPS && seg.y < rect.y + rect.height - EPS;
24709
- if (!insideY) return [seg];
24710
- if (seg.x2 <= rect.x + EPS || seg.x1 >= rect.x + rect.width - EPS) return [seg];
24711
- if (rect.x <= seg.x1 + EPS && rect.x + rect.width >= seg.x2 - EPS) return [];
24712
- const res = [];
24713
- if (seg.x1 < rect.x - EPS) res.push({ ...seg, x2: rect.x });
24714
- if (seg.x2 > rect.x + rect.width + EPS) res.push({ ...seg, x1: rect.x + rect.width });
24715
- return res;
24716
- });
24717
- });
24718
- return segments;
24719
24684
  }
24720
- function clipVLineByMerges(line, merges) {
24721
- let segments = [line];
24722
- merges.forEach((rect) => {
24723
- segments = segments.flatMap((seg) => {
24724
- const insideX = seg.x > rect.x + EPS && seg.x < rect.x + rect.width - EPS;
24725
- if (!insideX) return [seg];
24726
- if (seg.y2 <= rect.y + EPS || seg.y1 >= rect.y + rect.height - EPS) return [seg];
24727
- if (rect.y <= seg.y1 + EPS && rect.y + rect.height >= seg.y2 - EPS) return [];
24728
- const res = [];
24729
- if (seg.y1 < rect.y - EPS) res.push({ ...seg, y2: rect.y });
24730
- if (seg.y2 > rect.y + rect.height + EPS) res.push({ ...seg, y1: rect.y + rect.height });
24731
- return res;
24732
- });
24685
+ function getDataGroup2DFillEndCol(region, cellDataIndexMap) {
24686
+ const { itemRegion } = region;
24687
+ if (!itemRegion) return region.end.col;
24688
+ let maxCol = itemRegion.end.col;
24689
+ cellDataIndexMap.forEach((meta, key) => {
24690
+ const [rowStr, colStr] = key.split(",");
24691
+ const row = Number(rowStr);
24692
+ const col = Number(colStr);
24693
+ if (row >= itemRegion.start.row && row <= itemRegion.end.row && meta.dataIndex !== void 0) {
24694
+ maxCol = Math.max(maxCol, col);
24695
+ }
24733
24696
  });
24734
- return segments;
24735
- }
24736
- function createTableOutlineLayer(options) {
24737
- const { cells, inset = 1 } = options;
24738
- if (!cells.length) return { backgroundRect: null, hLines: [], vLines: [], labelPos: void 0 };
24739
- const minX = Math.min(...cells.map((c2) => c2.x));
24740
- const minY = Math.min(...cells.map((c2) => c2.y));
24741
- const maxX = Math.max(...cells.map((c2) => c2.x + c2.width));
24742
- const maxY = Math.max(...cells.map((c2) => c2.y + c2.height));
24743
- const minLY = Math.min(...cells.map((c2) => c2.layoutY));
24744
- const maxLX = Math.max(...cells.map((c2) => c2.layoutX + c2.width));
24745
- const maxLY = Math.max(...cells.map((c2) => c2.layoutY + c2.height));
24746
- const backgroundRect = {
24747
- x: minX + inset,
24748
- y: minY + inset,
24749
- width: maxX - minX - inset * 2,
24750
- height: maxY - minY - inset * 2
24751
- };
24752
- const hLines = [
24753
- { x1: minX + inset, x2: maxX - inset, y: minY + inset },
24754
- // top
24755
- { x1: minX + inset, x2: maxX - inset, y: maxY - inset }
24756
- // bottom
24757
- ];
24758
- const vLines = [
24759
- { x: minX + inset, y1: minY + inset, y2: maxY - inset },
24760
- // left
24761
- { x: maxX - inset, y1: minY + inset, y2: maxY - inset }
24762
- // right
24763
- ];
24764
- const labelPos = { x: maxLX - inset, y1: minLY + inset, y2: maxLY - inset };
24765
- return { backgroundRect, hLines, vLines, labelPos };
24697
+ return maxCol;
24766
24698
  }
24767
- const accumulate = (list) => {
24768
- const result = [0];
24769
- let acc = 0;
24770
- for (const n of list) {
24771
- acc += n;
24772
- result.push(acc);
24699
+ function resolveLinkSubTableCellZone(row, col, region, options = {}) {
24700
+ const { itemRegion } = region;
24701
+ if (!itemRegion) {
24702
+ return region.contains(row, col) ? "horizontal" : void 0;
24773
24703
  }
24774
- return result;
24775
- };
24776
- const inRange = (n, min, max) => n > min && n < max;
24777
- function mapCellsToOutlineCells(cells) {
24778
- return cells.map((c2) => ({
24779
- x: c2.x,
24780
- y: c2.rowY,
24781
- layoutX: c2.layoutX,
24782
- layoutY: c2.layoutY,
24783
- width: c2.width,
24784
- height: c2.height
24785
- }));
24786
- }
24787
- function groupBy(list, getKey) {
24788
- return list.reduce((acc, item) => {
24789
- const key = getKey(item);
24790
- (acc[key] ||= []).push(item);
24791
- return acc;
24792
- }, {});
24704
+ const cross = getLinkSubTableCrossRange(region);
24705
+ const fillEndCol = options.fillEndCol ?? itemRegion.end.col;
24706
+ const inCrossRows = row >= cross.start.row && row <= cross.end.row;
24707
+ const inItemRows = row >= itemRegion.start.row && row <= itemRegion.end.row;
24708
+ if (inCrossRows && col >= itemRegion.start.col && col <= fillEndCol) {
24709
+ return "cross";
24710
+ }
24711
+ if (!inCrossRows && inItemRows && col >= itemRegion.start.col && col <= fillEndCol) {
24712
+ return "vertical";
24713
+ }
24714
+ if (region.contains(row, col)) {
24715
+ if (col < itemRegion.start.col) {
24716
+ return "horizontal";
24717
+ }
24718
+ if (inCrossRows && col > fillEndCol) {
24719
+ return "horizontal";
24720
+ }
24721
+ }
24722
+ return void 0;
24793
24723
  }
24794
- function buildPosMap(layers, getRect, toDom) {
24795
- const res = {};
24796
- for (const [id, layer] of Object.entries(layers)) {
24797
- const rect = getRect(layer);
24798
- if (!rect) continue;
24799
- const pos = toDom(rect);
24800
- if (pos) res[id] = pos;
24724
+ function resolveLinkSubTableValuePath(region, cellZone) {
24725
+ switch (cellZone) {
24726
+ case "cross":
24727
+ return region.valuePath;
24728
+ case "vertical":
24729
+ return region.linkValuePath;
24730
+ case "horizontal":
24731
+ return region.subValuePath;
24801
24732
  }
24802
- return res;
24803
24733
  }
24804
- const getIsDataGroup2DTable = (type4) => {
24805
- if (!type4) return false;
24806
- return ["2d-table", "check-table"].includes(type4);
24807
- };
24808
- const getIs2DCellInSubTable = (cellZone) => {
24809
- if (!cellZone) return false;
24810
- return ["cross", "horizontal"].includes(cellZone);
24811
- };
24812
- function getDataIndexLayersMap({
24813
- type: type4,
24814
- cells,
24815
- isDesign,
24816
- convertExtraProps
24817
- }) {
24818
- const getDataIndex = (cell) => {
24819
- return getIsDataGroup2DTable(type4) && isDesign ? cell.subRenderer?.xDataIndex : cell.subRenderer?.dataIndex;
24820
- };
24821
- const getAllDataIndex = (cell) => {
24822
- const { dataIndex, xDataIndex, yDataIndex } = cell?.subRenderer || {};
24823
- return dataIndex ?? xDataIndex ?? yDataIndex;
24824
- };
24825
- const _cells = cells.filter(
24826
- (cell) => isNumber(getAllDataIndex(cell)) && cell?.subRenderer?.type === type4
24827
- );
24828
- if (!_cells.length) return {};
24829
- const grouped = groupBy(
24830
- _cells,
24831
- (cell) => `${cell.subRenderer.id}_dataIndex${getDataIndex(cell)}`
24832
- );
24833
- const layersMapEntries = Object.entries(grouped).map(([id, __cells]) => {
24834
- const firstCell = __cells[0];
24835
- const isFirstGroup = getDataIndex(firstCell) === 0;
24836
- const lastCell = __cells.filter((c2) => {
24837
- if (isDesign) {
24838
- return true;
24839
- } else {
24840
- const { type: type22, cellZone } = c2.subRenderer || {};
24841
- return getIsDataGroup2DTable(type22) ? getIs2DCellInSubTable(cellZone) : true;
24842
- }
24843
- }).at(-1);
24844
- const bgLayer = createTableOutlineLayer({
24845
- cells: mapCellsToOutlineCells(__cells),
24846
- inset: 4
24847
- });
24848
- const borderLayer = isFirstGroup ? createTableOutlineLayer({
24849
- cells: mapCellsToOutlineCells(__cells),
24850
- inset: OUTLINE_BORDER_INSET
24851
- }) : { hLines: [], vLines: [], backgroundRect: null, labelPos: void 0 };
24852
- return [
24853
- id,
24854
- {
24855
- ...borderLayer,
24856
- ...convertExtraProps(firstCell),
24857
- showBorder: isFirstGroup,
24858
- placeholderBjRect: bgLayer.backgroundRect,
24859
- lastCell
24860
- }
24861
- ];
24862
- });
24863
- return Object.fromEntries(layersMapEntries);
24734
+ function isInLinkSubTableLayoutScope(row, col, region, options = {}) {
24735
+ return resolveLinkSubTableCellZone(row, col, region, options) !== void 0;
24864
24736
  }
24865
24737
  class CellCollector {
24866
24738
  constructor(table) {
@@ -24900,19 +24772,19 @@ class CellCollector {
24900
24772
  }
24901
24773
  const body = cell.subTable;
24902
24774
  if (body) {
24903
- const map2 = body.type === "repeating" ? this.repeatingGroups : body.type === "2d-table" ? this._2DTableGroups : body.type === "bounded" ? this.boundedGroups : this.checkTableGroups;
24904
- if (!map2.has(body.regionId)) {
24905
- map2.set(body.regionId, []);
24775
+ const map = body.type === "repeating" ? this.repeatingGroups : body.type === "2d-table" ? this._2DTableGroups : body.type === "bounded" ? this.boundedGroups : this.checkTableGroups;
24776
+ if (!map.has(body.regionId)) {
24777
+ map.set(body.regionId, []);
24906
24778
  }
24907
- map2.get(body.regionId).push(position);
24779
+ map.get(body.regionId).push(position);
24908
24780
  }
24909
24781
  const item = cell.subTableItem;
24910
24782
  if (item) {
24911
- const map2 = item.type === "bounded-item" ? this.boundedItemGroups : this.dataGroup2DGroups;
24912
- if (!map2.has(item.regionId)) {
24913
- map2.set(item.regionId, []);
24783
+ const map = item.type === "bounded-item" ? this.boundedItemGroups : this.dataGroup2DGroups;
24784
+ if (!map.has(item.regionId)) {
24785
+ map.set(item.regionId, []);
24914
24786
  }
24915
- map2.get(item.regionId).push(position);
24787
+ map.get(item.regionId).push(position);
24916
24788
  }
24917
24789
  }
24918
24790
  }
@@ -25090,7 +24962,7 @@ class WtblCalculation {
25090
24962
  if (positions.length === 0) continue;
25091
24963
  const { minRow, maxRow, minCol, maxCol } = calculateGroupBounds(positions);
25092
24964
  const region = table.findRegionById(groupId);
25093
- if (region && getIsDataGroup2DTable(region.type)) {
24965
+ if (region && isLinkSubTableType(region.type)) {
25094
24966
  region.start.row = minRow;
25095
24967
  region.end.row = maxRow;
25096
24968
  region.start.col = minCol;
@@ -27218,6 +27090,8 @@ class TextWidget extends TextRun {
27218
27090
  widgetFileItem;
27219
27091
  pageWidgetMeta;
27220
27092
  dataIndex;
27093
+ xDataIndex;
27094
+ yDataIndex;
27221
27095
  constructor(options) {
27222
27096
  super(options);
27223
27097
  this.widgetMeta = options.widgetMeta;
@@ -31916,7 +31790,7 @@ class DeleteDataGroup2D extends CommandBase {
31916
31790
  return null;
31917
31791
  }
31918
31792
  const subTable = table.findRegionById(regionId);
31919
- if (!subTable || !getIsDataGroup2DTable(subTable.type)) {
31793
+ if (!subTable || !isLinkSubTableType(subTable.type)) {
31920
31794
  console.error(
31921
31795
  `deleteDataGroup2D: region not found with id ${regionId} or region type is not support`
31922
31796
  );
@@ -38226,72 +38100,6 @@ function canSwitchImageFieldToAdaptive(cell, fieldRunId) {
38226
38100
  }
38227
38101
  return !fieldRunId || run.id === fieldRunId;
38228
38102
  }
38229
- function getLinkSubTableCrossRange(region) {
38230
- const { itemRegion } = region;
38231
- if (!itemRegion) return void 0;
38232
- return {
38233
- start: {
38234
- row: Math.max(region.start.row, itemRegion.start.row),
38235
- col: Math.max(region.start.col, itemRegion.start.col)
38236
- },
38237
- end: {
38238
- row: Math.min(region.end.row, itemRegion.end.row),
38239
- col: Math.min(region.end.col, itemRegion.end.col)
38240
- }
38241
- };
38242
- }
38243
- function getDataGroup2DFillEndCol(region, cellDataIndexMap) {
38244
- const { itemRegion } = region;
38245
- if (!itemRegion) return region.end.col;
38246
- let maxCol = itemRegion.end.col;
38247
- cellDataIndexMap.forEach((meta, key) => {
38248
- const [rowStr, colStr] = key.split(",");
38249
- const row = Number(rowStr);
38250
- const col = Number(colStr);
38251
- if (row >= itemRegion.start.row && row <= itemRegion.end.row && meta.dataIndex !== void 0) {
38252
- maxCol = Math.max(maxCol, col);
38253
- }
38254
- });
38255
- return maxCol;
38256
- }
38257
- function resolveLinkSubTableCellZone(row, col, region, options = {}) {
38258
- const { itemRegion } = region;
38259
- if (!itemRegion) {
38260
- return region.contains(row, col) ? "horizontal" : void 0;
38261
- }
38262
- const cross = getLinkSubTableCrossRange(region);
38263
- const fillEndCol = options.fillEndCol ?? itemRegion.end.col;
38264
- const inCrossRows = row >= cross.start.row && row <= cross.end.row;
38265
- const inItemRows = row >= itemRegion.start.row && row <= itemRegion.end.row;
38266
- if (inCrossRows && col >= itemRegion.start.col && col <= fillEndCol) {
38267
- return "cross";
38268
- }
38269
- if (!inCrossRows && inItemRows && col >= itemRegion.start.col && col <= fillEndCol) {
38270
- return "vertical";
38271
- }
38272
- if (region.contains(row, col)) {
38273
- if (col < itemRegion.start.col) {
38274
- return "horizontal";
38275
- }
38276
- if (inCrossRows && col > fillEndCol) {
38277
- return "horizontal";
38278
- }
38279
- }
38280
- return void 0;
38281
- }
38282
- function resolveLinkSubTableValuePath(region, cellZone) {
38283
- switch (cellZone) {
38284
- case "cross":
38285
- return region.valuePath;
38286
- case "vertical":
38287
- return region.linkValuePath;
38288
- case "horizontal":
38289
- return region.subValuePath;
38290
- }
38291
- }
38292
- function isInLinkSubTableLayoutScope(row, col, region, options = {}) {
38293
- return resolveLinkSubTableCellZone(row, col, region, options) !== void 0;
38294
- }
38295
38103
  const INSERT_FIELD_MSG = {
38296
38104
  NOT_IN_CELL: "子表字段只能插入表格单元格中",
38297
38105
  PATH_INCOMPATIBLE: "字段路径与当前区域不兼容,无法插入",
@@ -38490,7 +38298,7 @@ class InsertField extends CommandBase {
38490
38298
  /** 二维表/检验表:用当前单元格 subRenderer 分区 valuePath 作为父路径 */
38491
38299
  getSubTableZoneParentPath() {
38492
38300
  const sub = this.getLayoutTableCellFromCursor()?.subRenderer;
38493
- if (sub && getIsDataGroup2DTable(sub.type)) {
38301
+ if (sub && isLinkSubTableType(sub.type)) {
38494
38302
  return sub.valuePath;
38495
38303
  }
38496
38304
  return void 0;
@@ -38501,7 +38309,7 @@ class InsertField extends CommandBase {
38501
38309
  if (!zoneParentPath || !widgetMeta.field) {
38502
38310
  return { valuePath: draggedValuePath, widgetMeta };
38503
38311
  }
38504
- if (layoutSub?.type === "2d-table" || layoutSub?.type === "check-table") {
38312
+ if (isLinkSubTableType(layoutSub?.type)) {
38505
38313
  const cell = this.getModelCellFromCursor();
38506
38314
  const region = cell ? this.getLinkSubTableRegionFromLayout(cell, layoutSub) : void 0;
38507
38315
  if (region && !this.getDraggedFieldSide(widgetMeta.field, region)) {
@@ -38509,7 +38317,7 @@ class InsertField extends CommandBase {
38509
38317
  }
38510
38318
  }
38511
38319
  const fieldLink = widgetMeta.field.fieldLink || getLastSegment(draggedValuePath);
38512
- const parentKey = getLastSegment(zoneParentPath);
38320
+ const parentKey = parseValuePath(zoneParentPath).normalized;
38513
38321
  const valuePath = generateValuePath(fieldLink, parentKey);
38514
38322
  return {
38515
38323
  valuePath,
@@ -38583,13 +38391,11 @@ class InsertField extends CommandBase {
38583
38391
  }
38584
38392
  getLinkSubTableRegionFromLayout(cell, sub) {
38585
38393
  const table = cell.table;
38394
+ if (!isLinkSubTableType(sub.type)) return void 0;
38586
38395
  if (sub.type === "2d-table") {
38587
38396
  return table.get2DTableById(sub.id);
38588
38397
  }
38589
- if (sub.type === "check-table") {
38590
- return table.getCheckTableById(sub.id);
38591
- }
38592
- return void 0;
38398
+ return table.getCheckTableById(sub.id);
38593
38399
  }
38594
38400
  /**
38595
38401
  * 校验字段是否可插入当前位置
@@ -38600,7 +38406,7 @@ class InsertField extends CommandBase {
38600
38406
  const cell = getAncestorCell(node);
38601
38407
  if (!cell) return INSERT_FIELD_MSG.NOT_IN_CELL;
38602
38408
  const layoutSub = this.getLayoutTableCellFromCursor()?.subRenderer;
38603
- if (layoutSub?.type === "2d-table" || layoutSub?.type === "check-table") {
38409
+ if (layoutSub && isLinkSubTableType(layoutSub.type)) {
38604
38410
  const region = this.getLinkSubTableRegionFromLayout(cell, layoutSub);
38605
38411
  if (!region) return INSERT_FIELD_MSG.NOT_IN_SUBTABLE_REGION;
38606
38412
  return this.validateLinkSubTableFieldPath(
@@ -38617,7 +38423,7 @@ class InsertField extends CommandBase {
38617
38423
  const colIndex = cell.getCurrentIndex();
38618
38424
  const rowIndex = row.getCurrentIndex();
38619
38425
  const targetRegion = regions.find((r) => r.contains(rowIndex, colIndex));
38620
- if (targetRegion?.type === "2d-table" || targetRegion?.type === "check-table") {
38426
+ if (targetRegion && isLinkSubTableType(targetRegion.type)) {
38621
38427
  return this.validateLinkSubTableFieldPath(
38622
38428
  valuePath,
38623
38429
  targetRegion,
@@ -39928,7 +39734,7 @@ class SetDataGroup2D extends CommandBase {
39928
39734
  let region;
39929
39735
  cellList.some((cell) => {
39930
39736
  const r = cell.getRegion();
39931
- if (r && getIsDataGroup2DTable(r.type)) {
39737
+ if (r && isLinkSubTableType(r.type)) {
39932
39738
  region = r;
39933
39739
  return true;
39934
39740
  }
@@ -40331,16 +40137,16 @@ function getClassNameFromPath(path2) {
40331
40137
  return path2.split("/").pop()?.replace(".ts", "") ?? "";
40332
40138
  }
40333
40139
  function buildCommandMap() {
40334
- const map2 = {};
40140
+ const map = {};
40335
40141
  Object.entries(commandModules).forEach(([path2, module2]) => {
40336
40142
  const expectedClassName = getClassNameFromPath(path2);
40337
40143
  const CommandClass = module2[expectedClassName];
40338
40144
  if (CommandClass && typeof CommandClass === "function") {
40339
40145
  const commandName = toCamelCase(expectedClassName);
40340
- map2[commandName] = CommandClass;
40146
+ map[commandName] = CommandClass;
40341
40147
  }
40342
40148
  });
40343
- return map2;
40149
+ return map;
40344
40150
  }
40345
40151
  class CommandManager {
40346
40152
  registry = /* @__PURE__ */ new Map();
@@ -40631,19 +40437,19 @@ class Table extends LayoutGroup {
40631
40437
  });
40632
40438
  }
40633
40439
  updateCellOffsetInfo() {
40634
- const map2 = /* @__PURE__ */ new Map();
40440
+ const map = /* @__PURE__ */ new Map();
40635
40441
  const rows = this.getChildren();
40636
40442
  rows.forEach((row, rowIndex) => {
40637
40443
  row.getChildren().forEach((cell, colIndex) => {
40638
40444
  if (cell.mergeFromId) {
40639
- cell.mergeRefColOffset = colIndex - map2.get(cell.mergeFromId).colIndex;
40640
- cell.mergeRefRowOffset = rowIndex - map2.get(cell.mergeFromId).rowIndex;
40445
+ cell.mergeRefColOffset = colIndex - map.get(cell.mergeFromId).colIndex;
40446
+ cell.mergeRefRowOffset = rowIndex - map.get(cell.mergeFromId).rowIndex;
40641
40447
  } else {
40642
- map2.set(cell.id, { rowIndex, colIndex });
40448
+ map.set(cell.id, { rowIndex, colIndex });
40643
40449
  }
40644
40450
  });
40645
40451
  });
40646
- map2.clear();
40452
+ map.clear();
40647
40453
  }
40648
40454
  forEachCell(options) {
40649
40455
  const { startRowIdx, startColIdx, endRowIdx, endColIdx, callback, filter: filter2 } = options;
@@ -40962,14 +40768,14 @@ class LayoutContext {
40962
40768
  getValuePath(path2) {
40963
40769
  if (!path2) return void 0;
40964
40770
  const { type: type4, dataIndex, xDataIndex, yDataIndex, cellZone } = this.cell?.subRenderer || {};
40965
- if (getIsDataGroup2DTable(type4) && cellZone === "cross") {
40771
+ if (isLinkSubTableType(type4) && cellZone === "cross") {
40966
40772
  return replacePathIndexPlaceholders({ x: xDataIndex, y: yDataIndex, templatePath: path2 });
40967
40773
  }
40968
40774
  if (!path2.includes("[n]")) {
40969
40775
  return path2;
40970
40776
  }
40971
40777
  let n = dataIndex;
40972
- if (getIsDataGroup2DTable(type4)) {
40778
+ if (isLinkSubTableType(type4)) {
40973
40779
  n = cellZone === "horizontal" ? yDataIndex : xDataIndex;
40974
40780
  }
40975
40781
  if (n === void 0) return path2;
@@ -40980,12 +40786,12 @@ class TextHandler {
40980
40786
  static getId(context, wr) {
40981
40787
  const baseId = wr.id;
40982
40788
  const sub = context.cell?.subRenderer;
40983
- if (sub && getIsDataGroup2DTable(sub.type) && sub.cellZone === "cross" && typeof sub.yDataIndex === "number" && typeof sub.xDataIndex === "number") {
40789
+ if (sub && isLinkSubTableType(sub.type) && sub.cellZone === "cross" && typeof sub.yDataIndex === "number" && typeof sub.xDataIndex === "number") {
40984
40790
  return `${baseId}@${sub.yDataIndex}_${sub.xDataIndex}`;
40985
40791
  }
40986
40792
  let runIndex;
40987
40793
  if (sub) {
40988
- if (getIsDataGroup2DTable(sub.type)) {
40794
+ if (isLinkSubTableType(sub.type)) {
40989
40795
  runIndex = sub.cellZone === "horizontal" ? sub.yDataIndex : sub.xDataIndex;
40990
40796
  } else {
40991
40797
  runIndex = sub.dataIndex;
@@ -41204,7 +41010,7 @@ class FieldBaseHandler {
41204
41010
  static getSubTableRunIndex(context) {
41205
41011
  const sub = context.cell?.subRenderer;
41206
41012
  if (!sub) return void 0;
41207
- if (getIsDataGroup2DTable(sub.type)) {
41013
+ if (isLinkSubTableType(sub.type)) {
41208
41014
  if (sub.cellZone === "horizontal") {
41209
41015
  return sub.yDataIndex;
41210
41016
  }
@@ -41218,7 +41024,7 @@ class FieldBaseHandler {
41218
41024
  static getId(context, wr) {
41219
41025
  const baseId = wr.id;
41220
41026
  const sub = context.cell?.subRenderer;
41221
- if (sub && getIsDataGroup2DTable(sub.type) && sub.cellZone === "cross" && typeof sub.yDataIndex === "number" && typeof sub.xDataIndex === "number") {
41027
+ if (sub && isLinkSubTableType(sub.type) && sub.cellZone === "cross" && typeof sub.yDataIndex === "number" && typeof sub.xDataIndex === "number") {
41222
41028
  return `${baseId}@${sub.yDataIndex}_${sub.xDataIndex}`;
41223
41029
  }
41224
41030
  const runIndex = this.getSubTableRunIndex(context);
@@ -41650,6 +41456,8 @@ class ImageWidget extends ImageRun {
41650
41456
  signature;
41651
41457
  pageWidgetMeta;
41652
41458
  dataIndex;
41459
+ xDataIndex;
41460
+ yDataIndex;
41653
41461
  constructor(options) {
41654
41462
  super(options);
41655
41463
  this.src = options.src;
@@ -41658,6 +41466,8 @@ class ImageWidget extends ImageRun {
41658
41466
  this.signature = options.signature;
41659
41467
  this.pageWidgetMeta = options.pageWidgetMeta;
41660
41468
  this.dataIndex = options.dataIndex;
41469
+ this.xDataIndex = options.xDataIndex;
41470
+ this.yDataIndex = options.yDataIndex;
41661
41471
  }
41662
41472
  }
41663
41473
  class FieldImageHandler extends FieldBaseHandler {
@@ -41978,7 +41788,7 @@ class WidgetBaseHandler {
41978
41788
  getDataIndex(init2 = null) {
41979
41789
  const { context } = this;
41980
41790
  const { type: type4, dataIndex, xDataIndex, yDataIndex, cellZone } = context.cell?.subRenderer || {};
41981
- if (getIsDataGroup2DTable(type4)) {
41791
+ if (isLinkSubTableType(type4)) {
41982
41792
  if (cellZone === "horizontal") {
41983
41793
  return yDataIndex ?? init2;
41984
41794
  }
@@ -41996,7 +41806,7 @@ class WidgetBaseHandler {
41996
41806
  getId() {
41997
41807
  const baseId = this.wr.id;
41998
41808
  const sub = this.context.cell?.subRenderer;
41999
- if (sub && getIsDataGroup2DTable(sub.type) && sub.cellZone === "cross" && typeof sub.yDataIndex === "number" && typeof sub.xDataIndex === "number") {
41809
+ if (sub && isLinkSubTableType(sub.type) && sub.cellZone === "cross" && typeof sub.yDataIndex === "number" && typeof sub.xDataIndex === "number") {
42000
41810
  return `${baseId}@${sub.yDataIndex}_${sub.xDataIndex}`;
42001
41811
  }
42002
41812
  const dataIndex = this.getDataIndex();
@@ -42031,7 +41841,7 @@ class SerialNumberHandler extends WidgetBaseHandler {
42031
41841
  layout() {
42032
41842
  const { wr, context } = this;
42033
41843
  const layoutStyle = this.getLayoutStyle();
42034
- const label = (context.cell?.subRenderer?.dataIndex ?? 0) + 1 + "";
41844
+ const label = (this.getDataIndex() ?? 0) + 1 + "";
42035
41845
  label.split("").forEach((char, charIndex) => {
42036
41846
  const { width, height, ascent, descent } = TextRun.measureText(
42037
41847
  TextRun.measurePayload(char, layoutStyle)
@@ -42120,7 +41930,11 @@ class QrCodeHandler extends WidgetBaseHandler {
42120
41930
  start: 0,
42121
41931
  end: 0
42122
41932
  },
42123
- pageWidgetMeta: wr.pageWidgetMeta
41933
+ pageWidgetMeta: wr.pageWidgetMeta,
41934
+ // todo
41935
+ dataIndex: this.getDataIndex() ?? void 0,
41936
+ xDataIndex: context.cell?.subRenderer?.xDataIndex,
41937
+ yDataIndex: context.cell?.subRenderer?.yDataIndex
42124
41938
  });
42125
41939
  context.addRun(run);
42126
41940
  }
@@ -42179,7 +41993,10 @@ class BarcodeHandler extends WidgetBaseHandler {
42179
41993
  end: 0
42180
41994
  },
42181
41995
  pageWidgetMeta: wr.pageWidgetMeta,
42182
- dataIndex: context.cell?.subRenderer?.dataIndex ?? 0
41996
+ // todo
41997
+ dataIndex: this.getDataIndex() ?? void 0,
41998
+ xDataIndex: context.cell?.subRenderer?.xDataIndex,
41999
+ yDataIndex: context.cell?.subRenderer?.yDataIndex
42183
42000
  });
42184
42001
  if (decorationInfo.render) {
42185
42002
  run.decorations = decorationInfo.decorations;
@@ -42227,7 +42044,11 @@ class DiagonalHandler extends WidgetBaseHandler {
42227
42044
  start: 0,
42228
42045
  end: 0
42229
42046
  },
42230
- pageWidgetMeta: wr.pageWidgetMeta
42047
+ pageWidgetMeta: wr.pageWidgetMeta,
42048
+ // todo
42049
+ dataIndex: this.getDataIndex() ?? void 0,
42050
+ xDataIndex: context.cell?.subRenderer?.xDataIndex,
42051
+ yDataIndex: context.cell?.subRenderer?.yDataIndex
42231
42052
  });
42232
42053
  context.addRun(run);
42233
42054
  cell.skipSplitMeasure = true;
@@ -43914,43 +43735,43 @@ class LayoutManager {
43914
43735
  handler.layout(context, run);
43915
43736
  }
43916
43737
  }
43917
- function generateModelMap(node, map2 = /* @__PURE__ */ new Map()) {
43738
+ function generateModelMap(node, map = /* @__PURE__ */ new Map()) {
43918
43739
  if (!node) return;
43919
- map2.set(node.id, node);
43740
+ map.set(node.id, node);
43920
43741
  const children = node.getChildren?.() ?? node.children ?? null;
43921
43742
  if (Array.isArray(children)) {
43922
43743
  for (let ci = 0; ci < children.length; ci++) {
43923
43744
  const child = children[ci];
43924
- generateModelMap(child, map2);
43745
+ generateModelMap(child, map);
43925
43746
  }
43926
43747
  }
43927
- return map2;
43748
+ return map;
43928
43749
  }
43929
43750
  function generateDocModelMap(doc) {
43930
- const map2 = /* @__PURE__ */ new Map();
43751
+ const map = /* @__PURE__ */ new Map();
43931
43752
  const body = doc.model?.document.body;
43932
43753
  if (body) {
43933
- generateModelMap(body, map2);
43754
+ generateModelMap(body, map);
43934
43755
  }
43935
43756
  const headers2 = doc.model?.headers?.headers;
43936
43757
  if (Array.isArray(headers2)) {
43937
43758
  headers2.forEach((header) => {
43938
- generateModelMap(header, map2);
43759
+ generateModelMap(header, map);
43939
43760
  });
43940
43761
  }
43941
43762
  const footers2 = doc.model?.footers?.footers;
43942
43763
  if (Array.isArray(footers2)) {
43943
43764
  footers2.forEach((footer) => {
43944
- generateModelMap(footer, map2);
43765
+ generateModelMap(footer, map);
43945
43766
  });
43946
43767
  }
43947
43768
  const overlays = doc.model?.overlays.overlays;
43948
43769
  if (Array.isArray(overlays)) {
43949
43770
  overlays.forEach((overlay) => {
43950
- generateModelMap(overlay, map2);
43771
+ generateModelMap(overlay, map);
43951
43772
  });
43952
43773
  }
43953
- return map2;
43774
+ return map;
43954
43775
  }
43955
43776
  class LayoutMapper {
43956
43777
  doc;
@@ -46233,10 +46054,12 @@ class DataManager {
46233
46054
  rows.push({});
46234
46055
  }
46235
46056
  const row = rows[index2] ?? {};
46057
+ const { group_: g_ } = row;
46236
46058
  rows[index2] = row;
46237
- const uidField = axis === "y" ? "__gw_y_uid" : "__gw_x_uid";
46059
+ const isY = axis === "y";
46060
+ const uidField = isY ? "__gw_y_uid" : "__gw_x_uid";
46238
46061
  if (!row[uidField]) {
46239
- row[uidField] = row.id || `${axis}_${uuid()}`;
46062
+ row[uidField] = g_ ? g_.includes(":") ? g_.split(":")[isY ? 0 : 1] : g_ : `${axis}_${uuid()}`;
46240
46063
  }
46241
46064
  return row;
46242
46065
  }
@@ -46554,13 +46377,22 @@ class DataManager {
46554
46377
  applyInitData(initDataMap) {
46555
46378
  for (const [path2, value] of Object.entries(initDataMap)) {
46556
46379
  if (value === void 0 || value === null) continue;
46557
- if (path2.includes("[n]")) {
46380
+ const parse = parseValuePath(path2);
46381
+ if (parse.isSubTable && !parse.isLink) {
46558
46382
  this.applyInitDataWildcard(path2, value);
46559
46383
  }
46560
46384
  }
46561
46385
  for (const [path2, value] of Object.entries(initDataMap)) {
46562
46386
  if (value === void 0 || value === null) continue;
46563
- if (!path2.includes("[n]")) {
46387
+ const parse = parseValuePath(path2);
46388
+ if (parse.isSubTable && parse.isLink) {
46389
+ this.applyInitDataCrossWildcard(path2, value);
46390
+ }
46391
+ }
46392
+ for (const [path2, value] of Object.entries(initDataMap)) {
46393
+ if (value === void 0 || value === null) continue;
46394
+ const parse = parseValuePath(path2);
46395
+ if (!(parse.isSubTable || parse.isLink)) {
46564
46396
  const existing = this.getByPath(this.rawData, path2);
46565
46397
  if (existing === void 0 || existing === null) {
46566
46398
  try {
@@ -46574,25 +46406,99 @@ class DataManager {
46574
46406
  }
46575
46407
  }
46576
46408
  }
46577
- applyInitDataWildcard(path2, value) {
46578
- const match = path2.match(/^\$\.([^[.]+)\[n\]/);
46579
- if (!match) return;
46580
- const subTableKey = match[1];
46581
- let subTableArray = this.rawData?.[subTableKey];
46582
- if (!Array.isArray(subTableArray) || subTableArray.length === 0) {
46583
- subTableArray = [{ ...DEFAULT_EMPTY_ITEM }];
46409
+ applyInitDataCrossWildcard(path2, value) {
46410
+ const parse = parseValuePath(path2);
46411
+ if (!parse.isLink) return;
46412
+ const yTableKey = parse.parentFieldKey;
46413
+ const xTableKey = parse.linkFieldKey;
46414
+ if (!yTableKey || !xTableKey) return;
46415
+ const yRows = this.ensureSubTableRowCount(
46416
+ yTableKey,
46417
+ this.resolveInitRowCount(yTableKey),
46418
+ false
46419
+ );
46420
+ const xRows = this.ensureSubTableRowCount(
46421
+ xTableKey,
46422
+ this.resolveInitRowCount(xTableKey),
46423
+ false
46424
+ );
46425
+ for (let y2 = 0; y2 < yRows.length; y2++) {
46426
+ for (let x2 = 0; x2 < xRows.length; x2++) {
46427
+ const realPath = replacePathIndexPlaceholders({ y: y2, x: x2, templatePath: path2 });
46428
+ const inferred = this.infer2DPathAndCoords(realPath);
46429
+ const existing = inferred ? this.get2DByCoords(inferred.logicalPath, inferred.coords) : this.getByPath(this.rawData, realPath);
46430
+ if (existing === void 0 || existing === null) {
46431
+ try {
46432
+ if (this.set(realPath, value, "user")) {
46433
+ this.clearPlaceholderFlag(yRows[y2]);
46434
+ this.clearPlaceholderFlag(xRows[x2]);
46435
+ } else {
46436
+ console.warn(`applyInitData: set returned false for path "${realPath}"`);
46437
+ }
46438
+ } catch (e) {
46439
+ console.warn(`applyInitData: failed to set path "${realPath}"`, e);
46440
+ }
46441
+ }
46442
+ }
46443
+ }
46444
+ }
46445
+ /**
46446
+ * 解析子表初始化行数:接口已有行数、版面数据分组槽位。
46447
+ * layoutRows 为 0(如二维表纵向 f_ewb)时不按分组扩行,仅保证至少 1 行可绑定。
46448
+ */
46449
+ resolveInitRowCount(subTableKey) {
46450
+ const existing = this.rawData?.[subTableKey];
46451
+ const dataRows = Array.isArray(existing) ? existing.length : 0;
46452
+ const layoutRows = this.doc?.model?.getSubTableLayoutSlotCount(subTableKey) ?? 1;
46453
+ if (layoutRows > 0) {
46454
+ return Math.max(dataRows, layoutRows);
46455
+ }
46456
+ return Math.max(dataRows, 1);
46457
+ }
46458
+ /**
46459
+ * 将子表数组补齐到指定行数。
46460
+ * @param asPlaceholder true:push/insert 用的系统占位行(带 __gw_default);false:applyInitData 物化行(空对象)
46461
+ */
46462
+ ensureSubTableRowCount(subTableKey, rowCount, asPlaceholder = true) {
46463
+ let arr = this.rawData?.[subTableKey];
46464
+ if (!Array.isArray(arr)) {
46465
+ arr = [];
46466
+ this.rawData[subTableKey] = arr;
46467
+ }
46468
+ while (arr.length < rowCount) {
46469
+ arr.push(asPlaceholder ? { ...DEFAULT_EMPTY_ITEM } : {});
46584
46470
  }
46471
+ return arr;
46472
+ }
46473
+ /** 行已写入业务数据后去掉占位标记,避免提交/对比时被当成空行 */
46474
+ clearPlaceholderFlag(row) {
46475
+ if (row && row.__gw_default) {
46476
+ delete row.__gw_default;
46477
+ }
46478
+ }
46479
+ applyInitDataWildcard(path2, value) {
46480
+ const subTableKey = parseValuePath(path2).parentFieldKey;
46481
+ if (!subTableKey) return;
46482
+ const subTableArray = this.ensureSubTableRowCount(
46483
+ subTableKey,
46484
+ this.resolveInitRowCount(subTableKey),
46485
+ false
46486
+ );
46585
46487
  for (let i = 0; i < subTableArray.length; i++) {
46586
46488
  const realPath = replacePathIndexPlaceholder(i, path2);
46587
46489
  const existing = this.getByPath(this.rawData, realPath);
46588
46490
  if (existing === void 0 || existing === null) {
46589
46491
  try {
46590
- if (!this.set(realPath, value, "user")) {
46492
+ if (this.set(realPath, value, "user")) {
46493
+ this.clearPlaceholderFlag(subTableArray[i]);
46494
+ } else {
46591
46495
  console.warn(`applyInitData: set returned false for path "${realPath}"`);
46592
46496
  }
46593
46497
  } catch (e) {
46594
46498
  console.warn(`applyInitData: failed to set path "${realPath}"`, e);
46595
46499
  }
46500
+ } else {
46501
+ this.clearPlaceholderFlag(subTableArray[i]);
46596
46502
  }
46597
46503
  }
46598
46504
  }
@@ -46874,12 +46780,21 @@ class DataManager {
46874
46780
  return void 0;
46875
46781
  }
46876
46782
  /**
46877
- * 将路径中的具体数组索引转换为通配符
46878
- * 例如: "items[0].name" -> "items[n].name"
46879
- * @param path 原始路径
46880
- * @returns 转换后的路径
46783
+ * 将路径中的具体数组索引转换为默认值通配符
46784
+ * - 普通子表: items[0].name -> items[n].name
46785
+ * - 二维交叉区: $.f_ewb:f_ewblink[0][1].f_value -> $.f_ewb:f_ewblink[n_y][n_x].f_value
46881
46786
  */
46882
46787
  convertPathToWildcard(path2) {
46788
+ const headKey = path2.replace(/^\$\./, "").split(/[\[.]/)[0] ?? "";
46789
+ const isCross = headKey.includes(":");
46790
+ if (isCross) {
46791
+ let index2 = 0;
46792
+ return path2.replace(/\[(\d+)\]/g, () => {
46793
+ const placeholder = index2 === 0 ? "n_y" : index2 === 1 ? "n_x" : "n";
46794
+ index2++;
46795
+ return `[${placeholder}]`;
46796
+ });
46797
+ }
46883
46798
  return path2.replace(/\[(\d+)\]/g, "[n]");
46884
46799
  }
46885
46800
  formatRuntimeValue(value) {
@@ -46931,9 +46846,9 @@ class DataManager {
46931
46846
  if (!this.depGraph.has(realPath)) {
46932
46847
  this.depGraph.set(realPath, /* @__PURE__ */ new Map());
46933
46848
  }
46934
- const map2 = this.depGraph.get(realPath);
46935
- if (!map2.has(depKey)) {
46936
- map2.set(depKey, node);
46849
+ const map = this.depGraph.get(realPath);
46850
+ if (!map.has(depKey)) {
46851
+ map.set(depKey, node);
46937
46852
  }
46938
46853
  });
46939
46854
  }
@@ -46961,9 +46876,9 @@ class DataManager {
46961
46876
  }
46962
46877
  /** 执行依赖 */
46963
46878
  async runDepsByPath(triggerPath, realPath) {
46964
- const map2 = this.depGraph.get(triggerPath);
46965
- if (!map2) return;
46966
- for (const node of map2.values()) {
46879
+ const map = this.depGraph.get(triggerPath);
46880
+ if (!map) return;
46881
+ for (const node of map.values()) {
46967
46882
  await this.runDependency(node, realPath, triggerPath === realPath);
46968
46883
  }
46969
46884
  }
@@ -47280,14 +47195,14 @@ class Doc {
47280
47195
  */
47281
47196
  getWidgetInstances() {
47282
47197
  const instances = [];
47283
- const map2 = /* @__PURE__ */ new Map();
47198
+ const map = /* @__PURE__ */ new Map();
47284
47199
  const collectWidgets = (node) => {
47285
47200
  if (!node) return;
47286
47201
  if (node.widgetMeta && node.valuePath) {
47287
47202
  const refId = node.modelRef?.id;
47288
- if (refId && !map2.has(refId)) {
47203
+ if (refId && !map.has(refId)) {
47289
47204
  instances.push(node);
47290
- map2.set(refId, true);
47205
+ map.set(refId, true);
47291
47206
  }
47292
47207
  }
47293
47208
  if (node.children && Array.isArray(node.children)) {
@@ -48920,6 +48835,41 @@ class Woverlays {
48920
48835
  });
48921
48836
  }
48922
48837
  }
48838
+ function countDataGroupSlots(range3, itemRange, fillDirection = "x") {
48839
+ const itemWidth = itemRange.end.col - itemRange.start.col + 1;
48840
+ const itemHeight = itemRange.end.row - itemRange.start.row + 1;
48841
+ let slotCount = 1;
48842
+ if (fillDirection === "x") {
48843
+ let currentRow = itemRange.start.row;
48844
+ let currentCol = itemRange.end.col + 1;
48845
+ while (currentRow + itemHeight - 1 <= range3.end.row) {
48846
+ while (currentCol + itemWidth - 1 <= range3.end.col) {
48847
+ slotCount++;
48848
+ currentCol += itemWidth;
48849
+ }
48850
+ currentRow += itemHeight;
48851
+ currentCol = range3.start.col;
48852
+ }
48853
+ } else {
48854
+ let currentCol = itemRange.start.col;
48855
+ let currentRow = itemRange.end.row + 1;
48856
+ while (currentCol + itemWidth - 1 <= range3.end.col) {
48857
+ while (currentRow + itemHeight - 1 <= range3.end.row) {
48858
+ slotCount++;
48859
+ currentRow += itemHeight;
48860
+ }
48861
+ currentCol += itemWidth;
48862
+ currentRow = range3.start.row;
48863
+ }
48864
+ }
48865
+ return slotCount;
48866
+ }
48867
+ function expandDataGroupRowRange(parent2, itemRange) {
48868
+ return {
48869
+ start: { row: itemRange.start.row, col: parent2.start.col },
48870
+ end: { row: itemRange.end.row, col: parent2.end.col }
48871
+ };
48872
+ }
48923
48873
  class DocModel {
48924
48874
  document;
48925
48875
  headers;
@@ -49047,7 +48997,7 @@ class DocModel {
49047
48997
  const tables = this.getAllTables();
49048
48998
  const dynamicTableRegions = tables.filter((w2) => w2.hasRepeating).flatMap((w2) => w2.repeating).map((item) => {
49049
48999
  return {
49050
- field: getLastSegment(item.valuePath),
49000
+ field: item.subFieldKey,
49051
49001
  key: "dyn",
49052
49002
  name: "动态表",
49053
49003
  subType: "sub-table"
@@ -49055,28 +49005,25 @@ class DocModel {
49055
49005
  });
49056
49006
  const fixedTableRegions = tables.filter((w2) => w2.hasBounded).flatMap((w2) => w2.bounded).map((item) => {
49057
49007
  return {
49058
- field: getLastSegment(item.valuePath),
49008
+ field: item.subFieldKey,
49059
49009
  key: "newfixed",
49060
49010
  name: "固定表",
49061
49011
  subType: "fixed-table"
49062
49012
  };
49063
49013
  });
49064
49014
  const table2DRegions = tables.filter((w2) => w2.has2DTable).flatMap((w2) => w2._2DTable).map((item) => {
49065
- const parsed = parseValuePath(item.valuePath);
49066
- const subFieldKey = parsed.isLink ? parsed.parentFieldKey ?? "" : parsed.fieldKey;
49067
- const linkFieldKey = parsed.linkFieldKey ?? "";
49068
49015
  const result = [];
49069
- if (subFieldKey) {
49016
+ if (item.subFieldKey) {
49070
49017
  result.push({
49071
- field: subFieldKey,
49018
+ field: item.subFieldKey,
49072
49019
  key: "dyn",
49073
49020
  name: "二维表",
49074
49021
  subType: "sub-table-2d"
49075
49022
  });
49076
49023
  }
49077
- if (linkFieldKey) {
49024
+ if (item.linkFieldKey) {
49078
49025
  result.push({
49079
- field: linkFieldKey,
49026
+ field: item.linkFieldKey,
49080
49027
  key: "newfixed",
49081
49028
  name: "二维表-关联",
49082
49029
  subType: "sub-table-2d-link"
@@ -49085,21 +49032,18 @@ class DocModel {
49085
49032
  return result;
49086
49033
  }).flat();
49087
49034
  const checkTableRegions = tables.filter((w2) => w2.hasCheckTable).flatMap((w2) => w2.checkTable).map((item) => {
49088
- const parsed = parseValuePath(item.valuePath);
49089
- const subFieldKey = parsed.isLink ? parsed.parentFieldKey ?? "" : parsed.fieldKey;
49090
- const linkFieldKey = parsed.linkFieldKey ?? "";
49091
49035
  const result = [];
49092
- if (subFieldKey) {
49036
+ if (item.subFieldKey) {
49093
49037
  result.push({
49094
- field: subFieldKey,
49038
+ field: item.subFieldKey,
49095
49039
  key: "newfixed",
49096
49040
  name: "检验表-动态",
49097
49041
  subType: "check-table-2d"
49098
49042
  });
49099
49043
  }
49100
- if (linkFieldKey) {
49044
+ if (item.linkFieldKey) {
49101
49045
  result.push({
49102
- field: linkFieldKey,
49046
+ field: item.linkFieldKey,
49103
49047
  key: "newfixed",
49104
49048
  name: "检验表-关联",
49105
49049
  subType: "check-table-2d-link"
@@ -49109,6 +49053,42 @@ class DocModel {
49109
49053
  }).flat();
49110
49054
  return [...dynamicTableRegions, ...fixedTableRegions, ...table2DRegions, ...checkTableRegions];
49111
49055
  }
49056
+ /**
49057
+ * 根据版面数据分组 / 动态关联铺砖,计算子表字段在 rawData 中应初始化的行数。
49058
+ *
49059
+ * - 固定表:槽位归 subFieldKey(bounded + itemRegion)
49060
+ * - 二维表 / 检验表:动态分组铺砖在关联轴,槽位归 linkFieldKey(如 f_ewblink);
49061
+ * 纵向 subFieldKey(如 f_ewb)不由 itemRegion 撑行,返回 0
49062
+ * - 其它子表无分组:返回 1
49063
+ */
49064
+ getSubTableLayoutSlotCount(subFieldKey) {
49065
+ if (!subFieldKey) return 1;
49066
+ let max = 0;
49067
+ let isLinkSubTableSubAxisOnly = false;
49068
+ for (const table of this.getAllTables()) {
49069
+ for (const region of table.bounded) {
49070
+ if (region.subFieldKey !== subFieldKey || !region.itemRegion) continue;
49071
+ const fillDirection = region.widgetMeta?.props?.fillDirection ?? "x";
49072
+ max = Math.max(max, countDataGroupSlots(region, region.itemRegion, fillDirection));
49073
+ region.type;
49074
+ }
49075
+ for (const region of [...table.checkTable, ...table._2DTable]) {
49076
+ if (!region.itemRegion) continue;
49077
+ const range3 = expandDataGroupRowRange(region, region.itemRegion);
49078
+ const slots = countDataGroupSlots(range3, region.itemRegion);
49079
+ if (region.linkFieldKey === subFieldKey) {
49080
+ max = Math.max(max, slots);
49081
+ region.type;
49082
+ }
49083
+ if (region.subFieldKey === subFieldKey) {
49084
+ isLinkSubTableSubAxisOnly = true;
49085
+ }
49086
+ }
49087
+ }
49088
+ if (max > 0) return max;
49089
+ if (isLinkSubTableSubAxisOnly) return 0;
49090
+ return 1;
49091
+ }
49112
49092
  /** 根据 pageIndex 获取页眉实例 */
49113
49093
  getHeader(pageIndex, section) {
49114
49094
  const hasEvenOdd = this.settings?.isEvenAndOddEnabled();
@@ -50111,19 +50091,19 @@ function getBpmnFieldAuthMap(list) {
50111
50091
  );
50112
50092
  }
50113
50093
  function deduplicateFields(data) {
50114
- const map2 = /* @__PURE__ */ new Map();
50094
+ const map = /* @__PURE__ */ new Map();
50115
50095
  data.forEach((item) => {
50116
50096
  const key = `${item.modelKey}_${item.field}`;
50117
- if (!map2.has(key)) {
50118
- map2.set(key, item);
50097
+ if (!map.has(key)) {
50098
+ map.set(key, item);
50119
50099
  } else {
50120
- const existing = map2.get(key);
50100
+ const existing = map.get(key);
50121
50101
  if (item.edit && !existing.edit) {
50122
- map2.set(key, item);
50102
+ map.set(key, item);
50123
50103
  }
50124
50104
  }
50125
50105
  });
50126
- return [...map2.values()];
50106
+ return [...map.values()];
50127
50107
  }
50128
50108
  class DocRequestStrategy {
50129
50109
  props;
@@ -50469,13 +50449,23 @@ const withRequestCache = new RequestCache({
50469
50449
  enableLogging: true
50470
50450
  // 启用日志
50471
50451
  });
50452
+ const FILTER_KEYS = [
50453
+ "_DICT",
50454
+ "_OPCT",
50455
+ "__FOREIGN__",
50456
+ "_MCTABLE",
50457
+ "__default_render__",
50458
+ "__gw_default",
50459
+ "__gw_x_uid",
50460
+ "__gw_y_uid"
50461
+ ];
50472
50462
  function transformSourceData(sourceData, i18nData) {
50473
50463
  const clone2 = cloneDeep(sourceData);
50474
50464
  const _DICT = i18nData ? Object.keys(clone2).reduce((acc, key) => {
50475
- const map2 = i18nData[key];
50465
+ const map = i18nData[key];
50476
50466
  const value = clone2[key];
50477
- if (map2 && value) {
50478
- const labels = String(value).split(",").map((k) => map2[k]);
50467
+ if (map && value) {
50468
+ const labels = String(value).split(",").map((k) => map[k]);
50479
50469
  acc[key] = { [value]: labels };
50480
50470
  }
50481
50471
  return acc;
@@ -50495,12 +50485,63 @@ function transformSourceDataList(data, dict = {}) {
50495
50485
  return list || [];
50496
50486
  }
50497
50487
  function conversionFormState(payload) {
50498
- const { interfaceData, masterSlaveList } = payload || {};
50488
+ const { interfaceData, masterSlaveList, instances } = payload || {};
50499
50489
  const formState = {};
50500
50490
  if (interfaceData && interfaceData.data) {
50501
50491
  merge(formState, transformSourceData(interfaceData.data, interfaceData.dict));
50502
50492
  }
50503
- masterSlaveList.map((item) => item.key).forEach((k) => {
50493
+ let _2dKeys = [];
50494
+ if (instances) {
50495
+ const _2DFieldList = instances.map(({ valuePath }) => {
50496
+ if (valuePath.includes(":")) {
50497
+ const { fieldKey, parentFieldKey, linkFieldKey } = parseValuePath(valuePath);
50498
+ const group2DKey = `${parentFieldKey}:${linkFieldKey}`;
50499
+ return {
50500
+ fieldKey,
50501
+ group2DKey
50502
+ };
50503
+ } else {
50504
+ return null;
50505
+ }
50506
+ }).filter(Boolean);
50507
+ Object.entries(groupBy$1(_2DFieldList, "group2DKey")).forEach(([group2DKey, fields]) => {
50508
+ _2dKeys.push(group2DKey);
50509
+ const [parentFieldKey, linkFieldKey] = group2DKey.split(":");
50510
+ const parentState = formState[parentFieldKey];
50511
+ const keys2 = ["group_", ...fields.map((f) => f.fieldKey)];
50512
+ formState[linkFieldKey]?.data.forEach((row) => {
50513
+ row.__gw_x_uid = row.group_;
50514
+ });
50515
+ formState[group2DKey] = {
50516
+ data: parentState?.data.map((row) => {
50517
+ const { group_: g_ } = row;
50518
+ const _row = pick(row, keys2);
50519
+ if (g_) {
50520
+ const [y2, x2] = g_.split(":");
50521
+ _row.__gw_y_uid = y2;
50522
+ _row.__gw_x_uid = x2;
50523
+ }
50524
+ return _row;
50525
+ }) || [],
50526
+ dict: parentState?.dict || []
50527
+ };
50528
+ const addedYUids = [];
50529
+ formState[parentFieldKey] = {
50530
+ data: [],
50531
+ dict: formState[parentFieldKey]?.dict || []
50532
+ };
50533
+ parentState?.data.forEach((row) => {
50534
+ const yUid = row.group_.split(":")[0];
50535
+ if (addedYUids.includes(yUid)) return;
50536
+ addedYUids.push(yUid);
50537
+ formState[parentFieldKey].data.push({
50538
+ ...row,
50539
+ __gw_y_uid: yUid
50540
+ });
50541
+ });
50542
+ });
50543
+ }
50544
+ masterSlaveList.map((item) => item.key).concat(_2dKeys).forEach((k) => {
50504
50545
  const subFormData = formState[k];
50505
50546
  if (subFormData) {
50506
50547
  formState[k] = transformSourceDataList([...subFormData.data], subFormData.dict);
@@ -50509,43 +50550,52 @@ function conversionFormState(payload) {
50509
50550
  return formState;
50510
50551
  }
50511
50552
  function getSubmitFormData(formData) {
50512
- const list2D = [];
50513
- const filterKeys = ["_DICT", "_OPCT", "__FOREIGN__", "_MCTABLE", "__default_render__"];
50514
- const realFormData = Object.keys(formData).reduce((acc, fieldKey) => {
50515
- const info = list2D.find(
50516
- (item) => (item.subTable2d || item.checkTable2d) && item.rowSubFieldKey === fieldKey
50517
- );
50518
- if (info) {
50519
- const colSubTable = formData[info.colSubFieldKey]?.map((item) => ({
50520
- [info.rowRefFieldKey]: item[info.colRefFieldKey]
50521
- }));
50522
- const arr = flatMap(
50523
- formData[fieldKey],
50524
- (row) => zip(row["_2DTABLE_"], colSubTable).map(([obj1, obj2]) => merge({}, obj1, obj2)).map(
50525
- (item) => merge(
50526
- pickBy(omit(row, filterKeys), (v) => !isNil(v)),
50527
- pickBy(omit(item, filterKeys), (v) => !isNil(v))
50528
- )
50529
- )
50530
- ).map((item) => omit(item, "_2DTABLE_"));
50531
- acc[fieldKey] = arr.every((item) => Object.keys(item).length === 1 && has(item, "group_")) ? [] : arr;
50532
- } else if (Array.isArray(formData[fieldKey])) {
50533
- acc[fieldKey] = formData[fieldKey].map(
50534
- (item) => Object.fromEntries(
50535
- Object.entries(item).filter(([key, value]) => {
50536
- if (filterKeys.includes(key)) return false;
50553
+ const _formData = { ...formData };
50554
+ Object.keys(_formData).filter((k) => k.includes(":")).forEach((_2DKey) => {
50555
+ const [subKey] = _2DKey.split(":");
50556
+ const _2DData = _formData[_2DKey];
50557
+ const subData = [..._formData[subKey]];
50558
+ if ([_2DData, subData].every(Array.isArray)) {
50559
+ _formData[subKey] = [];
50560
+ _2DData.forEach((obj) => {
50561
+ const { __gw_y_uid, __gw_x_uid } = obj;
50562
+ const row = subData.find((row2) => row2.__gw_y_uid === __gw_y_uid);
50563
+ if (!row) return;
50564
+ _formData[subKey].push({
50565
+ // 保留动态关联前端键值到 group_
50566
+ group_: `${__gw_y_uid}:${__gw_x_uid}`,
50567
+ ...row,
50568
+ ...omit(obj, FILTER_KEYS)
50569
+ });
50570
+ });
50571
+ }
50572
+ delete _formData[_2DKey];
50573
+ });
50574
+ const realFormData = Object.keys(_formData).reduce((reducedData, fieldKey) => {
50575
+ const fieldValue = _formData[fieldKey];
50576
+ if (Array.isArray(fieldValue)) {
50577
+ fieldValue.forEach((row) => {
50578
+ const { __gw_x_uid } = row;
50579
+ if (__gw_x_uid) {
50580
+ row.group_ = __gw_x_uid;
50581
+ }
50582
+ });
50583
+ reducedData[fieldKey] = _formData[fieldKey].map(
50584
+ (row) => Object.fromEntries(
50585
+ Object.entries(row).filter(([key, value]) => {
50586
+ if (FILTER_KEYS.includes(key)) return false;
50537
50587
  if (key.endsWith("_lb_") && isEmpty(value)) return false;
50538
50588
  return true;
50539
50589
  })
50540
50590
  )
50541
50591
  );
50542
50592
  } else {
50543
- acc[fieldKey] = formData[fieldKey];
50593
+ reducedData[fieldKey] = fieldValue;
50544
50594
  }
50545
- return acc;
50595
+ return reducedData;
50546
50596
  }, {});
50547
- console.log("0506 数据转成真实提交数据(二维表要平铺)", realFormData);
50548
- return omit(realFormData, filterKeys);
50597
+ console.log("数据转成真实提交数据", realFormData);
50598
+ return omit(realFormData, FILTER_KEYS);
50549
50599
  }
50550
50600
  const API_CONFIG = {
50551
50601
  ENTITY_CATEGORY: "entity",
@@ -51249,8 +51299,13 @@ async function applyAutofillRules(record, instances, autofillRules, masterSlaveL
51249
51299
  const targetField = widgetMeta.field;
51250
51300
  if (!targetField) continue;
51251
51301
  let runtimeValuePath = targetField.valuePath;
51302
+ if (parseValuePath(runtimeValuePath).isLink) continue;
51252
51303
  if (opts?.needReplacePathIndexPlaceholder) {
51253
- runtimeValuePath = replacePathIndexPlaceholder(opts.sourceValuePath, runtimeValuePath);
51304
+ if (parseValuePath(opts.sourceValuePath).isLink) continue;
51305
+ runtimeValuePath = replacePathIndexPlaceholders({
51306
+ refPath: opts.sourceValuePath,
51307
+ templatePath: runtimeValuePath
51308
+ });
51254
51309
  }
51255
51310
  const computed2 = await computeFieldDefaultValue({
51256
51311
  fieldType: targetField.fieldType,
@@ -51794,15 +51849,17 @@ const handleParameterMapping = async (parameterMapping, paramsConfig, fieldPermi
51794
51849
  const processParamItem = async (item) => {
51795
51850
  if (!referenceMap.has(item.formKey)) return;
51796
51851
  const value = referenceMap.get(item.formKey);
51797
- const valuePath = generateValuePath(item.field, item?.subModel ? item.subFieldKey : "");
51798
51852
  const widget = instances.find((instance2) => {
51799
51853
  const fieldMeta = instance2.widgetMeta?.field;
51800
51854
  if (item?.subModel) {
51801
- return item.field === getLastSegment(fieldMeta?.fieldLink) && item.subFieldKey === fieldMeta?.subFieldKey;
51855
+ const parsed = parseValuePath(fieldMeta?.subFieldKey);
51856
+ const subFieldKey = parsed.isLink ? parsed.parentFieldKey ?? "" : parsed.fieldKey;
51857
+ return item.field === getLastSegment(fieldMeta?.fieldLink) && item.subFieldKey === subFieldKey;
51802
51858
  }
51803
51859
  return item.field === getLastSegment(fieldMeta?.fieldLink) && !fieldMeta?.subFieldKey;
51804
51860
  });
51805
51861
  if (widget) {
51862
+ const valuePath = widget.valuePath;
51806
51863
  const computed2 = await computeFieldDefaultValue({
51807
51864
  fieldType: item.fieldType,
51808
51865
  fieldMeta: widget.widgetMeta.field,
@@ -51814,8 +51871,6 @@ const handleParameterMapping = async (parameterMapping, paramsConfig, fieldPermi
51814
51871
  allowSubModelRequest: true
51815
51872
  });
51816
51873
  merge(paramMap, computed2);
51817
- } else {
51818
- merge(paramMap, { [valuePath]: toFormatValue(item.fieldType, value) });
51819
51874
  }
51820
51875
  };
51821
51876
  await Promise.all([...builtinParams, ...compParams].map(processParamItem));
@@ -51833,11 +51888,10 @@ const buildPathMapFromApiResult = (onFieldMap, result, subTableInfo) => {
51833
51888
  onFieldMap.forEach((item) => {
51834
51889
  if (item.subModel === 0) {
51835
51890
  const firstRow = data[0];
51836
- item.fields.forEach(({ isFieldModel, leftFieldKey, fieldLink, rightFieldKey }) => {
51891
+ item.fields.forEach(({ isFieldModel, fieldLink, rightFieldKey, valuePath }) => {
51837
51892
  const srcKey = rightFieldKey;
51838
51893
  const value = isFieldModel ? firstRow?.__FOREIGN__?.[fieldLink] : firstRow?.[srcKey];
51839
- if (value != null) {
51840
- const valuePath = generateValuePath(leftFieldKey, "");
51894
+ if (value != null && valuePath) {
51841
51895
  pathMap[valuePath] = value;
51842
51896
  const label = getLabelFromDict(srcKey, value);
51843
51897
  if (label != null) pathMap[`${valuePath}_lb_`] = label;
@@ -51845,12 +51899,15 @@ const buildPathMapFromApiResult = (onFieldMap, result, subTableInfo) => {
51845
51899
  });
51846
51900
  } else if (item.subModel === 1) {
51847
51901
  data.forEach(
51848
- (rowData, index2) => item.fields.forEach(({ isFieldModel, leftFieldKey, fieldLink, rightFieldKey }) => {
51902
+ (rowData, index2) => item.fields.forEach(({ isFieldModel, fieldLink, rightFieldKey, valuePath }) => {
51849
51903
  const srcKey = rightFieldKey;
51850
51904
  const value = isFieldModel ? rowData?.__FOREIGN__?.[fieldLink] : rowData?.[srcKey];
51851
- if (value != null) {
51852
- const valuePath = generateValuePath(leftFieldKey, item.subFieldKey);
51853
- const runtimeValuePath = replacePathIndexPlaceholder(index2, valuePath);
51905
+ if (value != null && valuePath) {
51906
+ const runtimeValuePath = replacePathIndexPlaceholders({
51907
+ y: index2,
51908
+ n: index2,
51909
+ templatePath: valuePath
51910
+ });
51854
51911
  pathMap[runtimeValuePath] = value;
51855
51912
  const label = getLabelFromDict(srcKey, value);
51856
51913
  if (label != null) pathMap[`${runtimeValuePath}_lb_`] = label;
@@ -51861,7 +51918,7 @@ const buildPathMapFromApiResult = (onFieldMap, result, subTableInfo) => {
51861
51918
  });
51862
51919
  return pathMap;
51863
51920
  };
51864
- const handleCustomDataSource = async (customDataSource, paramsConfig, subTableInfo, instanceId) => {
51921
+ const handleCustomDataSource = async (customDataSource, paramsConfig, subTableInfo, instanceId, instances) => {
51865
51922
  if (!customDataSource.length || !paramsConfig) {
51866
51923
  return {};
51867
51924
  }
@@ -51882,7 +51939,26 @@ const handleCustomDataSource = async (customDataSource, paramsConfig, subTableIn
51882
51939
  formKey: ex.formKey
51883
51940
  };
51884
51941
  }),
51885
- onFieldMap: item.onFieldMap
51942
+ onFieldMap: item.onFieldMap.map((k) => {
51943
+ return {
51944
+ ...k,
51945
+ fields: k.fields.map((field) => {
51946
+ const widget = instances.find((instance2) => {
51947
+ const fieldMeta = instance2.widgetMeta?.field;
51948
+ if (k?.subModel === 1) {
51949
+ const parsed = parseValuePath(fieldMeta?.subFieldKey);
51950
+ const subFieldKey = parsed.isLink ? parsed.parentFieldKey ?? "" : parsed.fieldKey;
51951
+ return field.leftFieldKey === getLastSegment(fieldMeta?.fieldLink) && k.subFieldKey === subFieldKey;
51952
+ }
51953
+ return field.leftFieldKey === getLastSegment(fieldMeta?.fieldLink) && !fieldMeta?.subFieldKey;
51954
+ });
51955
+ return {
51956
+ ...field,
51957
+ valuePath: widget ? widget.valuePath : ""
51958
+ };
51959
+ })
51960
+ };
51961
+ })
51886
51962
  };
51887
51963
  });
51888
51964
  for (const info of customDsList) {
@@ -51951,7 +52027,11 @@ const handleCustomDataSource = async (customDataSource, paramsConfig, subTableIn
51951
52027
  Object.entries(rowData).forEach(([key, value]) => {
51952
52028
  if (value != null) {
51953
52029
  const valuePath = generateValuePath(key, item.subFieldKey);
51954
- const runtimeValuePath = replacePathIndexPlaceholder(index2, valuePath);
52030
+ const runtimeValuePath = replacePathIndexPlaceholders({
52031
+ y: index2,
52032
+ n: index2,
52033
+ templatePath: valuePath
52034
+ });
51955
52035
  ipaasPathMap[runtimeValuePath] = value;
51956
52036
  }
51957
52037
  });
@@ -52010,7 +52090,7 @@ const handleCustomDataSource = async (customDataSource, paramsConfig, subTableIn
52010
52090
  }
52011
52091
  }
52012
52092
  const results = await Promise.all(promises);
52013
- return results.reduce((merged, map2) => merge(merged, map2), {});
52093
+ return results.reduce((merged, map) => merge(merged, map), {});
52014
52094
  };
52015
52095
  const loadDataInitValues = async (dataInitConfig, paramsConfig, subTableInfo, fieldPermission, instanceId, instances, ctx) => {
52016
52096
  if (!dataInitConfig) return { paramMap: {}, dsRawData: {} };
@@ -52026,7 +52106,8 @@ const loadDataInitValues = async (dataInitConfig, paramsConfig, subTableInfo, fi
52026
52106
  customDataSource,
52027
52107
  paramsConfig,
52028
52108
  subTableInfo,
52029
- instanceId
52109
+ instanceId,
52110
+ instances
52030
52111
  );
52031
52112
  return { paramMap, dsMap };
52032
52113
  };
@@ -52239,7 +52320,8 @@ async function initializeDocumentEngine(props, payload, result) {
52239
52320
  console.log("接口获取接口数据 ===>", interfaceData);
52240
52321
  const rawData = conversionFormState({
52241
52322
  masterSlaveList,
52242
- interfaceData
52323
+ interfaceData,
52324
+ instances
52243
52325
  });
52244
52326
  const docRuntimeMeta = {
52245
52327
  ...requestInfo,
@@ -52345,7 +52427,11 @@ function useDocumentFactory(props, payload) {
52345
52427
  instances,
52346
52428
  isMockReport: payload.isMockReport || payload.factoryType === "template"
52347
52429
  });
52348
- const rawData = conversionFormState({ masterSlaveList, interfaceData });
52430
+ const rawData = conversionFormState({
52431
+ masterSlaveList,
52432
+ interfaceData,
52433
+ instances
52434
+ });
52349
52435
  doc.dataManager.setRawData(rawData);
52350
52436
  await nextTick();
52351
52437
  doc.docRuntimeMeta.handleInfo.initRawDataSnapshot = cloneDeep(doc.dataManager.getRawData());
@@ -55830,6 +55916,228 @@ const builtinComponents = {
55830
55916
  [BuiltinComponentTypeConst.InlineImage]: _sfc_main$2L,
55831
55917
  [BuiltinComponentTypeConst.Text]: _sfc_main$2K
55832
55918
  };
55919
+ const OUTLINE_BORDER_INSET = 1;
55920
+ const borderConfig = {
55921
+ outer: {
55922
+ color: "rgb(128, 128, 128)",
55923
+ width: 1
55924
+ },
55925
+ inner: {
55926
+ color: "rgb(128, 128, 128)",
55927
+ width: 1
55928
+ },
55929
+ guide: {
55930
+ color: "#026AC8",
55931
+ width: 2
55932
+ }
55933
+ };
55934
+ const subThemeConfig = {
55935
+ "fixed-table": {
55936
+ label: "固定表",
55937
+ color: "#309C41",
55938
+ background: "rgba(48,156,65,0.1)",
55939
+ labelBjColor: "rgba(48,156,65,0.8)"
55940
+ },
55941
+ "check-table": {
55942
+ label: "检验表",
55943
+ color: "#309C41",
55944
+ background: "rgba(48,156,65,0.1)",
55945
+ labelBjColor: "rgba(48,156,65,0.8)"
55946
+ },
55947
+ "dynamic-table": {
55948
+ label: "动态表",
55949
+ color: "#026AC8",
55950
+ background: "rgba(2,106,200,0.1)",
55951
+ labelBjColor: "rgba(2,106,200,0.8)"
55952
+ },
55953
+ "2d-table": {
55954
+ label: "二维表",
55955
+ color: "#026AC8",
55956
+ background: "rgba(2,106,200,0.1)",
55957
+ labelBjColor: "rgba(2,106,200,0.8)"
55958
+ },
55959
+ "table-header": {
55960
+ label: "表头",
55961
+ color: "rgba(245, 69, 71, 1)",
55962
+ background: "rgba(245, 69, 71, 0.1)",
55963
+ labelBjColor: "rgba(245, 69, 71, 0.8)"
55964
+ },
55965
+ "data-group": {
55966
+ label: "数据分组",
55967
+ color: "#F77E4A",
55968
+ background: "rgba(247,126,74,0.1)",
55969
+ labelBjColor: "rgba(247,126,74,0.8)"
55970
+ },
55971
+ "data-group-2d": {
55972
+ label: "动态关联",
55973
+ color: "#F77E4A",
55974
+ background: "rgba(247,126,74,0.1)",
55975
+ labelBjColor: "rgba(247,126,74,0.8)"
55976
+ }
55977
+ };
55978
+ const getStyleByType = (type4) => {
55979
+ const config = subThemeConfig[type4];
55980
+ return {
55981
+ strokeColor: config?.color || "#000",
55982
+ backgroundColor: config?.background || "transparent",
55983
+ label: config?.label || "",
55984
+ labelBjColor: config?.labelBjColor || "#666"
55985
+ };
55986
+ };
55987
+ const EPS = 1e-3;
55988
+ function clipHLineByMerges(line, merges) {
55989
+ let segments = [line];
55990
+ merges.forEach((rect) => {
55991
+ segments = segments.flatMap((seg) => {
55992
+ const insideY = seg.y > rect.y + EPS && seg.y < rect.y + rect.height - EPS;
55993
+ if (!insideY) return [seg];
55994
+ if (seg.x2 <= rect.x + EPS || seg.x1 >= rect.x + rect.width - EPS) return [seg];
55995
+ if (rect.x <= seg.x1 + EPS && rect.x + rect.width >= seg.x2 - EPS) return [];
55996
+ const res = [];
55997
+ if (seg.x1 < rect.x - EPS) res.push({ ...seg, x2: rect.x });
55998
+ if (seg.x2 > rect.x + rect.width + EPS) res.push({ ...seg, x1: rect.x + rect.width });
55999
+ return res;
56000
+ });
56001
+ });
56002
+ return segments;
56003
+ }
56004
+ function clipVLineByMerges(line, merges) {
56005
+ let segments = [line];
56006
+ merges.forEach((rect) => {
56007
+ segments = segments.flatMap((seg) => {
56008
+ const insideX = seg.x > rect.x + EPS && seg.x < rect.x + rect.width - EPS;
56009
+ if (!insideX) return [seg];
56010
+ if (seg.y2 <= rect.y + EPS || seg.y1 >= rect.y + rect.height - EPS) return [seg];
56011
+ if (rect.y <= seg.y1 + EPS && rect.y + rect.height >= seg.y2 - EPS) return [];
56012
+ const res = [];
56013
+ if (seg.y1 < rect.y - EPS) res.push({ ...seg, y2: rect.y });
56014
+ if (seg.y2 > rect.y + rect.height + EPS) res.push({ ...seg, y1: rect.y + rect.height });
56015
+ return res;
56016
+ });
56017
+ });
56018
+ return segments;
56019
+ }
56020
+ function createTableOutlineLayer(options) {
56021
+ const { cells, inset = 1 } = options;
56022
+ if (!cells.length) return { backgroundRect: null, hLines: [], vLines: [], labelPos: void 0 };
56023
+ const minX = Math.min(...cells.map((c2) => c2.x));
56024
+ const minY = Math.min(...cells.map((c2) => c2.y));
56025
+ const maxX = Math.max(...cells.map((c2) => c2.x + c2.width));
56026
+ const maxY = Math.max(...cells.map((c2) => c2.y + c2.height));
56027
+ const minLY = Math.min(...cells.map((c2) => c2.layoutY));
56028
+ const maxLX = Math.max(...cells.map((c2) => c2.layoutX + c2.width));
56029
+ const maxLY = Math.max(...cells.map((c2) => c2.layoutY + c2.height));
56030
+ const backgroundRect = {
56031
+ x: minX + inset,
56032
+ y: minY + inset,
56033
+ width: maxX - minX - inset * 2,
56034
+ height: maxY - minY - inset * 2
56035
+ };
56036
+ const hLines = [
56037
+ { x1: minX + inset, x2: maxX - inset, y: minY + inset },
56038
+ // top
56039
+ { x1: minX + inset, x2: maxX - inset, y: maxY - inset }
56040
+ // bottom
56041
+ ];
56042
+ const vLines = [
56043
+ { x: minX + inset, y1: minY + inset, y2: maxY - inset },
56044
+ // left
56045
+ { x: maxX - inset, y1: minY + inset, y2: maxY - inset }
56046
+ // right
56047
+ ];
56048
+ const labelPos = { x: maxLX - inset, y1: minLY + inset, y2: maxLY - inset };
56049
+ return { backgroundRect, hLines, vLines, labelPos };
56050
+ }
56051
+ const accumulate = (list) => {
56052
+ const result = [0];
56053
+ let acc = 0;
56054
+ for (const n of list) {
56055
+ acc += n;
56056
+ result.push(acc);
56057
+ }
56058
+ return result;
56059
+ };
56060
+ const inRange = (n, min, max) => n > min && n < max;
56061
+ function mapCellsToOutlineCells(cells) {
56062
+ return cells.map((c2) => ({
56063
+ x: c2.x,
56064
+ y: c2.rowY,
56065
+ layoutX: c2.layoutX,
56066
+ layoutY: c2.layoutY,
56067
+ width: c2.width,
56068
+ height: c2.height
56069
+ }));
56070
+ }
56071
+ function groupBy(list, getKey) {
56072
+ return list.reduce((acc, item) => {
56073
+ const key = getKey(item);
56074
+ (acc[key] ||= []).push(item);
56075
+ return acc;
56076
+ }, {});
56077
+ }
56078
+ function buildPosMap(layers, getRect, toDom) {
56079
+ const res = {};
56080
+ for (const [id, layer] of Object.entries(layers)) {
56081
+ const rect = getRect(layer);
56082
+ if (!rect) continue;
56083
+ const pos = toDom(rect);
56084
+ if (pos) res[id] = pos;
56085
+ }
56086
+ return res;
56087
+ }
56088
+ function getDataIndexLayersMap({
56089
+ type: type4,
56090
+ cells,
56091
+ isDesign,
56092
+ convertExtraProps
56093
+ }) {
56094
+ const getDataIndex = (cell) => {
56095
+ return isLinkSubTableType(type4) && isDesign ? cell.subRenderer?.xDataIndex : cell.subRenderer?.yDataIndex;
56096
+ };
56097
+ const getAllDataIndex = (cell) => {
56098
+ const { dataIndex, xDataIndex, yDataIndex } = cell?.subRenderer || {};
56099
+ return dataIndex ?? xDataIndex ?? yDataIndex;
56100
+ };
56101
+ const _cells = cells.filter(
56102
+ (cell) => isNumber(getAllDataIndex(cell)) && cell?.subRenderer?.type === type4
56103
+ );
56104
+ if (!_cells.length) return {};
56105
+ const grouped = groupBy(
56106
+ _cells,
56107
+ (cell) => `${cell.subRenderer.id}_dataIndex${getDataIndex(cell)}`
56108
+ );
56109
+ const layersMapEntries = Object.entries(grouped).map(([id, __cells]) => {
56110
+ const firstCell = __cells[0];
56111
+ const isFirstGroup = getDataIndex(firstCell) === 0;
56112
+ const lastCell = __cells.filter((c2) => {
56113
+ if (isDesign) {
56114
+ return true;
56115
+ } else {
56116
+ const { type: type22, cellZone } = c2.subRenderer || {};
56117
+ return isLinkSubTableType(type22) ? isLinkSubTableSubScopeZone(cellZone) : true;
56118
+ }
56119
+ }).at(-1);
56120
+ const bgLayer = createTableOutlineLayer({
56121
+ cells: mapCellsToOutlineCells(__cells),
56122
+ inset: 4
56123
+ });
56124
+ const borderLayer = isFirstGroup ? createTableOutlineLayer({
56125
+ cells: mapCellsToOutlineCells(__cells),
56126
+ inset: OUTLINE_BORDER_INSET
56127
+ }) : { hLines: [], vLines: [], backgroundRect: null, labelPos: void 0 };
56128
+ return [
56129
+ id,
56130
+ {
56131
+ ...borderLayer,
56132
+ ...convertExtraProps(firstCell),
56133
+ showBorder: isFirstGroup,
56134
+ placeholderBjRect: bgLayer.backgroundRect,
56135
+ lastCell
56136
+ }
56137
+ ];
56138
+ });
56139
+ return Object.fromEntries(layersMapEntries);
56140
+ }
55833
56141
  const baseCanvasAttrs = {
55834
56142
  /** 不参与事件命中检测 */
55835
56143
  listening: false,
@@ -56154,7 +56462,7 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
56154
56462
  const filteredCells = subTableCells.value.filter(({ subRenderer }) => {
56155
56463
  if (subRenderer) {
56156
56464
  const { type: type4, cellZone } = subRenderer;
56157
- return getIsDataGroup2DTable(type4) ? getIs2DCellInSubTable(cellZone) : true;
56465
+ return isLinkSubTableType(type4) ? isLinkSubTableSubScopeZone(cellZone) : true;
56158
56466
  } else {
56159
56467
  return true;
56160
56468
  }
@@ -56197,7 +56505,7 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
56197
56505
  convertExtraProps: (cell) => ({
56198
56506
  type: "data-group-2d",
56199
56507
  valuePath: cell.subRenderer.valuePath,
56200
- placeholder: `${cell.subRenderer.dataIndex}`
56508
+ placeholder: `${cell.subRenderer.xDataIndex}`
56201
56509
  })
56202
56510
  })
56203
56511
  );
@@ -57038,18 +57346,24 @@ const _sfc_main$2y = /* @__PURE__ */ defineComponent({
57038
57346
  upRowNum: 1,
57039
57347
  downRowNum: 1
57040
57348
  });
57349
+ const resolveRowDataPath = (valuePath) => {
57350
+ const parsed = parseValuePath(valuePath);
57351
+ return {
57352
+ path: parsed.isLink ? parsed.parentFieldPath ?? "" : parsed.fieldPath,
57353
+ subFieldKey: parsed.isLink ? parsed.parentFieldKey ?? "" : parsed.fieldKey
57354
+ };
57355
+ };
57041
57356
  const getCtx = () => {
57042
57357
  const { valuePath, dataIndex, yDataIndex } = props.cell.subRenderer;
57043
57358
  return {
57044
- path: valuePath,
57045
- index: dataIndex ?? yDataIndex ?? 0
57359
+ ...resolveRowDataPath(valuePath),
57360
+ index: yDataIndex ?? dataIndex ?? 0
57046
57361
  };
57047
57362
  };
57048
57363
  const readonly2 = computed(() => {
57049
- const subFieldKey = getLastSegment(getCtx().path);
57050
57364
  const state = resolveWidgetState({
57051
57365
  doc: props.doc,
57052
- fieldLink: subFieldKey,
57366
+ fieldLink: getCtx().subFieldKey,
57053
57367
  modelLink: props.doc.mainModelKey
57054
57368
  });
57055
57369
  return state.displayStatus === "readonly-component" || state.displayStatus === "readonly-text";
@@ -57206,7 +57520,7 @@ const _sfc_main$2y = /* @__PURE__ */ defineComponent({
57206
57520
  };
57207
57521
  }
57208
57522
  });
57209
- const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2y, [["__scopeId", "data-v-e2cc91ff"]]);
57523
+ const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2y, [["__scopeId", "data-v-a58c6b2e"]]);
57210
57524
  const _sfc_main$2x = /* @__PURE__ */ defineComponent({
57211
57525
  __name: "index",
57212
57526
  props: {
@@ -57643,7 +57957,10 @@ function diffListField(fieldKey, beforeRows, afterRows, metaMap, output) {
57643
57957
  continue;
57644
57958
  }
57645
57959
  const valuePath = generateValuePath(rowFieldKey, fieldKey);
57646
- const runtimeValuePath = replacePathIndexPlaceholder(rowIndex, valuePath);
57960
+ const runtimeValuePath = replacePathIndexPlaceholders({
57961
+ n: rowIndex,
57962
+ templatePath: valuePath
57963
+ });
57647
57964
  const meta = getFieldMeta(metaMap, runtimeValuePath);
57648
57965
  pushChange(output, {
57649
57966
  beforeValue,
@@ -57669,7 +57986,7 @@ function diffMainField(fieldKey, beforeValue, afterValue, beforeData, afterData,
57669
57986
  });
57670
57987
  }
57671
57988
  function buildWidgetFieldMetaMap(instances) {
57672
- const map2 = /* @__PURE__ */ new Map();
57989
+ const map = /* @__PURE__ */ new Map();
57673
57990
  for (const instance2 of instances || []) {
57674
57991
  const widgetMeta = instance2?.widgetMeta;
57675
57992
  const fieldMeta = widgetMeta?.field;
@@ -57682,10 +57999,10 @@ function buildWidgetFieldMetaMap(instances) {
57682
57999
  modelId: instance2.modelRef.id,
57683
58000
  points: instance2?.widgetMeta?.extra?.biz?.[instance2.modelRef.id] || {}
57684
58001
  };
57685
- map2.set(runtimeValuePath, value);
58002
+ map.set(runtimeValuePath, value);
57686
58003
  }
57687
- console.log("map", map2);
57688
- return map2;
58004
+ console.log("map", map);
58005
+ return map;
57689
58006
  }
57690
58007
  function buildFieldChangeList(params) {
57691
58008
  const baseline = normalizeFormData(params.baselineData);
@@ -60233,7 +60550,7 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
60233
60550
  const createFieldToWidget = createDesignFieldToWidgetFactory(designCtx.getFieldManifest);
60234
60551
  const subFieldKey = computed(() => {
60235
60552
  if (!interCtx.panelData?.context?.subFieldKey) return "";
60236
- return getLastSegment(interCtx.panelData.context.subFieldKey);
60553
+ return parseValuePath(interCtx.panelData.context.subFieldKey).normalized;
60237
60554
  });
60238
60555
  const modelKey = computed(() => {
60239
60556
  if (!interCtx.panelData) return "";
@@ -60358,7 +60675,7 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
60358
60675
  };
60359
60676
  }
60360
60677
  });
60361
- const ToolkitContentFields = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__scopeId", "data-v-2e5d2168"]]);
60678
+ const ToolkitContentFields = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__scopeId", "data-v-9c5fa2ca"]]);
60362
60679
  const _hoisted_1$1C = { class: "toolkit-content-widgets" };
60363
60680
  const _hoisted_2$11 = { key: 0 };
60364
60681
  const _hoisted_3$M = ["data-type", "draggable", "onDragstart"];
@@ -60631,14 +60948,14 @@ const _sfc_main$2e = /* @__PURE__ */ defineComponent({
60631
60948
  bl: { x: x2 + padding.left, y: y2 + height - padding.bottom },
60632
60949
  br: { x: x2 + width - padding.right, y: y2 + height - padding.bottom }
60633
60950
  };
60634
- const map2 = {
60951
+ const map = {
60635
60952
  tl: [-1, -1],
60636
60953
  tr: [1, -1],
60637
60954
  bl: [-1, 1],
60638
60955
  br: [1, 1]
60639
60956
  };
60640
60957
  return Object.keys(corners).map((pos) => {
60641
- const [dx, dy] = map2[pos];
60958
+ const [dx, dy] = map[pos];
60642
60959
  const cx = halfPixel(corners[pos].x);
60643
60960
  const cy = halfPixel(corners[pos].y);
60644
60961
  return {
@@ -64150,16 +64467,16 @@ const __vite_glob_0_42 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
64150
64467
  }, Symbol.toStringTag, { value: "Module" }));
64151
64468
  function loadFieldManifestModules() {
64152
64469
  const manifestModules = /* @__PURE__ */ Object.assign({ "./basic/boolean-manifest.ts": __vite_glob_0_0$3, "./basic/date-manifest.ts": __vite_glob_0_1$3, "./basic/date-time-manifest.ts": __vite_glob_0_2$3, "./basic/decimal-manifest.ts": __vite_glob_0_3$3, "./basic/double-manifest.ts": __vite_glob_0_4$3, "./basic/integer-manifest.ts": __vite_glob_0_5$3, "./basic/long-manifest.ts": __vite_glob_0_6$3, "./basic/long-text-manifest.ts": __vite_glob_0_7$2, "./basic/text-manifest.ts": __vite_glob_0_8$2, "./basic/time-manifest.ts": __vite_glob_0_9$2, "./business/destructive-test-qty-manifest.ts": __vite_glob_0_10$2, "./business/good-qty-manifest.ts": __vite_glob_0_11$2, "./business/material-check-qty-manifest.ts": __vite_glob_0_12$2, "./business/not-good-group-manifest.ts": __vite_glob_0_13$2, "./business/not-good-qty-manifest.ts": __vite_glob_0_14$1, "./business/not-good-reason-manifest.ts": __vite_glob_0_15$1, "./business/product-check-qty-manifest.ts": __vite_glob_0_16, "./business/production-date-manifest.ts": __vite_glob_0_17, "./business/report-end-time-manifest.ts": __vite_glob_0_18, "./business/report-start-time-manifest.ts": __vite_glob_0_19, "./business/reporter-manifest.ts": __vite_glob_0_20, "./business/routing-operation-manifest.ts": __vite_glob_0_21, "./business/scrap-group-manifest.ts": __vite_glob_0_22, "./business/scrap-material-manifest.ts": __vite_glob_0_23, "./business/scrap-material-no-manifest.ts": __vite_glob_0_24, "./business/scrap-qty-manifest.ts": __vite_glob_0_25, "./business/scrap-reason-manifest.ts": __vite_glob_0_26, "./business/work-hours-manifest.ts": __vite_glob_0_27, "./logic/attachment-manifest.ts": __vite_glob_0_28, "./logic/image-manifest.ts": __vite_glob_0_29, "./logic/option-manifest.ts": __vite_glob_0_30, "./logic/option-multi-manifest.ts": __vite_glob_0_31, "./logic/org-manifest.ts": __vite_glob_0_32, "./logic/org-multi-manifest.ts": __vite_glob_0_33, "./logic/signature-manifest.ts": __vite_glob_0_34, "./logic/user-manifest.ts": __vite_glob_0_35, "./logic/user-multi-manifest.ts": __vite_glob_0_36, "./trace/device-manifest.ts": __vite_glob_0_37, "./trace/material-no-manifest.ts": __vite_glob_0_38, "./trace/mfg-order-manifest.ts": __vite_glob_0_39, "./trace/product-manifest.ts": __vite_glob_0_40, "./trace/record-no-manifest.ts": __vite_glob_0_41, "./trace/trace-date-manifest.ts": __vite_glob_0_42 });
64153
- const map2 = {};
64470
+ const map = {};
64154
64471
  Object.entries(manifestModules).forEach(([path2, exports$1]) => {
64155
64472
  const { manifest: manifest2 } = exports$1;
64156
64473
  if (!manifest2) {
64157
64474
  console.warn(`模块 ${path2} 缺少必要导出项`);
64158
64475
  return;
64159
64476
  }
64160
- map2[manifest2.type] = manifest2;
64477
+ map[manifest2.type] = manifest2;
64161
64478
  });
64162
- return map2;
64479
+ return map;
64163
64480
  }
64164
64481
  const fieldManifestMap = loadFieldManifestModules();
64165
64482
  const manifest$6 = {
@@ -64456,16 +64773,16 @@ const __vite_glob_0_6$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.d
64456
64773
  }, Symbol.toStringTag, { value: "Module" }));
64457
64774
  function loadPaperWidgetManifestModules() {
64458
64775
  const manifestModules = /* @__PURE__ */ Object.assign({ "./basic/barcode-manifest.ts": __vite_glob_0_0$2, "./basic/diagonal-manifest.ts": __vite_glob_0_1$2, "./basic/image-manifest.ts": __vite_glob_0_2$2, "./basic/line-manifest.ts": __vite_glob_0_3$2, "./basic/pagination-manifest.ts": __vite_glob_0_4$2, "./basic/qrcode-manifest.ts": __vite_glob_0_5$2, "./basic/serialnumber-manifest.ts": __vite_glob_0_6$2 });
64459
- const map2 = {};
64776
+ const map = {};
64460
64777
  Object.entries(manifestModules).forEach(([path2, exports$1]) => {
64461
64778
  const { manifest: manifest2 } = exports$1;
64462
64779
  if (!manifest2) {
64463
64780
  console.warn(`模块 ${path2} 缺少必要导出项`);
64464
64781
  return;
64465
64782
  }
64466
- map2[manifest2.type] = manifest2;
64783
+ map[manifest2.type] = manifest2;
64467
64784
  });
64468
- return map2;
64785
+ return map;
64469
64786
  }
64470
64787
  const paperWidgetManifestMap = loadPaperWidgetManifestModules();
64471
64788
  const UploadTypeConst = {
@@ -65491,9 +65808,14 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
65491
65808
  const modelValue = computed(() => {
65492
65809
  let text = pageWidgetProps.value.value;
65493
65810
  if (valueType.value === ValueTypeConst.Field) {
65494
- const path2 = text?.fieldData?.valuePath;
65811
+ const path2 = text?.exp?.fieldData?.valuePath;
65495
65812
  if (path2) {
65496
- const runtimePath = replacePathIndexPlaceholder(props.widget.dataIndex, path2);
65813
+ const runtimePath = replacePathIndexPlaceholders({
65814
+ y: props.widget.yDataIndex,
65815
+ x: props.widget.xDataIndex,
65816
+ n: props.widget.dataIndex,
65817
+ templatePath: path2
65818
+ });
65497
65819
  text = docInst.value?.dataManager?.get(runtimePath);
65498
65820
  }
65499
65821
  }
@@ -65784,7 +66106,12 @@ const _sfc_main$1O = /* @__PURE__ */ defineComponent({
65784
66106
  return fieldInfo?.name ? `\${${fieldInfo.name}}` : path2;
65785
66107
  }
65786
66108
  if (path2) {
65787
- const runtimePath = replacePathIndexPlaceholder(props.widget.dataIndex, path2);
66109
+ const runtimePath = replacePathIndexPlaceholders({
66110
+ y: props.widget.yDataIndex,
66111
+ x: props.widget.xDataIndex,
66112
+ n: props.widget.dataIndex,
66113
+ templatePath: path2
66114
+ });
65788
66115
  return docInst.value?.dataManager?.get(runtimePath);
65789
66116
  }
65790
66117
  }
@@ -66258,9 +66585,14 @@ const _sfc_main$1K = /* @__PURE__ */ defineComponent({
66258
66585
  const modelValue = computed(() => {
66259
66586
  let text = pageWidgetProps.value.value;
66260
66587
  if (valueType.value === ValueTypeConst.Field) {
66261
- const path2 = text?.fieldData?.valuePath;
66588
+ const path2 = text?.exp?.fieldData?.valuePath;
66262
66589
  if (path2) {
66263
- const runtimePath = replacePathIndexPlaceholder(props.widget.dataIndex, path2);
66590
+ const runtimePath = replacePathIndexPlaceholders({
66591
+ y: props.widget.yDataIndex,
66592
+ x: props.widget.xDataIndex,
66593
+ n: props.widget.dataIndex,
66594
+ templatePath: path2
66595
+ });
66264
66596
  text = docInst.value?.dataManager?.get(runtimePath);
66265
66597
  }
66266
66598
  }
@@ -67192,13 +67524,15 @@ const _sfc_main$1D = /* @__PURE__ */ defineComponent({
67192
67524
  const designCtx = useDesignSuiteContext();
67193
67525
  const { docInst } = useDocPubApiContext();
67194
67526
  const props = __props;
67195
- const regionRef = computed(() => props.widget.findRegionById(props.active.context.regionId));
67196
- const modelKey = computed(() => getLastSegment(props.active.context.mainModelKey));
67197
- const fieldKey = computed(() => getLastSegment(regionRef.value?.valuePath));
67527
+ const regionRef = computed(
67528
+ () => props.widget.findRegionById(props.active.context.regionId)
67529
+ );
67530
+ const modelKey = computed(() => props.active.context.mainModelKey);
67531
+ const subFieldKey = computed(() => regionRef.value?.subFieldKey);
67198
67532
  const fieldInfo = computed(() => {
67199
- if (!modelKey.value || !fieldKey.value) return null;
67533
+ if (!modelKey.value || !subFieldKey.value) return null;
67200
67534
  const list = designCtx.runtime.getFieldList(modelKey.value);
67201
- return list?.find((f) => f.key === fieldKey.value) ?? null;
67535
+ return list?.find((f) => f.key === subFieldKey.value) ?? null;
67202
67536
  });
67203
67537
  const regionProps = usePanelProps(regionRef, "widgetMeta.props");
67204
67538
  function onDeleteDynamicTable() {
@@ -67317,7 +67651,7 @@ const _sfc_main$1D = /* @__PURE__ */ defineComponent({
67317
67651
  };
67318
67652
  }
67319
67653
  });
67320
- const DynamicTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__scopeId", "data-v-ca7aec6b"]]);
67654
+ const DynamicTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__scopeId", "data-v-09705f9b"]]);
67321
67655
  const schema$b = {
67322
67656
  key: "dynamic-table.basic",
67323
67657
  title: [
@@ -67346,8 +67680,8 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
67346
67680
  return props.widget.findRegionById(id);
67347
67681
  });
67348
67682
  const isBindDataGroup = withLayoutComputed(() => !!regionRef.value?.itemRegion);
67349
- const modelKey = computed(() => getLastSegment(props.active.context.mainModelKey));
67350
- const fieldKey = computed(() => getLastSegment(regionRef.value?.subFieldKey));
67683
+ const modelKey = computed(() => props.active.context.mainModelKey);
67684
+ const fieldKey = computed(() => regionRef.value?.subFieldKey);
67351
67685
  const fieldInfo = computed(() => {
67352
67686
  if (!modelKey.value || !fieldKey.value) return null;
67353
67687
  const list = designCtx.runtime.getFieldList(modelKey.value);
@@ -67453,7 +67787,7 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
67453
67787
  };
67454
67788
  }
67455
67789
  });
67456
- const _2DTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__scopeId", "data-v-7d2be0ce"]]);
67790
+ const _2DTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__scopeId", "data-v-8cc7a416"]]);
67457
67791
  const schema$a = {
67458
67792
  key: "2d-table.basic",
67459
67793
  title: [
@@ -67482,8 +67816,8 @@ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
67482
67816
  return props.widget.findRegionById(id);
67483
67817
  });
67484
67818
  const isBindDataGroup = withLayoutComputed(() => !!regionRef.value?.itemRegion);
67485
- const modelKey = computed(() => getLastSegment(props.active.context.mainModelKey));
67486
- const fieldKey = computed(() => getLastSegment(regionRef.value?.valuePath));
67819
+ const modelKey = computed(() => props.active.context.mainModelKey);
67820
+ const fieldKey = computed(() => regionRef.value?.subFieldKey);
67487
67821
  const fieldInfo = computed(() => {
67488
67822
  if (!modelKey.value || !fieldKey.value) return null;
67489
67823
  const list = designCtx.runtime.getFieldList(modelKey.value);
@@ -67589,7 +67923,7 @@ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
67589
67923
  };
67590
67924
  }
67591
67925
  });
67592
- const FixedTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__scopeId", "data-v-b909e48b"]]);
67926
+ const FixedTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__scopeId", "data-v-646f62b8"]]);
67593
67927
  const schema$9 = {
67594
67928
  key: "fixed-table.basic",
67595
67929
  title: [
@@ -67618,8 +67952,8 @@ const _sfc_main$1A = /* @__PURE__ */ defineComponent({
67618
67952
  return props.widget.findRegionById(id);
67619
67953
  });
67620
67954
  const isBindDataGroup = withLayoutComputed(() => !!regionRef.value?.itemRegion);
67621
- const modelKey = computed(() => getLastSegment(props.active.context.mainModelKey));
67622
- const fieldKey = computed(() => getLastSegment(regionRef.value?.subFieldKey));
67955
+ const modelKey = computed(() => props.active.context.mainModelKey);
67956
+ const fieldKey = computed(() => regionRef.value?.subFieldKey);
67623
67957
  const fieldInfo = computed(() => {
67624
67958
  if (!modelKey.value || !fieldKey.value) return null;
67625
67959
  const list = designCtx.runtime.getFieldList(modelKey.value);
@@ -67725,7 +68059,7 @@ const _sfc_main$1A = /* @__PURE__ */ defineComponent({
67725
68059
  };
67726
68060
  }
67727
68061
  });
67728
- const CheckTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__scopeId", "data-v-5792e4ce"]]);
68062
+ const CheckTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__scopeId", "data-v-e4d1497a"]]);
67729
68063
  const schema$8 = {
67730
68064
  key: "check-table.basic",
67731
68065
  title: [
@@ -67862,13 +68196,18 @@ const _sfc_main$1y = /* @__PURE__ */ defineComponent({
67862
68196
  };
67863
68197
  const props = __props;
67864
68198
  const sheetReadonly = ref(false);
68199
+ const rId = computed(() => props.active.context.regionId?.split("_")[0] ?? "");
68200
+ const regionRef = computed(
68201
+ () => props.widget.findRegionById(rId.value)
68202
+ );
67865
68203
  const optionsMap = computed(() => {
67866
- const { mainModelKey, subFieldKey } = props.active.context;
67867
- if (!mainModelKey || !subFieldKey) {
68204
+ const mainModelKey = props.active.context.mainModelKey;
68205
+ const rowFieldKey = regionRef.value?.subFieldKey;
68206
+ const colFieldKey = regionRef.value?.linkFieldKey;
68207
+ if (!mainModelKey || !rowFieldKey || !colFieldKey) {
67868
68208
  return { row: [], col: [] };
67869
68209
  }
67870
68210
  const mainFields = designCtx.runtime.getFieldList(mainModelKey);
67871
- const [rowFieldKey, colFieldKey] = subFieldKey.replace("$.", "").split(":") ?? [];
67872
68211
  const rowModelKey = mainFields.find((f) => f.key === rowFieldKey)?.bindInfo;
67873
68212
  const colModelKey = mainFields.find((f) => f.key === colFieldKey)?.bindInfo;
67874
68213
  return {
@@ -67876,10 +68215,6 @@ const _sfc_main$1y = /* @__PURE__ */ defineComponent({
67876
68215
  col: getFieldOptions(colModelKey)
67877
68216
  };
67878
68217
  });
67879
- const rId = computed(() => props.active.context.regionId?.split("_")[0] ?? "");
67880
- const regionRef = computed(
67881
- () => props.widget.findRegionById(rId.value)
67882
- );
67883
68218
  const itemRegion = computed(() => regionRef.value?.itemRegion);
67884
68219
  const regionProps = usePanelProps(regionRef, "widgetMeta.props");
67885
68220
  function onDeleteDataGroup2D() {
@@ -67978,7 +68313,7 @@ const _sfc_main$1y = /* @__PURE__ */ defineComponent({
67978
68313
  };
67979
68314
  }
67980
68315
  });
67981
- const DataGroup2DPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__scopeId", "data-v-6a36dc19"]]);
68316
+ const DataGroup2DPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__scopeId", "data-v-9e4ec5d9"]]);
67982
68317
  const schema$6 = {
67983
68318
  key: "data-group-2d.basic",
67984
68319
  title: [
@@ -76017,7 +76352,7 @@ const __vite_glob_1_6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
76017
76352
  const fieldModules = /* @__PURE__ */ Object.assign({ "./field/boolean/field-boolean-config.vue": __vite_glob_0_0, "./field/boolean/field-boolean-style.vue": __vite_glob_0_1, "./field/business/field-business-config.vue": __vite_glob_0_2, "./field/datetime/field-datetime-config.vue": __vite_glob_0_3, "./field/enum/field-enum-config.vue": __vite_glob_0_4, "./field/enum/field-enum-style.vue": __vite_glob_0_5, "./field/file/field-file-config.vue": __vite_glob_0_6, "./field/image/field-image-config.vue": __vite_glob_0_7, "./field/image/field-image-style.vue": __vite_glob_0_8, "./field/number/field-number-config.vue": __vite_glob_0_9, "./field/org/field-org-config.vue": __vite_glob_0_10, "./field/sign/field-sign-config.vue": __vite_glob_0_11, "./field/sign/field-sign-style.vue": __vite_glob_0_12, "./field/text/field-text-config.vue": __vite_glob_0_13, "./field/trace/field-trace-config.vue": __vite_glob_0_14, "./field/user/field-user-config.vue": __vite_glob_0_15 });
76018
76353
  const widgetModules = /* @__PURE__ */ Object.assign({ "./paper-widget/barcode/widget-barcode-config.vue": __vite_glob_1_0, "./paper-widget/diagonal/widget-diagonal-config.vue": __vite_glob_1_1, "./paper-widget/image/widget-image-config.vue": __vite_glob_1_2, "./paper-widget/line/widget-line-config.vue": __vite_glob_1_3, "./paper-widget/pagination/widget-pagination-config.vue": __vite_glob_1_4, "./paper-widget/qrcode/widget-qrcode-config.vue": __vite_glob_1_5, "./paper-widget/serialnumber/widget-serialnumber-config.vue": __vite_glob_1_6 });
76019
76354
  function buildMap(modules, reg) {
76020
- const map2 = {};
76355
+ const map = {};
76021
76356
  Object.entries(modules).forEach(([filePath, module2]) => {
76022
76357
  try {
76023
76358
  const match = filePath.match(reg);
@@ -76028,20 +76363,20 @@ function buildMap(modules, reg) {
76028
76363
  const [, coreId, typeStr] = match;
76029
76364
  const key = `schema:${coreId}`;
76030
76365
  const type4 = typeStr;
76031
- if (!map2[key]) {
76032
- map2[key] = {};
76366
+ if (!map[key]) {
76367
+ map[key] = {};
76033
76368
  }
76034
- map2[key][type4] = module2.default;
76369
+ map[key][type4] = module2.default;
76035
76370
  } catch (err) {
76036
76371
  console.error(`加载组件 ${filePath} 失败:`, err);
76037
76372
  }
76038
76373
  });
76039
- return map2;
76374
+ return map;
76040
76375
  }
76041
76376
  function mergeMaps(...maps) {
76042
76377
  const result = {};
76043
- maps.forEach((map2) => {
76044
- Object.entries(map2).forEach(([key, value]) => {
76378
+ maps.forEach((map) => {
76379
+ Object.entries(map).forEach(([key, value]) => {
76045
76380
  const _key = key;
76046
76381
  if (!result[_key]) {
76047
76382
  result[_key] = {};
@@ -77396,7 +77731,10 @@ function useTableDropdown(props) {
77396
77731
  strategy.value.linkFieldId,
77397
77732
  fieldMeta.value?.subFieldKey
77398
77733
  );
77399
- const realLinkValuePath = replacePathIndexPlaceholder(runtimeValuePath.value, linkValuePath);
77734
+ const realLinkValuePath = replacePathIndexPlaceholders({
77735
+ refPath: runtimeValuePath.value,
77736
+ templatePath: linkValuePath
77737
+ });
77400
77738
  return getValue$1(docInst.value.dataManager.get(realLinkValuePath), false);
77401
77739
  }
77402
77740
  });
@@ -77406,7 +77744,10 @@ function useTableDropdown(props) {
77406
77744
  strategy.value.clearFieldId,
77407
77745
  fieldMeta.value?.subFieldKey
77408
77746
  );
77409
- const realValuePath = replacePathIndexPlaceholder(runtimeValuePath.value, valuePath);
77747
+ const realValuePath = replacePathIndexPlaceholders({
77748
+ refPath: runtimeValuePath.value,
77749
+ templatePath: valuePath
77750
+ });
77410
77751
  return realValuePath;
77411
77752
  }
77412
77753
  });