@gct-paas/excel 0.1.40-beta.12 → 0.1.40-beta.16

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.
Files changed (155) hide show
  1. package/README.md +3 -4
  2. package/dist/{BaseComponent-gj20uBnJ.js → BaseComponent-CCne4pQR.js} +2 -2
  3. package/dist/{VueVideoPlayer-BeylL5J6.js → VueVideoPlayer-BrKkpGMj.js} +2 -2
  4. package/dist/{align-editor-r0dHXFka.js → align-editor-ClmAs0I2.js} +1 -1
  5. package/dist/{barcode-design-CYvf_EAE.js → barcode-design-CFTG45Rl.js} +2 -2
  6. package/dist/base/index.es.js +205 -189
  7. package/dist/{diagonal-design-oDhnFV7y.js → diagonal-design-DUBu7u6U.js} +2 -2
  8. package/dist/{dynamic-table-action-DQwZUD0_.js → dynamic-table-action-PCfL4kn8.js} +954 -231
  9. package/dist/{dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-8yB6zly8.js → dynamic-table-action.vue_vue_type_style_index_0_scoped_8710052f_lang-DNH0HQ7d.js} +1628 -1112
  10. package/dist/{edit.utils-CXmmCnxE-Cu6obgSA.js → edit.utils-CXmmCnxE-eEvfPyLJ.js} +1 -1
  11. package/dist/excel.css +4492 -3661
  12. package/dist/{exceljs.min-Cw2hDE6L.js → exceljs.min-BIUMCkHC.js} +2 -2
  13. package/dist/{font-editor-B_0EZdyd.js → font-editor-CrSyrXhC.js} +3 -3
  14. package/dist/{image-design-FDLY6DFg.js → image-design-9F6prQTp.js} +3 -8
  15. package/dist/{index-DcjvPNF5.js → index-0ACWYeQr.js} +2 -2
  16. package/dist/{index-Go0PUrqy.js → index-0igALLOR.js} +1 -1
  17. package/dist/{index-7u6Pmaax.js → index-6OopHjlb.js} +1 -1
  18. package/dist/{index-4cLi3g2p.js → index-BAOJVzJ6.js} +2 -2
  19. package/dist/{index-C0TsnxJJ.js → index-BD266iSg.js} +2 -2
  20. package/dist/{index-Z9jq6KeM.js → index-BDxVLxSI.js} +2 -2
  21. package/dist/{index-BdFPuj12.js → index-BLWe4Vz0.js} +1 -1
  22. package/dist/{index-DEHsGK91.js → index-BOk29nnL.js} +1 -1
  23. package/dist/{index-C1EtpaAY.js → index-BPN7XFwR.js} +2 -2
  24. package/dist/{index-Cg1LuaLW.js → index-BQnLQV0A.js} +2 -2
  25. package/dist/{index-73QPpTaL.js → index-BU7LYqsX.js} +3 -3
  26. package/dist/{index-CxcaWxbW.js → index-BY_qQ37w.js} +2 -2
  27. package/dist/{index-D3xW5qOp.js → index-BbiyVhS-.js} +2 -2
  28. package/dist/{index-CQTRWLPa.js → index-BiMaezbB.js} +3 -2
  29. package/dist/{index-D1QJAMGR.js → index-Bns57FNX.js} +2 -2
  30. package/dist/{index-BZd3wYPr.js → index-BsiUX7YD.js} +2 -2
  31. package/dist/{index-KxrgWfEL.js → index-Bt91J3fW.js} +1 -1
  32. package/dist/{index-xJJRBQFw.js → index-C0Lp1fyE.js} +43115 -36406
  33. package/dist/{index-BCsDTwbK.js → index-CDEmNgZo.js} +1 -1
  34. package/dist/{index-CRIhEnfm.js → index-CE2DJqcE.js} +1 -1
  35. package/dist/{index-Dyfxs8FQ.js → index-CnK65t9M.js} +2 -2
  36. package/dist/{index-CiCgngBb.js → index-CqKBqL3p.js} +2 -2
  37. package/dist/{index-DGODLCja.js → index-Cr-9RN_m.js} +1 -1
  38. package/dist/{index-DJiuJgNx.js → index-Cv7MTDYJ.js} +1 -1
  39. package/dist/{index-CdKmjzHb.js → index-D5VJUAJr.js} +3 -3
  40. package/dist/{index-BuAaPDLl.js → index-DNxZxXFS.js} +2 -2
  41. package/dist/{index-xeRTb7EG.js → index-DoHNHSgR.js} +3 -3
  42. package/dist/{index-B2bvlNJo.js → index-DohyZRFn.js} +2 -2
  43. package/dist/{index-Bh8Vsmje.js → index-Dss87bf6.js} +4 -4
  44. package/dist/{index-DgLLlaiF.js → index-FO_jC7SK.js} +1 -1
  45. package/dist/{index-ZJQMS_Ik.js → index-WFLjE8W5.js} +2 -2
  46. package/dist/{index-BtTM4eCk.js → index-cvcwGAKO.js} +2 -2
  47. package/dist/{index-C4ZaFHIk.js → index-odqvNkhp.js} +3 -3
  48. package/dist/{index-DOmpZ2Vn.js → index-tdchiGpE.js} +2 -2
  49. package/dist/index.es.js +50 -48
  50. package/dist/{online-form-model-select.vue_vue_type_script_setup_true_name_online-form-model-select_lang-CnQiVFDN.js → online-form-model-select.vue_vue_type_script_setup_true_name_online-form-model-select_lang-CpcHJZof.js} +26 -3
  51. package/dist/{pagination-design-BpXq_uV5.js → pagination-design-BQ-Knqog.js} +2 -2
  52. package/dist/paper-widget-design-BJ5NnowZ.js +4 -0
  53. package/dist/{print-runtime-instance-MOb76qZn.js → print-runtime-instance-Bfk83ysG.js} +1 -1
  54. package/dist/{print-snapshot-renderer-oKcwQUgc.js → print-snapshot-renderer-CWDB-YnM.js} +3 -3
  55. package/dist/{qrcode-design-CkkXDXcD.js → qrcode-design-6Lieupwb.js} +1 -1
  56. package/dist/{revo-grid.entry-BZADj2ve.js → revo-grid.entry-teEsaxO_.js} +1 -1
  57. package/dist/{revogr-attribution_7.entry-DbQASE7d.js → revogr-attribution_7.entry-CZUc_246.js} +3 -3
  58. package/dist/{revogr-clipboard_3.entry-BUDhUelS.js → revogr-clipboard_3.entry-25oO7inv.js} +2 -2
  59. package/dist/{revogr-data_4.entry-0V57Lz9p.js → revogr-data_4.entry-BzB9qFPe.js} +2 -2
  60. package/dist/{revogr-filter-panel.entry-BJEYteeW.js → revogr-filter-panel.entry-BGrVTJ1g.js} +1 -1
  61. package/dist/seal-design-DfSdoYe8.js +4 -0
  62. package/dist/{serialnumber-design-BbjW4gnZ.js → serialnumber-design-CXxSkCLn.js} +1 -1
  63. package/dist/shared/index.es.js +29 -28
  64. package/dist/{single-field-drop-DBjHYyMO.js → single-field-drop-GQQ8hg4y.js} +2 -3
  65. package/dist/{size-editor-CcYZKUn5.js → size-editor-CspaebYh.js} +1 -1
  66. package/dist/src/adapter/adapter.d.ts +1 -1
  67. package/dist/src/adapter/index.d.ts +2 -0
  68. package/dist/src/{nocode-web-render/src/render/sub-table/common → adapter/web}/inventory-scan-columns.d.ts +1 -1
  69. package/dist/src/{nocode-web-render/src/render/sub-table/material-balance/mb-web-render.d.ts → adapter/web/material-balance-render.d.ts} +1 -1
  70. package/dist/src/{nocode-web-render/src/render/sub-table/material-balance → adapter/web}/material-consume-modal.vue.d.ts +1 -1
  71. package/dist/src/adapter/web/material-consume-render.d.ts +25 -0
  72. package/dist/src/{nocode-web-render/src/render/common → adapter/web}/open-util.d.ts +1 -1
  73. package/dist/src/{nocode-web-render/src/render/sub-table/stocktake/stocktake-web-render.d.ts → adapter/web/stocktake-render.d.ts} +2 -2
  74. package/dist/src/{nocode-web-render/src/render/sub-table/common → adapter/web}/sub-table-render.d.ts +2 -5
  75. package/dist/src/nocode-base/src/components/document-sub-table-action/dynamic-table-action.vue.d.ts +0 -2
  76. package/dist/src/nocode-base/src/components/document-sub-table-action/sub-table-action.vue.d.ts +0 -3
  77. package/dist/src/nocode-base/src/components/document-sub-table-action/type.d.ts +0 -4
  78. package/dist/src/nocode-base/src/components/material-consume/types.d.ts +1 -5
  79. package/dist/src/nocode-base/src/core/sub-table/sub-table-core.d.ts +0 -4
  80. package/dist/src/nocode-base/src/hooks/material-consume/material-consume-table-controller.d.ts +0 -12
  81. package/dist/src/nocode-base/src/hooks/material-consume/mc-render.d.ts +1 -28
  82. package/dist/src/nocode-base/src/hooks/render-page/initialize-runtime.d.ts +3 -1
  83. package/dist/src/nocode-base/src/hooks/render-page/sterilization-date.d.ts +1 -1
  84. package/dist/src/nocode-base/src/runtime/multi-sheet-runtime.d.ts +3 -1
  85. package/dist/src/nocode-base/src/runtime/runtime-context.d.ts +4 -0
  86. package/dist/src/nocode-base/src/types/render/mc-render.d.ts +2 -15
  87. package/dist/src/nocode-base/src/types/render/sub-table-render.d.ts +0 -10
  88. package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/base-vxe-table.vue.d.ts +1 -1
  89. package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/default-value-rdo-editor.vue.d.ts +4 -4
  90. package/dist/src/online-form/src/views/__cell_widgets__/common/default-value-rdo-editor/rdo-table-dropdown.vue.d.ts +3 -3
  91. package/dist/src/online-form/src/views/__cell_widgets__/common/quick-search-editor/quick-search.util.d.ts +8 -0
  92. package/dist/src/online-form/src/views/designer/hooks/useAllSpreadSheets.d.ts +11 -0
  93. package/dist/src/online-form/src/views/designer/modules/base/designer-wrapper.vue.d.ts +1 -0
  94. package/dist/src/{nocode-web-render/src/components/print-fill-background-selector.vue.d.ts → online-form/src/views/designer/modules/duplicate-field-notice.vue.d.ts} +1 -1
  95. package/dist/src/{nocode-web-render/src/render/parse-rule → online-form/src/views/designer/modules/panel/sub-table/comps}/add-rule-btn.vue.d.ts +1 -1
  96. package/dist/src/online-form/src/views/designer/modules/panel/sub-table/panel-check-table/select-check-ds-modal.vue.d.ts +3 -3
  97. package/dist/src/online-form/src/views/designer/types/sheets.d.ts +2 -0
  98. package/dist/src/online-form/src/views/render/__components__/_field_/_base_/cell/cell-auto-complete.vue.d.ts +2 -2
  99. package/dist/src/online-form/src/views/render/__components__/_field_/_base_/cell/cell-date-picker.vue.d.ts +2 -2
  100. package/dist/src/online-form/src/views/render/__components__/_field_/_base_/cell/cell-text-input.vue.d.ts +2 -2
  101. package/dist/src/online-form/src/views/render/__components__/_field_/_base_/cell/cell-textarea.vue.d.ts +2 -2
  102. package/dist/src/online-form/src/views/render/__components__/_field_/trace/common/base-vxe-table.vue.d.ts +1 -1
  103. package/dist/src/shared/components/ColorPicker/src/ColorPicker.vue.d.ts +1 -1
  104. package/dist/src/{nocode-web-render/src → shared}/hooks/useWebUpload.d.ts +1 -1
  105. package/dist/src/shared/index.d.ts +1 -0
  106. package/dist/src/shared/types/index.d.ts +1 -0
  107. package/dist/src/shared/types/upload.d.ts +11 -0
  108. package/dist/{sub-table-factory-CUn9Ys8U.js → sub-table-factory-BI9zILxh.js} +2 -2
  109. package/dist/{text-design-CJ-LzwEP.js → text-design-C9uisWIi.js} +2 -2
  110. package/dist/{throttle-Cpk1LoGk-BVommE6v.js → throttle-Cpk1LoGk-CAjnQv90.js} +1 -1
  111. package/dist/{timediff-design-DLlIUaqv.js → timediff-design-DeOjrlwW.js} +1 -1
  112. package/dist/{trace-like-wrapper-3MK6tjpN.js → trace-like-wrapper-pQUXH6kC.js} +2 -2
  113. package/dist/{value-editor.vue_vue_type_style_index_0_lang-CmqBS9Ol.js → value-editor.vue_vue_type_style_index_0_lang-LLQsPkbC.js} +2 -2
  114. package/dist/{widget-barcode-BzrOK6u9.js → widget-barcode-DLyneDcq.js} +4 -4
  115. package/dist/{widget-diagonal-DXnNY3TR.js → widget-diagonal-2e5fVQJW.js} +3 -4
  116. package/dist/{widget-image-qlZU5zfL.js → widget-image-BXPMPWOk.js} +5 -7
  117. package/dist/{widget-line-BkFVTPZE.js → widget-line-CjiBmjBZ.js} +2 -2
  118. package/dist/{widget-pagination-BI7Vtnio.js → widget-pagination-DU3VR6Pn.js} +5 -5
  119. package/dist/{widget-power-CQaD6Z_a.js → widget-power-7i7Y46-D.js} +3 -4
  120. package/dist/{widget-qrcode-DNpnyMCx.js → widget-qrcode-DiTI2AJL.js} +3 -3
  121. package/dist/{widget-rangelimit-DE7-MYZD.js → widget-rangelimit-CYrvoR3L.js} +3 -4
  122. package/dist/{widget-serialnumber-CyMnA-nP.js → widget-serialnumber-DwLtEZJ0.js} +1 -1
  123. package/dist/{widget-text-BpZ7YJtP.js → widget-text-1F6QCLEu.js} +5 -5
  124. package/dist/{widget-timediff-DSEwFrr9.js → widget-timediff-CKGLI-LX.js} +2 -2
  125. package/package.json +2 -6
  126. package/dist/AntdIcon-DCIaV352.js +0 -1108
  127. package/dist/index-CFVecFFb.js +0 -4353
  128. package/dist/mb-render-_IUbyYCY.js +0 -276
  129. package/dist/paper-widget-design-CSOyFSja.js +0 -4
  130. package/dist/seal-design-BMrCPheX.js +0 -4
  131. package/dist/src/nocode-web-render/src/hooks/index.d.ts +0 -2
  132. package/dist/src/nocode-web-render/src/hooks/userFormPrint.d.ts +0 -15
  133. package/dist/src/nocode-web-render/src/index.d.ts +0 -6
  134. package/dist/src/nocode-web-render/src/logic/index.d.ts +0 -1
  135. package/dist/src/nocode-web-render/src/render/common/index.d.ts +0 -2
  136. package/dist/src/nocode-web-render/src/render/common/modal-manager.d.ts +0 -20
  137. package/dist/src/nocode-web-render/src/render/index.d.ts +0 -10
  138. package/dist/src/nocode-web-render/src/render/parse-rule/index.d.ts +0 -3
  139. package/dist/src/nocode-web-render/src/render/parse-rule/parse-rule-modal.vue.d.ts +0 -15
  140. package/dist/src/nocode-web-render/src/render/sub-table/allocate/allocate-web-render.d.ts +0 -4
  141. package/dist/src/nocode-web-render/src/render/sub-table/allocate/index.d.ts +0 -1
  142. package/dist/src/nocode-web-render/src/render/sub-table/common/multi-rows-modal.vue.d.ts +0 -15
  143. package/dist/src/nocode-web-render/src/render/sub-table/common/scan-modal.vue.d.ts +0 -19
  144. package/dist/src/nocode-web-render/src/render/sub-table/index.d.ts +0 -3
  145. package/dist/src/nocode-web-render/src/render/sub-table/material-balance/index.d.ts +0 -1
  146. package/dist/src/nocode-web-render/src/render/sub-table/material-consume/bom-modal.vue.d.ts +0 -11
  147. package/dist/src/nocode-web-render/src/render/sub-table/material-consume/index.d.ts +0 -4
  148. package/dist/src/nocode-web-render/src/render/sub-table/material-consume/mc-web-render.d.ts +0 -42
  149. package/dist/src/nocode-web-render/src/render/sub-table/stocktake/index.d.ts +0 -2
  150. package/dist/src/nocode-web-render/src/types/hooks/index.d.ts +0 -1
  151. package/dist/src/nocode-web-render/src/types/index.d.ts +0 -1
  152. package/dist/web-render/index.d.ts +0 -1
  153. package/dist/web-render/index.es.js +0 -596
  154. /package/dist/src/{nocode-web-render/src/adapter/index.d.ts → adapter/web/setup.d.ts} +0 -0
  155. /package/dist/src/{nocode-web-render/src/logic/utils.d.ts → adapter/web/upload.d.ts} +0 -0
