openxiangda 1.0.145 → 1.0.147

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.
@@ -6920,7 +6920,7 @@ var readTicketFromLocation = () => {
6920
6920
  var readPathFromLocation = () => typeof window === "undefined" ? void 0 : window.location.pathname;
6921
6921
 
6922
6922
  // packages/sdk/src/runtime/host/builtinRouteRenderer.tsx
6923
- import { useCallback as useCallback27, useEffect as useEffect50, useMemo as useMemo37, useState as useState42 } from "react";
6923
+ import { useCallback as useCallback27, useEffect as useEffect51, useMemo as useMemo37, useState as useState42 } from "react";
6924
6924
  import { Alert as Alert4, Button as Button16, Card as Card2, Empty as Empty8, Spin as Spin6, Typography as Typography3 } from "antd";
6925
6925
 
6926
6926
  // packages/sdk/src/components/core/imageCompression.ts
@@ -7660,6 +7660,30 @@ function createFormRuntimeApi(config) {
7660
7660
  });
7661
7661
  return response.data || response.result || [];
7662
7662
  },
7663
+ searchDepartments: async (params) => {
7664
+ const page = params?.page ?? 1;
7665
+ const pageSize = params?.pageSize ?? 50;
7666
+ const response = await request({
7667
+ url: "/department/search",
7668
+ method: "get",
7669
+ params: {
7670
+ keyword: params?.keyword,
7671
+ page,
7672
+ pageSize,
7673
+ includePath: params?.includePath ?? true
7674
+ }
7675
+ });
7676
+ const data = response.data || response.result;
7677
+ if (Array.isArray(data)) {
7678
+ return { items: data, total: data.length, page, pageSize };
7679
+ }
7680
+ return {
7681
+ items: data?.items || data?.list || [],
7682
+ total: Number(data?.total ?? data?.count ?? data?.items?.length ?? 0),
7683
+ page: Number(data?.page ?? page),
7684
+ pageSize: Number(data?.pageSize ?? pageSize)
7685
+ };
7686
+ },
7663
7687
  getDepartmentParentDepartments: async (id) => {
7664
7688
  const response = await request({
7665
7689
  url: `/department/${id}/parentDepartments`,
@@ -7747,7 +7771,7 @@ function createFormRuntimeApi(config) {
7747
7771
  }
7748
7772
 
7749
7773
  // packages/sdk/src/components/modules/DataManagementList.tsx
7750
- import { useCallback as useCallback26, useEffect as useEffect49, useMemo as useMemo36, useRef as useRef22, useState as useState41 } from "react";
7774
+ import { useCallback as useCallback26, useEffect as useEffect50, useMemo as useMemo36, useRef as useRef23, useState as useState41 } from "react";
7751
7775
  import {
7752
7776
  Alert as Alert3,
7753
7777
  Button as Button15,
@@ -7789,11 +7813,11 @@ import {
7789
7813
  import { useMemo as useMemo35 } from "react";
7790
7814
 
7791
7815
  // packages/sdk/src/components/templates/FormDetailTemplate.tsx
7792
- import { useCallback as useCallback18, useMemo as useMemo30, useRef as useRef16, useState as useState33 } from "react";
7816
+ import { useCallback as useCallback18, useMemo as useMemo30, useRef as useRef17, useState as useState33 } from "react";
7793
7817
  import dayjs10 from "dayjs";
7794
7818
 
7795
7819
  // packages/sdk/src/components/core/FormProvider.tsx
7796
- import React54, { useCallback as useCallback15, useEffect as useEffect40, useRef as useRef13, useState as useState26, useMemo as useMemo28 } from "react";
7820
+ import React54, { useCallback as useCallback15, useEffect as useEffect41, useRef as useRef14, useState as useState26, useMemo as useMemo28 } from "react";
7797
7821
 
7798
7822
  // packages/sdk/src/components/core/FormContext.ts
7799
7823
  import { createContext as createContext3, useContext as useContext3 } from "react";
@@ -13237,14 +13261,29 @@ function UserSelectField(props) {
13237
13261
  }
13238
13262
 
13239
13263
  // packages/sdk/src/components/fields/DepartmentSelectField/index.tsx
13240
- import { useEffect as useEffect31 } from "react";
13264
+ import { useEffect as useEffect32 } from "react";
13241
13265
 
13242
13266
  // packages/sdk/src/components/fields/DepartmentSelectField/DepartmentSelectFieldPC.tsx
13243
- import { useEffect as useEffect29, useMemo as useMemo22, useRef as useRef8, useState as useState19 } from "react";
13267
+ import { useEffect as useEffect30, useMemo as useMemo22, useRef as useRef9, useState as useState19 } from "react";
13244
13268
  import { TreeSelect } from "antd";
13245
13269
 
13270
+ // packages/sdk/src/components/fields/shared/departmentSearch.ts
13271
+ function canSearchAllDepartments(api, configuredTreeData) {
13272
+ return !configuredTreeData?.length && typeof api.searchDepartments === "function";
13273
+ }
13274
+ function normalizeDepartmentSearchItems(result) {
13275
+ const data = result?.data || result?.result || result;
13276
+ const source = Array.isArray(data) ? data : data?.items || data?.list || [];
13277
+ return source.map((item) => normalizeDepartmentNode(item)).filter((item) => item.id);
13278
+ }
13279
+ function getDepartmentPathText(department, separator = "/") {
13280
+ const path = Array.isArray(department?.path) ? department.path : [];
13281
+ const pathText = path.map((item) => item?.name).filter(Boolean).join(separator);
13282
+ return pathText || String(department?.fullPath || getDepartmentName(department) || "");
13283
+ }
13284
+
13246
13285
  // packages/sdk/src/components/fields/shared/DepartmentPicker.tsx
13247
- import { useMemo as useMemo21, useState as useState18 } from "react";
13286
+ import { useEffect as useEffect29, useMemo as useMemo21, useRef as useRef8, useState as useState18 } from "react";
13248
13287
  import { Button as Button6, Checkbox as Checkbox3, Empty as Empty4, Input as Input8, List as List2, Modal as Modal5, Space as Space4, Spin as Spin2, Tag as Tag4, Tree as Tree2 } from "antd";
13249
13288
  import { ApartmentOutlined, SearchOutlined as SearchOutlined3 } from "@ant-design/icons";
13250
13289
  import * as MobileAntd3 from "antd-mobile";
@@ -13257,7 +13296,11 @@ var getMobileComponent2 = (name) => {
13257
13296
  }
13258
13297
  };
13259
13298
  function normalizeSelection(items) {
13260
- return items.map((item) => ({ id: String(item.id || ""), name: String(item.name || item.id || "") })).filter((item) => item.id);
13299
+ return items.map((item) => ({
13300
+ id: String(item.id || ""),
13301
+ name: String(item.name || item.id || ""),
13302
+ fullPath: item.fullPath
13303
+ })).filter((item) => item.id);
13261
13304
  }
13262
13305
  function matchSearch(nodes, keyword) {
13263
13306
  if (!keyword) return nodes;
@@ -13278,7 +13321,12 @@ function DepartmentPickerPanel({
13278
13321
  treeData,
13279
13322
  onConfirm,
13280
13323
  onCancel,
13281
- mobile = false
13324
+ mobile = false,
13325
+ showSearch = true,
13326
+ searchScope = "loaded",
13327
+ showFullPath = false,
13328
+ searchMinLength = 1,
13329
+ searchDebounceMs = 300
13282
13330
  }) {
13283
13331
  const {
13284
13332
  treeData: loadedTreeData,
@@ -13292,11 +13340,53 @@ function DepartmentPickerPanel({
13292
13340
  const [selected, setSelected] = useState18(() => normalizeSelection(value));
13293
13341
  const [expandedKeys, setExpandedKeys] = useState18([]);
13294
13342
  const [currentDeptId, setCurrentDeptId] = useState18(null);
13343
+ const [remoteSearchResults, setRemoteSearchResults] = useState18([]);
13344
+ const [remoteSearchLoading, setRemoteSearchLoading] = useState18(false);
13345
+ const [remoteSearchError, setRemoteSearchError] = useState18("");
13346
+ const searchSeqRef = useRef8(0);
13295
13347
  const selectedIds = selected.map((item) => item.id);
13296
13348
  const MobileSearchBar = getMobileComponent2("SearchBar");
13349
+ const trimmedKeyword = keyword.trim();
13350
+ const canRemoteSearch = showSearch && searchScope === "all" && trimmedKeyword.length >= searchMinLength && canSearchAllDepartments(api, treeData);
13351
+ const spinning = treeLoading || remoteSearchLoading;
13352
+ useEffect29(() => {
13353
+ if (!canRemoteSearch) {
13354
+ searchSeqRef.current += 1;
13355
+ setRemoteSearchResults([]);
13356
+ setRemoteSearchLoading(false);
13357
+ setRemoteSearchError("");
13358
+ return;
13359
+ }
13360
+ const seq = searchSeqRef.current + 1;
13361
+ searchSeqRef.current = seq;
13362
+ setRemoteSearchLoading(true);
13363
+ setRemoteSearchError("");
13364
+ const timer = window.setTimeout(() => {
13365
+ api.searchDepartments?.({
13366
+ keyword: trimmedKeyword,
13367
+ page: 1,
13368
+ pageSize: 50,
13369
+ includePath: true
13370
+ }).then((result) => {
13371
+ if (searchSeqRef.current !== seq) return;
13372
+ setRemoteSearchResults(normalizeDepartmentSearchItems(result));
13373
+ }).catch((error) => {
13374
+ if (searchSeqRef.current !== seq) return;
13375
+ setRemoteSearchResults([]);
13376
+ setRemoteSearchError(error?.message || "\u641C\u7D22\u5931\u8D25");
13377
+ }).finally(() => {
13378
+ if (searchSeqRef.current === seq) {
13379
+ setRemoteSearchLoading(false);
13380
+ }
13381
+ });
13382
+ }, searchDebounceMs);
13383
+ return () => {
13384
+ window.clearTimeout(timer);
13385
+ };
13386
+ }, [api, canRemoteSearch, searchDebounceMs, trimmedKeyword]);
13297
13387
  const filteredTreeData = useMemo21(
13298
- () => matchSearch(loadedTreeData, keyword.trim()),
13299
- [keyword, loadedTreeData]
13388
+ () => showSearch ? matchSearch(loadedTreeData, trimmedKeyword) : loadedTreeData,
13389
+ [loadedTreeData, showSearch, trimmedKeyword]
13300
13390
  );
13301
13391
  const currentPath = useMemo21(() => {
13302
13392
  if (!currentDeptId) return [];
@@ -13311,13 +13401,36 @@ function DepartmentPickerPanel({
13311
13401
  return path;
13312
13402
  }, [currentDeptId, nodeMap, parentMap]);
13313
13403
  const mobileList = useMemo21(() => {
13314
- if (keyword.trim()) {
13315
- const lower = keyword.trim().toLowerCase();
13404
+ if (canRemoteSearch) {
13405
+ return remoteSearchResults;
13406
+ }
13407
+ if (showSearch && trimmedKeyword) {
13408
+ const lower = trimmedKeyword.toLowerCase();
13316
13409
  return flatNodes.filter((item) => item.name.toLowerCase().includes(lower)).map((item) => item.node);
13317
13410
  }
13318
13411
  if (!currentDeptId) return loadedTreeData;
13319
13412
  return nodeMap.get(currentDeptId)?.children || [];
13320
- }, [currentDeptId, flatNodes, keyword, loadedTreeData, nodeMap]);
13413
+ }, [
13414
+ canRemoteSearch,
13415
+ currentDeptId,
13416
+ flatNodes,
13417
+ loadedTreeData,
13418
+ nodeMap,
13419
+ remoteSearchResults,
13420
+ showSearch,
13421
+ trimmedKeyword
13422
+ ]);
13423
+ const getNodeValue = (node) => {
13424
+ const id = getDepartmentId(node);
13425
+ const name = getDepartmentName(node);
13426
+ const fullPath = getDepartmentPathText(node);
13427
+ return {
13428
+ id,
13429
+ name,
13430
+ ...fullPath && fullPath !== name ? { fullPath } : {}
13431
+ };
13432
+ };
13433
+ const getSelectedLabel = (item) => showFullPath ? item.fullPath || item.name : item.name;
13321
13434
  const upsertSelected = (department, checked) => {
13322
13435
  if (multiple) {
13323
13436
  setSelected((prev) => {
@@ -13334,14 +13447,14 @@ function DepartmentPickerPanel({
13334
13447
  const checkedKeys = Array.isArray(keys) ? keys : keys.checked;
13335
13448
  const next = checkedKeys.map((key) => {
13336
13449
  const node = nodeMap.get(String(key));
13337
- return node ? { id: getDepartmentId(node), name: getDepartmentName(node) } : void 0;
13450
+ return node ? getNodeValue(node) : void 0;
13338
13451
  }).filter(Boolean);
13339
13452
  setSelected(next);
13340
13453
  };
13341
13454
  const handleTreeSelect = (keys) => {
13342
13455
  const id = String(keys[0] || "");
13343
13456
  const node = id ? nodeMap.get(id) : void 0;
13344
- setSelected(node ? [{ id, name: getDepartmentName(node) }] : []);
13457
+ setSelected(node ? [getNodeValue(node)] : []);
13345
13458
  };
13346
13459
  const renderSelected = () => /* @__PURE__ */ jsxs30("div", { className: "sy-org-picker-selected", children: [
13347
13460
  /* @__PURE__ */ jsxs30("div", { className: "sy-org-picker-selected-head", children: [
@@ -13351,8 +13464,51 @@ function DepartmentPickerPanel({
13351
13464
  ] }),
13352
13465
  /* @__PURE__ */ jsx71("button", { type: "button", onClick: () => setSelected([]), disabled: !selected.length, children: "\u6E05\u7A7A" })
13353
13466
  ] }),
13354
- selected.length ? /* @__PURE__ */ jsx71("div", { className: "sy-org-picker-tags", children: selected.map((item) => /* @__PURE__ */ jsx71(Tag4, { closable: true, onClose: () => upsertSelected(item, false), children: item.name }, item.id)) }) : /* @__PURE__ */ jsx71(Empty4, { image: Empty4.PRESENTED_IMAGE_SIMPLE, description: "\u6682\u65E0\u9009\u62E9" })
13467
+ selected.length ? /* @__PURE__ */ jsx71("div", { className: "sy-org-picker-tags", children: selected.map((item) => /* @__PURE__ */ jsx71(Tag4, { closable: true, onClose: () => upsertSelected(item, false), children: getSelectedLabel(item) }, item.id)) }) : /* @__PURE__ */ jsx71(Empty4, { image: Empty4.PRESENTED_IMAGE_SIMPLE, description: "\u6682\u65E0\u9009\u62E9" })
13355
13468
  ] });
13469
+ const renderRemoteSearchResults = () => /* @__PURE__ */ jsx71(
13470
+ List2,
13471
+ {
13472
+ dataSource: remoteSearchResults,
13473
+ locale: { emptyText: remoteSearchError || "\u6682\u65E0\u90E8\u95E8" },
13474
+ renderItem: (node) => {
13475
+ const id = getDepartmentId(node);
13476
+ const name = getDepartmentName(node);
13477
+ const selectedNow = selectedIds.includes(id);
13478
+ const pathText = getDepartmentPathText(node);
13479
+ return /* @__PURE__ */ jsx71(
13480
+ List2.Item,
13481
+ {
13482
+ onClick: () => upsertSelected(getNodeValue(node), true),
13483
+ actions: [
13484
+ /* @__PURE__ */ jsx71(
13485
+ Checkbox3,
13486
+ {
13487
+ checked: selectedNow,
13488
+ onChange: (event) => upsertSelected(getNodeValue(node), event.target.checked)
13489
+ },
13490
+ "select"
13491
+ )
13492
+ ],
13493
+ children: /* @__PURE__ */ jsx71(
13494
+ List2.Item.Meta,
13495
+ {
13496
+ avatar: /* @__PURE__ */ jsx71(ApartmentOutlined, {}),
13497
+ title: /* @__PURE__ */ jsxs30("span", { children: [
13498
+ /* @__PURE__ */ jsx71("span", { children: name }),
13499
+ showFullPath && pathText && pathText !== name ? /* @__PURE__ */ jsxs30("span", { className: "sy-org-picker-path", children: [
13500
+ " ",
13501
+ pathText
13502
+ ] }) : null
13503
+ ] })
13504
+ }
13505
+ )
13506
+ },
13507
+ id
13508
+ );
13509
+ }
13510
+ }
13511
+ );
13356
13512
  if (mobile) {
13357
13513
  return /* @__PURE__ */ jsxs30("div", { className: "sy-org-picker sy-org-picker-mobile", children: [
13358
13514
  /* @__PURE__ */ jsxs30("div", { className: "sy-org-picker-mobile-head", children: [
@@ -13360,7 +13516,7 @@ function DepartmentPickerPanel({
13360
13516
  /* @__PURE__ */ jsx71("strong", { children: "\u9009\u62E9\u90E8\u95E8" }),
13361
13517
  /* @__PURE__ */ jsx71("button", { type: "button", onClick: () => onConfirm(selected), children: "\u786E\u5B9A" })
13362
13518
  ] }),
13363
- MobileSearchBar ? /* @__PURE__ */ jsx71(MobileSearchBar, { placeholder: "\u641C\u7D22\u90E8\u95E8", value: keyword, onChange: setKeyword }) : /* @__PURE__ */ jsx71("input", { value: keyword, onChange: (event) => setKeyword(event.target.value) }),
13519
+ showSearch ? MobileSearchBar ? /* @__PURE__ */ jsx71(MobileSearchBar, { placeholder: "\u641C\u7D22\u90E8\u95E8", value: keyword, onChange: setKeyword }) : /* @__PURE__ */ jsx71("input", { value: keyword, onChange: (event) => setKeyword(event.target.value) }) : null,
13364
13520
  /* @__PURE__ */ jsxs30("div", { className: "sy-org-picker-breadcrumb", children: [
13365
13521
  /* @__PURE__ */ jsx71("button", { type: "button", onClick: () => setCurrentDeptId(null), children: "\u90E8\u95E8" }),
13366
13522
  currentPath.map((item) => /* @__PURE__ */ jsxs30("button", { type: "button", onClick: () => setCurrentDeptId(item.id), children: [
@@ -13368,16 +13524,17 @@ function DepartmentPickerPanel({
13368
13524
  item.name
13369
13525
  ] }, item.id))
13370
13526
  ] }),
13371
- /* @__PURE__ */ jsx71(Spin2, { spinning: treeLoading, children: /* @__PURE__ */ jsx71(
13527
+ /* @__PURE__ */ jsx71(Spin2, { spinning, children: /* @__PURE__ */ jsx71(
13372
13528
  List2,
13373
13529
  {
13374
13530
  dataSource: mobileList,
13375
- locale: { emptyText: "\u6682\u65E0\u90E8\u95E8" },
13531
+ locale: { emptyText: remoteSearchError || "\u6682\u65E0\u90E8\u95E8" },
13376
13532
  renderItem: (node) => {
13377
13533
  const id = getDepartmentId(node);
13378
13534
  const name = getDepartmentName(node);
13379
13535
  const selectedNow = selectedIds.includes(id);
13380
- const hasChildren = Boolean(node.hasChildren && !node.isLeaf);
13536
+ const hasChildren = !canRemoteSearch && Boolean(node.hasChildren && !node.isLeaf);
13537
+ const pathText = getDepartmentPathText(node);
13381
13538
  return /* @__PURE__ */ jsx71(
13382
13539
  List2.Item,
13383
13540
  {
@@ -13386,7 +13543,7 @@ function DepartmentPickerPanel({
13386
13543
  Checkbox3,
13387
13544
  {
13388
13545
  checked: selectedNow,
13389
- onChange: (event) => upsertSelected({ id, name }, event.target.checked)
13546
+ onChange: (event) => upsertSelected(getNodeValue(node), event.target.checked)
13390
13547
  },
13391
13548
  "select"
13392
13549
  ),
@@ -13404,7 +13561,19 @@ function DepartmentPickerPanel({
13404
13561
  "children"
13405
13562
  ) : null
13406
13563
  ],
13407
- children: /* @__PURE__ */ jsx71(List2.Item.Meta, { avatar: /* @__PURE__ */ jsx71(ApartmentOutlined, {}), title: name })
13564
+ children: /* @__PURE__ */ jsx71(
13565
+ List2.Item.Meta,
13566
+ {
13567
+ avatar: /* @__PURE__ */ jsx71(ApartmentOutlined, {}),
13568
+ title: /* @__PURE__ */ jsxs30("span", { children: [
13569
+ /* @__PURE__ */ jsx71("span", { children: name }),
13570
+ showFullPath && pathText && pathText !== name ? /* @__PURE__ */ jsxs30("span", { className: "sy-org-picker-path", children: [
13571
+ " ",
13572
+ pathText
13573
+ ] }) : null
13574
+ ] })
13575
+ }
13576
+ )
13408
13577
  },
13409
13578
  id
13410
13579
  );
@@ -13417,7 +13586,7 @@ function DepartmentPickerPanel({
13417
13586
  return /* @__PURE__ */ jsxs30("div", { className: "sy-org-picker", children: [
13418
13587
  /* @__PURE__ */ jsxs30("div", { className: "sy-org-picker-main", children: [
13419
13588
  /* @__PURE__ */ jsxs30("div", { className: "sy-org-picker-tree", children: [
13420
- /* @__PURE__ */ jsx71(
13589
+ showSearch ? /* @__PURE__ */ jsx71(
13421
13590
  Input8,
13422
13591
  {
13423
13592
  allowClear: true,
@@ -13426,8 +13595,8 @@ function DepartmentPickerPanel({
13426
13595
  value: keyword,
13427
13596
  onChange: (event) => setKeyword(event.target.value)
13428
13597
  }
13429
- ),
13430
- /* @__PURE__ */ jsx71(Spin2, { spinning: treeLoading, children: /* @__PURE__ */ jsx71(
13598
+ ) : null,
13599
+ /* @__PURE__ */ jsx71(Spin2, { spinning, children: canRemoteSearch ? renderRemoteSearchResults() : /* @__PURE__ */ jsx71(
13431
13600
  Tree2,
13432
13601
  {
13433
13602
  checkable: multiple,
@@ -13517,6 +13686,17 @@ function convertTreeData(nodes) {
13517
13686
  children: node.children ? convertTreeData(node.children) : void 0
13518
13687
  }));
13519
13688
  }
13689
+ function convertSearchTreeData(nodes, showFullPath) {
13690
+ return nodes.map((node) => {
13691
+ const name = getDepartmentName(node);
13692
+ const pathText = getDepartmentPathText(node);
13693
+ return {
13694
+ value: getDepartmentId(node),
13695
+ title: showFullPath && pathText ? pathText : name,
13696
+ isLeaf: true
13697
+ };
13698
+ });
13699
+ }
13520
13700
  function DepartmentSelectFieldPC({
13521
13701
  fieldId,
13522
13702
  behavior,
@@ -13526,6 +13706,11 @@ function DepartmentSelectFieldPC({
13526
13706
  treeData,
13527
13707
  allowClear = true,
13528
13708
  maxCount,
13709
+ notFoundContent,
13710
+ showSearch = true,
13711
+ searchScope = "loaded",
13712
+ searchMinLength = 1,
13713
+ searchDebounceMs = 300,
13529
13714
  showFullPath,
13530
13715
  scopeType,
13531
13716
  specifiedDepts,
@@ -13536,10 +13721,15 @@ function DepartmentSelectFieldPC({
13536
13721
  const value = useMemo22(() => normalizeDepartmentArray(rawValue), [rawValue]);
13537
13722
  const disabled = behavior === "DISABLED";
13538
13723
  const configuredTreeData = treeData ?? EMPTY_TREE_DATA;
13539
- const remoteLoadedRef = useRef8(false);
13724
+ const remoteLoadedRef = useRef9(false);
13540
13725
  const [loadedTreeData, setLoadedTreeData] = useState19(configuredTreeData);
13541
13726
  const [pickerOpen, setPickerOpen] = useState19(false);
13542
- useEffect29(() => {
13727
+ const [searchKeyword, setSearchKeyword] = useState19("");
13728
+ const [remoteSearchResults, setRemoteSearchResults] = useState19([]);
13729
+ const [remoteSearchLoading, setRemoteSearchLoading] = useState19(false);
13730
+ const [selectedPathMap, setSelectedPathMap] = useState19({});
13731
+ const searchSeqRef = useRef9(0);
13732
+ useEffect30(() => {
13543
13733
  if (configuredTreeData.length) {
13544
13734
  setLoadedTreeData(configuredTreeData.map(normalizeDepartmentNode));
13545
13735
  return;
@@ -13550,22 +13740,87 @@ function DepartmentSelectFieldPC({
13550
13740
  (nodes) => setLoadedTreeData(nodes.map(normalizeDepartmentNode))
13551
13741
  );
13552
13742
  }, [api, configuredTreeData]);
13743
+ const trimmedSearchKeyword = searchKeyword.trim();
13744
+ const canRemoteSearch = showSearch && searchScope === "all" && trimmedSearchKeyword.length >= searchMinLength && canSearchAllDepartments(api, configuredTreeData);
13745
+ useEffect30(() => {
13746
+ if (!canRemoteSearch) {
13747
+ searchSeqRef.current += 1;
13748
+ setRemoteSearchResults([]);
13749
+ setRemoteSearchLoading(false);
13750
+ return;
13751
+ }
13752
+ const seq = searchSeqRef.current + 1;
13753
+ searchSeqRef.current = seq;
13754
+ setRemoteSearchLoading(true);
13755
+ const timer = window.setTimeout(() => {
13756
+ api.searchDepartments?.({
13757
+ keyword: trimmedSearchKeyword,
13758
+ page: 1,
13759
+ pageSize: 50,
13760
+ includePath: true
13761
+ }).then((result) => {
13762
+ if (searchSeqRef.current !== seq) return;
13763
+ setRemoteSearchResults(normalizeDepartmentSearchItems(result));
13764
+ }).catch(() => {
13765
+ if (searchSeqRef.current !== seq) return;
13766
+ setRemoteSearchResults([]);
13767
+ }).finally(() => {
13768
+ if (searchSeqRef.current === seq) {
13769
+ setRemoteSearchLoading(false);
13770
+ }
13771
+ });
13772
+ }, searchDebounceMs);
13773
+ return () => {
13774
+ window.clearTimeout(timer);
13775
+ };
13776
+ }, [api, canRemoteSearch, searchDebounceMs, trimmedSearchKeyword]);
13553
13777
  const scopedTreeData = filterTreeByScope(loadedTreeData, scopeType, specifiedDepts);
13554
13778
  const allDepts = flattenDepartments(scopedTreeData);
13779
+ const scopedRemoteSearchResults = useMemo22(() => {
13780
+ if (scopeType !== "specified" || !specifiedDepts?.length) {
13781
+ return remoteSearchResults;
13782
+ }
13783
+ const specifiedSet = new Set(specifiedDepts);
13784
+ return remoteSearchResults.filter((node) => {
13785
+ const id = getDepartmentId(node);
13786
+ if (specifiedSet.has(id)) return true;
13787
+ return node.path?.some((item) => specifiedSet.has(item.id));
13788
+ });
13789
+ }, [remoteSearchResults, scopeType, specifiedDepts]);
13790
+ const remoteDeptMap = useMemo22(() => {
13791
+ const map = /* @__PURE__ */ new Map();
13792
+ scopedRemoteSearchResults.forEach((node) => map.set(getDepartmentId(node), node));
13793
+ return map;
13794
+ }, [scopedRemoteSearchResults]);
13555
13795
  const handleChange = (selectedValue) => {
13556
13796
  const selectedValues = Array.isArray(selectedValue) ? selectedValue : selectedValue ? [selectedValue] : [];
13797
+ const nextPathMap = { ...selectedPathMap };
13557
13798
  const selected = selectedValues.map((item) => {
13558
13799
  const id = String(item?.value ?? item);
13559
13800
  const label = item?.label;
13560
- const matched = allDepts.find((dept) => dept.id === id) ?? value.find((dept) => getDepartmentId(dept) === id);
13801
+ const remoteDept = remoteDeptMap.get(id);
13802
+ const matched = remoteDept ?? allDepts.find((dept) => dept.id === id)?.node ?? value.find((dept) => getDepartmentId(dept) === id);
13803
+ if (remoteDept) {
13804
+ nextPathMap[id] = getDepartmentPathText(remoteDept);
13805
+ }
13561
13806
  const labelText = typeof label === "string" || typeof label === "number" ? String(label) : void 0;
13562
- return { id, name: labelText || matched?.name || id };
13807
+ return { id, name: getDepartmentName(matched) || labelText || id };
13563
13808
  }).filter((item) => item.id);
13564
13809
  const result = (multiple ? selected.slice(0, maxCount ?? selected.length) : selected.slice(0, 1)).map(toDepartmentValue);
13810
+ setSelectedPathMap(nextPathMap);
13565
13811
  setFieldValue(fieldId, result);
13566
13812
  onChange?.(result);
13567
13813
  };
13568
13814
  const handlePickerConfirm = (items) => {
13815
+ setSelectedPathMap((current) => {
13816
+ const next = { ...current };
13817
+ items.forEach((item) => {
13818
+ if (item.fullPath) {
13819
+ next[item.id] = String(item.fullPath);
13820
+ }
13821
+ });
13822
+ return next;
13823
+ });
13569
13824
  const result = (multiple ? items.slice(0, maxCount ?? items.length) : items.slice(0, 1)).map(
13570
13825
  toDepartmentValue
13571
13826
  );
@@ -13573,12 +13828,19 @@ function DepartmentSelectFieldPC({
13573
13828
  onChange?.(result);
13574
13829
  };
13575
13830
  const treeDataConverted = convertTreeData(scopedTreeData);
13831
+ const searchTreeDataConverted = convertSearchTreeData(scopedRemoteSearchResults, showFullPath);
13832
+ const renderedTreeData = canRemoteSearch ? searchTreeDataConverted : treeDataConverted;
13833
+ const getDisplayLabel2 = (dept) => {
13834
+ const id = getDepartmentId(dept);
13835
+ if (!showFullPath) return getDepartmentName(dept);
13836
+ return getDepartmentFullPath(id, scopedTreeData) || selectedPathMap[id] || (remoteDeptMap.has(id) ? getDepartmentPathText(remoteDeptMap.get(id)) : "") || getDepartmentName(dept);
13837
+ };
13576
13838
  const selectValue = multiple ? value.map((d) => ({
13577
13839
  value: getDepartmentId(d),
13578
- label: showFullPath ? getDepartmentFullPath(getDepartmentId(d), scopedTreeData) || getDepartmentName(d) : getDepartmentName(d)
13840
+ label: getDisplayLabel2(d)
13579
13841
  })) : value[0] ? {
13580
13842
  value: getDepartmentId(value[0]),
13581
- label: showFullPath ? getDepartmentFullPath(getDepartmentId(value[0]), scopedTreeData) || getDepartmentName(value[0]) : getDepartmentName(value[0])
13843
+ label: getDisplayLabel2(value[0])
13582
13844
  } : void 0;
13583
13845
  return /* @__PURE__ */ jsxs31("div", { className: "sy-select-with-picker", children: [
13584
13846
  /* @__PURE__ */ jsx72(
@@ -13590,9 +13852,14 @@ function DepartmentSelectFieldPC({
13590
13852
  maxCount,
13591
13853
  allowClear,
13592
13854
  labelInValue: true,
13593
- treeData: treeDataConverted,
13855
+ showSearch,
13856
+ searchValue: searchKeyword,
13857
+ onSearch: setSearchKeyword,
13858
+ filterTreeNode: canRemoteSearch ? false : void 0,
13859
+ treeData: renderedTreeData,
13594
13860
  value: selectValue,
13595
13861
  placeholder,
13862
+ notFoundContent: remoteSearchLoading ? "\u641C\u7D22\u4E2D..." : notFoundContent || "\u6682\u65E0\u90E8\u95E8",
13596
13863
  disabled,
13597
13864
  onChange: handleChange,
13598
13865
  loadData: async (node) => {
@@ -13636,6 +13903,11 @@ function DepartmentSelectFieldPC({
13636
13903
  multiple,
13637
13904
  value,
13638
13905
  treeData,
13906
+ showSearch,
13907
+ searchScope,
13908
+ showFullPath,
13909
+ searchMinLength,
13910
+ searchDebounceMs,
13639
13911
  onConfirm: handlePickerConfirm,
13640
13912
  onCancel: () => void 0
13641
13913
  }
@@ -13644,7 +13916,7 @@ function DepartmentSelectFieldPC({
13644
13916
  }
13645
13917
 
13646
13918
  // packages/sdk/src/components/fields/DepartmentSelectField/DepartmentSelectFieldMobile.tsx
13647
- import { useEffect as useEffect30, useMemo as useMemo23, useRef as useRef9, useState as useState20 } from "react";
13919
+ import { useEffect as useEffect31, useMemo as useMemo23, useRef as useRef10, useState as useState20 } from "react";
13648
13920
  import * as MobileAntd4 from "antd-mobile";
13649
13921
  import { jsx as jsx73, jsxs as jsxs32 } from "react/jsx-runtime";
13650
13922
  var EMPTY_TREE_DATA2 = [];
@@ -13668,6 +13940,10 @@ function DepartmentSelectFieldMobile({
13668
13940
  treeData,
13669
13941
  allowClear = true,
13670
13942
  maxCount,
13943
+ showSearch = true,
13944
+ searchScope = "loaded",
13945
+ searchMinLength = 1,
13946
+ searchDebounceMs = 300,
13671
13947
  showFullPath,
13672
13948
  scopeType,
13673
13949
  specifiedDepts,
@@ -13679,9 +13955,9 @@ function DepartmentSelectFieldMobile({
13679
13955
  const disabled = behavior === "DISABLED";
13680
13956
  const [showPicker, setShowPicker] = useState20(false);
13681
13957
  const configuredTreeData = treeData ?? EMPTY_TREE_DATA2;
13682
- const remoteLoadedRef = useRef9(false);
13958
+ const remoteLoadedRef = useRef10(false);
13683
13959
  const [loadedTreeData, setLoadedTreeData] = useState20(configuredTreeData);
13684
- useEffect30(() => {
13960
+ useEffect31(() => {
13685
13961
  if (configuredTreeData.length) {
13686
13962
  setLoadedTreeData(configuredTreeData.map(normalizeDepartmentNode));
13687
13963
  }
@@ -13755,6 +14031,11 @@ function DepartmentSelectFieldMobile({
13755
14031
  multiple,
13756
14032
  value,
13757
14033
  treeData,
14034
+ showSearch,
14035
+ searchScope,
14036
+ showFullPath,
14037
+ searchMinLength,
14038
+ searchDebounceMs,
13758
14039
  onConfirm: handleConfirm,
13759
14040
  onCancel: () => setShowPicker(false)
13760
14041
  }
@@ -13816,7 +14097,7 @@ function DepartmentSelectField(props) {
13816
14097
  const { fieldBehaviors, setFieldValue, formData, registerField, unregisterField } = useFormContext();
13817
14098
  const { isMobile } = useDeviceDetect();
13818
14099
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
13819
- useEffect31(() => {
14100
+ useEffect32(() => {
13820
14101
  registerField(fieldId);
13821
14102
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
13822
14103
  setFieldValue(fieldId, defaultValue);
@@ -13841,7 +14122,7 @@ function DepartmentSelectField(props) {
13841
14122
  }
13842
14123
 
13843
14124
  // packages/sdk/src/components/fields/CascadeSelectField/index.tsx
13844
- import { useEffect as useEffect32 } from "react";
14125
+ import { useEffect as useEffect33 } from "react";
13845
14126
  import { Cascader } from "antd";
13846
14127
  import { jsx as jsx76 } from "react/jsx-runtime";
13847
14128
  var toValuePath = (value, multiple) => {
@@ -13880,7 +14161,7 @@ function CascadeSelectField(props) {
13880
14161
  const { formData, fieldBehaviors, setFieldValue, registerField, unregisterField } = useFormContext();
13881
14162
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
13882
14163
  const value = formData[fieldId] ?? (multiple ? [] : []);
13883
- useEffect32(() => {
14164
+ useEffect33(() => {
13884
14165
  registerField(fieldId);
13885
14166
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
13886
14167
  setFieldValue(fieldId, defaultValue);
@@ -13933,7 +14214,7 @@ function CascadeSelectField(props) {
13933
14214
  }
13934
14215
 
13935
14216
  // packages/sdk/src/components/fields/AddressField/index.tsx
13936
- import { useCallback as useCallback11, useEffect as useEffect33, useMemo as useMemo25, useState as useState21 } from "react";
14217
+ import { useCallback as useCallback11, useEffect as useEffect34, useMemo as useMemo25, useState as useState21 } from "react";
13937
14218
  import { Button as Button7, Cascader as Cascader2, Input as Input9, Space as Space5, Spin as Spin3 } from "antd";
13938
14219
  import * as MobileAntd5 from "antd-mobile";
13939
14220
  import { jsx as jsx77, jsxs as jsxs33 } from "react/jsx-runtime";
@@ -14097,11 +14378,11 @@ function AddressField(props) {
14097
14378
  const detailEnabled = mode === "province-city-district-street-detail";
14098
14379
  const disabled = behavior === "DISABLED";
14099
14380
  const MobilePopup = getMobileComponent3("Popup");
14100
- useEffect33(() => {
14381
+ useEffect34(() => {
14101
14382
  registerField(fieldId);
14102
14383
  return () => unregisterField(fieldId);
14103
14384
  }, [fieldId, registerField, unregisterField]);
14104
- useEffect33(() => {
14385
+ useEffect34(() => {
14105
14386
  if (defaultValue !== void 0 && rawValue === void 0) {
14106
14387
  setFieldValue(fieldId, defaultValue);
14107
14388
  }
@@ -14113,7 +14394,7 @@ function AddressField(props) {
14113
14394
  },
14114
14395
  [api, depth]
14115
14396
  );
14116
- useEffect33(() => {
14397
+ useEffect34(() => {
14117
14398
  let mounted = true;
14118
14399
  setLoadingRoots(true);
14119
14400
  loadDivisions(void 0, "province", 0).then((nextOptions) => {
@@ -14125,7 +14406,7 @@ function AddressField(props) {
14125
14406
  mounted = false;
14126
14407
  };
14127
14408
  }, [loadDivisions]);
14128
- useEffect33(() => {
14409
+ useEffect34(() => {
14129
14410
  if (!value) return;
14130
14411
  let cancelled = false;
14131
14412
  const hydrateMissingLabels = async () => {
@@ -14161,7 +14442,7 @@ function AddressField(props) {
14161
14442
  cancelled = true;
14162
14443
  };
14163
14444
  }, [fieldId, levels, loadDivisions, setFieldValue, value]);
14164
- useEffect33(() => {
14445
+ useEffect34(() => {
14165
14446
  if (!mobileOpen) return;
14166
14447
  const level = levels[mobileLevelIndex] || "province";
14167
14448
  const parentLevel = levels[mobileLevelIndex - 1];
@@ -14341,7 +14622,7 @@ function AddressField(props) {
14341
14622
  }
14342
14623
 
14343
14624
  // packages/sdk/src/components/fields/AssociationFormField/index.tsx
14344
- import { useCallback as useCallback12, useEffect as useEffect34, useMemo as useMemo26, useRef as useRef10, useState as useState22 } from "react";
14625
+ import { useCallback as useCallback12, useEffect as useEffect35, useMemo as useMemo26, useRef as useRef11, useState as useState22 } from "react";
14345
14626
  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";
14346
14627
  import { jsx as jsx78, jsxs as jsxs34 } from "react/jsx-runtime";
14347
14628
  var DEFAULT_PAGE_SIZE = 10;
@@ -14419,19 +14700,19 @@ function AssociationFormField(props) {
14419
14700
  });
14420
14701
  const [selectedRowKeys, setSelectedRowKeys] = useState22([]);
14421
14702
  const [selectedRecords, setSelectedRecords] = useState22([]);
14422
- const formDataRef = useRef10(formData);
14423
- const associationFormRef = useRef10(associationForm);
14424
- useEffect34(() => {
14703
+ const formDataRef = useRef11(formData);
14704
+ const associationFormRef = useRef11(associationForm);
14705
+ useEffect35(() => {
14425
14706
  registerField(fieldId);
14426
14707
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
14427
14708
  setFieldValue(fieldId, normalizeValues(defaultValue));
14428
14709
  }
14429
14710
  return () => unregisterField(fieldId);
14430
14711
  }, [fieldId]);
14431
- useEffect34(() => {
14712
+ useEffect35(() => {
14432
14713
  formDataRef.current = formData;
14433
14714
  }, [formData]);
14434
- useEffect34(() => {
14715
+ useEffect35(() => {
14435
14716
  associationFormRef.current = associationForm;
14436
14717
  }, [associationForm]);
14437
14718
  const associationAppType = associationForm?.appType;
@@ -14546,10 +14827,10 @@ function AssociationFormField(props) {
14546
14827
  },
14547
14828
  [fetchRecords, keyword, pagination.pageSize]
14548
14829
  );
14549
- useEffect34(() => {
14830
+ useEffect35(() => {
14550
14831
  void loadOptions();
14551
14832
  }, [loadOptions]);
14552
- useEffect34(() => {
14833
+ useEffect35(() => {
14553
14834
  setSelectedRowKeys(value.map((item) => item.value));
14554
14835
  setSelectedRecords(
14555
14836
  value.map(
@@ -14823,7 +15104,7 @@ function AssociationFormField(props) {
14823
15104
  }
14824
15105
 
14825
15106
  // packages/sdk/src/components/fields/EditorField/index.tsx
14826
- import { useCallback as useCallback13, useEffect as useEffect35, useMemo as useMemo27, useRef as useRef11, useState as useState23 } from "react";
15107
+ import { useCallback as useCallback13, useEffect as useEffect36, useMemo as useMemo27, useRef as useRef12, useState as useState23 } from "react";
14827
15108
  import { Extension } from "@tiptap/core";
14828
15109
  import { EditorContent, useEditor } from "@tiptap/react";
14829
15110
  import StarterKit from "@tiptap/starter-kit";
@@ -15477,7 +15758,7 @@ function RichTextEditorCore({
15477
15758
  fieldId = "richText",
15478
15759
  mobile = false
15479
15760
  }) {
15480
- const inputRef = useRef11(null);
15761
+ const inputRef = useRef12(null);
15481
15762
  const [uploading, setUploading] = useState23(false);
15482
15763
  const [uploadError, setUploadError] = useState23("");
15483
15764
  const [charCount, setCharCount] = useState23(0);
@@ -15492,8 +15773,8 @@ function RichTextEditorCore({
15492
15773
  const [tableOpen, setTableOpen] = useState23(false);
15493
15774
  const [tableRows, setTableRows] = useState23(3);
15494
15775
  const [tableCols, setTableCols] = useState23(3);
15495
- const onChangeRef = useRef11(onChange);
15496
- useEffect35(() => {
15776
+ const onChangeRef = useRef12(onChange);
15777
+ useEffect36(() => {
15497
15778
  onChangeRef.current = onChange;
15498
15779
  }, [onChange]);
15499
15780
  const actions = useMemo27(() => normalizeToolbarConfig(toolbarConfig), [toolbarConfig]);
@@ -15562,11 +15843,11 @@ function RichTextEditorCore({
15562
15843
  },
15563
15844
  [fieldId, extensions, disabled, maxLength, updateHtml]
15564
15845
  );
15565
- useEffect35(() => {
15846
+ useEffect36(() => {
15566
15847
  if (!editor || isEditorDestroyed(editor)) return;
15567
15848
  editor.setEditable(!disabled);
15568
15849
  }, [disabled, editor]);
15569
- useEffect35(() => {
15850
+ useEffect36(() => {
15570
15851
  if (!editor || isEditorDestroyed(editor)) return;
15571
15852
  const currentHtml = getSafeEditorHtml(editor);
15572
15853
  if ((value || "") !== currentHtml) {
@@ -15880,14 +16161,14 @@ function EditorField(props) {
15880
16161
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
15881
16162
  const rawValue = formData[fieldId] ?? "";
15882
16163
  const value = normalizeRichTextHtml(rawValue);
15883
- useEffect35(() => {
16164
+ useEffect36(() => {
15884
16165
  registerField(fieldId);
15885
16166
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
15886
16167
  setFieldValue(fieldId, normalizeRichTextHtml(defaultValue));
15887
16168
  }
15888
16169
  return () => unregisterField(fieldId);
15889
16170
  }, [fieldId]);
15890
- useEffect35(() => {
16171
+ useEffect36(() => {
15891
16172
  if (rawValue && rawValue !== value) {
15892
16173
  setFieldValue(fieldId, value);
15893
16174
  }
@@ -15945,7 +16226,7 @@ function EditorField(props) {
15945
16226
  }
15946
16227
 
15947
16228
  // packages/sdk/src/components/fields/SerialNumberField/index.tsx
15948
- import { useEffect as useEffect36 } from "react";
16229
+ import { useEffect as useEffect37 } from "react";
15949
16230
  import { Input as Input12 } from "antd";
15950
16231
  import { jsx as jsx80 } from "react/jsx-runtime";
15951
16232
  function SerialNumberField(props) {
@@ -15965,7 +16246,7 @@ function SerialNumberField(props) {
15965
16246
  const { formData, fieldBehaviors, setFieldValue, registerField, unregisterField } = useFormContext();
15966
16247
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "READONLY";
15967
16248
  const value = formData[fieldId] ?? "";
15968
- useEffect36(() => {
16249
+ useEffect37(() => {
15969
16250
  registerField(fieldId);
15970
16251
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
15971
16252
  setFieldValue(fieldId, defaultValue);
@@ -16007,7 +16288,7 @@ function SerialNumberField(props) {
16007
16288
  }
16008
16289
 
16009
16290
  // packages/sdk/src/components/fields/LocationField/index.tsx
16010
- import { useEffect as useEffect37, useState as useState24 } from "react";
16291
+ import { useEffect as useEffect38, useState as useState24 } from "react";
16011
16292
  import { Button as Button10, Space as Space8 } from "antd";
16012
16293
  import { jsx as jsx81, jsxs as jsxs36 } from "react/jsx-runtime";
16013
16294
  var getDingTalkApi = () => {
@@ -16051,7 +16332,7 @@ function LocationField(props) {
16051
16332
  const value = formData[fieldId];
16052
16333
  const [locating, setLocating] = useState24(false);
16053
16334
  const [error, setError] = useState24("");
16054
- useEffect37(() => {
16335
+ useEffect38(() => {
16055
16336
  registerField(fieldId);
16056
16337
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
16057
16338
  setFieldValue(fieldId, defaultValue);
@@ -16192,7 +16473,7 @@ function LocationField(props) {
16192
16473
  }
16193
16474
 
16194
16475
  // packages/sdk/src/components/fields/DigitalSignatureField/index.tsx
16195
- import { useCallback as useCallback14, useEffect as useEffect38, useRef as useRef12, useState as useState25 } from "react";
16476
+ import { useCallback as useCallback14, useEffect as useEffect39, useRef as useRef13, useState as useState25 } from "react";
16196
16477
  import { Button as Button11, Modal as Modal8, Space as Space9 } from "antd";
16197
16478
  import { jsx as jsx82, jsxs as jsxs37 } from "react/jsx-runtime";
16198
16479
  var CANVAS_HEIGHT = 260;
@@ -16230,10 +16511,10 @@ function DigitalSignatureField(props) {
16230
16511
  const [saving, setSaving] = useState25(false);
16231
16512
  const [drawn, setDrawn] = useState25(false);
16232
16513
  const [error, setError] = useState25("");
16233
- const canvasRef = useRef12(null);
16234
- const drawingRef = useRef12(false);
16235
- const pointsRef = useRef12([]);
16236
- useEffect38(() => {
16514
+ const canvasRef = useRef13(null);
16515
+ const drawingRef = useRef13(false);
16516
+ const pointsRef = useRef13([]);
16517
+ useEffect39(() => {
16237
16518
  registerField(fieldId);
16238
16519
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
16239
16520
  setFieldValue(fieldId, defaultValue);
@@ -16262,7 +16543,7 @@ function DigitalSignatureField(props) {
16262
16543
  ctx.lineJoin = "round";
16263
16544
  ctx.strokeStyle = "#111827";
16264
16545
  }, []);
16265
- useEffect38(() => {
16546
+ useEffect39(() => {
16266
16547
  if (!open) return;
16267
16548
  pointsRef.current = [];
16268
16549
  setDrawn(false);
@@ -16441,7 +16722,7 @@ function DigitalSignatureField(props) {
16441
16722
  }
16442
16723
 
16443
16724
  // packages/sdk/src/components/fields/JSONField/index.tsx
16444
- import { useEffect as useEffect39 } from "react";
16725
+ import { useEffect as useEffect40 } from "react";
16445
16726
  import { jsx as jsx83 } from "react/jsx-runtime";
16446
16727
  var formatJson = (value) => {
16447
16728
  if (value === void 0 || value === null || value === "") return "--";
@@ -16468,7 +16749,7 @@ function JSONField(props) {
16468
16749
  const { formData, fieldBehaviors, setFieldValue, registerField, unregisterField } = useFormContext();
16469
16750
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "READONLY";
16470
16751
  const value = formData[fieldId];
16471
- useEffect39(() => {
16752
+ useEffect40(() => {
16472
16753
  registerField(fieldId);
16473
16754
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
16474
16755
  setFieldValue(fieldId, defaultValue);
@@ -16971,11 +17252,11 @@ function FormProvider({
16971
17252
  }
16972
17253
  return { ...values, ...initialValues };
16973
17254
  }, [schema, initialValues, mergedRuntime]);
16974
- const initialValuesRef = useRef13(computedInitialValues);
17255
+ const initialValuesRef = useRef14(computedInitialValues);
16975
17256
  const [formData, setFormData] = useState26({ ...computedInitialValues });
16976
17257
  const [fieldErrors, setFieldErrors] = useState26({});
16977
17258
  const [registeredFields] = useState26(/* @__PURE__ */ new Set());
16978
- useEffect40(() => {
17259
+ useEffect41(() => {
16979
17260
  if (!schema.fields.some((field) => needsCurrentUserRuntime(field.defaultShortcut?.type)))
16980
17261
  return;
16981
17262
  if (mergedRuntime.currentUser && mergedRuntime.currentDepartment) return;
@@ -16999,7 +17280,7 @@ function FormProvider({
16999
17280
  cancelled = true;
17000
17281
  };
17001
17282
  }, [api, mergedRuntime.currentDepartment, mergedRuntime.currentUser, schema.fields]);
17002
- useEffect40(() => {
17283
+ useEffect41(() => {
17003
17284
  setFormData((prev) => {
17004
17285
  let changed = false;
17005
17286
  const next = { ...prev };
@@ -17044,7 +17325,7 @@ function FormProvider({
17044
17325
  () => evaluateLayoutBehaviors(effects, formData),
17045
17326
  [effects, formData]
17046
17327
  );
17047
- useEffect40(() => {
17328
+ useEffect41(() => {
17048
17329
  const valueActions = getValueActions(effects, formData);
17049
17330
  if (valueActions.length === 0) return;
17050
17331
  let changed = false;
@@ -17186,7 +17467,7 @@ function FormProvider({
17186
17467
  [registeredFields]
17187
17468
  );
17188
17469
  const [dynamicOptions, setDynamicOptions] = useState26({});
17189
- useEffect40(() => {
17470
+ useEffect41(() => {
17190
17471
  const loadDynamicOptions = async () => {
17191
17472
  const updates = {};
17192
17473
  for (const field of schema.fields) {
@@ -17204,7 +17485,7 @@ function FormProvider({
17204
17485
  };
17205
17486
  loadDynamicOptions();
17206
17487
  }, [schema.fields, mergedRuntime]);
17207
- useEffect40(() => {
17488
+ useEffect41(() => {
17208
17489
  let cancelled = false;
17209
17490
  const loadDataLinkageOptions = async () => {
17210
17491
  const updates = {};
@@ -17230,7 +17511,7 @@ function FormProvider({
17230
17511
  window.clearTimeout(timer);
17231
17512
  };
17232
17513
  }, [schema.fields, mergedRuntime, formData]);
17233
- useEffect40(() => {
17514
+ useEffect41(() => {
17234
17515
  let cancelled = false;
17235
17516
  const loadDefaultValueLinkages = async () => {
17236
17517
  const fields = schema.fields.filter((field) => field.defaultValueLinkage);
@@ -17984,7 +18265,7 @@ function isLayoutVisible(visibleWhen, formData) {
17984
18265
  }
17985
18266
 
17986
18267
  // packages/sdk/src/components/core/FormShell.tsx
17987
- import { useEffect as useEffect41, useMemo as useMemo29 } from "react";
18268
+ import { useEffect as useEffect42, useMemo as useMemo29 } from "react";
17988
18269
  import * as Antd2 from "antd";
17989
18270
  import { jsx as jsx89 } from "react/jsx-runtime";
17990
18271
  function normalizeMaxWidth(maxWidth) {
@@ -18014,7 +18295,7 @@ function FormShell({ children, appearance, className }) {
18014
18295
  const [form] = useAntForm();
18015
18296
  const { formData, setFieldValue } = useFormContext();
18016
18297
  const maxWidth = normalizeMaxWidth(appearance?.maxWidth);
18017
- useEffect41(() => {
18298
+ useEffect42(() => {
18018
18299
  form?.setFieldsValue?.(formData);
18019
18300
  }, [form, formData]);
18020
18301
  const style = useMemo29(() => {
@@ -18083,7 +18364,7 @@ async function validateAndNotify(validateAllWithErrors) {
18083
18364
  }
18084
18365
 
18085
18366
  // packages/sdk/src/components/hooks/useFormDetail.ts
18086
- import { useState as useState30, useEffect as useEffect42, useCallback as useCallback16, useRef as useRef14 } from "react";
18367
+ import { useState as useState30, useEffect as useEffect43, useCallback as useCallback16, useRef as useRef15 } from "react";
18087
18368
 
18088
18369
  // packages/sdk/src/components/utils/formInstanceData.ts
18089
18370
  var FORM_INSTANCE_METADATA_KEYS = /* @__PURE__ */ new Set([
@@ -18285,16 +18566,16 @@ function useFormDetail(options) {
18285
18566
  const [formData, setFormData] = useState30(null);
18286
18567
  const [instanceInfo, setInstanceInfo] = useState30(null);
18287
18568
  const [permissions, setPermissions] = useState30(null);
18288
- const mountedRef = useRef14(true);
18289
- const onPermissionDeniedRef = useRef14(onPermissionDenied);
18569
+ const mountedRef = useRef15(true);
18570
+ const onPermissionDeniedRef = useRef15(onPermissionDenied);
18290
18571
  const fieldIdsKey = fieldIds?.join("") ?? "";
18291
- useEffect42(() => {
18572
+ useEffect43(() => {
18292
18573
  mountedRef.current = true;
18293
18574
  return () => {
18294
18575
  mountedRef.current = false;
18295
18576
  };
18296
18577
  }, []);
18297
- useEffect42(() => {
18578
+ useEffect43(() => {
18298
18579
  onPermissionDeniedRef.current = onPermissionDenied;
18299
18580
  }, [onPermissionDenied]);
18300
18581
  const loadData = useCallback16(async () => {
@@ -18332,7 +18613,7 @@ function useFormDetail(options) {
18332
18613
  }
18333
18614
  }
18334
18615
  }, [request, formUuid, appType, formInstanceId, fieldIdsKey]);
18335
- useEffect42(() => {
18616
+ useEffect43(() => {
18336
18617
  loadData();
18337
18618
  }, [loadData]);
18338
18619
  const fieldBehaviors = normalizeFieldBehaviors(permissions, mode);
@@ -18394,7 +18675,7 @@ function useFormDetail(options) {
18394
18675
  }
18395
18676
 
18396
18677
  // packages/sdk/src/components/hooks/useChangeRecords.ts
18397
- import { useState as useState31, useEffect as useEffect43, useCallback as useCallback17, useRef as useRef15 } from "react";
18678
+ import { useState as useState31, useEffect as useEffect44, useCallback as useCallback17, useRef as useRef16 } from "react";
18398
18679
  var normalizeChangeRecordList = (value) => {
18399
18680
  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;
18400
18681
  const records = Array.isArray(body) ? body : body?.records ?? body?.data ?? body?.list ?? body?.items ?? [];
@@ -18413,8 +18694,8 @@ function useChangeRecords(options) {
18413
18694
  const [loading, setLoading] = useState31(false);
18414
18695
  const [total, setTotal] = useState31(0);
18415
18696
  const [page, setPage] = useState31(1);
18416
- const mountedRef = useRef15(true);
18417
- useEffect43(() => {
18697
+ const mountedRef = useRef16(true);
18698
+ useEffect44(() => {
18418
18699
  mountedRef.current = true;
18419
18700
  return () => {
18420
18701
  mountedRef.current = false;
@@ -18451,7 +18732,7 @@ function useChangeRecords(options) {
18451
18732
  },
18452
18733
  [request, formUuid, appType, formInstanceId, pageSize]
18453
18734
  );
18454
- useEffect43(() => {
18735
+ useEffect44(() => {
18455
18736
  if (autoLoad) {
18456
18737
  fetchRecords(1, false);
18457
18738
  }
@@ -18879,8 +19160,8 @@ var InnerDetailContent = ({
18879
19160
  onSave,
18880
19161
  inDrawer = false
18881
19162
  }) => {
18882
- const formDataRef = useRef16(void 0);
18883
- const validateRef = useRef16(void 0);
19163
+ const formDataRef = useRef17(void 0);
19164
+ const validateRef = useRef17(void 0);
18884
19165
  const [accessDenied, setAccessDenied] = useState33(false);
18885
19166
  const fieldIds = useMemo30(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
18886
19167
  const {
@@ -19059,12 +19340,12 @@ var FormDetailTemplate = (props) => {
19059
19340
  };
19060
19341
 
19061
19342
  // packages/sdk/src/components/templates/FormSubmitTemplate.tsx
19062
- import { useEffect as useEffect46, useRef as useRef18, useState as useState36, useCallback as useCallback21 } from "react";
19343
+ import { useEffect as useEffect47, useRef as useRef19, useState as useState36, useCallback as useCallback21 } from "react";
19063
19344
  import { Button as Button14, message as message4, Modal as Modal9, Select as Select8 } from "antd";
19064
19345
  import { CheckCircleFilled as CheckCircleFilled2 } from "@ant-design/icons";
19065
19346
 
19066
19347
  // packages/sdk/src/components/hooks/useDraftStorage.ts
19067
- import { useState as useState34, useCallback as useCallback19, useEffect as useEffect44 } from "react";
19348
+ import { useState as useState34, useCallback as useCallback19, useEffect as useEffect45 } from "react";
19068
19349
  function getDraftKey(appType, formUuid) {
19069
19350
  return `${appType}__${formUuid}__draft`;
19070
19351
  }
@@ -19087,7 +19368,7 @@ function useDraftStorage(options) {
19087
19368
  const [hasDraft, setHasDraft] = useState34(false);
19088
19369
  const [draftData, setDraftData] = useState34(null);
19089
19370
  const [draftTimestamp, setDraftTimestamp] = useState34(null);
19090
- useEffect44(() => {
19371
+ useEffect45(() => {
19091
19372
  const stored = readDraft(key);
19092
19373
  if (stored) {
19093
19374
  setHasDraft(true);
@@ -19144,7 +19425,7 @@ function useDraftStorage(options) {
19144
19425
  }
19145
19426
 
19146
19427
  // packages/sdk/src/components/hooks/useFormNavigation.ts
19147
- import { useState as useState35, useCallback as useCallback20, useRef as useRef17, useEffect as useEffect45 } from "react";
19428
+ import { useState as useState35, useCallback as useCallback20, useRef as useRef18, useEffect as useEffect46 } from "react";
19148
19429
  var normalizeBasePath = (basePath) => {
19149
19430
  const normalized = String(basePath || "").replace(/^\/+|\/+$/g, "");
19150
19431
  return normalized ? `/${normalized}` : "";
@@ -19178,10 +19459,10 @@ function useFormNavigation(options) {
19178
19459
  } = options;
19179
19460
  const [isRedirecting, setIsRedirecting] = useState35(false);
19180
19461
  const [countdown, setCountdown] = useState35(0);
19181
- const timerRef = useRef17(null);
19182
- const redirectTargetRef = useRef17(null);
19183
- const mountedRef = useRef17(true);
19184
- useEffect45(() => {
19462
+ const timerRef = useRef18(null);
19463
+ const redirectTargetRef = useRef18(null);
19464
+ const mountedRef = useRef18(true);
19465
+ useEffect46(() => {
19185
19466
  mountedRef.current = true;
19186
19467
  return () => {
19187
19468
  mountedRef.current = false;
@@ -19473,15 +19754,15 @@ var InnerFormContent = ({
19473
19754
  const [submissionDepartmentModalOpen, setSubmissionDepartmentModalOpen] = useState36(false);
19474
19755
  const [submissionDepartmentOptions, setSubmissionDepartmentOptions] = useState36([]);
19475
19756
  const [selectedSubmissionDepartmentId, setSelectedSubmissionDepartmentId] = useState36();
19476
- const submissionDepartmentResolverRef = useRef18(null);
19757
+ const submissionDepartmentResolverRef = useRef19(null);
19477
19758
  const [previewOpen, setPreviewOpen] = useState36(false);
19478
19759
  const [previewLoading, setPreviewLoading] = useState36(false);
19479
19760
  const [previewRoutes, setPreviewRoutes] = useState36([]);
19480
19761
  const [pendingFormData, setPendingFormData] = useState36(null);
19481
19762
  const [pendingSubmissionDepartmentId, setPendingSubmissionDepartmentId] = useState36();
19482
19763
  const [pendingInitiatorSelectedApprovers, setPendingInitiatorSelectedApprovers] = useState36();
19483
- const pendingSubmissionDepartmentIdRef = useRef18(void 0);
19484
- const pendingInitiatorSelectedApproversRef = useRef18(
19764
+ const pendingSubmissionDepartmentIdRef = useRef19(void 0);
19765
+ const pendingInitiatorSelectedApproversRef = useRef19(
19485
19766
  void 0
19486
19767
  );
19487
19768
  const [initiatorApproverOpen, setInitiatorApproverOpen] = useState36(false);
@@ -19497,7 +19778,7 @@ var InnerFormContent = ({
19497
19778
  mode: submitSuccessMode === "continue" ? "stay" : submitSuccessMode,
19498
19779
  basePath: config.navigation?.basePath
19499
19780
  });
19500
- useEffect46(() => {
19781
+ useEffect47(() => {
19501
19782
  return () => {
19502
19783
  submissionDepartmentResolverRef.current?.(null);
19503
19784
  submissionDepartmentResolverRef.current = null;
@@ -19990,12 +20271,12 @@ var FormSubmitTemplate = ({
19990
20271
  };
19991
20272
 
19992
20273
  // packages/sdk/src/components/templates/ProcessDetailTemplate.tsx
19993
- import { useCallback as useCallback25, useMemo as useMemo34, useRef as useRef21, useState as useState40 } from "react";
20274
+ import { useCallback as useCallback25, useMemo as useMemo34, useRef as useRef22, useState as useState40 } from "react";
19994
20275
  import dayjs11 from "dayjs";
19995
20276
  import { Form as AntForm, Input as Input14, Modal as Modal11, message as message5 } from "antd";
19996
20277
 
19997
20278
  // packages/sdk/src/components/hooks/useProcessDetail.ts
19998
- import { useState as useState37, useEffect as useEffect47, useCallback as useCallback23, useRef as useRef19, useMemo as useMemo32 } from "react";
20279
+ import { useState as useState37, useEffect as useEffect48, useCallback as useCallback23, useRef as useRef20, useMemo as useMemo32 } from "react";
19999
20280
 
20000
20281
  // packages/sdk/src/components/hooks/useFieldPermission.ts
20001
20282
  import { useMemo as useMemo31, useCallback as useCallback22 } from "react";
@@ -20122,9 +20403,9 @@ function useProcessDetail(options) {
20122
20403
  const [permissions, setPermissions] = useState37(null);
20123
20404
  const [processDefinition, setProcessDefinition] = useState37(null);
20124
20405
  const [dataVersion, setDataVersion] = useState37(0);
20125
- const mountedRef = useRef19(true);
20406
+ const mountedRef = useRef20(true);
20126
20407
  const fieldIdsKey = fieldIds?.join("") ?? "";
20127
- useEffect47(() => {
20408
+ useEffect48(() => {
20128
20409
  mountedRef.current = true;
20129
20410
  return () => {
20130
20411
  mountedRef.current = false;
@@ -20240,7 +20521,7 @@ function useProcessDetail(options) {
20240
20521
  }
20241
20522
  }
20242
20523
  }, [request, formUuid, appType, formInstanceId, fieldIdsKey]);
20243
- useEffect47(() => {
20524
+ useEffect48(() => {
20244
20525
  loadData();
20245
20526
  }, [loadData]);
20246
20527
  const switchToEdit = useCallback23(() => {
@@ -20317,7 +20598,7 @@ function useProcessDetail(options) {
20317
20598
  }
20318
20599
 
20319
20600
  // packages/sdk/src/components/hooks/useApprovalActions.ts
20320
- import { useState as useState38, useCallback as useCallback24, useRef as useRef20, useEffect as useEffect48 } from "react";
20601
+ import { useState as useState38, useCallback as useCallback24, useRef as useRef21, useEffect as useEffect49 } from "react";
20321
20602
  function useApprovalActions(options) {
20322
20603
  const { formInstanceId, formUuid, appType, currentTaskId, onActionComplete, getFormValues } = options;
20323
20604
  const { api } = useFormContext();
@@ -20326,8 +20607,8 @@ function useApprovalActions(options) {
20326
20607
  const [currentAction, setCurrentAction] = useState38(null);
20327
20608
  const [returnableNodes, setReturnableNodes] = useState38([]);
20328
20609
  const [returnPolicy, setReturnPolicy] = useState38(null);
20329
- const mountedRef = useRef20(true);
20330
- useEffect48(() => {
20610
+ const mountedRef = useRef21(true);
20611
+ useEffect49(() => {
20331
20612
  mountedRef.current = true;
20332
20613
  return () => {
20333
20614
  mountedRef.current = false;
@@ -20954,8 +21235,8 @@ var InnerProcessContent = ({
20954
21235
  onDelete,
20955
21236
  inDrawer = false
20956
21237
  }) => {
20957
- const formDataRef = useRef21(void 0);
20958
- const validateRef = useRef21(void 0);
21238
+ const formDataRef = useRef22(void 0);
21239
+ const validateRef = useRef22(void 0);
20959
21240
  const [withdrawForm] = AntForm.useForm();
20960
21241
  const [withdrawOpen, setWithdrawOpen] = useState40(false);
20961
21242
  const [withdrawLoading, setWithdrawLoading] = useState40(false);
@@ -22635,7 +22916,7 @@ function AsyncEntityFilterSelect({
22635
22916
  },
22636
22917
  [api, entityType]
22637
22918
  );
22638
- useEffect49(() => {
22919
+ useEffect50(() => {
22639
22920
  void loadOptions();
22640
22921
  }, [loadOptions]);
22641
22922
  return /* @__PURE__ */ jsx100(
@@ -22946,7 +23227,7 @@ function ResizableColumnTitle({
22946
23227
  onResize,
22947
23228
  onResizeEnd
22948
23229
  }) {
22949
- const dragRef = useRef22({ startX: 0, startWidth: width, latestWidth: width });
23230
+ const dragRef = useRef23({ startX: 0, startWidth: width, latestWidth: width });
22950
23231
  const handleMouseDown = (event) => {
22951
23232
  event.preventDefault();
22952
23233
  event.stopPropagation();
@@ -23015,7 +23296,7 @@ var DataManagementList = ({
23015
23296
  permissionMode = "auto",
23016
23297
  actionOverrides
23017
23298
  }) => {
23018
- const rootRef = useRef22(null);
23299
+ const rootRef = useRef23(null);
23019
23300
  const api = useMemo36(() => {
23020
23301
  if (typeof requestOverride === "function") {
23021
23302
  return createFormRuntimeApi({ request: requestOverride });
@@ -23029,7 +23310,7 @@ var DataManagementList = ({
23029
23310
  const [showFields, setShowFields] = useState41([]);
23030
23311
  const [lockFieldIds, setLockFieldIds] = useState41([]);
23031
23312
  const [widths, setWidths] = useState41({});
23032
- const widthsRef = useRef22({});
23313
+ const widthsRef = useRef23({});
23033
23314
  const [sort, setSort] = useState41([]);
23034
23315
  const [density, setDensity] = useState41("middle");
23035
23316
  const [detailOpenMode, setDetailOpenMode] = useState41("drawer");
@@ -23067,7 +23348,7 @@ var DataManagementList = ({
23067
23348
  const [actionSummary, setActionSummary] = useState41(null);
23068
23349
  const [permissionLoading, setPermissionLoading] = useState41(permissionMode === "auto");
23069
23350
  const [permissionError, setPermissionError] = useState41(null);
23070
- const fetchStateRef = useRef22({});
23351
+ const fetchStateRef = useRef23({});
23071
23352
  const isProcessForm = isProcessFormType(formType);
23072
23353
  const request = api.request;
23073
23354
  const getPopupContainer = useCallback26(
@@ -23082,7 +23363,7 @@ var DataManagementList = ({
23082
23363
  const confirmDanger = useCallback26((title2, content, onOk) => {
23083
23364
  if (confirmAction(title2, content)) onOk();
23084
23365
  }, []);
23085
- useEffect49(() => {
23366
+ useEffect50(() => {
23086
23367
  let mounted = true;
23087
23368
  if (permissionMode !== "auto") {
23088
23369
  setActionSummary(null);
@@ -23155,10 +23436,10 @@ var DataManagementList = ({
23155
23436
  () => new Set(forcedConfig?.lockFieldIds || []),
23156
23437
  [forcedConfig?.lockFieldIds]
23157
23438
  );
23158
- useEffect49(() => {
23439
+ useEffect50(() => {
23159
23440
  widthsRef.current = widths;
23160
23441
  }, [widths]);
23161
- useEffect49(() => {
23442
+ useEffect50(() => {
23162
23443
  fetchStateRef.current = {
23163
23444
  current,
23164
23445
  pageSize,
@@ -23211,7 +23492,7 @@ var DataManagementList = ({
23211
23492
  },
23212
23493
  [appType, forcedConfig, formUuid, request]
23213
23494
  );
23214
- useEffect49(() => {
23495
+ useEffect50(() => {
23215
23496
  let mounted = true;
23216
23497
  const loadSchemaAndConfig = async () => {
23217
23498
  if (!appType || !formUuid) return;
@@ -24481,7 +24762,7 @@ function BuiltinRouteRenderer({
24481
24762
  const runtimeStorage = route?.runtime?.storage;
24482
24763
  const permissionDenied = isRuntimePermissionDenied(route);
24483
24764
  const reload = useCallback27(() => setReloadKey((value) => value + 1), []);
24484
- useEffect50(() => {
24765
+ useEffect51(() => {
24485
24766
  let cancelled = false;
24486
24767
  setSchema(void 0);
24487
24768
  setError("");