@gct-paas/word 0.1.31 → 0.1.32

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.
@@ -3,7 +3,6 @@ import { Doc } from '../view/Doc';
3
3
  import { WidgetMeta } from '../widget/widget-meta';
4
4
  import { WordHighlight } from '../model/types';
5
5
  import { PointerHitResult } from '../cursor/hit/types';
6
- import { FieldMeta } from '@gct-paas/api/apaas';
7
6
  export interface CursorMeta {
8
7
  nodeId: string;
9
8
  offset: number;
@@ -103,7 +102,6 @@ export type CommandPayloadMap = {
103
102
  insertField: CommandPayload & {
104
103
  widgetMeta: WidgetMeta;
105
104
  valuePath: string;
106
- mainModelFields: FieldMeta[];
107
105
  };
108
106
  insertPaperWidget: CommandPayload & {
109
107
  pageWidgetMeta: WidgetMeta;
@@ -122,8 +122,22 @@ export declare class DataManager {
122
122
  /**
123
123
  * 设置整个原始数据
124
124
  * @param data 新的 JSON 数据
125
+ * @param defaultsMap 默认值, 字段值为 undefined 时才懒填充,不覆盖接口数据
125
126
  */
126
127
  setRawData(data: Data, defaultsMap?: Record<string, any>): void;
128
+ /**
129
+ * 将初始化数据直接写入 rawData(仅填充空值,不覆盖接口数据)
130
+ * 与 defaults(懒填充)不同,此方法在初始化阶段一次性写入
131
+ *
132
+ * 支持两种子表路径形式:
133
+ * - `[n]` 通配符:展开到 rawData 中已有的每一行(无则创建一行),如 `$.sub[n].field`
134
+ * - 真实下标:直接写入指定行,如 `$.sub[0].field`
135
+ *
136
+ * 处理顺序:先展开 `[n]` 通配符,再写入真实下标路径。
137
+ * 这样可以保证:参数映射(`[n]`)先铺好默认值,自定义数据源(真实下标)再精确覆盖。
138
+ */
139
+ applyInitData(initDataMap: Record<string, any>): void;
140
+ private applyInitDataWildcard;
127
141
  /**
128
142
  * 内部方法:根据路径获取值
129
143
  */
@@ -18,6 +18,7 @@ export declare function useInteraction(docRef: Ref<Doc | null>): {
18
18
  readonly context: {
19
19
  readonly mainModelKey?: string | undefined;
20
20
  readonly subFieldKey?: string | undefined;
21
+ readonly isDataGroup2DClicked?: boolean | undefined;
21
22
  readonly regionId?: string | undefined;
22
23
  readonly secRefId?: string | undefined;
23
24
  };
@@ -5,7 +5,6 @@ export declare class TextHandler {
5
5
  static get2DInfo(context: LayoutContext): {
6
6
  xDataIndex: number | undefined;
7
7
  yDataIndex: number | undefined;
8
- valuePath2D: string | undefined;
9
8
  };
10
9
  /**
11
10
  * 合并部分run
@@ -10,7 +10,6 @@ export declare class FieldBaseHandler {
10
10
  static get2DInfo(context: LayoutContext): {
11
11
  xDataIndex: number | undefined;
12
12
  yDataIndex: number | undefined;
13
- valuePath2D: string | undefined;
14
13
  };
15
14
  static getValue(ctx: HandlerContext, valuePath: string): any;
16
15
  static getLabel(ctx: HandlerContext, valuePath: string): any;
@@ -24,7 +24,3 @@ export declare function repeat(count: number, callback: (index: number) => void)
24
24
  * distributeInteger(10, 3) // [3, 3, 4]
25
25
  */
26
26
  export declare function distributeInteger(total: number, count: number): number[];
27
- /**
28
- * 将主工程的数据转换为 Word 的 JSONPath 格式数据
29
- */
30
- export declare const mainData2WordData: (data: Record<string, any>) => Record<string, any>;
@@ -21,11 +21,13 @@ export type SubRenderer = {
21
21
  id: string;
22
22
  type: 'dynamic-table' | '2d-table' | 'fixed-table' | 'check-table' | 'table-header';
23
23
  dataIndex?: number;
24
- xDataIndex?: number;
25
- yDataIndex?: number;
26
24
  valuePath: string;
27
25
  widgetMeta?: RepeatingWidgetMeta | BoundedWidgetMeta | CheckTableWidgetMeta | _2DTableWidgetMeta;
28
26
  dataGroup2DAreaRange?: TableRange;
27
+ xDataIndex?: number;
28
+ yDataIndex?: number;
29
+ /** 用来标记二维表的子类型 交叉 / 横向 / 纵向 */
30
+ cellZone?: 'cross' | 'horizontal' | 'vertical';
29
31
  };
30
32
  export declare class TableCell extends LayoutGroup<Paragraph> implements IContainerMetrics {
31
33
  component: "tableCell";
@@ -7,7 +7,6 @@ type ModelRef = {
7
7
  id: string;
8
8
  start?: number;
9
9
  end?: number;
10
- valuePath2D?: string;
11
10
  xDataIndex?: number;
12
11
  yDataIndex?: number;
13
12
  };
@@ -27,6 +27,7 @@ export type PanelType =
27
27
  type ActiveContext = {
28
28
  mainModelKey: string;
29
29
  subFieldKey: string | undefined;
30
+ isDataGroup2DClicked?: boolean;
30
31
  regionId: string;
31
32
  /** 章节引用 id */
32
33
  secRefId: string;
package/dist/index.es.js CHANGED
@@ -20594,7 +20594,8 @@ function safeParseJson(data, fallback = null, validator2) {
20594
20594
  }
20595
20595
  function generateValuePath(fieldLink, subFieldKey) {
20596
20596
  if (subFieldKey) {
20597
- return `$.${subFieldKey}[n].${fieldLink}`;
20597
+ const connector = subFieldKey.includes(":") ? "" : "[n]";
20598
+ return `$.${subFieldKey}${connector}.${fieldLink}`;
20598
20599
  } else {
20599
20600
  return `$.${fieldLink}`;
20600
20601
  }
@@ -26668,12 +26669,6 @@ function distributeInteger(total, count) {
26668
26669
  }
26669
26670
  return result;
26670
26671
  }
26671
- const mainData2WordData = (data) => {
26672
- const entries = Object.entries(data).map(([key, value]) => {
26673
- return [`$.${key}`, value];
26674
- });
26675
- return Object.fromEntries(entries);
26676
- };
26677
26672
  class TextUtil {
26678
26673
  /** 字体度量缓存限制 */
26679
26674
  static FONT_METRICS_CACHE_LIMIT = 80;
@@ -38116,21 +38111,13 @@ class InsertField extends CommandBase {
38116
38111
  const cursor = this.doc.cursorManager;
38117
38112
  const { nodeId, offset: offset2, side } = cursor.getCursor();
38118
38113
  const {
38119
- valuePath: _valuePath,
38120
- widgetMeta,
38121
- mainModelFields
38114
+ valuePath,
38115
+ widgetMeta
38122
38116
  } = this.payload;
38123
38117
  const mapper = this.doc.layoutMapper;
38124
38118
  const node = mapper.getBaseMetaNodeById(nodeId);
38125
38119
  const run = node.raw;
38126
38120
  const wp = mapper.getModelNodeById(run.parent.modelRef.id);
38127
- let valuePath = _valuePath;
38128
- if (run.modelRef?.valuePath2D) {
38129
- const [subTableKey, dataGroup2DKey] = run.modelRef.valuePath2D.replace("$.", "").split(":") || [];
38130
- const subTableModelKey = mainModelFields.find((f) => f.key === subTableKey)?.bindInfo;
38131
- const dataGroup2DModelKey = mainModelFields.find((f) => f.key === dataGroup2DKey)?.bindInfo;
38132
- valuePath = `$.${subTableModelKey}:${dataGroup2DModelKey}.${valuePath.replace("$.", "")}`;
38133
- }
38134
38121
  const wr = new WrField({ text: valuePath, valuePath, widgetMeta });
38135
38122
  if (!this.validateFieldPath(valuePath, wp)) {
38136
38123
  console.warn("字段路径不合法,无法插入字段", valuePath);
@@ -40640,8 +40627,8 @@ class TextHandler {
40640
40627
  return id;
40641
40628
  }
40642
40629
  static get2DInfo(context) {
40643
- const { xDataIndex, yDataIndex, valuePath } = context.cell?.subRenderer || {};
40644
- return { xDataIndex, yDataIndex, valuePath2D: valuePath };
40630
+ const { xDataIndex, yDataIndex } = context.cell?.subRenderer || {};
40631
+ return { xDataIndex, yDataIndex };
40645
40632
  }
40646
40633
  /**
40647
40634
  * 合并部分run
@@ -40846,8 +40833,8 @@ class FieldBaseHandler {
40846
40833
  return id;
40847
40834
  }
40848
40835
  static get2DInfo(context) {
40849
- const { xDataIndex, yDataIndex, valuePath } = context.cell?.subRenderer || {};
40850
- return { xDataIndex, yDataIndex, valuePath2D: valuePath };
40836
+ const { xDataIndex, yDataIndex } = context.cell?.subRenderer || {};
40837
+ return { xDataIndex, yDataIndex };
40851
40838
  }
40852
40839
  static getValue(ctx, valuePath) {
40853
40840
  const { context } = ctx;
@@ -45926,6 +45913,7 @@ class DataManager {
45926
45913
  /**
45927
45914
  * 设置整个原始数据
45928
45915
  * @param data 新的 JSON 数据
45916
+ * @param defaultsMap 默认值, 字段值为 undefined 时才懒填充,不覆盖接口数据
45929
45917
  */
45930
45918
  setRawData(data, defaultsMap) {
45931
45919
  const oldData = this.rawData;
@@ -45935,6 +45923,58 @@ class DataManager {
45935
45923
  this.setDefaults(defaultsMap);
45936
45924
  }
45937
45925
  }
45926
+ /**
45927
+ * 将初始化数据直接写入 rawData(仅填充空值,不覆盖接口数据)
45928
+ * 与 defaults(懒填充)不同,此方法在初始化阶段一次性写入
45929
+ *
45930
+ * 支持两种子表路径形式:
45931
+ * - `[n]` 通配符:展开到 rawData 中已有的每一行(无则创建一行),如 `$.sub[n].field`
45932
+ * - 真实下标:直接写入指定行,如 `$.sub[0].field`
45933
+ *
45934
+ * 处理顺序:先展开 `[n]` 通配符,再写入真实下标路径。
45935
+ * 这样可以保证:参数映射(`[n]`)先铺好默认值,自定义数据源(真实下标)再精确覆盖。
45936
+ */
45937
+ applyInitData(initDataMap) {
45938
+ for (const [path2, value] of Object.entries(initDataMap)) {
45939
+ if (value === void 0 || value === null) continue;
45940
+ if (path2.includes("[n]")) {
45941
+ this.applyInitDataWildcard(path2, value);
45942
+ }
45943
+ }
45944
+ for (const [path2, value] of Object.entries(initDataMap)) {
45945
+ if (value === void 0 || value === null) continue;
45946
+ if (!path2.includes("[n]")) {
45947
+ const existing = this.getByPath(this.rawData, path2);
45948
+ if (existing === void 0 || existing === null) {
45949
+ try {
45950
+ this.setByPath(this.rawData, path2, value);
45951
+ } catch (e) {
45952
+ console.warn(`applyInitData: failed to set path "${path2}"`, e);
45953
+ }
45954
+ }
45955
+ }
45956
+ }
45957
+ }
45958
+ applyInitDataWildcard(path2, value) {
45959
+ const match = path2.match(/^\$\.([^[.]+)\[n\]/);
45960
+ if (!match) return;
45961
+ const subTableKey = match[1];
45962
+ let subTableArray = this.rawData?.[subTableKey];
45963
+ if (!Array.isArray(subTableArray) || subTableArray.length === 0) {
45964
+ subTableArray = [{ ...DEFAULT_EMPTY_ITEM }];
45965
+ }
45966
+ for (let i = 0; i < subTableArray.length; i++) {
45967
+ const realPath = replacePathIndexPlaceholder(i, path2);
45968
+ const existing = this.getByPath(this.rawData, realPath);
45969
+ if (existing === void 0 || existing === null) {
45970
+ try {
45971
+ this.setByPath(this.rawData, realPath, value);
45972
+ } catch (e) {
45973
+ console.warn(`applyInitData: failed to set path "${realPath}"`, e);
45974
+ }
45975
+ }
45976
+ }
45977
+ }
45938
45978
  /**
45939
45979
  * 内部方法:根据路径获取值
45940
45980
  */
@@ -50226,6 +50266,28 @@ const apiFetchers = {
50226
50266
  totalCount: totalCount || 0
50227
50267
  };
50228
50268
  },
50269
+ fetchOne: async (id) => {
50270
+ if (!id) return {};
50271
+ const result = await api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey(
50272
+ {
50273
+ modelCategory: API_CONFIG.ENTITY_CATEGORY,
50274
+ modelKey: API_CONFIG.LOT_DEFAULTS.modelKey,
50275
+ bsKey: API_CONFIG.LOT_DEFAULTS.bsKey
50276
+ },
50277
+ {},
50278
+ {
50279
+ query: { "material_no_.like": id },
50280
+ pageSize: 20,
50281
+ pageNo: 1
50282
+ }
50283
+ );
50284
+ const { data = [], totalPage, dict, totalCount } = result || {};
50285
+ return {
50286
+ data: transformSourceDataList(data || [], dict) || [],
50287
+ totalPage,
50288
+ totalCount: totalCount || 0
50289
+ };
50290
+ },
50229
50291
  transformers: {
50230
50292
  toOptions(items) {
50231
50293
  const transformer = createTransformer("material_no_", "material_no_");
@@ -50430,7 +50492,7 @@ async function fetchLabelAndFill(defaults2, valuePath, id, fetcher, props, fallb
50430
50492
  defaults2 ??= {};
50431
50493
  defaults2[valuePath] = id;
50432
50494
  try {
50433
- const isSingle = fetcher === "rdo2ref";
50495
+ const isSingle = fetcher === "rdo2ref" || fetcher === "lot2sn";
50434
50496
  const result = isSingle ? await apiFetchers[fetcher].getOptionById(id, props) : await apiFetchers[fetcher].getOptionByIds(getValue$1(id, true), props);
50435
50497
  const list = Array.isArray(result) ? result : result ? [result] : [];
50436
50498
  const labels = list.map((i) => i?.label).filter(Boolean);
@@ -50447,7 +50509,7 @@ async function fetchLabelAndFill(defaults2, valuePath, id, fetcher, props, fallb
50447
50509
  }
50448
50510
  return defaults2;
50449
50511
  }
50450
- async function enrichApiDefaultValues(defaults2, rule, valuePath, fieldMeta, context, loadFieldByKey) {
50512
+ async function enrichApiDefaultValues(defaults2, rule, valuePath, fieldMeta, context, loadFieldByKey, options) {
50451
50513
  if (!rule || !("fetcher" in rule)) {
50452
50514
  return defaults2;
50453
50515
  }
@@ -50468,7 +50530,8 @@ async function enrichApiDefaultValues(defaults2, rule, valuePath, fieldMeta, con
50468
50530
  return defaults2;
50469
50531
  }
50470
50532
  const apiRule = rule;
50471
- if (apiRule.onlyMainModelFieldsCanRequest && fieldMeta.subFieldKey) {
50533
+ const allowSubModelRequest = options?.allowSubModelRequest ?? false;
50534
+ if (apiRule.onlyMainModelFieldsCanRequest && fieldMeta.subFieldKey && !allowSubModelRequest) {
50472
50535
  return defaults2;
50473
50536
  }
50474
50537
  const modelKey = getLastSegment(fieldMeta.modelLink);
@@ -50504,7 +50567,16 @@ async function fetchAutofillSource(field, context) {
50504
50567
  return data;
50505
50568
  }
50506
50569
  async function computeFieldDefaultValue(params) {
50507
- const { fieldType, fieldMeta, valuePath, value, props, getFieldManifest, loadFieldByKey } = params;
50570
+ const {
50571
+ fieldType,
50572
+ fieldMeta,
50573
+ valuePath,
50574
+ value,
50575
+ props,
50576
+ getFieldManifest,
50577
+ loadFieldByKey,
50578
+ allowSubModelRequest
50579
+ } = params;
50508
50580
  const result = {};
50509
50581
  const manifest2 = getFieldManifest(fieldType);
50510
50582
  const rule = manifest2?.computed?.defaultValueRule;
@@ -50533,7 +50605,10 @@ async function computeFieldDefaultValue(params) {
50533
50605
  valuePath,
50534
50606
  fieldMeta,
50535
50607
  fakeContext,
50536
- loadFieldByKey
50608
+ loadFieldByKey,
50609
+ {
50610
+ allowSubModelRequest
50611
+ }
50537
50612
  );
50538
50613
  }
50539
50614
  Object.assign(result, defaults2);
@@ -51007,14 +51082,6 @@ const builtinFieldColumns = [
51007
51082
  name: "字段类型"
51008
51083
  }
51009
51084
  ];
51010
- const DEFAULT_FROM_STATE = {
51011
- _DICT: {},
51012
- //翻译的字段
51013
- _OPCT: {},
51014
- //关联模型字段完全体
51015
- _MCTABLE: {}
51016
- // 物料消耗表业务数据
51017
- };
51018
51085
  function getDefaultQueryIdsByFieldType(payload) {
51019
51086
  const defaultQueryIds = {
51020
51087
  [FIELD_TYPE.MATERIAL_NO]: payload.materialNumber,
@@ -51069,13 +51136,13 @@ async function loadDefaultValuesByFields(instances, ctx, context, masterSlaveLis
51069
51136
  await Promise.all(promises);
51070
51137
  return defaultDataMap;
51071
51138
  }
51072
- const handleParameterMapping = (parameterMapping, paramsConfig, subTableInfo, fieldPermission) => {
51139
+ const handleParameterMapping = async (parameterMapping, paramsConfig, fieldPermission, instances, ctx) => {
51073
51140
  if (!parameterMapping.length || !paramsConfig) {
51074
51141
  return {};
51075
51142
  }
51076
51143
  const referenceMap = new Map(Object.entries(paramsConfig));
51077
- const paramMap = { ...cloneDeep(DEFAULT_FROM_STATE) };
51078
- const subMappedFields = {};
51144
+ const paramMap = {};
51145
+ console.log("TJ::parameterMapping", parameterMapping);
51079
51146
  const paramsMapList = parameterMapping.map((item) => {
51080
51147
  return item.toFields.map((f) => {
51081
51148
  return {
@@ -51099,90 +51166,75 @@ const handleParameterMapping = (parameterMapping, paramsConfig, subTableInfo, fi
51099
51166
  return item?.paramMapType === type4 === isBuiltin && (!field || !field.readonly);
51100
51167
  })
51101
51168
  );
51102
- const processParamItem = (item) => {
51169
+ const processParamItem = async (item) => {
51103
51170
  if (!referenceMap.has(item.formKey)) return;
51104
51171
  const value = referenceMap.get(item.formKey);
51105
- const formattedValue = toFormatValue(item.fieldType, value);
51106
- const target = item?.subModel ? (subMappedFields[item.subFieldKey] ??= {}, subMappedFields[item.subFieldKey]) : paramMap;
51107
- merge(target, { [item.field]: formattedValue });
51108
- };
51109
- [...builtinParams, ...compParams].forEach(processParamItem);
51110
- Object.entries(subMappedFields).forEach(([key, value]) => {
51111
- const subTableConfig = subTableInfo.find(({ field }) => field === key);
51112
- if (!subTableConfig) return;
51113
- const data = [value];
51114
- let data2d;
51115
- const { childInitRowLen, key: tableKey } = subTableConfig;
51116
- const is2DTable = subTableConfig.subTable2d && tableKey === "dyn" || subTableConfig.checkTable2d && tableKey === "newfixed";
51117
- if (is2DTable) {
51118
- const emptyList = Array.from({ length: childInitRowLen });
51119
- data2d = data.map((fInfo) => {
51120
- const group_ = `${tableKey}${uuid()}`;
51121
- return emptyList.map((_2) => {
51122
- return {
51123
- ...fInfo,
51124
- group_
51125
- };
51126
- });
51127
- }).flat();
51172
+ const valuePath = generateValuePath(item.field, item?.subModel ? item.subFieldKey : "");
51173
+ const widget = instances.find((instance2) => {
51174
+ const fieldMeta = instance2.widgetMeta?.field;
51175
+ if (item?.subModel) {
51176
+ return item.field === getLastSegment(fieldMeta?.fieldLink) && item.subFieldKey === fieldMeta?.subFieldKey;
51177
+ }
51178
+ return item.field === getLastSegment(fieldMeta?.fieldLink) && !fieldMeta?.subFieldKey;
51179
+ });
51180
+ if (widget) {
51181
+ const computed2 = await computeFieldDefaultValue({
51182
+ fieldType: item.fieldType,
51183
+ fieldMeta: widget.widgetMeta.field,
51184
+ valuePath,
51185
+ value: toFormatValue(item.fieldType, value),
51186
+ props: widget.widgetMeta.props ?? {},
51187
+ getFieldManifest: ctx.getFieldManifest.bind(ctx),
51188
+ loadFieldByKey: async (modelKey, fieldKey) => ctx.runtime.loadFieldByKey(modelKey, fieldKey),
51189
+ allowSubModelRequest: true
51190
+ });
51191
+ merge(paramMap, computed2);
51192
+ } else {
51193
+ merge(paramMap, { [valuePath]: toFormatValue(item.fieldType, value) });
51128
51194
  }
51129
- merge(paramMap, {
51130
- [key]: {
51131
- data: data2d || data,
51132
- dict: {}
51133
- }
51134
- });
51135
- });
51195
+ };
51196
+ await Promise.all([...builtinParams, ...compParams].map(processParamItem));
51136
51197
  return paramMap;
51137
51198
  };
51138
- const getFormDataItem = (onFieldMap, subTableInfo, result) => {
51139
- const formDataItem = { ...cloneDeep(DEFAULT_FROM_STATE) };
51140
- if (result?.data?.length) {
51141
- const firstData = cloneDeep(result.data[0]);
51142
- onFieldMap.forEach((item) => {
51143
- if (item.subModel === 0) {
51144
- const mappedFields = item.fields.reduce(
51145
- (prev, { isFieldModel, leftFieldKey, fieldLink, rightFieldKey }) => {
51146
- prev[leftFieldKey] = isFieldModel ? firstData?.__FOREIGN__?.[fieldLink] : firstData[rightFieldKey];
51147
- return prev;
51148
- },
51149
- {}
51150
- );
51151
- merge(formDataItem, mappedFields);
51152
- } else if (item.subModel === 1) {
51153
- const sInfo = subTableInfo.find((aa2) => aa2.field === item.subFieldKey) || {};
51154
- const fieldList = result.data.map(
51155
- (data) => item.fields.reduce(
51156
- (prev, { isFieldModel, leftFieldKey, fieldLink, rightFieldKey }) => {
51157
- prev[leftFieldKey] = isFieldModel ? data?.__FOREIGN__?.[fieldLink] : data[rightFieldKey];
51158
- return prev;
51159
- },
51160
- {}
51161
- )
51162
- );
51163
- let fieldList2d;
51164
- if (sInfo.subTable2d && sInfo.key === "dyn" || sInfo.checkTable2d && sInfo.key === "newfixed") {
51165
- const emptyList = Array.from({ length: sInfo.childInitRowLen });
51166
- fieldList2d = fieldList.map((fInfo) => {
51167
- const group_ = `${sInfo.key}${uuid()}`;
51168
- return emptyList.map((_2) => {
51169
- return {
51170
- ...fInfo,
51171
- group_
51172
- };
51173
- });
51174
- }).flat();
51199
+ const buildPathMapFromApiResult = (onFieldMap, result, subTableInfo) => {
51200
+ const pathMap = {};
51201
+ const { data = [], dict = {} } = result;
51202
+ if (!data?.length) return pathMap;
51203
+ const getLabelFromDict = (srcKey, value) => {
51204
+ const entry = dict?.[srcKey]?.[value];
51205
+ if (entry == null) return void 0;
51206
+ return Array.isArray(entry) ? entry[0] : entry;
51207
+ };
51208
+ onFieldMap.forEach((item) => {
51209
+ if (item.subModel === 0) {
51210
+ const firstRow = data[0];
51211
+ item.fields.forEach(({ isFieldModel, leftFieldKey, fieldLink, rightFieldKey }) => {
51212
+ const srcKey = rightFieldKey;
51213
+ const value = isFieldModel ? firstRow?.__FOREIGN__?.[fieldLink] : firstRow?.[srcKey];
51214
+ if (value != null) {
51215
+ const valuePath = generateValuePath(leftFieldKey, "");
51216
+ pathMap[valuePath] = value;
51217
+ const label = getLabelFromDict(srcKey, value);
51218
+ if (label != null) pathMap[`${valuePath}_lb_`] = label;
51175
51219
  }
51176
- merge(formDataItem, {
51177
- [item.subFieldKey]: {
51178
- data: fieldList2d || fieldList,
51179
- dict: result.dict ?? {}
51220
+ });
51221
+ } else if (item.subModel === 1) {
51222
+ data.forEach(
51223
+ (rowData, index2) => item.fields.forEach(({ isFieldModel, leftFieldKey, fieldLink, rightFieldKey }) => {
51224
+ const srcKey = rightFieldKey;
51225
+ const value = isFieldModel ? rowData?.__FOREIGN__?.[fieldLink] : rowData?.[srcKey];
51226
+ if (value != null) {
51227
+ const valuePath = generateValuePath(leftFieldKey, item.subFieldKey);
51228
+ const runtimeValuePath = replacePathIndexPlaceholder(index2, valuePath);
51229
+ pathMap[runtimeValuePath] = value;
51230
+ const label = getLabelFromDict(srcKey, value);
51231
+ if (label != null) pathMap[`${runtimeValuePath}_lb_`] = label;
51180
51232
  }
51181
- });
51182
- }
51183
- });
51184
- }
51185
- return formDataItem;
51233
+ })
51234
+ );
51235
+ }
51236
+ });
51237
+ return pathMap;
51186
51238
  };
51187
51239
  const handleCustomDataSource = async (customDataSource, paramsConfig, subTableInfo, instanceId) => {
51188
51240
  if (!customDataSource.length || !paramsConfig) {
@@ -51237,24 +51289,15 @@ const handleCustomDataSource = async (customDataSource, paramsConfig, subTableIn
51237
51289
  metaInfo = await api.apaas.modelMeta.getInfo({ id: info.joinModelKey });
51238
51290
  }
51239
51291
  if (metaInfo && metaInfo.type === "RDO" && info.joinModelKey === "em_product") {
51240
- const promise = api.apaas.onlineFormInstance.getGetRelatedProduct({
51241
- id: instanceId
51242
- }).then((res) => {
51243
- return getFormDataItem(info.onFieldMap, subTableInfo, {
51244
- data: res ? [res] : []
51245
- });
51246
- });
51292
+ const promise = api.apaas.onlineFormInstance.getGetRelatedProduct({ id: instanceId }).then(
51293
+ (res) => buildPathMapFromApiResult(info.onFieldMap, { data: res ? [res] : [] })
51294
+ );
51247
51295
  promises.push(promise);
51248
51296
  } else if (info.joinModelType === JoinModelTypeEum.SqlModel) {
51249
51297
  if (finalSQL) {
51250
- const promise = api.apaas.dataSource.postSelect({
51251
- key: info.joinModelKey,
51252
- sql: finalSQL
51253
- }).then((res) => {
51254
- return getFormDataItem(info.onFieldMap, subTableInfo, {
51255
- data: res ?? []
51256
- });
51257
- });
51298
+ const promise = api.apaas.dataSource.postSelect({ key: info.joinModelKey, sql: finalSQL }).then(
51299
+ (res) => buildPathMapFromApiResult(info.onFieldMap, { data: res ?? [] })
51300
+ );
51258
51301
  promises.push(promise);
51259
51302
  }
51260
51303
  } else if (info.joinModelType === JoinModelTypeEum.IpaasModel) {
@@ -51267,36 +51310,30 @@ const handleCustomDataSource = async (customDataSource, paramsConfig, subTableIn
51267
51310
  queryParameters: metaIpaas.metaQuery,
51268
51311
  uriParameters: metaIpaas.metaUri
51269
51312
  }).then((res) => {
51270
- const formDataItem = { ...cloneDeep(DEFAULT_FROM_STATE) };
51313
+ const ipaasPathMap = {};
51271
51314
  info.onFieldMap.forEach((item) => {
51272
51315
  if (item.subModel === 0) {
51273
- const mappedFields = jsonSchemaUtils.processJsonSchemaSubModel0(item, res);
51274
- merge(formDataItem, mappedFields);
51275
- } else if (item.subModel === 1) {
51276
- const sInfo = subTableInfo.find((aa2) => aa2.field === item.subFieldKey) || {};
51277
- const fieldList = jsonSchemaUtils.processJsonSchemaSubModel1(item, res);
51278
- let fieldList2d;
51279
- if (sInfo.subTable2d && sInfo.key === "dyn" || sInfo.checkTable2d && sInfo.key === "newfixed") {
51280
- const emptyList = Array.from({ length: sInfo.childInitRowLen });
51281
- fieldList2d = fieldList.map((fInfo) => {
51282
- const group_ = `${sInfo.key}${uuid()}`;
51283
- return emptyList.map((_2) => {
51284
- return {
51285
- ...fInfo,
51286
- group_
51287
- };
51288
- });
51289
- }).flat();
51290
- }
51291
- merge(formDataItem, {
51292
- [item.subFieldKey]: {
51293
- data: fieldList2d || fieldList,
51294
- dict: {}
51316
+ const fields = jsonSchemaUtils.processJsonSchemaSubModel0(item, res);
51317
+ Object.entries(fields).forEach(([key, value]) => {
51318
+ if (value != null) {
51319
+ const valuePath = generateValuePath(key, "");
51320
+ ipaasPathMap[valuePath] = value;
51295
51321
  }
51296
51322
  });
51323
+ } else if (item.subModel === 1) {
51324
+ let rows = jsonSchemaUtils.processJsonSchemaSubModel1(item, res);
51325
+ rows.forEach((rowData, index2) => {
51326
+ Object.entries(rowData).forEach(([key, value]) => {
51327
+ if (value != null) {
51328
+ const valuePath = generateValuePath(key, item.subFieldKey);
51329
+ const runtimeValuePath = replacePathIndexPlaceholder(index2, valuePath);
51330
+ ipaasPathMap[runtimeValuePath] = value;
51331
+ }
51332
+ });
51333
+ });
51297
51334
  }
51298
51335
  });
51299
- return formDataItem;
51336
+ return ipaasPathMap;
51300
51337
  });
51301
51338
  promises.push(promise);
51302
51339
  }
@@ -51306,8 +51343,9 @@ const handleCustomDataSource = async (customDataSource, paramsConfig, subTableIn
51306
51343
  protocolKey: info.joinModelKey,
51307
51344
  instId: instanceId
51308
51345
  });
51309
- const promise = getFormDataItem(info.onFieldMap, subTableInfo, res);
51310
- promises.push(promise);
51346
+ promises.push(
51347
+ Promise.resolve(buildPathMapFromApiResult(info.onFieldMap, res))
51348
+ );
51311
51349
  }
51312
51350
  } else {
51313
51351
  const query = info.query.filter((item) => {
@@ -51341,24 +51379,23 @@ const handleCustomDataSource = async (customDataSource, paramsConfig, subTableIn
51341
51379
  foreignFields
51342
51380
  },
51343
51381
  ...params
51344
- }).then((res) => {
51345
- return getFormDataItem(info.onFieldMap, subTableInfo, res);
51346
- });
51382
+ }).then((res) => buildPathMapFromApiResult(info.onFieldMap, res));
51347
51383
  promises.push(promise);
51348
51384
  }
51349
51385
  }
51350
51386
  }
51351
- return Promise.all(promises);
51387
+ const results = await Promise.all(promises);
51388
+ return results.reduce((merged, map2) => merge(merged, map2), {});
51352
51389
  };
51353
- const loadDataInitValues = async (runtimeJson, paramsConfig, subTableInfo, fieldPermission, instanceId) => {
51354
- const { document: document2 } = JSON.parse(runtimeJson || "{}");
51355
- if (!document2?.config?.dataInit) return {};
51356
- const { parameterMapping = [], customDataSource = [] } = document2.config.dataInit;
51357
- const paramMap = handleParameterMapping(
51390
+ const loadDataInitValues = async (dataInitConfig, paramsConfig, subTableInfo, fieldPermission, instanceId, instances, ctx) => {
51391
+ if (!dataInitConfig) return { paramMap: {}, dsRawData: {} };
51392
+ const { parameterMapping = [], customDataSource = [] } = dataInitConfig || {};
51393
+ const paramMap = await handleParameterMapping(
51358
51394
  parameterMapping,
51359
51395
  paramsConfig,
51360
- subTableInfo,
51361
- fieldPermission
51396
+ fieldPermission,
51397
+ instances,
51398
+ ctx
51362
51399
  );
51363
51400
  const dsMap = await handleCustomDataSource(
51364
51401
  customDataSource,
@@ -51366,10 +51403,7 @@ const loadDataInitValues = async (runtimeJson, paramsConfig, subTableInfo, field
51366
51403
  subTableInfo,
51367
51404
  instanceId
51368
51405
  );
51369
- return {
51370
- ...mainData2WordData(paramMap),
51371
- ...mainData2WordData(dsMap)
51372
- };
51406
+ return { paramMap, dsMap };
51373
51407
  };
51374
51408
  const collectLinkedModelFields = (instances) => {
51375
51409
  const mainFields = /* @__PURE__ */ new Set();
@@ -51557,15 +51591,17 @@ async function initializeDocumentEngine(props, payload, result) {
51557
51591
  masterSlaveList
51558
51592
  );
51559
51593
  console.log("默认值集合 ===>", defaultDataMap);
51560
- const dataInitMap = await loadDataInitValues(
51561
- requestInfo.runtimeJson || "",
51594
+ const { paramMap, dsMap } = await loadDataInitValues(
51595
+ cloneRuntimeJson?.document?.config?.dataInit,
51562
51596
  paramsConfig,
51563
- [],
51564
- // JSW TODO: subTableInfo
51597
+ docModel.getSubTableInfoList(),
51565
51598
  JSON.parse(requestInfo.processFieldPermission || "[]"),
51566
- id
51599
+ id,
51600
+ instances,
51601
+ payload.ctx
51567
51602
  );
51568
- console.log("数据初始化集合 ===>", dataInitMap);
51603
+ console.log("TJ::数据初始化集合/参数映射 ===>", paramMap);
51604
+ console.log("TJ::数据初始化集合/自定义数据源 ===>", dsMap);
51569
51605
  const interfaceData = await fetchRenderData({
51570
51606
  info: requestInfo,
51571
51607
  fetchConfig: {
@@ -51599,10 +51635,8 @@ async function initializeDocumentEngine(props, payload, result) {
51599
51635
  docRuntimeMeta,
51600
51636
  fieldModelQuery: payload.ctx.runtime
51601
51637
  });
51602
- doc.dataManager.setRawData(rawData, {
51603
- ...defaultDataMap,
51604
- ...dataInitMap
51605
- });
51638
+ doc.dataManager.setRawData(rawData, defaultDataMap);
51639
+ doc.dataManager.applyInitData({ ...paramMap, ...dsMap });
51606
51640
  doc.docRuntimeMeta.handleInfo.initRawDataSnapshot = cloneDeep(doc.dataManager.getRawData());
51607
51641
  const docInfo = snapshotDocInfo(doc);
51608
51642
  return {
@@ -55673,10 +55707,11 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
55673
55707
  dataGroup2DList.push({
55674
55708
  subTableId: cell.subRenderer.id,
55675
55709
  subTableType: cell.subRenderer.type,
55710
+ subTableValuePath: cell.subRenderer.valuePath,
55676
55711
  dataGroup2DAreaRange: cell.subRenderer?.dataGroup2DAreaRange
55677
55712
  });
55678
55713
  });
55679
- dataGroup2DList.forEach(({ subTableId, subTableType, dataGroup2DAreaRange }) => {
55714
+ dataGroup2DList.forEach(({ subTableId, subTableType, subTableValuePath, dataGroup2DAreaRange }) => {
55680
55715
  if (!dataGroup2DAreaRange?.start) return;
55681
55716
  const {
55682
55717
  start: { row: startRow, col: startCol },
@@ -55695,6 +55730,7 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
55695
55730
  subRenderer: {
55696
55731
  id: subTableId,
55697
55732
  type: subTableType,
55733
+ valuePath: subTableValuePath,
55698
55734
  dataIndex: fakeDataIndex,
55699
55735
  xDataIndex: fakeDataIndex
55700
55736
  }
@@ -55941,7 +55977,11 @@ const _sfc_main$2D = /* @__PURE__ */ defineComponent({
55941
55977
  pos: dataGroupTypePos.value[id],
55942
55978
  onMouseenter: ($event) => onMouseenter(id, "data-group-first"),
55943
55979
  onMouseleave,
55944
- onClick: ($event) => handleAction(layer.type, { regionId: id, subFieldKey: layer.valuePath })
55980
+ onClick: ($event) => handleAction(layer.type, {
55981
+ regionId: id,
55982
+ subFieldKey: layer.valuePath,
55983
+ isDataGroup2DClicked: true
55984
+ })
55945
55985
  }, null, 8, ["uuid", "isPreview", "layer", "pos", "onMouseenter", "onClick"])) : createCommentVNode("", true)
55946
55986
  ]),
55947
55987
  _: 2
@@ -59763,15 +59803,20 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
59763
59803
  const createFieldToWidget = createDesignFieldToWidgetFactory(designCtx.getFieldManifest);
59764
59804
  const subFieldKey = computed(() => {
59765
59805
  if (!interCtx.panelData) return "";
59766
- const s = getLastSegment(interCtx.panelData.context.subFieldKey);
59767
- return s.includes(":") ? s.split(":")[0] : s;
59806
+ return getLastSegment(interCtx.panelData.context.subFieldKey);
59768
59807
  });
59769
59808
  const modelKey = computed(() => {
59770
59809
  if (!interCtx.panelData) return "";
59771
59810
  const mainModelKey = interCtx.panelData.context.mainModelKey;
59772
59811
  if (!mainModelKey) return "";
59773
- if (subFieldKey.value) {
59774
- const field = designCtx.runtime.getFieldList(mainModelKey)?.find((f) => f.key === subFieldKey.value);
59812
+ const fullSubKey = subFieldKey.value;
59813
+ if (fullSubKey) {
59814
+ let singleSubKey = fullSubKey;
59815
+ if (fullSubKey.includes(":")) {
59816
+ const keyIndex = interCtx.panelData.context.isDataGroup2DClicked ? 1 : 0;
59817
+ singleSubKey = fullSubKey.split(":")[keyIndex];
59818
+ }
59819
+ const field = designCtx.runtime.getFieldList(mainModelKey)?.find((f) => f.key === singleSubKey);
59775
59820
  return field?.bindInfo ?? "";
59776
59821
  }
59777
59822
  return mainModelKey;
@@ -59884,7 +59929,7 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
59884
59929
  };
59885
59930
  }
59886
59931
  });
59887
- const ToolkitContentFields = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__scopeId", "data-v-c740a237"]]);
59932
+ const ToolkitContentFields = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__scopeId", "data-v-3fbe453b"]]);
59888
59933
  function createDesignPaperWidgetToWidgetFactory(getPaperWidgetManifest) {
59889
59934
  return function(widget, opts = {}) {
59890
59935
  const manifest2 = getPaperWidgetManifest(widget.type);
@@ -60046,21 +60091,12 @@ const _sfc_main$2g = /* @__PURE__ */ defineComponent({
60046
60091
  title: "",
60047
60092
  onClose: _cache[4] || (_cache[4] = ($event) => handleToolkitClose("data-init")),
60048
60093
  onVisibleChange: _cache[5] || (_cache[5] = ($event) => handleVisibleChange("data-init", $event))
60049
- }),
60050
- createVNode(ToolkitItem, {
60051
- noDropdown: "",
60052
- icon: "icon-shujumoxing",
60053
- version: "v1",
60054
- label: "数据加载",
60055
- title: "",
60056
- onClose: _cache[6] || (_cache[6] = ($event) => handleToolkitClose("data-load")),
60057
- onVisibleChange: _cache[7] || (_cache[7] = ($event) => handleVisibleChange("data-load", $event))
60058
60094
  })
60059
60095
  ]);
60060
60096
  };
60061
60097
  }
60062
60098
  });
60063
- const Toolkit = /* @__PURE__ */ _export_sfc(_sfc_main$2g, [["__scopeId", "data-v-dddcd6f8"]]);
60099
+ const Toolkit = /* @__PURE__ */ _export_sfc(_sfc_main$2g, [["__scopeId", "data-v-7ebf8ab6"]]);
60064
60100
  const _hoisted_1$1A = { class: "designer_panel-wrapper" };
60065
60101
  const _hoisted_2$10 = { class: "panel-breadcrumb" };
60066
60102
  const _hoisted_3$L = {
@@ -61665,8 +61701,6 @@ const _sfc_main$22 = /* @__PURE__ */ defineComponent({
61665
61701
  setup(__props) {
61666
61702
  const { docInst } = useDocPubApiContext();
61667
61703
  const interCtx = useInteractionContext();
61668
- const modelKey = toRef(docInst.value, "mainModelKey");
61669
- const { fields: mainModelFields } = useModelData(modelKey);
61670
61704
  const pageStageRef = ref(null);
61671
61705
  const scrollRef = ref(null);
61672
61706
  function canDrop(e, isOutOfFlow) {
@@ -61701,7 +61735,6 @@ const _sfc_main$22 = /* @__PURE__ */ defineComponent({
61701
61735
  docInst.value.execute(CommandType.insertField, {
61702
61736
  valuePath: widgetMeta.field?.valuePath,
61703
61737
  widgetMeta,
61704
- mainModelFields: mainModelFields.value || [],
61705
61738
  doCallback(data) {
61706
61739
  if (!data) return;
61707
61740
  const focus = Array.isArray(data) ? data[data.length - 1] : data;
@@ -61791,7 +61824,7 @@ const _sfc_main$22 = /* @__PURE__ */ defineComponent({
61791
61824
  };
61792
61825
  }
61793
61826
  });
61794
- const EditableCanvas = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__scopeId", "data-v-02d21574"]]);
61827
+ const EditableCanvas = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__scopeId", "data-v-85f53514"]]);
61795
61828
  const useDocDesignLayoutProps = () => {
61796
61829
  const provideProps = (props) => {
61797
61830
  provide(DOC_DESIGN_LAYOUT_PROPS, props);
@@ -63025,6 +63058,13 @@ const manifest$A = {
63025
63058
  defaultProps: {
63026
63059
  ...commonDefaultProps,
63027
63060
  autofillRules: []
63061
+ },
63062
+ computed: {
63063
+ defaultValueRule: {
63064
+ type: "api",
63065
+ fetcher: "ref",
63066
+ onlyMainModelFieldsCanRequest: true
63067
+ }
63028
63068
  }
63029
63069
  };
63030
63070
  const __vite_glob_0_13$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -63066,6 +63106,13 @@ const manifest$y = {
63066
63106
  defaultProps: {
63067
63107
  ...commonDefaultProps,
63068
63108
  autofillRules: []
63109
+ },
63110
+ computed: {
63111
+ defaultValueRule: {
63112
+ type: "api",
63113
+ fetcher: "ref",
63114
+ onlyMainModelFieldsCanRequest: true
63115
+ }
63069
63116
  }
63070
63117
  };
63071
63118
  const __vite_glob_0_15$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -63220,6 +63267,13 @@ const manifest$r = {
63220
63267
  defaultProps: {
63221
63268
  ...commonDefaultProps,
63222
63269
  autofillRules: []
63270
+ },
63271
+ computed: {
63272
+ defaultValueRule: {
63273
+ type: "api",
63274
+ fetcher: "ref",
63275
+ onlyMainModelFieldsCanRequest: true
63276
+ }
63223
63277
  }
63224
63278
  };
63225
63279
  const __vite_glob_0_22 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -63239,6 +63293,13 @@ const manifest$q = {
63239
63293
  defaultProps: {
63240
63294
  ...commonDefaultProps,
63241
63295
  autofillRules: []
63296
+ },
63297
+ computed: {
63298
+ defaultValueRule: {
63299
+ type: "api",
63300
+ fetcher: "rdo2ref",
63301
+ onlyMainModelFieldsCanRequest: true
63302
+ }
63242
63303
  }
63243
63304
  };
63244
63305
  const __vite_glob_0_23 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -63257,6 +63318,13 @@ const manifest$p = {
63257
63318
  propsSchema: "schema:field-business",
63258
63319
  defaultProps: {
63259
63320
  ...commonDefaultProps
63321
+ },
63322
+ computed: {
63323
+ defaultValueRule: {
63324
+ type: "api",
63325
+ fetcher: "lot2sn",
63326
+ onlyMainModelFieldsCanRequest: true
63327
+ }
63260
63328
  }
63261
63329
  };
63262
63330
  const __vite_glob_0_24 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -63298,6 +63366,13 @@ const manifest$n = {
63298
63366
  defaultProps: {
63299
63367
  ...commonDefaultProps,
63300
63368
  autofillRules: []
63369
+ },
63370
+ computed: {
63371
+ defaultValueRule: {
63372
+ type: "api",
63373
+ fetcher: "ref",
63374
+ onlyMainModelFieldsCanRequest: true
63375
+ }
63301
63376
  }
63302
63377
  };
63303
63378
  const __vite_glob_0_26 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -63410,7 +63485,10 @@ const manifest$i = {
63410
63485
  ...styleDefaultProps
63411
63486
  },
63412
63487
  computed: {
63413
- defaultValueRule: labelResolveEnumConfig,
63488
+ defaultValueRule: {
63489
+ ...labelResolveEnumConfig,
63490
+ isMulti: true
63491
+ },
63414
63492
  propRules: {
63415
63493
  computedOptions: optionsMapEnumConfig
63416
63494
  }
@@ -63546,6 +63624,13 @@ const manifest$c = {
63546
63624
  defaultProps: {
63547
63625
  ...commonDefaultProps,
63548
63626
  autofillRules: []
63627
+ },
63628
+ computed: {
63629
+ defaultValueRule: {
63630
+ type: "api",
63631
+ fetcher: "ref",
63632
+ onlyMainModelFieldsCanRequest: true
63633
+ }
63549
63634
  }
63550
63635
  };
63551
63636
  const __vite_glob_0_37 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -67400,14 +67485,17 @@ const _sfc_main$1y = /* @__PURE__ */ defineComponent({
67400
67485
  const designCtx = useDesignSuiteContext();
67401
67486
  const getFieldOptions = (modelKey) => {
67402
67487
  if (!modelKey) return [];
67403
- return designCtx.runtime.getFieldList(modelKey).filter((f) => f.createTime === "USER_DEFINED").map(({ key, name }) => ({ label: name, value: key }));
67488
+ return designCtx.runtime.getFieldList(modelKey).filter((f) => f.createType === "USER_DEFINED").map(({ key, name }) => ({ label: name, value: key }));
67404
67489
  };
67405
67490
  const props = __props;
67406
67491
  const sheetReadonly = ref(false);
67407
67492
  const optionsMap = computed(() => {
67408
67493
  const { mainModelKey, subFieldKey } = props.active.context;
67494
+ if (!mainModelKey || !subFieldKey) {
67495
+ return { row: [], col: [] };
67496
+ }
67409
67497
  const mainFields = designCtx.runtime.getFieldList(mainModelKey);
67410
- const [rowFieldKey, colFieldKey] = subFieldKey?.replace("$.", "").split(":") ?? [];
67498
+ const [rowFieldKey, colFieldKey] = subFieldKey.replace("$.", "").split(":") ?? [];
67411
67499
  const rowModelKey = mainFields.find((f) => f.key === rowFieldKey)?.bindInfo;
67412
67500
  const colModelKey = mainFields.find((f) => f.key === colFieldKey)?.bindInfo;
67413
67501
  return {
@@ -67484,11 +67572,11 @@ const _sfc_main$1y = /* @__PURE__ */ defineComponent({
67484
67572
  size: "small",
67485
67573
  allowClear: "",
67486
67574
  disabled: sheetReadonly.value,
67487
- value: unref(regionProps).refColField,
67488
- "onUpdate:value": _cache[1] || (_cache[1] = ($event) => unref(regionProps).refColField = $event),
67575
+ modelValue: unref(regionProps).refColField,
67576
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(regionProps).refColField = $event),
67489
67577
  placeholder: "请选择关联主键",
67490
67578
  options: optionsMap.value.col
67491
- }, null, 8, ["disabled", "value", "options"])
67579
+ }, null, 8, ["disabled", "modelValue", "options"])
67492
67580
  ]),
67493
67581
  _: 1
67494
67582
  }),
@@ -67501,11 +67589,11 @@ const _sfc_main$1y = /* @__PURE__ */ defineComponent({
67501
67589
  size: "small",
67502
67590
  allowClear: "",
67503
67591
  disabled: sheetReadonly.value,
67504
- value: unref(regionProps).refRowField,
67505
- "onUpdate:value": _cache[2] || (_cache[2] = ($event) => unref(regionProps).refRowField = $event),
67592
+ modelValue: unref(regionProps).refRowField,
67593
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(regionProps).refRowField = $event),
67506
67594
  placeholder: "请选择动态表关联关系建立",
67507
67595
  options: optionsMap.value.row
67508
- }, null, 8, ["disabled", "value", "options"])
67596
+ }, null, 8, ["disabled", "modelValue", "options"])
67509
67597
  ]),
67510
67598
  _: 1
67511
67599
  })
@@ -67517,7 +67605,7 @@ const _sfc_main$1y = /* @__PURE__ */ defineComponent({
67517
67605
  };
67518
67606
  }
67519
67607
  });
67520
- const DataGroup2DPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__scopeId", "data-v-09b6985e"]]);
67608
+ const DataGroup2DPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__scopeId", "data-v-6a36dc19"]]);
67521
67609
  const schema$6 = {
67522
67610
  key: "data-group-2d.basic",
67523
67611
  title: [
@@ -5,6 +5,7 @@ export declare function useActivePanel(): {
5
5
  readonly context: {
6
6
  readonly mainModelKey?: string | undefined;
7
7
  readonly subFieldKey?: string | undefined;
8
+ readonly isDataGroup2DClicked?: boolean | undefined;
8
9
  readonly regionId?: string | undefined;
9
10
  readonly secRefId?: string | undefined;
10
11
  };
@@ -17,6 +17,7 @@ export declare function useTableSelection(): {
17
17
  readonly context: {
18
18
  readonly mainModelKey?: string | undefined;
19
19
  readonly subFieldKey?: string | undefined;
20
+ readonly isDataGroup2DClicked?: boolean | undefined;
20
21
  readonly regionId?: string | undefined;
21
22
  readonly secRefId?: string | undefined;
22
23
  };
@@ -11,7 +11,10 @@ export declare function applyDefaultValue(props: any, payload: {
11
11
  valuePath: string;
12
12
  }): Record<string, any> | undefined;
13
13
  /** 获取填充 API 类型的默认值 */
14
- export declare function enrichApiDefaultValues(defaults: Record<string, any> | undefined, rule: ComputedRule, valuePath: string, fieldMeta: FieldDataBindingMeta, context: any, loadFieldByKey: (modelKey: string, key: string) => Promise<FieldMeta | undefined>): Promise<Record<string, any> | undefined>;
14
+ export declare function enrichApiDefaultValues(defaults: Record<string, any> | undefined, rule: ComputedRule, valuePath: string, fieldMeta: FieldDataBindingMeta, context: any, loadFieldByKey: (modelKey: string, key: string) => Promise<FieldMeta | undefined>, options?: {
15
+ /** 是否允许子模型字段请求 */
16
+ allowSubModelRequest?: boolean;
17
+ }): Promise<Record<string, any> | undefined>;
15
18
  export declare function computeFieldDefaultValue(params: {
16
19
  /** 字段类型 */
17
20
  fieldType: FIELD_TYPE;
@@ -27,6 +30,8 @@ export declare function computeFieldDefaultValue(params: {
27
30
  getFieldManifest: (type: FIELD_TYPE) => FieldManifest | undefined;
28
31
  /** enrich 依赖 */
29
32
  loadFieldByKey: (modelKey: string, key: string) => Promise<FieldMeta | undefined>;
33
+ /** 是否允许子模型字段请求 */
34
+ allowSubModelRequest?: boolean;
30
35
  }): Promise<Record<string, any>>;
31
36
  /** 默认值-数据填充 */
32
37
  export declare function loadDefaultValueByAutofillRules(ctx: DesignSuiteContext, instances: any[], autofillRules: any[], field: FieldDataBindingMeta, masterSlaveList: FieldMeta[],
@@ -25,7 +25,9 @@ export declare function getDefaultQueryIdsByFieldType(payload: {
25
25
  /** 获取默认值集合 */
26
26
  export declare function loadDefaultValuesByFields(instances: any[], ctx: DesignSuiteContext, context: any, masterSlaveList: FieldMeta[]): Promise<Record<string, any>>;
27
27
  /** 获取数据初始化数据 */
28
- export declare const loadDataInitValues: (runtimeJson: string,
28
+ export declare const loadDataInitValues: (
29
+ /** 数据初始化配置 */
30
+ dataInitConfig: any,
29
31
  /** 参数配置 */
30
32
  paramsConfig: any,
31
33
  /** 子表信息 */
@@ -33,8 +35,18 @@ subTableInfo: any[],
33
35
  /** 字段权限 */
34
36
  fieldPermission: any[],
35
37
  /** 实例 ID */
36
- instanceId: string) => Promise<{
37
- [x: string]: any;
38
+ instanceId: string,
39
+ /** 组件实例列表(用于查找 widget 的 fieldMeta/props,供 label 派生) */
40
+ instances: any[],
41
+ /** 设计套件上下文(用于 getFieldManifest 和 loadFieldByKey) */
42
+ ctx: DesignSuiteContext) => Promise<{
43
+ paramMap: {};
44
+ dsRawData: {};
45
+ dsMap?: undefined;
46
+ } | {
47
+ paramMap: Record<string, any>;
48
+ dsMap: Record<string, any>;
49
+ dsRawData?: undefined;
38
50
  }>;
39
51
  /** 收集模型关联字段(主表 + 子表) */
40
52
  export declare const collectLinkedModelFields: (instances: any[]) => {
package/dist/word.css CHANGED
@@ -8658,17 +8658,17 @@ textarea[data-v-57fe54a3]::placeholder {
8658
8658
  .toolkit-item .area.active[data-v-2b1ef693] {
8659
8659
  background-color: #d4d9e2;
8660
8660
  }
8661
- .content-fields-wrapper[data-v-c740a237] {
8661
+ .content-fields-wrapper[data-v-3fbe453b] {
8662
8662
  overflow: hidden;
8663
8663
  position: relative;
8664
8664
  display: flex;
8665
8665
  flex-direction: column;
8666
8666
  height: 480px;
8667
8667
  }
8668
- .content-fields-wrapper .search[data-v-c740a237] {
8668
+ .content-fields-wrapper .search[data-v-3fbe453b] {
8669
8669
  padding: 12px 8px 6px;
8670
8670
  }
8671
- .content-fields-wrapper .container[data-v-c740a237] {
8671
+ .content-fields-wrapper .container[data-v-3fbe453b] {
8672
8672
  position: relative;
8673
8673
  display: flex;
8674
8674
  flex-direction: column;
@@ -8676,7 +8676,7 @@ textarea[data-v-57fe54a3]::placeholder {
8676
8676
  flex: 1;
8677
8677
  overflow: hidden;
8678
8678
  }
8679
- .content-fields-wrapper .container .field-list-wrap[data-v-c740a237] {
8679
+ .content-fields-wrapper .container .field-list-wrap[data-v-3fbe453b] {
8680
8680
  -webkit-box-flex: 1;
8681
8681
  -ms-flex: 1 1 0%;
8682
8682
  -webkit-flex: 1 1 0%;
@@ -8684,10 +8684,10 @@ textarea[data-v-57fe54a3]::placeholder {
8684
8684
  overflow: hidden;
8685
8685
  height: 100%;
8686
8686
  }
8687
- .content-fields-wrapper .container .field-list[data-v-c740a237] {
8687
+ .content-fields-wrapper .container .field-list[data-v-3fbe453b] {
8688
8688
  padding: 4px 6px;
8689
8689
  }
8690
- .content-fields-wrapper .container .item[data-v-c740a237] {
8690
+ .content-fields-wrapper .container .item[data-v-3fbe453b] {
8691
8691
  display: flex;
8692
8692
  align-items: center;
8693
8693
  padding: 5px 8px;
@@ -8699,35 +8699,35 @@ textarea[data-v-57fe54a3]::placeholder {
8699
8699
  user-select: none;
8700
8700
  flex-shrink: 0;
8701
8701
  }
8702
- .content-fields-wrapper .container .main[data-v-c740a237] {
8702
+ .content-fields-wrapper .container .main[data-v-3fbe453b] {
8703
8703
  color: #c3c3c3;
8704
8704
  padding: 4px 10px;
8705
8705
  }
8706
- .content-fields-wrapper .container .field[data-v-c740a237] {
8706
+ .content-fields-wrapper .container .field[data-v-3fbe453b] {
8707
8707
  color: #212528;
8708
8708
  border-radius: 4px;
8709
8709
  cursor: pointer;
8710
8710
  transition: all 0.3s ease;
8711
8711
  }
8712
- .content-fields-wrapper .container .field[data-v-c740a237]:hover {
8712
+ .content-fields-wrapper .container .field[data-v-3fbe453b]:hover {
8713
8713
  background: #f5f5f5;
8714
8714
  }
8715
- .content-fields-wrapper .container .field .field-icon[data-v-c740a237] {
8715
+ .content-fields-wrapper .container .field .field-icon[data-v-3fbe453b] {
8716
8716
  display: flex;
8717
8717
  align-items: center;
8718
8718
  justify-content: center;
8719
8719
  margin-right: 6px;
8720
8720
  }
8721
- .content-fields-wrapper .container .field .field-title[data-v-c740a237] {
8721
+ .content-fields-wrapper .container .field .field-title[data-v-3fbe453b] {
8722
8722
  overflow: hidden;
8723
8723
  font-size: 12px;
8724
8724
  text-overflow: ellipsis;
8725
8725
  white-space: nowrap;
8726
8726
  }
8727
- .content-fields-wrapper .container .field + .field[data-v-c740a237] {
8727
+ .content-fields-wrapper .container .field + .field[data-v-3fbe453b] {
8728
8728
  margin-top: 2px;
8729
8729
  }
8730
- .content-fields-wrapper .container .empty[data-v-c740a237] {
8730
+ .content-fields-wrapper .container .empty[data-v-3fbe453b] {
8731
8731
  position: absolute;
8732
8732
  left: 0;
8733
8733
  top: 0;
@@ -8768,7 +8768,7 @@ ul li[data-v-1e28101c] {
8768
8768
  ul li .widget-icon[data-v-1e28101c] {
8769
8769
  margin-right: 6px;
8770
8770
  }
8771
- .designer_toolkit-wrapper[data-v-dddcd6f8] {
8771
+ .designer_toolkit-wrapper[data-v-7ebf8ab6] {
8772
8772
  position: relative;
8773
8773
  background: #f2f4f7;
8774
8774
  width: 48px;
@@ -8777,7 +8777,7 @@ ul li .widget-icon[data-v-1e28101c] {
8777
8777
  flex-direction: column;
8778
8778
  overflow: hidden;
8779
8779
  }
8780
- .designer_toolkit-wrapper[data-v-dddcd6f8]::after {
8780
+ .designer_toolkit-wrapper[data-v-7ebf8ab6]::after {
8781
8781
  content: '';
8782
8782
  position: absolute;
8783
8783
  width: 1px;
@@ -9131,7 +9131,7 @@ ul li .widget-icon[data-v-1e28101c] {
9131
9131
  width: fit-content;
9132
9132
  pointer-events: none;
9133
9133
  }
9134
- .render-container[data-v-02d21574] {
9134
+ .render-container[data-v-85f53514] {
9135
9135
  overflow-y: auto;
9136
9136
  overflow-x: auto;
9137
9137
  white-space: normal;
@@ -9733,13 +9733,13 @@ svg.portrait-icon[data-v-8bdb451e] {
9733
9733
  .panel-data-group .line-content .delete-title[data-v-4572267c]:hover {
9734
9734
  opacity: 0.7;
9735
9735
  }
9736
- .panel-data-group-2d[data-v-09b6985e] {
9736
+ .panel-data-group-2d[data-v-6a36dc19] {
9737
9737
  position: relative;
9738
9738
  }
9739
- .panel-data-group-2d .container[data-v-09b6985e] {
9739
+ .panel-data-group-2d .container[data-v-6a36dc19] {
9740
9740
  padding: 16px;
9741
9741
  }
9742
- .panel-data-group-2d .content[data-v-09b6985e] {
9742
+ .panel-data-group-2d .content[data-v-6a36dc19] {
9743
9743
  width: 100%;
9744
9744
  display: flex;
9745
9745
  line-height: 22px;
@@ -9747,18 +9747,18 @@ svg.portrait-icon[data-v-8bdb451e] {
9747
9747
  align-items: center;
9748
9748
  justify-content: flex-end;
9749
9749
  }
9750
- .panel-data-group-2d .line-content[data-v-09b6985e] {
9750
+ .panel-data-group-2d .line-content[data-v-6a36dc19] {
9751
9751
  position: relative;
9752
9752
  display: flex;
9753
9753
  margin-top: 12px;
9754
9754
  margin-bottom: 12px;
9755
9755
  gap: 16px;
9756
9756
  }
9757
- .panel-data-group-2d .line-content .form-item[data-v-09b6985e] {
9757
+ .panel-data-group-2d .line-content .form-item[data-v-6a36dc19] {
9758
9758
  margin-top: 0;
9759
9759
  gap: 8px;
9760
9760
  }
9761
- .panel-data-group-2d .line-content .delete-title[data-v-09b6985e] {
9761
+ .panel-data-group-2d .line-content .delete-title[data-v-6a36dc19] {
9762
9762
  color: #f54547;
9763
9763
  cursor: pointer;
9764
9764
  transition: all 0.3s;
@@ -9768,7 +9768,7 @@ svg.portrait-icon[data-v-8bdb451e] {
9768
9768
  right: 0;
9769
9769
  line-height: 22px;
9770
9770
  }
9771
- .panel-data-group-2d .line-content .delete-title[data-v-09b6985e]:hover {
9771
+ .panel-data-group-2d .line-content .delete-title[data-v-6a36dc19]:hover {
9772
9772
  opacity: 0.7;
9773
9773
  }
9774
9774
  .data-init-add-button[data-v-f7e62c9d] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",