@gct-paas/word 0.1.32 → 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/base/input/src/input.vue.d.ts +1 -1
- package/dist/base/input/src/text-area.vue.d.ts +1 -1
- package/dist/base/table/src/table.vue.d.ts +1 -1
- package/dist/core/command/commands/InsertField.d.ts +22 -2
- package/dist/core/data/DataManager.d.ts +40 -12
- package/dist/core/layout/handlers/fields/FieldBaseHandler.d.ts +1 -0
- package/dist/core/layout/linkSubTableLayout.d.ts +27 -0
- package/dist/core/layout/providers/TableInfoProvider.d.ts +2 -3
- package/dist/core/model/DocModel.d.ts +9 -0
- package/dist/core/model/document/Wtbl/RegionManager.d.ts +47 -10
- package/dist/core/model/document/Wtc.d.ts +20 -15
- package/dist/core/model/document/wtcRegionRef.d.ts +20 -0
- package/dist/core/model/logic/{Region.d.ts → base/Region.d.ts} +2 -5
- package/dist/core/model/logic/{SubTableHeaderRegion.d.ts → header/SubTableHeaderRegion.d.ts} +3 -6
- package/dist/core/model/logic/{TableHeaderRegion.d.ts → header/TableHeaderRegion.d.ts} +3 -3
- package/dist/core/model/logic/index.d.ts +18 -22
- package/dist/core/model/logic/{BoundedItemRegion.d.ts → subtable/bounded/BoundedItemRegion.d.ts} +5 -1
- package/dist/core/model/logic/{BoundedRegion.d.ts → subtable/bounded/BoundedRegion.d.ts} +7 -9
- package/dist/core/model/logic/subtable/link/CheckTableRegion.d.ts +11 -0
- package/dist/core/model/logic/subtable/link/DataGroup2DRegion.d.ts +15 -0
- package/dist/core/model/logic/subtable/link/LinkSubTableRegion.d.ts +48 -0
- package/dist/core/model/logic/subtable/link/_2DTableRegion.d.ts +11 -0
- package/dist/core/model/logic/{RepeatingRegion.d.ts → subtable/repeating/RepeatingRegion.d.ts} +7 -9
- package/dist/core/model/logic/subtable/shared/dataGroupSlotCount.d.ts +18 -0
- package/dist/core/model/logic/subtable/shared/itemRegionOps.d.ts +11 -0
- package/dist/core/model/logic/subtable/shared/regionValuePath.d.ts +8 -0
- package/dist/core/model/logic/types.d.ts +10 -0
- package/dist/core/utils/expand.d.ts +49 -18
- package/dist/core/view/TableCell.d.ts +3 -7
- package/dist/core/view/runs/ImageWidget.d.ts +6 -0
- package/dist/core/view/runs/TextWidget.d.ts +6 -0
- package/dist/index.es.js +1968 -1254
- package/dist/runtime/canvas/table/utils/index.d.ts +2 -2
- package/dist/runtime/factories/createDesignWidgetFactory.d.ts +17 -0
- package/dist/runtime/factories/{useRenderData.d.ts → useWidgetRenderData.d.ts} +18 -6
- package/dist/runtime/renderer/dropdowns/components/tables/rdo-table-dropdown.vue.d.ts +3 -3
- package/dist/runtime/renderer/dropdowns/components/tables/table-dropdown.vue.d.ts +3 -3
- package/dist/utils/func/core.d.ts +62 -18
- package/dist/utils/func/render.d.ts +4 -1
- package/dist/word.css +153 -153
- package/package.json +1 -1
- package/dist/core/model/logic/CheckTableRegion.d.ts +0 -44
- package/dist/core/model/logic/DataGroup2DRegion.d.ts +0 -12
- package/dist/core/model/logic/_2DTableRegion.d.ts +0 -44
- package/dist/runtime/factories/createFieldToWidgetFactory.d.ts +0 -13
- package/dist/runtime/factories/createPaperWidgetToWidgetFactory.d.ts +0 -13
- package/dist/runtime/factories/usePwRenderData.d.ts +0 -13
package/dist/index.es.js
CHANGED
|
@@ -15580,7 +15580,7 @@ function isArrayBufferView(val) {
|
|
|
15580
15580
|
}
|
|
15581
15581
|
const isString = typeOfTest("string");
|
|
15582
15582
|
const isFunction$2 = typeOfTest("function");
|
|
15583
|
-
const isNumber = typeOfTest("number");
|
|
15583
|
+
const isNumber$1 = typeOfTest("number");
|
|
15584
15584
|
const isObject$1 = (thing) => thing !== null && typeof thing === "object";
|
|
15585
15585
|
const isBoolean = (thing) => thing === true || thing === false;
|
|
15586
15586
|
const isPlainObject$1 = (val) => {
|
|
@@ -15738,7 +15738,7 @@ const toArray = (thing) => {
|
|
|
15738
15738
|
if (!thing) return null;
|
|
15739
15739
|
if (isArray$1(thing)) return thing;
|
|
15740
15740
|
let i = thing.length;
|
|
15741
|
-
if (!isNumber(i)) return null;
|
|
15741
|
+
if (!isNumber$1(i)) return null;
|
|
15742
15742
|
const arr = new Array(i);
|
|
15743
15743
|
while (i-- > 0) {
|
|
15744
15744
|
arr[i] = thing[i];
|
|
@@ -15881,7 +15881,7 @@ const utils$1 = {
|
|
|
15881
15881
|
isFormData,
|
|
15882
15882
|
isArrayBufferView,
|
|
15883
15883
|
isString,
|
|
15884
|
-
isNumber,
|
|
15884
|
+
isNumber: isNumber$1,
|
|
15885
15885
|
isBoolean,
|
|
15886
15886
|
isObject: isObject$1,
|
|
15887
15887
|
isPlainObject: isPlainObject$1,
|
|
@@ -17464,12 +17464,12 @@ const getFetch = (config) => {
|
|
|
17464
17464
|
Response,
|
|
17465
17465
|
fetch2
|
|
17466
17466
|
];
|
|
17467
|
-
let len = seeds.length, i = len, seed2, target,
|
|
17467
|
+
let len = seeds.length, i = len, seed2, target, map = seedCache;
|
|
17468
17468
|
while (i--) {
|
|
17469
17469
|
seed2 = seeds[i];
|
|
17470
|
-
target =
|
|
17471
|
-
target === void 0 &&
|
|
17472
|
-
|
|
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$
|
|
19036
|
+
var nativeMax$1 = Math.max;
|
|
19037
19037
|
function overRest(func, start, transform) {
|
|
19038
|
-
start = nativeMax$
|
|
19038
|
+
start = nativeMax$1(start === void 0 ? func.length - 1 : start, 0);
|
|
19039
19039
|
return function() {
|
|
19040
|
-
var args = arguments, index2 = -1, length = nativeMax$
|
|
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
|
}
|
|
@@ -19121,11 +19121,11 @@ var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
|
|
|
19121
19121
|
var Buffer$2 = moduleExports$2 ? root.Buffer : void 0;
|
|
19122
19122
|
var nativeIsBuffer = Buffer$2 ? Buffer$2.isBuffer : void 0;
|
|
19123
19123
|
var isBuffer = nativeIsBuffer || stubFalse;
|
|
19124
|
-
var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$6 = "[object Map]", numberTag$
|
|
19124
|
+
var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$6 = "[object Map]", numberTag$4 = "[object Number]", objectTag$4 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$6 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]";
|
|
19125
19125
|
var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
|
|
19126
19126
|
var typedArrayTags = {};
|
|
19127
19127
|
typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
|
|
19128
|
-
typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$6] = typedArrayTags[numberTag$
|
|
19128
|
+
typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$6] = typedArrayTags[numberTag$4] = typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$6] = typedArrayTags[stringTag$3] = typedArrayTags[weakMapTag$2] = false;
|
|
19129
19129
|
function baseIsTypedArray(value) {
|
|
19130
19130
|
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
19131
19131
|
}
|
|
@@ -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(
|
|
19348
|
-
var 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) {
|
|
@@ -19684,7 +19684,7 @@ function cloneTypedArray(typedArray, isDeep) {
|
|
|
19684
19684
|
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
19685
19685
|
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
19686
19686
|
}
|
|
19687
|
-
var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$4 = "[object Map]", numberTag$
|
|
19687
|
+
var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$4 = "[object Map]", numberTag$3 = "[object Number]", regexpTag$2 = "[object RegExp]", setTag$4 = "[object Set]", stringTag$2 = "[object String]", symbolTag$2 = "[object Symbol]";
|
|
19688
19688
|
var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
|
|
19689
19689
|
function initCloneByTag(object4, tag, isDeep) {
|
|
19690
19690
|
var Ctor = object4.constructor;
|
|
@@ -19708,7 +19708,7 @@ function initCloneByTag(object4, tag, isDeep) {
|
|
|
19708
19708
|
return cloneTypedArray(object4, isDeep);
|
|
19709
19709
|
case mapTag$4:
|
|
19710
19710
|
return new Ctor();
|
|
19711
|
-
case numberTag$
|
|
19711
|
+
case numberTag$3:
|
|
19712
19712
|
case stringTag$2:
|
|
19713
19713
|
return new Ctor(object4);
|
|
19714
19714
|
case regexpTag$2:
|
|
@@ -19735,10 +19735,10 @@ function baseIsSet(value) {
|
|
|
19735
19735
|
var nodeIsSet = nodeUtil && nodeUtil.isSet;
|
|
19736
19736
|
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
|
|
19737
19737
|
var CLONE_DEEP_FLAG$2 = 1, CLONE_FLAT_FLAG$1 = 2, CLONE_SYMBOLS_FLAG$2 = 4;
|
|
19738
|
-
var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$2 = "[object Map]", numberTag$
|
|
19738
|
+
var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$2 = "[object Map]", numberTag$2 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]";
|
|
19739
19739
|
var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
|
|
19740
19740
|
var cloneableTags = {};
|
|
19741
|
-
cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$2] = cloneableTags[numberTag$
|
|
19741
|
+
cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$2] = cloneableTags[numberTag$2] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$2] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
19742
19742
|
cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
|
|
19743
19743
|
function baseClone(value, bitmask, customizer, key, object4, stack) {
|
|
19744
19744
|
var result, isDeep = bitmask & CLONE_DEEP_FLAG$2, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$2;
|
|
@@ -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(
|
|
19881
|
-
var index2 = -1, result = Array(
|
|
19882
|
-
|
|
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;
|
|
@@ -19892,7 +19892,7 @@ function setToArray(set2) {
|
|
|
19892
19892
|
return result;
|
|
19893
19893
|
}
|
|
19894
19894
|
var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2;
|
|
19895
|
-
var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag$1 = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag$1 = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
|
|
19895
|
+
var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag$1 = "[object Map]", numberTag$1 = "[object Number]", regexpTag = "[object RegExp]", setTag$1 = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
|
|
19896
19896
|
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
|
|
19897
19897
|
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
19898
19898
|
function equalByTag(object4, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
@@ -19910,7 +19910,7 @@ function equalByTag(object4, other, tag, bitmask, customizer, equalFunc, stack)
|
|
|
19910
19910
|
return true;
|
|
19911
19911
|
case boolTag:
|
|
19912
19912
|
case dateTag:
|
|
19913
|
-
case numberTag:
|
|
19913
|
+
case numberTag$1:
|
|
19914
19914
|
return eq(+object4, +other);
|
|
19915
19915
|
case errorTag:
|
|
19916
19916
|
return object4.name == other.name && object4.message == other.message;
|
|
@@ -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
|
|
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
|
|
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) {
|
|
@@ -20430,6 +20416,10 @@ function isEmpty(value) {
|
|
|
20430
20416
|
function isEqual(value, other) {
|
|
20431
20417
|
return baseIsEqual(value, other);
|
|
20432
20418
|
}
|
|
20419
|
+
var numberTag = "[object Number]";
|
|
20420
|
+
function isNumber(value) {
|
|
20421
|
+
return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
|
|
20422
|
+
}
|
|
20433
20423
|
function isNil(value) {
|
|
20434
20424
|
return value == null;
|
|
20435
20425
|
}
|
|
@@ -20502,18 +20492,6 @@ function basePickBy(object4, paths, predicate) {
|
|
|
20502
20492
|
}
|
|
20503
20493
|
return result;
|
|
20504
20494
|
}
|
|
20505
|
-
function pickBy(object4, predicate) {
|
|
20506
|
-
if (object4 == null) {
|
|
20507
|
-
return {};
|
|
20508
|
-
}
|
|
20509
|
-
var props = arrayMap(getAllKeysIn(object4), function(prop) {
|
|
20510
|
-
return [prop];
|
|
20511
|
-
});
|
|
20512
|
-
predicate = baseIteratee(predicate);
|
|
20513
|
-
return basePickBy(object4, props, function(value, path2) {
|
|
20514
|
-
return predicate(value, path2[0]);
|
|
20515
|
-
});
|
|
20516
|
-
}
|
|
20517
20495
|
function basePick(object4, paths) {
|
|
20518
20496
|
return basePickBy(object4, paths, function(value, path2) {
|
|
20519
20497
|
return hasIn(object4, path2);
|
|
@@ -20525,23 +20503,6 @@ var pick = flatRest(function(object4, paths) {
|
|
|
20525
20503
|
function set(object4, path2, value) {
|
|
20526
20504
|
return object4 == null ? object4 : baseSet(object4, path2, value);
|
|
20527
20505
|
}
|
|
20528
|
-
var nativeMax = Math.max;
|
|
20529
|
-
function unzip(array4) {
|
|
20530
|
-
if (!(array4 && array4.length)) {
|
|
20531
|
-
return [];
|
|
20532
|
-
}
|
|
20533
|
-
var length = 0;
|
|
20534
|
-
array4 = arrayFilter(array4, function(group) {
|
|
20535
|
-
if (isArrayLikeObject(group)) {
|
|
20536
|
-
length = nativeMax(group.length, length);
|
|
20537
|
-
return true;
|
|
20538
|
-
}
|
|
20539
|
-
});
|
|
20540
|
-
return baseTimes(length, function(index2) {
|
|
20541
|
-
return arrayMap(array4, baseProperty(index2));
|
|
20542
|
-
});
|
|
20543
|
-
}
|
|
20544
|
-
var zip = baseRest(unzip);
|
|
20545
20506
|
function fallbackUUID() {
|
|
20546
20507
|
const bytes = new Uint8Array(16);
|
|
20547
20508
|
crypto?.getRandomValues?.(bytes);
|
|
@@ -20594,13 +20555,35 @@ function safeParseJson(data, fallback = null, validator2) {
|
|
|
20594
20555
|
}
|
|
20595
20556
|
function generateValuePath(fieldLink, subFieldKey) {
|
|
20596
20557
|
if (subFieldKey) {
|
|
20597
|
-
const connector = subFieldKey.includes(":") ? "" : "[n]";
|
|
20558
|
+
const connector = subFieldKey.includes(":") ? "[n_y][n_x]" : "[n]";
|
|
20598
20559
|
return `$.${subFieldKey}${connector}.${fieldLink}`;
|
|
20599
20560
|
} else {
|
|
20600
20561
|
return `$.${fieldLink}`;
|
|
20601
20562
|
}
|
|
20602
20563
|
}
|
|
20603
|
-
function
|
|
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
|
+
}
|
|
20569
|
+
function replacePathIndexPlaceholders(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
|
+
}
|
|
20580
|
+
let path2 = templatePath;
|
|
20581
|
+
path2 = replacePathIndexPlaceholder(y2, path2, "n_y");
|
|
20582
|
+
path2 = replacePathIndexPlaceholder(x2, path2, "n_x");
|
|
20583
|
+
path2 = replacePathIndexPlaceholder(n ?? x2, path2, "n");
|
|
20584
|
+
return path2;
|
|
20585
|
+
}
|
|
20586
|
+
function replacePathIndexPlaceholder(refPath, templatePath, placeholder = "n") {
|
|
20604
20587
|
let index2;
|
|
20605
20588
|
if (refPath === void 0) {
|
|
20606
20589
|
return templatePath;
|
|
@@ -20609,32 +20592,63 @@ function replacePathIndexPlaceholder(refPath, templatePath) {
|
|
|
20609
20592
|
index2 = refPath.toString();
|
|
20610
20593
|
} else {
|
|
20611
20594
|
const indexMatch = refPath.match(/\[(\d+)\]/);
|
|
20612
|
-
index2 = indexMatch ? indexMatch[1] :
|
|
20595
|
+
index2 = indexMatch ? indexMatch[1] : placeholder;
|
|
20613
20596
|
}
|
|
20614
|
-
return templatePath.
|
|
20597
|
+
return templatePath.replaceAll(`[${placeholder}]`, `[${index2}]`);
|
|
20615
20598
|
}
|
|
20616
|
-
function
|
|
20617
|
-
if (!
|
|
20618
|
-
const index2 = str.lastIndexOf(separator);
|
|
20619
|
-
return index2 === -1 ? str : str.slice(index2 + 1);
|
|
20620
|
-
}
|
|
20621
|
-
function parseLinkFieldExpression(str) {
|
|
20622
|
-
if (!str) {
|
|
20599
|
+
function parseValuePath(valuePath) {
|
|
20600
|
+
if (!valuePath) {
|
|
20623
20601
|
return {
|
|
20624
|
-
|
|
20625
|
-
|
|
20626
|
-
|
|
20602
|
+
raw: "",
|
|
20603
|
+
normalized: "",
|
|
20604
|
+
fieldKey: "",
|
|
20605
|
+
fieldPath: "",
|
|
20606
|
+
isRoot: false,
|
|
20607
|
+
isSubTable: false,
|
|
20608
|
+
isLink: false,
|
|
20609
|
+
hasIndex: false,
|
|
20610
|
+
segments: []
|
|
20611
|
+
};
|
|
20612
|
+
}
|
|
20613
|
+
const normalized = valuePath.replace(/^\$\./, "");
|
|
20614
|
+
const segments = normalized.split(".").filter(Boolean);
|
|
20615
|
+
const only = segments[0] || "";
|
|
20616
|
+
const parentRaw = segments.length > 1 ? only : only.includes(":") ? only : "";
|
|
20617
|
+
const fieldKey = segments.length > 1 ? segments.at(-1) || "" : only.includes(":") ? "" : only;
|
|
20618
|
+
const hasIndex = /\[[^\]]+\]/.test(valuePath);
|
|
20619
|
+
const isLink = parentRaw.includes(":");
|
|
20620
|
+
let parentFieldKey = "";
|
|
20621
|
+
let linkFieldKey = "";
|
|
20622
|
+
if (isLink) {
|
|
20623
|
+
const colonIdx = parentRaw.indexOf(":");
|
|
20624
|
+
const subFieldKey = colonIdx >= 0 ? parentRaw.slice(0, colonIdx) : parentRaw;
|
|
20625
|
+
const linkKey = colonIdx >= 0 ? parentRaw.slice(colonIdx + 1) : "";
|
|
20626
|
+
parentFieldKey = (subFieldKey || "").replace(/\[[^\]]*\]/g, "");
|
|
20627
|
+
linkFieldKey = (linkKey || "").replace(/\[[^\]]*\]/g, "");
|
|
20628
|
+
} else {
|
|
20629
|
+
parentFieldKey = parentRaw.replace(/\[.*?\]/g, "");
|
|
20627
20630
|
}
|
|
20628
|
-
const normalized = str.replace(/^\$\./, "");
|
|
20629
|
-
const [subFieldKey = "", linkFieldKey = ""] = normalized.split(":");
|
|
20630
20631
|
return {
|
|
20631
|
-
|
|
20632
|
-
|
|
20632
|
+
raw: valuePath,
|
|
20633
|
+
normalized,
|
|
20634
|
+
fieldKey,
|
|
20635
|
+
fieldPath: fieldKey ? `$.${fieldKey}` : "",
|
|
20636
|
+
parentFieldKey,
|
|
20637
|
+
parentFieldPath: parentFieldKey ? `$.${parentFieldKey}` : "",
|
|
20638
|
+
isRoot: segments.length === 1,
|
|
20639
|
+
isSubTable: segments.length > 1,
|
|
20640
|
+
isLink,
|
|
20641
|
+
linkFieldKey,
|
|
20642
|
+
linkFieldPath: linkFieldKey ? `$.${linkFieldKey}` : "",
|
|
20643
|
+
hasIndex,
|
|
20644
|
+
segments
|
|
20633
20645
|
};
|
|
20634
20646
|
}
|
|
20635
20647
|
function getBeforeBracket(str) {
|
|
20636
|
-
const reg = /\$\.[a-
|
|
20637
|
-
|
|
20648
|
+
const reg = /\$\.[a-z0-9_$:]+(?:\[[^\]]+\])+/i;
|
|
20649
|
+
const m = str.match(reg)?.[0];
|
|
20650
|
+
if (m) return m;
|
|
20651
|
+
return str.match(/\$\.[a-z_]+\[[^\]]+\]/i)?.[0] || "";
|
|
20638
20652
|
}
|
|
20639
20653
|
function createRafOnce() {
|
|
20640
20654
|
let rafId = null;
|
|
@@ -20671,10 +20685,10 @@ function createRafOnce() {
|
|
|
20671
20685
|
return { schedule, syncSchedule, cancel };
|
|
20672
20686
|
}
|
|
20673
20687
|
function listToTree(list, transform = (n) => n) {
|
|
20674
|
-
const
|
|
20688
|
+
const map = /* @__PURE__ */ new Map();
|
|
20675
20689
|
const roots = [];
|
|
20676
20690
|
list.forEach((item) => {
|
|
20677
|
-
|
|
20691
|
+
map.set(item.value, item);
|
|
20678
20692
|
item.children = [];
|
|
20679
20693
|
});
|
|
20680
20694
|
list.forEach((node) => {
|
|
@@ -20682,7 +20696,7 @@ function listToTree(list, transform = (n) => n) {
|
|
|
20682
20696
|
if (!parentId || parentId === "ROOT") {
|
|
20683
20697
|
roots.push(transform(node));
|
|
20684
20698
|
} else {
|
|
20685
|
-
const parent2 =
|
|
20699
|
+
const parent2 = map.get(parentId);
|
|
20686
20700
|
parent2?.children?.push(transform(node));
|
|
20687
20701
|
}
|
|
20688
20702
|
});
|
|
@@ -22626,16 +22640,7 @@ const TABLE_CELL_TEMPLATE = {
|
|
|
22626
22640
|
}
|
|
22627
22641
|
]
|
|
22628
22642
|
};
|
|
22629
|
-
const WTC_REF_KEYS = [
|
|
22630
|
-
"mergeId",
|
|
22631
|
-
"repeatingId",
|
|
22632
|
-
"_2DTableId",
|
|
22633
|
-
"boundedId",
|
|
22634
|
-
"boundedItemId",
|
|
22635
|
-
"checkTableId",
|
|
22636
|
-
"dataGroup2DId",
|
|
22637
|
-
"headerId"
|
|
22638
|
-
];
|
|
22643
|
+
const WTC_REF_KEYS = ["mergeId", "subTable", "subTableItem", "header"];
|
|
22639
22644
|
class Wtc extends ModelGroup {
|
|
22640
22645
|
name = "w:tc";
|
|
22641
22646
|
type = "element";
|
|
@@ -22652,19 +22657,12 @@ class Wtc extends ModelGroup {
|
|
|
22652
22657
|
// 被合并单元格指向源头单元格的 ID
|
|
22653
22658
|
mergeId;
|
|
22654
22659
|
// 属于哪个合并区域的 ID(所有属于同一合并区域的单元格都有相同值)
|
|
22655
|
-
|
|
22656
|
-
|
|
22657
|
-
|
|
22658
|
-
|
|
22659
|
-
|
|
22660
|
-
|
|
22661
|
-
boundedItemId;
|
|
22662
|
-
// 有界区域内的项目 ID
|
|
22663
|
-
checkTableId;
|
|
22664
|
-
// 属于哪个检验表的 ID
|
|
22665
|
-
dataGroup2DId;
|
|
22666
|
-
// 属于哪个数据关联项目 ID
|
|
22667
|
-
headerId;
|
|
22660
|
+
/** 子表主体(动态表 / 固定表 / 二维表 / 检验表) */
|
|
22661
|
+
subTable;
|
|
22662
|
+
/** 子表内数据分组或数据关联 */
|
|
22663
|
+
subTableItem;
|
|
22664
|
+
/** 表头 / 子表表头 */
|
|
22665
|
+
header;
|
|
22668
22666
|
vMergeType;
|
|
22669
22667
|
// 临时字段,用于 fromXmlJson 时追踪垂直合并
|
|
22670
22668
|
tempMergeId;
|
|
@@ -22677,13 +22675,9 @@ class Wtc extends ModelGroup {
|
|
|
22677
22675
|
this.mergeId = options.mergeId;
|
|
22678
22676
|
this.mergeFromId = options.mergeFromId;
|
|
22679
22677
|
this.vMergeType = options.vMergeType;
|
|
22680
|
-
this.
|
|
22681
|
-
this.
|
|
22682
|
-
this.
|
|
22683
|
-
this.boundedItemId = options.boundedItemId;
|
|
22684
|
-
this.checkTableId = options.checkTableId;
|
|
22685
|
-
this.dataGroup2DId = options.dataGroup2DId;
|
|
22686
|
-
this.headerId = options.headerId;
|
|
22678
|
+
this.subTable = options.subTable;
|
|
22679
|
+
this.subTableItem = options.subTableItem;
|
|
22680
|
+
this.header = options.header;
|
|
22687
22681
|
this.backgroundColor = options.backgroundColor;
|
|
22688
22682
|
this.tempMergeId = options.tempMergeId;
|
|
22689
22683
|
}
|
|
@@ -22760,6 +22754,36 @@ class Wtc extends ModelGroup {
|
|
|
22760
22754
|
});
|
|
22761
22755
|
return result;
|
|
22762
22756
|
}
|
|
22757
|
+
setSubTable(type4, regionId) {
|
|
22758
|
+
this.subTable = { type: type4, regionId };
|
|
22759
|
+
}
|
|
22760
|
+
clearSubTable() {
|
|
22761
|
+
this.subTable = void 0;
|
|
22762
|
+
}
|
|
22763
|
+
setSubTableItem(type4, regionId) {
|
|
22764
|
+
this.subTableItem = { type: type4, regionId };
|
|
22765
|
+
}
|
|
22766
|
+
clearSubTableItem() {
|
|
22767
|
+
this.subTableItem = void 0;
|
|
22768
|
+
}
|
|
22769
|
+
setHeaderRef(type4, regionId) {
|
|
22770
|
+
this.header = { type: type4, regionId };
|
|
22771
|
+
}
|
|
22772
|
+
clearHeaderRef() {
|
|
22773
|
+
this.header = void 0;
|
|
22774
|
+
}
|
|
22775
|
+
/** 按 regionId 清除单元格上的子表 / 表头引用 */
|
|
22776
|
+
clearRegionRef(regionId) {
|
|
22777
|
+
if (this.subTable?.regionId === regionId) {
|
|
22778
|
+
this.subTable = void 0;
|
|
22779
|
+
}
|
|
22780
|
+
if (this.subTableItem?.regionId === regionId) {
|
|
22781
|
+
this.subTableItem = void 0;
|
|
22782
|
+
}
|
|
22783
|
+
if (this.header?.regionId === regionId) {
|
|
22784
|
+
this.header = void 0;
|
|
22785
|
+
}
|
|
22786
|
+
}
|
|
22763
22787
|
/**
|
|
22764
22788
|
* 查找当前单元格对应的区域
|
|
22765
22789
|
* @returns
|
|
@@ -23457,9 +23481,6 @@ class Region {
|
|
|
23457
23481
|
}
|
|
23458
23482
|
/**
|
|
23459
23483
|
* 检查指定的行列位置是否在当前区域内
|
|
23460
|
-
* @param row 行号
|
|
23461
|
-
* @param col 列号
|
|
23462
|
-
* @returns 是否在区域内
|
|
23463
23484
|
*/
|
|
23464
23485
|
contains(row, col) {
|
|
23465
23486
|
return row >= this.start.row && row <= this.end.row && col >= this.start.col && col <= this.end.col;
|
|
@@ -23479,84 +23500,104 @@ class Region {
|
|
|
23479
23500
|
};
|
|
23480
23501
|
}
|
|
23481
23502
|
}
|
|
23482
|
-
class
|
|
23483
|
-
type = "
|
|
23484
|
-
name;
|
|
23485
|
-
valuePath;
|
|
23486
|
-
widgetMeta;
|
|
23503
|
+
class TableHeaderRegion extends Region {
|
|
23504
|
+
type = "table-header";
|
|
23505
|
+
name = "";
|
|
23487
23506
|
constructor(options) {
|
|
23488
23507
|
super(options);
|
|
23489
|
-
this.valuePath = options.valuePath;
|
|
23490
23508
|
this.name = options.name;
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
23494
|
-
|
|
23509
|
+
}
|
|
23510
|
+
toJSON() {
|
|
23511
|
+
return {
|
|
23512
|
+
...super.toJSON(),
|
|
23513
|
+
name: this.name
|
|
23495
23514
|
};
|
|
23496
23515
|
}
|
|
23497
|
-
|
|
23498
|
-
|
|
23499
|
-
|
|
23516
|
+
static fromJSON(json, table) {
|
|
23517
|
+
return new TableHeaderRegion({
|
|
23518
|
+
table,
|
|
23519
|
+
id: json.id,
|
|
23520
|
+
start: json.start,
|
|
23521
|
+
end: json.end,
|
|
23522
|
+
name: json.name
|
|
23523
|
+
});
|
|
23524
|
+
}
|
|
23525
|
+
}
|
|
23526
|
+
class SubTableHeaderRegion extends Region {
|
|
23527
|
+
type = "sub-table-header";
|
|
23528
|
+
name = "";
|
|
23529
|
+
subTableId;
|
|
23530
|
+
constructor(options) {
|
|
23531
|
+
super(options);
|
|
23532
|
+
this.name = options.name;
|
|
23533
|
+
this.subTableId = options.subTableId;
|
|
23534
|
+
}
|
|
23500
23535
|
toJSON() {
|
|
23501
23536
|
return {
|
|
23502
23537
|
...super.toJSON(),
|
|
23503
23538
|
name: this.name,
|
|
23504
|
-
|
|
23505
|
-
widgetMeta: this.widgetMeta
|
|
23539
|
+
subTableId: this.subTableId
|
|
23506
23540
|
};
|
|
23507
23541
|
}
|
|
23508
|
-
/**
|
|
23509
|
-
* 从 JSON 对象还原
|
|
23510
|
-
*/
|
|
23511
23542
|
static fromJSON(json, table) {
|
|
23512
|
-
|
|
23543
|
+
return new SubTableHeaderRegion({
|
|
23513
23544
|
table,
|
|
23514
23545
|
id: json.id,
|
|
23515
23546
|
start: json.start,
|
|
23516
23547
|
end: json.end,
|
|
23517
23548
|
name: json.name,
|
|
23518
|
-
|
|
23519
|
-
widgetMeta: json.widgetMeta
|
|
23549
|
+
subTableId: json.subTableId
|
|
23520
23550
|
});
|
|
23521
|
-
return region;
|
|
23522
23551
|
}
|
|
23523
23552
|
}
|
|
23524
|
-
|
|
23525
|
-
|
|
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
|
+
}
|
|
23564
|
+
class RepeatingRegion extends Region {
|
|
23565
|
+
type = "repeating";
|
|
23526
23566
|
name;
|
|
23527
23567
|
valuePath;
|
|
23528
23568
|
widgetMeta;
|
|
23529
|
-
itemRegion;
|
|
23530
23569
|
constructor(options) {
|
|
23531
23570
|
super(options);
|
|
23532
|
-
this.name = options.name;
|
|
23533
23571
|
this.valuePath = options.valuePath;
|
|
23572
|
+
this.name = options.name;
|
|
23534
23573
|
this.widgetMeta = options.widgetMeta || {
|
|
23535
23574
|
props: {
|
|
23536
|
-
|
|
23537
|
-
refColField: void 0,
|
|
23538
|
-
refRowField: void 0
|
|
23575
|
+
quickFill: false
|
|
23539
23576
|
}
|
|
23540
23577
|
};
|
|
23541
|
-
this.itemRegion = options.itemRegion;
|
|
23542
23578
|
}
|
|
23543
|
-
|
|
23544
|
-
|
|
23545
|
-
|
|
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
|
+
}
|
|
23546
23591
|
toJSON() {
|
|
23547
23592
|
return {
|
|
23548
23593
|
...super.toJSON(),
|
|
23549
23594
|
name: this.name,
|
|
23550
23595
|
valuePath: this.valuePath,
|
|
23551
|
-
widgetMeta: this.widgetMeta
|
|
23552
|
-
itemRegion: this.itemRegion ? this.itemRegion.toJSON() : void 0
|
|
23596
|
+
widgetMeta: this.widgetMeta
|
|
23553
23597
|
};
|
|
23554
23598
|
}
|
|
23555
|
-
/**
|
|
23556
|
-
* 从 JSON 对象还原
|
|
23557
|
-
*/
|
|
23558
23599
|
static fromJSON(json, table) {
|
|
23559
|
-
|
|
23600
|
+
return new RepeatingRegion({
|
|
23560
23601
|
table,
|
|
23561
23602
|
id: json.id,
|
|
23562
23603
|
start: json.start,
|
|
@@ -23565,52 +23606,10 @@ class CheckTableRegion extends Region {
|
|
|
23565
23606
|
valuePath: json.valuePath,
|
|
23566
23607
|
widgetMeta: json.widgetMeta
|
|
23567
23608
|
});
|
|
23568
|
-
if (json.itemRegion) {
|
|
23569
|
-
region.itemRegion = new DataGroup2DRegion({
|
|
23570
|
-
table,
|
|
23571
|
-
start: json.itemRegion?.start,
|
|
23572
|
-
end: json.itemRegion?.end,
|
|
23573
|
-
parent: region
|
|
23574
|
-
});
|
|
23575
|
-
}
|
|
23576
|
-
return region;
|
|
23577
|
-
}
|
|
23578
|
-
setItemRegion(options) {
|
|
23579
|
-
const region = new DataGroup2DRegion({
|
|
23580
|
-
table: this.table,
|
|
23581
|
-
parent: this,
|
|
23582
|
-
...options
|
|
23583
|
-
});
|
|
23584
|
-
this.itemRegion = region;
|
|
23585
|
-
this.table.forEachCell({
|
|
23586
|
-
startRowIdx: options.start.row,
|
|
23587
|
-
startColIdx: options.start.col,
|
|
23588
|
-
endRowIdx: options.end.row,
|
|
23589
|
-
endColIdx: options.end.col,
|
|
23590
|
-
callback: (cell) => {
|
|
23591
|
-
cell.dataGroup2DId = region.id;
|
|
23592
|
-
}
|
|
23593
|
-
});
|
|
23594
|
-
return region;
|
|
23595
|
-
}
|
|
23596
|
-
removeItemRegion() {
|
|
23597
|
-
if (this.itemRegion) {
|
|
23598
|
-
this.table.forEachCell({
|
|
23599
|
-
startRowIdx: this.itemRegion.start.row,
|
|
23600
|
-
startColIdx: this.itemRegion.start.col,
|
|
23601
|
-
endRowIdx: this.itemRegion.end.row,
|
|
23602
|
-
endColIdx: this.itemRegion.end.col,
|
|
23603
|
-
callback: (cell) => {
|
|
23604
|
-
cell.clearFieldRuns();
|
|
23605
|
-
cell.dataGroup2DId = void 0;
|
|
23606
|
-
}
|
|
23607
|
-
});
|
|
23608
|
-
}
|
|
23609
|
-
this.itemRegion = void 0;
|
|
23610
23609
|
}
|
|
23611
23610
|
}
|
|
23612
|
-
class
|
|
23613
|
-
type = "
|
|
23611
|
+
class BoundedItemRegion extends Region {
|
|
23612
|
+
type = "boundedItem";
|
|
23614
23613
|
parent;
|
|
23615
23614
|
constructor(options) {
|
|
23616
23615
|
super(options);
|
|
@@ -23618,12 +23617,47 @@ class DataGroup2DRegion extends Region {
|
|
|
23618
23617
|
this.parent = options.parent;
|
|
23619
23618
|
}
|
|
23620
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
|
+
}
|
|
23621
23632
|
remove() {
|
|
23622
23633
|
this.parent.removeItemRegion();
|
|
23623
23634
|
}
|
|
23624
23635
|
}
|
|
23625
|
-
|
|
23626
|
-
|
|
23636
|
+
function markSubTableItemCells(table, bounds, itemType, regionId) {
|
|
23637
|
+
table.forEachCell({
|
|
23638
|
+
startRowIdx: bounds.start.row,
|
|
23639
|
+
startColIdx: bounds.start.col,
|
|
23640
|
+
endRowIdx: bounds.end.row,
|
|
23641
|
+
endColIdx: bounds.end.col,
|
|
23642
|
+
callback: (cell) => {
|
|
23643
|
+
cell.setSubTableItem(itemType, regionId);
|
|
23644
|
+
}
|
|
23645
|
+
});
|
|
23646
|
+
}
|
|
23647
|
+
function clearSubTableItemCells(table, itemRegion) {
|
|
23648
|
+
table.forEachCell({
|
|
23649
|
+
startRowIdx: itemRegion.start.row,
|
|
23650
|
+
startColIdx: itemRegion.start.col,
|
|
23651
|
+
endRowIdx: itemRegion.end.row,
|
|
23652
|
+
endColIdx: itemRegion.end.col,
|
|
23653
|
+
callback: (cell) => {
|
|
23654
|
+
cell.clearFieldRuns();
|
|
23655
|
+
cell.clearSubTableItem();
|
|
23656
|
+
}
|
|
23657
|
+
});
|
|
23658
|
+
}
|
|
23659
|
+
class BoundedRegion extends Region {
|
|
23660
|
+
type = "bounded";
|
|
23627
23661
|
name;
|
|
23628
23662
|
valuePath;
|
|
23629
23663
|
widgetMeta;
|
|
@@ -23635,15 +23669,23 @@ class _2DTableRegion extends Region {
|
|
|
23635
23669
|
this.widgetMeta = options.widgetMeta || {
|
|
23636
23670
|
props: {
|
|
23637
23671
|
autoFill: true,
|
|
23638
|
-
|
|
23639
|
-
refRowField: void 0
|
|
23672
|
+
fillDirection: "x"
|
|
23640
23673
|
}
|
|
23641
23674
|
};
|
|
23642
23675
|
this.itemRegion = options.itemRegion;
|
|
23643
23676
|
}
|
|
23644
|
-
|
|
23645
|
-
|
|
23646
|
-
|
|
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
|
+
}
|
|
23647
23689
|
toJSON() {
|
|
23648
23690
|
return {
|
|
23649
23691
|
...super.toJSON(),
|
|
@@ -23653,11 +23695,8 @@ class _2DTableRegion extends Region {
|
|
|
23653
23695
|
itemRegion: this.itemRegion ? this.itemRegion.toJSON() : void 0
|
|
23654
23696
|
};
|
|
23655
23697
|
}
|
|
23656
|
-
/**
|
|
23657
|
-
* 从 JSON 对象还原
|
|
23658
|
-
*/
|
|
23659
23698
|
static fromJSON(json, table) {
|
|
23660
|
-
const region = new
|
|
23699
|
+
const region = new BoundedRegion({
|
|
23661
23700
|
table,
|
|
23662
23701
|
id: json.id,
|
|
23663
23702
|
start: json.start,
|
|
@@ -23667,7 +23706,7 @@ class _2DTableRegion extends Region {
|
|
|
23667
23706
|
widgetMeta: json.widgetMeta
|
|
23668
23707
|
});
|
|
23669
23708
|
if (json.itemRegion) {
|
|
23670
|
-
region.itemRegion = new
|
|
23709
|
+
region.itemRegion = new BoundedItemRegion({
|
|
23671
23710
|
table,
|
|
23672
23711
|
start: json.itemRegion?.start,
|
|
23673
23712
|
end: json.itemRegion?.end,
|
|
@@ -23677,41 +23716,24 @@ class _2DTableRegion extends Region {
|
|
|
23677
23716
|
return region;
|
|
23678
23717
|
}
|
|
23679
23718
|
setItemRegion(options) {
|
|
23680
|
-
const region = new
|
|
23719
|
+
const region = new BoundedItemRegion({
|
|
23681
23720
|
table: this.table,
|
|
23682
23721
|
parent: this,
|
|
23683
23722
|
...options
|
|
23684
23723
|
});
|
|
23685
23724
|
this.itemRegion = region;
|
|
23686
|
-
this.table.
|
|
23687
|
-
startRowIdx: options.start.row,
|
|
23688
|
-
startColIdx: options.start.col,
|
|
23689
|
-
endRowIdx: options.end.row,
|
|
23690
|
-
endColIdx: options.end.col,
|
|
23691
|
-
callback: (cell) => {
|
|
23692
|
-
cell.dataGroup2DId = region.id;
|
|
23693
|
-
}
|
|
23694
|
-
});
|
|
23725
|
+
markSubTableItemCells(this.table, options, "bounded-item", region.id);
|
|
23695
23726
|
return region;
|
|
23696
23727
|
}
|
|
23697
23728
|
removeItemRegion() {
|
|
23698
23729
|
if (this.itemRegion) {
|
|
23699
|
-
this.table.
|
|
23700
|
-
startRowIdx: this.itemRegion.start.row,
|
|
23701
|
-
startColIdx: this.itemRegion.start.col,
|
|
23702
|
-
endRowIdx: this.itemRegion.end.row,
|
|
23703
|
-
endColIdx: this.itemRegion.end.col,
|
|
23704
|
-
callback: (cell) => {
|
|
23705
|
-
cell.clearFieldRuns();
|
|
23706
|
-
cell.dataGroup2DId = void 0;
|
|
23707
|
-
}
|
|
23708
|
-
});
|
|
23730
|
+
clearSubTableItemCells(this.table, this.itemRegion);
|
|
23709
23731
|
}
|
|
23710
23732
|
this.itemRegion = void 0;
|
|
23711
23733
|
}
|
|
23712
23734
|
}
|
|
23713
|
-
class
|
|
23714
|
-
type = "
|
|
23735
|
+
class DataGroup2DRegion extends Region {
|
|
23736
|
+
type = "dataGroup2D";
|
|
23715
23737
|
parent;
|
|
23716
23738
|
constructor(options) {
|
|
23717
23739
|
super(options);
|
|
@@ -23719,12 +23741,23 @@ class BoundedItemRegion extends Region {
|
|
|
23719
23741
|
this.parent = options.parent;
|
|
23720
23742
|
}
|
|
23721
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
|
+
}
|
|
23722
23756
|
remove() {
|
|
23723
23757
|
this.parent.removeItemRegion();
|
|
23724
23758
|
}
|
|
23725
23759
|
}
|
|
23726
|
-
class
|
|
23727
|
-
type = "bounded";
|
|
23760
|
+
class LinkSubTableRegion extends Region {
|
|
23728
23761
|
name;
|
|
23729
23762
|
valuePath;
|
|
23730
23763
|
widgetMeta;
|
|
@@ -23736,15 +23769,25 @@ class BoundedRegion extends Region {
|
|
|
23736
23769
|
this.widgetMeta = options.widgetMeta || {
|
|
23737
23770
|
props: {
|
|
23738
23771
|
autoFill: true,
|
|
23739
|
-
|
|
23772
|
+
refColField: void 0,
|
|
23773
|
+
refRowField: void 0
|
|
23740
23774
|
}
|
|
23741
23775
|
};
|
|
23742
23776
|
this.itemRegion = options.itemRegion;
|
|
23743
23777
|
}
|
|
23744
|
-
|
|
23745
|
-
|
|
23746
|
-
|
|
23747
|
-
|
|
23778
|
+
get subFieldKey() {
|
|
23779
|
+
return resolveRegionValuePathKeys(this.valuePath).subFieldKey;
|
|
23780
|
+
}
|
|
23781
|
+
get linkFieldKey() {
|
|
23782
|
+
return resolveRegionValuePathKeys(this.valuePath).linkFieldKey;
|
|
23783
|
+
}
|
|
23784
|
+
get subValuePath() {
|
|
23785
|
+
return resolveRegionValuePathKeys(this.valuePath).subValuePath;
|
|
23786
|
+
}
|
|
23787
|
+
get linkValuePath() {
|
|
23788
|
+
return resolveRegionValuePathKeys(this.valuePath).linkValuePath;
|
|
23789
|
+
}
|
|
23790
|
+
toLinkSubTableJSON() {
|
|
23748
23791
|
return {
|
|
23749
23792
|
...super.toJSON(),
|
|
23750
23793
|
name: this.name,
|
|
@@ -23753,11 +23796,19 @@ class BoundedRegion extends Region {
|
|
|
23753
23796
|
itemRegion: this.itemRegion ? this.itemRegion.toJSON() : void 0
|
|
23754
23797
|
};
|
|
23755
23798
|
}
|
|
23756
|
-
|
|
23757
|
-
|
|
23758
|
-
|
|
23759
|
-
|
|
23760
|
-
|
|
23799
|
+
static restoreItemRegion(region, json, table) {
|
|
23800
|
+
if (json.itemRegion) {
|
|
23801
|
+
region.itemRegion = new DataGroup2DRegion({
|
|
23802
|
+
table,
|
|
23803
|
+
start: json.itemRegion?.start,
|
|
23804
|
+
end: json.itemRegion?.end,
|
|
23805
|
+
parent: region
|
|
23806
|
+
});
|
|
23807
|
+
}
|
|
23808
|
+
}
|
|
23809
|
+
/** 从 JSON 还原关联子表(二维表 / 检验表子类共用) */
|
|
23810
|
+
static fromLinkSubTableJSON(Ctor, json, table) {
|
|
23811
|
+
const region = new Ctor({
|
|
23761
23812
|
table,
|
|
23762
23813
|
id: json.id,
|
|
23763
23814
|
start: json.start,
|
|
@@ -23766,103 +23817,42 @@ class BoundedRegion extends Region {
|
|
|
23766
23817
|
valuePath: json.valuePath,
|
|
23767
23818
|
widgetMeta: json.widgetMeta
|
|
23768
23819
|
});
|
|
23769
|
-
|
|
23770
|
-
region.itemRegion = new BoundedItemRegion({
|
|
23771
|
-
table,
|
|
23772
|
-
start: json.itemRegion?.start,
|
|
23773
|
-
end: json.itemRegion?.end,
|
|
23774
|
-
parent: region
|
|
23775
|
-
});
|
|
23776
|
-
}
|
|
23820
|
+
LinkSubTableRegion.restoreItemRegion(region, json, table);
|
|
23777
23821
|
return region;
|
|
23778
23822
|
}
|
|
23779
23823
|
setItemRegion(options) {
|
|
23780
|
-
const region = new
|
|
23824
|
+
const region = new DataGroup2DRegion({
|
|
23781
23825
|
table: this.table,
|
|
23782
23826
|
parent: this,
|
|
23783
23827
|
...options
|
|
23784
23828
|
});
|
|
23785
23829
|
this.itemRegion = region;
|
|
23786
|
-
this.table.
|
|
23787
|
-
startRowIdx: options.start.row,
|
|
23788
|
-
startColIdx: options.start.col,
|
|
23789
|
-
endRowIdx: options.end.row,
|
|
23790
|
-
endColIdx: options.end.col,
|
|
23791
|
-
callback: (cell) => {
|
|
23792
|
-
cell.boundedItemId = region.id;
|
|
23793
|
-
}
|
|
23794
|
-
});
|
|
23830
|
+
markSubTableItemCells(this.table, options, "data-group-2d", region.id);
|
|
23795
23831
|
return region;
|
|
23796
23832
|
}
|
|
23797
23833
|
removeItemRegion() {
|
|
23798
23834
|
if (this.itemRegion) {
|
|
23799
|
-
this.table.
|
|
23800
|
-
startRowIdx: this.itemRegion.start.row,
|
|
23801
|
-
startColIdx: this.itemRegion.start.col,
|
|
23802
|
-
endRowIdx: this.itemRegion.end.row,
|
|
23803
|
-
endColIdx: this.itemRegion.end.col,
|
|
23804
|
-
callback: (cell) => {
|
|
23805
|
-
cell.clearFieldRuns();
|
|
23806
|
-
cell.boundedItemId = void 0;
|
|
23807
|
-
}
|
|
23808
|
-
});
|
|
23835
|
+
clearSubTableItemCells(this.table, this.itemRegion);
|
|
23809
23836
|
}
|
|
23810
23837
|
this.itemRegion = void 0;
|
|
23811
23838
|
}
|
|
23812
23839
|
}
|
|
23813
|
-
class
|
|
23814
|
-
type = "table
|
|
23815
|
-
name = "";
|
|
23816
|
-
constructor(options) {
|
|
23817
|
-
super(options);
|
|
23818
|
-
this.name = options.name;
|
|
23819
|
-
}
|
|
23840
|
+
class _2DTableRegion extends LinkSubTableRegion {
|
|
23841
|
+
type = "2d-table";
|
|
23820
23842
|
toJSON() {
|
|
23821
|
-
return
|
|
23822
|
-
...super.toJSON(),
|
|
23823
|
-
name: this.name
|
|
23824
|
-
};
|
|
23843
|
+
return this.toLinkSubTableJSON();
|
|
23825
23844
|
}
|
|
23826
23845
|
static fromJSON(json, table) {
|
|
23827
|
-
|
|
23828
|
-
table,
|
|
23829
|
-
id: json.id,
|
|
23830
|
-
start: json.start,
|
|
23831
|
-
end: json.end,
|
|
23832
|
-
name: json.name
|
|
23833
|
-
});
|
|
23834
|
-
return region;
|
|
23846
|
+
return LinkSubTableRegion.fromLinkSubTableJSON(_2DTableRegion, json, table);
|
|
23835
23847
|
}
|
|
23836
23848
|
}
|
|
23837
|
-
class
|
|
23838
|
-
type = "
|
|
23839
|
-
name = "";
|
|
23840
|
-
subTableId;
|
|
23841
|
-
constructor(options) {
|
|
23842
|
-
super(options);
|
|
23843
|
-
this.name = options.name;
|
|
23844
|
-
this.subTableId = options.subTableId;
|
|
23845
|
-
}
|
|
23846
|
-
/**
|
|
23847
|
-
* 序列化为 JSON 对象
|
|
23848
|
-
*/
|
|
23849
|
+
class CheckTableRegion extends LinkSubTableRegion {
|
|
23850
|
+
type = "check-table";
|
|
23849
23851
|
toJSON() {
|
|
23850
|
-
return
|
|
23851
|
-
...super.toJSON(),
|
|
23852
|
-
name: this.name,
|
|
23853
|
-
subTableId: this.subTableId
|
|
23854
|
-
};
|
|
23852
|
+
return this.toLinkSubTableJSON();
|
|
23855
23853
|
}
|
|
23856
23854
|
static fromJSON(json, table) {
|
|
23857
|
-
|
|
23858
|
-
table,
|
|
23859
|
-
id: json.id,
|
|
23860
|
-
start: json.start,
|
|
23861
|
-
end: json.end,
|
|
23862
|
-
name: json.name,
|
|
23863
|
-
subTableId: json.subTableId
|
|
23864
|
-
});
|
|
23865
|
-
return region;
|
|
23855
|
+
return LinkSubTableRegion.fromLinkSubTableJSON(CheckTableRegion, json, table);
|
|
23866
23856
|
}
|
|
23867
23857
|
}
|
|
23868
23858
|
const TABLE_TEMPLATE = {
|
|
@@ -24269,7 +24259,7 @@ class WtblRowColumnOps {
|
|
|
24269
24259
|
WTC_REF_KEYS.forEach((key) => {
|
|
24270
24260
|
const refValue = refCell[key];
|
|
24271
24261
|
if (!refValue) return;
|
|
24272
|
-
if (nextRefCell && nextRefCell[key] !== refValue) return;
|
|
24262
|
+
if (nextRefCell && JSON.stringify(nextRefCell[key]) !== JSON.stringify(refValue)) return;
|
|
24273
24263
|
newCell[key] = refValue;
|
|
24274
24264
|
});
|
|
24275
24265
|
}
|
|
@@ -24531,27 +24521,25 @@ class WtblCellIterator {
|
|
|
24531
24521
|
}
|
|
24532
24522
|
class WtblRegionManager {
|
|
24533
24523
|
/**
|
|
24534
|
-
*
|
|
24524
|
+
* 按 id 查找 region
|
|
24535
24525
|
*/
|
|
24536
24526
|
static findRegionById(table, regionId) {
|
|
24537
24527
|
return table.regions.find((r) => r.id === regionId);
|
|
24538
24528
|
}
|
|
24539
|
-
|
|
24540
|
-
|
|
24541
|
-
|
|
24542
|
-
|
|
24543
|
-
|
|
24544
|
-
return crossRegion;
|
|
24529
|
+
/**
|
|
24530
|
+
* 查找与给定矩形范围相交的第一个 region(含边界接触)
|
|
24531
|
+
*/
|
|
24532
|
+
static findCrossRegion(table, bounds) {
|
|
24533
|
+
return table.regions.find((r) => this.regionsIntersect(r, bounds));
|
|
24545
24534
|
}
|
|
24546
|
-
|
|
24547
|
-
|
|
24548
|
-
|
|
24549
|
-
|
|
24550
|
-
|
|
24551
|
-
return crossRegions;
|
|
24535
|
+
/**
|
|
24536
|
+
* 查找与给定矩形范围相交的全部 region
|
|
24537
|
+
*/
|
|
24538
|
+
static findCrossRegions(table, bounds) {
|
|
24539
|
+
return table.regions.filter((r) => this.regionsIntersect(r, bounds));
|
|
24552
24540
|
}
|
|
24553
24541
|
/**
|
|
24554
|
-
*
|
|
24542
|
+
* 按 id 删除 region,并清除其覆盖范围内单元格上的关联标记
|
|
24555
24543
|
*/
|
|
24556
24544
|
static deleteRegionById(table, regionId) {
|
|
24557
24545
|
const regionIndex = table.regions.findIndex((r) => r.id === regionId);
|
|
@@ -24559,154 +24547,192 @@ class WtblRegionManager {
|
|
|
24559
24547
|
const region = table.regions[regionIndex];
|
|
24560
24548
|
if (!region) return;
|
|
24561
24549
|
table.regions.splice(regionIndex, 1);
|
|
24562
|
-
|
|
24563
|
-
|
|
24564
|
-
const is2DTable = regionType === "2d-table";
|
|
24565
|
-
const isBounded = regionType === "bounded";
|
|
24566
|
-
const isCheckTable = regionType === "check-table";
|
|
24567
|
-
const isThead = ["table-header", "sub-table-header"].includes(regionType);
|
|
24568
|
-
WtblCellIterator.forEachCell(table, {
|
|
24569
|
-
startRowIdx: start.row,
|
|
24570
|
-
startColIdx: start.col,
|
|
24571
|
-
endRowIdx: end.row,
|
|
24572
|
-
endColIdx: end.col,
|
|
24573
|
-
callback: (cell) => {
|
|
24574
|
-
if (isRepeating) {
|
|
24575
|
-
cell.clearFieldRuns();
|
|
24576
|
-
cell.repeatingId = void 0;
|
|
24577
|
-
cell.dataGroup2DId = void 0;
|
|
24578
|
-
} else if (is2DTable) {
|
|
24579
|
-
cell.clearFieldRuns();
|
|
24580
|
-
cell._2DTableId = void 0;
|
|
24581
|
-
cell.dataGroup2DId = void 0;
|
|
24582
|
-
} else if (isBounded) {
|
|
24583
|
-
cell.clearFieldRuns();
|
|
24584
|
-
cell.boundedId = void 0;
|
|
24585
|
-
cell.boundedItemId = void 0;
|
|
24586
|
-
} else if (isCheckTable) {
|
|
24587
|
-
cell.clearFieldRuns();
|
|
24588
|
-
cell.checkTableId = void 0;
|
|
24589
|
-
cell.dataGroup2DId = void 0;
|
|
24590
|
-
} else if (isThead) {
|
|
24591
|
-
cell.headerId = void 0;
|
|
24592
|
-
}
|
|
24593
|
-
}
|
|
24550
|
+
this.forEachCellInRegion(table, region, (cell) => {
|
|
24551
|
+
this.clearCellRegionMarks(cell, region);
|
|
24594
24552
|
});
|
|
24595
24553
|
}
|
|
24596
24554
|
/**
|
|
24597
|
-
*
|
|
24555
|
+
* 设置重复区域(子表体)
|
|
24598
24556
|
*/
|
|
24599
24557
|
static setRepeating(table, options) {
|
|
24600
|
-
const region = new RepeatingRegion({
|
|
24601
|
-
|
|
24602
|
-
|
|
24603
|
-
});
|
|
24604
|
-
table.regions.push(region);
|
|
24605
|
-
WtblCellIterator.forEachCell(table, {
|
|
24606
|
-
startRowIdx: options.start.row,
|
|
24607
|
-
startColIdx: options.start.col,
|
|
24608
|
-
endRowIdx: options.end.row,
|
|
24609
|
-
endColIdx: options.end.col,
|
|
24610
|
-
callback: (cell) => {
|
|
24611
|
-
cell.repeatingId = region.id;
|
|
24612
|
-
}
|
|
24558
|
+
const region = new RepeatingRegion({ ...options, table });
|
|
24559
|
+
return this.registerRegion(table, region, options, (cell) => {
|
|
24560
|
+
cell.setSubTable("repeating", region.id);
|
|
24613
24561
|
});
|
|
24614
|
-
return region;
|
|
24615
24562
|
}
|
|
24616
24563
|
/**
|
|
24617
|
-
*
|
|
24564
|
+
* 设置二维表区域
|
|
24618
24565
|
*/
|
|
24619
24566
|
static set2DTable(table, options) {
|
|
24620
|
-
const region = new _2DTableRegion({
|
|
24621
|
-
|
|
24622
|
-
table
|
|
24567
|
+
const region = new _2DTableRegion({ ...options, table });
|
|
24568
|
+
return this.registerRegion(table, region, options, (cell) => {
|
|
24569
|
+
cell.setSubTable("2d-table", region.id);
|
|
24623
24570
|
});
|
|
24624
|
-
table.regions.push(region);
|
|
24625
|
-
WtblCellIterator.forEachCell(table, {
|
|
24626
|
-
startRowIdx: options.start.row,
|
|
24627
|
-
startColIdx: options.start.col,
|
|
24628
|
-
endRowIdx: options.end.row,
|
|
24629
|
-
endColIdx: options.end.col,
|
|
24630
|
-
callback: (cell) => {
|
|
24631
|
-
cell._2DTableId = region.id;
|
|
24632
|
-
}
|
|
24633
|
-
});
|
|
24634
|
-
return region;
|
|
24635
24571
|
}
|
|
24636
24572
|
/**
|
|
24637
|
-
*
|
|
24573
|
+
* 设置有界区域(子表体)
|
|
24638
24574
|
*/
|
|
24639
24575
|
static setBounded(table, options) {
|
|
24640
|
-
const region = new BoundedRegion({
|
|
24641
|
-
|
|
24642
|
-
|
|
24576
|
+
const region = new BoundedRegion({ ...options, table });
|
|
24577
|
+
return this.registerRegion(table, region, options, (cell) => {
|
|
24578
|
+
cell.setSubTable("bounded", region.id);
|
|
24643
24579
|
});
|
|
24644
|
-
table.regions.push(region);
|
|
24645
|
-
WtblCellIterator.forEachCell(table, {
|
|
24646
|
-
startRowIdx: options.start.row,
|
|
24647
|
-
startColIdx: options.start.col,
|
|
24648
|
-
endRowIdx: options.end.row,
|
|
24649
|
-
endColIdx: options.end.col,
|
|
24650
|
-
callback: (cell) => {
|
|
24651
|
-
cell.boundedId = region.id;
|
|
24652
|
-
}
|
|
24653
|
-
});
|
|
24654
|
-
return region;
|
|
24655
24580
|
}
|
|
24656
24581
|
/**
|
|
24657
|
-
*
|
|
24582
|
+
* 设置检验表区域
|
|
24658
24583
|
*/
|
|
24659
24584
|
static setCheckTable(table, options) {
|
|
24660
|
-
const region = new CheckTableRegion({
|
|
24661
|
-
|
|
24662
|
-
table
|
|
24585
|
+
const region = new CheckTableRegion({ ...options, table });
|
|
24586
|
+
return this.registerRegion(table, region, options, (cell) => {
|
|
24587
|
+
cell.setSubTable("check-table", region.id);
|
|
24663
24588
|
});
|
|
24664
|
-
table.regions.push(region);
|
|
24665
|
-
WtblCellIterator.forEachCell(table, {
|
|
24666
|
-
startRowIdx: options.start.row,
|
|
24667
|
-
startColIdx: options.start.col,
|
|
24668
|
-
endRowIdx: options.end.row,
|
|
24669
|
-
endColIdx: options.end.col,
|
|
24670
|
-
callback: (cell) => {
|
|
24671
|
-
cell.checkTableId = region.id;
|
|
24672
|
-
}
|
|
24673
|
-
});
|
|
24674
|
-
return region;
|
|
24675
24589
|
}
|
|
24590
|
+
/**
|
|
24591
|
+
* 设置表头区域(主表表头)
|
|
24592
|
+
*/
|
|
24676
24593
|
static setTableHeader(table, options) {
|
|
24677
|
-
const region = new TableHeaderRegion({
|
|
24678
|
-
|
|
24679
|
-
table
|
|
24680
|
-
});
|
|
24681
|
-
table.regions.push(region);
|
|
24682
|
-
WtblCellIterator.forEachCell(table, {
|
|
24683
|
-
startRowIdx: options.start.row,
|
|
24684
|
-
startColIdx: options.start.col,
|
|
24685
|
-
endRowIdx: options.end.row,
|
|
24686
|
-
endColIdx: options.end.col,
|
|
24687
|
-
callback: (cell) => {
|
|
24688
|
-
cell.headerId = region.id;
|
|
24689
|
-
}
|
|
24594
|
+
const region = new TableHeaderRegion({ ...options, table });
|
|
24595
|
+
return this.registerRegion(table, region, options, (cell) => {
|
|
24596
|
+
cell.setHeaderRef("table-header", region.id);
|
|
24690
24597
|
});
|
|
24691
|
-
return region;
|
|
24692
24598
|
}
|
|
24599
|
+
/**
|
|
24600
|
+
* 设置子表表头区域
|
|
24601
|
+
*/
|
|
24693
24602
|
static setSubTableHeader(table, options) {
|
|
24694
|
-
const region = new SubTableHeaderRegion({
|
|
24695
|
-
|
|
24696
|
-
table
|
|
24603
|
+
const region = new SubTableHeaderRegion({ ...options, table });
|
|
24604
|
+
return this.registerRegion(table, region, options, (cell) => {
|
|
24605
|
+
cell.setHeaderRef("sub-table-header", region.id);
|
|
24697
24606
|
});
|
|
24698
|
-
|
|
24607
|
+
}
|
|
24608
|
+
/**
|
|
24609
|
+
* 判断两个矩形区域是否相交(含边界恰好相贴的情况)
|
|
24610
|
+
*/
|
|
24611
|
+
static regionsIntersect(a, b2) {
|
|
24612
|
+
return !(a.end.row < b2.start.row || a.start.row > b2.end.row || a.end.col < b2.start.col || a.start.col > b2.end.col);
|
|
24613
|
+
}
|
|
24614
|
+
/**
|
|
24615
|
+
* 遍历 region 覆盖范围内的所有单元格
|
|
24616
|
+
*/
|
|
24617
|
+
static forEachCellInRegion(table, bounds, callback) {
|
|
24618
|
+
const { start, end } = bounds;
|
|
24699
24619
|
WtblCellIterator.forEachCell(table, {
|
|
24700
|
-
startRowIdx:
|
|
24701
|
-
startColIdx:
|
|
24702
|
-
endRowIdx:
|
|
24703
|
-
endColIdx:
|
|
24704
|
-
callback: (cell) =>
|
|
24705
|
-
cell.headerId = region.id;
|
|
24706
|
-
}
|
|
24620
|
+
startRowIdx: start.row,
|
|
24621
|
+
startColIdx: start.col,
|
|
24622
|
+
endRowIdx: end.row,
|
|
24623
|
+
endColIdx: end.col,
|
|
24624
|
+
callback: (cell) => callback(cell)
|
|
24707
24625
|
});
|
|
24626
|
+
}
|
|
24627
|
+
/**
|
|
24628
|
+
* 将 region 加入 table.regions,并同步标记覆盖范围内的单元格
|
|
24629
|
+
*/
|
|
24630
|
+
static registerRegion(table, region, bounds, markCell) {
|
|
24631
|
+
table.regions.push(region);
|
|
24632
|
+
this.forEachCellInRegion(table, bounds, markCell);
|
|
24708
24633
|
return region;
|
|
24709
24634
|
}
|
|
24635
|
+
/**
|
|
24636
|
+
* 删除 region 时,按类型清除单元格上的关联数据
|
|
24637
|
+
*
|
|
24638
|
+
* - 子表类:清除字段 runs + 子表 / 子表项引用
|
|
24639
|
+
* - 表头类:清除字段 runs + 表头引用
|
|
24640
|
+
* - 其他:仅清除对应 region 的引用
|
|
24641
|
+
*/
|
|
24642
|
+
static clearCellRegionMarks(cell, region) {
|
|
24643
|
+
const regionId = region.id;
|
|
24644
|
+
switch (region.type) {
|
|
24645
|
+
case "repeating":
|
|
24646
|
+
case "2d-table":
|
|
24647
|
+
case "bounded":
|
|
24648
|
+
case "check-table":
|
|
24649
|
+
cell.clearFieldRuns();
|
|
24650
|
+
cell.clearSubTable();
|
|
24651
|
+
cell.clearSubTableItem();
|
|
24652
|
+
break;
|
|
24653
|
+
case "table-header":
|
|
24654
|
+
case "sub-table-header":
|
|
24655
|
+
cell.clearFieldRuns();
|
|
24656
|
+
cell.clearHeaderRef();
|
|
24657
|
+
break;
|
|
24658
|
+
default:
|
|
24659
|
+
cell.clearRegionRef(regionId);
|
|
24660
|
+
}
|
|
24661
|
+
}
|
|
24662
|
+
}
|
|
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;
|
|
24674
|
+
return {
|
|
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
|
+
}
|
|
24683
|
+
};
|
|
24684
|
+
}
|
|
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
|
+
}
|
|
24696
|
+
});
|
|
24697
|
+
return maxCol;
|
|
24698
|
+
}
|
|
24699
|
+
function resolveLinkSubTableCellZone(row, col, region, options = {}) {
|
|
24700
|
+
const { itemRegion } = region;
|
|
24701
|
+
if (!itemRegion) {
|
|
24702
|
+
return region.contains(row, col) ? "horizontal" : void 0;
|
|
24703
|
+
}
|
|
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;
|
|
24723
|
+
}
|
|
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;
|
|
24732
|
+
}
|
|
24733
|
+
}
|
|
24734
|
+
function isInLinkSubTableLayoutScope(row, col, region, options = {}) {
|
|
24735
|
+
return resolveLinkSubTableCellZone(row, col, region, options) !== void 0;
|
|
24710
24736
|
}
|
|
24711
24737
|
class CellCollector {
|
|
24712
24738
|
constructor(table) {
|
|
@@ -24744,41 +24770,21 @@ class CellCollector {
|
|
|
24744
24770
|
}
|
|
24745
24771
|
this.mergeGroups.get(cell.mergeId).push(position);
|
|
24746
24772
|
}
|
|
24747
|
-
|
|
24748
|
-
|
|
24749
|
-
|
|
24750
|
-
|
|
24751
|
-
|
|
24752
|
-
}
|
|
24753
|
-
if (cell._2DTableId) {
|
|
24754
|
-
if (!this._2DTableGroups.has(cell._2DTableId)) {
|
|
24755
|
-
this._2DTableGroups.set(cell._2DTableId, []);
|
|
24756
|
-
}
|
|
24757
|
-
this._2DTableGroups.get(cell._2DTableId).push(position);
|
|
24758
|
-
}
|
|
24759
|
-
if (cell.boundedId) {
|
|
24760
|
-
if (!this.boundedGroups.has(cell.boundedId)) {
|
|
24761
|
-
this.boundedGroups.set(cell.boundedId, []);
|
|
24773
|
+
const body = cell.subTable;
|
|
24774
|
+
if (body) {
|
|
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, []);
|
|
24762
24778
|
}
|
|
24763
|
-
|
|
24779
|
+
map.get(body.regionId).push(position);
|
|
24764
24780
|
}
|
|
24765
|
-
|
|
24766
|
-
|
|
24767
|
-
|
|
24781
|
+
const item = cell.subTableItem;
|
|
24782
|
+
if (item) {
|
|
24783
|
+
const map = item.type === "bounded-item" ? this.boundedItemGroups : this.dataGroup2DGroups;
|
|
24784
|
+
if (!map.has(item.regionId)) {
|
|
24785
|
+
map.set(item.regionId, []);
|
|
24768
24786
|
}
|
|
24769
|
-
|
|
24770
|
-
}
|
|
24771
|
-
if (cell.checkTableId) {
|
|
24772
|
-
if (!this.checkTableGroups.has(cell.checkTableId)) {
|
|
24773
|
-
this.checkTableGroups.set(cell.checkTableId, []);
|
|
24774
|
-
}
|
|
24775
|
-
this.checkTableGroups.get(cell.checkTableId).push(position);
|
|
24776
|
-
}
|
|
24777
|
-
if (cell.dataGroup2DId) {
|
|
24778
|
-
if (!this.dataGroup2DGroups.has(cell.dataGroup2DId)) {
|
|
24779
|
-
this.dataGroup2DGroups.set(cell.dataGroup2DId, []);
|
|
24780
|
-
}
|
|
24781
|
-
this.dataGroup2DGroups.get(cell.dataGroup2DId).push(position);
|
|
24787
|
+
map.get(item.regionId).push(position);
|
|
24782
24788
|
}
|
|
24783
24789
|
}
|
|
24784
24790
|
}
|
|
@@ -24956,7 +24962,7 @@ class WtblCalculation {
|
|
|
24956
24962
|
if (positions.length === 0) continue;
|
|
24957
24963
|
const { minRow, maxRow, minCol, maxCol } = calculateGroupBounds(positions);
|
|
24958
24964
|
const region = table.findRegionById(groupId);
|
|
24959
|
-
if (region &&
|
|
24965
|
+
if (region && isLinkSubTableType(region.type)) {
|
|
24960
24966
|
region.start.row = minRow;
|
|
24961
24967
|
region.end.row = maxRow;
|
|
24962
24968
|
region.start.col = minCol;
|
|
@@ -27084,6 +27090,8 @@ class TextWidget extends TextRun {
|
|
|
27084
27090
|
widgetFileItem;
|
|
27085
27091
|
pageWidgetMeta;
|
|
27086
27092
|
dataIndex;
|
|
27093
|
+
xDataIndex;
|
|
27094
|
+
yDataIndex;
|
|
27087
27095
|
constructor(options) {
|
|
27088
27096
|
super(options);
|
|
27089
27097
|
this.widgetMeta = options.widgetMeta;
|
|
@@ -31782,7 +31790,7 @@ class DeleteDataGroup2D extends CommandBase {
|
|
|
31782
31790
|
return null;
|
|
31783
31791
|
}
|
|
31784
31792
|
const subTable = table.findRegionById(regionId);
|
|
31785
|
-
if (!subTable ||
|
|
31793
|
+
if (!subTable || !isLinkSubTableType(subTable.type)) {
|
|
31786
31794
|
console.error(
|
|
31787
31795
|
`deleteDataGroup2D: region not found with id ${regionId} or region type is not support`
|
|
31788
31796
|
);
|
|
@@ -38092,6 +38100,16 @@ function canSwitchImageFieldToAdaptive(cell, fieldRunId) {
|
|
|
38092
38100
|
}
|
|
38093
38101
|
return !fieldRunId || run.id === fieldRunId;
|
|
38094
38102
|
}
|
|
38103
|
+
const INSERT_FIELD_MSG = {
|
|
38104
|
+
NOT_IN_CELL: "子表字段只能插入表格单元格中",
|
|
38105
|
+
PATH_INCOMPATIBLE: "字段路径与当前区域不兼容,无法插入",
|
|
38106
|
+
NOT_IN_SUBTABLE_REGION: "当前位置不在子表区域内,无法插入该字段",
|
|
38107
|
+
LINK_IN_CROSS: "二维表/检验表关联字段不能拖入交叉区域",
|
|
38108
|
+
SUB_IN_CROSS_PATH: "该字段不能拖入交叉区域",
|
|
38109
|
+
LINK_ONLY_VERTICAL: "请使用动态关联字段拖入纵向关联区域",
|
|
38110
|
+
SUB_ONLY_HORIZONTAL: "请使用子表主体字段拖入横向区域",
|
|
38111
|
+
SUB_IN_2D_EXPANSION: "二维表字段不能拖入交叉区域上方或下方的扩展区域"
|
|
38112
|
+
};
|
|
38095
38113
|
class InsertField extends CommandBase {
|
|
38096
38114
|
constructor(doc, payload) {
|
|
38097
38115
|
super(doc, payload);
|
|
@@ -38110,17 +38128,20 @@ class InsertField extends CommandBase {
|
|
|
38110
38128
|
handleCollapseText() {
|
|
38111
38129
|
const cursor = this.doc.cursorManager;
|
|
38112
38130
|
const { nodeId, offset: offset2, side } = cursor.getCursor();
|
|
38113
|
-
const {
|
|
38114
|
-
valuePath,
|
|
38115
|
-
widgetMeta
|
|
38116
|
-
} = this.payload;
|
|
38131
|
+
const { valuePath: draggedValuePath, widgetMeta } = this.payload;
|
|
38117
38132
|
const mapper = this.doc.layoutMapper;
|
|
38118
38133
|
const node = mapper.getBaseMetaNodeById(nodeId);
|
|
38119
38134
|
const run = node.raw;
|
|
38120
38135
|
const wp = mapper.getModelNodeById(run.parent.modelRef.id);
|
|
38121
|
-
const
|
|
38122
|
-
|
|
38123
|
-
|
|
38136
|
+
const { valuePath, widgetMeta: resolvedMeta } = this.resolveInsertFieldPayload(
|
|
38137
|
+
draggedValuePath,
|
|
38138
|
+
widgetMeta
|
|
38139
|
+
);
|
|
38140
|
+
const wr = new WrField({ text: valuePath, valuePath, widgetMeta: resolvedMeta });
|
|
38141
|
+
const validateError = this.validateFieldPath(valuePath, wp, widgetMeta);
|
|
38142
|
+
if (validateError) {
|
|
38143
|
+
GctMessage.warning(validateError);
|
|
38144
|
+
this.isTerminated = true;
|
|
38124
38145
|
return null;
|
|
38125
38146
|
}
|
|
38126
38147
|
const cell = getAncestorCell(wp);
|
|
@@ -38171,8 +38192,17 @@ class InsertField extends CommandBase {
|
|
|
38171
38192
|
if (models.length === 0) return null;
|
|
38172
38193
|
if (mode !== SelectionMode.PP) return null;
|
|
38173
38194
|
this.clearSelectionContent(models);
|
|
38174
|
-
const { valuePath, widgetMeta } = this.payload;
|
|
38175
|
-
const
|
|
38195
|
+
const { valuePath: draggedValuePath, widgetMeta } = this.payload;
|
|
38196
|
+
const { valuePath, widgetMeta: resolvedMeta } = this.resolveInsertFieldPayload(
|
|
38197
|
+
draggedValuePath,
|
|
38198
|
+
widgetMeta
|
|
38199
|
+
);
|
|
38200
|
+
const validateError = this.validateFieldPath(valuePath, blockFirst, widgetMeta);
|
|
38201
|
+
if (validateError) {
|
|
38202
|
+
GctMessage.warning(validateError);
|
|
38203
|
+
return null;
|
|
38204
|
+
}
|
|
38205
|
+
const wr = new WrField({ text: "*", valuePath, widgetMeta: resolvedMeta });
|
|
38176
38206
|
const cell = getAncestorCell(blockFirst);
|
|
38177
38207
|
if (isCellLockedByAdaptiveImage(cell)) {
|
|
38178
38208
|
GctMessage.warning(ADAPTIVE_IMAGE_CELL_MSG);
|
|
@@ -38194,16 +38224,7 @@ class InsertField extends CommandBase {
|
|
|
38194
38224
|
};
|
|
38195
38225
|
}
|
|
38196
38226
|
isRootField(valuePath) {
|
|
38197
|
-
|
|
38198
|
-
return true;
|
|
38199
|
-
}
|
|
38200
|
-
return false;
|
|
38201
|
-
}
|
|
38202
|
-
isNestedTableField(valuePath) {
|
|
38203
|
-
if (valuePath && valuePath.indexOf("[n]") !== -1) {
|
|
38204
|
-
return true;
|
|
38205
|
-
}
|
|
38206
|
-
return false;
|
|
38227
|
+
return parseValuePath(valuePath).isRoot;
|
|
38207
38228
|
}
|
|
38208
38229
|
/**
|
|
38209
38230
|
* 判断两个 valuePath 是否连续(父子关系)
|
|
@@ -38220,15 +38241,17 @@ class InsertField extends CommandBase {
|
|
|
38220
38241
|
*/
|
|
38221
38242
|
isConsecutivePath(parentPath, childPath) {
|
|
38222
38243
|
if (!parentPath || !childPath) return false;
|
|
38223
|
-
|
|
38224
|
-
if (!childPath.startsWith(_parentPath)) {
|
|
38244
|
+
if (!childPath.startsWith(parentPath)) {
|
|
38225
38245
|
return false;
|
|
38226
38246
|
}
|
|
38227
|
-
const remainder = childPath.slice(
|
|
38247
|
+
const remainder = childPath.slice(parentPath.length);
|
|
38228
38248
|
if (remainder === "") {
|
|
38229
38249
|
return false;
|
|
38230
38250
|
}
|
|
38231
|
-
|
|
38251
|
+
if (remainder.startsWith(":")) {
|
|
38252
|
+
return false;
|
|
38253
|
+
}
|
|
38254
|
+
return remainder.startsWith(".") || remainder.startsWith("[n].") || remainder.startsWith("[");
|
|
38232
38255
|
}
|
|
38233
38256
|
/**
|
|
38234
38257
|
* 判断 childPath 是否可以在 parentPath 的循环区域中使用
|
|
@@ -38254,22 +38277,166 @@ class InsertField extends CommandBase {
|
|
|
38254
38277
|
const hasLoops = (relativePath.match(/\[n\]/g) || []).length > 0;
|
|
38255
38278
|
return !!(relativePath && relativePath !== "." && !hasLoops);
|
|
38256
38279
|
}
|
|
38257
|
-
|
|
38258
|
-
|
|
38259
|
-
|
|
38260
|
-
|
|
38280
|
+
getLayoutTableCellFromCursor() {
|
|
38281
|
+
const cursor = this.doc.cursorManager.getCursor();
|
|
38282
|
+
if (!cursor?.nodeId) return void 0;
|
|
38283
|
+
const meta = this.doc.layoutMapper.getBaseMetaNodeById(cursor.nodeId);
|
|
38284
|
+
const tableCellId = meta?.line?.tableCellId;
|
|
38285
|
+
if (!tableCellId) return void 0;
|
|
38286
|
+
return this.doc.layoutMapper.getLayoutNodeById(tableCellId);
|
|
38287
|
+
}
|
|
38288
|
+
getModelCellFromCursor() {
|
|
38289
|
+
const cursor = this.doc.cursorManager.getCursor();
|
|
38290
|
+
if (!cursor?.nodeId) return null;
|
|
38291
|
+
const meta = this.doc.layoutMapper.getBaseMetaNodeById(cursor.nodeId);
|
|
38292
|
+
const run = meta?.raw;
|
|
38293
|
+
const wpId = run?.parent?.modelRef?.id;
|
|
38294
|
+
if (!wpId) return null;
|
|
38295
|
+
const wp = this.doc.layoutMapper.getModelNodeById(wpId);
|
|
38296
|
+
return wp ? getAncestorCell(wp) : null;
|
|
38297
|
+
}
|
|
38298
|
+
/** 二维表/检验表:用当前单元格 subRenderer 分区 valuePath 作为父路径 */
|
|
38299
|
+
getSubTableZoneParentPath() {
|
|
38300
|
+
const sub = this.getLayoutTableCellFromCursor()?.subRenderer;
|
|
38301
|
+
if (sub && isLinkSubTableType(sub.type)) {
|
|
38302
|
+
return sub.valuePath;
|
|
38303
|
+
}
|
|
38304
|
+
return void 0;
|
|
38305
|
+
}
|
|
38306
|
+
resolveInsertFieldPayload(draggedValuePath, widgetMeta) {
|
|
38307
|
+
const layoutSub = this.getLayoutTableCellFromCursor()?.subRenderer;
|
|
38308
|
+
const zoneParentPath = this.getSubTableZoneParentPath();
|
|
38309
|
+
if (!zoneParentPath || !widgetMeta.field) {
|
|
38310
|
+
return { valuePath: draggedValuePath, widgetMeta };
|
|
38311
|
+
}
|
|
38312
|
+
if (isLinkSubTableType(layoutSub?.type)) {
|
|
38313
|
+
const cell = this.getModelCellFromCursor();
|
|
38314
|
+
const region = cell ? this.getLinkSubTableRegionFromLayout(cell, layoutSub) : void 0;
|
|
38315
|
+
if (region && !this.getDraggedFieldSide(widgetMeta.field, region)) {
|
|
38316
|
+
return { valuePath: draggedValuePath, widgetMeta };
|
|
38317
|
+
}
|
|
38318
|
+
}
|
|
38319
|
+
const fieldLink = widgetMeta.field.fieldLink || getLastSegment(draggedValuePath);
|
|
38320
|
+
const parentKey = parseValuePath(zoneParentPath).normalized;
|
|
38321
|
+
const valuePath = generateValuePath(fieldLink, parentKey);
|
|
38322
|
+
return {
|
|
38323
|
+
valuePath,
|
|
38324
|
+
widgetMeta: {
|
|
38325
|
+
...widgetMeta,
|
|
38326
|
+
field: {
|
|
38327
|
+
...widgetMeta.field,
|
|
38328
|
+
valuePath,
|
|
38329
|
+
subFieldKey: parentKey
|
|
38330
|
+
}
|
|
38331
|
+
}
|
|
38332
|
+
};
|
|
38333
|
+
}
|
|
38334
|
+
/**
|
|
38335
|
+
* 根据拖拽时 palette 传入的 subFieldKey 判断字段属于关联侧还是二维表/检验表主体侧。
|
|
38336
|
+
* - 仅 linkFieldKey:动态关联 palette(f_ewblink)
|
|
38337
|
+
* - 仅 subFieldKey:横向区 palette(f_ewb)
|
|
38338
|
+
* - sub:link:交叉区 palette 拖入的主体字段(f_ewb:f_ewblink)
|
|
38339
|
+
*/
|
|
38340
|
+
getDraggedFieldSide(field, region) {
|
|
38341
|
+
const raw = field?.subFieldKey;
|
|
38342
|
+
if (!raw) return void 0;
|
|
38343
|
+
const parsed = parseValuePath(raw);
|
|
38344
|
+
const subFieldKey = parsed.isLink ? parsed.parentFieldKey ?? "" : parsed.fieldKey;
|
|
38345
|
+
const linkFieldKey = parsed.linkFieldKey ?? "";
|
|
38346
|
+
if (subFieldKey === region.subFieldKey && linkFieldKey === region.linkFieldKey) {
|
|
38347
|
+
return "sub";
|
|
38348
|
+
}
|
|
38349
|
+
if (!linkFieldKey && subFieldKey === region.linkFieldKey) {
|
|
38350
|
+
return "link";
|
|
38351
|
+
}
|
|
38352
|
+
if (!linkFieldKey && subFieldKey === region.subFieldKey) {
|
|
38353
|
+
return "sub";
|
|
38354
|
+
}
|
|
38355
|
+
return void 0;
|
|
38356
|
+
}
|
|
38357
|
+
validateLinkSubTableFieldPath(valuePath, region, field, cell, cellZone) {
|
|
38358
|
+
const fieldSide = this.getDraggedFieldSide(field, region);
|
|
38359
|
+
if (!fieldSide) {
|
|
38360
|
+
return INSERT_FIELD_MSG.PATH_INCOMPATIBLE;
|
|
38361
|
+
}
|
|
38362
|
+
const zoneParentPath = cellZone ? resolveLinkSubTableValuePath(region, cellZone) : fieldSide === "link" ? region.linkValuePath : region.subValuePath;
|
|
38363
|
+
if (!this.isFieldPathCompatible(zoneParentPath, valuePath)) {
|
|
38364
|
+
return INSERT_FIELD_MSG.PATH_INCOMPATIBLE;
|
|
38365
|
+
}
|
|
38366
|
+
const parsed = parseValuePath(valuePath);
|
|
38367
|
+
if (cellZone === "cross") {
|
|
38368
|
+
if (fieldSide === "link") return INSERT_FIELD_MSG.LINK_IN_CROSS;
|
|
38369
|
+
if (!parsed.isLink) return INSERT_FIELD_MSG.SUB_IN_CROSS_PATH;
|
|
38370
|
+
return null;
|
|
38371
|
+
}
|
|
38372
|
+
if (cellZone === "vertical" && fieldSide !== "link") {
|
|
38373
|
+
return INSERT_FIELD_MSG.LINK_ONLY_VERTICAL;
|
|
38374
|
+
}
|
|
38375
|
+
if (cellZone === "horizontal" && fieldSide !== "sub") {
|
|
38376
|
+
return INSERT_FIELD_MSG.SUB_ONLY_HORIZONTAL;
|
|
38377
|
+
}
|
|
38378
|
+
if (region.type === "2d-table" && fieldSide === "sub" && this.isDataGroup2DExpansionCell(cell, region)) {
|
|
38379
|
+
return INSERT_FIELD_MSG.SUB_IN_2D_EXPANSION;
|
|
38380
|
+
}
|
|
38381
|
+
return null;
|
|
38382
|
+
}
|
|
38383
|
+
/** 数据关联区向上/下扩充、超出子表主体行范围的模板行 */
|
|
38384
|
+
isDataGroup2DExpansionCell(cell, region) {
|
|
38385
|
+
const item = region.itemRegion;
|
|
38386
|
+
if (!item) return false;
|
|
38387
|
+
const rowIndex = cell.parent.getCurrentIndex();
|
|
38388
|
+
const inItemRows = rowIndex >= item.start.row && rowIndex <= item.end.row;
|
|
38389
|
+
const inBodyRows = rowIndex >= region.start.row && rowIndex <= region.end.row;
|
|
38390
|
+
return inItemRows && !inBodyRows;
|
|
38391
|
+
}
|
|
38392
|
+
getLinkSubTableRegionFromLayout(cell, sub) {
|
|
38393
|
+
const table = cell.table;
|
|
38394
|
+
if (!isLinkSubTableType(sub.type)) return void 0;
|
|
38395
|
+
if (sub.type === "2d-table") {
|
|
38396
|
+
return table.get2DTableById(sub.id);
|
|
38397
|
+
}
|
|
38398
|
+
return table.getCheckTableById(sub.id);
|
|
38399
|
+
}
|
|
38400
|
+
/**
|
|
38401
|
+
* 校验字段是否可插入当前位置
|
|
38402
|
+
* @returns 校验通过返回 null,失败返回提示文案
|
|
38403
|
+
*/
|
|
38404
|
+
validateFieldPath(valuePath = "", node, widgetMeta) {
|
|
38405
|
+
if (this.isRootField(valuePath)) return null;
|
|
38261
38406
|
const cell = getAncestorCell(node);
|
|
38262
|
-
if (!cell) return
|
|
38407
|
+
if (!cell) return INSERT_FIELD_MSG.NOT_IN_CELL;
|
|
38408
|
+
const layoutSub = this.getLayoutTableCellFromCursor()?.subRenderer;
|
|
38409
|
+
if (layoutSub && isLinkSubTableType(layoutSub.type)) {
|
|
38410
|
+
const region = this.getLinkSubTableRegionFromLayout(cell, layoutSub);
|
|
38411
|
+
if (!region) return INSERT_FIELD_MSG.NOT_IN_SUBTABLE_REGION;
|
|
38412
|
+
return this.validateLinkSubTableFieldPath(
|
|
38413
|
+
valuePath,
|
|
38414
|
+
region,
|
|
38415
|
+
widgetMeta?.field,
|
|
38416
|
+
cell,
|
|
38417
|
+
layoutSub.cellZone
|
|
38418
|
+
);
|
|
38419
|
+
}
|
|
38263
38420
|
const table = cell.table;
|
|
38264
38421
|
const row = cell.parent;
|
|
38265
38422
|
const regions = table.regions;
|
|
38266
38423
|
const colIndex = cell.getCurrentIndex();
|
|
38267
38424
|
const rowIndex = row.getCurrentIndex();
|
|
38268
|
-
const targetRegion = regions.find((r) =>
|
|
38269
|
-
|
|
38270
|
-
|
|
38271
|
-
|
|
38272
|
-
|
|
38425
|
+
const targetRegion = regions.find((r) => r.contains(rowIndex, colIndex));
|
|
38426
|
+
if (targetRegion && isLinkSubTableType(targetRegion.type)) {
|
|
38427
|
+
return this.validateLinkSubTableFieldPath(
|
|
38428
|
+
valuePath,
|
|
38429
|
+
targetRegion,
|
|
38430
|
+
widgetMeta?.field,
|
|
38431
|
+
cell
|
|
38432
|
+
);
|
|
38433
|
+
}
|
|
38434
|
+
const zoneParentPath = this.getSubTableZoneParentPath();
|
|
38435
|
+
if (zoneParentPath) {
|
|
38436
|
+
return this.isFieldPathCompatible(zoneParentPath, valuePath) ? null : INSERT_FIELD_MSG.PATH_INCOMPATIBLE;
|
|
38437
|
+
}
|
|
38438
|
+
if (!targetRegion) return INSERT_FIELD_MSG.NOT_IN_SUBTABLE_REGION;
|
|
38439
|
+
return this.isFieldPathCompatible(targetRegion.valuePath, valuePath) ? null : INSERT_FIELD_MSG.PATH_INCOMPATIBLE;
|
|
38273
38440
|
}
|
|
38274
38441
|
}
|
|
38275
38442
|
const __vite_glob_0_15$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -39567,7 +39734,7 @@ class SetDataGroup2D extends CommandBase {
|
|
|
39567
39734
|
let region;
|
|
39568
39735
|
cellList.some((cell) => {
|
|
39569
39736
|
const r = cell.getRegion();
|
|
39570
|
-
if (r &&
|
|
39737
|
+
if (r && isLinkSubTableType(r.type)) {
|
|
39571
39738
|
region = r;
|
|
39572
39739
|
return true;
|
|
39573
39740
|
}
|
|
@@ -39970,16 +40137,16 @@ function getClassNameFromPath(path2) {
|
|
|
39970
40137
|
return path2.split("/").pop()?.replace(".ts", "") ?? "";
|
|
39971
40138
|
}
|
|
39972
40139
|
function buildCommandMap() {
|
|
39973
|
-
const
|
|
40140
|
+
const map = {};
|
|
39974
40141
|
Object.entries(commandModules).forEach(([path2, module2]) => {
|
|
39975
40142
|
const expectedClassName = getClassNameFromPath(path2);
|
|
39976
40143
|
const CommandClass = module2[expectedClassName];
|
|
39977
40144
|
if (CommandClass && typeof CommandClass === "function") {
|
|
39978
40145
|
const commandName = toCamelCase(expectedClassName);
|
|
39979
|
-
|
|
40146
|
+
map[commandName] = CommandClass;
|
|
39980
40147
|
}
|
|
39981
40148
|
});
|
|
39982
|
-
return
|
|
40149
|
+
return map;
|
|
39983
40150
|
}
|
|
39984
40151
|
class CommandManager {
|
|
39985
40152
|
registry = /* @__PURE__ */ new Map();
|
|
@@ -40270,19 +40437,19 @@ class Table extends LayoutGroup {
|
|
|
40270
40437
|
});
|
|
40271
40438
|
}
|
|
40272
40439
|
updateCellOffsetInfo() {
|
|
40273
|
-
const
|
|
40440
|
+
const map = /* @__PURE__ */ new Map();
|
|
40274
40441
|
const rows = this.getChildren();
|
|
40275
40442
|
rows.forEach((row, rowIndex) => {
|
|
40276
40443
|
row.getChildren().forEach((cell, colIndex) => {
|
|
40277
40444
|
if (cell.mergeFromId) {
|
|
40278
|
-
cell.mergeRefColOffset = colIndex -
|
|
40279
|
-
cell.mergeRefRowOffset = rowIndex -
|
|
40445
|
+
cell.mergeRefColOffset = colIndex - map.get(cell.mergeFromId).colIndex;
|
|
40446
|
+
cell.mergeRefRowOffset = rowIndex - map.get(cell.mergeFromId).rowIndex;
|
|
40280
40447
|
} else {
|
|
40281
|
-
|
|
40448
|
+
map.set(cell.id, { rowIndex, colIndex });
|
|
40282
40449
|
}
|
|
40283
40450
|
});
|
|
40284
40451
|
});
|
|
40285
|
-
|
|
40452
|
+
map.clear();
|
|
40286
40453
|
}
|
|
40287
40454
|
forEachCell(options) {
|
|
40288
40455
|
const { startRowIdx, startColIdx, endRowIdx, endColIdx, callback, filter: filter2 } = options;
|
|
@@ -40600,35 +40767,50 @@ class LayoutContext {
|
|
|
40600
40767
|
*/
|
|
40601
40768
|
getValuePath(path2) {
|
|
40602
40769
|
if (!path2) return void 0;
|
|
40770
|
+
const { type: type4, dataIndex, xDataIndex, yDataIndex, cellZone } = this.cell?.subRenderer || {};
|
|
40771
|
+
if (isLinkSubTableType(type4) && cellZone === "cross") {
|
|
40772
|
+
return replacePathIndexPlaceholders({ x: xDataIndex, y: yDataIndex, templatePath: path2 });
|
|
40773
|
+
}
|
|
40603
40774
|
if (!path2.includes("[n]")) {
|
|
40604
40775
|
return path2;
|
|
40605
40776
|
}
|
|
40606
|
-
const {
|
|
40607
|
-
type: type4,
|
|
40608
|
-
dataIndex,
|
|
40609
|
-
xDataIndex
|
|
40610
|
-
} = this.cell?.subRenderer || {};
|
|
40611
40777
|
let n = dataIndex;
|
|
40612
|
-
if (type4
|
|
40613
|
-
n = xDataIndex;
|
|
40778
|
+
if (isLinkSubTableType(type4)) {
|
|
40779
|
+
n = cellZone === "horizontal" ? yDataIndex : xDataIndex;
|
|
40614
40780
|
}
|
|
40615
40781
|
if (n === void 0) return path2;
|
|
40616
|
-
return
|
|
40782
|
+
return replacePathIndexPlaceholder(n, path2);
|
|
40617
40783
|
}
|
|
40618
40784
|
}
|
|
40619
40785
|
class TextHandler {
|
|
40620
40786
|
static getId(context, wr) {
|
|
40621
|
-
|
|
40622
|
-
|
|
40623
|
-
|
|
40624
|
-
|
|
40625
|
-
|
|
40787
|
+
const baseId = wr.id;
|
|
40788
|
+
const sub = context.cell?.subRenderer;
|
|
40789
|
+
if (sub && isLinkSubTableType(sub.type) && sub.cellZone === "cross" && typeof sub.yDataIndex === "number" && typeof sub.xDataIndex === "number") {
|
|
40790
|
+
return `${baseId}@${sub.yDataIndex}_${sub.xDataIndex}`;
|
|
40791
|
+
}
|
|
40792
|
+
let runIndex;
|
|
40793
|
+
if (sub) {
|
|
40794
|
+
if (isLinkSubTableType(sub.type)) {
|
|
40795
|
+
runIndex = sub.cellZone === "horizontal" ? sub.yDataIndex : sub.xDataIndex;
|
|
40796
|
+
} else {
|
|
40797
|
+
runIndex = sub.dataIndex;
|
|
40798
|
+
}
|
|
40799
|
+
}
|
|
40800
|
+
if (typeof runIndex === "number") {
|
|
40801
|
+
return `${baseId}@${runIndex}`;
|
|
40802
|
+
}
|
|
40803
|
+
if (context.type === "header" || context.type === "footer") {
|
|
40804
|
+
return `${baseId}$p${Math.max(0, context.page?.pageIndex ?? 0)}`;
|
|
40626
40805
|
}
|
|
40627
|
-
return
|
|
40806
|
+
return baseId;
|
|
40628
40807
|
}
|
|
40629
40808
|
static get2DInfo(context) {
|
|
40630
|
-
const { xDataIndex, yDataIndex } = context.cell?.subRenderer || {};
|
|
40631
|
-
return {
|
|
40809
|
+
const { xDataIndex, yDataIndex, cellZone } = context.cell?.subRenderer || {};
|
|
40810
|
+
return {
|
|
40811
|
+
xDataIndex: cellZone === "horizontal" ? void 0 : xDataIndex,
|
|
40812
|
+
yDataIndex
|
|
40813
|
+
};
|
|
40632
40814
|
}
|
|
40633
40815
|
/**
|
|
40634
40816
|
* 合并部分run
|
|
@@ -40707,7 +40889,9 @@ class TextHandler {
|
|
|
40707
40889
|
const chars = text.split("");
|
|
40708
40890
|
let doc = context.doc;
|
|
40709
40891
|
chars.forEach((char, charIndex) => {
|
|
40710
|
-
const { width, height, ascent, descent } = TextRun.measureText(
|
|
40892
|
+
const { width, height, ascent, descent } = TextRun.measureText(
|
|
40893
|
+
TextRun.measurePayload(char, layoutStyle)
|
|
40894
|
+
);
|
|
40711
40895
|
const run = new TextRun({
|
|
40712
40896
|
doc,
|
|
40713
40897
|
width,
|
|
@@ -40823,18 +41007,41 @@ class FieldBaseHandler {
|
|
|
40823
41007
|
static hasValue(value) {
|
|
40824
41008
|
return value !== void 0 && value !== null;
|
|
40825
41009
|
}
|
|
41010
|
+
static getSubTableRunIndex(context) {
|
|
41011
|
+
const sub = context.cell?.subRenderer;
|
|
41012
|
+
if (!sub) return void 0;
|
|
41013
|
+
if (isLinkSubTableType(sub.type)) {
|
|
41014
|
+
if (sub.cellZone === "horizontal") {
|
|
41015
|
+
return sub.yDataIndex;
|
|
41016
|
+
}
|
|
41017
|
+
return sub.xDataIndex;
|
|
41018
|
+
}
|
|
41019
|
+
if (typeof sub.dataIndex === "number") {
|
|
41020
|
+
return sub.dataIndex;
|
|
41021
|
+
}
|
|
41022
|
+
return void 0;
|
|
41023
|
+
}
|
|
40826
41024
|
static getId(context, wr) {
|
|
40827
|
-
|
|
40828
|
-
|
|
40829
|
-
|
|
40830
|
-
|
|
40831
|
-
|
|
41025
|
+
const baseId = wr.id;
|
|
41026
|
+
const sub = context.cell?.subRenderer;
|
|
41027
|
+
if (sub && isLinkSubTableType(sub.type) && sub.cellZone === "cross" && typeof sub.yDataIndex === "number" && typeof sub.xDataIndex === "number") {
|
|
41028
|
+
return `${baseId}@${sub.yDataIndex}_${sub.xDataIndex}`;
|
|
41029
|
+
}
|
|
41030
|
+
const runIndex = this.getSubTableRunIndex(context);
|
|
41031
|
+
if (typeof runIndex === "number") {
|
|
41032
|
+
return `${baseId}@${runIndex}`;
|
|
40832
41033
|
}
|
|
40833
|
-
|
|
41034
|
+
if (context.type === "header" || context.type === "footer") {
|
|
41035
|
+
return `${baseId}$p${Math.max(0, context.page?.pageIndex ?? 0)}`;
|
|
41036
|
+
}
|
|
41037
|
+
return baseId;
|
|
40834
41038
|
}
|
|
40835
41039
|
static get2DInfo(context) {
|
|
40836
|
-
const { xDataIndex, yDataIndex } = context.cell?.subRenderer || {};
|
|
40837
|
-
return {
|
|
41040
|
+
const { xDataIndex, yDataIndex, cellZone } = context.cell?.subRenderer || {};
|
|
41041
|
+
return {
|
|
41042
|
+
xDataIndex: cellZone === "horizontal" ? void 0 : xDataIndex,
|
|
41043
|
+
yDataIndex
|
|
41044
|
+
};
|
|
40838
41045
|
}
|
|
40839
41046
|
static getValue(ctx, valuePath) {
|
|
40840
41047
|
const { context } = ctx;
|
|
@@ -40917,7 +41124,9 @@ class FieldBaseHandler {
|
|
|
40917
41124
|
position: "left"
|
|
40918
41125
|
});
|
|
40919
41126
|
chars.forEach((char, charIndex) => {
|
|
40920
|
-
const { width, height, ascent, descent } = TextRun.measureText(
|
|
41127
|
+
const { width, height, ascent, descent } = TextRun.measureText(
|
|
41128
|
+
TextRun.measurePayload(char, layoutStyle)
|
|
41129
|
+
);
|
|
40921
41130
|
const run = new TextWidget({
|
|
40922
41131
|
doc,
|
|
40923
41132
|
width,
|
|
@@ -40962,7 +41171,9 @@ class FieldBaseHandler {
|
|
|
40962
41171
|
position: "left"
|
|
40963
41172
|
});
|
|
40964
41173
|
chars.forEach((char, charIndex) => {
|
|
40965
|
-
const { width, height, ascent, descent } = TextRun.measureText(
|
|
41174
|
+
const { width, height, ascent, descent } = TextRun.measureText(
|
|
41175
|
+
TextRun.measurePayload(char, measureStyle)
|
|
41176
|
+
);
|
|
40966
41177
|
const run = new TextWidget({
|
|
40967
41178
|
doc,
|
|
40968
41179
|
width,
|
|
@@ -41036,7 +41247,9 @@ class FieldBaseHandler {
|
|
|
41036
41247
|
} = payload;
|
|
41037
41248
|
const style = { ...layoutStyle, fontSize };
|
|
41038
41249
|
label.split("").forEach((char, charIndex) => {
|
|
41039
|
-
const { width, height, ascent, descent } = TextRun.measureText(
|
|
41250
|
+
const { width, height, ascent, descent } = TextRun.measureText(
|
|
41251
|
+
TextRun.measurePayload(char, style)
|
|
41252
|
+
);
|
|
41040
41253
|
const run = new TextWidget({
|
|
41041
41254
|
doc: context.doc,
|
|
41042
41255
|
width,
|
|
@@ -41114,7 +41327,9 @@ class FieldBaseHandler {
|
|
|
41114
41327
|
} : {
|
|
41115
41328
|
widgetFieldRightMarker: true
|
|
41116
41329
|
};
|
|
41117
|
-
const { width, height, ascent, descent } = TextRun.measureText(
|
|
41330
|
+
const { width, height, ascent, descent } = TextRun.measureText(
|
|
41331
|
+
TextRun.measurePayload(label, measureStyle)
|
|
41332
|
+
);
|
|
41118
41333
|
const _width = position === "left" ? width + 2 : width + 3;
|
|
41119
41334
|
const run = new TextWidget({
|
|
41120
41335
|
doc: context.doc,
|
|
@@ -41241,6 +41456,8 @@ class ImageWidget extends ImageRun {
|
|
|
41241
41456
|
signature;
|
|
41242
41457
|
pageWidgetMeta;
|
|
41243
41458
|
dataIndex;
|
|
41459
|
+
xDataIndex;
|
|
41460
|
+
yDataIndex;
|
|
41244
41461
|
constructor(options) {
|
|
41245
41462
|
super(options);
|
|
41246
41463
|
this.src = options.src;
|
|
@@ -41249,6 +41466,8 @@ class ImageWidget extends ImageRun {
|
|
|
41249
41466
|
this.signature = options.signature;
|
|
41250
41467
|
this.pageWidgetMeta = options.pageWidgetMeta;
|
|
41251
41468
|
this.dataIndex = options.dataIndex;
|
|
41469
|
+
this.xDataIndex = options.xDataIndex;
|
|
41470
|
+
this.yDataIndex = options.yDataIndex;
|
|
41252
41471
|
}
|
|
41253
41472
|
}
|
|
41254
41473
|
class FieldImageHandler extends FieldBaseHandler {
|
|
@@ -41568,8 +41787,14 @@ class WidgetBaseHandler {
|
|
|
41568
41787
|
*/
|
|
41569
41788
|
getDataIndex(init2 = null) {
|
|
41570
41789
|
const { context } = this;
|
|
41571
|
-
const { type: type4, dataIndex, xDataIndex } = context.cell?.subRenderer || {};
|
|
41572
|
-
|
|
41790
|
+
const { type: type4, dataIndex, xDataIndex, yDataIndex, cellZone } = context.cell?.subRenderer || {};
|
|
41791
|
+
if (isLinkSubTableType(type4)) {
|
|
41792
|
+
if (cellZone === "horizontal") {
|
|
41793
|
+
return yDataIndex ?? init2;
|
|
41794
|
+
}
|
|
41795
|
+
return xDataIndex ?? init2;
|
|
41796
|
+
}
|
|
41797
|
+
return dataIndex ?? init2;
|
|
41573
41798
|
}
|
|
41574
41799
|
getPaperIndex() {
|
|
41575
41800
|
const { context } = this;
|
|
@@ -41579,21 +41804,28 @@ class WidgetBaseHandler {
|
|
|
41579
41804
|
return null;
|
|
41580
41805
|
}
|
|
41581
41806
|
getId() {
|
|
41582
|
-
const
|
|
41583
|
-
|
|
41807
|
+
const baseId = this.wr.id;
|
|
41808
|
+
const sub = this.context.cell?.subRenderer;
|
|
41809
|
+
if (sub && isLinkSubTableType(sub.type) && sub.cellZone === "cross" && typeof sub.yDataIndex === "number" && typeof sub.xDataIndex === "number") {
|
|
41810
|
+
return `${baseId}@${sub.yDataIndex}_${sub.xDataIndex}`;
|
|
41811
|
+
}
|
|
41584
41812
|
const dataIndex = this.getDataIndex();
|
|
41585
|
-
const pageIndex = this.getPaperIndex();
|
|
41586
41813
|
if (typeof dataIndex === "number") {
|
|
41587
|
-
|
|
41588
|
-
}
|
|
41589
|
-
|
|
41814
|
+
return `${baseId}@${dataIndex}`;
|
|
41815
|
+
}
|
|
41816
|
+
const pageIndex = this.getPaperIndex();
|
|
41817
|
+
if (typeof pageIndex === "number") {
|
|
41818
|
+
return `${baseId}$p${pageIndex}`;
|
|
41590
41819
|
}
|
|
41591
|
-
return
|
|
41820
|
+
return baseId;
|
|
41592
41821
|
}
|
|
41593
41822
|
get2DInfo() {
|
|
41594
41823
|
const { context } = this;
|
|
41595
|
-
const { xDataIndex, yDataIndex } = context.cell?.subRenderer || {};
|
|
41596
|
-
return {
|
|
41824
|
+
const { xDataIndex, yDataIndex, cellZone } = context.cell?.subRenderer || {};
|
|
41825
|
+
return {
|
|
41826
|
+
xDataIndex: cellZone === "horizontal" ? void 0 : xDataIndex,
|
|
41827
|
+
yDataIndex
|
|
41828
|
+
};
|
|
41597
41829
|
}
|
|
41598
41830
|
getLayoutStyle() {
|
|
41599
41831
|
const { wr, context } = this;
|
|
@@ -41609,7 +41841,7 @@ class SerialNumberHandler extends WidgetBaseHandler {
|
|
|
41609
41841
|
layout() {
|
|
41610
41842
|
const { wr, context } = this;
|
|
41611
41843
|
const layoutStyle = this.getLayoutStyle();
|
|
41612
|
-
const label = (
|
|
41844
|
+
const label = (this.getDataIndex() ?? 0) + 1 + "";
|
|
41613
41845
|
label.split("").forEach((char, charIndex) => {
|
|
41614
41846
|
const { width, height, ascent, descent } = TextRun.measureText(
|
|
41615
41847
|
TextRun.measurePayload(char, layoutStyle)
|
|
@@ -41698,7 +41930,11 @@ class QrCodeHandler extends WidgetBaseHandler {
|
|
|
41698
41930
|
start: 0,
|
|
41699
41931
|
end: 0
|
|
41700
41932
|
},
|
|
41701
|
-
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
|
|
41702
41938
|
});
|
|
41703
41939
|
context.addRun(run);
|
|
41704
41940
|
}
|
|
@@ -41738,7 +41974,7 @@ class BarcodeHandler extends WidgetBaseHandler {
|
|
|
41738
41974
|
layout() {
|
|
41739
41975
|
const { wr, context } = this;
|
|
41740
41976
|
const computedMap = wr.pageWidgetMeta?.props?.newSpecificConfig;
|
|
41741
|
-
const id =
|
|
41977
|
+
const id = this.getId();
|
|
41742
41978
|
const config = computedMap?.[id];
|
|
41743
41979
|
const width = config?.relWidth ?? wr.pageWidgetMeta?.layout?.width ?? 120;
|
|
41744
41980
|
const height = wr.pageWidgetMeta?.layout?.height ?? 40;
|
|
@@ -41757,7 +41993,10 @@ class BarcodeHandler extends WidgetBaseHandler {
|
|
|
41757
41993
|
end: 0
|
|
41758
41994
|
},
|
|
41759
41995
|
pageWidgetMeta: wr.pageWidgetMeta,
|
|
41760
|
-
|
|
41996
|
+
// todo
|
|
41997
|
+
dataIndex: this.getDataIndex() ?? void 0,
|
|
41998
|
+
xDataIndex: context.cell?.subRenderer?.xDataIndex,
|
|
41999
|
+
yDataIndex: context.cell?.subRenderer?.yDataIndex
|
|
41761
42000
|
});
|
|
41762
42001
|
if (decorationInfo.render) {
|
|
41763
42002
|
run.decorations = decorationInfo.decorations;
|
|
@@ -41805,7 +42044,11 @@ class DiagonalHandler extends WidgetBaseHandler {
|
|
|
41805
42044
|
start: 0,
|
|
41806
42045
|
end: 0
|
|
41807
42046
|
},
|
|
41808
|
-
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
|
|
41809
42052
|
});
|
|
41810
42053
|
context.addRun(run);
|
|
41811
42054
|
cell.skipSplitMeasure = true;
|
|
@@ -42518,12 +42761,16 @@ function splitTableByHeight(table, maxHeight) {
|
|
|
42518
42761
|
console.timeEnd(key);
|
|
42519
42762
|
return result;
|
|
42520
42763
|
}
|
|
42764
|
+
const cellKey = (row, col) => `${row},${col}`;
|
|
42521
42765
|
class TableExpander {
|
|
42522
42766
|
table;
|
|
42523
42767
|
doc;
|
|
42524
42768
|
data;
|
|
42769
|
+
/** 模板节点 id → Wtr / Wtc */
|
|
42525
42770
|
modelMapper = /* @__PURE__ */ new Map();
|
|
42771
|
+
/** 展开实例 id → RowFragment / CellFragment */
|
|
42526
42772
|
instanceMapper = /* @__PURE__ */ new Map();
|
|
42773
|
+
/** 模板行索引 → 各类逻辑区域(用于按行分发展开策略) */
|
|
42527
42774
|
rowIndexRepeatingMapper = /* @__PURE__ */ new Map();
|
|
42528
42775
|
rowIndex2DTableMapper = /* @__PURE__ */ new Map();
|
|
42529
42776
|
rowIndexBoundedMapper = /* @__PURE__ */ new Map();
|
|
@@ -42531,11 +42778,13 @@ class TableExpander {
|
|
|
42531
42778
|
rowIndexTableHeaderMapper = /* @__PURE__ */ new Map();
|
|
42532
42779
|
rowIdTableHeaderMapper = /* @__PURE__ */ new Map();
|
|
42533
42780
|
rowIdSubTableMapper = /* @__PURE__ */ new Map();
|
|
42781
|
+
/** 固定表 / 检验表 / 二维表:数据关联铺砖后的单元格数据索引 */
|
|
42534
42782
|
boundedCellDataIndexMap = /* @__PURE__ */ new Map();
|
|
42535
42783
|
checkTableCellDataIndexMap = /* @__PURE__ */ new Map();
|
|
42536
42784
|
_2DTableCellDataIndexMap = /* @__PURE__ */ new Map();
|
|
42785
|
+
/** 展开后的行列表(按文档顺序) */
|
|
42537
42786
|
rows = [];
|
|
42538
|
-
|
|
42787
|
+
/** 表头区域 id → 该区域包含的模板行 id 列表 */
|
|
42539
42788
|
regionIdTableHeaderMetaMap = /* @__PURE__ */ new Map();
|
|
42540
42789
|
constructor(table, doc) {
|
|
42541
42790
|
this.table = table;
|
|
@@ -42546,373 +42795,371 @@ class TableExpander {
|
|
|
42546
42795
|
getModelById(id) {
|
|
42547
42796
|
return this.modelMapper.get(id);
|
|
42548
42797
|
}
|
|
42798
|
+
// ─── 初始化入口 ─────────────────────────────────────────────
|
|
42549
42799
|
initialize() {
|
|
42550
42800
|
this.initializeModelMapper();
|
|
42551
|
-
this.
|
|
42552
|
-
this.initialize2DTableMapper();
|
|
42553
|
-
this.initializeBoundedMapper();
|
|
42554
|
-
this.initializeCheckTableMapper();
|
|
42555
|
-
this.initializeTableHeaderMapper();
|
|
42801
|
+
this.initializeRegionMappers();
|
|
42556
42802
|
this.initializeBoundedItemDataIndex();
|
|
42557
42803
|
this.initializeDataGroup2DDataIndex();
|
|
42558
42804
|
this.initializeRows();
|
|
42559
42805
|
this.transformMergeRelations();
|
|
42560
42806
|
}
|
|
42561
42807
|
initializeModelMapper() {
|
|
42562
|
-
this.table.rows
|
|
42808
|
+
for (const wtr of this.table.rows) {
|
|
42563
42809
|
this.modelMapper.set(wtr.id, wtr);
|
|
42564
|
-
wtr.cells
|
|
42810
|
+
for (const wtc of wtr.cells) {
|
|
42565
42811
|
this.modelMapper.set(wtc.id, wtc);
|
|
42566
|
-
});
|
|
42567
|
-
});
|
|
42568
|
-
}
|
|
42569
|
-
initializeRepeatingMapper() {
|
|
42570
|
-
this.table.repeating.forEach((region) => {
|
|
42571
|
-
for (let r = region.start.row; r <= region.end.row; r++) {
|
|
42572
|
-
this.rowIndexRepeatingMapper.set(r, region);
|
|
42573
|
-
this.rowIdSubTableMapper.set(this.table.rows[r]?.id, region);
|
|
42574
|
-
}
|
|
42575
|
-
});
|
|
42576
|
-
}
|
|
42577
|
-
initialize2DTableMapper() {
|
|
42578
|
-
this.table._2DTable.forEach((region) => {
|
|
42579
|
-
for (let r = region.start.row; r <= region.end.row; r++) {
|
|
42580
|
-
this.rowIndex2DTableMapper.set(r, region);
|
|
42581
|
-
this.rowIdSubTableMapper.set(this.table.rows[r]?.id, region);
|
|
42582
42812
|
}
|
|
42583
|
-
}
|
|
42813
|
+
}
|
|
42584
42814
|
}
|
|
42585
|
-
|
|
42586
|
-
|
|
42587
|
-
|
|
42588
|
-
|
|
42589
|
-
|
|
42590
|
-
|
|
42591
|
-
|
|
42815
|
+
/** 建立模板行索引 / 行 id 与各类子表、表头区域的映射 */
|
|
42816
|
+
initializeRegionMappers() {
|
|
42817
|
+
this.registerRowsForRegions(this.table.repeating, this.rowIndexRepeatingMapper);
|
|
42818
|
+
this.registerRowsForRegions(this.table._2DTable, this.rowIndex2DTableMapper);
|
|
42819
|
+
this.registerRowsForRegions(this.table.bounded, this.rowIndexBoundedMapper);
|
|
42820
|
+
this.registerRowsForRegions(this.table.checkTable, this.rowIndexCheckTableMapper);
|
|
42821
|
+
this.initializeTableHeaderMapper();
|
|
42592
42822
|
}
|
|
42593
|
-
|
|
42594
|
-
|
|
42823
|
+
registerRowsForRegions(regions, rowIndexMapper) {
|
|
42824
|
+
for (const region of regions) {
|
|
42595
42825
|
for (let r = region.start.row; r <= region.end.row; r++) {
|
|
42596
|
-
|
|
42597
|
-
this.
|
|
42826
|
+
rowIndexMapper.set(r, region);
|
|
42827
|
+
const rowId = this.table.rows[r]?.id;
|
|
42828
|
+
if (rowId) this.rowIdSubTableMapper.set(rowId, region);
|
|
42598
42829
|
}
|
|
42599
|
-
}
|
|
42830
|
+
}
|
|
42600
42831
|
}
|
|
42601
42832
|
initializeTableHeaderMapper() {
|
|
42602
|
-
this.table.tableHeader
|
|
42833
|
+
for (const region of this.table.tableHeader) {
|
|
42603
42834
|
const tableHeaderRowIds = [];
|
|
42604
42835
|
for (let r = region.start.row; r <= region.end.row; r++) {
|
|
42605
42836
|
this.rowIndexTableHeaderMapper.set(r, region);
|
|
42606
|
-
this.rowIdTableHeaderMapper.set(this.table.getChildAt(r).id, region);
|
|
42607
42837
|
const wtr = this.table.rows[r];
|
|
42838
|
+
this.rowIdTableHeaderMapper.set(wtr.id, region);
|
|
42608
42839
|
tableHeaderRowIds.push(wtr.id);
|
|
42609
42840
|
}
|
|
42610
|
-
this.regionIdTableHeaderMetaMap.set(region.id, {
|
|
42611
|
-
|
|
42612
|
-
});
|
|
42613
|
-
});
|
|
42841
|
+
this.regionIdTableHeaderMetaMap.set(region.id, { rowIds: tableHeaderRowIds });
|
|
42842
|
+
}
|
|
42614
42843
|
}
|
|
42615
42844
|
initializeBoundedItemDataIndex() {
|
|
42616
|
-
this.table.bounded
|
|
42617
|
-
if (region.itemRegion)
|
|
42618
|
-
|
|
42619
|
-
|
|
42620
|
-
|
|
42621
|
-
|
|
42622
|
-
|
|
42623
|
-
|
|
42624
|
-
});
|
|
42625
|
-
});
|
|
42626
|
-
}
|
|
42627
|
-
});
|
|
42845
|
+
for (const region of this.table.bounded) {
|
|
42846
|
+
if (!region.itemRegion) continue;
|
|
42847
|
+
const fillDirection = region.widgetMeta?.props?.fillDirection ?? "x";
|
|
42848
|
+
this.mergeIndexMap(
|
|
42849
|
+
this.boundedCellDataIndexMap,
|
|
42850
|
+
this.computeDataIndexMap(region, region.itemRegion, fillDirection)
|
|
42851
|
+
);
|
|
42852
|
+
}
|
|
42628
42853
|
}
|
|
42629
|
-
|
|
42854
|
+
/**
|
|
42855
|
+
* 检验表 / 二维表的数据关联区:itemRegion 可能超出子表行范围(向上/下扩充),
|
|
42856
|
+
* 展开铺砖时需用扩充后的行范围。
|
|
42857
|
+
*/
|
|
42630
42858
|
getDataGroup2DItemRange(range3, itemRange) {
|
|
42631
|
-
const {
|
|
42632
|
-
start: { row: startRow },
|
|
42633
|
-
end: { row: endRow }
|
|
42634
|
-
} = itemRange;
|
|
42635
42859
|
const expandedRange = cloneDeep(pick(range3, "start", "end"));
|
|
42636
|
-
expandedRange.start.row =
|
|
42637
|
-
expandedRange.end.row =
|
|
42860
|
+
expandedRange.start.row = itemRange.start.row;
|
|
42861
|
+
expandedRange.end.row = itemRange.end.row;
|
|
42638
42862
|
return expandedRange;
|
|
42639
42863
|
}
|
|
42640
42864
|
initializeDataGroup2DDataIndex() {
|
|
42641
|
-
this.table.checkTable.
|
|
42642
|
-
|
|
42643
|
-
|
|
42644
|
-
|
|
42645
|
-
|
|
42646
|
-
|
|
42647
|
-
|
|
42648
|
-
|
|
42649
|
-
|
|
42650
|
-
|
|
42651
|
-
|
|
42652
|
-
|
|
42653
|
-
|
|
42654
|
-
|
|
42655
|
-
|
|
42656
|
-
|
|
42657
|
-
map2.forEach((obj, key) => {
|
|
42658
|
-
this._2DTableCellDataIndexMap.set(key, {
|
|
42659
|
-
dataIndex: obj.dataIndex,
|
|
42660
|
-
refCellId: obj.refCellId
|
|
42661
|
-
});
|
|
42662
|
-
});
|
|
42663
|
-
}
|
|
42865
|
+
this.initLinkSubTableCellIndexMaps(this.table.checkTable, this.checkTableCellDataIndexMap);
|
|
42866
|
+
this.initLinkSubTableCellIndexMaps(this.table._2DTable, this._2DTableCellDataIndexMap);
|
|
42867
|
+
}
|
|
42868
|
+
initLinkSubTableCellIndexMaps(regions, target) {
|
|
42869
|
+
for (const region of regions) {
|
|
42870
|
+
if (!region.itemRegion) continue;
|
|
42871
|
+
const expandedRange = this.getDataGroup2DItemRange(region, region.itemRegion);
|
|
42872
|
+
this.mergeIndexMap(target, this.computeDataIndexMap(expandedRange, region.itemRegion));
|
|
42873
|
+
}
|
|
42874
|
+
}
|
|
42875
|
+
mergeIndexMap(target, source) {
|
|
42876
|
+
source.forEach((meta, key) => {
|
|
42877
|
+
target.set(key, {
|
|
42878
|
+
dataIndex: meta.dataIndex,
|
|
42879
|
+
refCellId: meta.refCellId
|
|
42880
|
+
});
|
|
42664
42881
|
});
|
|
42665
42882
|
}
|
|
42883
|
+
// ─── 按行展开 ───────────────────────────────────────────────
|
|
42666
42884
|
initializeRows() {
|
|
42667
|
-
for (let
|
|
42668
|
-
const wtr = this.table.rows[
|
|
42669
|
-
if (this.rowIndexRepeatingMapper.has(
|
|
42670
|
-
const region = this.rowIndexRepeatingMapper.get(
|
|
42671
|
-
if (
|
|
42885
|
+
for (let rowIndex = 0; rowIndex < this.table.rows.length; rowIndex++) {
|
|
42886
|
+
const wtr = this.table.rows[rowIndex];
|
|
42887
|
+
if (this.rowIndexRepeatingMapper.has(rowIndex)) {
|
|
42888
|
+
const region = this.rowIndexRepeatingMapper.get(rowIndex);
|
|
42889
|
+
if (rowIndex === region.start.row) {
|
|
42672
42890
|
this.initializeRepeatingRowsInRange(region);
|
|
42673
42891
|
}
|
|
42674
|
-
} else if (this.rowIndex2DTableMapper.has(
|
|
42675
|
-
const region = this.rowIndex2DTableMapper.get(
|
|
42676
|
-
if (
|
|
42677
|
-
this.initialize2DTableRowsInRange(
|
|
42892
|
+
} else if (this.rowIndex2DTableMapper.has(rowIndex)) {
|
|
42893
|
+
const region = this.rowIndex2DTableMapper.get(rowIndex);
|
|
42894
|
+
if (rowIndex === region.start.row) {
|
|
42895
|
+
this.initialize2DTableRowsInRange(rowIndex, region);
|
|
42678
42896
|
}
|
|
42679
|
-
} else if (this.rowIndexBoundedMapper.has(
|
|
42680
|
-
|
|
42681
|
-
|
|
42682
|
-
|
|
42683
|
-
|
|
42684
|
-
|
|
42685
|
-
|
|
42686
|
-
|
|
42687
|
-
|
|
42897
|
+
} else if (this.rowIndexBoundedMapper.has(rowIndex)) {
|
|
42898
|
+
this.initializeBoundedRowInRange(wtr, rowIndex, this.rowIndexBoundedMapper.get(rowIndex));
|
|
42899
|
+
} else if (this.rowIndexCheckTableMapper.has(rowIndex)) {
|
|
42900
|
+
this.initializeCheckTableRowInRange(
|
|
42901
|
+
wtr,
|
|
42902
|
+
rowIndex,
|
|
42903
|
+
this.rowIndexCheckTableMapper.get(rowIndex)
|
|
42904
|
+
);
|
|
42905
|
+
} else if (this.rowIndexTableHeaderMapper.has(rowIndex)) {
|
|
42906
|
+
this.initializeTableHeaderRowInRange(wtr, this.rowIndexTableHeaderMapper.get(rowIndex));
|
|
42688
42907
|
} else {
|
|
42689
|
-
this.initializeNormalRowInRange(wtr,
|
|
42908
|
+
this.initializeNormalRowInRange(wtr, rowIndex);
|
|
42690
42909
|
}
|
|
42691
42910
|
}
|
|
42692
42911
|
}
|
|
42912
|
+
/** 编辑模式只展开一份;预览/填报模式按数据路径长度重复 */
|
|
42693
42913
|
getRepeatCount(region) {
|
|
42694
|
-
if (this.doc.mode === DocModeTypeConst.Edit)
|
|
42695
|
-
|
|
42696
|
-
}
|
|
42697
|
-
return this.data.get(region.valuePath)?.length || 1;
|
|
42914
|
+
if (this.doc.mode === DocModeTypeConst.Edit) return 1;
|
|
42915
|
+
return this.data.get(region.subValuePath || region.valuePath)?.length || 1;
|
|
42698
42916
|
}
|
|
42917
|
+
// ─── 循环子表 / 二维子表(纵向重复)────────────────────────
|
|
42699
42918
|
initializeRepeatingRowsInRange(region) {
|
|
42700
|
-
|
|
42701
|
-
|
|
42702
|
-
|
|
42703
|
-
|
|
42704
|
-
|
|
42705
|
-
|
|
42706
|
-
|
|
42707
|
-
|
|
42708
|
-
|
|
42709
|
-
|
|
42710
|
-
|
|
42711
|
-
|
|
42712
|
-
id: `${wtc.id}@${dataIndex}`,
|
|
42713
|
-
expandFromId: wtc.id,
|
|
42714
|
-
rowspan: (wtc.rowspan ?? 1) + repeatRowsCount * (repeatCount - 1),
|
|
42715
|
-
colspan: wtc.colspan ?? 1
|
|
42716
|
-
};
|
|
42717
|
-
this.instanceMapper.set(cell2.id, cell2);
|
|
42718
|
-
return cell2;
|
|
42719
|
-
} else {
|
|
42720
|
-
const instanceCell = this.instanceMapper.get(`${wtc.mergeFromId}@0`) ?? this.instanceMapper.get(wtc.mergeFromId);
|
|
42721
|
-
instanceCell.rowspan = (instanceCell.rowspan ?? 1) + repeatRowsCount * (repeatCount - 1);
|
|
42722
|
-
}
|
|
42723
|
-
}
|
|
42724
|
-
const cell = {
|
|
42725
|
-
id: `${wtc.id}@${dataIndex}`,
|
|
42726
|
-
expandFromId: wtc.id,
|
|
42727
|
-
rowspan: wtc.rowspan ?? 1,
|
|
42728
|
-
colspan: wtc.colspan ?? 1
|
|
42729
|
-
};
|
|
42730
|
-
if (region.contains(region.start.row + _wtrIndex, wtcIndex)) {
|
|
42731
|
-
cell.dataIndex = this.doc.mode === DocModeTypeConst.Edit ? void 0 : dataIndex;
|
|
42732
|
-
cell.repeatingId = region.id;
|
|
42733
|
-
}
|
|
42734
|
-
this.instanceMapper.set(cell.id, cell);
|
|
42735
|
-
return cell;
|
|
42736
|
-
})
|
|
42737
|
-
};
|
|
42738
|
-
this.instanceMapper.set(row.id, row);
|
|
42739
|
-
this.rows.push(row);
|
|
42740
|
-
});
|
|
42919
|
+
this.initializeRepeatableSubTableRows(region, (templateRow, col, dataIndex) => {
|
|
42920
|
+
const cell = {
|
|
42921
|
+
id: "",
|
|
42922
|
+
expandFromId: "",
|
|
42923
|
+
rowspan: 1,
|
|
42924
|
+
colspan: 1
|
|
42925
|
+
};
|
|
42926
|
+
if (region.contains(templateRow, col)) {
|
|
42927
|
+
cell.dataIndex = this.doc.mode === DocModeTypeConst.Edit ? void 0 : dataIndex;
|
|
42928
|
+
cell.repeatingId = region.id;
|
|
42929
|
+
}
|
|
42930
|
+
return cell;
|
|
42741
42931
|
});
|
|
42742
42932
|
}
|
|
42743
|
-
initialize2DTableRowsInRange(
|
|
42933
|
+
initialize2DTableRowsInRange(regionStartRow, region) {
|
|
42934
|
+
this.initializeRepeatableSubTableRows(
|
|
42935
|
+
region,
|
|
42936
|
+
(templateRow, col, yDataIndex, wtc) => {
|
|
42937
|
+
const dataIndexMeta = this._2DTableCellDataIndexMap.get(cellKey(templateRow, col));
|
|
42938
|
+
const linkMeta = this.resolveLinkSubTableCellMeta(templateRow, col, region, dataIndexMeta);
|
|
42939
|
+
const cell = {
|
|
42940
|
+
id: "",
|
|
42941
|
+
expandFromId: linkMeta.expandFromId || wtc.id,
|
|
42942
|
+
rowspan: wtc.rowspan ?? 1,
|
|
42943
|
+
colspan: wtc.colspan ?? 1,
|
|
42944
|
+
xDataIndex: linkMeta.xDataIndex,
|
|
42945
|
+
cellZone: linkMeta.cellZone
|
|
42946
|
+
};
|
|
42947
|
+
if (region.contains(templateRow, col)) {
|
|
42948
|
+
cell.yDataIndex = this.doc.mode === DocModeTypeConst.Edit ? void 0 : yDataIndex;
|
|
42949
|
+
}
|
|
42950
|
+
if (linkMeta.cellZone) {
|
|
42951
|
+
cell._2DTableId = region.id;
|
|
42952
|
+
}
|
|
42953
|
+
return cell;
|
|
42954
|
+
},
|
|
42955
|
+
regionStartRow
|
|
42956
|
+
);
|
|
42957
|
+
}
|
|
42958
|
+
/**
|
|
42959
|
+
* 循环子表与二维子表共用的纵向展开逻辑:
|
|
42960
|
+
* 按数据条数复制行块,区域外最后一行单元格需合并 rowspan 以覆盖重复产生的额外行。
|
|
42961
|
+
*/
|
|
42962
|
+
initializeRepeatableSubTableRows(region, enrichCell, regionStartRow = region.start.row) {
|
|
42744
42963
|
const repeatCount = this.getRepeatCount(region);
|
|
42745
|
-
const
|
|
42746
|
-
const
|
|
42747
|
-
|
|
42748
|
-
|
|
42964
|
+
const templateRows = this.table.children.slice(region.start.row, region.end.row + 1);
|
|
42965
|
+
const templateRowCount = templateRows.length;
|
|
42966
|
+
const extraRowspan = templateRowCount * (repeatCount - 1);
|
|
42967
|
+
repeat(repeatCount, (dataIndex) => {
|
|
42968
|
+
templateRows.forEach((wtr, rowOffset) => {
|
|
42969
|
+
const templateRow = regionStartRow + rowOffset;
|
|
42970
|
+
const isLastTemplateRow = rowOffset === templateRowCount - 1;
|
|
42749
42971
|
const row = {
|
|
42750
|
-
id: `${
|
|
42751
|
-
expandFromId:
|
|
42752
|
-
cells:
|
|
42753
|
-
const
|
|
42754
|
-
const
|
|
42755
|
-
|
|
42756
|
-
|
|
42757
|
-
|
|
42758
|
-
|
|
42759
|
-
|
|
42760
|
-
|
|
42761
|
-
|
|
42762
|
-
|
|
42763
|
-
|
|
42764
|
-
|
|
42765
|
-
|
|
42766
|
-
const instanceCell = this.instanceMapper.get(`${wtc.mergeFromId}@0`) ?? this.instanceMapper.get(wtc.mergeFromId);
|
|
42767
|
-
instanceCell.rowspan = (instanceCell.rowspan ?? 1) + repeatRowsCount * (repeatCount - 1);
|
|
42768
|
-
}
|
|
42769
|
-
}
|
|
42770
|
-
const cell = {
|
|
42771
|
-
id: `${wtc.id}@${yDataIndex}`,
|
|
42772
|
-
expandFromId: dataIndexMeta?.refCellId || wtc.id,
|
|
42773
|
-
rowspan: wtc.rowspan ?? 1,
|
|
42774
|
-
colspan: wtc.colspan ?? 1,
|
|
42775
|
-
xDataIndex
|
|
42776
|
-
};
|
|
42777
|
-
if (region.contains(region.start.row + _wtrIndex, wtcIndex)) {
|
|
42778
|
-
cell.dataIndex = yDataIndex;
|
|
42779
|
-
cell.yDataIndex = yDataIndex;
|
|
42780
|
-
cell._2DTableId = region.id;
|
|
42781
|
-
}
|
|
42972
|
+
id: `${wtr.id}@${dataIndex}`,
|
|
42973
|
+
expandFromId: wtr.id,
|
|
42974
|
+
cells: wtr.children.map((wtc, col) => {
|
|
42975
|
+
const outsideRegion = dataIndex === 0 && isLastTemplateRow && (col < region.start.col || col > region.end.col);
|
|
42976
|
+
const extended = this.tryCreateExtendedRowspanCell(
|
|
42977
|
+
wtc,
|
|
42978
|
+
dataIndex,
|
|
42979
|
+
outsideRegion,
|
|
42980
|
+
extraRowspan
|
|
42981
|
+
);
|
|
42982
|
+
if (extended) return extended;
|
|
42983
|
+
const cell = enrichCell(templateRow, col, dataIndex, wtc);
|
|
42984
|
+
cell.id = `${wtc.id}@${dataIndex}`;
|
|
42985
|
+
if (!cell.expandFromId) cell.expandFromId = wtc.id;
|
|
42986
|
+
cell.rowspan = wtc.rowspan ?? 1;
|
|
42987
|
+
cell.colspan = wtc.colspan ?? 1;
|
|
42782
42988
|
this.instanceMapper.set(cell.id, cell);
|
|
42783
42989
|
return cell;
|
|
42784
42990
|
})
|
|
42785
42991
|
};
|
|
42786
|
-
this.
|
|
42787
|
-
this.rows.push(row);
|
|
42992
|
+
this.pushRow(row);
|
|
42788
42993
|
});
|
|
42789
42994
|
});
|
|
42790
42995
|
}
|
|
42791
|
-
|
|
42792
|
-
|
|
42793
|
-
|
|
42794
|
-
|
|
42795
|
-
|
|
42796
|
-
|
|
42797
|
-
|
|
42798
|
-
|
|
42799
|
-
|
|
42800
|
-
|
|
42801
|
-
|
|
42802
|
-
|
|
42803
|
-
|
|
42804
|
-
|
|
42996
|
+
/**
|
|
42997
|
+
* 循环区域外、首条数据最后一行:将 rowspan 拉长以吞并后续重复行,
|
|
42998
|
+
* 避免区域外单元格被拆成多行。
|
|
42999
|
+
*/
|
|
43000
|
+
tryCreateExtendedRowspanCell(wtc, dataIndex, shouldExtend, extraRowspan) {
|
|
43001
|
+
if (!shouldExtend) return void 0;
|
|
43002
|
+
if (!wtc.mergeFromId) {
|
|
43003
|
+
const cell = {
|
|
43004
|
+
id: `${wtc.id}@${dataIndex}`,
|
|
43005
|
+
expandFromId: wtc.id,
|
|
43006
|
+
rowspan: (wtc.rowspan ?? 1) + extraRowspan,
|
|
43007
|
+
colspan: wtc.colspan ?? 1
|
|
43008
|
+
};
|
|
43009
|
+
this.instanceMapper.set(cell.id, cell);
|
|
43010
|
+
return cell;
|
|
43011
|
+
}
|
|
43012
|
+
const anchor = this.instanceMapper.get(`${wtc.mergeFromId}@0`) ?? this.instanceMapper.get(wtc.mergeFromId);
|
|
43013
|
+
if (anchor) {
|
|
43014
|
+
anchor.rowspan = (anchor.rowspan ?? 1) + extraRowspan;
|
|
43015
|
+
}
|
|
43016
|
+
return void 0;
|
|
43017
|
+
}
|
|
43018
|
+
// ─── 单行区域(固定表 / 检验表 / 表头 / 普通行)────────────
|
|
43019
|
+
initializeBoundedRowInRange(wtr, rowIndex, region) {
|
|
43020
|
+
this.pushRow(
|
|
43021
|
+
this.buildSingleTemplateRow(wtr, (wtc, col) => {
|
|
43022
|
+
const dataIndexMeta = this.boundedCellDataIndexMap.get(cellKey(rowIndex, col));
|
|
43023
|
+
const cell = this.createTemplateCell(wtc, dataIndexMeta?.refCellId);
|
|
43024
|
+
if (region.start.col <= col && col <= region.end.col) {
|
|
42805
43025
|
cell.boundedId = region.id;
|
|
42806
43026
|
}
|
|
42807
43027
|
if (dataIndexMeta?.dataIndex !== void 0) {
|
|
42808
43028
|
cell.dataIndex = dataIndexMeta.dataIndex;
|
|
42809
43029
|
}
|
|
42810
|
-
this.instanceMapper.set(cell.id, cell);
|
|
42811
43030
|
return cell;
|
|
42812
43031
|
})
|
|
42813
|
-
|
|
42814
|
-
this.instanceMapper.set(row.id, row);
|
|
42815
|
-
this.rows.push(row);
|
|
43032
|
+
);
|
|
42816
43033
|
}
|
|
42817
|
-
initializeCheckTableRowInRange(wtr,
|
|
42818
|
-
|
|
42819
|
-
|
|
42820
|
-
|
|
42821
|
-
|
|
42822
|
-
const
|
|
42823
|
-
|
|
42824
|
-
|
|
42825
|
-
|
|
42826
|
-
|
|
42827
|
-
|
|
42828
|
-
|
|
42829
|
-
};
|
|
42830
|
-
if (region.start.col <= wtcIndex && wtcIndex <= region.end.col) {
|
|
42831
|
-
cell.checkTableId = region.id;
|
|
42832
|
-
}
|
|
42833
|
-
if (dataIndexMeta?.dataIndex !== void 0) {
|
|
42834
|
-
cell.dataIndex = dataIndexMeta.dataIndex;
|
|
42835
|
-
}
|
|
42836
|
-
this.instanceMapper.set(cell.id, cell);
|
|
43034
|
+
initializeCheckTableRowInRange(wtr, rowIndex, region) {
|
|
43035
|
+
this.pushRow(
|
|
43036
|
+
this.buildSingleTemplateRow(wtr, (wtc, col) => {
|
|
43037
|
+
const dataIndexMeta = this.checkTableCellDataIndexMap.get(cellKey(rowIndex, col));
|
|
43038
|
+
const linkMeta = this.resolveLinkSubTableCellMeta(rowIndex, col, region, dataIndexMeta);
|
|
43039
|
+
const cell = this.createTemplateCell(
|
|
43040
|
+
wtc,
|
|
43041
|
+
linkMeta.expandFromId,
|
|
43042
|
+
linkMeta.xDataIndex,
|
|
43043
|
+
linkMeta.cellZone
|
|
43044
|
+
);
|
|
43045
|
+
if (linkMeta.cellZone) cell.checkTableId = region.id;
|
|
42837
43046
|
return cell;
|
|
42838
43047
|
})
|
|
42839
|
-
|
|
42840
|
-
this.instanceMapper.set(row.id, row);
|
|
42841
|
-
this.rows.push(row);
|
|
43048
|
+
);
|
|
42842
43049
|
}
|
|
42843
43050
|
initializeTableHeaderRowInRange(wtr, region) {
|
|
42844
|
-
|
|
42845
|
-
|
|
42846
|
-
|
|
42847
|
-
|
|
42848
|
-
const cell = {
|
|
42849
|
-
id: wtc.id,
|
|
42850
|
-
expandFromId: wtc.id,
|
|
42851
|
-
rowspan: wtc.rowspan ?? 1,
|
|
42852
|
-
colspan: wtc.colspan ?? 1
|
|
42853
|
-
};
|
|
42854
|
-
if (region.start.col <= wtcIndex && wtcIndex <= region.end.col) {
|
|
43051
|
+
this.pushRow(
|
|
43052
|
+
this.buildSingleTemplateRow(wtr, (wtc, col) => {
|
|
43053
|
+
const cell = this.createTemplateCell(wtc);
|
|
43054
|
+
if (region.start.col <= col && col <= region.end.col) {
|
|
42855
43055
|
cell.headerId = region.id;
|
|
42856
43056
|
}
|
|
42857
|
-
this.instanceMapper.set(cell.id, cell);
|
|
42858
43057
|
return cell;
|
|
42859
43058
|
})
|
|
42860
|
-
|
|
42861
|
-
this.instanceMapper.set(row.id, row);
|
|
42862
|
-
this.rows.push(row);
|
|
43059
|
+
);
|
|
42863
43060
|
}
|
|
42864
|
-
initializeNormalRowInRange(wtr,
|
|
42865
|
-
|
|
43061
|
+
initializeNormalRowInRange(wtr, rowIndex) {
|
|
43062
|
+
this.pushRow(
|
|
43063
|
+
this.buildSingleTemplateRow(wtr, (wtc, col) => {
|
|
43064
|
+
const dataIndexMeta = this.checkTableCellDataIndexMap.get(cellKey(rowIndex, col)) ?? this._2DTableCellDataIndexMap.get(cellKey(rowIndex, col));
|
|
43065
|
+
const linkRegion = this.findLinkSubTableRegionForCell(rowIndex, col);
|
|
43066
|
+
const cell = this.createTemplateCell(wtc, dataIndexMeta?.refCellId);
|
|
43067
|
+
if (linkRegion) {
|
|
43068
|
+
const linkMeta = this.resolveLinkSubTableCellMeta(
|
|
43069
|
+
rowIndex,
|
|
43070
|
+
col,
|
|
43071
|
+
linkRegion,
|
|
43072
|
+
dataIndexMeta
|
|
43073
|
+
);
|
|
43074
|
+
cell.expandFromId = linkMeta.expandFromId || wtc.id;
|
|
43075
|
+
cell.xDataIndex = linkMeta.xDataIndex;
|
|
43076
|
+
cell.cellZone = linkMeta.cellZone;
|
|
43077
|
+
if (linkRegion.type === "check-table") {
|
|
43078
|
+
cell.checkTableId = linkRegion.id;
|
|
43079
|
+
} else {
|
|
43080
|
+
cell._2DTableId = linkRegion.id;
|
|
43081
|
+
}
|
|
43082
|
+
}
|
|
43083
|
+
return cell;
|
|
43084
|
+
})
|
|
43085
|
+
);
|
|
43086
|
+
}
|
|
43087
|
+
buildSingleTemplateRow(wtr, buildCell) {
|
|
43088
|
+
return {
|
|
42866
43089
|
id: wtr.id,
|
|
42867
43090
|
expandFromId: wtr.id,
|
|
42868
|
-
cells: wtr.children.map((wtc,
|
|
42869
|
-
const
|
|
42870
|
-
const _2DMeta = this._2DTableCellDataIndexMap.get(`${wtrIndex},${wtcIndex}`);
|
|
42871
|
-
const dataGroup2DRefCellId = checkMeta?.refCellId || _2DMeta?.refCellId;
|
|
42872
|
-
const cell = {
|
|
42873
|
-
id: wtc.id,
|
|
42874
|
-
expandFromId: dataGroup2DRefCellId || wtc.id,
|
|
42875
|
-
rowspan: wtc.rowspan ?? 1,
|
|
42876
|
-
colspan: wtc.colspan ?? 1
|
|
42877
|
-
};
|
|
43091
|
+
cells: wtr.children.map((wtc, col) => {
|
|
43092
|
+
const cell = buildCell(wtc, col);
|
|
42878
43093
|
this.instanceMapper.set(cell.id, cell);
|
|
42879
43094
|
return cell;
|
|
42880
43095
|
})
|
|
42881
43096
|
};
|
|
43097
|
+
}
|
|
43098
|
+
createTemplateCell(wtc, expandFromId, xDataIndex, cellZone) {
|
|
43099
|
+
return {
|
|
43100
|
+
id: wtc.id,
|
|
43101
|
+
expandFromId: expandFromId ?? wtc.id,
|
|
43102
|
+
rowspan: wtc.rowspan ?? 1,
|
|
43103
|
+
colspan: wtc.colspan ?? 1,
|
|
43104
|
+
...xDataIndex !== void 0 && { xDataIndex },
|
|
43105
|
+
...cellZone !== void 0 && { cellZone }
|
|
43106
|
+
};
|
|
43107
|
+
}
|
|
43108
|
+
pushRow(row) {
|
|
42882
43109
|
this.instanceMapper.set(row.id, row);
|
|
42883
43110
|
this.rows.push(row);
|
|
42884
43111
|
}
|
|
43112
|
+
// ─── 数据关联子表(检验表 / 二维表)元信息 ─────────────────
|
|
43113
|
+
getLinkSubTableCellIndexMap(region) {
|
|
43114
|
+
return region.type === "2d-table" ? this._2DTableCellDataIndexMap : this.checkTableCellDataIndexMap;
|
|
43115
|
+
}
|
|
43116
|
+
getFillEndColForRegion(region) {
|
|
43117
|
+
return getDataGroup2DFillEndCol(region, this.getLinkSubTableCellIndexMap(region));
|
|
43118
|
+
}
|
|
43119
|
+
findLinkSubTableRegionForCell(row, col) {
|
|
43120
|
+
const candidates = [...this.table.checkTable, ...this.table._2DTable];
|
|
43121
|
+
for (const region of candidates) {
|
|
43122
|
+
const fillEndCol = this.getFillEndColForRegion(region);
|
|
43123
|
+
if (isInLinkSubTableLayoutScope(row, col, region, { fillEndCol })) {
|
|
43124
|
+
return region;
|
|
43125
|
+
}
|
|
43126
|
+
}
|
|
43127
|
+
return void 0;
|
|
43128
|
+
}
|
|
43129
|
+
resolveLinkSubTableCellMeta(row, col, region, dataIndexMeta) {
|
|
43130
|
+
const fillEndCol = this.getFillEndColForRegion(region);
|
|
43131
|
+
return {
|
|
43132
|
+
cellZone: resolveLinkSubTableCellZone(row, col, region, { fillEndCol }),
|
|
43133
|
+
xDataIndex: dataIndexMeta?.dataIndex,
|
|
43134
|
+
expandFromId: dataIndexMeta?.refCellId
|
|
43135
|
+
};
|
|
43136
|
+
}
|
|
43137
|
+
// ─── 合并单元格关系 ─────────────────────────────────────────
|
|
43138
|
+
/** 根据主单元格的 rowspan/colspan,为被覆盖的从属单元格设置 mergeFromId */
|
|
42885
43139
|
transformMergeRelations() {
|
|
42886
|
-
this.rows.
|
|
42887
|
-
row
|
|
42888
|
-
|
|
42889
|
-
|
|
42890
|
-
|
|
42891
|
-
|
|
42892
|
-
|
|
42893
|
-
|
|
42894
|
-
|
|
42895
|
-
|
|
42896
|
-
}
|
|
43140
|
+
for (let rowIndex = 0; rowIndex < this.rows.length; rowIndex++) {
|
|
43141
|
+
const row = this.rows[rowIndex];
|
|
43142
|
+
for (let colIndex = 0; colIndex < row.cells.length; colIndex++) {
|
|
43143
|
+
const cell = row.cells[colIndex];
|
|
43144
|
+
if (cell.colspan <= 1 && cell.rowspan <= 1) continue;
|
|
43145
|
+
for (let dr = 0; dr < cell.rowspan; dr++) {
|
|
43146
|
+
for (let dc = 0; dc < cell.colspan; dc++) {
|
|
43147
|
+
if (dr === 0 && dc === 0) continue;
|
|
43148
|
+
const covered = this.rows[rowIndex + dr]?.cells[colIndex + dc];
|
|
43149
|
+
if (covered) covered.mergeFromId = cell.id;
|
|
43150
|
+
}
|
|
42897
43151
|
}
|
|
42898
|
-
}
|
|
42899
|
-
}
|
|
43152
|
+
}
|
|
43153
|
+
}
|
|
42900
43154
|
}
|
|
43155
|
+
// ─── 数据铺砖索引计算 ─────────────────────────────────────
|
|
42901
43156
|
/**
|
|
42902
|
-
*
|
|
42903
|
-
*
|
|
42904
|
-
* @param range - 整体范围 {start:{row,col} end:{row,col}},表示需要分配数据项的总区域
|
|
42905
|
-
* @param itemRange - 局部范围 {start:{row,col} end:{row,col}},表示一个数据项的模板大小
|
|
42906
|
-
* @param fillDirection - `x`:先横向扩展再换行;`y`:先纵向扩展再换列(与 `x` 的行列外层循环互为镜像)
|
|
42907
|
-
* @returns Map,key 为字符串 "row,col",值为对应的数据索引
|
|
42908
|
-
*
|
|
42909
|
-
* 横向(x)算法:
|
|
42910
|
-
* 1. 局部范围内的单元格数据索引为 0
|
|
42911
|
-
* 2. 从局部范围右侧开始,按 itemWidth 宽度逐个扩展数据项
|
|
42912
|
-
* 3. 当同一行带内无法再放置更多数据项时,换到下一个 itemHeight 行带
|
|
42913
|
-
* 4. 换行后从整体范围的最左侧列开始继续扩展
|
|
43157
|
+
* 计算单元格对应的数据索引(用于范围扩展 / 数据关联铺砖)。
|
|
42914
43158
|
*
|
|
42915
|
-
*
|
|
43159
|
+
* @param range - 需要分配数据项的总区域
|
|
43160
|
+
* @param itemRange - 单个数据项的模板大小(局部范围索引均为 0)
|
|
43161
|
+
* @param fillDirection - `x`:先横向铺砖再换行;`y`:先纵向铺砖再换列
|
|
43162
|
+
* @returns key 为 "row,col",含 dataIndex 及引用模板单元格 id
|
|
42916
43163
|
*/
|
|
42917
43164
|
computeDataIndexMap(range3, itemRange, fillDirection = "x") {
|
|
42918
43165
|
const indexMap = /* @__PURE__ */ new Map();
|
|
@@ -42920,34 +43167,32 @@ class TableExpander {
|
|
|
42920
43167
|
const itemHeight = itemRange.end.row - itemRange.start.row + 1;
|
|
42921
43168
|
for (let r = itemRange.start.row; r <= itemRange.end.row; r++) {
|
|
42922
43169
|
for (let c2 = itemRange.start.col; c2 <= itemRange.end.col; c2++) {
|
|
42923
|
-
indexMap.set(
|
|
42924
|
-
dataIndex: 0
|
|
42925
|
-
});
|
|
43170
|
+
indexMap.set(cellKey(r, c2), { dataIndex: 0 });
|
|
42926
43171
|
}
|
|
42927
43172
|
}
|
|
42928
|
-
const
|
|
42929
|
-
const
|
|
42930
|
-
const stampBlock = (blockTopRow, blockLeftCol,
|
|
43173
|
+
const templateTopRow = itemRange.start.row;
|
|
43174
|
+
const templateLeftCol = itemRange.start.col;
|
|
43175
|
+
const stampBlock = (blockTopRow, blockLeftCol, dataIndex) => {
|
|
42931
43176
|
for (let r = blockTopRow; r < blockTopRow + itemHeight; r++) {
|
|
42932
43177
|
for (let c2 = blockLeftCol; c2 < blockLeftCol + itemWidth; c2++) {
|
|
42933
|
-
const
|
|
42934
|
-
const
|
|
42935
|
-
const refCell = this.table.getChildAt(
|
|
42936
|
-
indexMap.set(
|
|
42937
|
-
dataIndex
|
|
42938
|
-
refPos:
|
|
43178
|
+
const refRow = templateTopRow + r - blockTopRow;
|
|
43179
|
+
const refCol = templateLeftCol + c2 - blockLeftCol;
|
|
43180
|
+
const refCell = this.table.getChildAt(refRow).getChildAt(refCol);
|
|
43181
|
+
indexMap.set(cellKey(r, c2), {
|
|
43182
|
+
dataIndex,
|
|
43183
|
+
refPos: cellKey(refRow, refCol),
|
|
42939
43184
|
refCellId: refCell.id
|
|
42940
43185
|
});
|
|
42941
43186
|
}
|
|
42942
43187
|
}
|
|
42943
43188
|
};
|
|
42944
|
-
let
|
|
43189
|
+
let nextDataIndex = 1;
|
|
42945
43190
|
if (fillDirection === "x") {
|
|
42946
43191
|
let currentRow = itemRange.start.row;
|
|
42947
43192
|
let currentCol = itemRange.end.col + 1;
|
|
42948
43193
|
while (currentRow + itemHeight - 1 <= range3.end.row) {
|
|
42949
43194
|
while (currentCol + itemWidth - 1 <= range3.end.col) {
|
|
42950
|
-
stampBlock(currentRow, currentCol,
|
|
43195
|
+
stampBlock(currentRow, currentCol, nextDataIndex++);
|
|
42951
43196
|
currentCol += itemWidth;
|
|
42952
43197
|
}
|
|
42953
43198
|
currentRow += itemHeight;
|
|
@@ -42958,7 +43203,7 @@ class TableExpander {
|
|
|
42958
43203
|
let currentRow = itemRange.end.row + 1;
|
|
42959
43204
|
while (currentCol + itemWidth - 1 <= range3.end.col) {
|
|
42960
43205
|
while (currentRow + itemHeight - 1 <= range3.end.row) {
|
|
42961
|
-
stampBlock(currentRow, currentCol,
|
|
43206
|
+
stampBlock(currentRow, currentCol, nextDataIndex++);
|
|
42962
43207
|
currentRow += itemHeight;
|
|
42963
43208
|
}
|
|
42964
43209
|
currentCol += itemWidth;
|
|
@@ -42993,32 +43238,18 @@ class TableInfoProvider {
|
|
|
42993
43238
|
getCellModelRef(cell) {
|
|
42994
43239
|
return { id: cell.expandFromId };
|
|
42995
43240
|
}
|
|
42996
|
-
|
|
42997
|
-
|
|
42998
|
-
const
|
|
42999
|
-
|
|
43000
|
-
|
|
43001
|
-
|
|
43002
|
-
|
|
43003
|
-
|
|
43004
|
-
|
|
43005
|
-
|
|
43006
|
-
|
|
43007
|
-
end: {
|
|
43008
|
-
row: endRow
|
|
43009
|
-
}
|
|
43010
|
-
} = itemRegion;
|
|
43011
|
-
const range3 = {
|
|
43012
|
-
start: {
|
|
43013
|
-
row: startRow,
|
|
43014
|
-
col: startCol
|
|
43015
|
-
},
|
|
43016
|
-
end: {
|
|
43017
|
-
row: endRow,
|
|
43018
|
-
col: endCol
|
|
43019
|
-
}
|
|
43241
|
+
buildLinkSubTableSubRenderer(regionId, type4, region, cell) {
|
|
43242
|
+
const cellZone = cell.cellZone;
|
|
43243
|
+
const valuePath = cellZone ? resolveLinkSubTableValuePath(region, cellZone) : region.valuePath;
|
|
43244
|
+
return {
|
|
43245
|
+
id: regionId,
|
|
43246
|
+
type: type4,
|
|
43247
|
+
valuePath,
|
|
43248
|
+
widgetMeta: region.widgetMeta,
|
|
43249
|
+
cellZone,
|
|
43250
|
+
xDataIndex: cellZone === "horizontal" ? void 0 : cell.xDataIndex,
|
|
43251
|
+
yDataIndex: cellZone === "horizontal" || cellZone === "cross" ? cell.yDataIndex : void 0
|
|
43020
43252
|
};
|
|
43021
|
-
return range3;
|
|
43022
43253
|
}
|
|
43023
43254
|
getCellSubRenderer(cell) {
|
|
43024
43255
|
if (cell.repeatingId) {
|
|
@@ -43032,17 +43263,8 @@ class TableInfoProvider {
|
|
|
43032
43263
|
};
|
|
43033
43264
|
} else if (cell._2DTableId) {
|
|
43034
43265
|
const region = this.wtbl.get2DTableById(cell._2DTableId);
|
|
43035
|
-
return
|
|
43036
|
-
|
|
43037
|
-
type: "2d-table",
|
|
43038
|
-
// 二维表使用 cell 的扩展字段
|
|
43039
|
-
dataIndex: cell.dataIndex,
|
|
43040
|
-
xDataIndex: cell.xDataIndex,
|
|
43041
|
-
yDataIndex: cell.yDataIndex,
|
|
43042
|
-
valuePath: region?.valuePath,
|
|
43043
|
-
widgetMeta: region?.widgetMeta,
|
|
43044
|
-
dataGroup2DAreaRange: this.getDataGroup2DAreaRange(region)
|
|
43045
|
-
};
|
|
43266
|
+
if (!region || !cell.cellZone) return void 0;
|
|
43267
|
+
return this.buildLinkSubTableSubRenderer(cell._2DTableId, "2d-table", region, cell);
|
|
43046
43268
|
} else if (cell.boundedId) {
|
|
43047
43269
|
const region = this.wtbl.getBoundedById(cell.boundedId);
|
|
43048
43270
|
return {
|
|
@@ -43054,21 +43276,13 @@ class TableInfoProvider {
|
|
|
43054
43276
|
};
|
|
43055
43277
|
} else if (cell.checkTableId) {
|
|
43056
43278
|
const region = this.wtbl.getCheckTableById(cell.checkTableId);
|
|
43057
|
-
return
|
|
43058
|
-
|
|
43059
|
-
type: "check-table",
|
|
43060
|
-
dataIndex: cell.dataIndex,
|
|
43061
|
-
valuePath: region?.valuePath,
|
|
43062
|
-
widgetMeta: region?.widgetMeta,
|
|
43063
|
-
dataGroup2DAreaRange: this.getDataGroup2DAreaRange(region)
|
|
43064
|
-
};
|
|
43279
|
+
if (!region || !cell.cellZone) return void 0;
|
|
43280
|
+
return this.buildLinkSubTableSubRenderer(cell.checkTableId, "check-table", region, cell);
|
|
43065
43281
|
} else if (cell.headerId) {
|
|
43066
43282
|
return {
|
|
43067
43283
|
id: cell.headerId,
|
|
43068
43284
|
type: "table-header",
|
|
43069
43285
|
dataIndex: cell.dataIndex,
|
|
43070
|
-
// valuePath: region?.valuePath!,
|
|
43071
|
-
// widgetMeta: region?.widgetMeta,
|
|
43072
43286
|
valuePath: "",
|
|
43073
43287
|
widgetMeta: void 0
|
|
43074
43288
|
};
|
|
@@ -43521,43 +43735,43 @@ class LayoutManager {
|
|
|
43521
43735
|
handler.layout(context, run);
|
|
43522
43736
|
}
|
|
43523
43737
|
}
|
|
43524
|
-
function generateModelMap(node,
|
|
43738
|
+
function generateModelMap(node, map = /* @__PURE__ */ new Map()) {
|
|
43525
43739
|
if (!node) return;
|
|
43526
|
-
|
|
43740
|
+
map.set(node.id, node);
|
|
43527
43741
|
const children = node.getChildren?.() ?? node.children ?? null;
|
|
43528
43742
|
if (Array.isArray(children)) {
|
|
43529
43743
|
for (let ci = 0; ci < children.length; ci++) {
|
|
43530
43744
|
const child = children[ci];
|
|
43531
|
-
generateModelMap(child,
|
|
43745
|
+
generateModelMap(child, map);
|
|
43532
43746
|
}
|
|
43533
43747
|
}
|
|
43534
|
-
return
|
|
43748
|
+
return map;
|
|
43535
43749
|
}
|
|
43536
43750
|
function generateDocModelMap(doc) {
|
|
43537
|
-
const
|
|
43751
|
+
const map = /* @__PURE__ */ new Map();
|
|
43538
43752
|
const body = doc.model?.document.body;
|
|
43539
43753
|
if (body) {
|
|
43540
|
-
generateModelMap(body,
|
|
43754
|
+
generateModelMap(body, map);
|
|
43541
43755
|
}
|
|
43542
43756
|
const headers2 = doc.model?.headers?.headers;
|
|
43543
43757
|
if (Array.isArray(headers2)) {
|
|
43544
43758
|
headers2.forEach((header) => {
|
|
43545
|
-
generateModelMap(header,
|
|
43759
|
+
generateModelMap(header, map);
|
|
43546
43760
|
});
|
|
43547
43761
|
}
|
|
43548
43762
|
const footers2 = doc.model?.footers?.footers;
|
|
43549
43763
|
if (Array.isArray(footers2)) {
|
|
43550
43764
|
footers2.forEach((footer) => {
|
|
43551
|
-
generateModelMap(footer,
|
|
43765
|
+
generateModelMap(footer, map);
|
|
43552
43766
|
});
|
|
43553
43767
|
}
|
|
43554
43768
|
const overlays = doc.model?.overlays.overlays;
|
|
43555
43769
|
if (Array.isArray(overlays)) {
|
|
43556
43770
|
overlays.forEach((overlay) => {
|
|
43557
|
-
generateModelMap(overlay,
|
|
43771
|
+
generateModelMap(overlay, map);
|
|
43558
43772
|
});
|
|
43559
43773
|
}
|
|
43560
|
-
return
|
|
43774
|
+
return map;
|
|
43561
43775
|
}
|
|
43562
43776
|
class LayoutMapper {
|
|
43563
43777
|
doc;
|
|
@@ -45694,6 +45908,13 @@ class DataManager {
|
|
|
45694
45908
|
* @returns 指定路径的值,不存在返回 undefined
|
|
45695
45909
|
*/
|
|
45696
45910
|
get(path2) {
|
|
45911
|
+
const inferred = this.infer2DPathAndCoords(path2);
|
|
45912
|
+
if (inferred) {
|
|
45913
|
+
const value2D = this.get2DByCoords(inferred.logicalPath, inferred.coords);
|
|
45914
|
+
if (value2D !== void 0) {
|
|
45915
|
+
return value2D;
|
|
45916
|
+
}
|
|
45917
|
+
}
|
|
45697
45918
|
let value = this.getByPath(this.rawData, path2);
|
|
45698
45919
|
if (value === void 0) {
|
|
45699
45920
|
value = this.getDefault(path2);
|
|
@@ -45710,16 +45931,26 @@ class DataManager {
|
|
|
45710
45931
|
getLabel(path2) {
|
|
45711
45932
|
return this.get(this.getLabelPath(path2)) || this.get(path2);
|
|
45712
45933
|
}
|
|
45934
|
+
assignField(target, fieldPath, value) {
|
|
45935
|
+
if (!fieldPath.includes(".") && !fieldPath.includes("[")) {
|
|
45936
|
+
target[fieldPath] = value;
|
|
45937
|
+
return;
|
|
45938
|
+
}
|
|
45939
|
+
this.setByPath(target, `$.${fieldPath}`, value);
|
|
45940
|
+
}
|
|
45713
45941
|
/**
|
|
45714
45942
|
* 根据 jsonpath 设置数据
|
|
45715
45943
|
* @param path jsonpath 路径
|
|
45716
45944
|
* @param value 要设置的值
|
|
45717
|
-
* @param x
|
|
45718
|
-
* @param y
|
|
45719
45945
|
* @returns 是否设置成功
|
|
45720
45946
|
*/
|
|
45721
|
-
|
|
45947
|
+
set(path2, value, source = "user") {
|
|
45722
45948
|
try {
|
|
45949
|
+
const inferred = this.infer2DPathAndCoords(path2);
|
|
45950
|
+
if (inferred) {
|
|
45951
|
+
const updated = this.set2DByCoords(inferred.logicalPath, value, inferred.coords, source);
|
|
45952
|
+
if (updated) return true;
|
|
45953
|
+
}
|
|
45723
45954
|
const oldValue = this.getByPath(this.rawData, path2);
|
|
45724
45955
|
this.setByPath(this.rawData, path2, value);
|
|
45725
45956
|
this.emit(path2, value, oldValue, source);
|
|
@@ -45730,21 +45961,204 @@ class DataManager {
|
|
|
45730
45961
|
}
|
|
45731
45962
|
}
|
|
45732
45963
|
/**
|
|
45733
|
-
*
|
|
45734
|
-
*
|
|
45735
|
-
*
|
|
45736
|
-
*
|
|
45964
|
+
* 从带数字下标的 path 推断二维坐标(供 setMultiple / patch / 业务回填等无 modelRef 的场景)
|
|
45965
|
+
* - 单轴:$.f_ewb[0].f_name → y=0;$.f_ewblink[1].x → x=1(需能从 rawData 的交叉 key 识别轴,或命中 link 命名启发)
|
|
45966
|
+
* - 交叉:$.f_ewb:f_ewblink[0][1].f_value → y=0,x=1
|
|
45967
|
+
* 不会处理 [n] 通配符;普通子表(如 $.b[0].c)不推断,避免破坏原有语义。
|
|
45737
45968
|
*/
|
|
45738
|
-
|
|
45739
|
-
|
|
45740
|
-
|
|
45741
|
-
|
|
45742
|
-
|
|
45969
|
+
infer2DPathAndCoords(path2) {
|
|
45970
|
+
if (!path2 || path2.includes("[n]")) return null;
|
|
45971
|
+
const segments = this.parsePath(path2);
|
|
45972
|
+
if (segments.length < 3) return null;
|
|
45973
|
+
const head = segments[0];
|
|
45974
|
+
if (head?.type !== "property") return null;
|
|
45975
|
+
const tableKey = head.value;
|
|
45976
|
+
const restToFieldPath = (startIdx) => {
|
|
45977
|
+
let s = "";
|
|
45978
|
+
for (let i = startIdx; i < segments.length; i++) {
|
|
45979
|
+
const seg = segments[i];
|
|
45980
|
+
if (!seg) continue;
|
|
45981
|
+
if (seg.type === "property") {
|
|
45982
|
+
s += (s ? "." : "") + seg.value;
|
|
45983
|
+
} else {
|
|
45984
|
+
s += `[${seg.value}]`;
|
|
45985
|
+
}
|
|
45986
|
+
}
|
|
45987
|
+
return s;
|
|
45988
|
+
};
|
|
45989
|
+
if (tableKey.includes(":")) {
|
|
45990
|
+
let i = 1;
|
|
45991
|
+
if (segments[i]?.type !== "index") return null;
|
|
45992
|
+
const y2 = parseInt(segments[i].value, 10);
|
|
45993
|
+
i++;
|
|
45994
|
+
if (segments[i]?.type !== "index") return null;
|
|
45995
|
+
const x2 = parseInt(segments[i].value, 10);
|
|
45996
|
+
i++;
|
|
45997
|
+
const fieldPath2 = restToFieldPath(i);
|
|
45998
|
+
if (!fieldPath2) return null;
|
|
45999
|
+
return { logicalPath: `$.${tableKey}.${fieldPath2}`, coords: { x: x2, y: y2 } };
|
|
46000
|
+
}
|
|
46001
|
+
if (segments[1]?.type !== "index") return null;
|
|
46002
|
+
const idx = parseInt(segments[1].value, 10);
|
|
46003
|
+
if (!Number.isFinite(idx)) return null;
|
|
46004
|
+
const axisResolved = this.resolveAxisByTableKey(tableKey);
|
|
46005
|
+
const axisGuess = this.guessLinkSubTableAxis(tableKey);
|
|
46006
|
+
const axis = axisResolved?.axis ?? axisGuess;
|
|
46007
|
+
if (!axis) return null;
|
|
46008
|
+
const fieldPath = restToFieldPath(2);
|
|
46009
|
+
if (!fieldPath) return null;
|
|
46010
|
+
const coords = axis === "y" ? { y: idx } : { x: idx };
|
|
46011
|
+
return { logicalPath: `$.${tableKey}.${fieldPath}`, coords };
|
|
46012
|
+
}
|
|
46013
|
+
/**
|
|
46014
|
+
* rawData 尚无交叉 key 时,用命名约定推测轴(避免误判普通子表 $.b[0])
|
|
46015
|
+
* 须先于「f_ewb 主体」判断:f_ewblink 也以 f_ewb 开头。
|
|
46016
|
+
*/
|
|
46017
|
+
guessLinkSubTableAxis(tableKey) {
|
|
46018
|
+
const lower = tableKey.toLowerCase();
|
|
46019
|
+
if (lower.includes("ewblink") || /link$/i.test(lower)) return "x";
|
|
46020
|
+
if (lower.startsWith("f_ewb")) return "y";
|
|
46021
|
+
return null;
|
|
46022
|
+
}
|
|
46023
|
+
parse2DPath(path2) {
|
|
46024
|
+
const normalized = path2.replace(/^\$\./, "");
|
|
46025
|
+
const firstDot = normalized.indexOf(".");
|
|
46026
|
+
if (firstDot === -1) return null;
|
|
46027
|
+
const tableKey = normalized.slice(0, firstDot).replace(/\[[^\]]+\]/g, "");
|
|
46028
|
+
const fieldPath = normalized.slice(firstDot + 1);
|
|
46029
|
+
if (!tableKey || !fieldPath) return null;
|
|
46030
|
+
return { tableKey, fieldPath };
|
|
46031
|
+
}
|
|
46032
|
+
getCrossKeys() {
|
|
46033
|
+
return Object.keys(this.rawData).filter((key) => key.includes(":"));
|
|
46034
|
+
}
|
|
46035
|
+
resolveAxisByTableKey(tableKey) {
|
|
46036
|
+
const crossKeys = this.getCrossKeys();
|
|
46037
|
+
const matched = crossKeys.filter((key) => {
|
|
46038
|
+
const [yKey2, xKey] = key.split(":");
|
|
46039
|
+
return yKey2 === tableKey || xKey === tableKey;
|
|
46040
|
+
});
|
|
46041
|
+
if (matched.length === 0) return null;
|
|
46042
|
+
const first = matched[0];
|
|
46043
|
+
const [yKey] = first.split(":");
|
|
46044
|
+
return { axis: yKey === tableKey ? "y" : "x", crossKeys: matched };
|
|
46045
|
+
}
|
|
46046
|
+
ensureAxisRowAndUid(tableKey, index2, axis) {
|
|
46047
|
+
const path2 = `$.${tableKey}`;
|
|
46048
|
+
let rows = this.getByPath(this.rawData, path2);
|
|
46049
|
+
if (!Array.isArray(rows)) {
|
|
46050
|
+
rows = [];
|
|
46051
|
+
this.setByPath(this.rawData, path2, rows);
|
|
46052
|
+
}
|
|
46053
|
+
while (rows.length <= index2) {
|
|
46054
|
+
rows.push({});
|
|
46055
|
+
}
|
|
46056
|
+
const row = rows[index2] ?? {};
|
|
46057
|
+
const { group_: g_ } = row;
|
|
46058
|
+
rows[index2] = row;
|
|
46059
|
+
const isY = axis === "y";
|
|
46060
|
+
const uidField = isY ? "__gw_y_uid" : "__gw_x_uid";
|
|
46061
|
+
if (!row[uidField]) {
|
|
46062
|
+
row[uidField] = g_ ? g_.includes(":") ? g_.split(":")[isY ? 0 : 1] : g_ : `${axis}_${uuid()}`;
|
|
46063
|
+
}
|
|
46064
|
+
return row;
|
|
46065
|
+
}
|
|
46066
|
+
getFieldFromRow(row, fieldPath) {
|
|
46067
|
+
if (!fieldPath.includes(".") && !fieldPath.includes("[")) {
|
|
46068
|
+
return row[fieldPath];
|
|
46069
|
+
}
|
|
46070
|
+
return this.getByPath(row, `$.${fieldPath}`);
|
|
46071
|
+
}
|
|
46072
|
+
/**
|
|
46073
|
+
* 按 y/x 坐标读取二维表数据(与 set2DByCoords 对称)
|
|
46074
|
+
* 交叉区在 rawData 中按 __gw_y_uid / __gw_x_uid 稀疏存储,不能直接用 [y][x] 下标 getByPath。
|
|
46075
|
+
*/
|
|
46076
|
+
get2DByCoords(path2, coords) {
|
|
46077
|
+
const parsed = this.parse2DPath(path2);
|
|
46078
|
+
if (!parsed) return void 0;
|
|
46079
|
+
const { tableKey, fieldPath } = parsed;
|
|
46080
|
+
if (tableKey.includes(":")) {
|
|
46081
|
+
const [yTableKey = "", xTableKey = ""] = tableKey.split(":");
|
|
46082
|
+
if (!yTableKey || !xTableKey) return void 0;
|
|
46083
|
+
if (typeof coords.y !== "number" || typeof coords.x !== "number") return void 0;
|
|
46084
|
+
const yRows = this.getByPath(this.rawData, `$.${yTableKey}`);
|
|
46085
|
+
const xRows = this.getByPath(this.rawData, `$.${xTableKey}`);
|
|
46086
|
+
const yUid = yRows?.[coords.y]?.__gw_y_uid;
|
|
46087
|
+
const xUid = xRows?.[coords.x]?.__gw_x_uid;
|
|
46088
|
+
if (!yUid || !xUid) return void 0;
|
|
46089
|
+
const crossRows = this.getByPath(this.rawData, `$.${tableKey}`);
|
|
46090
|
+
if (!Array.isArray(crossRows)) return void 0;
|
|
46091
|
+
const row = crossRows.find(
|
|
46092
|
+
(item) => item?.__gw_y_uid === yUid && item?.__gw_x_uid === xUid
|
|
46093
|
+
);
|
|
46094
|
+
if (!row) return void 0;
|
|
46095
|
+
return this.getFieldFromRow(row, fieldPath);
|
|
46096
|
+
}
|
|
46097
|
+
const axisInfo = this.resolveAxisByTableKey(tableKey);
|
|
46098
|
+
const axis = axisInfo?.axis ?? (typeof coords.y === "number" ? "y" : typeof coords.x === "number" ? "x" : null);
|
|
46099
|
+
if (!axis) return void 0;
|
|
46100
|
+
const index2 = axis === "y" ? coords.y : coords.x;
|
|
46101
|
+
if (typeof index2 !== "number") return void 0;
|
|
46102
|
+
const rows = this.getByPath(this.rawData, `$.${tableKey}`);
|
|
46103
|
+
if (!Array.isArray(rows) || !rows[index2]) return void 0;
|
|
46104
|
+
return this.getFieldFromRow(rows[index2], fieldPath);
|
|
46105
|
+
}
|
|
46106
|
+
set2DByCoords(path2, value, coords, source) {
|
|
46107
|
+
const parsed = this.parse2DPath(path2);
|
|
46108
|
+
if (!parsed) return false;
|
|
46109
|
+
const { tableKey, fieldPath } = parsed;
|
|
46110
|
+
if (tableKey.includes(":")) {
|
|
46111
|
+
const [yTableKey = "", xTableKey = ""] = tableKey.split(":");
|
|
46112
|
+
if (!yTableKey || !xTableKey) return false;
|
|
46113
|
+
if (typeof coords.y !== "number" || typeof coords.x !== "number") return false;
|
|
46114
|
+
const yRow = this.ensureAxisRowAndUid(yTableKey, coords.y, "y");
|
|
46115
|
+
const xRow = this.ensureAxisRowAndUid(xTableKey, coords.x, "x");
|
|
46116
|
+
const yUid = yRow.__gw_y_uid;
|
|
46117
|
+
const xUid = xRow.__gw_x_uid;
|
|
46118
|
+
if (!yUid || !xUid) return false;
|
|
46119
|
+
const crossPath = `$.${tableKey}`;
|
|
46120
|
+
const oldValue2 = this.deepClone(this.getByPath(this.rawData, crossPath));
|
|
46121
|
+
let rows = this.getByPath(this.rawData, crossPath);
|
|
46122
|
+
if (!Array.isArray(rows)) {
|
|
46123
|
+
rows = [];
|
|
46124
|
+
this.setByPath(this.rawData, crossPath, rows);
|
|
46125
|
+
}
|
|
46126
|
+
let row2 = rows.find((item) => item?.__gw_y_uid === yUid && item?.__gw_x_uid === xUid);
|
|
46127
|
+
if (!row2) {
|
|
46128
|
+
row2 = { __gw_y_uid: yUid, __gw_x_uid: xUid };
|
|
46129
|
+
rows.push(row2);
|
|
46130
|
+
}
|
|
46131
|
+
this.assignField(row2, fieldPath, value);
|
|
46132
|
+
this.emit(crossPath, this.getByPath(this.rawData, crossPath), oldValue2, source);
|
|
45743
46133
|
return true;
|
|
45744
|
-
} catch (error) {
|
|
45745
|
-
console.error(`Failed to set value at path "${path2}":`, error);
|
|
45746
|
-
return false;
|
|
45747
46134
|
}
|
|
46135
|
+
const axisInfo = this.resolveAxisByTableKey(tableKey);
|
|
46136
|
+
const axis = axisInfo?.axis ?? (typeof coords.y === "number" ? "y" : typeof coords.x === "number" ? "x" : null);
|
|
46137
|
+
if (!axis) return false;
|
|
46138
|
+
const index2 = axis === "y" ? coords.y : coords.x;
|
|
46139
|
+
if (typeof index2 !== "number") return false;
|
|
46140
|
+
const tablePath = `$.${tableKey}`;
|
|
46141
|
+
const oldValue = this.deepClone(this.getByPath(this.rawData, tablePath));
|
|
46142
|
+
const row = this.ensureAxisRowAndUid(tableKey, index2, axis);
|
|
46143
|
+
this.assignField(row, fieldPath, value);
|
|
46144
|
+
this.emit(tablePath, this.getByPath(this.rawData, tablePath), oldValue, source);
|
|
46145
|
+
return true;
|
|
46146
|
+
}
|
|
46147
|
+
cleanupCrossByAxisUid(tableKey, axis, uid) {
|
|
46148
|
+
if (!uid) return;
|
|
46149
|
+
const uidField = axis === "y" ? "__gw_y_uid" : "__gw_x_uid";
|
|
46150
|
+
this.getCrossKeys().forEach((crossKey) => {
|
|
46151
|
+
const [yKey, xKey] = crossKey.split(":");
|
|
46152
|
+
const matched = (axis === "y" ? yKey : xKey) === tableKey;
|
|
46153
|
+
if (!matched) return;
|
|
46154
|
+
const path2 = `$.${crossKey}`;
|
|
46155
|
+
const rows = this.getByPath(this.rawData, path2);
|
|
46156
|
+
if (!Array.isArray(rows)) return;
|
|
46157
|
+
const oldValue = this.deepClone(rows);
|
|
46158
|
+
const next = rows.filter((item) => item?.[uidField] !== uid);
|
|
46159
|
+
this.setByPath(this.rawData, path2, next);
|
|
46160
|
+
this.emit(path2, next, oldValue);
|
|
46161
|
+
});
|
|
45748
46162
|
}
|
|
45749
46163
|
/**
|
|
45750
46164
|
* 将一个部分值对象合进整体
|
|
@@ -45812,8 +46226,15 @@ class DataManager {
|
|
|
45812
46226
|
this.set(path2, arr);
|
|
45813
46227
|
}
|
|
45814
46228
|
const oldValue = [...arr];
|
|
46229
|
+
const tableKey = path2.replace(/^\$\./, "").replace(/\[(n|\d+)\]/g, "");
|
|
46230
|
+
const axisInfo = this.resolveAxisByTableKey(tableKey);
|
|
45815
46231
|
values.forEach((value) => {
|
|
45816
|
-
|
|
46232
|
+
const cloned = this.deepClone(value);
|
|
46233
|
+
arr.push(cloned);
|
|
46234
|
+
if (axisInfo) {
|
|
46235
|
+
const index2 = arr.length - 1;
|
|
46236
|
+
this.ensureAxisRowAndUid(tableKey, index2, axisInfo.axis);
|
|
46237
|
+
}
|
|
45817
46238
|
});
|
|
45818
46239
|
this.emit(path2, arr, oldValue);
|
|
45819
46240
|
return true;
|
|
@@ -45836,6 +46257,12 @@ class DataManager {
|
|
|
45836
46257
|
const oldValue = [...arr];
|
|
45837
46258
|
const poppedValue = arr.pop();
|
|
45838
46259
|
this.emit(path2, arr, oldValue);
|
|
46260
|
+
const tableKey = path2.replace(/^\$\./, "").replace(/\[(n|\d+)\]/g, "");
|
|
46261
|
+
const axisInfo = this.resolveAxisByTableKey(tableKey);
|
|
46262
|
+
if (axisInfo) {
|
|
46263
|
+
const uidField = axisInfo.axis === "y" ? "__gw_y_uid" : "__gw_x_uid";
|
|
46264
|
+
this.cleanupCrossByAxisUid(tableKey, axisInfo.axis, poppedValue?.[uidField]);
|
|
46265
|
+
}
|
|
45839
46266
|
return poppedValue;
|
|
45840
46267
|
} catch (error) {
|
|
45841
46268
|
console.error(`Failed to pop value at path "${path2}":`, error);
|
|
@@ -45865,6 +46292,13 @@ class DataManager {
|
|
|
45865
46292
|
const oldValue = [...arr];
|
|
45866
46293
|
const clonedValues = values.map((value) => this.deepClone(value));
|
|
45867
46294
|
arr.splice(index2, 0, ...clonedValues);
|
|
46295
|
+
const tableKey = path2.replace(/^\$\./, "").replace(/\[(n|\d+)\]/g, "");
|
|
46296
|
+
const axisInfo = this.resolveAxisByTableKey(tableKey);
|
|
46297
|
+
if (axisInfo) {
|
|
46298
|
+
for (let i = index2; i < arr.length; i++) {
|
|
46299
|
+
this.ensureAxisRowAndUid(tableKey, i, axisInfo.axis);
|
|
46300
|
+
}
|
|
46301
|
+
}
|
|
45868
46302
|
this.emit(path2, arr, oldValue);
|
|
45869
46303
|
return true;
|
|
45870
46304
|
} catch (error) {
|
|
@@ -45890,6 +46324,12 @@ class DataManager {
|
|
|
45890
46324
|
const oldValue = [...arr];
|
|
45891
46325
|
const removedValue = arr.splice(index2, 1)[0];
|
|
45892
46326
|
this.emit(path2, arr, oldValue);
|
|
46327
|
+
const tableKey = path2.replace(/^\$\./, "").replace(/\[(n|\d+)\]/g, "");
|
|
46328
|
+
const axisInfo = this.resolveAxisByTableKey(tableKey);
|
|
46329
|
+
if (axisInfo) {
|
|
46330
|
+
const uidField = axisInfo.axis === "y" ? "__gw_y_uid" : "__gw_x_uid";
|
|
46331
|
+
this.cleanupCrossByAxisUid(tableKey, axisInfo.axis, removedValue?.[uidField]);
|
|
46332
|
+
}
|
|
45893
46333
|
return removedValue;
|
|
45894
46334
|
} catch (error) {
|
|
45895
46335
|
console.error(`Failed to remove value at path "${path2}":`, error);
|
|
@@ -45937,17 +46377,28 @@ class DataManager {
|
|
|
45937
46377
|
applyInitData(initDataMap) {
|
|
45938
46378
|
for (const [path2, value] of Object.entries(initDataMap)) {
|
|
45939
46379
|
if (value === void 0 || value === null) continue;
|
|
45940
|
-
|
|
46380
|
+
const parse = parseValuePath(path2);
|
|
46381
|
+
if (parse.isSubTable && !parse.isLink) {
|
|
45941
46382
|
this.applyInitDataWildcard(path2, value);
|
|
45942
46383
|
}
|
|
45943
46384
|
}
|
|
45944
46385
|
for (const [path2, value] of Object.entries(initDataMap)) {
|
|
45945
46386
|
if (value === void 0 || value === null) continue;
|
|
45946
|
-
|
|
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)) {
|
|
45947
46396
|
const existing = this.getByPath(this.rawData, path2);
|
|
45948
46397
|
if (existing === void 0 || existing === null) {
|
|
45949
46398
|
try {
|
|
45950
|
-
this.
|
|
46399
|
+
if (!this.set(path2, value, "user")) {
|
|
46400
|
+
console.warn(`applyInitData: set returned false for path "${path2}"`);
|
|
46401
|
+
}
|
|
45951
46402
|
} catch (e) {
|
|
45952
46403
|
console.warn(`applyInitData: failed to set path "${path2}"`, e);
|
|
45953
46404
|
}
|
|
@@ -45955,23 +46406,99 @@ class DataManager {
|
|
|
45955
46406
|
}
|
|
45956
46407
|
}
|
|
45957
46408
|
}
|
|
45958
|
-
|
|
45959
|
-
const
|
|
45960
|
-
if (!
|
|
45961
|
-
const
|
|
45962
|
-
|
|
45963
|
-
if (!
|
|
45964
|
-
|
|
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);
|
|
45965
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 } : {});
|
|
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
|
+
);
|
|
45966
46487
|
for (let i = 0; i < subTableArray.length; i++) {
|
|
45967
46488
|
const realPath = replacePathIndexPlaceholder(i, path2);
|
|
45968
46489
|
const existing = this.getByPath(this.rawData, realPath);
|
|
45969
46490
|
if (existing === void 0 || existing === null) {
|
|
45970
46491
|
try {
|
|
45971
|
-
this.
|
|
46492
|
+
if (this.set(realPath, value, "user")) {
|
|
46493
|
+
this.clearPlaceholderFlag(subTableArray[i]);
|
|
46494
|
+
} else {
|
|
46495
|
+
console.warn(`applyInitData: set returned false for path "${realPath}"`);
|
|
46496
|
+
}
|
|
45972
46497
|
} catch (e) {
|
|
45973
46498
|
console.warn(`applyInitData: failed to set path "${realPath}"`, e);
|
|
45974
46499
|
}
|
|
46500
|
+
} else {
|
|
46501
|
+
this.clearPlaceholderFlag(subTableArray[i]);
|
|
45975
46502
|
}
|
|
45976
46503
|
}
|
|
45977
46504
|
}
|
|
@@ -46095,7 +46622,7 @@ class DataManager {
|
|
|
46095
46622
|
if (current.startsWith(".")) {
|
|
46096
46623
|
current = current.substring(1);
|
|
46097
46624
|
}
|
|
46098
|
-
const regex = /([a-zA-Z_$][a-zA-Z0-9_
|
|
46625
|
+
const regex = /([a-zA-Z_$][a-zA-Z0-9_$:]*)|\.([a-zA-Z_$][a-zA-Z0-9_$:]*)|\.?(\[(\d+)\])/g;
|
|
46099
46626
|
let match;
|
|
46100
46627
|
while ((match = regex.exec(current)) !== null) {
|
|
46101
46628
|
if (match[1]) {
|
|
@@ -46253,12 +46780,21 @@ class DataManager {
|
|
|
46253
46780
|
return void 0;
|
|
46254
46781
|
}
|
|
46255
46782
|
/**
|
|
46256
|
-
*
|
|
46257
|
-
*
|
|
46258
|
-
*
|
|
46259
|
-
* @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
|
|
46260
46786
|
*/
|
|
46261
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
|
+
}
|
|
46262
46798
|
return path2.replace(/\[(\d+)\]/g, "[n]");
|
|
46263
46799
|
}
|
|
46264
46800
|
formatRuntimeValue(value) {
|
|
@@ -46310,9 +46846,9 @@ class DataManager {
|
|
|
46310
46846
|
if (!this.depGraph.has(realPath)) {
|
|
46311
46847
|
this.depGraph.set(realPath, /* @__PURE__ */ new Map());
|
|
46312
46848
|
}
|
|
46313
|
-
const
|
|
46314
|
-
if (!
|
|
46315
|
-
|
|
46849
|
+
const map = this.depGraph.get(realPath);
|
|
46850
|
+
if (!map.has(depKey)) {
|
|
46851
|
+
map.set(depKey, node);
|
|
46316
46852
|
}
|
|
46317
46853
|
});
|
|
46318
46854
|
}
|
|
@@ -46340,9 +46876,9 @@ class DataManager {
|
|
|
46340
46876
|
}
|
|
46341
46877
|
/** 执行依赖 */
|
|
46342
46878
|
async runDepsByPath(triggerPath, realPath) {
|
|
46343
|
-
const
|
|
46344
|
-
if (!
|
|
46345
|
-
for (const node of
|
|
46879
|
+
const map = this.depGraph.get(triggerPath);
|
|
46880
|
+
if (!map) return;
|
|
46881
|
+
for (const node of map.values()) {
|
|
46346
46882
|
await this.runDependency(node, realPath, triggerPath === realPath);
|
|
46347
46883
|
}
|
|
46348
46884
|
}
|
|
@@ -46659,14 +47195,14 @@ class Doc {
|
|
|
46659
47195
|
*/
|
|
46660
47196
|
getWidgetInstances() {
|
|
46661
47197
|
const instances = [];
|
|
46662
|
-
const
|
|
47198
|
+
const map = /* @__PURE__ */ new Map();
|
|
46663
47199
|
const collectWidgets = (node) => {
|
|
46664
47200
|
if (!node) return;
|
|
46665
47201
|
if (node.widgetMeta && node.valuePath) {
|
|
46666
47202
|
const refId = node.modelRef?.id;
|
|
46667
|
-
if (refId && !
|
|
47203
|
+
if (refId && !map.has(refId)) {
|
|
46668
47204
|
instances.push(node);
|
|
46669
|
-
|
|
47205
|
+
map.set(refId, true);
|
|
46670
47206
|
}
|
|
46671
47207
|
}
|
|
46672
47208
|
if (node.children && Array.isArray(node.children)) {
|
|
@@ -48299,6 +48835,41 @@ class Woverlays {
|
|
|
48299
48835
|
});
|
|
48300
48836
|
}
|
|
48301
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
|
+
}
|
|
48302
48873
|
class DocModel {
|
|
48303
48874
|
document;
|
|
48304
48875
|
headers;
|
|
@@ -48426,7 +48997,7 @@ class DocModel {
|
|
|
48426
48997
|
const tables = this.getAllTables();
|
|
48427
48998
|
const dynamicTableRegions = tables.filter((w2) => w2.hasRepeating).flatMap((w2) => w2.repeating).map((item) => {
|
|
48428
48999
|
return {
|
|
48429
|
-
field:
|
|
49000
|
+
field: item.subFieldKey,
|
|
48430
49001
|
key: "dyn",
|
|
48431
49002
|
name: "动态表",
|
|
48432
49003
|
subType: "sub-table"
|
|
@@ -48434,26 +49005,25 @@ class DocModel {
|
|
|
48434
49005
|
});
|
|
48435
49006
|
const fixedTableRegions = tables.filter((w2) => w2.hasBounded).flatMap((w2) => w2.bounded).map((item) => {
|
|
48436
49007
|
return {
|
|
48437
|
-
field:
|
|
49008
|
+
field: item.subFieldKey,
|
|
48438
49009
|
key: "newfixed",
|
|
48439
49010
|
name: "固定表",
|
|
48440
49011
|
subType: "fixed-table"
|
|
48441
49012
|
};
|
|
48442
49013
|
});
|
|
48443
49014
|
const table2DRegions = tables.filter((w2) => w2.has2DTable).flatMap((w2) => w2._2DTable).map((item) => {
|
|
48444
|
-
const region = parseLinkFieldExpression(item.valuePath);
|
|
48445
49015
|
const result = [];
|
|
48446
|
-
if (
|
|
49016
|
+
if (item.subFieldKey) {
|
|
48447
49017
|
result.push({
|
|
48448
|
-
field:
|
|
49018
|
+
field: item.subFieldKey,
|
|
48449
49019
|
key: "dyn",
|
|
48450
49020
|
name: "二维表",
|
|
48451
49021
|
subType: "sub-table-2d"
|
|
48452
49022
|
});
|
|
48453
49023
|
}
|
|
48454
|
-
if (
|
|
49024
|
+
if (item.linkFieldKey) {
|
|
48455
49025
|
result.push({
|
|
48456
|
-
field:
|
|
49026
|
+
field: item.linkFieldKey,
|
|
48457
49027
|
key: "newfixed",
|
|
48458
49028
|
name: "二维表-关联",
|
|
48459
49029
|
subType: "sub-table-2d-link"
|
|
@@ -48462,19 +49032,18 @@ class DocModel {
|
|
|
48462
49032
|
return result;
|
|
48463
49033
|
}).flat();
|
|
48464
49034
|
const checkTableRegions = tables.filter((w2) => w2.hasCheckTable).flatMap((w2) => w2.checkTable).map((item) => {
|
|
48465
|
-
const region = parseLinkFieldExpression(item.valuePath);
|
|
48466
49035
|
const result = [];
|
|
48467
|
-
if (
|
|
49036
|
+
if (item.subFieldKey) {
|
|
48468
49037
|
result.push({
|
|
48469
|
-
field:
|
|
49038
|
+
field: item.subFieldKey,
|
|
48470
49039
|
key: "newfixed",
|
|
48471
49040
|
name: "检验表-动态",
|
|
48472
49041
|
subType: "check-table-2d"
|
|
48473
49042
|
});
|
|
48474
49043
|
}
|
|
48475
|
-
if (
|
|
49044
|
+
if (item.linkFieldKey) {
|
|
48476
49045
|
result.push({
|
|
48477
|
-
field:
|
|
49046
|
+
field: item.linkFieldKey,
|
|
48478
49047
|
key: "newfixed",
|
|
48479
49048
|
name: "检验表-关联",
|
|
48480
49049
|
subType: "check-table-2d-link"
|
|
@@ -48484,6 +49053,42 @@ class DocModel {
|
|
|
48484
49053
|
}).flat();
|
|
48485
49054
|
return [...dynamicTableRegions, ...fixedTableRegions, ...table2DRegions, ...checkTableRegions];
|
|
48486
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
|
+
}
|
|
48487
49092
|
/** 根据 pageIndex 获取页眉实例 */
|
|
48488
49093
|
getHeader(pageIndex, section) {
|
|
48489
49094
|
const hasEvenOdd = this.settings?.isEvenAndOddEnabled();
|
|
@@ -49486,19 +50091,19 @@ function getBpmnFieldAuthMap(list) {
|
|
|
49486
50091
|
);
|
|
49487
50092
|
}
|
|
49488
50093
|
function deduplicateFields(data) {
|
|
49489
|
-
const
|
|
50094
|
+
const map = /* @__PURE__ */ new Map();
|
|
49490
50095
|
data.forEach((item) => {
|
|
49491
50096
|
const key = `${item.modelKey}_${item.field}`;
|
|
49492
|
-
if (!
|
|
49493
|
-
|
|
50097
|
+
if (!map.has(key)) {
|
|
50098
|
+
map.set(key, item);
|
|
49494
50099
|
} else {
|
|
49495
|
-
const existing =
|
|
50100
|
+
const existing = map.get(key);
|
|
49496
50101
|
if (item.edit && !existing.edit) {
|
|
49497
|
-
|
|
50102
|
+
map.set(key, item);
|
|
49498
50103
|
}
|
|
49499
50104
|
}
|
|
49500
50105
|
});
|
|
49501
|
-
return [...
|
|
50106
|
+
return [...map.values()];
|
|
49502
50107
|
}
|
|
49503
50108
|
class DocRequestStrategy {
|
|
49504
50109
|
props;
|
|
@@ -49844,13 +50449,23 @@ const withRequestCache = new RequestCache({
|
|
|
49844
50449
|
enableLogging: true
|
|
49845
50450
|
// 启用日志
|
|
49846
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
|
+
];
|
|
49847
50462
|
function transformSourceData(sourceData, i18nData) {
|
|
49848
50463
|
const clone2 = cloneDeep(sourceData);
|
|
49849
50464
|
const _DICT = i18nData ? Object.keys(clone2).reduce((acc, key) => {
|
|
49850
|
-
const
|
|
50465
|
+
const map = i18nData[key];
|
|
49851
50466
|
const value = clone2[key];
|
|
49852
|
-
if (
|
|
49853
|
-
const labels = String(value).split(",").map((k) =>
|
|
50467
|
+
if (map && value) {
|
|
50468
|
+
const labels = String(value).split(",").map((k) => map[k]);
|
|
49854
50469
|
acc[key] = { [value]: labels };
|
|
49855
50470
|
}
|
|
49856
50471
|
return acc;
|
|
@@ -49870,12 +50485,63 @@ function transformSourceDataList(data, dict = {}) {
|
|
|
49870
50485
|
return list || [];
|
|
49871
50486
|
}
|
|
49872
50487
|
function conversionFormState(payload) {
|
|
49873
|
-
const { interfaceData, masterSlaveList } = payload || {};
|
|
50488
|
+
const { interfaceData, masterSlaveList, instances } = payload || {};
|
|
49874
50489
|
const formState = {};
|
|
49875
50490
|
if (interfaceData && interfaceData.data) {
|
|
49876
50491
|
merge(formState, transformSourceData(interfaceData.data, interfaceData.dict));
|
|
49877
50492
|
}
|
|
49878
|
-
|
|
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) => {
|
|
49879
50545
|
const subFormData = formState[k];
|
|
49880
50546
|
if (subFormData) {
|
|
49881
50547
|
formState[k] = transformSourceDataList([...subFormData.data], subFormData.dict);
|
|
@@ -49884,43 +50550,52 @@ function conversionFormState(payload) {
|
|
|
49884
50550
|
return formState;
|
|
49885
50551
|
}
|
|
49886
50552
|
function getSubmitFormData(formData) {
|
|
49887
|
-
const
|
|
49888
|
-
|
|
49889
|
-
|
|
49890
|
-
const
|
|
49891
|
-
|
|
49892
|
-
)
|
|
49893
|
-
|
|
49894
|
-
|
|
49895
|
-
|
|
49896
|
-
|
|
49897
|
-
|
|
49898
|
-
|
|
49899
|
-
|
|
49900
|
-
|
|
49901
|
-
|
|
49902
|
-
|
|
49903
|
-
|
|
49904
|
-
|
|
49905
|
-
|
|
49906
|
-
|
|
49907
|
-
|
|
49908
|
-
|
|
49909
|
-
|
|
49910
|
-
|
|
49911
|
-
|
|
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;
|
|
49912
50587
|
if (key.endsWith("_lb_") && isEmpty(value)) return false;
|
|
49913
50588
|
return true;
|
|
49914
50589
|
})
|
|
49915
50590
|
)
|
|
49916
50591
|
);
|
|
49917
50592
|
} else {
|
|
49918
|
-
|
|
50593
|
+
reducedData[fieldKey] = fieldValue;
|
|
49919
50594
|
}
|
|
49920
|
-
return
|
|
50595
|
+
return reducedData;
|
|
49921
50596
|
}, {});
|
|
49922
|
-
console.log("
|
|
49923
|
-
return omit(realFormData,
|
|
50597
|
+
console.log("数据转成真实提交数据", realFormData);
|
|
50598
|
+
return omit(realFormData, FILTER_KEYS);
|
|
49924
50599
|
}
|
|
49925
50600
|
const API_CONFIG = {
|
|
49926
50601
|
ENTITY_CATEGORY: "entity",
|
|
@@ -50624,8 +51299,13 @@ async function applyAutofillRules(record, instances, autofillRules, masterSlaveL
|
|
|
50624
51299
|
const targetField = widgetMeta.field;
|
|
50625
51300
|
if (!targetField) continue;
|
|
50626
51301
|
let runtimeValuePath = targetField.valuePath;
|
|
51302
|
+
if (parseValuePath(runtimeValuePath).isLink) continue;
|
|
50627
51303
|
if (opts?.needReplacePathIndexPlaceholder) {
|
|
50628
|
-
|
|
51304
|
+
if (parseValuePath(opts.sourceValuePath).isLink) continue;
|
|
51305
|
+
runtimeValuePath = replacePathIndexPlaceholders({
|
|
51306
|
+
refPath: opts.sourceValuePath,
|
|
51307
|
+
templatePath: runtimeValuePath
|
|
51308
|
+
});
|
|
50629
51309
|
}
|
|
50630
51310
|
const computed2 = await computeFieldDefaultValue({
|
|
50631
51311
|
fieldType: targetField.fieldType,
|
|
@@ -51169,15 +51849,17 @@ const handleParameterMapping = async (parameterMapping, paramsConfig, fieldPermi
|
|
|
51169
51849
|
const processParamItem = async (item) => {
|
|
51170
51850
|
if (!referenceMap.has(item.formKey)) return;
|
|
51171
51851
|
const value = referenceMap.get(item.formKey);
|
|
51172
|
-
const valuePath = generateValuePath(item.field, item?.subModel ? item.subFieldKey : "");
|
|
51173
51852
|
const widget = instances.find((instance2) => {
|
|
51174
51853
|
const fieldMeta = instance2.widgetMeta?.field;
|
|
51175
51854
|
if (item?.subModel) {
|
|
51176
|
-
|
|
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;
|
|
51177
51858
|
}
|
|
51178
51859
|
return item.field === getLastSegment(fieldMeta?.fieldLink) && !fieldMeta?.subFieldKey;
|
|
51179
51860
|
});
|
|
51180
51861
|
if (widget) {
|
|
51862
|
+
const valuePath = widget.valuePath;
|
|
51181
51863
|
const computed2 = await computeFieldDefaultValue({
|
|
51182
51864
|
fieldType: item.fieldType,
|
|
51183
51865
|
fieldMeta: widget.widgetMeta.field,
|
|
@@ -51189,8 +51871,6 @@ const handleParameterMapping = async (parameterMapping, paramsConfig, fieldPermi
|
|
|
51189
51871
|
allowSubModelRequest: true
|
|
51190
51872
|
});
|
|
51191
51873
|
merge(paramMap, computed2);
|
|
51192
|
-
} else {
|
|
51193
|
-
merge(paramMap, { [valuePath]: toFormatValue(item.fieldType, value) });
|
|
51194
51874
|
}
|
|
51195
51875
|
};
|
|
51196
51876
|
await Promise.all([...builtinParams, ...compParams].map(processParamItem));
|
|
@@ -51208,11 +51888,10 @@ const buildPathMapFromApiResult = (onFieldMap, result, subTableInfo) => {
|
|
|
51208
51888
|
onFieldMap.forEach((item) => {
|
|
51209
51889
|
if (item.subModel === 0) {
|
|
51210
51890
|
const firstRow = data[0];
|
|
51211
|
-
item.fields.forEach(({ isFieldModel,
|
|
51891
|
+
item.fields.forEach(({ isFieldModel, fieldLink, rightFieldKey, valuePath }) => {
|
|
51212
51892
|
const srcKey = rightFieldKey;
|
|
51213
51893
|
const value = isFieldModel ? firstRow?.__FOREIGN__?.[fieldLink] : firstRow?.[srcKey];
|
|
51214
|
-
if (value != null) {
|
|
51215
|
-
const valuePath = generateValuePath(leftFieldKey, "");
|
|
51894
|
+
if (value != null && valuePath) {
|
|
51216
51895
|
pathMap[valuePath] = value;
|
|
51217
51896
|
const label = getLabelFromDict(srcKey, value);
|
|
51218
51897
|
if (label != null) pathMap[`${valuePath}_lb_`] = label;
|
|
@@ -51220,12 +51899,15 @@ const buildPathMapFromApiResult = (onFieldMap, result, subTableInfo) => {
|
|
|
51220
51899
|
});
|
|
51221
51900
|
} else if (item.subModel === 1) {
|
|
51222
51901
|
data.forEach(
|
|
51223
|
-
(rowData, index2) => item.fields.forEach(({ isFieldModel,
|
|
51902
|
+
(rowData, index2) => item.fields.forEach(({ isFieldModel, fieldLink, rightFieldKey, valuePath }) => {
|
|
51224
51903
|
const srcKey = rightFieldKey;
|
|
51225
51904
|
const value = isFieldModel ? rowData?.__FOREIGN__?.[fieldLink] : rowData?.[srcKey];
|
|
51226
|
-
if (value != null) {
|
|
51227
|
-
const
|
|
51228
|
-
|
|
51905
|
+
if (value != null && valuePath) {
|
|
51906
|
+
const runtimeValuePath = replacePathIndexPlaceholders({
|
|
51907
|
+
y: index2,
|
|
51908
|
+
n: index2,
|
|
51909
|
+
templatePath: valuePath
|
|
51910
|
+
});
|
|
51229
51911
|
pathMap[runtimeValuePath] = value;
|
|
51230
51912
|
const label = getLabelFromDict(srcKey, value);
|
|
51231
51913
|
if (label != null) pathMap[`${runtimeValuePath}_lb_`] = label;
|
|
@@ -51236,7 +51918,7 @@ const buildPathMapFromApiResult = (onFieldMap, result, subTableInfo) => {
|
|
|
51236
51918
|
});
|
|
51237
51919
|
return pathMap;
|
|
51238
51920
|
};
|
|
51239
|
-
const handleCustomDataSource = async (customDataSource, paramsConfig, subTableInfo, instanceId) => {
|
|
51921
|
+
const handleCustomDataSource = async (customDataSource, paramsConfig, subTableInfo, instanceId, instances) => {
|
|
51240
51922
|
if (!customDataSource.length || !paramsConfig) {
|
|
51241
51923
|
return {};
|
|
51242
51924
|
}
|
|
@@ -51257,7 +51939,26 @@ const handleCustomDataSource = async (customDataSource, paramsConfig, subTableIn
|
|
|
51257
51939
|
formKey: ex.formKey
|
|
51258
51940
|
};
|
|
51259
51941
|
}),
|
|
51260
|
-
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
|
+
})
|
|
51261
51962
|
};
|
|
51262
51963
|
});
|
|
51263
51964
|
for (const info of customDsList) {
|
|
@@ -51326,7 +52027,11 @@ const handleCustomDataSource = async (customDataSource, paramsConfig, subTableIn
|
|
|
51326
52027
|
Object.entries(rowData).forEach(([key, value]) => {
|
|
51327
52028
|
if (value != null) {
|
|
51328
52029
|
const valuePath = generateValuePath(key, item.subFieldKey);
|
|
51329
|
-
const runtimeValuePath =
|
|
52030
|
+
const runtimeValuePath = replacePathIndexPlaceholders({
|
|
52031
|
+
y: index2,
|
|
52032
|
+
n: index2,
|
|
52033
|
+
templatePath: valuePath
|
|
52034
|
+
});
|
|
51330
52035
|
ipaasPathMap[runtimeValuePath] = value;
|
|
51331
52036
|
}
|
|
51332
52037
|
});
|
|
@@ -51385,7 +52090,7 @@ const handleCustomDataSource = async (customDataSource, paramsConfig, subTableIn
|
|
|
51385
52090
|
}
|
|
51386
52091
|
}
|
|
51387
52092
|
const results = await Promise.all(promises);
|
|
51388
|
-
return results.reduce((merged,
|
|
52093
|
+
return results.reduce((merged, map) => merge(merged, map), {});
|
|
51389
52094
|
};
|
|
51390
52095
|
const loadDataInitValues = async (dataInitConfig, paramsConfig, subTableInfo, fieldPermission, instanceId, instances, ctx) => {
|
|
51391
52096
|
if (!dataInitConfig) return { paramMap: {}, dsRawData: {} };
|
|
@@ -51401,7 +52106,8 @@ const loadDataInitValues = async (dataInitConfig, paramsConfig, subTableInfo, fi
|
|
|
51401
52106
|
customDataSource,
|
|
51402
52107
|
paramsConfig,
|
|
51403
52108
|
subTableInfo,
|
|
51404
|
-
instanceId
|
|
52109
|
+
instanceId,
|
|
52110
|
+
instances
|
|
51405
52111
|
);
|
|
51406
52112
|
return { paramMap, dsMap };
|
|
51407
52113
|
};
|
|
@@ -51614,7 +52320,8 @@ async function initializeDocumentEngine(props, payload, result) {
|
|
|
51614
52320
|
console.log("接口获取接口数据 ===>", interfaceData);
|
|
51615
52321
|
const rawData = conversionFormState({
|
|
51616
52322
|
masterSlaveList,
|
|
51617
|
-
interfaceData
|
|
52323
|
+
interfaceData,
|
|
52324
|
+
instances
|
|
51618
52325
|
});
|
|
51619
52326
|
const docRuntimeMeta = {
|
|
51620
52327
|
...requestInfo,
|
|
@@ -51720,7 +52427,11 @@ function useDocumentFactory(props, payload) {
|
|
|
51720
52427
|
instances,
|
|
51721
52428
|
isMockReport: payload.isMockReport || payload.factoryType === "template"
|
|
51722
52429
|
});
|
|
51723
|
-
const rawData = conversionFormState({
|
|
52430
|
+
const rawData = conversionFormState({
|
|
52431
|
+
masterSlaveList,
|
|
52432
|
+
interfaceData,
|
|
52433
|
+
instances
|
|
52434
|
+
});
|
|
51724
52435
|
doc.dataManager.setRawData(rawData);
|
|
51725
52436
|
await nextTick();
|
|
51726
52437
|
doc.docRuntimeMeta.handleInfo.initRawDataSnapshot = cloneDeep(doc.dataManager.getRawData());
|
|
@@ -52496,12 +53207,20 @@ const DROPDOWN_TYPES = /* @__PURE__ */ new Set([
|
|
|
52496
53207
|
"fw:rdo-table-select"
|
|
52497
53208
|
]);
|
|
52498
53209
|
const DIALOG_TYPES = /* @__PURE__ */ new Set(["fw:signature", "fw:image", "fw:file"]);
|
|
53210
|
+
function useMetaFromWidget(widget, metaKey) {
|
|
53211
|
+
const meta = computed(() => widget?.[metaKey] ?? {});
|
|
53212
|
+
const props = computed(() => meta.value.props ?? {});
|
|
53213
|
+
const widgetType = computed(() => meta.value.type);
|
|
53214
|
+
return { meta, props, widgetType };
|
|
53215
|
+
}
|
|
52499
53216
|
function useWidgetMeta(widget) {
|
|
52500
|
-
const
|
|
53217
|
+
const {
|
|
53218
|
+
meta: widgetMeta,
|
|
53219
|
+
props: widgetProps,
|
|
53220
|
+
widgetType
|
|
53221
|
+
} = useMetaFromWidget(widget, "widgetMeta");
|
|
52501
53222
|
const fieldMeta = computed(() => widgetMeta.value.field);
|
|
52502
|
-
const widgetProps = computed(() => widgetMeta.value.props ?? {});
|
|
52503
53223
|
const runtimeValuePath = computed(() => widget.valuePath || fieldMeta.value?.valuePath || "");
|
|
52504
|
-
const widgetType = computed(() => widgetMeta.value.type);
|
|
52505
53224
|
const isMultiple = computed(() => MULTIPLE_TYPES.has(widgetType.value));
|
|
52506
53225
|
const isAsync = computed(() => ASYNC_TYPES.has(widgetType.value));
|
|
52507
53226
|
const isDropdown = computed(() => {
|
|
@@ -52523,6 +53242,14 @@ function useWidgetMeta(widget) {
|
|
|
52523
53242
|
isDialog
|
|
52524
53243
|
};
|
|
52525
53244
|
}
|
|
53245
|
+
function usePaperWidgetMeta(widget) {
|
|
53246
|
+
const {
|
|
53247
|
+
meta: pageWidgetMeta,
|
|
53248
|
+
props: pageWidgetProps,
|
|
53249
|
+
widgetType
|
|
53250
|
+
} = useMetaFromWidget(widget, "pageWidgetMeta");
|
|
53251
|
+
return { pageWidgetMeta, pageWidgetProps, widgetType };
|
|
53252
|
+
}
|
|
52526
53253
|
function useFieldInfo(fieldMeta) {
|
|
52527
53254
|
const designCtx = useDesignSuiteContext();
|
|
52528
53255
|
const field = computed(() => fieldMeta());
|
|
@@ -52611,6 +53338,17 @@ function useWidgetStaticAttrs(widget) {
|
|
|
52611
53338
|
showDisplayStatus: newDisplayStatus
|
|
52612
53339
|
};
|
|
52613
53340
|
}
|
|
53341
|
+
function usePaperWidgetStaticAttrs(widget) {
|
|
53342
|
+
const { docInst, isDesignMode } = useDocPubApiContext();
|
|
53343
|
+
const { pageWidgetMeta, pageWidgetProps, widgetType } = usePaperWidgetMeta(widget);
|
|
53344
|
+
return {
|
|
53345
|
+
docInst,
|
|
53346
|
+
isDesignMode,
|
|
53347
|
+
pageWidgetMeta,
|
|
53348
|
+
pageWidgetProps,
|
|
53349
|
+
widgetType
|
|
53350
|
+
};
|
|
53351
|
+
}
|
|
52614
53352
|
const _hoisted_1$1U = { class: "dropdown-container" };
|
|
52615
53353
|
const _sfc_main$2S = /* @__PURE__ */ defineComponent({
|
|
52616
53354
|
__name: "dropdown-container",
|
|
@@ -52666,7 +53404,7 @@ const _sfc_main$2S = /* @__PURE__ */ defineComponent({
|
|
|
52666
53404
|
};
|
|
52667
53405
|
}
|
|
52668
53406
|
});
|
|
52669
|
-
const DropdownContainer = /* @__PURE__ */ _export_sfc(_sfc_main$2S, [["__scopeId", "data-v-
|
|
53407
|
+
const DropdownContainer = /* @__PURE__ */ _export_sfc(_sfc_main$2S, [["__scopeId", "data-v-c9c3a05b"]]);
|
|
52670
53408
|
const _hoisted_1$1T = { class: "dialog-container" };
|
|
52671
53409
|
const _sfc_main$2R = /* @__PURE__ */ defineComponent({
|
|
52672
53410
|
__name: "dialog-container",
|
|
@@ -54351,7 +55089,7 @@ const _sfc_main$2Q = /* @__PURE__ */ defineComponent({
|
|
|
54351
55089
|
};
|
|
54352
55090
|
}
|
|
54353
55091
|
});
|
|
54354
|
-
const OverlayRender = /* @__PURE__ */ _export_sfc(_sfc_main$2Q, [["__scopeId", "data-v-
|
|
55092
|
+
const OverlayRender = /* @__PURE__ */ _export_sfc(_sfc_main$2Q, [["__scopeId", "data-v-1d10a573"]]);
|
|
54355
55093
|
let activeHoverId = 0;
|
|
54356
55094
|
function useHoverDelay(callback, delay = 120) {
|
|
54357
55095
|
let timer = null;
|
|
@@ -55350,14 +56088,18 @@ function buildPosMap(layers, getRect, toDom) {
|
|
|
55350
56088
|
function getDataIndexLayersMap({
|
|
55351
56089
|
type: type4,
|
|
55352
56090
|
cells,
|
|
55353
|
-
|
|
56091
|
+
isDesign,
|
|
55354
56092
|
convertExtraProps
|
|
55355
56093
|
}) {
|
|
55356
56094
|
const getDataIndex = (cell) => {
|
|
55357
|
-
return type4
|
|
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;
|
|
55358
56100
|
};
|
|
55359
56101
|
const _cells = cells.filter(
|
|
55360
|
-
(cell) =>
|
|
56102
|
+
(cell) => isNumber(getAllDataIndex(cell)) && cell?.subRenderer?.type === type4
|
|
55361
56103
|
);
|
|
55362
56104
|
if (!_cells.length) return {};
|
|
55363
56105
|
const grouped = groupBy(
|
|
@@ -55366,13 +56108,20 @@ function getDataIndexLayersMap({
|
|
|
55366
56108
|
);
|
|
55367
56109
|
const layersMapEntries = Object.entries(grouped).map(([id, __cells]) => {
|
|
55368
56110
|
const firstCell = __cells[0];
|
|
55369
|
-
const
|
|
55370
|
-
const
|
|
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);
|
|
55371
56120
|
const bgLayer = createTableOutlineLayer({
|
|
55372
56121
|
cells: mapCellsToOutlineCells(__cells),
|
|
55373
56122
|
inset: 4
|
|
55374
56123
|
});
|
|
55375
|
-
const borderLayer =
|
|
56124
|
+
const borderLayer = isFirstGroup ? createTableOutlineLayer({
|
|
55376
56125
|
cells: mapCellsToOutlineCells(__cells),
|
|
55377
56126
|
inset: OUTLINE_BORDER_INSET
|
|
55378
56127
|
}) : { hLines: [], vLines: [], backgroundRect: null, labelPos: void 0 };
|
|
@@ -55381,7 +56130,7 @@ function getDataIndexLayersMap({
|
|
|
55381
56130
|
{
|
|
55382
56131
|
...borderLayer,
|
|
55383
56132
|
...convertExtraProps(firstCell),
|
|
55384
|
-
showBorder:
|
|
56133
|
+
showBorder: isFirstGroup,
|
|
55385
56134
|
placeholderBjRect: bgLayer.backgroundRect,
|
|
55386
56135
|
lastCell
|
|
55387
56136
|
}
|
|
@@ -55699,49 +56448,6 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
|
|
|
55699
56448
|
}))
|
|
55700
56449
|
)
|
|
55701
56450
|
);
|
|
55702
|
-
const dataGroup2DCells = computed(() => {
|
|
55703
|
-
const dataGroup2DList = [];
|
|
55704
|
-
const cells = [];
|
|
55705
|
-
props.rows.flatMap((row) => row.cells).filter((cell) => cell?.subRenderer?.id && ["check-table", "2d-table"].includes(cell.subRenderer.type)).forEach((cell) => {
|
|
55706
|
-
if (dataGroup2DList.find((o) => o.subTableId === cell.subRenderer.id)) return;
|
|
55707
|
-
dataGroup2DList.push({
|
|
55708
|
-
subTableId: cell.subRenderer.id,
|
|
55709
|
-
subTableType: cell.subRenderer.type,
|
|
55710
|
-
subTableValuePath: cell.subRenderer.valuePath,
|
|
55711
|
-
dataGroup2DAreaRange: cell.subRenderer?.dataGroup2DAreaRange
|
|
55712
|
-
});
|
|
55713
|
-
});
|
|
55714
|
-
dataGroup2DList.forEach(({ subTableId, subTableType, subTableValuePath, dataGroup2DAreaRange }) => {
|
|
55715
|
-
if (!dataGroup2DAreaRange?.start) return;
|
|
55716
|
-
const {
|
|
55717
|
-
start: { row: startRow, col: startCol },
|
|
55718
|
-
end: { row: endRow, col: endCol }
|
|
55719
|
-
} = dataGroup2DAreaRange;
|
|
55720
|
-
props.rows.forEach((row, rowIndex) => {
|
|
55721
|
-
row.cells.forEach((cell, colIndex) => {
|
|
55722
|
-
const isInRange = rowIndex >= startRow && rowIndex <= endRow && colIndex >= startCol && colIndex <= endCol;
|
|
55723
|
-
if (isInRange) {
|
|
55724
|
-
const fakeDataIndex = colIndex - dataGroup2DAreaRange.start.col;
|
|
55725
|
-
cells.push({
|
|
55726
|
-
...cell,
|
|
55727
|
-
rowY: row.y,
|
|
55728
|
-
layoutY: row.layoutY,
|
|
55729
|
-
// 伪造动态关联的 subRenderer
|
|
55730
|
-
subRenderer: {
|
|
55731
|
-
id: subTableId,
|
|
55732
|
-
type: subTableType,
|
|
55733
|
-
valuePath: subTableValuePath,
|
|
55734
|
-
dataIndex: fakeDataIndex,
|
|
55735
|
-
xDataIndex: fakeDataIndex
|
|
55736
|
-
}
|
|
55737
|
-
});
|
|
55738
|
-
}
|
|
55739
|
-
});
|
|
55740
|
-
});
|
|
55741
|
-
});
|
|
55742
|
-
const uniqueCells = Object.values(groupBy(cells, (c2) => c2.id)).map((cells2) => cells2[0]).filter(Boolean);
|
|
55743
|
-
return uniqueCells;
|
|
55744
|
-
});
|
|
55745
56451
|
const pageBaseOffset = computed(() => {
|
|
55746
56452
|
const node = props.doc.layoutMapper.getBaseMetaNodeById(tableId.value);
|
|
55747
56453
|
if (!node) return null;
|
|
@@ -55753,7 +56459,15 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
|
|
|
55753
56459
|
};
|
|
55754
56460
|
});
|
|
55755
56461
|
const outlineLayers = computed(() => {
|
|
55756
|
-
const
|
|
56462
|
+
const filteredCells = subTableCells.value.filter(({ subRenderer }) => {
|
|
56463
|
+
if (subRenderer) {
|
|
56464
|
+
const { type: type4, cellZone } = subRenderer;
|
|
56465
|
+
return isLinkSubTableType(type4) ? isLinkSubTableSubScopeZone(cellZone) : true;
|
|
56466
|
+
} else {
|
|
56467
|
+
return true;
|
|
56468
|
+
}
|
|
56469
|
+
});
|
|
56470
|
+
const grouped = groupBy(filteredCells, (cell) => cell.subRenderer.id);
|
|
55757
56471
|
return Object.fromEntries(
|
|
55758
56472
|
Object.entries(grouped).map(([id, cells]) => {
|
|
55759
56473
|
const outline = createTableOutlineLayer({
|
|
@@ -55775,7 +56489,7 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
|
|
|
55775
56489
|
() => getDataIndexLayersMap({
|
|
55776
56490
|
type: "fixed-table",
|
|
55777
56491
|
cells: subTableCells.value,
|
|
55778
|
-
|
|
56492
|
+
isDesign: true,
|
|
55779
56493
|
convertExtraProps: (cell) => ({
|
|
55780
56494
|
type: "data-group",
|
|
55781
56495
|
valuePath: cell.subRenderer.valuePath,
|
|
@@ -55786,20 +56500,20 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
|
|
|
55786
56500
|
const checkTableDataGroup2DLayersMap = computed(
|
|
55787
56501
|
() => getDataIndexLayersMap({
|
|
55788
56502
|
type: "check-table",
|
|
55789
|
-
cells:
|
|
55790
|
-
|
|
56503
|
+
cells: subTableCells.value,
|
|
56504
|
+
isDesign: true,
|
|
55791
56505
|
convertExtraProps: (cell) => ({
|
|
55792
56506
|
type: "data-group-2d",
|
|
55793
56507
|
valuePath: cell.subRenderer.valuePath,
|
|
55794
|
-
placeholder: `${cell.subRenderer.
|
|
56508
|
+
placeholder: `${cell.subRenderer.xDataIndex}`
|
|
55795
56509
|
})
|
|
55796
56510
|
})
|
|
55797
56511
|
);
|
|
55798
56512
|
const _2DTableDataGroup2DLayersMap = computed(
|
|
55799
56513
|
() => getDataIndexLayersMap({
|
|
55800
56514
|
type: "2d-table",
|
|
55801
|
-
cells:
|
|
55802
|
-
|
|
56515
|
+
cells: subTableCells.value,
|
|
56516
|
+
isDesign: true,
|
|
55803
56517
|
convertExtraProps: (cell) => ({
|
|
55804
56518
|
type: "data-group-2d",
|
|
55805
56519
|
valuePath: cell.subRenderer.valuePath,
|
|
@@ -56632,18 +57346,24 @@ const _sfc_main$2y = /* @__PURE__ */ defineComponent({
|
|
|
56632
57346
|
upRowNum: 1,
|
|
56633
57347
|
downRowNum: 1
|
|
56634
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
|
+
};
|
|
56635
57356
|
const getCtx = () => {
|
|
56636
|
-
const {
|
|
57357
|
+
const { valuePath, dataIndex, yDataIndex } = props.cell.subRenderer;
|
|
56637
57358
|
return {
|
|
56638
|
-
|
|
56639
|
-
index:
|
|
57359
|
+
...resolveRowDataPath(valuePath),
|
|
57360
|
+
index: yDataIndex ?? dataIndex ?? 0
|
|
56640
57361
|
};
|
|
56641
57362
|
};
|
|
56642
57363
|
const readonly2 = computed(() => {
|
|
56643
|
-
const subFieldKey = getLastSegment(getCtx().path);
|
|
56644
57364
|
const state = resolveWidgetState({
|
|
56645
57365
|
doc: props.doc,
|
|
56646
|
-
fieldLink: subFieldKey,
|
|
57366
|
+
fieldLink: getCtx().subFieldKey,
|
|
56647
57367
|
modelLink: props.doc.mainModelKey
|
|
56648
57368
|
});
|
|
56649
57369
|
return state.displayStatus === "readonly-component" || state.displayStatus === "readonly-text";
|
|
@@ -56800,7 +57520,7 @@ const _sfc_main$2y = /* @__PURE__ */ defineComponent({
|
|
|
56800
57520
|
};
|
|
56801
57521
|
}
|
|
56802
57522
|
});
|
|
56803
|
-
const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2y, [["__scopeId", "data-v-
|
|
57523
|
+
const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2y, [["__scopeId", "data-v-a58c6b2e"]]);
|
|
56804
57524
|
const _sfc_main$2x = /* @__PURE__ */ defineComponent({
|
|
56805
57525
|
__name: "index",
|
|
56806
57526
|
props: {
|
|
@@ -56844,7 +57564,7 @@ const _sfc_main$2x = /* @__PURE__ */ defineComponent({
|
|
|
56844
57564
|
return getDataIndexLayersMap({
|
|
56845
57565
|
type: type4,
|
|
56846
57566
|
cells: subTableCells.value,
|
|
56847
|
-
|
|
57567
|
+
isDesign: false,
|
|
56848
57568
|
convertExtraProps: () => ({
|
|
56849
57569
|
type: type4,
|
|
56850
57570
|
placeholder: "",
|
|
@@ -57237,7 +57957,10 @@ function diffListField(fieldKey, beforeRows, afterRows, metaMap, output) {
|
|
|
57237
57957
|
continue;
|
|
57238
57958
|
}
|
|
57239
57959
|
const valuePath = generateValuePath(rowFieldKey, fieldKey);
|
|
57240
|
-
const runtimeValuePath =
|
|
57960
|
+
const runtimeValuePath = replacePathIndexPlaceholders({
|
|
57961
|
+
n: rowIndex,
|
|
57962
|
+
templatePath: valuePath
|
|
57963
|
+
});
|
|
57241
57964
|
const meta = getFieldMeta(metaMap, runtimeValuePath);
|
|
57242
57965
|
pushChange(output, {
|
|
57243
57966
|
beforeValue,
|
|
@@ -57263,7 +57986,7 @@ function diffMainField(fieldKey, beforeValue, afterValue, beforeData, afterData,
|
|
|
57263
57986
|
});
|
|
57264
57987
|
}
|
|
57265
57988
|
function buildWidgetFieldMetaMap(instances) {
|
|
57266
|
-
const
|
|
57989
|
+
const map = /* @__PURE__ */ new Map();
|
|
57267
57990
|
for (const instance2 of instances || []) {
|
|
57268
57991
|
const widgetMeta = instance2?.widgetMeta;
|
|
57269
57992
|
const fieldMeta = widgetMeta?.field;
|
|
@@ -57276,10 +57999,10 @@ function buildWidgetFieldMetaMap(instances) {
|
|
|
57276
57999
|
modelId: instance2.modelRef.id,
|
|
57277
58000
|
points: instance2?.widgetMeta?.extra?.biz?.[instance2.modelRef.id] || {}
|
|
57278
58001
|
};
|
|
57279
|
-
|
|
58002
|
+
map.set(runtimeValuePath, value);
|
|
57280
58003
|
}
|
|
57281
|
-
console.log("map",
|
|
57282
|
-
return
|
|
58004
|
+
console.log("map", map);
|
|
58005
|
+
return map;
|
|
57283
58006
|
}
|
|
57284
58007
|
function buildFieldChangeList(params) {
|
|
57285
58008
|
const baseline = normalizeFormData(params.baselineData);
|
|
@@ -59215,8 +59938,10 @@ const _sfc_main$2l = /* @__PURE__ */ defineComponent({
|
|
|
59215
59938
|
}[type4];
|
|
59216
59939
|
const usedSubModelKeys = (docInst.value.model?.document.body.children || []).map((w2) => {
|
|
59217
59940
|
if (w2.name === "w:tbl" && (w2.hasBounded || w2.hasCheckTable || w2.hasRepeating || w2.has2DTable)) {
|
|
59218
|
-
const
|
|
59219
|
-
return
|
|
59941
|
+
const subTableRegions = [...w2.bounded, ...w2.checkTable, ...w2.repeating, ...w2._2DTable];
|
|
59942
|
+
return subTableRegions.flatMap((region) => {
|
|
59943
|
+
return region.valuePath.replace("$.", "").split(":");
|
|
59944
|
+
});
|
|
59220
59945
|
} else {
|
|
59221
59946
|
return [];
|
|
59222
59947
|
}
|
|
@@ -59545,7 +60270,7 @@ const _sfc_main$2l = /* @__PURE__ */ defineComponent({
|
|
|
59545
60270
|
};
|
|
59546
60271
|
}
|
|
59547
60272
|
});
|
|
59548
|
-
const WordTable = /* @__PURE__ */ _export_sfc(_sfc_main$2l, [["__scopeId", "data-v-
|
|
60273
|
+
const WordTable = /* @__PURE__ */ _export_sfc(_sfc_main$2l, [["__scopeId", "data-v-77cd5ff0"]]);
|
|
59549
60274
|
const _hoisted_1$1F = { class: "ribbon" };
|
|
59550
60275
|
const _hoisted_2$14 = { class: "ribbon-content-wrapper" };
|
|
59551
60276
|
const _sfc_main$2k = /* @__PURE__ */ defineComponent({
|
|
@@ -59735,17 +60460,24 @@ function useHighlightSearch() {
|
|
|
59735
60460
|
highlightName
|
|
59736
60461
|
};
|
|
59737
60462
|
}
|
|
59738
|
-
function
|
|
60463
|
+
function buildPaletteExtra(manifest2, label, opts) {
|
|
60464
|
+
return {
|
|
60465
|
+
extensions: manifest2.extensions,
|
|
60466
|
+
biz: {
|
|
60467
|
+
fromField: true,
|
|
60468
|
+
source: opts.source ?? "palette",
|
|
60469
|
+
fieldIdentity: { label }
|
|
60470
|
+
}
|
|
60471
|
+
};
|
|
60472
|
+
}
|
|
60473
|
+
function createDesignFieldToWidgetFactory(getManifest) {
|
|
59739
60474
|
return function createWidgetFromField(field, opts = {}) {
|
|
59740
|
-
const manifest2 =
|
|
60475
|
+
const manifest2 = getManifest(field.type);
|
|
59741
60476
|
const valuePath = generateValuePath(field.key, opts.parentFieldKey || "");
|
|
59742
60477
|
return {
|
|
59743
60478
|
id: uuid(),
|
|
59744
60479
|
type: manifest2.component,
|
|
59745
|
-
layout: {
|
|
59746
|
-
width: 70,
|
|
59747
|
-
height: 18
|
|
59748
|
-
},
|
|
60480
|
+
layout: { width: 70, height: 18 },
|
|
59749
60481
|
props: {
|
|
59750
60482
|
...manifest2.defaultProps ?? {},
|
|
59751
60483
|
...opts.overrideProps ?? {}
|
|
@@ -59766,16 +60498,31 @@ function createDesignFieldToWidgetFactory(getFieldManifest) {
|
|
|
59766
60498
|
valuePath,
|
|
59767
60499
|
...opts.parentFieldKey ? { subFieldKey: opts.parentFieldKey } : void 0
|
|
59768
60500
|
},
|
|
59769
|
-
extra:
|
|
59770
|
-
|
|
59771
|
-
|
|
59772
|
-
|
|
59773
|
-
|
|
59774
|
-
|
|
59775
|
-
|
|
59776
|
-
|
|
59777
|
-
|
|
59778
|
-
|
|
60501
|
+
extra: buildPaletteExtra(manifest2, field.name, opts)
|
|
60502
|
+
};
|
|
60503
|
+
};
|
|
60504
|
+
}
|
|
60505
|
+
function createDesignPaperWidgetToWidgetFactory(getManifest) {
|
|
60506
|
+
return function createWidgetFromPaperWidget(widget, opts = {}) {
|
|
60507
|
+
const manifest2 = getManifest(widget.type);
|
|
60508
|
+
return {
|
|
60509
|
+
id: uuid(),
|
|
60510
|
+
type: manifest2.component,
|
|
60511
|
+
layout: manifest2.defaultLayout || {},
|
|
60512
|
+
props: {
|
|
60513
|
+
...manifest2.defaultProps ?? {},
|
|
60514
|
+
...opts.overrideProps ?? {}
|
|
60515
|
+
},
|
|
60516
|
+
behavior: {
|
|
60517
|
+
draggable: manifest2.allowDrag,
|
|
60518
|
+
resizable: false,
|
|
60519
|
+
copyable: false,
|
|
60520
|
+
removable: false,
|
|
60521
|
+
droppable: false,
|
|
60522
|
+
outOfFlow: !!manifest2.outOfFlow
|
|
60523
|
+
},
|
|
60524
|
+
widget: { widgetType: widget.type },
|
|
60525
|
+
extra: buildPaletteExtra(manifest2, widget.name, opts)
|
|
59779
60526
|
};
|
|
59780
60527
|
};
|
|
59781
60528
|
}
|
|
@@ -59802,19 +60549,18 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
|
|
|
59802
60549
|
const { keyword, highlightName } = useHighlightSearch();
|
|
59803
60550
|
const createFieldToWidget = createDesignFieldToWidgetFactory(designCtx.getFieldManifest);
|
|
59804
60551
|
const subFieldKey = computed(() => {
|
|
59805
|
-
if (!interCtx.panelData) return "";
|
|
59806
|
-
return
|
|
60552
|
+
if (!interCtx.panelData?.context?.subFieldKey) return "";
|
|
60553
|
+
return parseValuePath(interCtx.panelData.context.subFieldKey).normalized;
|
|
59807
60554
|
});
|
|
59808
60555
|
const modelKey = computed(() => {
|
|
59809
60556
|
if (!interCtx.panelData) return "";
|
|
59810
|
-
const mainModelKey = interCtx.panelData.context
|
|
60557
|
+
const { mainModelKey, isDataGroup2DClicked } = interCtx.panelData.context;
|
|
59811
60558
|
if (!mainModelKey) return "";
|
|
59812
60559
|
const fullSubKey = subFieldKey.value;
|
|
59813
60560
|
if (fullSubKey) {
|
|
59814
60561
|
let singleSubKey = fullSubKey;
|
|
59815
60562
|
if (fullSubKey.includes(":")) {
|
|
59816
|
-
|
|
59817
|
-
singleSubKey = fullSubKey.split(":")[keyIndex];
|
|
60563
|
+
singleSubKey = fullSubKey.split(":")[isDataGroup2DClicked ? 1 : 0];
|
|
59818
60564
|
}
|
|
59819
60565
|
const field = designCtx.runtime.getFieldList(mainModelKey)?.find((f) => f.key === singleSubKey);
|
|
59820
60566
|
return field?.bindInfo ?? "";
|
|
@@ -59929,42 +60675,7 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
|
|
|
59929
60675
|
};
|
|
59930
60676
|
}
|
|
59931
60677
|
});
|
|
59932
|
-
const ToolkitContentFields = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__scopeId", "data-v-
|
|
59933
|
-
function createDesignPaperWidgetToWidgetFactory(getPaperWidgetManifest) {
|
|
59934
|
-
return function(widget, opts = {}) {
|
|
59935
|
-
const manifest2 = getPaperWidgetManifest(widget.type);
|
|
59936
|
-
return {
|
|
59937
|
-
id: uuid(),
|
|
59938
|
-
type: manifest2.component,
|
|
59939
|
-
layout: manifest2.defaultLayout || {},
|
|
59940
|
-
props: {
|
|
59941
|
-
...manifest2.defaultProps ?? {},
|
|
59942
|
-
...opts.overrideProps ?? {}
|
|
59943
|
-
},
|
|
59944
|
-
behavior: {
|
|
59945
|
-
draggable: manifest2.allowDrag,
|
|
59946
|
-
resizable: false,
|
|
59947
|
-
copyable: false,
|
|
59948
|
-
removable: false,
|
|
59949
|
-
droppable: false,
|
|
59950
|
-
outOfFlow: !!manifest2.outOfFlow
|
|
59951
|
-
},
|
|
59952
|
-
widget: {
|
|
59953
|
-
widgetType: widget.type
|
|
59954
|
-
},
|
|
59955
|
-
extra: {
|
|
59956
|
-
extensions: manifest2.extensions,
|
|
59957
|
-
biz: {
|
|
59958
|
-
fromField: true,
|
|
59959
|
-
source: opts.source ?? "palette",
|
|
59960
|
-
fieldIdentity: {
|
|
59961
|
-
label: widget.name
|
|
59962
|
-
}
|
|
59963
|
-
}
|
|
59964
|
-
}
|
|
59965
|
-
};
|
|
59966
|
-
};
|
|
59967
|
-
}
|
|
60678
|
+
const ToolkitContentFields = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__scopeId", "data-v-9c5fa2ca"]]);
|
|
59968
60679
|
const _hoisted_1$1C = { class: "toolkit-content-widgets" };
|
|
59969
60680
|
const _hoisted_2$11 = { key: 0 };
|
|
59970
60681
|
const _hoisted_3$M = ["data-type", "draggable", "onDragstart"];
|
|
@@ -60014,7 +60725,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
|
|
|
60014
60725
|
};
|
|
60015
60726
|
}
|
|
60016
60727
|
});
|
|
60017
|
-
const ToolkitContentWidgets = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__scopeId", "data-v-
|
|
60728
|
+
const ToolkitContentWidgets = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__scopeId", "data-v-393cb2aa"]]);
|
|
60018
60729
|
const _hoisted_1$1B = { class: "designer_toolkit-wrapper" };
|
|
60019
60730
|
const _sfc_main$2g = /* @__PURE__ */ defineComponent({
|
|
60020
60731
|
__name: "toolkit",
|
|
@@ -60237,14 +60948,14 @@ const _sfc_main$2e = /* @__PURE__ */ defineComponent({
|
|
|
60237
60948
|
bl: { x: x2 + padding.left, y: y2 + height - padding.bottom },
|
|
60238
60949
|
br: { x: x2 + width - padding.right, y: y2 + height - padding.bottom }
|
|
60239
60950
|
};
|
|
60240
|
-
const
|
|
60951
|
+
const map = {
|
|
60241
60952
|
tl: [-1, -1],
|
|
60242
60953
|
tr: [1, -1],
|
|
60243
60954
|
bl: [-1, 1],
|
|
60244
60955
|
br: [1, 1]
|
|
60245
60956
|
};
|
|
60246
60957
|
return Object.keys(corners).map((pos) => {
|
|
60247
|
-
const [dx, dy] =
|
|
60958
|
+
const [dx, dy] = map[pos];
|
|
60248
60959
|
const cx = halfPixel(corners[pos].x);
|
|
60249
60960
|
const cy = halfPixel(corners[pos].y);
|
|
60250
60961
|
return {
|
|
@@ -61121,7 +61832,7 @@ const _sfc_main$27 = /* @__PURE__ */ defineComponent({
|
|
|
61121
61832
|
};
|
|
61122
61833
|
}
|
|
61123
61834
|
});
|
|
61124
|
-
const ValidationCommentItem = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__scopeId", "data-v-
|
|
61835
|
+
const ValidationCommentItem = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__scopeId", "data-v-553b2a25"]]);
|
|
61125
61836
|
const _hoisted_1$1x = {
|
|
61126
61837
|
key: 0,
|
|
61127
61838
|
class: "validation-comment-layer"
|
|
@@ -63756,16 +64467,16 @@ const __vite_glob_0_42 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
|
|
|
63756
64467
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
63757
64468
|
function loadFieldManifestModules() {
|
|
63758
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 });
|
|
63759
|
-
const
|
|
64470
|
+
const map = {};
|
|
63760
64471
|
Object.entries(manifestModules).forEach(([path2, exports$1]) => {
|
|
63761
64472
|
const { manifest: manifest2 } = exports$1;
|
|
63762
64473
|
if (!manifest2) {
|
|
63763
64474
|
console.warn(`模块 ${path2} 缺少必要导出项`);
|
|
63764
64475
|
return;
|
|
63765
64476
|
}
|
|
63766
|
-
|
|
64477
|
+
map[manifest2.type] = manifest2;
|
|
63767
64478
|
});
|
|
63768
|
-
return
|
|
64479
|
+
return map;
|
|
63769
64480
|
}
|
|
63770
64481
|
const fieldManifestMap = loadFieldManifestModules();
|
|
63771
64482
|
const manifest$6 = {
|
|
@@ -64062,16 +64773,16 @@ const __vite_glob_0_6$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.d
|
|
|
64062
64773
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
64063
64774
|
function loadPaperWidgetManifestModules() {
|
|
64064
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 });
|
|
64065
|
-
const
|
|
64776
|
+
const map = {};
|
|
64066
64777
|
Object.entries(manifestModules).forEach(([path2, exports$1]) => {
|
|
64067
64778
|
const { manifest: manifest2 } = exports$1;
|
|
64068
64779
|
if (!manifest2) {
|
|
64069
64780
|
console.warn(`模块 ${path2} 缺少必要导出项`);
|
|
64070
64781
|
return;
|
|
64071
64782
|
}
|
|
64072
|
-
|
|
64783
|
+
map[manifest2.type] = manifest2;
|
|
64073
64784
|
});
|
|
64074
|
-
return
|
|
64785
|
+
return map;
|
|
64075
64786
|
}
|
|
64076
64787
|
const paperWidgetManifestMap = loadPaperWidgetManifestModules();
|
|
64077
64788
|
const UploadTypeConst = {
|
|
@@ -65081,27 +65792,6 @@ const __vite_glob_0_7$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.d
|
|
|
65081
65792
|
__proto__: null,
|
|
65082
65793
|
default: _sfc_main$1Q
|
|
65083
65794
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
65084
|
-
function usePaperWidgetMeta(widget) {
|
|
65085
|
-
const pageWidgetMeta = computed(() => widget?.pageWidgetMeta ?? {});
|
|
65086
|
-
const pageWidgetProps = computed(() => pageWidgetMeta.value.props ?? {});
|
|
65087
|
-
const widgetType = computed(() => pageWidgetMeta.value.type);
|
|
65088
|
-
return {
|
|
65089
|
-
pageWidgetMeta,
|
|
65090
|
-
pageWidgetProps,
|
|
65091
|
-
widgetType
|
|
65092
|
-
};
|
|
65093
|
-
}
|
|
65094
|
-
function usePaperWidgetStaticAttrs(widget) {
|
|
65095
|
-
const { docInst, isDesignMode } = useDocPubApiContext();
|
|
65096
|
-
const { pageWidgetMeta, pageWidgetProps, widgetType } = usePaperWidgetMeta(widget);
|
|
65097
|
-
return {
|
|
65098
|
-
docInst,
|
|
65099
|
-
isDesignMode,
|
|
65100
|
-
pageWidgetMeta,
|
|
65101
|
-
pageWidgetProps,
|
|
65102
|
-
widgetType
|
|
65103
|
-
};
|
|
65104
|
-
}
|
|
65105
65795
|
const UNIT_WIDTH = 1;
|
|
65106
65796
|
const _sfc_main$1P = /* @__PURE__ */ defineComponent({
|
|
65107
65797
|
__name: "pw-barcode-render",
|
|
@@ -65118,9 +65808,14 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
|
|
|
65118
65808
|
const modelValue = computed(() => {
|
|
65119
65809
|
let text = pageWidgetProps.value.value;
|
|
65120
65810
|
if (valueType.value === ValueTypeConst.Field) {
|
|
65121
|
-
const path2 = text?.fieldData?.valuePath;
|
|
65811
|
+
const path2 = text?.exp?.fieldData?.valuePath;
|
|
65122
65812
|
if (path2) {
|
|
65123
|
-
const runtimePath =
|
|
65813
|
+
const runtimePath = replacePathIndexPlaceholders({
|
|
65814
|
+
y: props.widget.yDataIndex,
|
|
65815
|
+
x: props.widget.xDataIndex,
|
|
65816
|
+
n: props.widget.dataIndex,
|
|
65817
|
+
templatePath: path2
|
|
65818
|
+
});
|
|
65124
65819
|
text = docInst.value?.dataManager?.get(runtimePath);
|
|
65125
65820
|
}
|
|
65126
65821
|
}
|
|
@@ -65411,7 +66106,12 @@ const _sfc_main$1O = /* @__PURE__ */ defineComponent({
|
|
|
65411
66106
|
return fieldInfo?.name ? `\${${fieldInfo.name}}` : path2;
|
|
65412
66107
|
}
|
|
65413
66108
|
if (path2) {
|
|
65414
|
-
const runtimePath =
|
|
66109
|
+
const runtimePath = replacePathIndexPlaceholders({
|
|
66110
|
+
y: props.widget.yDataIndex,
|
|
66111
|
+
x: props.widget.xDataIndex,
|
|
66112
|
+
n: props.widget.dataIndex,
|
|
66113
|
+
templatePath: path2
|
|
66114
|
+
});
|
|
65415
66115
|
return docInst.value?.dataManager?.get(runtimePath);
|
|
65416
66116
|
}
|
|
65417
66117
|
}
|
|
@@ -65885,9 +66585,14 @@ const _sfc_main$1K = /* @__PURE__ */ defineComponent({
|
|
|
65885
66585
|
const modelValue = computed(() => {
|
|
65886
66586
|
let text = pageWidgetProps.value.value;
|
|
65887
66587
|
if (valueType.value === ValueTypeConst.Field) {
|
|
65888
|
-
const path2 = text?.fieldData?.valuePath;
|
|
66588
|
+
const path2 = text?.exp?.fieldData?.valuePath;
|
|
65889
66589
|
if (path2) {
|
|
65890
|
-
const runtimePath =
|
|
66590
|
+
const runtimePath = replacePathIndexPlaceholders({
|
|
66591
|
+
y: props.widget.yDataIndex,
|
|
66592
|
+
x: props.widget.xDataIndex,
|
|
66593
|
+
n: props.widget.dataIndex,
|
|
66594
|
+
templatePath: path2
|
|
66595
|
+
});
|
|
65891
66596
|
text = docInst.value?.dataManager?.get(runtimePath);
|
|
65892
66597
|
}
|
|
65893
66598
|
}
|
|
@@ -66723,7 +67428,7 @@ const _sfc_main$1E = /* @__PURE__ */ defineComponent({
|
|
|
66723
67428
|
};
|
|
66724
67429
|
}
|
|
66725
67430
|
});
|
|
66726
|
-
const PaperPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["__scopeId", "data-v-
|
|
67431
|
+
const PaperPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["__scopeId", "data-v-3cf8e3a5"]]);
|
|
66727
67432
|
const schema$c = {
|
|
66728
67433
|
key: "paper.basic",
|
|
66729
67434
|
title: "表单属性",
|
|
@@ -66819,13 +67524,15 @@ const _sfc_main$1D = /* @__PURE__ */ defineComponent({
|
|
|
66819
67524
|
const designCtx = useDesignSuiteContext();
|
|
66820
67525
|
const { docInst } = useDocPubApiContext();
|
|
66821
67526
|
const props = __props;
|
|
66822
|
-
const regionRef = computed(
|
|
66823
|
-
|
|
66824
|
-
|
|
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);
|
|
66825
67532
|
const fieldInfo = computed(() => {
|
|
66826
|
-
if (!modelKey.value || !
|
|
67533
|
+
if (!modelKey.value || !subFieldKey.value) return null;
|
|
66827
67534
|
const list = designCtx.runtime.getFieldList(modelKey.value);
|
|
66828
|
-
return list?.find((f) => f.key ===
|
|
67535
|
+
return list?.find((f) => f.key === subFieldKey.value) ?? null;
|
|
66829
67536
|
});
|
|
66830
67537
|
const regionProps = usePanelProps(regionRef, "widgetMeta.props");
|
|
66831
67538
|
function onDeleteDynamicTable() {
|
|
@@ -66944,7 +67651,7 @@ const _sfc_main$1D = /* @__PURE__ */ defineComponent({
|
|
|
66944
67651
|
};
|
|
66945
67652
|
}
|
|
66946
67653
|
});
|
|
66947
|
-
const DynamicTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__scopeId", "data-v-
|
|
67654
|
+
const DynamicTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__scopeId", "data-v-09705f9b"]]);
|
|
66948
67655
|
const schema$b = {
|
|
66949
67656
|
key: "dynamic-table.basic",
|
|
66950
67657
|
title: [
|
|
@@ -66973,8 +67680,8 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
66973
67680
|
return props.widget.findRegionById(id);
|
|
66974
67681
|
});
|
|
66975
67682
|
const isBindDataGroup = withLayoutComputed(() => !!regionRef.value?.itemRegion);
|
|
66976
|
-
const modelKey = computed(() =>
|
|
66977
|
-
const fieldKey = computed(() =>
|
|
67683
|
+
const modelKey = computed(() => props.active.context.mainModelKey);
|
|
67684
|
+
const fieldKey = computed(() => regionRef.value?.subFieldKey);
|
|
66978
67685
|
const fieldInfo = computed(() => {
|
|
66979
67686
|
if (!modelKey.value || !fieldKey.value) return null;
|
|
66980
67687
|
const list = designCtx.runtime.getFieldList(modelKey.value);
|
|
@@ -67080,7 +67787,7 @@ const _sfc_main$1C = /* @__PURE__ */ defineComponent({
|
|
|
67080
67787
|
};
|
|
67081
67788
|
}
|
|
67082
67789
|
});
|
|
67083
|
-
const _2DTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__scopeId", "data-v-
|
|
67790
|
+
const _2DTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__scopeId", "data-v-8cc7a416"]]);
|
|
67084
67791
|
const schema$a = {
|
|
67085
67792
|
key: "2d-table.basic",
|
|
67086
67793
|
title: [
|
|
@@ -67109,8 +67816,8 @@ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
|
|
|
67109
67816
|
return props.widget.findRegionById(id);
|
|
67110
67817
|
});
|
|
67111
67818
|
const isBindDataGroup = withLayoutComputed(() => !!regionRef.value?.itemRegion);
|
|
67112
|
-
const modelKey = computed(() =>
|
|
67113
|
-
const fieldKey = computed(() =>
|
|
67819
|
+
const modelKey = computed(() => props.active.context.mainModelKey);
|
|
67820
|
+
const fieldKey = computed(() => regionRef.value?.subFieldKey);
|
|
67114
67821
|
const fieldInfo = computed(() => {
|
|
67115
67822
|
if (!modelKey.value || !fieldKey.value) return null;
|
|
67116
67823
|
const list = designCtx.runtime.getFieldList(modelKey.value);
|
|
@@ -67216,7 +67923,7 @@ const _sfc_main$1B = /* @__PURE__ */ defineComponent({
|
|
|
67216
67923
|
};
|
|
67217
67924
|
}
|
|
67218
67925
|
});
|
|
67219
|
-
const FixedTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__scopeId", "data-v-
|
|
67926
|
+
const FixedTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__scopeId", "data-v-646f62b8"]]);
|
|
67220
67927
|
const schema$9 = {
|
|
67221
67928
|
key: "fixed-table.basic",
|
|
67222
67929
|
title: [
|
|
@@ -67245,8 +67952,8 @@ const _sfc_main$1A = /* @__PURE__ */ defineComponent({
|
|
|
67245
67952
|
return props.widget.findRegionById(id);
|
|
67246
67953
|
});
|
|
67247
67954
|
const isBindDataGroup = withLayoutComputed(() => !!regionRef.value?.itemRegion);
|
|
67248
|
-
const modelKey = computed(() =>
|
|
67249
|
-
const fieldKey = computed(() =>
|
|
67955
|
+
const modelKey = computed(() => props.active.context.mainModelKey);
|
|
67956
|
+
const fieldKey = computed(() => regionRef.value?.subFieldKey);
|
|
67250
67957
|
const fieldInfo = computed(() => {
|
|
67251
67958
|
if (!modelKey.value || !fieldKey.value) return null;
|
|
67252
67959
|
const list = designCtx.runtime.getFieldList(modelKey.value);
|
|
@@ -67352,7 +68059,7 @@ const _sfc_main$1A = /* @__PURE__ */ defineComponent({
|
|
|
67352
68059
|
};
|
|
67353
68060
|
}
|
|
67354
68061
|
});
|
|
67355
|
-
const CheckTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__scopeId", "data-v-
|
|
68062
|
+
const CheckTablePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__scopeId", "data-v-e4d1497a"]]);
|
|
67356
68063
|
const schema$8 = {
|
|
67357
68064
|
key: "check-table.basic",
|
|
67358
68065
|
title: [
|
|
@@ -67489,13 +68196,18 @@ const _sfc_main$1y = /* @__PURE__ */ defineComponent({
|
|
|
67489
68196
|
};
|
|
67490
68197
|
const props = __props;
|
|
67491
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
|
+
);
|
|
67492
68203
|
const optionsMap = computed(() => {
|
|
67493
|
-
const
|
|
67494
|
-
|
|
68204
|
+
const mainModelKey = props.active.context.mainModelKey;
|
|
68205
|
+
const rowFieldKey = regionRef.value?.subFieldKey;
|
|
68206
|
+
const colFieldKey = regionRef.value?.linkFieldKey;
|
|
68207
|
+
if (!mainModelKey || !rowFieldKey || !colFieldKey) {
|
|
67495
68208
|
return { row: [], col: [] };
|
|
67496
68209
|
}
|
|
67497
68210
|
const mainFields = designCtx.runtime.getFieldList(mainModelKey);
|
|
67498
|
-
const [rowFieldKey, colFieldKey] = subFieldKey.replace("$.", "").split(":") ?? [];
|
|
67499
68211
|
const rowModelKey = mainFields.find((f) => f.key === rowFieldKey)?.bindInfo;
|
|
67500
68212
|
const colModelKey = mainFields.find((f) => f.key === colFieldKey)?.bindInfo;
|
|
67501
68213
|
return {
|
|
@@ -67503,10 +68215,6 @@ const _sfc_main$1y = /* @__PURE__ */ defineComponent({
|
|
|
67503
68215
|
col: getFieldOptions(colModelKey)
|
|
67504
68216
|
};
|
|
67505
68217
|
});
|
|
67506
|
-
const rId = computed(() => props.active.context.regionId?.split("_")[0] ?? "");
|
|
67507
|
-
const regionRef = computed(
|
|
67508
|
-
() => props.widget.findRegionById(rId.value)
|
|
67509
|
-
);
|
|
67510
68218
|
const itemRegion = computed(() => regionRef.value?.itemRegion);
|
|
67511
68219
|
const regionProps = usePanelProps(regionRef, "widgetMeta.props");
|
|
67512
68220
|
function onDeleteDataGroup2D() {
|
|
@@ -67605,7 +68313,7 @@ const _sfc_main$1y = /* @__PURE__ */ defineComponent({
|
|
|
67605
68313
|
};
|
|
67606
68314
|
}
|
|
67607
68315
|
});
|
|
67608
|
-
const DataGroup2DPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__scopeId", "data-v-
|
|
68316
|
+
const DataGroup2DPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__scopeId", "data-v-9e4ec5d9"]]);
|
|
67609
68317
|
const schema$6 = {
|
|
67610
68318
|
key: "data-group-2d.basic",
|
|
67611
68319
|
title: [
|
|
@@ -75644,7 +76352,7 @@ const __vite_glob_1_6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
|
|
|
75644
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 });
|
|
75645
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 });
|
|
75646
76354
|
function buildMap(modules, reg) {
|
|
75647
|
-
const
|
|
76355
|
+
const map = {};
|
|
75648
76356
|
Object.entries(modules).forEach(([filePath, module2]) => {
|
|
75649
76357
|
try {
|
|
75650
76358
|
const match = filePath.match(reg);
|
|
@@ -75655,20 +76363,20 @@ function buildMap(modules, reg) {
|
|
|
75655
76363
|
const [, coreId, typeStr] = match;
|
|
75656
76364
|
const key = `schema:${coreId}`;
|
|
75657
76365
|
const type4 = typeStr;
|
|
75658
|
-
if (!
|
|
75659
|
-
|
|
76366
|
+
if (!map[key]) {
|
|
76367
|
+
map[key] = {};
|
|
75660
76368
|
}
|
|
75661
|
-
|
|
76369
|
+
map[key][type4] = module2.default;
|
|
75662
76370
|
} catch (err) {
|
|
75663
76371
|
console.error(`加载组件 ${filePath} 失败:`, err);
|
|
75664
76372
|
}
|
|
75665
76373
|
});
|
|
75666
|
-
return
|
|
76374
|
+
return map;
|
|
75667
76375
|
}
|
|
75668
76376
|
function mergeMaps(...maps) {
|
|
75669
76377
|
const result = {};
|
|
75670
|
-
maps.forEach((
|
|
75671
|
-
Object.entries(
|
|
76378
|
+
maps.forEach((map) => {
|
|
76379
|
+
Object.entries(map).forEach(([key, value]) => {
|
|
75672
76380
|
const _key = key;
|
|
75673
76381
|
if (!result[_key]) {
|
|
75674
76382
|
result[_key] = {};
|
|
@@ -75904,7 +76612,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
75904
76612
|
};
|
|
75905
76613
|
}
|
|
75906
76614
|
});
|
|
75907
|
-
const optionDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-
|
|
76615
|
+
const optionDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-d81082a4"]]);
|
|
75908
76616
|
const optionDropdown$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
75909
76617
|
__proto__: null,
|
|
75910
76618
|
default: optionDropdown
|
|
@@ -76125,7 +76833,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
76125
76833
|
};
|
|
76126
76834
|
}
|
|
76127
76835
|
});
|
|
76128
|
-
const treeDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-
|
|
76836
|
+
const treeDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-4a40a7ac"]]);
|
|
76129
76837
|
const treeDropdown$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
76130
76838
|
__proto__: null,
|
|
76131
76839
|
default: treeDropdown
|
|
@@ -76161,7 +76869,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
76161
76869
|
};
|
|
76162
76870
|
}
|
|
76163
76871
|
});
|
|
76164
|
-
const datetimeDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-
|
|
76872
|
+
const datetimeDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-a395aede"]]);
|
|
76165
76873
|
const datetimeDropdown$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
76166
76874
|
__proto__: null,
|
|
76167
76875
|
default: datetimeDropdown
|
|
@@ -76193,7 +76901,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
76193
76901
|
};
|
|
76194
76902
|
}
|
|
76195
76903
|
});
|
|
76196
|
-
const timeDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-
|
|
76904
|
+
const timeDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-b2862e2a"]]);
|
|
76197
76905
|
const timeDropdown$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
76198
76906
|
__proto__: null,
|
|
76199
76907
|
default: timeDropdown
|
|
@@ -77023,7 +77731,10 @@ function useTableDropdown(props) {
|
|
|
77023
77731
|
strategy.value.linkFieldId,
|
|
77024
77732
|
fieldMeta.value?.subFieldKey
|
|
77025
77733
|
);
|
|
77026
|
-
const realLinkValuePath =
|
|
77734
|
+
const realLinkValuePath = replacePathIndexPlaceholders({
|
|
77735
|
+
refPath: runtimeValuePath.value,
|
|
77736
|
+
templatePath: linkValuePath
|
|
77737
|
+
});
|
|
77027
77738
|
return getValue$1(docInst.value.dataManager.get(realLinkValuePath), false);
|
|
77028
77739
|
}
|
|
77029
77740
|
});
|
|
@@ -77033,7 +77744,10 @@ function useTableDropdown(props) {
|
|
|
77033
77744
|
strategy.value.clearFieldId,
|
|
77034
77745
|
fieldMeta.value?.subFieldKey
|
|
77035
77746
|
);
|
|
77036
|
-
const realValuePath =
|
|
77747
|
+
const realValuePath = replacePathIndexPlaceholders({
|
|
77748
|
+
refPath: runtimeValuePath.value,
|
|
77749
|
+
templatePath: valuePath
|
|
77750
|
+
});
|
|
77037
77751
|
return realValuePath;
|
|
77038
77752
|
}
|
|
77039
77753
|
});
|
|
@@ -77718,7 +78432,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
77718
78432
|
};
|
|
77719
78433
|
}
|
|
77720
78434
|
});
|
|
77721
|
-
const uploadFileDialog = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
78435
|
+
const uploadFileDialog = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-8f81c7bf"]]);
|
|
77722
78436
|
const uploadFileDialog$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
77723
78437
|
__proto__: null,
|
|
77724
78438
|
default: uploadFileDialog
|
|
@@ -78017,7 +78731,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
78017
78731
|
};
|
|
78018
78732
|
}
|
|
78019
78733
|
});
|
|
78020
|
-
const uploadImageDialog = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
78734
|
+
const uploadImageDialog = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-a4f2d7a5"]]);
|
|
78021
78735
|
const uploadImageDialog$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
78022
78736
|
__proto__: null,
|
|
78023
78737
|
default: uploadImageDialog
|
|
@@ -78204,7 +78918,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
78204
78918
|
};
|
|
78205
78919
|
}
|
|
78206
78920
|
});
|
|
78207
|
-
const signatureDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
78921
|
+
const signatureDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-41124487"]]);
|
|
78208
78922
|
const signatureDialog$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
78209
78923
|
__proto__: null,
|
|
78210
78924
|
default: signatureDialog
|