@gct-paas/word 0.1.67-beta.2 → 0.1.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @gct-paas/word v0.1.67-beta.2 */
1
+ /*! @gct-paas/word v0.1.67 */
2
2
  import { Fragment, Suspense, Teleport, Transition, TransitionGroup, cloneVNode, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, getCurrentInstance, getCurrentScope, guardReactiveProps, h, inject, isRef, isVNode, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, readonly, ref, render, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, toValue, unref, useCssVars, useModel, useSlots, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
3
3
  import FloatingVue, { PopperWrapper } from "floating-vue";
4
4
  import VueKonva from "vue-konva";
@@ -8896,7 +8896,7 @@ function generateValuePath(fieldLink, subFieldKey) {
8896
8896
  * @param separator 分隔符,默认.
8897
8897
  * @returns 最后一个片段,空值返回空字符串
8898
8898
  */
8899
- function getLastSegment(str, separator = ".") {
8899
+ function getLastSegment$1(str, separator = ".") {
8900
8900
  if (!str) return "";
8901
8901
  const index = str.lastIndexOf(separator);
8902
8902
  return index === -1 ? str : str.slice(index + 1);
@@ -90530,9 +90530,9 @@ var init_render = __esmMin((() => {
90530
90530
  if (item === null || item === void 0 ? void 0 : item.subModel) {
90531
90531
  const parsed = parseValuePath(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.subFieldKey);
90532
90532
  const subFieldKey = parsed.isLink ? parsed.parentFieldKey ?? "" : parsed.fieldKey;
90533
- return item.field === getLastSegment(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.fieldLink) && item.subFieldKey === subFieldKey;
90533
+ return item.field === getLastSegment$1(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.fieldLink) && item.subFieldKey === subFieldKey;
90534
90534
  }
90535
- return item.field === getLastSegment(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.fieldLink) && !(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.subFieldKey);
90535
+ return item.field === getLastSegment$1(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.fieldLink) && !(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.subFieldKey);
90536
90536
  });
90537
90537
  if (widget) {
90538
90538
  const valuePath = widget.valuePath;
@@ -90599,9 +90599,9 @@ var init_render = __esmMin((() => {
90599
90599
  if ((k === null || k === void 0 ? void 0 : k.subModel) === 1) {
90600
90600
  const parsed = parseValuePath(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.subFieldKey);
90601
90601
  const subFieldKey = parsed.isLink ? parsed.parentFieldKey ?? "" : parsed.fieldKey;
90602
- return field.leftFieldKey === getLastSegment(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.fieldLink) && k.subFieldKey === subFieldKey;
90602
+ return field.leftFieldKey === getLastSegment$1(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.fieldLink) && k.subFieldKey === subFieldKey;
90603
90603
  }
90604
- return field.leftFieldKey === getLastSegment(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.fieldLink) && !(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.subFieldKey);
90604
+ return field.leftFieldKey === getLastSegment$1(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.fieldLink) && !(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.subFieldKey);
90605
90605
  });
90606
90606
  return {
90607
90607
  ...field,
@@ -93825,10 +93825,10 @@ function collectAutofillBindingsForSubTable(instances, subFieldKey) {
93825
93825
  }
93826
93826
  function resolveAutofillFieldModelKey(doc, field) {
93827
93827
  if (!field.subFieldKey && doc.mainModelKey) return doc.mainModelKey;
93828
- return getLastSegment(field.modelLink);
93828
+ return getLastSegment$1(field.modelLink);
93829
93829
  }
93830
93830
  function resolveAutofillFieldKey(field) {
93831
- return getLastSegment(field.fieldLink);
93831
+ return getLastSegment$1(field.fieldLink);
93832
93832
  }
93833
93833
  /** 从 fieldModelQuery 缓存读取字段元数据 */
93834
93834
  function readAutofillFieldMetaFromCache(doc, field) {
@@ -94304,7 +94304,7 @@ function fieldNeedsLabelEnrichment(fieldType, manifest) {
94304
94304
  return false;
94305
94305
  }
94306
94306
  function getDictFieldKey(path, fieldBinding) {
94307
- return parseValuePath(path).fieldKey || getLastSegment(fieldBinding.fieldLink) || "";
94307
+ return parseValuePath(path).fieldKey || getLastSegment$1(fieldBinding.fieldLink) || "";
94308
94308
  }
94309
94309
  function readDictLabel(dataManager, path, fieldBinding, value, dictFieldKey) {
94310
94310
  var _row$_DICT;
@@ -94342,8 +94342,8 @@ async function readApiLabel(strategy, value, fieldBinding, loadFieldByKey) {
94342
94342
  if (value == null || value === "") return void 0;
94343
94343
  const fetcher = apiFetchers[strategy.fetcher];
94344
94344
  if (!(fetcher === null || fetcher === void 0 ? void 0 : fetcher.getOptionById) && !(fetcher === null || fetcher === void 0 ? void 0 : fetcher.getOptionByIds)) return strategy.fallback;
94345
- const modelKey = getLastSegment(fieldBinding.modelLink);
94346
- const fieldKey = getLastSegment(fieldBinding.fieldLink);
94345
+ const modelKey = getLastSegment$1(fieldBinding.modelLink);
94346
+ const fieldKey = getLastSegment$1(fieldBinding.fieldLink);
94347
94347
  const fieldInfo = await loadFieldByKey(modelKey, fieldKey);
94348
94348
  const params = {
94349
94349
  modelKey: (fieldInfo === null || fieldInfo === void 0 ? void 0 : fieldInfo.modelKey) || modelKey,
@@ -107359,7 +107359,7 @@ var init_InsertField = __esmMin((() => {
107359
107359
  widgetMeta
107360
107360
  };
107361
107361
  }
107362
- const fieldLink = widgetMeta.field.fieldLink || getLastSegment(draggedValuePath);
107362
+ const fieldLink = widgetMeta.field.fieldLink || getLastSegment$1(draggedValuePath);
107363
107363
  const parentKey = parseValuePath(zoneParentPath).normalized;
107364
107364
  const valuePath = generateValuePath(fieldLink, parentKey);
107365
107365
  return {
@@ -121957,12 +121957,14 @@ var init_bom_validator = __esmMin((() => {
121957
121957
  merge(newArr[sameIndex], row, { qty_: newQty });
121958
121958
  return newArr;
121959
121959
  }
121960
- const sameGroupIndex = findLastIndex(newArr, (i) => {
121961
- return util.productIds.includes(i.product_id_);
121962
- });
121963
- if (sameGroupIndex >= 0) {
121964
- newArr.splice(sameGroupIndex + 1, 0, row);
121965
- return newArr;
121960
+ if (util) {
121961
+ const sameGroupIndex = findLastIndex(newArr, (i) => {
121962
+ return util.productIds.includes(i.product_id_);
121963
+ });
121964
+ if (sameGroupIndex >= 0) {
121965
+ newArr.splice(sameGroupIndex + 1, 0, row);
121966
+ return newArr;
121967
+ }
121966
121968
  }
121967
121969
  newArr.push(row);
121968
121970
  return newArr;
@@ -122134,12 +122136,12 @@ var init_material_consume_table_controller = __esmMin((() => {
122134
122136
  * 参顶部[物料消耗表字段控制]
122135
122137
  * @param rowPath $.f_sub[n] n 必须为数字
122136
122138
  */
122137
- static disableQtyRequired(dataManager, rowPath) {
122139
+ static updateQtyRequiredDisablement(dataManager, rowPath, disabled) {
122138
122140
  this._updateDisablement({
122139
122141
  dataManager,
122140
122142
  rowPath,
122141
122143
  fields: ["qty_required_"],
122142
- disabled: true
122144
+ disabled
122143
122145
  });
122144
122146
  }
122145
122147
  /**
@@ -122175,6 +122177,7 @@ var init_material_consume_table_controller = __esmMin((() => {
122175
122177
  "qty_transfer_uom_id_",
122176
122178
  "transfer_formula_"
122177
122179
  ];
122180
+ if (option.disabled) fields.push("qty_required_", "qty_consumed_");
122178
122181
  this._updateDisablement({
122179
122182
  ...option,
122180
122183
  fields
@@ -122576,7 +122579,7 @@ var init_material_consume_table_controller = __esmMin((() => {
122576
122579
  * 选中行开启编辑
122577
122580
  * @param row
122578
122581
  */
122579
- editRow(option) {
122582
+ editRow(option, isBomPattern) {
122580
122583
  if (this.hasEditingRow()) return;
122581
122584
  const isLast = option.rowIndex === this.actualTableData.length - 1;
122582
122585
  if (this.enableSequenceLoading && !isLast) {
@@ -122584,6 +122587,8 @@ var init_material_consume_table_controller = __esmMin((() => {
122584
122587
  return;
122585
122588
  }
122586
122589
  MCDataUtil.updateRow(option, false);
122590
+ const { dataManager, subFieldKey, rowIndex } = option;
122591
+ MCDataUtil.updateQtyRequiredDisablement(dataManager, `$.${subFieldKey}[${rowIndex}]`, isBomPattern);
122587
122592
  }
122588
122593
  /**
122589
122594
  * 更新整个数组的所有行的已消耗数量
@@ -122840,7 +122845,8 @@ var init_material_consume_util = __esmMin((() => {
122840
122845
  const formTmplBomList = await api$1.apaas.onlineFormTmpl.getGetBomByFormTmplId({ id: templateId });
122841
122846
  if (formTmplBomList === null || formTmplBomList === void 0 ? void 0 : formTmplBomList.length) {
122842
122847
  var _docModel$document$ch;
122843
- if (docModel.document.config) docModel.document.config.formTmplBomList = formTmplBomList;
122848
+ if (!docModel.document.config) docModel.document.config = {};
122849
+ docModel.document.config.formTmplBomList = formTmplBomList;
122844
122850
  (_docModel$document$ch = docModel.document.children[0]) === null || _docModel$document$ch === void 0 || _docModel$document$ch.children.flatMap((el) => el.regions).filter((r) => (r === null || r === void 0 ? void 0 : r.type) === "material-consume-table").forEach((r) => {
122845
122851
  const { valuePath } = r;
122846
122852
  const matchedBom = formTmplBomList.find((bom) => bom.table_key_ === valuePath);
@@ -122854,11 +122860,11 @@ var init_material_consume_util = __esmMin((() => {
122854
122860
  if (!(tmplBomC === null || tmplBomC === void 0 || (_tmplBomC$formInstBom = tmplBomC.formInstBom) === null || _tmplBomC$formInstBom === void 0 ? void 0 : _tmplBomC$formInstBom.formTmplBomList)) return;
122855
122861
  tmplBomC.formInstBom.formTmplBomList.forEach(({ personal_bom_enabled_, entries_, table_key_ }) => {
122856
122862
  const tableController = tmplBomC === null || tmplBomC === void 0 ? void 0 : tmplBomC.findTableControllerByField(table_key_);
122857
- const useBomMode = (tableController === null || tableController === void 0 ? void 0 : tableController.mcPattern) === MaterialConsumptionPatternEnum.BOM;
122863
+ const isBomPattern = (tableController === null || tableController === void 0 ? void 0 : tableController.mcPattern) === MaterialConsumptionPatternEnum.BOM;
122858
122864
  const subFieldKey = table_key_.replace("$.", "");
122859
122865
  const rows = doc.dataManager.getRawData()[subFieldKey] || [];
122860
122866
  const activeCount = rows.filter((row) => !(row === null || row === void 0 ? void 0 : row.deleted_)).length;
122861
- if (useBomMode) {
122867
+ if (isBomPattern) {
122862
122868
  const entries = personal_bom_enabled_ ? entries_ : tmplBomC.bomEntries;
122863
122869
  const includedIds = [];
122864
122870
  (entries || []).forEach((e) => {
@@ -122869,7 +122875,7 @@ var init_material_consume_util = __esmMin((() => {
122869
122875
  });
122870
122876
  subConfig[`${table_key_}[n].product_id_`] = { "id_.in": includedIds };
122871
122877
  repeat(activeCount || 1, (index) => {
122872
- MCDataUtil.disableQtyRequired(doc.dataManager, `${table_key_}[${index}]`);
122878
+ MCDataUtil.updateQtyRequiredDisablement(doc.dataManager, `${table_key_}[${index}]`, true);
122873
122879
  });
122874
122880
  }
122875
122881
  rows.forEach((row, rowIndex) => {
@@ -123200,8 +123206,8 @@ function resolveFieldInfo(options) {
123200
123206
  if (options.fieldInfo) return options.fieldInfo;
123201
123207
  const runtime = (_options$ctx = options.ctx) === null || _options$ctx === void 0 ? void 0 : _options$ctx.runtime;
123202
123208
  const field = (_options$widget = options.widget) === null || _options$widget === void 0 || (_options$widget = _options$widget.widgetMeta) === null || _options$widget === void 0 ? void 0 : _options$widget.field;
123203
- const modelKey = getLastSegment(field === null || field === void 0 ? void 0 : field.modelLink);
123204
- const fieldKey = getLastSegment(field === null || field === void 0 ? void 0 : field.fieldLink);
123209
+ const modelKey = getLastSegment$1(field === null || field === void 0 ? void 0 : field.modelLink);
123210
+ const fieldKey = getLastSegment$1(field === null || field === void 0 ? void 0 : field.fieldLink);
123205
123211
  if (!runtime || !modelKey || !fieldKey) return void 0;
123206
123212
  return (runtime.getFieldList(modelKey) ?? []).find((item) => item.key === fieldKey);
123207
123213
  }
@@ -123618,7 +123624,7 @@ var init_main_field_bind_engine = __esmMin((() => {
123618
123624
  var _binding$excludeField;
123619
123625
  if (field.subFieldKey) continue;
123620
123626
  if (field.fieldType !== binding.fieldType) continue;
123621
- const fieldKey = getLastSegment(field.fieldLink);
123627
+ const fieldKey = getLastSegment$1(field.fieldLink);
123622
123628
  if ((_binding$excludeField = binding.excludeFieldKeys) === null || _binding$excludeField === void 0 ? void 0 : _binding$excludeField.includes(fieldKey)) continue;
123623
123629
  if (!valuePath) continue;
123624
123630
  updates[valuePath] = contextValue;
@@ -125277,11 +125283,11 @@ function useFieldInfo(fieldMeta) {
125277
125283
  const field = computed(() => fieldMeta());
125278
125284
  const modelKey = computed(() => {
125279
125285
  var _field$value;
125280
- return ((_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value.modelLink) ? getLastSegment(field.value.modelLink) : null;
125286
+ return ((_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value.modelLink) ? getLastSegment$1(field.value.modelLink) : null;
125281
125287
  });
125282
125288
  const fieldKey = computed(() => {
125283
125289
  var _field$value2;
125284
- return ((_field$value2 = field.value) === null || _field$value2 === void 0 ? void 0 : _field$value2.fieldLink) ? getLastSegment(field.value.fieldLink) : null;
125290
+ return ((_field$value2 = field.value) === null || _field$value2 === void 0 ? void 0 : _field$value2.fieldLink) ? getLastSegment$1(field.value.fieldLink) : null;
125285
125291
  });
125286
125292
  const fieldList = computed(() => {
125287
125293
  if (!modelKey.value) return [];
@@ -130278,8 +130284,8 @@ function buildWidgetValidationPayload(doc, widget, mode = "change") {
130278
130284
  "fw:select-multiple",
130279
130285
  "fw:tree-select-multiple"
130280
130286
  ].includes(type);
130281
- const modelKey = getLastSegment(fieldMeta.modelLink);
130282
- const fieldKey = getLastSegment(fieldMeta.fieldLink);
130287
+ const modelKey = getLastSegment$1(fieldMeta.modelLink);
130288
+ const fieldKey = getLastSegment$1(fieldMeta.fieldLink);
130283
130289
  const fieldInfo = doc.fieldModelQuery.getFieldByKeyAsync(modelKey, fieldKey);
130284
130290
  const modelInfo = doc.fieldModelQuery.getModel(modelKey);
130285
130291
  const ctx = createValidatorContext(doc, {
@@ -130851,8 +130857,8 @@ async function resolveESopViewModalOptions(doc, widgetMeta, runtimeValuePath) {
130851
130857
  if (value == null || value === "") return null;
130852
130858
  const fieldBinding = widgetMeta.field;
130853
130859
  if (!fieldBinding) return null;
130854
- const modelKey = getLastSegment(fieldBinding.modelLink);
130855
- const fieldKey = getLastSegment(fieldBinding.fieldLink);
130860
+ const modelKey = getLastSegment$1(fieldBinding.modelLink);
130861
+ const fieldKey = getLastSegment$1(fieldBinding.fieldLink);
130856
130862
  const fieldInfo = await doc.fieldModelQuery.loadFieldByKey(modelKey, fieldKey);
130857
130863
  const refModelKey = (fieldInfo === null || fieldInfo === void 0 ? void 0 : fieldInfo.bindInfo) || ((_widgetMeta$props = widgetMeta.props) === null || _widgetMeta$props === void 0 ? void 0 : _widgetMeta$props.refModelKey);
130858
130864
  if (!refModelKey) return null;
@@ -130902,7 +130908,7 @@ function resolveFieldKey(widgetMeta, runtimeValuePath) {
130902
130908
  if (sub === null || sub === void 0 ? void 0 : sub.fieldKey) return sub.fieldKey;
130903
130909
  const fromPath = parseValuePath(runtimeValuePath).fieldKey;
130904
130910
  if (fromPath) return fromPath;
130905
- return getLastSegment((_widgetMeta$field = widgetMeta.field) === null || _widgetMeta$field === void 0 ? void 0 : _widgetMeta$field.fieldLink) || "";
130911
+ return getLastSegment$1((_widgetMeta$field = widgetMeta.field) === null || _widgetMeta$field === void 0 ? void 0 : _widgetMeta$field.fieldLink) || "";
130906
130912
  }
130907
130913
  function resolveOpenFieldHyperlinkModalOptions(doc, widgetMeta, runtimeValuePath) {
130908
130914
  var _widgetMeta$field2, _TableRuntimeContext$, _widgetMeta$field3, _widgetMeta$field4;
@@ -133584,6 +133590,10 @@ var init_sub_table_action_vue_vue_type_script_setup_true_name_sub_table_action_l
133584
133590
  const { valuePath } = getCtx();
133585
133591
  return tmplBomCRef === null || tmplBomCRef === void 0 || (_tmplBomCRef$value = tmplBomCRef.value) === null || _tmplBomCRef$value === void 0 ? void 0 : _tmplBomCRef$value.tableControllers[valuePath];
133586
133592
  });
133593
+ const mcTableIsBomPattern = computed(() => {
133594
+ var _mcTableCtrl$value;
133595
+ return ((_mcTableCtrl$value = mcTableCtrl.value) === null || _mcTableCtrl$value === void 0 ? void 0 : _mcTableCtrl$value.mcPattern) === MaterialConsumptionPatternEnum.BOM;
133596
+ });
133587
133597
  const handleMaterialConsumeAction = async (val) => {
133588
133598
  const ctrl = mcTableCtrl.value;
133589
133599
  const { tableName, valuePath, subFieldKey, subModelKey, index: rowIndex } = getCtx();
@@ -133608,7 +133618,7 @@ var init_sub_table_action_vue_vue_type_script_setup_true_name_sub_table_action_l
133608
133618
  dataManager,
133609
133619
  subFieldKey,
133610
133620
  rowIndex
133611
- });
133621
+ }, mcTableIsBomPattern.value);
133612
133622
  else if (val === "view-bom") ctrl.openBomModal();
133613
133623
  else if (val === "change-rule") ctrl.changeScanRule(mainModelKey, subModelKey);
133614
133624
  };
@@ -133650,9 +133660,9 @@ var init_sub_table_action_vue_vue_type_script_setup_true_name_sub_table_action_l
133650
133660
  */
133651
133661
  const handleRowIncreased = (subFieldKey, rowIndex) => {
133652
133662
  if (subTableType.value.isMaterialConsume) {
133653
- var _mcTableCtrl$value, _mcTableCtrl$value2;
133654
- (_mcTableCtrl$value = mcTableCtrl.value) === null || _mcTableCtrl$value === void 0 || _mcTableCtrl$value.updateRowConsumed(props.doc);
133655
- if (((_mcTableCtrl$value2 = mcTableCtrl.value) === null || _mcTableCtrl$value2 === void 0 ? void 0 : _mcTableCtrl$value2.mcPattern) === MaterialConsumptionPatternEnum.BOM) MCDataUtil.disableQtyRequired(props.doc.dataManager, `$.${subFieldKey}[${rowIndex}]`);
133663
+ var _mcTableCtrl$value2;
133664
+ (_mcTableCtrl$value2 = mcTableCtrl.value) === null || _mcTableCtrl$value2 === void 0 || _mcTableCtrl$value2.updateRowConsumed(props.doc);
133665
+ if (mcTableIsBomPattern.value) MCDataUtil.updateQtyRequiredDisablement(props.doc.dataManager, `$.${subFieldKey}[${rowIndex}]`, true);
133656
133666
  }
133657
133667
  new TableRuntime(props.doc).onRowInit(subFieldKey, rowIndex);
133658
133668
  };
@@ -133813,17 +133823,17 @@ var init_sub_table_action_vue_vue_type_script_setup_true_name_sub_table_action_l
133813
133823
  });
133814
133824
  }));
133815
133825
  //#endregion
133816
- //#region src/runtime/canvas/table/render/table-structure-overlay/sub-table-action.vue?vue&type=style&index=0&scoped=923a27bd&lang.less
133817
- var init_sub_table_action_vue_vue_type_style_index_0_scoped_923a27bd_lang = __esmMin((() => {}));
133826
+ //#region src/runtime/canvas/table/render/table-structure-overlay/sub-table-action.vue?vue&type=style&index=0&scoped=e16ba4cf&lang.less
133827
+ var init_sub_table_action_vue_vue_type_style_index_0_scoped_e16ba4cf_lang = __esmMin((() => {}));
133818
133828
  //#endregion
133819
133829
  //#region src/runtime/canvas/table/render/table-structure-overlay/sub-table-action.vue
133820
133830
  var sub_table_action_default;
133821
133831
  var init_sub_table_action = __esmMin((() => {
133822
133832
  init_sub_table_action_vue_vue_type_script_setup_true_name_sub_table_action_lang();
133823
133833
  init_sub_table_action_vue_vue_type_script_setup_true_name_sub_table_action_lang();
133824
- init_sub_table_action_vue_vue_type_style_index_0_scoped_923a27bd_lang();
133834
+ init_sub_table_action_vue_vue_type_style_index_0_scoped_e16ba4cf_lang();
133825
133835
  init__plugin_vue_export_helper();
133826
- sub_table_action_default = /*#__PURE__*/ _plugin_vue_export_helper_default(sub_table_action_vue_vue_type_script_setup_true_name_sub_table_action_lang_default, [["__scopeId", "data-v-923a27bd"]]);
133836
+ sub_table_action_default = /*#__PURE__*/ _plugin_vue_export_helper_default(sub_table_action_vue_vue_type_script_setup_true_name_sub_table_action_lang_default, [["__scopeId", "data-v-e16ba4cf"]]);
133827
133837
  }));
133828
133838
  //#endregion
133829
133839
  //#region src/runtime/canvas/table/render/table-structure-overlay/index.vue?vue&type=script&setup=true&lang.ts
@@ -135188,8 +135198,8 @@ function resolveFieldFocusContext(doc, modelId) {
135188
135198
  }
135189
135199
  const fieldMeta = (_raw$widgetMeta = raw.widgetMeta) === null || _raw$widgetMeta === void 0 ? void 0 : _raw$widgetMeta.field;
135190
135200
  if (!(fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.fieldLink) || !fieldMeta.modelLink) return null;
135191
- const modelKey = getLastSegment(fieldMeta.modelLink);
135192
- const field = getLastSegment(fieldMeta.fieldLink);
135201
+ const modelKey = getLastSegment$1(fieldMeta.modelLink);
135202
+ const field = getLastSegment$1(fieldMeta.fieldLink);
135193
135203
  if (!modelKey || !field) return null;
135194
135204
  const runtimeValuePath = raw.valuePath || fieldMeta.valuePath || "";
135195
135205
  const subModelKey = fieldMeta.subFieldKey || void 0;
@@ -135379,6 +135389,97 @@ function useFormTmplAndModelInit(controller, options) {
135379
135389
  }, { immediate: true }) };
135380
135390
  }
135381
135391
  //#endregion
135392
+ //#region src/utils/func/calc-used-fields.ts
135393
+ /**
135394
+ * 从 region.valuePath 解析主模型上的子表 / 关联字段 key
135395
+ * 例:`$.f_dtb` → ['f_dtb'];`$.f_a:f_b` → ['f_a', 'f_b']
135396
+ */
135397
+ function extractRegionFieldKeys(valuePath) {
135398
+ const first = (valuePath.replace(/^\$\./, "").split(".")[0] || "").replace(/\[[^\]]*\]/g, "");
135399
+ if (!first) return [];
135400
+ if (first.includes(":")) return first.split(":").map((s) => s.trim()).filter(Boolean);
135401
+ return [first];
135402
+ }
135403
+ function getLastSegment(str, separator = ".") {
135404
+ if (!str) return "";
135405
+ const index = str.lastIndexOf(separator);
135406
+ return index === -1 ? str : str.slice(index + 1);
135407
+ }
135408
+ function fieldDedupeKey(info) {
135409
+ return `${info.source}:${info.modelKey ?? ""}.${info.fieldKey}.${info.valuePath ?? ""}`;
135410
+ }
135411
+ function collectFromWidgetField(map, node) {
135412
+ var _node$widgetMeta, _node$widgetMeta2;
135413
+ const field = (_node$widgetMeta = node.widgetMeta) === null || _node$widgetMeta === void 0 ? void 0 : _node$widgetMeta.field;
135414
+ if (!field || !node.valuePath) return;
135415
+ const fieldKey = getLastSegment(field.fieldLink);
135416
+ if (!fieldKey) return;
135417
+ const info = {
135418
+ modelKey: field.modelLink,
135419
+ fieldKey,
135420
+ fieldLink: field.fieldLink,
135421
+ subFieldKey: field.subFieldKey,
135422
+ fieldType: field.fieldType,
135423
+ label: (_node$widgetMeta2 = node.widgetMeta) === null || _node$widgetMeta2 === void 0 || (_node$widgetMeta2 = _node$widgetMeta2.extra) === null || _node$widgetMeta2 === void 0 || (_node$widgetMeta2 = _node$widgetMeta2.biz) === null || _node$widgetMeta2 === void 0 || (_node$widgetMeta2 = _node$widgetMeta2.fieldIdentity) === null || _node$widgetMeta2 === void 0 ? void 0 : _node$widgetMeta2.label,
135424
+ valuePath: node.valuePath,
135425
+ source: "widget"
135426
+ };
135427
+ map.set(fieldDedupeKey(info), info);
135428
+ }
135429
+ /**
135430
+ * 仅遍历 document(不含页眉 / 页脚 / overlays)
135431
+ */
135432
+ function walkDocumentNodes(document, visit) {
135433
+ const walk = (node) => {
135434
+ if (node == null) return;
135435
+ if (Array.isArray(node)) {
135436
+ for (const child of node) walk(child);
135437
+ return;
135438
+ }
135439
+ if (typeof node !== "object") return;
135440
+ const el = node;
135441
+ if (el.name) visit(el);
135442
+ if (Array.isArray(el.elements)) for (const child of el.elements) walk(child);
135443
+ };
135444
+ walk(document);
135445
+ }
135446
+ /**
135447
+ * 从 Word runtimeJson 提取页面上拖入的字段信息
135448
+ */
135449
+ function calcUsedFieldsFromRuntimeJson(opts) {
135450
+ if (opts.runtimeJson == null) return [];
135451
+ let runtimeJson = opts.runtimeJson;
135452
+ if (typeof runtimeJson === "string") try {
135453
+ runtimeJson = JSON.parse(runtimeJson);
135454
+ } catch {
135455
+ return [];
135456
+ }
135457
+ if (!runtimeJson || typeof runtimeJson !== "object") return [];
135458
+ const document = runtimeJson.document;
135459
+ if (!document) return [];
135460
+ const map = /* @__PURE__ */ new Map();
135461
+ const { mainModelKey } = opts;
135462
+ walkDocumentNodes(document, (node) => {
135463
+ collectFromWidgetField(map, node);
135464
+ if (node.name !== "w:tbl" || !Array.isArray(node.regions)) return;
135465
+ for (const region of node.regions) {
135466
+ if (!region) continue;
135467
+ collectFromWidgetField(map, region);
135468
+ if (!region.valuePath) continue;
135469
+ for (const fieldKey of extractRegionFieldKeys(region.valuePath)) {
135470
+ const info = {
135471
+ modelKey: mainModelKey,
135472
+ fieldKey,
135473
+ valuePath: region.valuePath,
135474
+ source: "region"
135475
+ };
135476
+ map.set(fieldDedupeKey(info), info);
135477
+ }
135478
+ }
135479
+ });
135480
+ return Array.from(map.values());
135481
+ }
135482
+ //#endregion
135382
135483
  //#region src/sdk/engine/index.ts
135383
135484
  init_core();
135384
135485
  //#endregion
@@ -143877,8 +143978,8 @@ var pw_diagonal_render_vue_vue_type_script_setup_true_name_pw_diagonal_render_la
143877
143978
  const fieldMeta = (_pageWidgetProps$valu2 = pageWidgetProps.value.bindFields) === null || _pageWidgetProps$valu2 === void 0 ? void 0 : _pageWidgetProps$valu2[index];
143878
143979
  if (fieldMeta && fieldMeta.fieldData) {
143879
143980
  var _designCtx$runtime$ge, _fieldMeta$fieldData;
143880
- const modelKey = getLastSegment(fieldMeta.fieldData.modelLink);
143881
- const fieldKey = getLastSegment(fieldMeta.fieldData.fieldLink);
143981
+ const modelKey = getLastSegment$1(fieldMeta.fieldData.modelLink);
143982
+ const fieldKey = getLastSegment$1(fieldMeta.fieldData.fieldLink);
143882
143983
  const fieldInfo = modelKey && fieldKey ? ((_designCtx$runtime$ge = designCtx.runtime.getFieldList(modelKey)) === null || _designCtx$runtime$ge === void 0 ? void 0 : _designCtx$runtime$ge.find((f) => f.key === fieldKey)) ?? null : null;
143883
143984
  const path = (_fieldMeta$fieldData = fieldMeta.fieldData) === null || _fieldMeta$fieldData === void 0 ? void 0 : _fieldMeta$fieldData.valuePath;
143884
143985
  if (isDesignMode.value) return (fieldInfo === null || fieldInfo === void 0 ? void 0 : fieldInfo.name) ? `\${${fieldInfo.name}}` : path;
@@ -146774,7 +146875,7 @@ var MaterialConsumeTablePanel_vue_vue_type_script_setup_true_lang_default = /*@_
146774
146875
  init__plugin_vue_export_helper();
146775
146876
  //#endregion
146776
146877
  //#region src/suites/edhr/panel-schema/material-consume-table/material-consume-table.basic.ts
146777
- var schema$10 = createTablePanelSchema("material-consume-table.basic", /* @__PURE__ */ _plugin_vue_export_helper_default(MaterialConsumeTablePanel_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-0b5a3b4b"]]));
146878
+ var schema$10 = createTablePanelSchema("material-consume-table.basic", /* @__PURE__ */ _plugin_vue_export_helper_default(MaterialConsumeTablePanel_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-0e3048f6"]]));
146778
146879
  //#endregion
146779
146880
  //#region src/suites/edhr/panel-schema/fixed-table/fixed-table.basic.ts
146780
146881
  var schema$9 = createTablePanelSchema("fixed-table.basic", BoundedSubTablePanel_default);
@@ -151520,8 +151621,8 @@ function useFieldPanelMeta(getField) {
151520
151621
  manifest: void 0
151521
151622
  };
151522
151623
  const manifest = designCtx.getFieldManifest(field.fieldType);
151523
- const modelKey = getLastSegment(field.modelLink);
151524
- const fieldKey = getLastSegment(field.fieldLink);
151624
+ const modelKey = getLastSegment$1(field.modelLink);
151625
+ const fieldKey = getLastSegment$1(field.fieldLink);
151525
151626
  return {
151526
151627
  field,
151527
151628
  fieldInfo: modelKey && fieldKey ? ((_designCtx$runtime$ge = designCtx.runtime.getFieldList(modelKey)) === null || _designCtx$runtime$ge === void 0 ? void 0 : _designCtx$runtime$ge.find((f) => f.key === fieldKey)) ?? null : null,
@@ -157754,4 +157855,4 @@ function registerSuite(plugin) {
157754
157855
  plugin.install();
157755
157856
  }
157756
157857
  //#endregion
157757
- export { BuiltinComponentTypeConst, doc_design_layout_default as DocDesignLayout, DocModeTypeConst, doc_render_layout_default as DocRenderLayout, layout_default as GctLayout, PaperSizeConst, edhrSuitePlugin, registerPanelSchemas, registerSuite, setupPlatformAdapters, setupVueRuntime, useDocController, useDocOperations, useDocRuntimeProvider, useDocSuite, useDocumentFactory, useFormTmplAndModelInit, useWord };
157858
+ export { BuiltinComponentTypeConst, doc_design_layout_default as DocDesignLayout, DocModeTypeConst, doc_render_layout_default as DocRenderLayout, layout_default as GctLayout, PaperSizeConst, calcUsedFieldsFromRuntimeJson, edhrSuitePlugin, registerPanelSchemas, registerSuite, setupPlatformAdapters, setupVueRuntime, useDocController, useDocOperations, useDocRuntimeProvider, useDocSuite, useDocumentFactory, useFormTmplAndModelInit, useWord };
@@ -43,7 +43,7 @@ export declare class MCDataUtil {
43
43
  * 参顶部[物料消耗表字段控制]
44
44
  * @param rowPath $.f_sub[n] n 必须为数字
45
45
  */
46
- static disableQtyRequired(dataManager: DataManager, rowPath: string): void;
46
+ static updateQtyRequiredDisablement(dataManager: DataManager, rowPath: string, disabled: boolean): void;
47
47
  /**
48
48
  * 物料类型 是否选择[查看物料]时,需要更新指定字段是否禁用
49
49
  * 参顶部[物料消耗表字段控制]
@@ -225,7 +225,7 @@ export declare class MaterialConsumeTableController {
225
225
  * 选中行开启编辑
226
226
  * @param row
227
227
  */
228
- editRow(option: UpdateRowOption): void;
228
+ editRow(option: UpdateRowOption, isBomPattern: boolean): void;
229
229
  /**
230
230
  * 更新整个数组的所有行的已消耗数量
231
231
  *
@@ -13,3 +13,4 @@ export { useDocRuntimeProvider } from '../doc-runtime/composables/useDocRuntimeP
13
13
  export { useDocOperations } from '../doc-runtime/composables/useDocOperations';
14
14
  export { useDocController } from '../doc-runtime/composables/useDocController';
15
15
  export { useFormTmplAndModelInit } from '../doc-runtime/device-link/useFormTmplAndModelInit';
16
+ export { calcUsedFieldsFromRuntimeJson, type CalcUsedFieldsFromRuntimeJsonOptions, type UsedFieldInfo, } from '../../utils/func/calc-used-fields';
@@ -0,0 +1,32 @@
1
+ export type CalcUsedFieldsFromRuntimeJsonOptions = {
2
+ /** Word runtimeJson / designerJson(对象或 JSON 字符串) */
3
+ runtimeJson: object | string;
4
+ /**
5
+ * 主模型 key;用于补全表格 region 解析出的子表字段的 modelKey
6
+ * 不传则 region 字段的 modelKey 为空,由外部自行补齐
7
+ */
8
+ mainModelKey?: string;
9
+ };
10
+ /** 从 runtimeJson 提取出的页面字段信息 */
11
+ export type UsedFieldInfo = {
12
+ /** 模型 key */
13
+ modelKey?: string;
14
+ /** 字段 key */
15
+ fieldKey: string;
16
+ /** 原始 fieldLink */
17
+ fieldLink?: string;
18
+ /** 子表字段 key */
19
+ subFieldKey?: string;
20
+ /** 字段类型 */
21
+ fieldType?: string;
22
+ /** 显示名 */
23
+ label?: string;
24
+ /** 数据路径 */
25
+ valuePath?: string;
26
+ /** 来源:拖入控件 / 表格区域 */
27
+ source: 'widget' | 'region';
28
+ };
29
+ /**
30
+ * 从 Word runtimeJson 提取页面上拖入的字段信息
31
+ */
32
+ export declare function calcUsedFieldsFromRuntimeJson(opts: CalcUsedFieldsFromRuntimeJsonOptions): UsedFieldInfo[];
package/dist/word.css CHANGED
@@ -9433,20 +9433,20 @@ textarea[data-v-2de31883]::placeholder {
9433
9433
  .table-action .row-headers .row-header:last-child .row-add-btn[data-v-c40eef9f] .gct-icon.bottom {
9434
9434
  transform: translateY(-100%);
9435
9435
  }
9436
- .sub-table-action-container[data-v-923a27bd] {
9436
+ .sub-table-action-container[data-v-e16ba4cf] {
9437
9437
  position: absolute;
9438
9438
  z-index: 999;
9439
9439
  }
9440
- .sub-table-action-bar[data-v-923a27bd],
9441
- .sub-table-action-popper[data-v-923a27bd] {
9440
+ .sub-table-action-bar[data-v-e16ba4cf],
9441
+ .sub-table-action-popper[data-v-e16ba4cf] {
9442
9442
  pointer-events: auto;
9443
9443
  user-select: none;
9444
9444
  }
9445
- .sub-table-action-bar[data-v-923a27bd] {
9445
+ .sub-table-action-bar[data-v-e16ba4cf] {
9446
9446
  display: flex;
9447
9447
  }
9448
- .sub-table-action-bar .more-btn[data-v-923a27bd],
9449
- .sub-table-action-bar .confirm-btn[data-v-923a27bd] {
9448
+ .sub-table-action-bar .more-btn[data-v-e16ba4cf],
9449
+ .sub-table-action-bar .confirm-btn[data-v-e16ba4cf] {
9450
9450
  display: flex;
9451
9451
  justify-content: center;
9452
9452
  align-items: center;
@@ -9455,44 +9455,44 @@ textarea[data-v-2de31883]::placeholder {
9455
9455
  cursor: pointer;
9456
9456
  box-sizing: border-box;
9457
9457
  }
9458
- .sub-table-action-bar .more-btn[data-v-923a27bd] {
9458
+ .sub-table-action-bar .more-btn[data-v-e16ba4cf] {
9459
9459
  width: 10px;
9460
9460
  background: #026ac8;
9461
9461
  border-radius: 0 4px 4px 0;
9462
9462
  }
9463
- .sub-table-action-bar .confirm-btn[data-v-923a27bd] {
9463
+ .sub-table-action-bar .confirm-btn[data-v-e16ba4cf] {
9464
9464
  margin-left: 4px;
9465
9465
  border-radius: 4px;
9466
9466
  border: 1px solid #4ec262;
9467
9467
  }
9468
- .sub-table-action-popper[data-v-923a27bd] {
9468
+ .sub-table-action-popper[data-v-e16ba4cf] {
9469
9469
  padding: 2px 8px;
9470
9470
  }
9471
- .sub-table-action-popper .action-menu[data-v-923a27bd] {
9471
+ .sub-table-action-popper .action-menu[data-v-e16ba4cf] {
9472
9472
  padding: 4px 0;
9473
9473
  width: 220px;
9474
9474
  user-select: none;
9475
9475
  }
9476
- .sub-table-action-popper .action-menu + .action-menu[data-v-923a27bd] {
9476
+ .sub-table-action-popper .action-menu + .action-menu[data-v-e16ba4cf] {
9477
9477
  margin-top: 4px;
9478
9478
  padding-top: 4px;
9479
9479
  border-top: 1px solid #efefef;
9480
9480
  }
9481
- .sub-table-action-popper .action-menu .menu-title[data-v-923a27bd] {
9481
+ .sub-table-action-popper .action-menu .menu-title[data-v-e16ba4cf] {
9482
9482
  color: #bcbcbc;
9483
9483
  margin: 4px 0;
9484
9484
  }
9485
- .sub-table-action-popper .action-menu .menu-item[data-v-923a27bd] {
9485
+ .sub-table-action-popper .action-menu .menu-item[data-v-e16ba4cf] {
9486
9486
  display: flex;
9487
9487
  align-items: center;
9488
9488
  padding: 8px 10px;
9489
9489
  border-radius: 4px;
9490
9490
  }
9491
- .sub-table-action-popper .action-menu .menu-item[data-v-923a27bd]:hover {
9491
+ .sub-table-action-popper .action-menu .menu-item[data-v-e16ba4cf]:hover {
9492
9492
  cursor: pointer;
9493
9493
  background-color: #f2f5f8;
9494
9494
  }
9495
- .sub-table-action-popper .action-menu .menu-item .item-icon[data-v-923a27bd] {
9495
+ .sub-table-action-popper .action-menu .menu-item .item-icon[data-v-e16ba4cf] {
9496
9496
  display: flex;
9497
9497
  align-items: center;
9498
9498
  justify-content: start;
@@ -9500,14 +9500,14 @@ textarea[data-v-2de31883]::placeholder {
9500
9500
  width: 20px;
9501
9501
  height: 20px;
9502
9502
  }
9503
- .sub-table-action-popper .action-menu .menu-item .item-icon.scale-large[data-v-923a27bd] {
9503
+ .sub-table-action-popper .action-menu .menu-item .item-icon.scale-large[data-v-e16ba4cf] {
9504
9504
  transform: scale(1.5);
9505
9505
  }
9506
- .sub-table-action-popper .action-menu .menu-item .item-label[data-v-923a27bd] {
9506
+ .sub-table-action-popper .action-menu .menu-item .item-label[data-v-e16ba4cf] {
9507
9507
  flex-grow: 1;
9508
9508
  margin-left: 8px;
9509
9509
  }
9510
- .sub-table-action-popper .action-menu .menu-item .item-label.flex-between-center[data-v-923a27bd] {
9510
+ .sub-table-action-popper .action-menu .menu-item .item-label.flex-between-center[data-v-e16ba4cf] {
9511
9511
  display: flex;
9512
9512
  justify-content: space-between;
9513
9513
  align-items: center;
@@ -11083,22 +11083,22 @@ svg.portrait-icon[data-v-8bdb451e] {
11083
11083
  .bom-entry-item .iconfont.btn-item[data-v-cabb46fe] {
11084
11084
  margin-right: 8px;
11085
11085
  }
11086
- .panel-material-consume-table[data-v-0b5a3b4b] {
11086
+ .panel-material-consume-table[data-v-0e3048f6] {
11087
11087
  position: relative;
11088
11088
  }
11089
- .panel-material-consume-table .container[data-v-0b5a3b4b] {
11089
+ .panel-material-consume-table .container[data-v-0e3048f6] {
11090
11090
  padding: 16px;
11091
11091
  }
11092
- .panel-material-consume-table .form-custom-label[data-v-0b5a3b4b] {
11092
+ .panel-material-consume-table .form-custom-label[data-v-0e3048f6] {
11093
11093
  display: inline-flex;
11094
11094
  align-items: center;
11095
11095
  gap: 4px;
11096
11096
  }
11097
- .panel-material-consume-table .form-custom-label .icon[data-v-0b5a3b4b] {
11097
+ .panel-material-consume-table .form-custom-label .icon[data-v-0e3048f6] {
11098
11098
  cursor: pointer;
11099
11099
  vertical-align: text-top;
11100
11100
  }
11101
- .panel-material-consume-table .content[data-v-0b5a3b4b] {
11101
+ .panel-material-consume-table .content[data-v-0e3048f6] {
11102
11102
  display: flex;
11103
11103
  align-items: center;
11104
11104
  justify-content: flex-end;
@@ -11106,7 +11106,7 @@ svg.portrait-icon[data-v-8bdb451e] {
11106
11106
  line-height: 22px;
11107
11107
  width: 100%;
11108
11108
  }
11109
- .panel-material-consume-table .entries-container[data-v-0b5a3b4b] {
11109
+ .panel-material-consume-table .entries-container[data-v-0e3048f6] {
11110
11110
  padding: 6px 0;
11111
11111
  }
11112
11112
  .add-ds-btn[data-v-e5dff26f] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.67-beta.2",
3
+ "version": "0.1.67",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",
@@ -1,2 +0,0 @@
1
- import { DocModel } from '../../../../../core/model';
2
- export declare const syncMaterialConsumeTableBomInfo: (templateId: string, docModel: DocModel) => Promise<void>;