@@ -1,11 +1,9 @@
1
- import { reactive, toRaw, computed, watch, onScopeDispose, inject, h, shallowReactive, markRaw, ref, nextTick, toRef, provide, defineComponent, openBlock, createElementBlock, mergeProps, unref, createElementVNode, normalizeClass, renderSlot, createCommentVNode, createVNode, toDisplayString, Fragment, renderList, onUnmounted, isVNode, onMounted, onBeforeMount, resolveComponent, createBlock, withCtx, createTextVNode } from "vue";
2
- import { aj as CellWidgetViewState, F as FIELD_TYPE, bm as RenderModeEnum, Z as FormTypeEnum, bG as BpmnNodeTypeEnum, cz as getFieldPlaceholder, bY as MobileFillTypeEnum, C as ComponentTypeEnum, a0 as PlatformEnum, cA as isReferenceOptionActive, p as api, bw as uuid2, c6 as calcUtils, bk as findRuntimeTableRow, ca as ensureTableRowKeys, c3 as bindRuntimeTableColumns, bj as getRowId, cB as FRONT_ROW_KEY, cp as isTableRowKeyMatch, by as isAttachFieldActive, cC as filterRulesByTrigger, cD as isEmptyValue$1, c7 as decodeTableCellRowKey, c9 as ensureFrontRowKey, b2 as getParseRuleInfo, aH as transformUtils, aZ as materialCheck, a_ as getLotLockedReason, a$ as validateReinspectionDate, bp as FormulaRuleFieldKeyEnum, h as SubTableType, b3 as getParseRuleValue, cE as buildError, I as CreateType, bn as findRuntimeParentRow, aK as Dependency_ENUM, aJ as ASSIGNMENTSTRATEGY_ENUM, bL as commonUtils, aO as DeviceLink, a9 as _export_sfc, cj as getRenderedRuntimeTableCell, A as CellType, ct as relocateDeletedRowsToEnd, cF as resetTableRowIdentity, K as useModal, cG as q, cH as QUICK_FILL_ALLOWED_FIELDS, cI as groupFixedTableRows, cJ as processQuickFillRows, cK as getIsGroupEmpty } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_53d7e66c_lang-8yB6zly8.js";
3
- import { cloneDeep, isEmpty, has, pickBy, isNil, mergeWith, omit, last, pick, merge } from "lodash-es";
1
+ import { reactive, toRaw, computed, watch, onScopeDispose, inject, h, shallowReactive, markRaw, ref, provide, nextTick, toRef, defineComponent, openBlock, createElementBlock, mergeProps, unref, createElementVNode, normalizeClass, renderSlot, createCommentVNode, createVNode, toDisplayString, Fragment, renderList, onUnmounted, isVNode, onMounted, onBeforeMount, resolveComponent, createBlock, withCtx, createTextVNode } from "vue";
2
+ import { al as CellWidgetViewState, F as FIELD_TYPE, bl as RenderModeEnum, a0 as FormTypeEnum, bB as BpmnNodeTypeEnum, cq as getFieldPlaceholder, bR as MobileFillTypeEnum, C as ComponentTypeEnum, bk as findRuntimeTableRow, b0 as renderUtils, a3 as PlatformEnum, p as api, bu as uuid2, b$ as calcUtils, c3 as ensureTableRowKeys, bY as bindRuntimeTableColumns, bj as getRowId, cr as FRONT_ROW_KEY, ci as isTableRowKeyMatch, aA as RangeCompareOp, az as RangeValidateMode, c0 as decodeTableCellRowKey, c2 as ensureFrontRowKey, b7 as getParseRuleInfo, aK as transformUtils, b2 as materialCheck, b3 as getLotLockedReason, b4 as validateReinspectionDate, bo as FormulaRuleFieldKeyEnum, N as CreateType, h as SubTableType, b8 as getParseRuleValue, bm as findRuntimeParentRow, aN as Dependency_ENUM, aM as ASSIGNMENTSTRATEGY_ENUM, bF as commonUtils, aR as DeviceLink, ac as useNamespace, ad as _export_sfc, I as Icon, cc as getRenderedRuntimeTableCell, H as CellType, cs as resetTableRowIdentity, R as useModal, ct as q, cu as QUICK_FILL_ALLOWED_FIELDS, cv as groupFixedTableRows, cw as processQuickFillRows, cx as getIsGroupEmpty } from "./dynamic-table-action.vue_vue_type_style_index_0_scoped_8710052f_lang-DNH0HQ7d.js";
4
3
  import dayjs from "dayjs";
5
- import { a as useNamespace, I as Icon } from "./AntdIcon-DCIaV352.js";
4
+ import { cloneDeep, isEmpty, has, isNil, pickBy, mergeWith, omit, last, pick, merge } from "lodash-es";
6
5
  import "@gct-paas/form-base";
7
6
  import { Modal, message } from "ant-design-vue";
