openxiangda 1.0.129 → 1.0.131

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.
@@ -6588,7 +6588,7 @@ var readTicketFromLocation = () => {
6588
6588
  var readPathFromLocation = () => typeof window === "undefined" ? void 0 : window.location.pathname;
6589
6589
 
6590
6590
  // packages/sdk/src/runtime/host/builtinRouteRenderer.tsx
6591
- import { useCallback as useCallback26, useEffect as useEffect50, useMemo as useMemo37, useState as useState42 } from "react";
6591
+ import { useCallback as useCallback27, useEffect as useEffect50, useMemo as useMemo37, useState as useState42 } from "react";
6592
6592
  import { Alert as Alert4, Button as Button16, Card as Card2, Empty as Empty8, Spin as Spin6, Typography as Typography3 } from "antd";
6593
6593
 
6594
6594
  // packages/sdk/src/components/core/imageCompression.ts
@@ -7375,7 +7375,7 @@ function createFormRuntimeApi(config) {
7375
7375
  }
7376
7376
 
7377
7377
  // packages/sdk/src/components/modules/DataManagementList.tsx
7378
- import { useCallback as useCallback25, useEffect as useEffect49, useMemo as useMemo36, useRef as useRef22, useState as useState41 } from "react";
7378
+ import { useCallback as useCallback26, useEffect as useEffect49, useMemo as useMemo36, useRef as useRef22, useState as useState41 } from "react";
7379
7379
  import {
7380
7380
  Alert as Alert3,
7381
7381
  Button as Button15,
@@ -7417,11 +7417,11 @@ import {
7417
7417
  import { useMemo as useMemo35 } from "react";
7418
7418
 
7419
7419
  // packages/sdk/src/components/templates/FormDetailTemplate.tsx
7420
- import { useCallback as useCallback17, useMemo as useMemo30, useRef as useRef16, useState as useState33 } from "react";
7420
+ import { useCallback as useCallback18, useMemo as useMemo30, useRef as useRef16, useState as useState33 } from "react";
7421
7421
  import dayjs10 from "dayjs";
7422
7422
 
7423
7423
  // packages/sdk/src/components/core/FormProvider.tsx
7424
- import React54, { useCallback as useCallback14, useEffect as useEffect40, useRef as useRef13, useState as useState26, useMemo as useMemo28 } from "react";
7424
+ import React54, { useCallback as useCallback15, useEffect as useEffect40, useRef as useRef13, useState as useState26, useMemo as useMemo28 } from "react";
7425
7425
 
7426
7426
  // packages/sdk/src/components/core/FormContext.ts
7427
7427
  import { createContext as createContext3, useContext as useContext3 } from "react";
@@ -13561,7 +13561,7 @@ function CascadeSelectField(props) {
13561
13561
  }
13562
13562
 
13563
13563
  // packages/sdk/src/components/fields/AddressField/index.tsx
13564
- import { useEffect as useEffect33, useMemo as useMemo25, useState as useState21 } from "react";
13564
+ import { useCallback as useCallback11, useEffect as useEffect33, useMemo as useMemo25, useState as useState21 } from "react";
13565
13565
  import { Button as Button7, Cascader as Cascader2, Input as Input9, Space as Space5, Spin as Spin3 } from "antd";
13566
13566
  import * as MobileAntd5 from "antd-mobile";
13567
13567
  import { jsx as jsx77, jsxs as jsxs33 } from "react/jsx-runtime";
@@ -13581,7 +13581,42 @@ var modeDepth = (mode) => {
13581
13581
  return 3;
13582
13582
  };
13583
13583
  var activeLevels = (mode) => LEVELS.slice(0, modeDepth(mode));
13584
- var valueToPath = (value) => LEVELS.map((level) => value?.[level]?.value).filter(Boolean);
13584
+ var stringifyValue = (value) => {
13585
+ if (value === void 0 || value === null || value === "") return void 0;
13586
+ return String(value);
13587
+ };
13588
+ var normalizeAddressPart = (part) => {
13589
+ if (part === void 0 || part === null || part === "") return void 0;
13590
+ if (typeof part === "object") {
13591
+ const value2 = stringifyValue(part.value ?? part.adcode ?? part.code ?? part.id ?? part.label);
13592
+ if (!value2) return void 0;
13593
+ const label = stringifyValue(part.label ?? part.name ?? part.title) ?? "";
13594
+ return { label, value: value2 };
13595
+ }
13596
+ const value = stringifyValue(part);
13597
+ return value ? { label: "", value } : void 0;
13598
+ };
13599
+ var normalizeAddressValue = (raw) => {
13600
+ if (!raw || typeof raw !== "object") return void 0;
13601
+ const next = {};
13602
+ LEVELS.forEach((level) => {
13603
+ const part = normalizeAddressPart(raw[level]);
13604
+ if (part) next[level] = part;
13605
+ });
13606
+ if (raw.detail !== void 0 && raw.detail !== null) {
13607
+ next.detail = String(raw.detail);
13608
+ }
13609
+ if (typeof raw.fullAddress === "string" && raw.fullAddress) {
13610
+ next.fullAddress = raw.fullAddress;
13611
+ }
13612
+ return Object.keys(next).length > 0 ? next : void 0;
13613
+ };
13614
+ var getDisplayLabel = (part) => {
13615
+ const label = part?.label?.trim();
13616
+ if (!label) return void 0;
13617
+ return label === part?.value ? void 0 : label;
13618
+ };
13619
+ var valueToPath = (value, levels) => levels.map((level) => value?.[level]?.value).filter(Boolean);
13585
13620
  var normalizeDivision = (item, level, depth, index) => ({
13586
13621
  label: String(item.name || item.label || item.adcode || item.value),
13587
13622
  value: String(item.adcode || item.value || item.id),
@@ -13590,7 +13625,66 @@ var normalizeDivision = (item, level, depth, index) => ({
13590
13625
  });
13591
13626
  var composeFullAddress = (value, levels = LEVELS) => {
13592
13627
  if (!value) return "";
13593
- return [...levels.map((level) => value[level]?.label), value.detail].filter(Boolean).join("");
13628
+ return [...levels.map((level) => getDisplayLabel(value[level])), value.detail].filter(Boolean).join("");
13629
+ };
13630
+ var mergeValuePathIntoOptions = (source, value, levels, depth) => {
13631
+ if (!value) return source;
13632
+ const mergeAt = (items, index) => {
13633
+ const level = levels[index];
13634
+ const part = level ? value[level] : void 0;
13635
+ if (!level || !part?.value) return items;
13636
+ let matched = false;
13637
+ const nextItems = items.map((item) => {
13638
+ if (String(item.value) !== part.value) return item;
13639
+ matched = true;
13640
+ const label = getDisplayLabel(part) ?? getDisplayLabel(item) ?? "\u5730\u5740\u52A0\u8F7D\u4E2D";
13641
+ const hasNextPath = Boolean(levels[index + 1] && value[levels[index + 1]]?.value);
13642
+ return {
13643
+ ...item,
13644
+ label,
13645
+ level: item.level ?? level,
13646
+ isLeaf: index + 1 >= depth || !hasNextPath && item.isLeaf === true,
13647
+ children: hasNextPath ? mergeAt(item.children ?? [], index + 1) : item.children
13648
+ };
13649
+ });
13650
+ if (!matched) {
13651
+ const hasNextPath = Boolean(levels[index + 1] && value[levels[index + 1]]?.value);
13652
+ const option = {
13653
+ label: getDisplayLabel(part) ?? "\u5730\u5740\u52A0\u8F7D\u4E2D",
13654
+ value: part.value,
13655
+ level,
13656
+ isLeaf: index + 1 >= depth
13657
+ };
13658
+ if (hasNextPath) option.children = mergeAt([], index + 1);
13659
+ nextItems.push(option);
13660
+ }
13661
+ return nextItems;
13662
+ };
13663
+ return mergeAt(source, 0);
13664
+ };
13665
+ var setNestedChildren = (source, selectedOptions, children) => {
13666
+ const [current, ...rest] = selectedOptions;
13667
+ if (!current) return source;
13668
+ const currentValue = String(current.value);
13669
+ let matched = false;
13670
+ const next = source.map((item) => {
13671
+ if (String(item.value) !== currentValue) return item;
13672
+ matched = true;
13673
+ return {
13674
+ ...item,
13675
+ children: rest.length ? setNestedChildren(item.children ?? [], rest, children) : children
13676
+ };
13677
+ });
13678
+ if (!matched) {
13679
+ next.push({
13680
+ label: String(current.label || current.value),
13681
+ value: currentValue,
13682
+ level: current.level,
13683
+ isLeaf: false,
13684
+ children: rest.length ? setNestedChildren([], rest, children) : children
13685
+ });
13686
+ }
13687
+ return next;
13594
13688
  };
13595
13689
  function AddressField(props) {
13596
13690
  const {
@@ -13612,7 +13706,8 @@ function AddressField(props) {
13612
13706
  const { formData, fieldBehaviors, setFieldValue, registerField, unregisterField, api } = useFormContext();
13613
13707
  const { isMobile } = useDeviceDetect();
13614
13708
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
13615
- const value = formData[fieldId];
13709
+ const rawValue = formData[fieldId];
13710
+ const value = useMemo25(() => normalizeAddressValue(rawValue), [rawValue]);
13616
13711
  const [options, setOptions] = useState21([]);
13617
13712
  const [loadingRoots, setLoadingRoots] = useState21(false);
13618
13713
  const [mobileOpen, setMobileOpen] = useState21(false);
@@ -13622,24 +13717,78 @@ function AddressField(props) {
13622
13717
  const [tempValue, setTempValue] = useState21();
13623
13718
  const depth = modeDepth(mode);
13624
13719
  const levels = useMemo25(() => activeLevels(mode), [mode]);
13720
+ const valuePath = useMemo25(() => valueToPath(value, levels), [levels, value]);
13721
+ const displayOptions = useMemo25(
13722
+ () => mergeValuePathIntoOptions(options, value, levels, depth),
13723
+ [depth, levels, options, value]
13724
+ );
13625
13725
  const detailEnabled = mode === "province-city-district-street-detail";
13626
13726
  const disabled = behavior === "DISABLED";
13627
13727
  const MobilePopup = getMobileComponent3("Popup");
13628
13728
  useEffect33(() => {
13629
13729
  registerField(fieldId);
13630
- if (defaultValue !== void 0 && formData[fieldId] === void 0) {
13730
+ return () => unregisterField(fieldId);
13731
+ }, [fieldId, registerField, unregisterField]);
13732
+ useEffect33(() => {
13733
+ if (defaultValue !== void 0 && rawValue === void 0) {
13631
13734
  setFieldValue(fieldId, defaultValue);
13632
13735
  }
13633
- return () => unregisterField(fieldId);
13634
- }, [fieldId]);
13635
- const loadDivisions = async (parentAdcode, level, index) => {
13636
- const list = await api.getChinaDivisions(parentAdcode);
13637
- return list.map((item) => normalizeDivision(item, level, depth, index));
13638
- };
13736
+ }, [defaultValue, fieldId, rawValue, setFieldValue]);
13737
+ const loadDivisions = useCallback11(
13738
+ async (parentAdcode, level, index) => {
13739
+ const list = await api.getChinaDivisions(parentAdcode);
13740
+ return list.map((item) => normalizeDivision(item, level, depth, index));
13741
+ },
13742
+ [api, depth]
13743
+ );
13639
13744
  useEffect33(() => {
13745
+ let mounted = true;
13640
13746
  setLoadingRoots(true);
13641
- loadDivisions(void 0, "province", 0).then(setOptions).finally(() => setLoadingRoots(false));
13642
- }, [api, depth]);
13747
+ loadDivisions(void 0, "province", 0).then((nextOptions) => {
13748
+ if (mounted) setOptions(nextOptions);
13749
+ }).finally(() => {
13750
+ if (mounted) setLoadingRoots(false);
13751
+ });
13752
+ return () => {
13753
+ mounted = false;
13754
+ };
13755
+ }, [loadDivisions]);
13756
+ useEffect33(() => {
13757
+ if (!value) return;
13758
+ let cancelled = false;
13759
+ const hydrateMissingLabels = async () => {
13760
+ let nextValue = { ...value };
13761
+ let changed = false;
13762
+ let parentAdcode;
13763
+ for (let index = 0; index < levels.length; index += 1) {
13764
+ const level = levels[index];
13765
+ const part = nextValue[level];
13766
+ if (!part?.value) break;
13767
+ if (!getDisplayLabel(part)) {
13768
+ const divisions = await loadDivisions(parentAdcode, level, index);
13769
+ const matched = divisions.find((option) => option.value === part.value);
13770
+ if (matched) {
13771
+ nextValue = { ...nextValue, [level]: { label: matched.label, value: matched.value } };
13772
+ changed = true;
13773
+ }
13774
+ }
13775
+ parentAdcode = part.value;
13776
+ }
13777
+ const fullAddress = composeFullAddress(nextValue, levels);
13778
+ if (fullAddress && nextValue.fullAddress !== fullAddress) {
13779
+ nextValue = { ...nextValue, fullAddress };
13780
+ changed = true;
13781
+ }
13782
+ if (!cancelled && changed) {
13783
+ setFieldValue(fieldId, nextValue);
13784
+ }
13785
+ };
13786
+ hydrateMissingLabels().catch(() => {
13787
+ });
13788
+ return () => {
13789
+ cancelled = true;
13790
+ };
13791
+ }, [fieldId, levels, loadDivisions, setFieldValue, value]);
13643
13792
  useEffect33(() => {
13644
13793
  if (!mobileOpen) return;
13645
13794
  const level = levels[mobileLevelIndex] || "province";
@@ -13647,7 +13796,7 @@ function AddressField(props) {
13647
13796
  const parentAdcode = parentLevel ? tempValue?.[parentLevel]?.value : void 0;
13648
13797
  setMobileLoading(true);
13649
13798
  loadDivisions(parentAdcode, level, mobileLevelIndex).then(setMobileOptions).finally(() => setMobileLoading(false));
13650
- }, [mobileOpen, mobileLevelIndex, tempValue, levels]);
13799
+ }, [loadDivisions, mobileOpen, mobileLevelIndex, tempValue, levels]);
13651
13800
  if (behavior === "HIDDEN") return null;
13652
13801
  const setAddressValue = (next) => {
13653
13802
  const normalized = next ? { ...next, fullAddress: composeFullAddress(next, levels) } : void 0;
@@ -13783,18 +13932,20 @@ function AddressField(props) {
13783
13932
  Cascader2,
13784
13933
  {
13785
13934
  style: { width: "100%" },
13786
- options,
13935
+ options: displayOptions,
13787
13936
  allowClear,
13788
13937
  disabled,
13789
- value: valueToPath(value),
13938
+ value: valuePath,
13790
13939
  placeholder: props.placeholder || "\u8BF7\u9009\u62E9\u5730\u5740",
13791
13940
  loading: loadingRoots,
13941
+ displayRender: (labels) => labels.filter(Boolean).join(" / ") || (valuePath.length ? "\u5730\u5740\u52A0\u8F7D\u4E2D" : ""),
13792
13942
  loadData: async (selectedOptions) => {
13793
13943
  const target = selectedOptions[selectedOptions.length - 1];
13794
13944
  const nextLevel = levels[selectedOptions.length] ?? "street";
13795
13945
  const children = await loadDivisions(target.value, nextLevel, selectedOptions.length);
13796
- target.children = children;
13797
- setOptions([...options]);
13946
+ setOptions(
13947
+ (currentOptions) => setNestedChildren(currentOptions, selectedOptions, children)
13948
+ );
13798
13949
  },
13799
13950
  onChange: (_path, selectedOptions) => {
13800
13951
  if (!selectedOptions?.length) {
@@ -13818,7 +13969,7 @@ function AddressField(props) {
13818
13969
  }
13819
13970
 
13820
13971
  // packages/sdk/src/components/fields/AssociationFormField/index.tsx
13821
- import { useCallback as useCallback11, useEffect as useEffect34, useMemo as useMemo26, useRef as useRef10, useState as useState22 } from "react";
13972
+ import { useCallback as useCallback12, useEffect as useEffect34, useMemo as useMemo26, useRef as useRef10, useState as useState22 } from "react";
13822
13973
  import { Button as Button8, Drawer, Input as Input10, Modal as Modal6, Select as Select6, Space as Space6, Spin as Spin4, Table, Tag as Tag5 } from "antd";
13823
13974
  import { jsx as jsx78, jsxs as jsxs34 } from "react/jsx-runtime";
13824
13975
  var DEFAULT_PAGE_SIZE = 10;
@@ -13932,7 +14083,7 @@ function AssociationFormField(props) {
13932
14083
  () => `${filterRulesKey}:${currentFieldFilterKey}`,
13933
14084
  [currentFieldFilterKey, filterRulesKey]
13934
14085
  );
13935
- const normalizeRecord = useCallback11(
14086
+ const normalizeRecord = useCallback12(
13936
14087
  (record) => {
13937
14088
  const mainFieldValue = associationMainFieldId ? record?.[associationMainFieldId] : void 0;
13938
14089
  const labelText = normalizeCellValue(mainFieldValue);
@@ -13945,7 +14096,7 @@ function AssociationFormField(props) {
13945
14096
  },
13946
14097
  [associationMainFieldId]
13947
14098
  );
13948
- const toValue = useCallback11(
14099
+ const toValue = useCallback12(
13949
14100
  (record) => ({
13950
14101
  label: record.__associationLabel,
13951
14102
  value: record.__associationValue,
@@ -13953,7 +14104,7 @@ function AssociationFormField(props) {
13953
14104
  }),
13954
14105
  []
13955
14106
  );
13956
- const buildFilters = useCallback11(() => {
14107
+ const buildFilters = useCallback12(() => {
13957
14108
  void filterDependencyKey;
13958
14109
  const rules = associationFormRef.current?.dataFilterRules || [];
13959
14110
  const currentFormData = formDataRef.current;
@@ -13969,7 +14120,7 @@ function AssociationFormField(props) {
13969
14120
  };
13970
14121
  }).filter(Boolean);
13971
14122
  }, [filterDependencyKey]);
13972
- const fetchRecords = useCallback11(
14123
+ const fetchRecords = useCallback12(
13973
14124
  async (params) => {
13974
14125
  if (!canQuery) return { list: [], total: 0 };
13975
14126
  const filters = buildFilters();
@@ -13992,7 +14143,7 @@ function AssociationFormField(props) {
13992
14143
  },
13993
14144
  [api, associationAppType, associationFormUuid, buildFilters, canQuery, normalizeRecord]
13994
14145
  );
13995
- const loadOptions = useCallback11(
14146
+ const loadOptions = useCallback12(
13996
14147
  async (searchKeyWord) => {
13997
14148
  setSelectLoading(true);
13998
14149
  try {
@@ -14004,7 +14155,7 @@ function AssociationFormField(props) {
14004
14155
  },
14005
14156
  [fetchRecords, toValue]
14006
14157
  );
14007
- const loadTable = useCallback11(
14158
+ const loadTable = useCallback12(
14008
14159
  async (next) => {
14009
14160
  setTableLoading(true);
14010
14161
  const current = next?.current || 1;
@@ -14034,7 +14185,7 @@ function AssociationFormField(props) {
14034
14185
  ).filter(Boolean)
14035
14186
  );
14036
14187
  }, [normalizeRecord, value]);
14037
- const applyDataFilling = useCallback11(
14188
+ const applyDataFilling = useCallback12(
14038
14189
  (next) => {
14039
14190
  if (!associationForm?.dataFillingEnabled && !associationForm?.dataFillingRules?.mainRules) {
14040
14191
  return;
@@ -14048,7 +14199,7 @@ function AssociationFormField(props) {
14048
14199
  },
14049
14200
  [associationForm?.dataFillingEnabled, associationForm?.dataFillingRules, setFieldValue]
14050
14201
  );
14051
- const commitSelection = useCallback11(
14202
+ const commitSelection = useCallback12(
14052
14203
  (next) => {
14053
14204
  const normalized = multiple ? next : next.slice(0, 1);
14054
14205
  setFieldValue(fieldId, normalized);
@@ -14300,7 +14451,7 @@ function AssociationFormField(props) {
14300
14451
  }
14301
14452
 
14302
14453
  // packages/sdk/src/components/fields/EditorField/index.tsx
14303
- import { useCallback as useCallback12, useEffect as useEffect35, useMemo as useMemo27, useRef as useRef11, useState as useState23 } from "react";
14454
+ import { useCallback as useCallback13, useEffect as useEffect35, useMemo as useMemo27, useRef as useRef11, useState as useState23 } from "react";
14304
14455
  import { Extension } from "@tiptap/core";
14305
14456
  import { EditorContent, useEditor } from "@tiptap/react";
14306
14457
  import StarterKit from "@tiptap/starter-kit";
@@ -15009,7 +15160,7 @@ function RichTextEditorCore({
15009
15160
  ],
15010
15161
  [maxLength, placeholder]
15011
15162
  );
15012
- const updateHtml = useCallback12((next) => {
15163
+ const updateHtml = useCallback13((next) => {
15013
15164
  onChangeRef.current?.(next);
15014
15165
  }, []);
15015
15166
  const editor = useEditor(
@@ -15051,7 +15202,7 @@ function RichTextEditorCore({
15051
15202
  }
15052
15203
  setCharCount(countCharacters(editor));
15053
15204
  }, [editor, value]);
15054
- const insertImageFiles = useCallback12(
15205
+ const insertImageFiles = useCallback13(
15055
15206
  async (files) => {
15056
15207
  if (!editor || isEditorDestroyed(editor) || disabled || files.length === 0) return;
15057
15208
  const validFiles = files.filter((file) => {
@@ -15081,7 +15232,7 @@ function RichTextEditorCore({
15081
15232
  },
15082
15233
  [allowedImageTypes, api, disabled, editor, maxImageSize, uploadBucketName]
15083
15234
  );
15084
- const openLinkModal = useCallback12(() => {
15235
+ const openLinkModal = useCallback13(() => {
15085
15236
  if (!editor || isEditorDestroyed(editor)) return;
15086
15237
  setLinkUrl(editor.getAttributes("link").href || "");
15087
15238
  setLinkError("");
@@ -15107,7 +15258,7 @@ function RichTextEditorCore({
15107
15258
  editor.chain().focus().extendMarkRange("link").unsetLink().run();
15108
15259
  setLinkOpen(false);
15109
15260
  };
15110
- const openImageUrlModal = useCallback12(() => {
15261
+ const openImageUrlModal = useCallback13(() => {
15111
15262
  setImageUrl("");
15112
15263
  setImageAlt("");
15113
15264
  setImageTitle("");
@@ -15369,7 +15520,7 @@ function EditorField(props) {
15369
15520
  setFieldValue(fieldId, value);
15370
15521
  }
15371
15522
  }, [fieldId, rawValue, setFieldValue, value]);
15372
- const updateHtml = useCallback12(
15523
+ const updateHtml = useCallback13(
15373
15524
  (next) => {
15374
15525
  setFieldValue(fieldId, next);
15375
15526
  onChange?.(next);
@@ -15669,7 +15820,7 @@ function LocationField(props) {
15669
15820
  }
15670
15821
 
15671
15822
  // packages/sdk/src/components/fields/DigitalSignatureField/index.tsx
15672
- import { useCallback as useCallback13, useEffect as useEffect38, useRef as useRef12, useState as useState25 } from "react";
15823
+ import { useCallback as useCallback14, useEffect as useEffect38, useRef as useRef12, useState as useState25 } from "react";
15673
15824
  import { Button as Button11, Modal as Modal8, Space as Space9 } from "antd";
15674
15825
  import { jsx as jsx82, jsxs as jsxs37 } from "react/jsx-runtime";
15675
15826
  var CANVAS_HEIGHT = 260;
@@ -15717,7 +15868,7 @@ function DigitalSignatureField(props) {
15717
15868
  }
15718
15869
  return () => unregisterField(fieldId);
15719
15870
  }, [fieldId]);
15720
- const prepareCanvas = useCallback13(() => {
15871
+ const prepareCanvas = useCallback14(() => {
15721
15872
  const canvas = canvasRef.current;
15722
15873
  if (!canvas) return;
15723
15874
  const rect = canvas.getBoundingClientRect();
@@ -16544,7 +16695,7 @@ function FormProvider({
16544
16695
  setFieldErrors(nextErrors);
16545
16696
  }
16546
16697
  }, [effects, formData, fieldErrors]);
16547
- const setFieldValue = useCallback14((fieldId, value) => {
16698
+ const setFieldValue = useCallback15((fieldId, value) => {
16548
16699
  setFormData((prev) => ({ ...prev, [fieldId]: value }));
16549
16700
  setFieldErrors((prev) => {
16550
16701
  if (prev[fieldId]) {
@@ -16555,9 +16706,9 @@ function FormProvider({
16555
16706
  return prev;
16556
16707
  });
16557
16708
  }, []);
16558
- const getFieldValue = useCallback14((fieldId) => formData[fieldId], [formData]);
16559
- const getFormData2 = useCallback14(() => ({ ...formData }), [formData]);
16560
- const validateFieldById = useCallback14(
16709
+ const getFieldValue = useCallback15((fieldId) => formData[fieldId], [formData]);
16710
+ const getFormData2 = useCallback15(() => ({ ...formData }), [formData]);
16711
+ const validateFieldById = useCallback15(
16561
16712
  async (fieldId) => {
16562
16713
  const field = schema.fields.find((f) => f.fieldId === fieldId);
16563
16714
  if (!field) {
@@ -16618,7 +16769,7 @@ function FormProvider({
16618
16769
  },
16619
16770
  [schema, formData, fieldBehaviors, fieldOverrides]
16620
16771
  );
16621
- const validateAllWithErrors = useCallback14(async () => {
16772
+ const validateAllWithErrors = useCallback15(async () => {
16622
16773
  const fieldRules = {};
16623
16774
  const validationData = { ...formData };
16624
16775
  for (const field of schema.fields) {
@@ -16642,21 +16793,21 @@ function FormProvider({
16642
16793
  setFieldErrors(errors);
16643
16794
  return errors;
16644
16795
  }, [schema, formData, fieldBehaviors, fieldOverrides]);
16645
- const validateAll = useCallback14(async () => {
16796
+ const validateAll = useCallback15(async () => {
16646
16797
  const errors = await validateAllWithErrors();
16647
16798
  return Object.keys(errors).length === 0;
16648
16799
  }, [validateAllWithErrors]);
16649
- const resetForm = useCallback14(() => {
16800
+ const resetForm = useCallback15(() => {
16650
16801
  setFormData({ ...initialValuesRef.current });
16651
16802
  setFieldErrors({});
16652
16803
  }, []);
16653
- const registerField = useCallback14(
16804
+ const registerField = useCallback15(
16654
16805
  (fieldId) => {
16655
16806
  registeredFields.add(fieldId);
16656
16807
  },
16657
16808
  [registeredFields]
16658
16809
  );
16659
- const unregisterField = useCallback14(
16810
+ const unregisterField = useCallback15(
16660
16811
  (fieldId) => {
16661
16812
  registeredFields.delete(fieldId);
16662
16813
  },
@@ -17560,7 +17711,7 @@ async function validateAndNotify(validateAllWithErrors) {
17560
17711
  }
17561
17712
 
17562
17713
  // packages/sdk/src/components/hooks/useFormDetail.ts
17563
- import { useState as useState30, useEffect as useEffect42, useCallback as useCallback15, useRef as useRef14 } from "react";
17714
+ import { useState as useState30, useEffect as useEffect42, useCallback as useCallback16, useRef as useRef14 } from "react";
17564
17715
 
17565
17716
  // packages/sdk/src/components/utils/formInstanceData.ts
17566
17717
  var FORM_INSTANCE_METADATA_KEYS = /* @__PURE__ */ new Set([
@@ -17774,7 +17925,7 @@ function useFormDetail(options) {
17774
17925
  useEffect42(() => {
17775
17926
  onPermissionDeniedRef.current = onPermissionDenied;
17776
17927
  }, [onPermissionDenied]);
17777
- const loadData = useCallback15(async () => {
17928
+ const loadData = useCallback16(async () => {
17778
17929
  if (!mountedRef.current) return;
17779
17930
  setLoading(true);
17780
17931
  try {
@@ -17816,14 +17967,14 @@ function useFormDetail(options) {
17816
17967
  const canEdit = hasViewOperation(permissions?.operations, "edit");
17817
17968
  const canDelete = hasViewOperation(permissions?.operations, "delete");
17818
17969
  const canViewChangeRecords = hasViewOperation(permissions?.operations, "change_records");
17819
- const switchToEdit = useCallback15(() => {
17970
+ const switchToEdit = useCallback16(() => {
17820
17971
  setMode("edit");
17821
17972
  loadData();
17822
17973
  }, [loadData]);
17823
- const switchToReadonly = useCallback15(() => {
17974
+ const switchToReadonly = useCallback16(() => {
17824
17975
  setMode("readonly");
17825
17976
  }, []);
17826
- const saveChanges = useCallback15(
17977
+ const saveChanges = useCallback16(
17827
17978
  async (values) => {
17828
17979
  try {
17829
17980
  await api.updateFormData({
@@ -17844,7 +17995,7 @@ function useFormDetail(options) {
17844
17995
  },
17845
17996
  [api, formInstanceId, formUuid, appType]
17846
17997
  );
17847
- const deleteInstance = useCallback15(async () => {
17998
+ const deleteInstance = useCallback16(async () => {
17848
17999
  try {
17849
18000
  await deleteFormData(request, { formInstanceId, appType, formUuid });
17850
18001
  return true;
@@ -17871,7 +18022,7 @@ function useFormDetail(options) {
17871
18022
  }
17872
18023
 
17873
18024
  // packages/sdk/src/components/hooks/useChangeRecords.ts
17874
- import { useState as useState31, useEffect as useEffect43, useCallback as useCallback16, useRef as useRef15 } from "react";
18025
+ import { useState as useState31, useEffect as useEffect43, useCallback as useCallback17, useRef as useRef15 } from "react";
17875
18026
  var normalizeChangeRecordList = (value) => {
17876
18027
  const body = value && typeof value === "object" && !Array.isArray(value) ? Array.isArray(value.data) || Array.isArray(value.records) || Array.isArray(value.list) || Array.isArray(value.items) ? value : value.data ?? value.result ?? value : value;
17877
18028
  const records = Array.isArray(body) ? body : body?.records ?? body?.data ?? body?.list ?? body?.items ?? [];
@@ -17897,7 +18048,7 @@ function useChangeRecords(options) {
17897
18048
  mountedRef.current = false;
17898
18049
  };
17899
18050
  }, []);
17900
- const fetchRecords = useCallback16(
18051
+ const fetchRecords = useCallback17(
17901
18052
  async (pageNum, append) => {
17902
18053
  if (!mountedRef.current) return;
17903
18054
  setLoading(true);
@@ -17935,11 +18086,11 @@ function useChangeRecords(options) {
17935
18086
  }, [autoLoad, fetchRecords]);
17936
18087
  const safeRecords = Array.isArray(records) ? records : [];
17937
18088
  const hasMore = safeRecords.length < total;
17938
- const loadMore = useCallback16(async () => {
18089
+ const loadMore = useCallback17(async () => {
17939
18090
  if (!hasMore || loading) return;
17940
18091
  await fetchRecords(page + 1, true);
17941
18092
  }, [hasMore, loading, page, fetchRecords]);
17942
- const refresh = useCallback16(async () => {
18093
+ const refresh = useCallback17(async () => {
17943
18094
  setRecords([]);
17944
18095
  setPage(1);
17945
18096
  setTotal(0);
@@ -18394,7 +18545,7 @@ var InnerDetailContent = ({
18394
18545
  formInstanceId,
18395
18546
  autoLoad: enableChangeRecords && canViewChangeRecords
18396
18547
  });
18397
- const handleSave = useCallback17(async () => {
18548
+ const handleSave = useCallback18(async () => {
18398
18549
  if (validateRef.current && !await validateAndNotify(validateRef.current)) return;
18399
18550
  const values = formDataRef.current?.() ?? formData;
18400
18551
  if (!values) return;
@@ -18403,13 +18554,13 @@ var InnerDetailContent = ({
18403
18554
  onSave?.(values);
18404
18555
  }
18405
18556
  }, [formData, saveChanges, onSave]);
18406
- const handleDelete = useCallback17(async () => {
18557
+ const handleDelete = useCallback18(async () => {
18407
18558
  const success = await deleteInstance();
18408
18559
  if (success) {
18409
18560
  onDelete?.();
18410
18561
  }
18411
18562
  }, [deleteInstance, onDelete]);
18412
- const handleCancel = useCallback17(() => {
18563
+ const handleCancel = useCallback18(() => {
18413
18564
  switchToReadonly();
18414
18565
  }, [switchToReadonly]);
18415
18566
  const readonlyActions = [];
@@ -18536,12 +18687,12 @@ var FormDetailTemplate = (props) => {
18536
18687
  };
18537
18688
 
18538
18689
  // packages/sdk/src/components/templates/FormSubmitTemplate.tsx
18539
- import { useEffect as useEffect46, useRef as useRef18, useState as useState36, useCallback as useCallback20 } from "react";
18690
+ import { useEffect as useEffect46, useRef as useRef18, useState as useState36, useCallback as useCallback21 } from "react";
18540
18691
  import { Button as Button14, message as message4, Modal as Modal9, Select as Select8 } from "antd";
18541
18692
  import { CheckCircleFilled as CheckCircleFilled2 } from "@ant-design/icons";
18542
18693
 
18543
18694
  // packages/sdk/src/components/hooks/useDraftStorage.ts
18544
- import { useState as useState34, useCallback as useCallback18, useEffect as useEffect44 } from "react";
18695
+ import { useState as useState34, useCallback as useCallback19, useEffect as useEffect44 } from "react";
18545
18696
  function getDraftKey(appType, formUuid) {
18546
18697
  return `${appType}__${formUuid}__draft`;
18547
18698
  }
@@ -18578,7 +18729,7 @@ function useDraftStorage(options) {
18578
18729
  setDraftTimestamp(null);
18579
18730
  }
18580
18731
  }, [key, autoRestore]);
18581
- const saveDraft = useCallback18(
18732
+ const saveDraft = useCallback19(
18582
18733
  (data) => {
18583
18734
  const payload = { data, ts: Date.now() };
18584
18735
  try {
@@ -18592,7 +18743,7 @@ function useDraftStorage(options) {
18592
18743
  },
18593
18744
  [key]
18594
18745
  );
18595
- const restoreDraft = useCallback18(() => {
18746
+ const restoreDraft = useCallback19(() => {
18596
18747
  const stored = readDraft(key);
18597
18748
  if (stored) {
18598
18749
  setDraftData(stored.data);
@@ -18600,7 +18751,7 @@ function useDraftStorage(options) {
18600
18751
  }
18601
18752
  return null;
18602
18753
  }, [key]);
18603
- const clearDraft = useCallback18(() => {
18754
+ const clearDraft = useCallback19(() => {
18604
18755
  try {
18605
18756
  localStorage.removeItem(key);
18606
18757
  } catch (error) {
@@ -18621,7 +18772,7 @@ function useDraftStorage(options) {
18621
18772
  }
18622
18773
 
18623
18774
  // packages/sdk/src/components/hooks/useFormNavigation.ts
18624
- import { useState as useState35, useCallback as useCallback19, useRef as useRef17, useEffect as useEffect45 } from "react";
18775
+ import { useState as useState35, useCallback as useCallback20, useRef as useRef17, useEffect as useEffect45 } from "react";
18625
18776
  var normalizeBasePath = (basePath) => {
18626
18777
  const normalized = String(basePath || "").replace(/^\/+|\/+$/g, "");
18627
18778
  return normalized ? `/${normalized}` : "";
@@ -18668,13 +18819,13 @@ function useFormNavigation(options) {
18668
18819
  }
18669
18820
  };
18670
18821
  }, []);
18671
- const navigateToDetail = useCallback19(
18822
+ const navigateToDetail = useCallback20(
18672
18823
  (formInstId) => {
18673
18824
  window.location.href = buildDetailUrl(appType, formUuid, formInstId, "formDetail", basePath);
18674
18825
  },
18675
18826
  [appType, basePath, formUuid]
18676
18827
  );
18677
- const navigateToProcessDetail = useCallback19(
18828
+ const navigateToProcessDetail = useCallback20(
18678
18829
  (formInstId) => {
18679
18830
  window.location.href = buildDetailUrl(
18680
18831
  appType,
@@ -18686,7 +18837,7 @@ function useFormNavigation(options) {
18686
18837
  },
18687
18838
  [appType, basePath, formUuid]
18688
18839
  );
18689
- const startRedirectCountdown = useCallback19(
18840
+ const startRedirectCountdown = useCallback20(
18690
18841
  (targetUrl) => {
18691
18842
  const totalSeconds = Math.ceil(redirectDelay / 1e3);
18692
18843
  setIsRedirecting(true);
@@ -18719,7 +18870,7 @@ function useFormNavigation(options) {
18719
18870
  },
18720
18871
  [redirectDelay]
18721
18872
  );
18722
- const cancelRedirect = useCallback19(() => {
18873
+ const cancelRedirect = useCallback20(() => {
18723
18874
  if (timerRef.current) {
18724
18875
  clearInterval(timerRef.current);
18725
18876
  timerRef.current = null;
@@ -18728,7 +18879,7 @@ function useFormNavigation(options) {
18728
18879
  setCountdown(0);
18729
18880
  redirectTargetRef.current = null;
18730
18881
  }, []);
18731
- const handlePostSubmit = useCallback19(
18882
+ const handlePostSubmit = useCallback20(
18732
18883
  (formInstId) => {
18733
18884
  if (mode === "stay") {
18734
18885
  onStay?.(formInstId);
@@ -18964,14 +19115,14 @@ var InnerFormContent = ({
18964
19115
  submissionDepartmentResolverRef.current = null;
18965
19116
  };
18966
19117
  }, []);
18967
- const closeSubmissionDepartmentModal = useCallback20((value = null) => {
19118
+ const closeSubmissionDepartmentModal = useCallback21((value = null) => {
18968
19119
  setSubmissionDepartmentModalOpen(false);
18969
19120
  setSubmissionDepartmentOptions([]);
18970
19121
  setSelectedSubmissionDepartmentId(void 0);
18971
19122
  submissionDepartmentResolverRef.current?.(value);
18972
19123
  submissionDepartmentResolverRef.current = null;
18973
19124
  }, []);
18974
- const promptSubmissionDepartmentSelection = useCallback20(
19125
+ const promptSubmissionDepartmentSelection = useCallback21(
18975
19126
  (options, preferredDepartmentId) => {
18976
19127
  return new Promise((resolve) => {
18977
19128
  const selected = options.some((option) => option.value === preferredDepartmentId) ? preferredDepartmentId : options[0]?.value;
@@ -18983,7 +19134,7 @@ var InnerFormContent = ({
18983
19134
  },
18984
19135
  []
18985
19136
  );
18986
- const resolveSubmissionDepartmentId = useCallback20(async () => {
19137
+ const resolveSubmissionDepartmentId = useCallback21(async () => {
18987
19138
  if (formType !== "process") {
18988
19139
  return void 0;
18989
19140
  }
@@ -19005,7 +19156,7 @@ var InnerFormContent = ({
19005
19156
  }
19006
19157
  return promptSubmissionDepartmentSelection(departments, departmentId);
19007
19158
  }, [api, config.formUuid, departmentId, formType, promptSubmissionDepartmentSelection, schema]);
19008
- const performSubmit = useCallback20(
19159
+ const performSubmit = useCallback21(
19009
19160
  async (formData, submissionDepartmentId, initiatorSelectedApprovers) => {
19010
19161
  const submitData = normalizeFormDataForSubmit(schema, formData);
19011
19162
  setSubmitting(true);
@@ -19081,7 +19232,7 @@ var InnerFormContent = ({
19081
19232
  departmentId
19082
19233
  ]
19083
19234
  );
19084
- const continuePreparedSubmit = useCallback20(
19235
+ const continuePreparedSubmit = useCallback21(
19085
19236
  async (submitData, submissionDepartmentId, initiatorSelectedApprovers) => {
19086
19237
  if (formType === "process" && enableProcessPreview && !isSaveDraftSubmitBehavior(config)) {
19087
19238
  setPendingFormData(submitData);
@@ -19113,7 +19264,7 @@ var InnerFormContent = ({
19113
19264
  },
19114
19265
  [api.request, config, enableProcessPreview, formType, performSubmit]
19115
19266
  );
19116
- const prepareSubmit = useCallback20(async () => {
19267
+ const prepareSubmit = useCallback21(async () => {
19117
19268
  const valid = await validateAndNotify(validateAllWithErrors);
19118
19269
  if (!valid) return;
19119
19270
  const formData = getFormData2();
@@ -19170,7 +19321,7 @@ var InnerFormContent = ({
19170
19321
  resolveSubmissionDepartmentId,
19171
19322
  continuePreparedSubmit
19172
19323
  ]);
19173
- const handlePreviewConfirm = useCallback20(async () => {
19324
+ const handlePreviewConfirm = useCallback21(async () => {
19174
19325
  const data = pendingFormData ?? getFormData2();
19175
19326
  const submissionDepartmentId = pendingSubmissionDepartmentIdRef.current ?? pendingSubmissionDepartmentId;
19176
19327
  const initiatorSelectedApprovers = pendingInitiatorSelectedApproversRef.current ?? pendingInitiatorSelectedApprovers;
@@ -19188,7 +19339,7 @@ var InnerFormContent = ({
19188
19339
  pendingSubmissionDepartmentId,
19189
19340
  performSubmit
19190
19341
  ]);
19191
- const handleInitiatorApproverConfirm = useCallback20(
19342
+ const handleInitiatorApproverConfirm = useCallback21(
19192
19343
  async (selectedUsersByNode) => {
19193
19344
  const data = pendingFormData;
19194
19345
  if (!data) {
@@ -19204,7 +19355,7 @@ var InnerFormContent = ({
19204
19355
  },
19205
19356
  [continuePreparedSubmit, pendingFormData, pendingSubmissionDepartmentId]
19206
19357
  );
19207
- const handleInitiatorApproverCancel = useCallback20(() => {
19358
+ const handleInitiatorApproverCancel = useCallback21(() => {
19208
19359
  setInitiatorApproverOpen(false);
19209
19360
  setInitiatorApproverRequirements([]);
19210
19361
  setPendingFormData(null);
@@ -19213,23 +19364,23 @@ var InnerFormContent = ({
19213
19364
  pendingSubmissionDepartmentIdRef.current = void 0;
19214
19365
  pendingInitiatorSelectedApproversRef.current = void 0;
19215
19366
  }, []);
19216
- const handleSaveDraft = useCallback20(() => {
19367
+ const handleSaveDraft = useCallback21(() => {
19217
19368
  const data = getFormData2();
19218
19369
  saveDraft(data);
19219
19370
  }, [getFormData2, saveDraft]);
19220
- const handleRestoreDraft = useCallback20(() => {
19371
+ const handleRestoreDraft = useCallback21(() => {
19221
19372
  const data = restoreDraft();
19222
19373
  if (!data) return;
19223
19374
  Object.entries(data).forEach(([fieldId, value]) => {
19224
19375
  setFieldValue(fieldId, value);
19225
19376
  });
19226
19377
  }, [restoreDraft, setFieldValue]);
19227
- const handleContinue = useCallback20(() => {
19378
+ const handleContinue = useCallback21(() => {
19228
19379
  setSubmitted(false);
19229
19380
  setSuccessInfo(null);
19230
19381
  resetForm();
19231
19382
  }, [resetForm]);
19232
- const handleViewDetail = useCallback20(() => {
19383
+ const handleViewDetail = useCallback21(() => {
19233
19384
  if (!successInfo) return;
19234
19385
  if (formType === "process") {
19235
19386
  navigateToProcessDetail(successInfo.formInstanceId);
@@ -19450,15 +19601,15 @@ var FormSubmitTemplate = ({
19450
19601
  };
19451
19602
 
19452
19603
  // packages/sdk/src/components/templates/ProcessDetailTemplate.tsx
19453
- import { useCallback as useCallback24, useMemo as useMemo34, useRef as useRef21, useState as useState40 } from "react";
19604
+ import { useCallback as useCallback25, useMemo as useMemo34, useRef as useRef21, useState as useState40 } from "react";
19454
19605
  import dayjs11 from "dayjs";
19455
19606
  import { Form as AntForm, Input as Input14, Modal as Modal11, message as message5 } from "antd";
19456
19607
 
19457
19608
  // packages/sdk/src/components/hooks/useProcessDetail.ts
19458
- import { useState as useState37, useEffect as useEffect47, useCallback as useCallback22, useRef as useRef19, useMemo as useMemo32 } from "react";
19609
+ import { useState as useState37, useEffect as useEffect47, useCallback as useCallback23, useRef as useRef19, useMemo as useMemo32 } from "react";
19459
19610
 
19460
19611
  // packages/sdk/src/components/hooks/useFieldPermission.ts
19461
- import { useMemo as useMemo31, useCallback as useCallback21 } from "react";
19612
+ import { useMemo as useMemo31, useCallback as useCallback22 } from "react";
19462
19613
  var normalizeBehavior = (value) => {
19463
19614
  if (value === "EDITABLE") return "NORMAL";
19464
19615
  if (value === "READ_ONLY") return "READONLY";
@@ -19491,7 +19642,7 @@ var normalizeFlowConfig = (config) => {
19491
19642
  };
19492
19643
  function useFieldPermission(options) {
19493
19644
  const { viewPermissions, processDefinition, currentTask, isApprover, mode } = options;
19494
- const computeBehaviors = useCallback21(() => {
19645
+ const computeBehaviors = useCallback22(() => {
19495
19646
  const behaviors = {};
19496
19647
  if (!currentTask && viewPermissions) {
19497
19648
  return normalizeFieldBehaviors(viewPermissions, mode);
@@ -19618,7 +19769,7 @@ function useProcessDetail(options) {
19618
19769
  }
19619
19770
  return actions;
19620
19771
  }, [isApprover, isProcessFinal, currentTask?.actions, canWithdraw]);
19621
- const loadData = useCallback22(async () => {
19772
+ const loadData = useCallback23(async () => {
19622
19773
  if (!mountedRef.current) return;
19623
19774
  setLoading(true);
19624
19775
  setAccessDenied(false);
@@ -19703,21 +19854,21 @@ function useProcessDetail(options) {
19703
19854
  useEffect47(() => {
19704
19855
  loadData();
19705
19856
  }, [loadData]);
19706
- const switchToEdit = useCallback22(() => {
19857
+ const switchToEdit = useCallback23(() => {
19707
19858
  setMode("edit");
19708
19859
  void loadData();
19709
19860
  }, [loadData]);
19710
- const switchToReadonly = useCallback22(() => {
19861
+ const switchToReadonly = useCallback23(() => {
19711
19862
  setMode("readonly");
19712
19863
  }, []);
19713
- const refreshDetail = useCallback22(async () => {
19864
+ const refreshDetail = useCallback23(async () => {
19714
19865
  setMode("readonly");
19715
19866
  await loadData();
19716
19867
  }, [loadData]);
19717
- const refreshProgress = useCallback22(async () => {
19868
+ const refreshProgress = useCallback23(async () => {
19718
19869
  await refreshDetail();
19719
19870
  }, [refreshDetail]);
19720
- const saveChanges = useCallback22(
19871
+ const saveChanges = useCallback23(
19721
19872
  async (values) => {
19722
19873
  try {
19723
19874
  await api.updateFormData({
@@ -19736,7 +19887,7 @@ function useProcessDetail(options) {
19736
19887
  },
19737
19888
  [api, formInstanceId, formUuid, appType, loadData]
19738
19889
  );
19739
- const deleteInstance = useCallback22(async () => {
19890
+ const deleteInstance = useCallback23(async () => {
19740
19891
  try {
19741
19892
  await deleteFormData(request, { formInstanceId, appType, formUuid });
19742
19893
  return true;
@@ -19777,7 +19928,7 @@ function useProcessDetail(options) {
19777
19928
  }
19778
19929
 
19779
19930
  // packages/sdk/src/components/hooks/useApprovalActions.ts
19780
- import { useState as useState38, useCallback as useCallback23, useRef as useRef20, useEffect as useEffect48 } from "react";
19931
+ import { useState as useState38, useCallback as useCallback24, useRef as useRef20, useEffect as useEffect48 } from "react";
19781
19932
  function useApprovalActions(options) {
19782
19933
  const { formInstanceId, formUuid, appType, currentTaskId, onActionComplete, getFormValues } = options;
19783
19934
  const { api } = useFormContext();
@@ -19793,13 +19944,13 @@ function useApprovalActions(options) {
19793
19944
  mountedRef.current = false;
19794
19945
  };
19795
19946
  }, []);
19796
- const resetLoading = useCallback23(() => {
19947
+ const resetLoading = useCallback24(() => {
19797
19948
  if (mountedRef.current) {
19798
19949
  setIsLoading(false);
19799
19950
  setCurrentAction(null);
19800
19951
  }
19801
19952
  }, []);
19802
- const approve = useCallback23(
19953
+ const approve = useCallback24(
19803
19954
  async (comments) => {
19804
19955
  setIsLoading(true);
19805
19956
  setCurrentAction("approve");
@@ -19824,7 +19975,7 @@ function useApprovalActions(options) {
19824
19975
  },
19825
19976
  [request, formInstanceId, appType, formUuid, getFormValues, onActionComplete, resetLoading]
19826
19977
  );
19827
- const reject = useCallback23(
19978
+ const reject = useCallback24(
19828
19979
  async (comments) => {
19829
19980
  setIsLoading(true);
19830
19981
  setCurrentAction("reject");
@@ -19845,7 +19996,7 @@ function useApprovalActions(options) {
19845
19996
  },
19846
19997
  [request, formInstanceId, onActionComplete, resetLoading]
19847
19998
  );
19848
- const transfer = useCallback23(
19999
+ const transfer = useCallback24(
19849
20000
  async (userId, reason) => {
19850
20001
  if (!currentTaskId) {
19851
20002
  console.error("[useApprovalActions] transfer failed: no currentTaskId");
@@ -19870,7 +20021,7 @@ function useApprovalActions(options) {
19870
20021
  },
19871
20022
  [request, currentTaskId, onActionComplete, resetLoading]
19872
20023
  );
19873
- const returnTo = useCallback23(
20024
+ const returnTo = useCallback24(
19874
20025
  async (nodeId, reason) => {
19875
20026
  if (!currentTaskId) {
19876
20027
  console.error("[useApprovalActions] returnTo failed: no currentTaskId");
@@ -19895,7 +20046,7 @@ function useApprovalActions(options) {
19895
20046
  },
19896
20047
  [request, currentTaskId, onActionComplete, resetLoading]
19897
20048
  );
19898
- const withdraw = useCallback23(
20049
+ const withdraw = useCallback24(
19899
20050
  async (reason) => {
19900
20051
  setIsLoading(true);
19901
20052
  setCurrentAction("withdraw");
@@ -19915,7 +20066,7 @@ function useApprovalActions(options) {
19915
20066
  },
19916
20067
  [request, formInstanceId, onActionComplete, resetLoading]
19917
20068
  );
19918
- const save = useCallback23(async () => {
20069
+ const save = useCallback24(async () => {
19919
20070
  setIsLoading(true);
19920
20071
  setCurrentAction("save");
19921
20072
  try {
@@ -19935,7 +20086,7 @@ function useApprovalActions(options) {
19935
20086
  return false;
19936
20087
  }
19937
20088
  }, [request, formInstanceId, formUuid, appType, getFormValues, onActionComplete, resetLoading]);
19938
- const resubmit = useCallback23(
20089
+ const resubmit = useCallback24(
19939
20090
  async (comments, selectedApprovers) => {
19940
20091
  if (!currentTaskId) {
19941
20092
  console.error("[useApprovalActions] resubmit failed: no currentTaskId");
@@ -19965,7 +20116,7 @@ function useApprovalActions(options) {
19965
20116
  },
19966
20117
  [request, currentTaskId, formUuid, appType, getFormValues, onActionComplete, resetLoading]
19967
20118
  );
19968
- const callbackTask = useCallback23(
20119
+ const callbackTask = useCallback24(
19969
20120
  async (payload) => {
19970
20121
  if (!currentTaskId) {
19971
20122
  console.error("[useApprovalActions] callbackTask failed: no currentTaskId");
@@ -19989,7 +20140,7 @@ function useApprovalActions(options) {
19989
20140
  },
19990
20141
  [request, currentTaskId, onActionComplete, resetLoading]
19991
20142
  );
19992
- const loadReturnableNodes = useCallback23(async () => {
20143
+ const loadReturnableNodes = useCallback24(async () => {
19993
20144
  if (!currentTaskId) return [];
19994
20145
  try {
19995
20146
  const result = await getReturnableNodeResult(request, currentTaskId);
@@ -20492,45 +20643,45 @@ var InnerProcessContent = ({
20492
20643
  formInstanceId,
20493
20644
  autoLoad: enableChangeRecords && canViewChangeRecords
20494
20645
  });
20495
- const validateForm = useCallback24(async () => {
20646
+ const validateForm = useCallback25(async () => {
20496
20647
  return validateRef.current ? validateAndNotify(validateRef.current) : true;
20497
20648
  }, []);
20498
- const handleApprove = useCallback24(
20649
+ const handleApprove = useCallback25(
20499
20650
  async (comments) => {
20500
20651
  if (!await validateForm()) return;
20501
20652
  await approve(comments);
20502
20653
  },
20503
20654
  [approve, validateForm]
20504
20655
  );
20505
- const handleReject = useCallback24(
20656
+ const handleReject = useCallback25(
20506
20657
  async (comments) => {
20507
20658
  await reject(comments);
20508
20659
  },
20509
20660
  [reject]
20510
20661
  );
20511
- const handleTransfer = useCallback24(
20662
+ const handleTransfer = useCallback25(
20512
20663
  async (userId, reason) => {
20513
20664
  await transfer(userId, reason);
20514
20665
  },
20515
20666
  [transfer]
20516
20667
  );
20517
- const handleReturn = useCallback24(
20668
+ const handleReturn = useCallback25(
20518
20669
  async (nodeId, reason) => {
20519
20670
  await returnTo(nodeId, reason);
20520
20671
  },
20521
20672
  [returnTo]
20522
20673
  );
20523
- const handleWithdraw = useCallback24(
20674
+ const handleWithdraw = useCallback25(
20524
20675
  async (reason) => {
20525
20676
  await withdraw(reason);
20526
20677
  },
20527
20678
  [withdraw]
20528
20679
  );
20529
- const handleSave = useCallback24(async () => {
20680
+ const handleSave = useCallback25(async () => {
20530
20681
  if (!await validateForm()) return;
20531
20682
  await save();
20532
20683
  }, [save, validateForm]);
20533
- const handleResubmit = useCallback24(
20684
+ const handleResubmit = useCallback25(
20534
20685
  async (comments) => {
20535
20686
  if (!await validateForm()) return;
20536
20687
  const values = formDataRef.current?.() ?? formData ?? {};
@@ -20564,7 +20715,7 @@ var InnerProcessContent = ({
20564
20715
  },
20565
20716
  [api.request, appType, currentTaskId, formData, formUuid, resubmit, validateForm]
20566
20717
  );
20567
- const handleInitiatorApproverConfirm = useCallback24(
20718
+ const handleInitiatorApproverConfirm = useCallback25(
20568
20719
  async (selectedUsersByNode) => {
20569
20720
  const selectedApprovers = normalizeSelectedApprovers2(selectedUsersByNode);
20570
20721
  setInitiatorApproverOpen(false);
@@ -20575,15 +20726,15 @@ var InnerProcessContent = ({
20575
20726
  },
20576
20727
  [pendingResubmitComments, resubmit]
20577
20728
  );
20578
- const handleInitiatorApproverCancel = useCallback24(() => {
20729
+ const handleInitiatorApproverCancel = useCallback25(() => {
20579
20730
  setInitiatorApproverOpen(false);
20580
20731
  setInitiatorApproverRequirements([]);
20581
20732
  setPendingResubmitComments(void 0);
20582
20733
  }, []);
20583
- const handleCallback = useCallback24(async () => {
20734
+ const handleCallback = useCallback25(async () => {
20584
20735
  await callbackTask();
20585
20736
  }, [callbackTask]);
20586
- const handleCompletedSave = useCallback24(async () => {
20737
+ const handleCompletedSave = useCallback25(async () => {
20587
20738
  if (!await validateForm()) return;
20588
20739
  const values = formDataRef.current?.() ?? formData;
20589
20740
  if (!values) return;
@@ -20597,7 +20748,7 @@ var InnerProcessContent = ({
20597
20748
  setSaveLoading(false);
20598
20749
  }
20599
20750
  }, [formData, onSave, saveChanges, validateForm]);
20600
- const handleCompletedDelete = useCallback24(async () => {
20751
+ const handleCompletedDelete = useCallback25(async () => {
20601
20752
  setDeleteLoading(true);
20602
20753
  try {
20603
20754
  const success = await deleteInstance();
@@ -20608,7 +20759,7 @@ var InnerProcessContent = ({
20608
20759
  setDeleteLoading(false);
20609
20760
  }
20610
20761
  }, [deleteInstance, onDelete]);
20611
- const handleFooterWithdraw = useCallback24(async () => {
20762
+ const handleFooterWithdraw = useCallback25(async () => {
20612
20763
  const values = await withdrawForm.validateFields();
20613
20764
  setWithdrawLoading(true);
20614
20765
  try {
@@ -20619,7 +20770,7 @@ var InnerProcessContent = ({
20619
20770
  setWithdrawLoading(false);
20620
20771
  }
20621
20772
  }, [handleWithdraw, withdrawForm]);
20622
- const handleFooterWithdrawCancel = useCallback24(() => {
20773
+ const handleFooterWithdrawCancel = useCallback25(() => {
20623
20774
  setWithdrawOpen(false);
20624
20775
  withdrawForm.resetFields();
20625
20776
  }, [withdrawForm]);
@@ -21951,7 +22102,7 @@ function AsyncEntityFilterSelect({
21951
22102
  const [options, setOptions] = useState41([]);
21952
22103
  const [fetching, setFetching] = useState41(false);
21953
22104
  const multiple = normalizeOperator(operator) === "IN";
21954
- const loadOptions = useCallback25(
22105
+ const loadOptions = useCallback26(
21955
22106
  async (keyword = "") => {
21956
22107
  setFetching(true);
21957
22108
  try {
@@ -22421,16 +22572,16 @@ var DataManagementList = ({
22421
22572
  const fetchStateRef = useRef22({});
22422
22573
  const isProcessForm = isProcessFormType(formType);
22423
22574
  const request = api.request;
22424
- const getPopupContainer = useCallback25(
22575
+ const getPopupContainer = useCallback26(
22425
22576
  (triggerNode) => resolveDataManagementPopupContainer(rootRef.current, triggerNode),
22426
22577
  []
22427
22578
  );
22428
- const getOverlayContainer = useCallback25(
22579
+ const getOverlayContainer = useCallback26(
22429
22580
  () => resolveDataManagementPortalContainer(rootRef.current),
22430
22581
  []
22431
22582
  );
22432
22583
  const drawerWidth = "min(960px, calc(100vw - 48px))";
22433
- const confirmDanger = useCallback25((title2, content, onOk) => {
22584
+ const confirmDanger = useCallback26((title2, content, onOk) => {
22434
22585
  if (confirmAction(title2, content)) onOk();
22435
22586
  }, []);
22436
22587
  const visibleFields = useMemo36(
@@ -22457,7 +22608,7 @@ var DataManagementList = ({
22457
22608
  sort
22458
22609
  };
22459
22610
  }, [current, filterGroup, pageSize, searchKeyWord, sort]);
22460
- const loadData = useCallback25(
22611
+ const loadData = useCallback26(
22461
22612
  async (overrides = {}) => {
22462
22613
  if (!appType || !formUuid) return;
22463
22614
  const fetchState = { ...fetchStateRef.current, ...overrides };
@@ -22583,7 +22734,7 @@ var DataManagementList = ({
22583
22734
  request,
22584
22735
  title
22585
22736
  ]);
22586
- const persistConfig = useCallback25(
22737
+ const persistConfig = useCallback26(
22587
22738
  async (patch) => {
22588
22739
  const personalPatch = stripForcedConfigPatch(patch, forcedConfig);
22589
22740
  const nextConfig = { ...config, ...personalPatch };
@@ -22627,12 +22778,12 @@ var DataManagementList = ({
22627
22778
  const handleRemoveSort = (index) => {
22628
22779
  setSort((prev) => prev.filter((_, itemIndex) => itemIndex !== index));
22629
22780
  };
22630
- const updateColumnWidth = useCallback25((fieldId, width) => {
22781
+ const updateColumnWidth = useCallback26((fieldId, width) => {
22631
22782
  const nextWidth = Math.round(Math.max(96, Math.min(520, width)));
22632
22783
  widthsRef.current = { ...widthsRef.current, [fieldId]: nextWidth };
22633
22784
  setWidths(widthsRef.current);
22634
22785
  }, []);
22635
- const commitColumnWidth = useCallback25(
22786
+ const commitColumnWidth = useCallback26(
22636
22787
  (fieldId, width) => {
22637
22788
  const nextWidth = Math.round(Math.max(96, Math.min(520, width)));
22638
22789
  const nextWidths = { ...widthsRef.current, [fieldId]: nextWidth };
@@ -22642,7 +22793,7 @@ var DataManagementList = ({
22642
22793
  },
22643
22794
  [persistConfig]
22644
22795
  );
22645
- const handleDetail = useCallback25(
22796
+ const handleDetail = useCallback26(
22646
22797
  (record) => {
22647
22798
  const formInstanceId = getRecordId(record);
22648
22799
  if (!formInstanceId) {
@@ -22667,7 +22818,7 @@ var DataManagementList = ({
22667
22818
  },
22668
22819
  [appType, detailBasePath, detailOpenMode, detailPageUrlBuilder, formType, formUuid]
22669
22820
  );
22670
- const handleDelete = useCallback25(
22821
+ const handleDelete = useCallback26(
22671
22822
  async (ids) => {
22672
22823
  if (ids.length === 0) return;
22673
22824
  await deleteDataManagementRows(request, { appType, formUuid, formInstanceIds: ids });
@@ -22676,7 +22827,7 @@ var DataManagementList = ({
22676
22827
  },
22677
22828
  [appType, current, formUuid, loadData, pageSize, request]
22678
22829
  );
22679
- const getSelectedRecordIds = useCallback25(
22830
+ const getSelectedRecordIds = useCallback26(
22680
22831
  () => selectedRowKeys.map((key) => {
22681
22832
  const record = dataSource.find((item) => String(getRecordId(item)) === String(key));
22682
22833
  return String(getSelectedRecordId(record, key));
@@ -23789,7 +23940,7 @@ function BuiltinRouteRenderer({
23789
23940
  );
23790
23941
  const runtimeStorage = route?.runtime?.storage;
23791
23942
  const permissionDenied = isRuntimePermissionDenied(route);
23792
- const reload = useCallback26(() => setReloadKey((value) => value + 1), []);
23943
+ const reload = useCallback27(() => setReloadKey((value) => value + 1), []);
23793
23944
  useEffect50(() => {
23794
23945
  let cancelled = false;
23795
23946
  setSchema(void 0);