8
- import { u as useFormModel } from "./mb-render-_IUbyYCY.js";
9
7
  var MaterialConsumptionPatternEnum = /* @__PURE__ */ ((MaterialConsumptionPatternEnum2) => {
10
8
  MaterialConsumptionPatternEnum2["RECORD"] = "record";
11
9
  MaterialConsumptionPatternEnum2["BOM"] = "bom";
@@ -772,6 +770,49 @@ function getSubTableQuickFillInfo(subTableFieldId, mobileTdIdGroups) {
772
770
  if (!subTableFieldId) return;
773
771
  return assignWidgetInfo(MobileFillTypeEnum.SUB_TABLE, { rowSubFieldKey: subTableFieldId });
774
772
  }
773
+ function getCurrentFormData(_rule, options) {
774
+ if (!_rule._subtableFieldId) return options?.formData;
775
+ return findRuntimeTableRow(options?.formData?.[_rule._subtableFieldId], _rule._rowKey);
776
+ }
777
+ function isSameOptionValue(current, expected) {
778
+ if (typeof expected === "boolean") {
779
+ return renderUtils.getBoolValue(current) === expected;
780
+ }
781
+ if (current === void 0 || current === null || current === "") {
782
+ return false;
783
+ }
784
+ return String(current) === String(expected);
785
+ }
786
+ function isAttachFieldActive(attach, formData) {
787
+ if (attach?.parent && !isAttachFieldActive(attach.parent, formData)) return false;
788
+ if (!attach?.belongFieldId || isNil(attach.optionValue)) {
789
+ return true;
790
+ }
791
+ const row = attach.subtableFieldId ? findRuntimeTableRow(formData?.[attach.subtableFieldId], attach.rowKey) : formData;
792
+ if (attach.subtableFieldId && (!attach.rowKey || !row || row === formData)) {
793
+ return false;
794
+ }
795
+ const raw = row?.[attach.belongFieldId];
796
+ if (attach.multiple) {
797
+ const current = renderUtils.getValue(raw, true);
798
+ if (!Array.isArray(current)) return false;
799
+ return current.some((v) => isSameOptionValue(v, attach.optionValue));
800
+ }
801
+ return isSameOptionValue(raw, attach.optionValue);
802
+ }
803
+ function isReferenceOptionActive(referenceInfo, rowFormData) {
804
+ if (!referenceInfo?.belongFieldId || isNil(referenceInfo.optionValue)) {
805
+ return true;
806
+ }
807
+ return isAttachFieldActive(
808
+ {
809
+ belongFieldId: referenceInfo.belongFieldId,
810
+ optionValue: referenceInfo.optionValue,
811
+ multiple: referenceInfo.multiple
812
+ },
813
+ rowFormData
814
+ );
815
+ }
775
816
  function fieldChromeStyles(state) {
776
817
  const required4 = state === "required";
777
818
  const disabled = state === "disabled";
@@ -1056,7 +1097,7 @@ function normalizeSheetMetadata(sheet) {
1056
1097
  };
1057
1098
  return { ...sheet, paper, nodes, dataCenter: { [ComponentTypeEnum.PAPER]: paper, ...nodes } };
1058
1099
  }
1059
- function normalizeRuntime(runtime) {
1100
+ function normalizeRuntime(runtime, formType) {
1060
1101
  if (typeof runtime === "string") {
1061
1102
  if (!runtime.trim()) throw new Error("运行时数据不能为空");
1062
1103
  try {
@@ -1067,7 +1108,16 @@ function normalizeRuntime(runtime) {
1067
1108
  }
1068
1109
  assertObject(runtime, "运行时数据格式无效");
1069
1110
  if (runtime.schemaVersion == null || runtime.schemaVersion === 1) {
1070
- const normalized = convertV1Runtime(runtime);
1111
+ const legacyRuntime = formType === FormTypeEnum.FILE && runtime[ComponentTypeEnum.PAPER] == null ? {
1112
+ ...runtime,
1113
+ [ComponentTypeEnum.PAPER]: {
1114
+ id: ComponentTypeEnum.PAPER,
1115
+ component: ComponentTypeEnum.PAPER,
1116
+ props: {},
1117
+ nextIds: []
1118
+ }
1119
+ } : runtime;
1120
+ const normalized = convertV1Runtime(legacyRuntime);
1071
1121
  normalized.sheets.forEach(validateSheetGraph);
1072
1122
  return { ...normalized, sheets: normalized.sheets.map(normalizeSheetMetadata) };
1073
1123
  }
@@ -1204,6 +1254,7 @@ function createRuntimeInstanceContext(options) {
1204
1254
  uniqueId: options.uniqueId,
1205
1255
  instanceId: options.instanceId,
1206
1256
  templateId: options.templateId,
1257
+ formType: options.formType,
1207
1258
  schemaVersion: options.runtime.schemaVersion,
1208
1259
  formConfig: options.runtime.formConfig,
1209
1260
  defaultData: options.defaultData,
@@ -1293,7 +1344,7 @@ class RuntimeSheetService {
1293
1344
  this.calculatingDepth += 1;
1294
1345
  let succeeded = false;
1295
1346
  try {
1296
- const pageData = RuntimeSheetService.calculatePages(sheet.dataCenter, this.formState.state);
1347
+ const pageData = this.context.formType === FormTypeEnum.FILE ? [] : RuntimeSheetService.calculatePages(sheet.dataCenter, this.formState.state);
1297
1348
  this.assertAlive();
1298
1349
  sheet.pageData = pageData;
1299
1350
  sheet.paginationError = void 0;
@@ -2147,7 +2198,7 @@ function format(template) {
2147
2198
  function isNativeStringType(type4) {
2148
2199
  return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
2149
2200
  }
2150
- function isEmptyValue(value, type4) {
2201
+ function isEmptyValue$1(value, type4) {
2151
2202
  if (value === void 0 || value === null) {
2152
2203
  return true;
2153
2204
  }
@@ -2306,7 +2357,7 @@ function deepMerge(target, source) {
2306
2357
  return target;
2307
2358
  }
2308
2359
  var required$1 = function required(rule, value, source, errors, options, type4) {
2309
- if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
2360
+ if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue$1(value, type4 || rule.type))) {
2310
2361
  errors.push(format(options.messages.required, rule.fullField));
2311
2362
  }
2312
2363
  };
@@ -2493,11 +2544,11 @@ var string = function string2(rule, value, callback, source, options) {
2493
2544
  var errors = [];
2494
2545
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2495
2546
  if (validate) {
2496
- if (isEmptyValue(value, "string") && !rule.required) {
2547
+ if (isEmptyValue$1(value, "string") && !rule.required) {
2497
2548
  return callback();
2498
2549
  }
2499
2550
  rules.required(rule, value, source, errors, options, "string");
2500
- if (!isEmptyValue(value, "string")) {
2551
+ if (!isEmptyValue$1(value, "string")) {
2501
2552
  rules.type(rule, value, source, errors, options);
2502
2553
  rules.range(rule, value, source, errors, options);
2503
2554
  rules.pattern(rule, value, source, errors, options);
@@ -2512,7 +2563,7 @@ var method2 = function method3(rule, value, callback, source, options) {
2512
2563
  var errors = [];
2513
2564
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2514
2565
  if (validate) {
2515
- if (isEmptyValue(value) && !rule.required) {
2566
+ if (isEmptyValue$1(value) && !rule.required) {
2516
2567
  return callback();
2517
2568
  }
2518
2569
  rules.required(rule, value, source, errors, options);
@@ -2529,7 +2580,7 @@ var number2 = function number3(rule, value, callback, source, options) {
2529
2580
  if (value === "") {
2530
2581
  value = void 0;
2531
2582
  }
2532
- if (isEmptyValue(value) && !rule.required) {
2583
+ if (isEmptyValue$1(value) && !rule.required) {
2533
2584
  return callback();
2534
2585
  }
2535
2586
  rules.required(rule, value, source, errors, options);
@@ -2544,7 +2595,7 @@ var _boolean = function _boolean2(rule, value, callback, source, options) {
2544
2595
  var errors = [];
2545
2596
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2546
2597
  if (validate) {
2547
- if (isEmptyValue(value) && !rule.required) {
2598
+ if (isEmptyValue$1(value) && !rule.required) {
2548
2599
  return callback();
2549
2600
  }
2550
2601
  rules.required(rule, value, source, errors, options);
@@ -2558,11 +2609,11 @@ var regexp2 = function regexp3(rule, value, callback, source, options) {
2558
2609
  var errors = [];
2559
2610
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2560
2611
  if (validate) {
2561
- if (isEmptyValue(value) && !rule.required) {
2612
+ if (isEmptyValue$1(value) && !rule.required) {
2562
2613
  return callback();
2563
2614
  }
2564
2615
  rules.required(rule, value, source, errors, options);
2565
- if (!isEmptyValue(value)) {
2616
+ if (!isEmptyValue$1(value)) {
2566
2617
  rules.type(rule, value, source, errors, options);
2567
2618
  }
2568
2619
  }
@@ -2572,7 +2623,7 @@ var integer2 = function integer3(rule, value, callback, source, options) {
2572
2623
  var errors = [];
2573
2624
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2574
2625
  if (validate) {
2575
- if (isEmptyValue(value) && !rule.required) {
2626
+ if (isEmptyValue$1(value) && !rule.required) {
2576
2627
  return callback();
2577
2628
  }
2578
2629
  rules.required(rule, value, source, errors, options);
@@ -2587,7 +2638,7 @@ var floatFn = function floatFn2(rule, value, callback, source, options) {
2587
2638
  var errors = [];
2588
2639
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2589
2640
  if (validate) {
2590
- if (isEmptyValue(value) && !rule.required) {
2641
+ if (isEmptyValue$1(value) && !rule.required) {
2591
2642
  return callback();
2592
2643
  }
2593
2644
  rules.required(rule, value, source, errors, options);
@@ -2617,7 +2668,7 @@ var object2 = function object3(rule, value, callback, source, options) {
2617
2668
  var errors = [];
2618
2669
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2619
2670
  if (validate) {
2620
- if (isEmptyValue(value) && !rule.required) {
2671
+ if (isEmptyValue$1(value) && !rule.required) {
2621
2672
  return callback();
2622
2673
  }
2623
2674
  rules.required(rule, value, source, errors, options);
@@ -2632,7 +2683,7 @@ var enumerable2 = function enumerable3(rule, value, callback, source, options) {
2632
2683
  var errors = [];
2633
2684
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2634
2685
  if (validate) {
2635
- if (isEmptyValue(value) && !rule.required) {
2686
+ if (isEmptyValue$1(value) && !rule.required) {
2636
2687
  return callback();
2637
2688
  }
2638
2689
  rules.required(rule, value, source, errors, options);
@@ -2646,11 +2697,11 @@ var pattern2 = function pattern3(rule, value, callback, source, options) {
2646
2697
  var errors = [];
2647
2698
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2648
2699
  if (validate) {
2649
- if (isEmptyValue(value, "string") && !rule.required) {
2700
+ if (isEmptyValue$1(value, "string") && !rule.required) {
2650
2701
  return callback();
2651
2702
  }
2652
2703
  rules.required(rule, value, source, errors, options);
2653
- if (!isEmptyValue(value, "string")) {
2704
+ if (!isEmptyValue$1(value, "string")) {
2654
2705
  rules.pattern(rule, value, source, errors, options);
2655
2706
  }
2656
2707
  }
@@ -2660,11 +2711,11 @@ var date2 = function date3(rule, value, callback, source, options) {
2660
2711
  var errors = [];
2661
2712
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2662
2713
  if (validate) {
2663
- if (isEmptyValue(value, "date") && !rule.required) {
2714
+ if (isEmptyValue$1(value, "date") && !rule.required) {
2664
2715
  return callback();
2665
2716
  }
2666
2717
  rules.required(rule, value, source, errors, options);
2667
- if (!isEmptyValue(value, "date")) {
2718
+ if (!isEmptyValue$1(value, "date")) {
2668
2719
  var dateObject;
2669
2720
  if (value instanceof Date) {
2670
2721
  dateObject = value;
@@ -2690,11 +2741,11 @@ var type2 = function type3(rule, value, callback, source, options) {
2690
2741
  var errors = [];
2691
2742
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2692
2743
  if (validate) {
2693
- if (isEmptyValue(value, ruleType) && !rule.required) {
2744
+ if (isEmptyValue$1(value, ruleType) && !rule.required) {
2694
2745
  return callback();
2695
2746
  }
2696
2747
  rules.required(rule, value, source, errors, options, ruleType);
2697
- if (!isEmptyValue(value, ruleType)) {
2748
+ if (!isEmptyValue$1(value, ruleType)) {
2698
2749
  rules.type(rule, value, source, errors, options);
2699
2750
  }
2700
2751
  }
@@ -2704,7 +2755,7 @@ var any = function any2(rule, value, callback, source, options) {
2704
2755
  var errors = [];
2705
2756
  var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2706
2757
  if (validate) {
2707
- if (isEmptyValue(value) && !rule.required) {
2758
+ if (isEmptyValue$1(value) && !rule.required) {
2708
2759
  return callback();
2709
2760
  }
2710
2761
  rules.required(rule, value, source, errors, options);
@@ -3041,6 +3092,518 @@ Schema.register = function register(type4, validator) {
3041
3092
  Schema.warning = warning;
3042
3093
  Schema.messages = messages;
3043
3094
  Schema.validators = validators;
3095
+ const stampKeys = [
3096
+ "sealId",
3097
+ "sealName",
3098
+ "sealType",
3099
+ "sealImage",
3100
+ "sealUserId",
3101
+ "sealUserName",
3102
+ "sealUserTime"
3103
+ ];
3104
+ function isSealPosition(value) {
3105
+ if (!value || typeof value !== "object") return false;
3106
+ const p = value;
3107
+ return typeof p.sheetId === "string" && !!p.sheetId && Number.isInteger(p.pageIndex) && p.pageIndex >= 0 && Number.isFinite(p.leftMm) && p.leftMm >= 0 && Number.isFinite(p.topMm) && p.topMm >= 0;
3108
+ }
3109
+ function readSealValue(raw, fallback) {
3110
+ let parsed = {};
3111
+ try {
3112
+ const value = typeof raw === "string" ? JSON.parse(raw || "{}") : raw;
3113
+ if (value && typeof value === "object" && !Array.isArray(value)) parsed = value;
3114
+ } catch {
3115
+ }
3116
+ const stamp = Object.fromEntries(
3117
+ stampKeys.map((key) => [key, typeof parsed[key] === "string" ? parsed[key] : ""])
3118
+ );
3119
+ return {
3120
+ ...stamp,
3121
+ sealPosition: { ...isSealPosition(parsed.sealPosition) ? parsed.sealPosition : fallback }
3122
+ };
3123
+ }
3124
+ function isSealStamped(raw) {
3125
+ try {
3126
+ const value = typeof raw === "string" ? JSON.parse(raw || "{}") : raw;
3127
+ return !!value && typeof value.sealId === "string" && !!value.sealId && typeof value.sealImage === "string" && !!value.sealImage;
3128
+ } catch {
3129
+ return false;
3130
+ }
3131
+ }
3132
+ function isValidSealValue(raw) {
3133
+ try {
3134
+ const value = typeof raw === "string" ? JSON.parse(raw || "{}") : raw;
3135
+ return !!value && stampKeys.every((key) => typeof value[key] === "string") && isSealPosition(value.sealPosition) && (stampKeys.every((key) => !value[key]) || stampKeys.every((key) => !!value[key]));
3136
+ } catch {
3137
+ return false;
3138
+ }
3139
+ }
3140
+ function moveSealValue(raw, fallback, position) {
3141
+ return JSON.stringify({ ...readSealValue(raw, fallback), sealPosition: { ...position } });
3142
+ }
3143
+ function stampSealValue(raw, fallback, stamp) {
3144
+ const current = readSealValue(raw, fallback);
3145
+ const next = readSealValue({ ...stamp, sealPosition: current.sealPosition }, fallback);
3146
+ return JSON.stringify(next);
3147
+ }
3148
+ function clearSealValue(raw, fallback) {
3149
+ return JSON.stringify(
3150
+ readSealValue({ sealPosition: readSealValue(raw, fallback).sealPosition }, fallback)
3151
+ );
3152
+ }
3153
+ function normalizeSealDiameter(value) {
3154
+ const diameter = Number(value);
3155
+ return Number.isFinite(diameter) && diameter > 0 ? Math.min(diameter, 200) : 42;
3156
+ }
3157
+ function clampSealPosition(position, widthMm, heightMm, diameterMm) {
3158
+ return {
3159
+ ...position,
3160
+ leftMm: Math.max(0, Math.min(position.leftMm, Math.max(0, widthMm - diameterMm))),
3161
+ topMm: Math.max(0, Math.min(position.topMm, Math.max(0, heightMm - diameterMm)))
3162
+ };
3163
+ }
3164
+ function initializeSealFields(fields, formData) {
3165
+ for (const { props } of fields) {
3166
+ if (!props.field || props.isFieldModel || props.subFieldKey) continue;
3167
+ const raw = formData[props.field];
3168
+ if (raw == null || raw === "") {
3169
+ formData[props.field] = JSON.stringify(readSealValue("", props.sealPosition));
3170
+ continue;
3171
+ }
3172
+ try {
3173
+ const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
3174
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) continue;
3175
+ if (!isSealPosition(parsed.sealPosition)) {
3176
+ formData[props.field] = JSON.stringify({
3177
+ ...parsed,
3178
+ sealPosition: { ...props.sealPosition }
3179
+ });
3180
+ } else if (typeof raw !== "string") {
3181
+ formData[props.field] = JSON.stringify(parsed);
3182
+ }
3183
+ } catch {
3184
+ }
3185
+ }
3186
+ }
3187
+ const { identify, calculate: calculate$1 } = {
3188
+ identify: (expression) => window.NocodeAdapter.utils?.formulaIdentify?.(expression) ?? [],
3189
+ calculate: (expression, data) => window.NocodeAdapter.utils?.formulaCalculate?.(expression, data)
3190
+ };
3191
+ const getFieldDataValue = (parseInfo, formData) => {
3192
+ const getTextValue = (processedKey, value) => {
3193
+ const textValue = value ?? formData?.[processedKey] ?? "";
3194
+ return Array.isArray(textValue) ? textValue.join() : textValue;
3195
+ };
3196
+ const { type: type4, processed, hashValue } = parseInfo;
3197
+ if (type4 === "hash") {
3198
+ const tableData = toRaw(formData?.[hashValue] || []);
3199
+ return tableData.filter((d) => !d.deleted_).map((row) => getTextValue(processed, row?.[processed])).filter((i) => !isNil(i));
3200
+ }
3201
+ return getTextValue(processed, formData?.[processed]);
3202
+ };
3203
+ const parseFormulaVar = (formulaVar) => {
3204
+ const result = {
3205
+ original: formulaVar,
3206
+ type: "",
3207
+ processed: "",
3208
+ hashValue: "",
3209
+ dataType: ""
3210
+ };
3211
+ if (/^\$([^$]+)\$\.(.+)$/.test(formulaVar)) {
3212
+ const match = formulaVar.match(/^\$([^$]+)\$\.(.+)$/);
3213
+ result.type = "hash";
3214
+ result.processed = match[2];
3215
+ result.hashValue = match[1];
3216
+ result.dataType = "globType";
3217
+ } else if (/^_\.(.+)$/.test(formulaVar)) {
3218
+ const match = formulaVar.match(/^_\.(.+)$/);
3219
+ result.type = "underscore";
3220
+ result.processed = match[1];
3221
+ result.dataType = "currentRowType";
3222
+ } else {
3223
+ result.type = "plain";
3224
+ result.processed = formulaVar;
3225
+ result.dataType = "globType";
3226
+ }
3227
+ return result;
3228
+ };
3229
+ const getParseFormulaVarInfos = (expr) => {
3230
+ const rowArgs = expr ? identify(expr) : [];
3231
+ return {
3232
+ rowArgs,
3233
+ parseInfos: rowArgs.map((curr) => parseFormulaVar(curr))
3234
+ };
3235
+ };
3236
+ const calculateFormula = async (expr, formData, instanceFormState) => {
3237
+ const rowArgs = identify(expr);
3238
+ const formulaData = isEmpty(rowArgs) ? {} : rowArgs.reduce((total, curr) => {
3239
+ const parseInfo = parseFormulaVar(curr);
3240
+ total[curr] = getFieldDataValue(
3241
+ parseInfo,
3242
+ parseInfo.dataType === "currentRowType" ? formData : instanceFormState
3243
+ );
3244
+ return total;
3245
+ }, {});
3246
+ return calculate$1(expr, formulaData);
3247
+ };
3248
+ const isEmptyValue = (value) => {
3249
+ return value === void 0 || value === null || typeof value === "string" && value.trim() === "" || Array.isArray(value) && value.length === 0;
3250
+ };
3251
+ const compareByOp = (left, right, op) => {
3252
+ switch (op) {
3253
+ case RangeCompareOp.LT:
3254
+ return left < right;
3255
+ case RangeCompareOp.LE:
3256
+ return left <= right;
3257
+ case RangeCompareOp.GT:
3258
+ return left > right;
3259
+ case RangeCompareOp.GE:
3260
+ default:
3261
+ return left >= right;
3262
+ }
3263
+ };
3264
+ const rangeCompareMessage = (op, val) => {
3265
+ switch (op) {
3266
+ case RangeCompareOp.LT:
3267
+ return $t("sys.fieldValueNotGreaterOrEqual", { val });
3268
+ case RangeCompareOp.LE:
3269
+ return $t("sys.fieldValueNoMoreThan", { val });
3270
+ case RangeCompareOp.GT:
3271
+ return $t("sys.fieldValueNotLessOrEqual", { val });
3272
+ case RangeCompareOp.GE:
3273
+ default:
3274
+ return $t("sys.fieldValueNotLessThan", { val });
3275
+ }
3276
+ };
3277
+ const toUnixTimestamp = (input) => {
3278
+ if (isNil(input) || input === "") return null;
3279
+ const asNumber = typeof input === "number" || typeof input === "string" && /^-?\d+(\.\d+)?$/.test(input.trim());
3280
+ if (asNumber) {
3281
+ const n = Number(input);
3282
+ if (Number.isNaN(n)) return null;
3283
+ const parsed2 = n > 1e12 ? dayjs(n) : dayjs.unix(n);
3284
+ return parsed2.isValid() ? parsed2.unix() : null;
3285
+ }
3286
+ const parsed = dayjs(input);
3287
+ return parsed.isValid() ? parsed.unix() : null;
3288
+ };
3289
+ const buildError = (validatorInfo, message2) => JSON.stringify({ ...validatorInfo, message: message2 });
3290
+ function areValidationCommentsEqual(left, right) {
3291
+ const serialize = (comments) => JSON.stringify(
3292
+ comments,
3293
+ (_key, value) => value && typeof value === "object" && "message" in value ? { ...value, message: value.message } : value
3294
+ );
3295
+ return serialize(left) === serialize(right);
3296
+ }
3297
+ const createRule = (validator, message2, trigger = "change") => ({
3298
+ required: true,
3299
+ validator,
3300
+ message: message2,
3301
+ trigger
3302
+ });
3303
+ function relocateDeletedRowsToEnd(rows = []) {
3304
+ const active = [];
3305
+ const deleted = [];
3306
+ for (const row of rows) {
3307
+ if (row?.deleted_) deleted.push(row);
3308
+ else active.push(row);
3309
+ }
3310
+ return [...active, ...deleted];
3311
+ }
3312
+ function filterRulesByTrigger(rules2, trigger) {
3313
+ return rules2.filter((rule) => {
3314
+ const ruleTrigger = rule.trigger;
3315
+ if (!ruleTrigger) return trigger === "change";
3316
+ if (trigger === "blur") {
3317
+ return ruleTrigger === "blur" || ruleTrigger === "change";
3318
+ }
3319
+ return ruleTrigger === trigger;
3320
+ });
3321
+ }
3322
+ function assembleRules(input) {
3323
+ const { showRequired, fieldType, validatorInfo, props } = input;
3324
+ const {
3325
+ minlength,
3326
+ maxlength,
3327
+ regex,
3328
+ regexHint,
3329
+ validateTrue,
3330
+ validateFalse,
3331
+ enableRangeValidate,
3332
+ maxValidateMode,
3333
+ minValidateMode,
3334
+ maxCompareOp,
3335
+ minCompareOp,
3336
+ minValue,
3337
+ maxValue,
3338
+ minFormulaExpr,
3339
+ maxFormulaExpr,
3340
+ minDate,
3341
+ maxDate,
3342
+ minDateFormulaExpr,
3343
+ maxDateFormulaExpr,
3344
+ maxDateValidateMode,
3345
+ minDateValidateMode
3346
+ } = props;
3347
+ const resolvedMaxCompareOp = maxCompareOp ?? RangeCompareOp.LE;
3348
+ const resolvedMinCompareOp = minCompareOp ?? RangeCompareOp.GE;
3349
+ const RuleProps = [];
3350
+ if (props.bizType === FIELD_TYPE.SEAL) {
3351
+ if (showRequired) {
3352
+ RuleProps.push(
3353
+ createRule(
3354
+ (_rule, value) => isSealStamped(value),
3355
+ buildError(
3356
+ { ...validatorInfo, validationCode: "seal-required" },
3357
+ $t("sys.fieldRequired")
3358
+ ),
3359
+ "manual"
3360
+ )
3361
+ );
3362
+ }
3363
+ RuleProps.push(
3364
+ createRule(
3365
+ (_rule, value) => isEmptyValue(value) || isValidSealValue(value),
3366
+ buildError(validatorInfo, $t("sys.seal.invalid"))
3367
+ )
3368
+ );
3369
+ return RuleProps;
3370
+ }
3371
+ if (showRequired) {
3372
+ RuleProps.push(
3373
+ createRule(
3374
+ (_rule, value) => !isEmptyValue(value),
3375
+ buildError(validatorInfo, $t("sys.fieldRequired")),
3376
+ "manual"
3377
+ )
3378
+ );
3379
+ }
3380
+ if (!isNil(minlength)) {
3381
+ RuleProps.push(
3382
+ createRule((_rule, value) => {
3383
+ if (isEmptyValue(value)) return true;
3384
+ return String(value).length >= minlength;
3385
+ }, buildError(validatorInfo, $t("sys.fieldLengthNotLessThan", { len: minlength })))
3386
+ );
3387
+ }
3388
+ const effectiveMaxlength = isNil(maxlength) && fieldType === FIELD_TYPE.TEXT ? 1024 : maxlength;
3389
+ if (!isNil(effectiveMaxlength)) {
3390
+ RuleProps.push(
3391
+ createRule((_rule, value) => {
3392
+ if (isEmptyValue(value)) return true;
3393
+ return String(value).length <= effectiveMaxlength;
3394
+ }, buildError(validatorInfo, $t("sys.fieldLengthNoMoreThan", { len: effectiveMaxlength })))
3395
+ );
3396
+ }
3397
+ if (regex) {
3398
+ RuleProps.push(
3399
+ createRule((_rule, value) => {
3400
+ if (isEmptyValue(value)) return true;
3401
+ return new RegExp(regex).test(value);
3402
+ }, buildError(validatorInfo, regexHint ?? $t("sys.fieldFormatError")))
3403
+ );
3404
+ }
3405
+ if (validateTrue) {
3406
+ RuleProps.push({
3407
+ required: true,
3408
+ trigger: "manual",
3409
+ validator: (_rule, value) => value === true,
3410
+ message: buildError(validatorInfo, $t("sys.fieldValueNeedTrue"))
3411
+ });
3412
+ }
3413
+ if (validateFalse) {
3414
+ RuleProps.push({
3415
+ required: true,
3416
+ trigger: "manual",
3417
+ validator: (_rule, value) => value === false,
3418
+ message: buildError(validatorInfo, $t("sys.fieldValueNeedFalse"))
3419
+ });
3420
+ }
3421
+ const configuredMinCoversZero = enableRangeValidate && minValidateMode === RangeValidateMode.Fixed_Number && !isEmptyValue(minValue) && Number(minValue) >= 0 && (resolvedMinCompareOp === RangeCompareOp.GE || resolvedMinCompareOp === RangeCompareOp.GT);
3422
+ if (input.defaultMinValue === 0 && !configuredMinCoversZero) {
3423
+ RuleProps.push(
3424
+ createRule(
3425
+ (_rule, value) => isEmptyValue(value) || Number(value) >= 0,
3426
+ buildError(validatorInfo, rangeCompareMessage(RangeCompareOp.GE, 0))
3427
+ )
3428
+ );
3429
+ }
3430
+ if (!enableRangeValidate) {
3431
+ return RuleProps;
3432
+ }
3433
+ if (minValidateMode === RangeValidateMode.Fixed_Number && !isEmptyValue(minValue)) {
3434
+ RuleProps.push(
3435
+ createRule((_rule, value) => {
3436
+ if (isEmptyValue(value)) return true;
3437
+ return compareByOp(Number(value), Number(minValue), resolvedMinCompareOp);
3438
+ }, buildError(validatorInfo, rangeCompareMessage(resolvedMinCompareOp, minValue)))
3439
+ );
3440
+ }
3441
+ if (minValidateMode === RangeValidateMode.Variable_Validate && minFormulaExpr) {
3442
+ RuleProps.push({
3443
+ required: true,
3444
+ trigger: "change",
3445
+ validator: async (_rule, value, _callback, _source, options) => {
3446
+ const currentFormData = getCurrentFormData(_rule, options);
3447
+ const formulaValue = await calculateFormula(
3448
+ minFormulaExpr,
3449
+ currentFormData,
3450
+ options?.formData
3451
+ );
3452
+ if (isEmptyValue(formulaValue)) {
3453
+ return Promise.resolve();
3454
+ }
3455
+ const parsedMin = parseFloat(formulaValue);
3456
+ if (!isNaN(parsedMin)) {
3457
+ if (isEmptyValue(value)) {
3458
+ return Promise.resolve();
3459
+ }
3460
+ if (!compareByOp(Number(value), parsedMin, resolvedMinCompareOp)) {
3461
+ return Promise.reject(
3462
+ new Error(
3463
+ buildError(validatorInfo, rangeCompareMessage(resolvedMinCompareOp, parsedMin))
3464
+ )
3465
+ );
3466
+ }
3467
+ }
3468
+ return Promise.resolve();
3469
+ }
3470
+ });
3471
+ }
3472
+ if (maxValidateMode === RangeValidateMode.Fixed_Number && !isEmptyValue(maxValue)) {
3473
+ RuleProps.push(
3474
+ createRule((_rule, value) => {
3475
+ if (isEmptyValue(value)) return true;
3476
+ return compareByOp(Number(value), Number(maxValue), resolvedMaxCompareOp);
3477
+ }, buildError(validatorInfo, rangeCompareMessage(resolvedMaxCompareOp, maxValue)))
3478
+ );
3479
+ }
3480
+ if (maxValidateMode === RangeValidateMode.Variable_Validate && maxFormulaExpr) {
3481
+ RuleProps.push({
3482
+ required: true,
3483
+ trigger: "change",
3484
+ validator: async (_rule, value, _callback, _source, options) => {
3485
+ const currentFormData = getCurrentFormData(_rule, options);
3486
+ const formulaValue = await calculateFormula(
3487
+ maxFormulaExpr,
3488
+ currentFormData,
3489
+ options?.formData
3490
+ );
3491
+ if (isEmptyValue(formulaValue)) {
3492
+ return Promise.resolve();
3493
+ }
3494
+ const parsedMax = parseFloat(formulaValue);
3495
+ if (!isNaN(parsedMax)) {
3496
+ if (isEmptyValue(value)) {
3497
+ return Promise.resolve();
3498
+ }
3499
+ if (!compareByOp(Number(value), parsedMax, resolvedMaxCompareOp)) {
3500
+ return Promise.reject(
3501
+ new Error(
3502
+ buildError(validatorInfo, rangeCompareMessage(resolvedMaxCompareOp, parsedMax))
3503
+ )
3504
+ );
3505
+ }
3506
+ }
3507
+ return Promise.resolve();
3508
+ }
3509
+ });
3510
+ }
3511
+ if (minDateValidateMode === RangeValidateMode.Fixed_Number && minDate) {
3512
+ RuleProps.push(
3513
+ createRule((_rule, value) => {
3514
+ if (isEmptyValue(value)) return true;
3515
+ const inputTime = dayjs(value).unix();
3516
+ const minTimestamp = dayjs(minDate).unix();
3517
+ if (!dayjs(value).isValid() || !dayjs(minDate).isValid()) return true;
3518
+ return compareByOp(inputTime, minTimestamp, resolvedMinCompareOp);
3519
+ }, buildError(validatorInfo, rangeCompareMessage(resolvedMinCompareOp, minDate)))
3520
+ );
3521
+ }
3522
+ if (maxDateValidateMode === RangeValidateMode.Fixed_Number && maxDate) {
3523
+ RuleProps.push(
3524
+ createRule((_rule, value) => {
3525
+ if (isEmptyValue(value)) return true;
3526
+ const inputTime = dayjs(value).unix();
3527
+ const maxTimestamp = dayjs(maxDate).unix();
3528
+ if (!dayjs(value).isValid() || !dayjs(maxDate).isValid()) return true;
3529
+ return compareByOp(inputTime, maxTimestamp, resolvedMaxCompareOp);
3530
+ }, buildError(validatorInfo, rangeCompareMessage(resolvedMaxCompareOp, maxDate)))
3531
+ );
3532
+ }
3533
+ if (minDateValidateMode === RangeValidateMode.Variable_Validate && minDateFormulaExpr) {
3534
+ RuleProps.push({
3535
+ required: true,
3536
+ trigger: "change",
3537
+ validator: async (_rule, value, _callback, _source, options) => {
3538
+ const currentFormData = getCurrentFormData(_rule, options);
3539
+ const formulaValue = await calculateFormula(
3540
+ minDateFormulaExpr,
3541
+ currentFormData,
3542
+ options?.formData
3543
+ );
3544
+ const limitTime = toUnixTimestamp(formulaValue);
3545
+ if (limitTime !== null) {
3546
+ if (isEmptyValue(value)) {
3547
+ return Promise.resolve();
3548
+ }
3549
+ if (!dayjs(value).isValid()) {
3550
+ return Promise.resolve();
3551
+ }
3552
+ const inputTime = dayjs(value).unix();
3553
+ const fmt = fieldType === FIELD_TYPE.DATE_TIME ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
3554
+ if (!compareByOp(inputTime, limitTime, resolvedMinCompareOp)) {
3555
+ return Promise.reject(
3556
+ new Error(
3557
+ buildError(
3558
+ validatorInfo,
3559
+ rangeCompareMessage(resolvedMinCompareOp, dayjs.unix(limitTime).format(fmt))
3560
+ )
3561
+ )
3562
+ );
3563
+ }
3564
+ }
3565
+ return Promise.resolve();
3566
+ }
3567
+ });
3568
+ }
3569
+ if (maxDateValidateMode === RangeValidateMode.Variable_Validate && maxDateFormulaExpr) {
3570
+ RuleProps.push({
3571
+ required: true,
3572
+ trigger: "change",
3573
+ validator: async (_rule, value, _callback, _source, options) => {
3574
+ const currentFormData = getCurrentFormData(_rule, options);
3575
+ const formulaValue = await calculateFormula(
3576
+ maxDateFormulaExpr,
3577
+ currentFormData,
3578
+ options?.formData
3579
+ );
3580
+ const limitTime = toUnixTimestamp(formulaValue);
3581
+ if (limitTime !== null) {
3582
+ if (isEmptyValue(value)) {
3583
+ return Promise.resolve();
3584
+ }
3585
+ if (!dayjs(value).isValid()) {
3586
+ return Promise.resolve();
3587
+ }
3588
+ const inputTime = dayjs(value).unix();
3589
+ const fmt = fieldType === FIELD_TYPE.DATE_TIME ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
3590
+ if (!compareByOp(inputTime, limitTime, resolvedMaxCompareOp)) {
3591
+ return Promise.reject(
3592
+ new Error(
3593
+ buildError(
3594
+ validatorInfo,
3595
+ rangeCompareMessage(resolvedMaxCompareOp, dayjs.unix(limitTime).format(fmt))
3596
+ )
3597
+ )
3598
+ );
3599
+ }
3600
+ }
3601
+ return Promise.resolve();
3602
+ }
3603
+ });
3604
+ }
3605
+ return RuleProps;
3606
+ }
3044
3607
  function resolveKeepExceptionHighlight(formValue, fieldValue) {
3045
3608
  if (typeof fieldValue === "boolean") {
3046
3609
  return fieldValue;
@@ -3166,7 +3729,7 @@ function clearResolvedManualErrors(map, resolvePayload) {
3166
3729
  if (!payload) continue;
3167
3730
  const hasManual = filterRulesByTrigger(payload.rules, "manual").length > 0;
3168
3731
  const hasLive = filterRulesByTrigger(payload.rules, "change").length > 0;
3169
- if (hasManual && !hasLive && !isEmptyValue$1(payload.value)) {
3732
+ if (hasManual && !hasLive && !isEmptyValue(payload.value)) {
3170
3733
  delete next[path];
3171
3734
  }
3172
3735
  }
@@ -3180,7 +3743,7 @@ function mergeLiveValidation(current, liveResult, livePaths, resolvePayload) {
3180
3743
  continue;
3181
3744
  }
3182
3745
  const payload = resolvePayload(path);
3183
- const keepManualComment = !!payload && filterRulesByTrigger(payload.rules, "manual").length > 0 && isEmptyValue$1(payload.value) && !!base[path]?.length;
3746
+ const keepManualComment = !!payload && filterRulesByTrigger(payload.rules, "manual").length > 0 && isEmptyValue(payload.value) && !!base[path]?.length;
3184
3747
  if (!keepManualComment) {
3185
3748
  delete base[path];
3186
3749
  }
@@ -3223,7 +3786,7 @@ function mergeDisplayValidation(current, displayResult, ruleKeys, validatedPaths
3223
3786
  next[path] = displayResult[path];
3224
3787
  } else {
3225
3788
  const payload = resolvePayload(path);
3226
- const keepManualComment = !!payload && filterRulesByTrigger(payload.rules, "manual").length > 0 && isEmptyValue$1(payload.value) && !!next[path]?.length;
3789
+ const keepManualComment = !!payload && filterRulesByTrigger(payload.rules, "manual").length > 0 && isEmptyValue(payload.value) && !!next[path]?.length;
3227
3790
  if (!keepManualComment) delete next[path];
3228
3791
  }
3229
3792
  }
@@ -5364,8 +5927,6 @@ class MaterialConsumeTableController {
5364
5927
  dataStatus;
5365
5928
  /** factory 是否已绑定过运行时(避免重复 initTableData) */
5366
5929
  runtimeBound = false;
5367
- /** 多 Sheet / 同屏多实例下,弹层和异步交互使用该键隔离。 */
5368
- runtimeOwnerId = "";
5369
5930
  /** 表单是否已暂存或提交(已处理过则不再跑初始化) */
5370
5931
  get isDataProcessed() {
5371
5932
  return ["STASH", "SUBMIT"].includes(this.dataStatus ?? "");
@@ -5473,21 +6034,6 @@ class MaterialConsumeTableController {
5473
6034
  this.scanRuleProps = toParseRuleConfig(id);
5474
6035
  this.scanRuleInfo = await getParseRuleInfo({ id: this.scanRuleProps.parsingRuleId });
5475
6036
  }
5476
- /**
5477
- * 变更条码规则
5478
- */
5479
- async changeScanRule() {
5480
- const { id_, base_id_ } = this.scanRuleInfo ?? {};
5481
- const newConfig = await MaterialConsumeTableController.render.openChangeRuleModal({
5482
- config: this.scanRuleProps,
5483
- subModelKey: this.widget.props.modelKey,
5484
- formModelController: this.formModelController
5485
- });
5486
- if (newConfig) {
5487
- this.scanRuleProps = newConfig;
5488
- this.scanRuleInfo = await getParseRuleInfo({ id: this.scanRuleProps.parsingRuleId });
5489
- }
5490
- }
5491
6037
  /**
5492
6038
  * 是否人为指定物料
5493
6039
  * @readonly
@@ -5754,29 +6300,12 @@ class MaterialConsumeTableController {
5754
6300
  });
5755
6301
  this.isScanOpen = false;
5756
6302
  }
5757
- /**
5758
- * 打开扫描弹窗
5759
- * @param opts
5760
- */
5761
- async openBomModal() {
5762
- if (!this.actualBomEntries) {
5763
- return;
5764
- }
5765
- await MaterialConsumeTableController.render?.openBomModal({
5766
- ownerId: this.runtimeOwnerId,
5767
- bomList: this.actualBomEntries,
5768
- onSubstitute: async () => {
5769
- console.log("一键导入数据逻辑");
5770
- }
5771
- });
5772
- }
5773
6303
  /**
5774
6304
  * 表单加载时由 factory 调用:绑定稳定数据源并初始化行数据。
5775
6305
  * 不在分页组件 setup 中调用,避免跨页挂载重复 init。
5776
6306
  */
5777
6307
  bindRuntime(opts) {
5778
6308
  this.tableDataRef = opts.tableDataRef;
5779
- this.runtimeOwnerId = opts.ownerId;
5780
6309
  this.mainFormState = opts.mainFormState ?? ref({});
5781
6310
  this.dataStatus = opts.dataStatus;
5782
6311
  if (this.runtimeBound) return;
@@ -6178,6 +6707,31 @@ class MaterialConsumeTableController {
6178
6707
  await this.applyUnitConversionRules(row);
6179
6708
  }
6180
6709
  }
6710
+ class MCRender {
6711
+ /**
6712
+ * 提示信息
6713
+ * @param opts
6714
+ */
6715
+ message(opts) {
6716
+ throw new Error("Function message not implemented.");
6717
+ }
6718
+ async openScanModal(opts) {
6719
+ throw new Error("Function openScanModal not implemented.");
6720
+ }
6721
+ /**
6722
+ * 扫码返回多条候选时,弹窗选择其中一条
6723
+ * 取消返回 undefined
6724
+ */
6725
+ async openMultiRowsModal(opts) {
6726
+ throw new Error("Function openMultiRowsModal not implemented.");
6727
+ }
6728
+ /**
6729
+ * 关闭当前页面的 form-base 弹层
6730
+ */
6731
+ destroyAllModals(_ownerId) {
6732
+ throw new Error("Function destroyAllModals not implemented.");
6733
+ }
6734
+ }
6181
6735
  var SubTableActionEnum = /* @__PURE__ */ ((SubTableActionEnum2) => {
6182
6736
  SubTableActionEnum2["QuickFillRowCurrent"] = "quickFillRowCurrent";
6183
6737
  SubTableActionEnum2["InsertRowBefore"] = "insertRowBefore";
@@ -6189,8 +6743,6 @@ var SubTableActionEnum = /* @__PURE__ */ ((SubTableActionEnum2) => {
6189
6743
  SubTableActionEnum2["ClearRowCurrent"] = "clearRowCurrent";
6190
6744
  SubTableActionEnum2["CONFIRM"] = "CONFIRM";
6191
6745
  SubTableActionEnum2["SCAN"] = "SCAN";
6192
- SubTableActionEnum2["VIEW_BOM"] = "VIEW_BOM";
6193
- SubTableActionEnum2["CHANGE_PARSE_RULE"] = "CHANGE_PARSE_RULE";
6194
6746
  SubTableActionEnum2["RowEdit"] = "rowEdit";
6195
6747
  SubTableActionEnum2["Insert1GroupAfter"] = "insert1GroupAfter";
6196
6748
  return SubTableActionEnum2;
@@ -6210,18 +6762,6 @@ function getMenuByAction(type4) {
6210
6762
  label: "条码扫描",
6211
6763
  icon: "size24 icon-saoma1"
6212
6764
  },
6213
- [SubTableActionEnum.VIEW_BOM]: {
6214
- type: SubTableActionMenuTypeEnum.ACTION,
6215
- key: SubTableActionEnum.VIEW_BOM,
6216
- label: "BOM查看",
6217
- icon: "size24 icon-a-bom11"
6218
- },
6219
- [SubTableActionEnum.CHANGE_PARSE_RULE]: {
6220
- type: SubTableActionMenuTypeEnum.ACTION,
6221
- key: SubTableActionEnum.CHANGE_PARSE_RULE,
6222
- label: "条码解析规则变更",
6223
- icon: "icon-tiaomajiexi"
6224
- },
6225
6765
  [SubTableActionEnum.QuickFillRowCurrent]: {
6226
6766
  type: SubTableActionMenuTypeEnum.ACTION,
6227
6767
  key: SubTableActionEnum.QuickFillRowCurrent,
@@ -6405,6 +6945,204 @@ class TdHandler {
6405
6945
  this.mergeTd({ cellWidget: { props: { newSpecificConfig: { customLoader } } } });
6406
6946
  }
6407
6947
  }
6948
+ class BaseFormModelFetcher {
6949
+ /** 默认接口 */
6950
+ apis = {
6951
+ getFieldMetaList: api.apaas.fieldMeta.getList,
6952
+ getModelMetaSubModelList: api.apaas.modelComprehensive.getSubModelList,
6953
+ getModelDetail2FieldList: api.apaas.modelMeta.getDetail
6954
+ };
6955
+ /**
6956
+ * 模型映射缓存
6957
+ */
6958
+ modelMetaMap = {};
6959
+ async load(opts) {
6960
+ const { model } = opts;
6961
+ this.modelMetaMap = {};
6962
+ await this.loadModelFields(model);
6963
+ await this.loadSubModelsFields(model);
6964
+ return Object.values(this.modelMetaMap);
6965
+ }
6966
+ /**
6967
+ * 补全字段信息
6968
+ * @param modelKey 字段所属的模型
6969
+ * @param [fields=[]]
6970
+ * @return {*}
6971
+ */
6972
+ completeFields(modelKey, fields = []) {
6973
+ return fields.map((field) => {
6974
+ if (!field.modelKey) {
6975
+ field.modelKey = modelKey;
6976
+ }
6977
+ return field;
6978
+ });
6979
+ }
6980
+ /**
6981
+ * 根据模型key加载模型字段
6982
+ *
6983
+ * @param [modelKey=this.model]
6984
+ * @return {*}
6985
+ */
6986
+ async loadModelFields(modelKey) {
6987
+ if (typeof this.apis.getFieldMetaList !== "function") {
6988
+ return;
6989
+ }
6990
+ const res = await this.apis.getFieldMetaList({
6991
+ modelKey
6992
+ });
6993
+ this.modelMetaMap[modelKey] = {
6994
+ key: modelKey,
6995
+ name: "",
6996
+ fields: this.completeFields(modelKey, res)
6997
+ };
6998
+ return res;
6999
+ }
7000
+ /**
7001
+ * 加载表单所有子表字段对应模型的字段信息集合
7002
+ */
7003
+ async loadSubModelsFields(modelKey) {
7004
+ const res = await this.apis.getModelMetaSubModelList({
7005
+ modelKey
7006
+ });
7007
+ (res ?? []).forEach((m) => {
7008
+ if (!this.modelMetaMap[m.key]) {
7009
+ this.modelMetaMap[m.key] = {
7010
+ key: m.key,
7011
+ name: m.name,
7012
+ subModel: m.subModel,
7013
+ fields: this.completeFields(m.key, m.fieldMetaList)
7014
+ };
7015
+ }
7016
+ });
7017
+ }
7018
+ }
7019
+ class FormModelController {
7020
+ /** 主模型的key */
7021
+ masterModelKey;
7022
+ /** 主模型的名称 */
7023
+ masterModelName;
7024
+ /** 模型请求器 */
7025
+ fetcher = new BaseFormModelFetcher();
7026
+ /** 模型映射缓存 */
7027
+ modelMetaMap = reactive({});
7028
+ /** 主模型信息 */
7029
+ get masterModel() {
7030
+ return this.modelMetaMap[this.masterModelKey];
7031
+ }
7032
+ /** 获取主模型字段集合 */
7033
+ get masterFields() {
7034
+ return this.masterModel?.fields;
7035
+ }
7036
+ /** 获取子模型 */
7037
+ getSubModel(subModelKey) {
7038
+ return this.modelMetaMap[subModelKey];
7039
+ }
7040
+ /** 获取子模型字段集合 */
7041
+ getSubModelFields(subModelKey) {
7042
+ return this.getSubModel(subModelKey)?.fields;
7043
+ }
7044
+ /**
7045
+ * 表单字段下拉选项(排除系统字段和子表字段)
7046
+ * value 格式为 modelKey.fieldKey,与字段映射存储格式一致
7047
+ */
7048
+ getFormFieldOptions(subModelKey) {
7049
+ const fields = subModelKey ? this.getSubModelFields(subModelKey) : this.masterModel?.fields;
7050
+ return (fields ?? []).filter(
7051
+ (field) => !this.isSystemField(field) && !this.isSubField(field) && !this.isObjectField(field)
7052
+ ).map((field) => ({
7053
+ ...field,
7054
+ label: `${field.name}`,
7055
+ value: `${field.modelKey}.${field.key}`
7056
+ }));
7057
+ }
7058
+ /**
7059
+ * 初始化
7060
+ *
7061
+ * @param opts
7062
+ * - model 主模型key
7063
+ * - name 主模型名称
7064
+ */
7065
+ async init(opts) {
7066
+ this.masterModelKey = opts.model;
7067
+ this.masterModelName = opts.name;
7068
+ await this.load();
7069
+ }
7070
+ /** 刷新数据 */
7071
+ async refresh() {
7072
+ await this.load();
7073
+ }
7074
+ /**
7075
+ * 加载数据并填充到modelMetaMap中
7076
+ * @protected
7077
+ * @return {*}
7078
+ */
7079
+ async load() {
7080
+ if (!this.masterModelKey) {
7081
+ console.error("缺少主模型的key");
7082
+ return;
7083
+ }
7084
+ const models = await this.fetcher.load({ model: this.masterModelKey });
7085
+ this.modelMetaMap = models.reduce((acc, cur) => {
7086
+ acc[cur.key] = cur;
7087
+ if (cur.key === this.masterModelKey) {
7088
+ cur.name = this.masterModelName;
7089
+ }
7090
+ return acc;
7091
+ }, {});
7092
+ }
7093
+ /** 是否是子模型字段 */
7094
+ isSubField(field) {
7095
+ return field.type === FIELD_TYPE.MASTERSLAVE && field.bindInfo;
7096
+ }
7097
+ /** 是否是预置字段,包括系统字段和业务内置字段 */
7098
+ isPresetField(field) {
7099
+ return [CreateType.BUILTIN, CreateType.SYSTEM].includes(field.createType);
7100
+ }
7101
+ /** 是否是系统字段 */
7102
+ isSystemField(field) {
7103
+ return field.createType === CreateType.SYSTEM;
7104
+ }
7105
+ /** 是否是对象字段类型 */
7106
+ isObjectField(field) {
7107
+ return field.type === FIELD_TYPE.OBJECT_TYPE;
7108
+ }
7109
+ /**
7110
+ * 获取主模型里子表字段对应的子模型key
7111
+ *
7112
+ * @param fieldKey 子表字段在主表里的字段key
7113
+ * @return {*}
7114
+ */
7115
+ getSubFieldModelKey(fieldKey) {
7116
+ return this.masterFields.find((field) => field.key === fieldKey)?.bindInfo;
7117
+ }
7118
+ /**
7119
+ * 获取字段信息
7120
+ * @param [modelKey=this.masterModelKey] 模型key
7121
+ * @param fieldKey 字段key
7122
+ * @return {*}
7123
+ */
7124
+ findField(modelKey = this.masterModelKey, fieldKey) {
7125
+ const model = this.modelMetaMap[modelKey];
7126
+ if (!model) {
7127
+ return;
7128
+ }
7129
+ return model.fields.find((field) => field.key === fieldKey);
7130
+ }
7131
+ }
7132
+ const FormModelControllerKey = "GctFormModelController";
7133
+ function useFormModel() {
7134
+ function provideController(c = new FormModelController()) {
7135
+ provide(FormModelControllerKey, c);
7136
+ return c;
7137
+ }
7138
+ function injectController() {
7139
+ return inject(FormModelControllerKey);
7140
+ }
7141
+ return {
7142
+ provideController,
7143
+ injectController
7144
+ };
7145
+ }
6408
7146
  const SCAN_ROW_META_KEYS = /* @__PURE__ */ new Set([FRONT_ROW_KEY, "id_", "id", "group_", "deleted_", "delete_"]);
6409
7147
  function hasRowId(row) {
6410
7148
  const id = row.id_ ?? row.id;
@@ -6638,8 +7376,6 @@ class SubTableCore {
6638
7376
  const { actionKey } = params;
6639
7377
  if (actionKey === SubTableActionEnum.SCAN) {
6640
7378
  this.openScanModal();
6641
- } else if (actionKey === SubTableActionEnum.CHANGE_PARSE_RULE) {
6642
- this.changeScanRule();
6643
7379
  }
6644
7380
  }
6645
7381
  /**
@@ -6741,20 +7477,6 @@ class SubTableCore {
6741
7477
  scanRuleInfo;
6742
7478
  /** 解析规则配置对象 */
6743
7479
  scanRuleProps;
6744
- /**
6745
- * 变更条码规则
6746
- */
6747
- async changeScanRule() {
6748
- const newConfig = await this.render.openChangeRuleModal({
6749
- config: this.scanRuleProps,
6750
- subModelKey: this.subModelKey,
6751
- formModelController: this.formModelController
6752
- });
6753
- if (newConfig) {
6754
- this.scanRuleProps = newConfig;
6755
- this.scanRuleInfo = await getParseRuleInfo({ id: newConfig.parsingRuleId });
6756
- }
6757
- }
6758
7480
  /**
6759
7481
  * 打开扫描弹窗
6760
7482
  * @param opts
@@ -8028,6 +8750,15 @@ async function applyConsumeObjectTraceChange(opts) {
8028
8750
  }
8029
8751
  return {};
8030
8752
  }
8753
+ class MBRender {
8754
+ // 多 Sheet / 同屏场景用 ownerId 隔离实例;基类仅声明宿主需要实现的能力。
8755
+ async openConsumeModal(_ownerId, _data) {
8756
+ throw new Error("Function openConsumeModal not implemented.");
8757
+ }
8758
+ destoryConsumeModal(_ownerId) {
8759
+ throw new Error("Function destoryConsumeModal not implemented.");
8760
+ }
8761
+ }
8031
8762
  const _hoisted_1$5 = ["data-merge", "data-fill-direction"];
8032
8763
  const _hoisted_2$1 = {
8033
8764
  key: 0,
@@ -8849,8 +9580,6 @@ function waitDomStable(el, idle = 100, timeout = 2e3) {
8849
9580
  var MaterialConsumeActionType = /* @__PURE__ */ ((MaterialConsumeActionType2) => {
8850
9581
  MaterialConsumeActionType2["CONFIRM"] = "CONFIRM";
8851
9582
  MaterialConsumeActionType2["SCAN"] = "SCAN";
8852
- MaterialConsumeActionType2["VIEW_BOM"] = "VIEW_BOM";
8853
- MaterialConsumeActionType2["CHANGE_PARSE_RULE"] = "CHANGE_PARSE_RULE";
8854
9583
  return MaterialConsumeActionType2;
8855
9584
  })(MaterialConsumeActionType || {});
8856
9585
  const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
@@ -9101,12 +9830,6 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
9101
9830
  title: props.widget.props.tableTitle
9102
9831
  });
9103
9832
  break;
9104
- case MaterialConsumeActionType.VIEW_BOM:
9105
- tableController.openBomModal();
9106
- break;
9107
- case MaterialConsumeActionType.CHANGE_PARSE_RULE:
9108
- tableController.changeScanRule();
9109
- break;
9110
9833
  }
9111
9834
  };
9112
9835
  const getNewTdInfo = (tdInfo, rowData, rowIndex) => {
@@ -9284,10 +10007,6 @@ const MaterialConsumeTable = /* @__PURE__ */ defineComponent({
9284
10007
  label: "业务操作"
9285
10008
  },
9286
10009
  showScanBtn ? getMenuByAction(SubTableActionEnum.SCAN) : void 0,
9287
- // tableController.actualBomEntries?.length
9288
- // ? getMenuByAction(SubTableActionEnum.VIEW_BOM)
9289
- // : undefined,
9290
- // getMenuByAction(SubTableActionEnum.CHANGE_PARSE_RULE),
9291
10010
  {
9292
10011
  type: SubTableActionMenuTypeEnum.DIVIDER
9293
10012
  },
@@ -9573,7 +10292,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9573
10292
  showInsertMultiple: { type: Boolean, default: false },
9574
10293
  showEditBtn: { type: Boolean, default: false },
9575
10294
  isMaterialConsume: { type: Boolean, default: false },
9576
- showBom: { type: Boolean, default: false },
9577
10295
  showScanBtn: { type: Boolean, default: false },
9578
10296
  showConfirmBtn: { type: Boolean, default: false },
9579
10297
  noPopover: { type: Boolean, default: false },
@@ -9597,19 +10315,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9597
10315
  label: "条码扫描",
9598
10316
  icon: "size24 icon-saoma1"
9599
10317
  },
9600
- {
9601
- show: props.showBom,
9602
- type: "action",
9603
- key: SubTableActionEnum.VIEW_BOM,
9604
- label: "BOM查看",
9605
- icon: "size24 icon-a-bom11"
9606
- },
9607
- {
9608
- type: "action",
9609
- key: SubTableActionEnum.CHANGE_PARSE_RULE,
9610
- label: "条码解析规则变更",
9611
- icon: "icon-tiaomajiexi"
9612
- },
9613
10318
  {
9614
10319
  type: "divider"
9615
10320
  },
@@ -9836,7 +10541,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9836
10541
  };
9837
10542
  }
9838
10543
  });
9839
- const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-acff8196"]]);
10544
+ const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-7047f1a3"]]);
9840
10545
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
9841
10546
  __name: "fixed-table-action",
9842
10547
  props: {
@@ -10366,7 +11071,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10366
11071
  showInsertMultiple: { type: Boolean, default: true },
10367
11072
  showEditBtn: { type: Boolean },
10368
11073
  isMaterialConsume: { type: Boolean },
10369
- showBom: { type: Boolean },
10370
11074
  showScanBtn: { type: Boolean },
10371
11075
  showConfirmBtn: { type: Boolean },
10372
11076
  noPopover: { type: Boolean },
@@ -10423,7 +11127,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10423
11127
  showDelBtn: __props.showDelBtn,
10424
11128
  showQuickFillBtn: __props.showQuickFillBtn,
10425
11129
  noPopover: __props.noPopover,
10426
- showBom: __props.showBom,
10427
11130
  showConfirmBtn: __props.showConfirmBtn,
10428
11131
  showEditBtn: __props.showEditBtn,
10429
11132
  showInsertMultiple: __props.showInsertMultiple,
@@ -10431,123 +11134,143 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10431
11134
  isMaterialConsume: __props.isMaterialConsume,
10432
11135
  menus: __props.menus,
10433
11136
  onMenuClick
10434
- }, null, 8, ["showDelBtn", "showQuickFillBtn", "noPopover", "showBom", "showConfirmBtn", "showEditBtn", "showInsertMultiple", "showScanBtn", "isMaterialConsume", "menus"]);
11137
+ }, null, 8, ["showDelBtn", "showQuickFillBtn", "noPopover", "showConfirmBtn", "showEditBtn", "showInsertMultiple", "showScanBtn", "isMaterialConsume", "menus"]);
10435
11138
  };
10436
11139
  }
10437
11140
  });
10438
- const DynamicTableAction = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-53d7e66c"]]);
11141
+ const DynamicTableAction = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8710052f"]]);
10439
11142
  export {
10440
- setFormulaParamsConfig as $,
10441
- getObjectBomProductQuery as A,
11143
+ RequiredQtyCalcRule as $,
11144
+ resolveObjectBomEntry as A,
10442
11145
  BorderTD as B,
10443
- normalizeHistoricalAutofillRow as C,
11146
+ runWithFillProduct as C,
10444
11147
  DEFAULT_BOOLEAN_FIELD_WIDTH as D,
10445
- EMPTY_PRODUCT_VERSION_ID as E,
10446
- parseRuntimeFieldPath as F,
10447
- useStyles as G,
10448
- useDependency as H,
10449
- useFieldPresentation as I,
10450
- useRuntimeEditorFlusher as J,
10451
- createRuntimeInstanceContext as K,
10452
- RuntimeInstanceRegistry as L,
11148
+ useNocodeFormWidget as E,
11149
+ FormModelController as F,
11150
+ applyConsumeObjectTraceChange as G,
11151
+ getObjectBomProductQuery as H,
11152
+ EMPTY_PRODUCT_VERSION_ID as I,
11153
+ normalizeHistoricalAutofillRow as J,
11154
+ readSealValue as K,
11155
+ isSealStamped as L,
10453
11156
  MAX_RUNTIME_SHEETS as M,
10454
- NCB_PROVIDE as N,
10455
- RequiredQtyCalcRule as O,
10456
- DocumentPaper as P,
10457
- DynamicTableAction as Q,
10458
- RuntimeFormStateStore as R,
10459
- ScanParamType as S,
10460
- getRuntimeDataFieldId as T,
10461
- buildRuntimeFieldPath as U,
10462
- resolveRuntimeFieldProps as V,
10463
- resolveRuntimeFieldState as W,
10464
- getRuntimeDependencyOutputKey as X,
10465
- isRowAddedInCurrentFormChange as Y,
10466
- MaterialConsumeTableController as Z,
10467
- _sfc_main$5 as _,
11157
+ stampSealValue as N,
11158
+ isValidSealValue as O,
11159
+ clearSealValue as P,
11160
+ parseRuntimeFieldPath as Q,
11161
+ NCB_PROVIDE as R,
11162
+ calculateFormula as S,
11163
+ useStyles as T,
11164
+ useDependency as U,
11165
+ useFieldPresentation as V,
11166
+ useRuntimeEditorFlusher as W,
11167
+ RuntimeFormStateStore as X,
11168
+ createRuntimeInstanceContext as Y,
11169
+ RuntimeInstanceRegistry as Z,
11170
+ ScanParamType as _,
10468
11171
  MAX_RUNTIME_SHEET_TITLE_LENGTH as a,
10469
- normalizeRuntime as a0,
10470
- RuntimeSheetService as a1,
10471
- validateObjectBomQtyOnSubmit as a2,
10472
- closeValidatorPopovers as a3,
10473
- enrichFormChangeRowDetails as a4,
10474
- useMaterialBalance as a5,
10475
- collectFormChangeFieldLocations as a6,
10476
- nextFormChangeRowViewHistoryId as a7,
10477
- DeviceConnector as a8,
10478
- DocumentLoading as a9,
10479
- pickObjectFieldKeys as aA,
10480
- recordSubtableRowAdd as aB,
10481
- recordSubtableRowDelete as aC,
10482
- resolveAnnotationFieldLocation as aD,
10483
- resolveFormChangeRowUi as aE,
10484
- resolveRowFormChangeMark as aF,
10485
- setSelectMobileTdId as aG,
10486
- stripLegacyFormConfigFromPaper as aH,
10487
- SubTableActionMenuTypeEnum as aI,
10488
- getMenuByAction as aJ,
10489
- SubTableActionEnum as aK,
10490
- resolveScanFillData as aL,
10491
- buildDefaultMapFromProfile as aM,
10492
- buildFieldStatusFromProfile as aN,
10493
- getRowHandlersForFieldChange as aO,
10494
- getInsertSubMenu as aP,
10495
- resolveScanAdjustType as aQ,
10496
- resolveScanQty as aR,
10497
- toDateOnly as aS,
10498
- hasSubtableBusinessData as aT,
10499
- getCopySubMenu as aU,
10500
- resolveScanParsedValue as aV,
10501
- isProductBatchEmptyRow as aW,
10502
- DynamicQuickFillModal as aa,
10503
- FixedQuickFillModal as ab,
10504
- FormTmplConfigController as ac,
10505
- LEGACY_RUNTIME_FORM_CONFIG_KEYS as ad,
10506
- LEGACY_RUNTIME_SHEET_ID as ae,
10507
- LEGACY_RUNTIME_SHEET_TITLE as af,
10508
- MCDataUtil as ag,
10509
- OCR_MODEL_PRECISION_ENUM_KEY as ah,
10510
- RuntimeAsyncTaskCoordinator as ai,
10511
- RuntimeDependencyService as aj,
10512
- RuntimeFieldRegistry as ak,
10513
- RuntimeInstanceEventBus as al,
10514
- RuntimePersistenceCoordinator as am,
10515
- RuntimeValidationService as an,
10516
- SubTableCore as ao,
10517
- buildFormChangeDisplayRows as ap,
10518
- convertV1Runtime as aq,
10519
- detailsHaveFormChangeRowOps as ar,
10520
- extractFormChangeRowDetails as as,
10521
- getFormChangeRowKey as at,
10522
- getFormChangeRowOp as au,
10523
- getSubTableQuickFillInfo as av,
10524
- isAnnLocationSelected as aw,
10525
- isBlank as ax,
10526
- isFormChangeGhostRow as ay,
10527
- normalizeHistoricalFieldConfig as az,
11172
+ stripLegacyFormConfigFromPaper as a$,
11173
+ MBRender as a0,
11174
+ MCRender as a1,
11175
+ moveSealValue as a2,
11176
+ DocumentPaper as a3,
11177
+ DynamicTableAction as a4,
11178
+ _sfc_main$5 as a5,
11179
+ getRuntimeDataFieldId as a6,
11180
+ buildRuntimeFieldPath as a7,
11181
+ resolveRuntimeFieldProps as a8,
11182
+ resolveRuntimeFieldState as a9,
11183
+ OCR_MODEL_PRECISION_ENUM_KEY as aA,
11184
+ RuntimeAsyncTaskCoordinator as aB,
11185
+ RuntimeDependencyService as aC,
11186
+ RuntimeFieldRegistry as aD,
11187
+ RuntimeInstanceEventBus as aE,
11188
+ RuntimePersistenceCoordinator as aF,
11189
+ RuntimeValidationService as aG,
11190
+ SubTableCore as aH,
11191
+ buildFormChangeDisplayRows as aI,
11192
+ convertV1Runtime as aJ,
11193
+ detailsHaveFormChangeRowOps as aK,
11194
+ extractFormChangeRowDetails as aL,
11195
+ getFormChangeRowKey as aM,
11196
+ getFormChangeRowOp as aN,
11197
+ getSubTableQuickFillInfo as aO,
11198
+ isAnnLocationSelected as aP,
11199
+ isBlank as aQ,
11200
+ isFormChangeGhostRow as aR,
11201
+ normalizeHistoricalFieldConfig as aS,
11202
+ pickObjectFieldKeys as aT,
11203
+ recordSubtableRowAdd as aU,
11204
+ recordSubtableRowDelete as aV,
11205
+ relocateDeletedRowsToEnd as aW,
11206
+ resolveAnnotationFieldLocation as aX,
11207
+ resolveFormChangeRowUi as aY,
11208
+ resolveRowFormChangeMark as aZ,
11209
+ setSelectMobileTdId as a_,
11210
+ assembleRules as aa,
11211
+ isAttachFieldActive as ab,
11212
+ getRuntimeDependencyOutputKey as ac,
11213
+ isRowAddedInCurrentFormChange as ad,
11214
+ MaterialConsumeTableController as ae,
11215
+ setFormulaParamsConfig as af,
11216
+ normalizeRuntime as ag,
11217
+ initializeSealFields as ah,
11218
+ RuntimeSheetService as ai,
11219
+ validateObjectBomQtyOnSubmit as aj,
11220
+ areValidationCommentsEqual as ak,
11221
+ closeValidatorPopovers as al,
11222
+ enrichFormChangeRowDetails as am,
11223
+ useMaterialBalance as an,
11224
+ collectFormChangeFieldLocations as ao,
11225
+ nextFormChangeRowViewHistoryId as ap,
11226
+ BaseFormModelFetcher as aq,
11227
+ DeviceConnector as ar,
11228
+ DocumentLoading as as,
11229
+ DynamicQuickFillModal as at,
11230
+ FixedQuickFillModal as au,
11231
+ FormTmplConfigController as av,
11232
+ LEGACY_RUNTIME_FORM_CONFIG_KEYS as aw,
11233
+ LEGACY_RUNTIME_SHEET_ID as ax,
11234
+ LEGACY_RUNTIME_SHEET_TITLE as ay,
11235
+ MCDataUtil as az,
10528
11236
  bindFormulaCacheInvalidation as b,
11237
+ SubTableActionMenuTypeEnum as b0,
11238
+ getMenuByAction as b1,
11239
+ SubTableActionEnum as b2,
11240
+ resolveScanFillData as b3,
11241
+ buildDefaultMapFromProfile as b4,
11242
+ buildFieldStatusFromProfile as b5,
11243
+ getRowHandlersForFieldChange as b6,
11244
+ getInsertSubMenu as b7,
11245
+ resolveScanAdjustType as b8,
11246
+ resolveScanQty as b9,
11247
+ toDateOnly as ba,
11248
+ hasSubtableBusinessData as bb,
11249
+ getCopySubMenu as bc,
11250
+ resolveScanParsedValue as bd,
11251
+ isProductBatchEmptyRow as be,
10529
11252
  currentParamsConfig as c,
10530
11253
  MULTI_SHEET_SCHEMA_VERSION as d,
10531
- createRuntimeDocumentV2 as e,
10532
- findFieldProfile as f,
10533
- getBusinessFieldKey as g,
10534
- normalizeHistoricalBusinessRow as h,
10535
- DeviceLinkTmplUtil as i,
10536
- normalizeAIOcrTmpl as j,
10537
- useWidgetStaticAttrs as k,
10538
- useRuntimeInstanceServices as l,
10539
- setSelectAnnotationId as m,
10540
- normalizeFieldWidth as n,
10541
- useRuntimeRowState as o,
10542
- getObjectBomMaterialLotQuery as p,
10543
- buildObjectLotExtraQuery as q,
10544
- resolveObjectFieldKeys as r,
11254
+ getBusinessFieldKey as e,
11255
+ createRuntimeDocumentV2 as f,
11256
+ getParseFormulaVarInfos as g,
11257
+ clampSealPosition as h,
11258
+ normalizeFieldWidth as i,
11259
+ useFormTmplConfig as j,
11260
+ findFieldProfile as k,
11261
+ normalizeHistoricalBusinessRow as l,
11262
+ DeviceLinkTmplUtil as m,
11263
+ normalizeSealDiameter as n,
11264
+ normalizeAIOcrTmpl as o,
11265
+ useWidgetStaticAttrs as p,
11266
+ useRuntimeInstanceServices as q,
11267
+ setSelectAnnotationId as r,
10545
11268
  setSelectValidatorId as s,
10546
- MaterialConsumptionPatternEnum as t,
10547
- useFormTmplConfig as u,
10548
- validateObjectBomForScan as v,
10549
- resolveObjectBomEntry as w,
10550
- runWithFillProduct as x,
10551
- useNocodeFormWidget as y,
10552
- applyConsumeObjectTraceChange as z
11269
+ useRuntimeRowState as t,
11270
+ useFormModel as u,
11271
+ getObjectBomMaterialLotQuery as v,
11272
+ buildObjectLotExtraQuery as w,
11273
+ resolveObjectFieldKeys as x,
11274
+ MaterialConsumptionPatternEnum as y,
11275
+ validateObjectBomForScan as z
10553
11276
  };