openxiangda 1.0.34 → 1.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +16 -0
  2. package/lib/cli.js +409 -0
  3. package/lib/workspace-init.js +1 -0
  4. package/openxiangda-skills/SKILL.md +4 -2
  5. package/openxiangda-skills/references/best-practices.md +11 -6
  6. package/openxiangda-skills/references/connector-resources.md +3 -0
  7. package/openxiangda-skills/references/data-views.md +217 -0
  8. package/openxiangda-skills/references/forms/component-registry.md +4 -3
  9. package/openxiangda-skills/references/forms/form-schema.md +31 -2
  10. package/openxiangda-skills/references/pages/page-sdk.md +43 -0
  11. package/openxiangda-skills/references/workspace-state.md +9 -0
  12. package/openxiangda-skills/skills/openxiangda-form/SKILL.md +3 -3
  13. package/openxiangda-skills/skills/openxiangda-permission-settings/SKILL.md +1 -1
  14. package/package.json +1 -1
  15. package/packages/sdk/dist/components/index.cjs +944 -765
  16. package/packages/sdk/dist/components/index.cjs.map +1 -1
  17. package/packages/sdk/dist/components/index.d.mts +18 -2
  18. package/packages/sdk/dist/components/index.d.ts +18 -2
  19. package/packages/sdk/dist/components/index.mjs +938 -761
  20. package/packages/sdk/dist/components/index.mjs.map +1 -1
  21. package/packages/sdk/dist/runtime/index.cjs +47 -0
  22. package/packages/sdk/dist/runtime/index.cjs.map +1 -1
  23. package/packages/sdk/dist/runtime/index.d.mts +18 -1
  24. package/packages/sdk/dist/runtime/index.d.ts +18 -1
  25. package/packages/sdk/dist/runtime/index.mjs +47 -0
  26. package/packages/sdk/dist/runtime/index.mjs.map +1 -1
  27. package/packages/sdk/src/build-source/scripts/utils/form-api.mjs +1 -0
  28. package/templates/sy-lowcode-app-workspace/examples/best-practices/decision-guide.md +4 -3
  29. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/permissions.test.ts +1 -1
  30. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/app-role/schema.ts +36 -18
  31. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/service-ticket/schema.ts +36 -18
  32. package/templates/sy-lowcode-app-workspace/src/shared/form-schema.ts +0 -1
@@ -790,7 +790,7 @@ var require_cjs = __commonJS({
790
790
  });
791
791
 
792
792
  // packages/sdk/src/components/core/FormProvider.tsx
793
- import React234, { useCallback as useCallback20, useEffect as useEffect82, useRef as useRef84, useState as useState69, useMemo as useMemo47 } from "react";
793
+ import React235, { useCallback as useCallback21, useEffect as useEffect84, useRef as useRef85, useState as useState70, useMemo as useMemo49 } from "react";
794
794
 
795
795
  // packages/sdk/src/components/core/FormContext.ts
796
796
  import { createContext, useContext } from "react";
@@ -29009,9 +29009,10 @@ function TextAreaField(props) {
29009
29009
  }
29010
29010
 
29011
29011
  // packages/sdk/src/components/fields/SelectField/index.tsx
29012
- import { useEffect as useEffect56 } from "react";
29012
+ import { useEffect as useEffect58 } from "react";
29013
29013
 
29014
29014
  // packages/sdk/src/components/fields/SelectField/SelectFieldPC.tsx
29015
+ import { useMemo as useMemo33 } from "react";
29015
29016
  import { Select } from "antd";
29016
29017
 
29017
29018
  // packages/sdk/src/components/fields/shared/optionDisplay.tsx
@@ -29085,6 +29086,294 @@ function renderReadonlyOptions(options, coloredOptions, tagWhenPlain = false) {
29085
29086
  ) });
29086
29087
  }
29087
29088
 
29089
+ // packages/sdk/src/components/fields/SelectField/useLinkedFormRemoteOptions.ts
29090
+ import { useCallback as useCallback15, useEffect as useEffect56, useMemo as useMemo32, useRef as useRef78, useState as useState53 } from "react";
29091
+
29092
+ // packages/sdk/src/components/core/optionSource.ts
29093
+ var DEFAULT_OPTION_PAGE_SIZE = 200;
29094
+ function getOptionValueFieldId(config3) {
29095
+ return config3.valueFieldId || config3.fieldId;
29096
+ }
29097
+ function getOptionLabelFieldId(config3) {
29098
+ return config3.labelFieldId || config3.fieldId;
29099
+ }
29100
+ function getSearchFieldId(config3) {
29101
+ return config3.searchFieldId || config3.labelFieldId || config3.fieldId;
29102
+ }
29103
+ function readFieldValue(row, fieldId) {
29104
+ if (!fieldId) return void 0;
29105
+ return row?.[fieldId];
29106
+ }
29107
+ function normalizeOptionScalar(rawValue) {
29108
+ if (rawValue === void 0 || rawValue === null || rawValue === "") return null;
29109
+ if (typeof rawValue === "object" && !Array.isArray(rawValue)) {
29110
+ return rawValue.value ?? rawValue.id ?? rawValue.key ?? rawValue.label;
29111
+ }
29112
+ return rawValue;
29113
+ }
29114
+ function normalizeOptionLabel(rawLabel, rawValue, fallbackLabel, value) {
29115
+ if (rawLabel !== void 0 && rawLabel !== null && rawLabel !== "") {
29116
+ if (typeof rawLabel === "object" && !Array.isArray(rawLabel)) {
29117
+ return rawLabel.label ?? rawLabel.name ?? rawLabel.title ?? rawLabel.value ?? value;
29118
+ }
29119
+ return rawLabel;
29120
+ }
29121
+ if (typeof rawValue === "object" && rawValue && !Array.isArray(rawValue)) {
29122
+ return rawValue.label ?? rawValue.name ?? rawValue.title ?? rawValue.value ?? value;
29123
+ }
29124
+ if (fallbackLabel !== void 0 && fallbackLabel !== null && fallbackLabel !== "") {
29125
+ return fallbackLabel;
29126
+ }
29127
+ return value;
29128
+ }
29129
+ function normalizeOptionItem(row, config3) {
29130
+ const normalizedConfig = typeof config3 === "string" ? { fieldId: config3 } : { ...config3, fieldId: config3.fieldId };
29131
+ const valueFieldId = getOptionValueFieldId(normalizedConfig);
29132
+ const labelFieldId = getOptionLabelFieldId(normalizedConfig);
29133
+ const rawValue = readFieldValue(row, valueFieldId) ?? (valueFieldId !== normalizedConfig.fieldId ? readFieldValue(row, normalizedConfig.fieldId) : void 0) ?? row?.value;
29134
+ const value = normalizeOptionScalar(rawValue);
29135
+ if (value === void 0 || value === null || value === "") return null;
29136
+ const rawLabel = labelFieldId === valueFieldId ? void 0 : readFieldValue(row, labelFieldId);
29137
+ const label = normalizeOptionLabel(rawLabel, rawValue, row?.label, value);
29138
+ return {
29139
+ value: String(value),
29140
+ label: String(label ?? value)
29141
+ };
29142
+ }
29143
+ function extractComparableValue(value) {
29144
+ if (value === void 0 || value === null || value === "") return value;
29145
+ if (Array.isArray(value)) {
29146
+ return value.map(extractComparableValue).filter((item) => item !== void 0 && item !== null && item !== "");
29147
+ }
29148
+ if (typeof value === "object") {
29149
+ if ("start" in value || "end" in value) {
29150
+ return [value.start, value.end].filter(
29151
+ (item) => item !== void 0 && item !== null && item !== ""
29152
+ );
29153
+ }
29154
+ return value.value ?? value.id ?? value.key ?? value.userId ?? value.userid ?? value.departmentId ?? value.deptId ?? value.label ?? value.name;
29155
+ }
29156
+ return value;
29157
+ }
29158
+ function normalizeFilterOperator(operator, value) {
29159
+ const normalized = operator === "neq" ? "ne" : operator || "eq";
29160
+ if (Array.isArray(value) && value.length > 0 && (normalized === "eq" || normalized === "contains")) {
29161
+ return "in";
29162
+ }
29163
+ return normalized;
29164
+ }
29165
+ async function resolveOptions(config3, runtime, formData, searchKeyword) {
29166
+ switch (config3.type) {
29167
+ case "custom":
29168
+ return [];
29169
+ // custom 类型直接用 props.options
29170
+ case "linkedForm":
29171
+ if (!config3.linkedForm) return [];
29172
+ return resolveLinkedFormOptions(config3.linkedForm, runtime, searchKeyword);
29173
+ case "dataLinkage":
29174
+ if (!config3.dataLinkage) return [];
29175
+ return resolveDataLinkageOptions(config3.dataLinkage, runtime, formData);
29176
+ default:
29177
+ return [];
29178
+ }
29179
+ }
29180
+ async function resolveLinkedFormOptions(config3, runtime, searchKeyword) {
29181
+ if (!runtime?.fetchFormData) return [];
29182
+ try {
29183
+ const filters = config3.filters?.map((f) => ({
29184
+ fieldId: f.fieldId,
29185
+ operator: normalizeFilterOperator(f.operator, extractComparableValue(f.value)),
29186
+ value: extractComparableValue(f.value)
29187
+ })) || [];
29188
+ const trimmedKeyword = String(searchKeyword || "").trim();
29189
+ if (trimmedKeyword) {
29190
+ filters.push({
29191
+ fieldId: getSearchFieldId(config3),
29192
+ operator: "contains",
29193
+ value: trimmedKeyword
29194
+ });
29195
+ }
29196
+ const result = await runtime.fetchFormData({
29197
+ formUuid: config3.formUuid,
29198
+ appType: runtime.appType || "",
29199
+ filters,
29200
+ sort: config3.sortField ? { field: config3.sortField, order: config3.sortOrder || "asc" } : void 0,
29201
+ fieldId: config3.fieldId,
29202
+ deduplicate: config3.deduplicate,
29203
+ pageSize: config3.pageSize ?? DEFAULT_OPTION_PAGE_SIZE
29204
+ });
29205
+ const items = result.data.map((row) => normalizeOptionItem(row, config3)).filter((item) => Boolean(item));
29206
+ if (config3.deduplicate) {
29207
+ const seen = /* @__PURE__ */ new Set();
29208
+ return items.filter((item) => {
29209
+ if (seen.has(item.value)) return false;
29210
+ seen.add(item.value);
29211
+ return true;
29212
+ });
29213
+ }
29214
+ return items;
29215
+ } catch (e2) {
29216
+ console.error("[FormComponents] resolveLinkedFormOptions failed:", e2);
29217
+ return [];
29218
+ }
29219
+ }
29220
+ async function resolveDataLinkageOptions(config3, runtime, formData) {
29221
+ if (!runtime?.fetchFormData) return [];
29222
+ try {
29223
+ const filters = config3.conditions.map((condition) => {
29224
+ const value = extractComparableValue(formData[condition.localFieldId]);
29225
+ return {
29226
+ fieldId: condition.remoteFieldId,
29227
+ operator: normalizeFilterOperator(condition.operator, value),
29228
+ value
29229
+ };
29230
+ });
29231
+ const result = await runtime.fetchFormData({
29232
+ formUuid: config3.formUuid,
29233
+ appType: runtime.appType || "",
29234
+ filters,
29235
+ conditionLogic: config3.conditionLogic,
29236
+ fieldId: config3.targetFieldId,
29237
+ deduplicate: config3.deduplicate,
29238
+ pageSize: DEFAULT_OPTION_PAGE_SIZE
29239
+ });
29240
+ const items = result.data.map((row) => normalizeOptionItem(row, config3.targetFieldId)).filter((item) => Boolean(item));
29241
+ if (config3.deduplicate) {
29242
+ const seen = /* @__PURE__ */ new Set();
29243
+ return items.filter((item) => {
29244
+ if (seen.has(item.value)) return false;
29245
+ seen.add(item.value);
29246
+ return true;
29247
+ });
29248
+ }
29249
+ return items;
29250
+ } catch (e2) {
29251
+ console.error("[FormComponents] resolveDataLinkageOptions failed:", e2);
29252
+ return [];
29253
+ }
29254
+ }
29255
+ async function resolveDefaultValueLinkage(config3, runtime, formData) {
29256
+ if (!runtime?.fetchFormData) return void 0;
29257
+ try {
29258
+ const filters = config3.conditions.map((condition) => {
29259
+ const value = extractComparableValue(formData[condition.localFieldId]);
29260
+ return {
29261
+ fieldId: condition.remoteFieldId,
29262
+ operator: normalizeFilterOperator(condition.operator, value),
29263
+ value
29264
+ };
29265
+ });
29266
+ const result = await runtime.fetchFormData({
29267
+ formUuid: config3.formUuid,
29268
+ appType: runtime.appType || "",
29269
+ filters,
29270
+ conditionLogic: config3.conditionLogic,
29271
+ fieldId: config3.targetFieldId,
29272
+ pageSize: DEFAULT_OPTION_PAGE_SIZE
29273
+ });
29274
+ if (result.data.length > 0) {
29275
+ return result.data[0][config3.targetFieldId] ?? result.data[0].value ?? void 0;
29276
+ }
29277
+ return void 0;
29278
+ } catch (e2) {
29279
+ console.error("[FormComponents] resolveDefaultValueLinkage failed:", e2);
29280
+ return void 0;
29281
+ }
29282
+ }
29283
+
29284
+ // packages/sdk/src/components/fields/SelectField/useLinkedFormRemoteOptions.ts
29285
+ var DEFAULT_REMOTE_SEARCH_DEBOUNCE_MS = 350;
29286
+ function mergeOptionItems(...groups) {
29287
+ const result = [];
29288
+ const seen = /* @__PURE__ */ new Set();
29289
+ for (const group of groups) {
29290
+ for (const option of group || []) {
29291
+ if (!option || option.value === void 0 || option.value === null) continue;
29292
+ const key = String(option.value);
29293
+ if (seen.has(key)) continue;
29294
+ seen.add(key);
29295
+ result.push(option);
29296
+ }
29297
+ }
29298
+ return result;
29299
+ }
29300
+ function useLinkedFormRemoteOptions(optionSource, baseOptions, selectedOptions) {
29301
+ const { runtime } = useFormContext();
29302
+ const linkedForm = optionSource?.type === "linkedForm" ? optionSource.linkedForm : void 0;
29303
+ const enabled = Boolean(linkedForm?.remoteSearch);
29304
+ const minChars = linkedForm?.remoteSearchMinChars ?? 0;
29305
+ const [remoteOptions, setRemoteOptions] = useState53(null);
29306
+ const [loading, setLoading] = useState53(false);
29307
+ const timerRef = useRef78(null);
29308
+ const requestRef = useRef78(0);
29309
+ const reset = useCallback15(() => {
29310
+ requestRef.current += 1;
29311
+ if (timerRef.current) {
29312
+ clearTimeout(timerRef.current);
29313
+ timerRef.current = null;
29314
+ }
29315
+ setRemoteOptions(null);
29316
+ setLoading(false);
29317
+ }, []);
29318
+ const search = useCallback15(
29319
+ (keyword) => {
29320
+ if (!enabled || !linkedForm) return;
29321
+ const trimmedKeyword = keyword.trim();
29322
+ if (!trimmedKeyword) {
29323
+ reset();
29324
+ return;
29325
+ }
29326
+ if (trimmedKeyword.length < minChars) {
29327
+ requestRef.current += 1;
29328
+ setRemoteOptions([]);
29329
+ setLoading(false);
29330
+ return;
29331
+ }
29332
+ if (timerRef.current) clearTimeout(timerRef.current);
29333
+ setLoading(true);
29334
+ timerRef.current = setTimeout(() => {
29335
+ const requestId = requestRef.current + 1;
29336
+ requestRef.current = requestId;
29337
+ void resolveLinkedFormOptions(linkedForm, runtime, trimmedKeyword).then((options2) => {
29338
+ if (requestRef.current !== requestId) return;
29339
+ setRemoteOptions(options2);
29340
+ setLoading(false);
29341
+ });
29342
+ }, DEFAULT_REMOTE_SEARCH_DEBOUNCE_MS);
29343
+ },
29344
+ [enabled, linkedForm, minChars, reset, runtime]
29345
+ );
29346
+ useEffect56(
29347
+ () => () => {
29348
+ requestRef.current += 1;
29349
+ if (timerRef.current) clearTimeout(timerRef.current);
29350
+ },
29351
+ []
29352
+ );
29353
+ const options = useMemo32(
29354
+ () => mergeOptionItems(remoteOptions ?? baseOptions, selectedOptions),
29355
+ [baseOptions, remoteOptions, selectedOptions]
29356
+ );
29357
+ return {
29358
+ enabled,
29359
+ loading,
29360
+ options,
29361
+ reset,
29362
+ search
29363
+ };
29364
+ }
29365
+
29366
+ // packages/sdk/src/components/fields/SelectField/valueSync.ts
29367
+ function syncSelectValueToFields(valueSync, option, setFieldValue) {
29368
+ if (!valueSync?.length) return;
29369
+ for (const rule of valueSync) {
29370
+ if (!rule.targetFieldId) continue;
29371
+ const valuePath = rule.valuePath || "value";
29372
+ const nextValue = option ? option[valuePath] : rule.emptyValue ?? "";
29373
+ setFieldValue(rule.targetFieldId, nextValue ?? "");
29374
+ }
29375
+ }
29376
+
29088
29377
  // packages/sdk/src/components/fields/SelectField/SelectFieldPC.tsx
29089
29378
  import { jsx as jsx16 } from "react/jsx-runtime";
29090
29379
  function SelectFieldPC({
@@ -29102,18 +29391,25 @@ function SelectFieldPC({
29102
29391
  variant,
29103
29392
  size: size2,
29104
29393
  coloredOptions,
29394
+ optionSource,
29395
+ valueSync,
29105
29396
  onChange
29106
29397
  }) {
29107
29398
  const { formData, setFieldValue } = useFormContext();
29108
29399
  const value = controlledValue !== void 0 ? controlledValue : formData[fieldId];
29109
29400
  const disabled = behavior === "DISABLED";
29401
+ const selectedOptions = useMemo33(() => value ? [value] : [], [value]);
29402
+ const remote = useLinkedFormRemoteOptions(optionSource, options, selectedOptions);
29403
+ const displayOptions = remote.options;
29110
29404
  const handleChange = (val) => {
29111
29405
  if (val === void 0) {
29112
29406
  setFieldValue(fieldId, null);
29407
+ syncSelectValueToFields(valueSync, null, setFieldValue);
29113
29408
  onChange?.(null);
29114
29409
  } else {
29115
- const option = options.find((o) => o.value === val) ?? null;
29410
+ const option = displayOptions.find((o) => o.value === val) ?? null;
29116
29411
  setFieldValue(fieldId, option);
29412
+ syncSelectValueToFields(valueSync, option, setFieldValue);
29117
29413
  onChange?.(option);
29118
29414
  }
29119
29415
  };
@@ -29126,21 +29422,24 @@ function SelectFieldPC({
29126
29422
  placeholder,
29127
29423
  disabled,
29128
29424
  allowClear,
29129
- showSearch,
29130
29425
  optionFilterProp: optionFilterProp || "label",
29131
29426
  optionLabelProp,
29132
29427
  placement,
29133
29428
  variant,
29134
29429
  size: size2,
29135
- options: toAntdOptions(options, coloredOptions),
29430
+ options: toAntdOptions(displayOptions, coloredOptions),
29431
+ filterOption: remote.enabled ? false : void 0,
29432
+ notFoundContent: remote.loading ? "\u52A0\u8F7D\u4E2D..." : void 0,
29433
+ onSearch: remote.enabled ? remote.search : void 0,
29136
29434
  onChange: handleChange,
29435
+ showSearch: remote.enabled || showSearch,
29137
29436
  "data-testid": `selectfield-input-${fieldId}`
29138
29437
  }
29139
29438
  );
29140
29439
  }
29141
29440
 
29142
29441
  // packages/sdk/src/components/fields/SelectField/SelectFieldMobile.tsx
29143
- import { useMemo as useMemo32, useState as useState53 } from "react";
29442
+ import { useEffect as useEffect57, useMemo as useMemo34, useState as useState54 } from "react";
29144
29443
 
29145
29444
  // packages/sdk/src/components/fields/shared/MobileField.tsx
29146
29445
  import { CloseCircleFilled, RightOutlined, SearchOutlined } from "@ant-design/icons";
@@ -29314,35 +29613,56 @@ function SelectFieldMobile({
29314
29613
  options,
29315
29614
  allowClear,
29316
29615
  coloredOptions,
29616
+ optionSource,
29617
+ valueSync,
29317
29618
  onChange
29318
29619
  }) {
29319
29620
  const { formData, setFieldValue } = useFormContext();
29320
29621
  const value = controlledValue !== void 0 ? controlledValue : formData[fieldId];
29321
29622
  const disabled = behavior === "DISABLED";
29322
- const [visible, setVisible] = useState53(false);
29323
- const [search, setSearch] = useState53("");
29324
- const [tempValue, setTempValue] = useState53(value ?? null);
29325
- const filteredOptions = useMemo32(() => {
29623
+ const [visible, setVisible] = useState54(false);
29624
+ const [search, setSearch] = useState54("");
29625
+ const [tempValue, setTempValue] = useState54(value ?? null);
29626
+ const selectedOptions = useMemo34(() => value ? [value] : tempValue ? [tempValue] : [], [
29627
+ tempValue,
29628
+ value
29629
+ ]);
29630
+ const {
29631
+ enabled: remoteEnabled,
29632
+ loading: remoteLoading,
29633
+ options: remoteOptions,
29634
+ reset: resetRemoteOptions,
29635
+ search: searchRemoteOptions
29636
+ } = useLinkedFormRemoteOptions(optionSource, options, selectedOptions);
29637
+ const filteredOptions = useMemo34(() => {
29638
+ if (remoteEnabled) return remoteOptions;
29326
29639
  const keyword = search.trim().toLowerCase();
29327
29640
  if (!keyword) return options;
29328
29641
  return options.filter(
29329
29642
  (option) => String(option.label ?? option.value).toLowerCase().includes(keyword)
29330
29643
  );
29331
- }, [options, search]);
29644
+ }, [options, remoteEnabled, remoteOptions, search]);
29645
+ useEffect57(() => {
29646
+ if (!visible || !remoteEnabled) return;
29647
+ searchRemoteOptions(search);
29648
+ }, [remoteEnabled, search, searchRemoteOptions, visible]);
29332
29649
  const openSheet = () => {
29333
29650
  if (disabled) return;
29334
29651
  setTempValue(value ?? null);
29335
29652
  setSearch("");
29653
+ resetRemoteOptions();
29336
29654
  setVisible(true);
29337
29655
  };
29338
29656
  const handleConfirm = () => {
29339
29657
  setFieldValue(fieldId, tempValue);
29658
+ syncSelectValueToFields(valueSync, tempValue, setFieldValue);
29340
29659
  onChange?.(tempValue);
29341
29660
  setVisible(false);
29342
29661
  };
29343
29662
  const handleClear = () => {
29344
29663
  setTempValue(null);
29345
29664
  setFieldValue(fieldId, null);
29665
+ syncSelectValueToFields(valueSync, null, setFieldValue);
29346
29666
  onChange?.(null);
29347
29667
  };
29348
29668
  return /* @__PURE__ */ jsxs5("div", { className: inputClassName, "data-testid": `selectfield-input-${fieldId}`, children: [
@@ -29367,24 +29687,28 @@ function SelectFieldMobile({
29367
29687
  testId: `selectfield-popup-${fieldId}`,
29368
29688
  children: /* @__PURE__ */ jsxs5("div", { className: "sy-mobile-option-sheet", children: [
29369
29689
  /* @__PURE__ */ jsx18("div", { className: "sy-mobile-option-search", children: /* @__PURE__ */ jsx18(MobileSearchBox, { value: search, onChange: setSearch }) }),
29370
- /* @__PURE__ */ jsx18("div", { className: "sy-mobile-option-list", children: filteredOptions.map((option) => {
29371
- const active = tempValue?.value === option.value;
29372
- return /* @__PURE__ */ jsxs5(
29373
- "button",
29374
- {
29375
- type: "button",
29376
- className: `sy-mobile-option-row ${active ? "is-active" : ""}`,
29377
- disabled: option.disabled,
29378
- onClick: () => setTempValue(option),
29379
- "data-testid": `selectfield-option-${option.value}`,
29380
- children: [
29381
- /* @__PURE__ */ jsx18("span", { className: "sy-mobile-option-check is-radio", "aria-hidden": "true" }),
29382
- /* @__PURE__ */ jsx18("span", { className: "sy-mobile-option-label", children: renderOptionLabel(option, coloredOptions) })
29383
- ]
29384
- },
29385
- option.value
29386
- );
29387
- }) }),
29690
+ /* @__PURE__ */ jsxs5("div", { className: "sy-mobile-option-list", children: [
29691
+ remoteLoading ? /* @__PURE__ */ jsx18("div", { className: "sy-mobile-option-row", children: "\u52A0\u8F7D\u4E2D..." }) : null,
29692
+ !remoteLoading && filteredOptions.length === 0 ? /* @__PURE__ */ jsx18("div", { className: "sy-mobile-option-row", children: "\u6682\u65E0\u6570\u636E" }) : null,
29693
+ !remoteLoading && filteredOptions.map((option) => {
29694
+ const active = tempValue?.value === option.value;
29695
+ return /* @__PURE__ */ jsxs5(
29696
+ "button",
29697
+ {
29698
+ type: "button",
29699
+ className: `sy-mobile-option-row ${active ? "is-active" : ""}`,
29700
+ disabled: option.disabled,
29701
+ onClick: () => setTempValue(option),
29702
+ "data-testid": `selectfield-option-${option.value}`,
29703
+ children: [
29704
+ /* @__PURE__ */ jsx18("span", { className: "sy-mobile-option-check is-radio", "aria-hidden": "true" }),
29705
+ /* @__PURE__ */ jsx18("span", { className: "sy-mobile-option-label", children: renderOptionLabel(option, coloredOptions) })
29706
+ ]
29707
+ },
29708
+ option.value
29709
+ );
29710
+ })
29711
+ ] }),
29388
29712
  /* @__PURE__ */ jsx18(MobileSheetFooter, { onCancel: () => setVisible(false), onConfirm: handleConfirm })
29389
29713
  ] })
29390
29714
  }
@@ -29430,7 +29754,7 @@ function SelectField(props) {
29430
29754
  const { fieldBehaviors, setFieldValue, formData, registerField, unregisterField } = useFormContext();
29431
29755
  const { isMobile } = useDeviceDetect();
29432
29756
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
29433
- useEffect56(() => {
29757
+ useEffect58(() => {
29434
29758
  registerField(fieldId);
29435
29759
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
29436
29760
  setFieldValue(fieldId, defaultValue);
@@ -29455,7 +29779,7 @@ function SelectField(props) {
29455
29779
  }
29456
29780
 
29457
29781
  // packages/sdk/src/components/fields/MultiSelectField/index.tsx
29458
- import { useEffect as useEffect57 } from "react";
29782
+ import { useEffect as useEffect59 } from "react";
29459
29783
 
29460
29784
  // packages/sdk/src/components/fields/MultiSelectField/MultiSelectFieldPC.tsx
29461
29785
  import { Select as Select2 } from "antd";
@@ -29515,7 +29839,7 @@ function MultiSelectFieldPC({
29515
29839
  }
29516
29840
 
29517
29841
  // packages/sdk/src/components/fields/MultiSelectField/MultiSelectFieldMobile.tsx
29518
- import { useMemo as useMemo33, useState as useState54 } from "react";
29842
+ import { useMemo as useMemo35, useState as useState55 } from "react";
29519
29843
  import { jsx as jsx22, jsxs as jsxs6 } from "react/jsx-runtime";
29520
29844
  function MultiSelectFieldMobile({
29521
29845
  fieldId,
@@ -29532,17 +29856,17 @@ function MultiSelectFieldMobile({
29532
29856
  const { formData, setFieldValue } = useFormContext();
29533
29857
  const value = controlledValue !== void 0 ? controlledValue ?? [] : formData[fieldId] ?? [];
29534
29858
  const disabled = behavior === "DISABLED";
29535
- const [visible, setVisible] = useState54(false);
29536
- const [search, setSearch] = useState54("");
29537
- const [tempValues, setTempValues] = useState54(value);
29538
- const filteredOptions = useMemo33(() => {
29859
+ const [visible, setVisible] = useState55(false);
29860
+ const [search, setSearch] = useState55("");
29861
+ const [tempValues, setTempValues] = useState55(value);
29862
+ const filteredOptions = useMemo35(() => {
29539
29863
  const keyword = search.trim().toLowerCase();
29540
29864
  if (!keyword) return options;
29541
29865
  return options.filter(
29542
29866
  (option) => String(option.label ?? option.value).toLowerCase().includes(keyword)
29543
29867
  );
29544
29868
  }, [options, search]);
29545
- const tempValueSet = useMemo33(
29869
+ const tempValueSet = useMemo35(
29546
29870
  () => new Set(tempValues.map((option) => option.value)),
29547
29871
  [tempValues]
29548
29872
  );
@@ -29659,7 +29983,7 @@ function MultiSelectField(props) {
29659
29983
  const { fieldBehaviors, setFieldValue, formData, registerField, unregisterField } = useFormContext();
29660
29984
  const { isMobile } = useDeviceDetect();
29661
29985
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
29662
- useEffect57(() => {
29986
+ useEffect59(() => {
29663
29987
  registerField(fieldId);
29664
29988
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
29665
29989
  setFieldValue(fieldId, defaultValue);
@@ -29684,7 +30008,7 @@ function MultiSelectField(props) {
29684
30008
  }
29685
30009
 
29686
30010
  // packages/sdk/src/components/fields/RadioField/index.tsx
29687
- import { useEffect as useEffect58 } from "react";
30011
+ import { useEffect as useEffect60 } from "react";
29688
30012
 
29689
30013
  // packages/sdk/src/components/fields/RadioField/RadioFieldPC.tsx
29690
30014
  import { Radio as Radio2 } from "antd";
@@ -29830,7 +30154,7 @@ function RadioField(props) {
29830
30154
  const { fieldBehaviors, setFieldValue, formData, registerField, unregisterField } = useFormContext();
29831
30155
  const { isMobile } = useDeviceDetect();
29832
30156
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
29833
- useEffect58(() => {
30157
+ useEffect60(() => {
29834
30158
  registerField(fieldId);
29835
30159
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
29836
30160
  setFieldValue(fieldId, defaultValue);
@@ -29855,7 +30179,7 @@ function RadioField(props) {
29855
30179
  }
29856
30180
 
29857
30181
  // packages/sdk/src/components/fields/CheckboxField/index.tsx
29858
- import { useEffect as useEffect59 } from "react";
30182
+ import { useEffect as useEffect61 } from "react";
29859
30183
 
29860
30184
  // packages/sdk/src/components/fields/CheckboxField/CheckboxFieldPC.tsx
29861
30185
  import { Checkbox as Checkbox2 } from "antd";
@@ -30012,7 +30336,7 @@ function CheckboxField(props) {
30012
30336
  const { fieldBehaviors, setFieldValue, formData, registerField, unregisterField } = useFormContext();
30013
30337
  const { isMobile } = useDeviceDetect();
30014
30338
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
30015
- useEffect59(() => {
30339
+ useEffect61(() => {
30016
30340
  registerField(fieldId);
30017
30341
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
30018
30342
  setFieldValue(fieldId, defaultValue);
@@ -30037,7 +30361,7 @@ function CheckboxField(props) {
30037
30361
  }
30038
30362
 
30039
30363
  // packages/sdk/src/components/fields/DateField/index.tsx
30040
- import { useEffect as useEffect60 } from "react";
30364
+ import { useEffect as useEffect62 } from "react";
30041
30365
 
30042
30366
  // packages/sdk/src/components/fields/DateField/DateFieldPC.tsx
30043
30367
  import { DatePicker as DatePicker2 } from "antd";
@@ -30694,11 +31018,11 @@ function DateFieldPC({
30694
31018
  }
30695
31019
 
30696
31020
  // packages/sdk/src/components/fields/DateField/DateFieldMobile.tsx
30697
- import { useState as useState55 } from "react";
31021
+ import { useState as useState56 } from "react";
30698
31022
  import dayjs15 from "dayjs";
30699
31023
 
30700
31024
  // packages/sdk/src/components/fields/shared/MobileDatePicker.tsx
30701
- import React202 from "react";
31025
+ import React203 from "react";
30702
31026
  import dayjs14 from "dayjs";
30703
31027
  import { jsx as jsx34 } from "react/jsx-runtime";
30704
31028
  var pad2 = (value) => String(value).padStart(2, "0");
@@ -30795,7 +31119,7 @@ function MobileDateTimePickerView({
30795
31119
  onChange
30796
31120
  }) {
30797
31121
  const precision = resolveTimePickerPrecision(dateFormat);
30798
- const columns = React202.useMemo(
31122
+ const columns = React203.useMemo(
30799
31123
  () => [getDateOptions(value, min2, max2), ...getTimePickerColumns(precision)],
30800
31124
  [value, min2, max2, precision]
30801
31125
  );
@@ -30826,12 +31150,12 @@ function DateFieldMobile({
30826
31150
  const { formData, setFieldValue } = useFormContext();
30827
31151
  const value = formData[fieldId];
30828
31152
  const disabled = behavior === "DISABLED";
30829
- const [visible, setVisible] = useState55(false);
30830
- const [mode, setMode] = useState55("date");
31153
+ const [visible, setVisible] = useState56(false);
31154
+ const [mode, setMode] = useState56("date");
30831
31155
  const format2 = getDateDisplayFormat(dateFormat, showTime);
30832
31156
  const inferredShowTime = shouldShowDateTime(dateFormat, showTime);
30833
31157
  const pickerValue = value && dayjs15(value).isValid() ? dayjs15(value).toDate() : /* @__PURE__ */ new Date();
30834
- const [tempDate, setTempDate] = useState55(pickerValue);
31158
+ const [tempDate, setTempDate] = useState56(pickerValue);
30835
31159
  const { min: min2, max: max2 } = getDateMinMax(dateRestriction);
30836
31160
  const openPicker = () => {
30837
31161
  if (disabled) return;
@@ -30968,7 +31292,7 @@ function DateField(props) {
30968
31292
  const { fieldBehaviors, setFieldValue, formData, registerField, unregisterField } = useFormContext();
30969
31293
  const { isMobile } = useDeviceDetect();
30970
31294
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
30971
- useEffect60(() => {
31295
+ useEffect62(() => {
30972
31296
  registerField(fieldId);
30973
31297
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
30974
31298
  setFieldValue(fieldId, defaultValue);
@@ -30993,7 +31317,7 @@ function DateField(props) {
30993
31317
  }
30994
31318
 
30995
31319
  // packages/sdk/src/components/fields/CascadeDateField/index.tsx
30996
- import { useEffect as useEffect61 } from "react";
31320
+ import { useEffect as useEffect63 } from "react";
30997
31321
 
30998
31322
  // packages/sdk/src/components/fields/CascadeDateField/CascadeDateFieldPC.tsx
30999
31323
  import { DatePicker as DatePicker3 } from "antd";
@@ -31050,7 +31374,7 @@ function CascadeDateFieldPC({
31050
31374
  }
31051
31375
 
31052
31376
  // packages/sdk/src/components/fields/CascadeDateField/CascadeDateFieldMobile.tsx
31053
- import { useState as useState56 } from "react";
31377
+ import { useState as useState57 } from "react";
31054
31378
  import dayjs17 from "dayjs";
31055
31379
  import { jsx as jsx39, jsxs as jsxs10 } from "react/jsx-runtime";
31056
31380
  function CascadeDateFieldMobile({
@@ -31067,11 +31391,11 @@ function CascadeDateFieldMobile({
31067
31391
  const { formData, setFieldValue } = useFormContext();
31068
31392
  const value = normalizeDateRangeValue(formData[fieldId]);
31069
31393
  const disabled = behavior === "DISABLED";
31070
- const [visible, setVisible] = useState56(false);
31071
- const [tempRange, setTempRange] = useState56(null);
31072
- const [timeStep, setTimeStep] = useState56("start");
31073
- const [tempStart, setTempStart] = useState56(/* @__PURE__ */ new Date());
31074
- const [tempEnd, setTempEnd] = useState56(/* @__PURE__ */ new Date());
31394
+ const [visible, setVisible] = useState57(false);
31395
+ const [tempRange, setTempRange] = useState57(null);
31396
+ const [timeStep, setTimeStep] = useState57("start");
31397
+ const [tempStart, setTempStart] = useState57(/* @__PURE__ */ new Date());
31398
+ const [tempEnd, setTempEnd] = useState57(/* @__PURE__ */ new Date());
31075
31399
  const format2 = getDateDisplayFormat(dateFormat, showTime);
31076
31400
  const inferredShowTime = shouldShowDateTime(dateFormat, showTime);
31077
31401
  const startValue = value?.start && dayjs17(value.start).isValid() ? dayjs17(value.start).toDate() : void 0;
@@ -31235,7 +31559,7 @@ function CascadeDateField(props) {
31235
31559
  const { fieldBehaviors, setFieldValue, formData, registerField, unregisterField } = useFormContext();
31236
31560
  const { isMobile } = useDeviceDetect();
31237
31561
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
31238
- useEffect61(() => {
31562
+ useEffect63(() => {
31239
31563
  registerField(fieldId);
31240
31564
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
31241
31565
  setFieldValue(fieldId, defaultValue);
@@ -31260,10 +31584,10 @@ function CascadeDateField(props) {
31260
31584
  }
31261
31585
 
31262
31586
  // packages/sdk/src/components/fields/AttachmentField/index.tsx
31263
- import { useEffect as useEffect62 } from "react";
31587
+ import { useEffect as useEffect64 } from "react";
31264
31588
 
31265
31589
  // packages/sdk/src/components/fields/AttachmentField/AttachmentFieldPC.tsx
31266
- import React207 from "react";
31590
+ import React208 from "react";
31267
31591
  import { Upload } from "antd";
31268
31592
 
31269
31593
  // packages/sdk/src/components/fields/shared/FileDisplay.tsx
@@ -31598,15 +31922,15 @@ function AttachmentFieldPC({
31598
31922
  onChange
31599
31923
  }) {
31600
31924
  const { formData, setFieldValue, api } = useFormContext();
31601
- const value = React207.useMemo(
31925
+ const value = React208.useMemo(
31602
31926
  () => dedupeAttachmentItems(
31603
31927
  Array.isArray(formData[fieldId]) ? formData[fieldId] : []
31604
31928
  ),
31605
31929
  [fieldId, formData]
31606
31930
  );
31607
- const valueRef = React207.useRef(value);
31931
+ const valueRef = React208.useRef(value);
31608
31932
  const disabled = behavior === "DISABLED";
31609
- React207.useEffect(() => {
31933
+ React208.useEffect(() => {
31610
31934
  valueRef.current = value;
31611
31935
  }, [value]);
31612
31936
  const setValue = (items) => {
@@ -31861,7 +32185,7 @@ function AttachmentFieldPC({
31861
32185
  }
31862
32186
 
31863
32187
  // packages/sdk/src/components/fields/AttachmentField/AttachmentFieldMobile.tsx
31864
- import React208 from "react";
32188
+ import React209 from "react";
31865
32189
  import { jsx as jsx44, jsxs as jsxs13 } from "react/jsx-runtime";
31866
32190
  var PREVIEW_PAGE_EXTENSIONS2 = [
31867
32191
  "pdf",
@@ -31914,16 +32238,16 @@ function AttachmentFieldMobile({
31914
32238
  onChange
31915
32239
  }) {
31916
32240
  const { formData, setFieldValue, api } = useFormContext();
31917
- const value = React208.useMemo(
32241
+ const value = React209.useMemo(
31918
32242
  () => dedupeAttachmentItems(
31919
32243
  Array.isArray(formData[fieldId]) ? formData[fieldId] : []
31920
32244
  ),
31921
32245
  [fieldId, formData]
31922
32246
  );
31923
- const valueRef = React208.useRef(value);
31924
- const inputRef = React208.useRef(null);
32247
+ const valueRef = React209.useRef(value);
32248
+ const inputRef = React209.useRef(null);
31925
32249
  const disabled = behavior === "DISABLED";
31926
- React208.useEffect(() => {
32250
+ React209.useEffect(() => {
31927
32251
  valueRef.current = value;
31928
32252
  }, [value]);
31929
32253
  const setValue = (items) => {
@@ -32284,7 +32608,7 @@ function AttachmentField(props) {
32284
32608
  const { fieldBehaviors, setFieldValue, formData, registerField, unregisterField } = useFormContext();
32285
32609
  const { isMobile } = useDeviceDetect();
32286
32610
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
32287
- useEffect62(() => {
32611
+ useEffect64(() => {
32288
32612
  registerField(fieldId);
32289
32613
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
32290
32614
  setFieldValue(fieldId, defaultValue);
@@ -32309,10 +32633,10 @@ function AttachmentField(props) {
32309
32633
  }
32310
32634
 
32311
32635
  // packages/sdk/src/components/fields/ImageField/index.tsx
32312
- import { useEffect as useEffect63 } from "react";
32636
+ import { useEffect as useEffect65 } from "react";
32313
32637
 
32314
32638
  // packages/sdk/src/components/fields/ImageField/ImageFieldPC.tsx
32315
- import React210 from "react";
32639
+ import React211 from "react";
32316
32640
  import { Upload as Upload2 } from "antd";
32317
32641
  import { Fragment as Fragment6, jsx as jsx47, jsxs as jsxs15 } from "react/jsx-runtime";
32318
32642
  var createLocalItem3 = (file) => {
@@ -32331,9 +32655,9 @@ var createLocalItem3 = (file) => {
32331
32655
  };
32332
32656
  };
32333
32657
  function ImageThumbContent({ item }) {
32334
- const [imageFailed, setImageFailed] = React210.useState(false);
32658
+ const [imageFailed, setImageFailed] = React211.useState(false);
32335
32659
  const src = item.previewUrl || item.url;
32336
- React210.useEffect(() => {
32660
+ React211.useEffect(() => {
32337
32661
  setImageFailed(false);
32338
32662
  }, [src]);
32339
32663
  if (src && !imageFailed) {
@@ -32361,15 +32685,15 @@ function ImageFieldPC({
32361
32685
  onChange
32362
32686
  }) {
32363
32687
  const { formData, setFieldValue, api } = useFormContext();
32364
- const value = React210.useMemo(
32688
+ const value = React211.useMemo(
32365
32689
  () => dedupeAttachmentItems(
32366
32690
  Array.isArray(formData[fieldId]) ? formData[fieldId] : []
32367
32691
  ),
32368
32692
  [fieldId, formData]
32369
32693
  );
32370
- const valueRef = React210.useRef(value);
32694
+ const valueRef = React211.useRef(value);
32371
32695
  const disabled = behavior === "DISABLED";
32372
- React210.useEffect(() => {
32696
+ React211.useEffect(() => {
32373
32697
  valueRef.current = value;
32374
32698
  }, [value]);
32375
32699
  const setValue = (items) => {
@@ -32628,7 +32952,7 @@ function ImageFieldPC({
32628
32952
  }
32629
32953
 
32630
32954
  // packages/sdk/src/components/fields/ImageField/ImageFieldMobile.tsx
32631
- import React211 from "react";
32955
+ import React212 from "react";
32632
32956
  import { Fragment as Fragment7, jsx as jsx48, jsxs as jsxs16 } from "react/jsx-runtime";
32633
32957
  var createLocalItem4 = (file) => {
32634
32958
  const uid = createUid("image");
@@ -32646,9 +32970,9 @@ var createLocalItem4 = (file) => {
32646
32970
  };
32647
32971
  };
32648
32972
  function ImageThumbContent2({ item }) {
32649
- const [imageFailed, setImageFailed] = React211.useState(false);
32973
+ const [imageFailed, setImageFailed] = React212.useState(false);
32650
32974
  const src = item.previewUrl || item.url;
32651
- React211.useEffect(() => {
32975
+ React212.useEffect(() => {
32652
32976
  setImageFailed(false);
32653
32977
  }, [src]);
32654
32978
  if (src && !imageFailed) {
@@ -32675,16 +32999,16 @@ function ImageFieldMobile({
32675
32999
  onChange
32676
33000
  }) {
32677
33001
  const { formData, setFieldValue, api } = useFormContext();
32678
- const value = React211.useMemo(
33002
+ const value = React212.useMemo(
32679
33003
  () => dedupeAttachmentItems(
32680
33004
  Array.isArray(formData[fieldId]) ? formData[fieldId] : []
32681
33005
  ),
32682
33006
  [fieldId, formData]
32683
33007
  );
32684
- const valueRef = React211.useRef(value);
32685
- const inputRef = React211.useRef(null);
33008
+ const valueRef = React212.useRef(value);
33009
+ const inputRef = React212.useRef(null);
32686
33010
  const disabled = behavior === "DISABLED";
32687
- React211.useEffect(() => {
33011
+ React212.useEffect(() => {
32688
33012
  valueRef.current = value;
32689
33013
  }, [value]);
32690
33014
  const setValue = (items) => {
@@ -32846,13 +33170,13 @@ function ImageFieldMobile({
32846
33170
  }
32847
33171
 
32848
33172
  // packages/sdk/src/components/fields/ImageField/ImageFieldReadonly.tsx
32849
- import React212 from "react";
33173
+ import React213 from "react";
32850
33174
  import { Fragment as Fragment8, jsx as jsx49, jsxs as jsxs17 } from "react/jsx-runtime";
32851
33175
  var getTicketUrl2 = (ticket, fallback) => typeof ticket === "string" ? ticket : ticket?.previewUrl || ticket?.downloadUrl || ticket?.relayUrl || ticket?.url || fallback;
32852
33176
  function ImageThumbContent3({ item, testId }) {
32853
- const [imageFailed, setImageFailed] = React212.useState(false);
33177
+ const [imageFailed, setImageFailed] = React213.useState(false);
32854
33178
  const src = item.previewUrl || item.url;
32855
- React212.useEffect(() => {
33179
+ React213.useEffect(() => {
32856
33180
  setImageFailed(false);
32857
33181
  }, [src]);
32858
33182
  if (src && !imageFailed) {
@@ -32876,8 +33200,8 @@ function ImageFieldReadonly({
32876
33200
  const { formData, api } = useFormContext();
32877
33201
  const { isMobile } = useDeviceDetect();
32878
33202
  const value = formData[fieldId] ?? [];
32879
- const [previewUrl, setPreviewUrl] = React212.useState("");
32880
- const [previewName, setPreviewName] = React212.useState("");
33203
+ const [previewUrl, setPreviewUrl] = React213.useState("");
33204
+ const [previewName, setPreviewName] = React213.useState("");
32881
33205
  if (value.length === 0) {
32882
33206
  return /* @__PURE__ */ jsx49(
32883
33207
  "div",
@@ -33069,7 +33393,7 @@ function ImageField(props) {
33069
33393
  const { fieldBehaviors, setFieldValue, formData, registerField, unregisterField } = useFormContext();
33070
33394
  const { isMobile } = useDeviceDetect();
33071
33395
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
33072
- useEffect63(() => {
33396
+ useEffect65(() => {
33073
33397
  registerField(fieldId);
33074
33398
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
33075
33399
  setFieldValue(fieldId, defaultValue);
@@ -33094,10 +33418,10 @@ function ImageField(props) {
33094
33418
  }
33095
33419
 
33096
33420
  // packages/sdk/src/components/fields/SubFormField/index.tsx
33097
- import { useEffect as useEffect64 } from "react";
33421
+ import { useEffect as useEffect66 } from "react";
33098
33422
 
33099
33423
  // packages/sdk/src/components/fields/SubFormField/SubFormCell.tsx
33100
- import { useMemo as useMemo34 } from "react";
33424
+ import { useMemo as useMemo36 } from "react";
33101
33425
  import { jsx as jsx51 } from "react/jsx-runtime";
33102
33426
  var stringifyFallbackValue = (value) => {
33103
33427
  if (value === void 0 || value === null) return "";
@@ -33118,7 +33442,7 @@ function SubFormCell({
33118
33442
  const scopedFieldId = `${parentFieldId}.${rowIndex}.${column.fieldId}`;
33119
33443
  const cellValue = row[column.fieldId];
33120
33444
  const resolvedBehavior = behavior === "DISABLED" || behavior === "READONLY" ? behavior : column.behavior ?? behavior ?? "NORMAL";
33121
- const childContext = useMemo34(
33445
+ const childContext = useMemo36(
33122
33446
  () => ({
33123
33447
  ...parentContext,
33124
33448
  formData: {
@@ -33412,7 +33736,7 @@ function SubFormField(props) {
33412
33736
  const { fieldBehaviors, setFieldValue, formData, registerField, unregisterField } = useFormContext();
33413
33737
  const { isMobile } = useDeviceDetect();
33414
33738
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
33415
- useEffect64(() => {
33739
+ useEffect66(() => {
33416
33740
  registerField(fieldId);
33417
33741
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
33418
33742
  setFieldValue(fieldId, defaultValue);
@@ -33437,14 +33761,14 @@ function SubFormField(props) {
33437
33761
  }
33438
33762
 
33439
33763
  // packages/sdk/src/components/fields/UserSelectField/index.tsx
33440
- import { useEffect as useEffect70 } from "react";
33764
+ import { useEffect as useEffect72 } from "react";
33441
33765
 
33442
33766
  // packages/sdk/src/components/fields/UserSelectField/UserSelectFieldPC.tsx
33443
- import { useEffect as useEffect67, useMemo as useMemo37, useState as useState59 } from "react";
33767
+ import { useEffect as useEffect69, useMemo as useMemo39, useState as useState60 } from "react";
33444
33768
  import { Select as Select3 } from "antd";
33445
33769
 
33446
33770
  // packages/sdk/src/components/fields/shared/UserPicker.tsx
33447
- import { useCallback as useCallback16, useEffect as useEffect66, useMemo as useMemo36, useState as useState58 } from "react";
33771
+ import { useCallback as useCallback17, useEffect as useEffect68, useMemo as useMemo38, useState as useState59 } from "react";
33448
33772
  import {
33449
33773
  Avatar as Avatar2,
33450
33774
  Button as Button2,
@@ -33462,7 +33786,7 @@ import {
33462
33786
  import { SearchOutlined as SearchOutlined2, TeamOutlined, UserOutlined } from "@ant-design/icons";
33463
33787
 
33464
33788
  // packages/sdk/src/components/fields/shared/useLazyDepartmentTree.ts
33465
- import { useCallback as useCallback15, useEffect as useEffect65, useMemo as useMemo35, useRef as useRef78, useState as useState57 } from "react";
33789
+ import { useCallback as useCallback16, useEffect as useEffect67, useMemo as useMemo37, useRef as useRef79, useState as useState58 } from "react";
33466
33790
  var toLazyNode = (node) => {
33467
33791
  const normalized = normalizeDepartmentNode(node);
33468
33792
  const id = getDepartmentId(normalized);
@@ -33512,15 +33836,15 @@ function buildIndexes(nodes) {
33512
33836
  return { nodeMap, parentMap, flatNodes };
33513
33837
  }
33514
33838
  function useLazyDepartmentTree(api, configuredTreeData) {
33515
- const [treeData, setTreeDataState] = useState57(
33839
+ const [treeData, setTreeDataState] = useState58(
33516
33840
  () => (configuredTreeData || []).map(toLazyNode)
33517
33841
  );
33518
- const [treeLoading, setTreeLoading] = useState57(false);
33519
- const treeDataRef = useRef78(treeData);
33520
- const rootsLoadedRef = useRef78(Boolean(configuredTreeData?.length));
33521
- const rootPromiseRef = useRef78(null);
33522
- const childPromiseRef = useRef78({});
33523
- const setTreeData = useCallback15(
33842
+ const [treeLoading, setTreeLoading] = useState58(false);
33843
+ const treeDataRef = useRef79(treeData);
33844
+ const rootsLoadedRef = useRef79(Boolean(configuredTreeData?.length));
33845
+ const rootPromiseRef = useRef79(null);
33846
+ const childPromiseRef = useRef79({});
33847
+ const setTreeData = useCallback16(
33524
33848
  (next) => {
33525
33849
  const resolved = typeof next === "function" ? next(treeDataRef.current) : next;
33526
33850
  treeDataRef.current = resolved;
@@ -33529,13 +33853,13 @@ function useLazyDepartmentTree(api, configuredTreeData) {
33529
33853
  },
33530
33854
  []
33531
33855
  );
33532
- useEffect65(() => {
33856
+ useEffect67(() => {
33533
33857
  if (!configuredTreeData) return;
33534
33858
  const next = configuredTreeData.map(toLazyNode);
33535
33859
  rootsLoadedRef.current = next.length > 0;
33536
33860
  setTreeData(next);
33537
33861
  }, [configuredTreeData, setTreeData]);
33538
- const loadRootDepartments = useCallback15(async () => {
33862
+ const loadRootDepartments = useCallback16(async () => {
33539
33863
  if (rootsLoadedRef.current) return treeDataRef.current;
33540
33864
  if (rootPromiseRef.current) return rootPromiseRef.current;
33541
33865
  setTreeLoading(true);
@@ -33551,7 +33875,7 @@ function useLazyDepartmentTree(api, configuredTreeData) {
33551
33875
  rootPromiseRef.current = promise;
33552
33876
  return promise;
33553
33877
  }, [api, setTreeData]);
33554
- const loadChildren = useCallback15(
33878
+ const loadChildren = useCallback16(
33555
33879
  async (parentId) => {
33556
33880
  const id = String(parentId || "");
33557
33881
  if (!id) return [];
@@ -33572,8 +33896,8 @@ function useLazyDepartmentTree(api, configuredTreeData) {
33572
33896
  },
33573
33897
  [api, setTreeData]
33574
33898
  );
33575
- const indexes = useMemo35(() => buildIndexes(treeData), [treeData]);
33576
- useEffect65(() => {
33899
+ const indexes = useMemo37(() => buildIndexes(treeData), [treeData]);
33900
+ useEffect67(() => {
33577
33901
  void loadRootDepartments();
33578
33902
  }, [loadRootDepartments]);
33579
33903
  return {
@@ -33618,24 +33942,24 @@ function UserPickerPanel({
33618
33942
  flatNodes,
33619
33943
  loadChildren
33620
33944
  } = useLazyDepartmentTree(api, treeData);
33621
- const [departmentKeyword, setDepartmentKeyword] = useState58("");
33622
- const [memberKeyword, setMemberKeyword] = useState58("");
33623
- const [mobileKeyword, setMobileKeyword] = useState58("");
33624
- const [currentDeptId, setCurrentDeptId] = useState58("");
33625
- const [expandedKeys, setExpandedKeys] = useState58([]);
33626
- const [members, setMembers] = useState58(() => normalizeUsers(dataSource));
33627
- const [memberPage, setMemberPage] = useState58(1);
33628
- const [memberPageSize, setMemberPageSize] = useState58(DEFAULT_MEMBER_PAGE_SIZE);
33629
- const [memberTotal, setMemberTotal] = useState58(() => normalizeUsers(dataSource).length);
33630
- const [memberReloadKey, setMemberReloadKey] = useState58(0);
33631
- const [loading, setLoading] = useState58(false);
33632
- const [selected, setSelected] = useState58(() => normalizeUsers(value));
33945
+ const [departmentKeyword, setDepartmentKeyword] = useState59("");
33946
+ const [memberKeyword, setMemberKeyword] = useState59("");
33947
+ const [mobileKeyword, setMobileKeyword] = useState59("");
33948
+ const [currentDeptId, setCurrentDeptId] = useState59("");
33949
+ const [expandedKeys, setExpandedKeys] = useState59([]);
33950
+ const [members, setMembers] = useState59(() => normalizeUsers(dataSource));
33951
+ const [memberPage, setMemberPage] = useState59(1);
33952
+ const [memberPageSize, setMemberPageSize] = useState59(DEFAULT_MEMBER_PAGE_SIZE);
33953
+ const [memberTotal, setMemberTotal] = useState59(() => normalizeUsers(dataSource).length);
33954
+ const [memberReloadKey, setMemberReloadKey] = useState59(0);
33955
+ const [loading, setLoading] = useState59(false);
33956
+ const [selected, setSelected] = useState59(() => normalizeUsers(value));
33633
33957
  const selectedIds = selected.map(getUserId);
33634
33958
  const MobileSearchBar = getMobileComponent("SearchBar");
33635
33959
  const activeMemberKeyword = (mobile ? mobileKeyword : memberKeyword).trim();
33636
- const staticUsers = useMemo36(() => normalizeUsers(dataSource), [dataSource]);
33960
+ const staticUsers = useMemo38(() => normalizeUsers(dataSource), [dataSource]);
33637
33961
  const hasStaticUserSource = staticUsers.length > 0;
33638
- useEffect66(() => {
33962
+ useEffect68(() => {
33639
33963
  if (mobile) return;
33640
33964
  if (currentDeptId || deptTreeData.length === 0) return;
33641
33965
  setExpandedKeys(deptTreeData.map((node) => getDepartmentId(node)));
@@ -33643,17 +33967,17 @@ function UserPickerPanel({
33643
33967
  setCurrentDeptId(getDepartmentId(deptTreeData[0]));
33644
33968
  }
33645
33969
  }, [currentDeptId, deptTreeData, loadAllWhenNoDepartment, mobile]);
33646
- useEffect66(() => {
33970
+ useEffect68(() => {
33647
33971
  setMemberPage(1);
33648
33972
  }, [activeMemberKeyword, currentDeptId, dataSource, mobile]);
33649
- const handleDepartmentSelect = useCallback16((deptId) => {
33973
+ const handleDepartmentSelect = useCallback17((deptId) => {
33650
33974
  const nextDeptId = String(deptId || "");
33651
33975
  setCurrentDeptId(nextDeptId);
33652
33976
  setMemberKeyword("");
33653
33977
  setMemberPage(1);
33654
33978
  setMemberReloadKey((current) => current + 1);
33655
33979
  }, []);
33656
- useEffect66(() => {
33980
+ useEffect68(() => {
33657
33981
  let active = true;
33658
33982
  const keyword = activeMemberKeyword;
33659
33983
  if (hasStaticUserSource) {
@@ -33726,7 +34050,7 @@ function UserPickerPanel({
33726
34050
  memberReloadKey,
33727
34051
  staticUsers
33728
34052
  ]);
33729
- const currentPath = useMemo36(() => {
34053
+ const currentPath = useMemo38(() => {
33730
34054
  if (!currentDeptId) return [];
33731
34055
  const path = [];
33732
34056
  let cursor = currentDeptId;
@@ -33738,7 +34062,7 @@ function UserPickerPanel({
33738
34062
  }
33739
34063
  return path;
33740
34064
  }, [currentDeptId, nodeMap, parentMap]);
33741
- const mobileDepartments = useMemo36(() => {
34065
+ const mobileDepartments = useMemo38(() => {
33742
34066
  const keyword = mobileKeyword.trim().toLowerCase();
33743
34067
  if (keyword) {
33744
34068
  return flatNodes.filter((item) => item.name.toLowerCase().includes(keyword)).map((item) => item.node);
@@ -33986,20 +34310,20 @@ function UserSelectFieldPC({
33986
34310
  }) {
33987
34311
  const { formData, setFieldValue, api } = useFormContext();
33988
34312
  const rawValue = formData[fieldId];
33989
- const value = useMemo37(() => normalizeUserArray(rawValue), [rawValue]);
34313
+ const value = useMemo39(() => normalizeUserArray(rawValue), [rawValue]);
33990
34314
  const disabled = behavior === "DISABLED";
33991
- const [optionsSource, setOptionsSource] = useState59(
34315
+ const [optionsSource, setOptionsSource] = useState60(
33992
34316
  () => dataSource.map(normalizeUser)
33993
34317
  );
33994
- const [loading, setLoading] = useState59(false);
33995
- const [pickerOpen, setPickerOpen] = useState59(false);
34318
+ const [loading, setLoading] = useState60(false);
34319
+ const [pickerOpen, setPickerOpen] = useState60(false);
33996
34320
  const pickerDataSource = dataSource.length > 0 ? dataSource : void 0;
33997
- useEffect67(() => {
34321
+ useEffect69(() => {
33998
34322
  if (dataSource.length) {
33999
34323
  setOptionsSource(dataSource.map(normalizeUser));
34000
34324
  }
34001
34325
  }, [dataSource]);
34002
- useEffect67(() => {
34326
+ useEffect69(() => {
34003
34327
  setOptionsSource((current) => {
34004
34328
  const merged = [...current];
34005
34329
  let changed = false;
@@ -34012,7 +34336,7 @@ function UserSelectFieldPC({
34012
34336
  return changed ? merged : current;
34013
34337
  });
34014
34338
  }, [value]);
34015
- useEffect67(() => {
34339
+ useEffect69(() => {
34016
34340
  const missing = value.filter((item) => getUserId(item) && getUserNameLikeId(item));
34017
34341
  if (missing.length === 0) return;
34018
34342
  let cancelled = false;
@@ -34055,7 +34379,7 @@ function UserSelectFieldPC({
34055
34379
  setLoading(false);
34056
34380
  }
34057
34381
  };
34058
- useEffect67(() => {
34382
+ useEffect69(() => {
34059
34383
  fetchUsers();
34060
34384
  }, []);
34061
34385
  const handleChange = (selectedIds) => {
@@ -34080,7 +34404,7 @@ function UserSelectFieldPC({
34080
34404
  setFieldValue(fieldId, normalized);
34081
34405
  onChange?.(normalized);
34082
34406
  };
34083
- const options = useMemo37(
34407
+ const options = useMemo39(
34084
34408
  () => optionsSource.map((u) => ({
34085
34409
  value: getUserId(u),
34086
34410
  label: formatUserDisplay(u, displayFormat)
@@ -34144,7 +34468,7 @@ function getUserNameLikeId(user) {
34144
34468
  }
34145
34469
 
34146
34470
  // packages/sdk/src/components/fields/UserSelectField/UserSelectFieldMobile.tsx
34147
- import { useEffect as useEffect68, useMemo as useMemo38, useState as useState60 } from "react";
34471
+ import { useEffect as useEffect70, useMemo as useMemo40, useState as useState61 } from "react";
34148
34472
  import { jsx as jsx58, jsxs as jsxs23 } from "react/jsx-runtime";
34149
34473
  var getMobilePopup = () => {
34150
34474
  try {
@@ -34168,19 +34492,19 @@ function UserSelectFieldMobile({
34168
34492
  }) {
34169
34493
  const { formData, setFieldValue, api } = useFormContext();
34170
34494
  const rawValue = formData[fieldId];
34171
- const value = useMemo38(() => normalizeUserArray(rawValue), [rawValue]);
34495
+ const value = useMemo40(() => normalizeUserArray(rawValue), [rawValue]);
34172
34496
  const disabled = behavior === "DISABLED";
34173
- const [showPicker, setShowPicker] = useState60(false);
34174
- const [optionsSource, setOptionsSource] = useState60(
34497
+ const [showPicker, setShowPicker] = useState61(false);
34498
+ const [optionsSource, setOptionsSource] = useState61(
34175
34499
  () => dataSource.map(normalizeUser)
34176
34500
  );
34177
34501
  const pickerDataSource = dataSource.length > 0 ? dataSource : void 0;
34178
- useEffect68(() => {
34502
+ useEffect70(() => {
34179
34503
  if (dataSource.length) {
34180
34504
  setOptionsSource(dataSource.map(normalizeUser));
34181
34505
  }
34182
34506
  }, [dataSource]);
34183
- useEffect68(() => {
34507
+ useEffect70(() => {
34184
34508
  setOptionsSource((current) => {
34185
34509
  const merged = [...current];
34186
34510
  let changed = false;
@@ -34276,7 +34600,7 @@ function UserSelectFieldMobile({
34276
34600
  }
34277
34601
 
34278
34602
  // packages/sdk/src/components/fields/UserSelectField/UserSelectFieldReadonly.tsx
34279
- import { useEffect as useEffect69, useMemo as useMemo39 } from "react";
34603
+ import { useEffect as useEffect71, useMemo as useMemo41 } from "react";
34280
34604
  import { jsx as jsx59 } from "react/jsx-runtime";
34281
34605
  function UserSelectFieldReadonly({
34282
34606
  fieldId,
@@ -34285,8 +34609,8 @@ function UserSelectFieldReadonly({
34285
34609
  }) {
34286
34610
  const { formData, setFieldValue, api } = useFormContext();
34287
34611
  const rawValue = formData[fieldId];
34288
- const value = useMemo39(() => normalizeUserArray(rawValue), [rawValue]);
34289
- useEffect69(() => {
34612
+ const value = useMemo41(() => normalizeUserArray(rawValue), [rawValue]);
34613
+ useEffect71(() => {
34290
34614
  const missing = value.filter((item) => getUserNameLikeId2(item));
34291
34615
  if (missing.length === 0) return;
34292
34616
  let cancelled = false;
@@ -34338,7 +34662,7 @@ function UserSelectField(props) {
34338
34662
  const { fieldBehaviors, setFieldValue, formData, registerField, unregisterField } = useFormContext();
34339
34663
  const { isMobile } = useDeviceDetect();
34340
34664
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
34341
- useEffect70(() => {
34665
+ useEffect72(() => {
34342
34666
  registerField(fieldId);
34343
34667
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
34344
34668
  setFieldValue(fieldId, defaultValue);
@@ -34363,14 +34687,14 @@ function UserSelectField(props) {
34363
34687
  }
34364
34688
 
34365
34689
  // packages/sdk/src/components/fields/DepartmentSelectField/index.tsx
34366
- import { useEffect as useEffect73 } from "react";
34690
+ import { useEffect as useEffect75 } from "react";
34367
34691
 
34368
34692
  // packages/sdk/src/components/fields/DepartmentSelectField/DepartmentSelectFieldPC.tsx
34369
- import { useEffect as useEffect71, useMemo as useMemo41, useRef as useRef79, useState as useState62 } from "react";
34693
+ import { useEffect as useEffect73, useMemo as useMemo43, useRef as useRef80, useState as useState63 } from "react";
34370
34694
  import { TreeSelect as TreeSelect2 } from "antd";
34371
34695
 
34372
34696
  // packages/sdk/src/components/fields/shared/DepartmentPicker.tsx
34373
- import { useMemo as useMemo40, useState as useState61 } from "react";
34697
+ import { useMemo as useMemo42, useState as useState62 } from "react";
34374
34698
  import { Button as Button3, Checkbox as Checkbox4, Empty as Empty3, Input as Input5, List as List4, Modal as Modal3, Space as Space3, Spin as Spin2, Tag as Tag4, Tree as Tree2 } from "antd";
34375
34699
  import { ApartmentOutlined, SearchOutlined as SearchOutlined3 } from "@ant-design/icons";
34376
34700
  import { jsx as jsx61, jsxs as jsxs24 } from "react/jsx-runtime";
@@ -34413,17 +34737,17 @@ function DepartmentPickerPanel({
34413
34737
  flatNodes,
34414
34738
  loadChildren
34415
34739
  } = useLazyDepartmentTree(api, treeData);
34416
- const [keyword, setKeyword] = useState61("");
34417
- const [selected, setSelected] = useState61(() => normalizeSelection(value));
34418
- const [expandedKeys, setExpandedKeys] = useState61([]);
34419
- const [currentDeptId, setCurrentDeptId] = useState61(null);
34740
+ const [keyword, setKeyword] = useState62("");
34741
+ const [selected, setSelected] = useState62(() => normalizeSelection(value));
34742
+ const [expandedKeys, setExpandedKeys] = useState62([]);
34743
+ const [currentDeptId, setCurrentDeptId] = useState62(null);
34420
34744
  const selectedIds = selected.map((item) => item.id);
34421
34745
  const MobileSearchBar = getMobileComponent2("SearchBar");
34422
- const filteredTreeData = useMemo40(
34746
+ const filteredTreeData = useMemo42(
34423
34747
  () => matchSearch(loadedTreeData, keyword.trim()),
34424
34748
  [keyword, loadedTreeData]
34425
34749
  );
34426
- const currentPath = useMemo40(() => {
34750
+ const currentPath = useMemo42(() => {
34427
34751
  if (!currentDeptId) return [];
34428
34752
  const path = [];
34429
34753
  let cursor = currentDeptId;
@@ -34435,7 +34759,7 @@ function DepartmentPickerPanel({
34435
34759
  }
34436
34760
  return path;
34437
34761
  }, [currentDeptId, nodeMap, parentMap]);
34438
- const mobileList = useMemo40(() => {
34762
+ const mobileList = useMemo42(() => {
34439
34763
  if (keyword.trim()) {
34440
34764
  const lower = keyword.trim().toLowerCase();
34441
34765
  return flatNodes.filter((item) => item.name.toLowerCase().includes(lower)).map((item) => item.node);
@@ -34658,13 +34982,13 @@ function DepartmentSelectFieldPC({
34658
34982
  }) {
34659
34983
  const { formData, setFieldValue, api } = useFormContext();
34660
34984
  const rawValue = formData[fieldId];
34661
- const value = useMemo41(() => normalizeDepartmentArray(rawValue), [rawValue]);
34985
+ const value = useMemo43(() => normalizeDepartmentArray(rawValue), [rawValue]);
34662
34986
  const disabled = behavior === "DISABLED";
34663
34987
  const configuredTreeData = treeData ?? EMPTY_TREE_DATA;
34664
- const remoteLoadedRef = useRef79(false);
34665
- const [loadedTreeData, setLoadedTreeData] = useState62(configuredTreeData);
34666
- const [pickerOpen, setPickerOpen] = useState62(false);
34667
- useEffect71(() => {
34988
+ const remoteLoadedRef = useRef80(false);
34989
+ const [loadedTreeData, setLoadedTreeData] = useState63(configuredTreeData);
34990
+ const [pickerOpen, setPickerOpen] = useState63(false);
34991
+ useEffect73(() => {
34668
34992
  if (configuredTreeData.length) {
34669
34993
  setLoadedTreeData(configuredTreeData.map(normalizeDepartmentNode));
34670
34994
  return;
@@ -34769,7 +35093,7 @@ function DepartmentSelectFieldPC({
34769
35093
  }
34770
35094
 
34771
35095
  // packages/sdk/src/components/fields/DepartmentSelectField/DepartmentSelectFieldMobile.tsx
34772
- import { useEffect as useEffect72, useMemo as useMemo42, useRef as useRef80, useState as useState63 } from "react";
35096
+ import { useEffect as useEffect74, useMemo as useMemo44, useRef as useRef81, useState as useState64 } from "react";
34773
35097
  import { jsx as jsx63, jsxs as jsxs26 } from "react/jsx-runtime";
34774
35098
  var EMPTY_TREE_DATA2 = [];
34775
35099
  function toDepartmentValue2(item) {
@@ -34799,13 +35123,13 @@ function DepartmentSelectFieldMobile({
34799
35123
  }) {
34800
35124
  const { formData, setFieldValue, api } = useFormContext();
34801
35125
  const rawValue = formData[fieldId];
34802
- const value = useMemo42(() => normalizeDepartmentArray(rawValue), [rawValue]);
35126
+ const value = useMemo44(() => normalizeDepartmentArray(rawValue), [rawValue]);
34803
35127
  const disabled = behavior === "DISABLED";
34804
- const [showPicker, setShowPicker] = useState63(false);
35128
+ const [showPicker, setShowPicker] = useState64(false);
34805
35129
  const configuredTreeData = treeData ?? EMPTY_TREE_DATA2;
34806
- const remoteLoadedRef = useRef80(false);
34807
- const [loadedTreeData, setLoadedTreeData] = useState63(configuredTreeData);
34808
- useEffect72(() => {
35130
+ const remoteLoadedRef = useRef81(false);
35131
+ const [loadedTreeData, setLoadedTreeData] = useState64(configuredTreeData);
35132
+ useEffect74(() => {
34809
35133
  if (configuredTreeData.length) {
34810
35134
  setLoadedTreeData(configuredTreeData.map(normalizeDepartmentNode));
34811
35135
  }
@@ -34899,7 +35223,7 @@ function DepartmentSelectFieldMobile({
34899
35223
  }
34900
35224
 
34901
35225
  // packages/sdk/src/components/fields/DepartmentSelectField/DepartmentSelectFieldReadonly.tsx
34902
- import { useMemo as useMemo43 } from "react";
35226
+ import { useMemo as useMemo45 } from "react";
34903
35227
  import { jsx as jsx64 } from "react/jsx-runtime";
34904
35228
  function DepartmentSelectFieldReadonly({
34905
35229
  fieldId,
@@ -34909,7 +35233,7 @@ function DepartmentSelectFieldReadonly({
34909
35233
  }) {
34910
35234
  const { formData } = useFormContext();
34911
35235
  const rawValue = formData[fieldId];
34912
- const value = useMemo43(() => normalizeDepartmentArray(rawValue), [rawValue]);
35236
+ const value = useMemo45(() => normalizeDepartmentArray(rawValue), [rawValue]);
34913
35237
  const display = value.length > 0 ? value.map(
34914
35238
  (d) => showFullPath ? getDepartmentFullPath(getDepartmentId(d), treeData) || getDepartmentName(d) : getDepartmentName(d)
34915
35239
  ).join(", ") : "--";
@@ -34940,7 +35264,7 @@ function DepartmentSelectField(props) {
34940
35264
  const { fieldBehaviors, setFieldValue, formData, registerField, unregisterField } = useFormContext();
34941
35265
  const { isMobile } = useDeviceDetect();
34942
35266
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
34943
- useEffect73(() => {
35267
+ useEffect75(() => {
34944
35268
  registerField(fieldId);
34945
35269
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
34946
35270
  setFieldValue(fieldId, defaultValue);
@@ -34965,7 +35289,7 @@ function DepartmentSelectField(props) {
34965
35289
  }
34966
35290
 
34967
35291
  // packages/sdk/src/components/fields/CascadeSelectField/index.tsx
34968
- import { useEffect as useEffect74 } from "react";
35292
+ import { useEffect as useEffect76 } from "react";
34969
35293
  import { Cascader as Cascader2 } from "antd";
34970
35294
  import { jsx as jsx66 } from "react/jsx-runtime";
34971
35295
  var toValuePath = (value, multiple) => {
@@ -35004,7 +35328,7 @@ function CascadeSelectField(props) {
35004
35328
  const { formData, fieldBehaviors, setFieldValue, registerField, unregisterField } = useFormContext();
35005
35329
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
35006
35330
  const value = formData[fieldId] ?? (multiple ? [] : []);
35007
- useEffect74(() => {
35331
+ useEffect76(() => {
35008
35332
  registerField(fieldId);
35009
35333
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
35010
35334
  setFieldValue(fieldId, defaultValue);
@@ -35057,7 +35381,7 @@ function CascadeSelectField(props) {
35057
35381
  }
35058
35382
 
35059
35383
  // packages/sdk/src/components/fields/AddressField/index.tsx
35060
- import { useEffect as useEffect75, useMemo as useMemo44, useState as useState64 } from "react";
35384
+ import { useEffect as useEffect77, useMemo as useMemo46, useState as useState65 } from "react";
35061
35385
  import { Button as Button4, Cascader as Cascader3, Input as Input6, Space as Space4, Spin as Spin3 } from "antd";
35062
35386
  import { jsx as jsx67, jsxs as jsxs27 } from "react/jsx-runtime";
35063
35387
  var LEVELS = ["province", "city", "district", "street"];
@@ -35108,19 +35432,19 @@ function AddressField(props) {
35108
35432
  const { isMobile } = useDeviceDetect();
35109
35433
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
35110
35434
  const value = formData[fieldId];
35111
- const [options, setOptions] = useState64([]);
35112
- const [loadingRoots, setLoadingRoots] = useState64(false);
35113
- const [mobileOpen, setMobileOpen] = useState64(false);
35114
- const [mobileLevelIndex, setMobileLevelIndex] = useState64(0);
35115
- const [mobileOptions, setMobileOptions] = useState64([]);
35116
- const [mobileLoading, setMobileLoading] = useState64(false);
35117
- const [tempValue, setTempValue] = useState64();
35435
+ const [options, setOptions] = useState65([]);
35436
+ const [loadingRoots, setLoadingRoots] = useState65(false);
35437
+ const [mobileOpen, setMobileOpen] = useState65(false);
35438
+ const [mobileLevelIndex, setMobileLevelIndex] = useState65(0);
35439
+ const [mobileOptions, setMobileOptions] = useState65([]);
35440
+ const [mobileLoading, setMobileLoading] = useState65(false);
35441
+ const [tempValue, setTempValue] = useState65();
35118
35442
  const depth = modeDepth(mode);
35119
- const levels = useMemo44(() => activeLevels(mode), [mode]);
35443
+ const levels = useMemo46(() => activeLevels(mode), [mode]);
35120
35444
  const detailEnabled = mode === "province-city-district-street-detail";
35121
35445
  const disabled = behavior === "DISABLED";
35122
35446
  const MobilePopup = getMobileComponent3("Popup");
35123
- useEffect75(() => {
35447
+ useEffect77(() => {
35124
35448
  registerField(fieldId);
35125
35449
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
35126
35450
  setFieldValue(fieldId, defaultValue);
@@ -35131,11 +35455,11 @@ function AddressField(props) {
35131
35455
  const list = await api.getChinaDivisions(parentAdcode);
35132
35456
  return list.map((item) => normalizeDivision(item, level, depth, index2));
35133
35457
  };
35134
- useEffect75(() => {
35458
+ useEffect77(() => {
35135
35459
  setLoadingRoots(true);
35136
35460
  loadDivisions(void 0, "province", 0).then(setOptions).finally(() => setLoadingRoots(false));
35137
35461
  }, [api, depth]);
35138
- useEffect75(() => {
35462
+ useEffect77(() => {
35139
35463
  if (!mobileOpen) return;
35140
35464
  const level = levels[mobileLevelIndex] || "province";
35141
35465
  const parentLevel = levels[mobileLevelIndex - 1];
@@ -35313,7 +35637,7 @@ function AddressField(props) {
35313
35637
  }
35314
35638
 
35315
35639
  // packages/sdk/src/components/fields/AssociationFormField/index.tsx
35316
- import { useCallback as useCallback17, useEffect as useEffect76, useMemo as useMemo45, useRef as useRef81, useState as useState65 } from "react";
35640
+ import { useCallback as useCallback18, useEffect as useEffect78, useMemo as useMemo47, useRef as useRef82, useState as useState66 } from "react";
35317
35641
  import { Button as Button5, Drawer, Input as Input7, Modal as Modal4, Select as Select4, Space as Space5, Spin as Spin4, Table, Tag as Tag5 } from "antd";
35318
35642
  import { jsx as jsx68, jsxs as jsxs28 } from "react/jsx-runtime";
35319
35643
  var DEFAULT_PAGE_SIZE = 10;
@@ -35376,45 +35700,45 @@ function AssociationFormField(props) {
35376
35700
  const { isMobile } = useDeviceDetect();
35377
35701
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
35378
35702
  const rawValue = formData[fieldId];
35379
- const value = useMemo45(() => normalizeValues(rawValue), [rawValue]);
35703
+ const value = useMemo47(() => normalizeValues(rawValue), [rawValue]);
35380
35704
  const disabled = behavior === "DISABLED";
35381
- const [options, setOptions] = useState65([]);
35382
- const [selectLoading, setSelectLoading] = useState65(false);
35383
- const [selectorOpen, setSelectorOpen] = useState65(false);
35384
- const [tableLoading, setTableLoading] = useState65(false);
35385
- const [tableData, setTableData] = useState65([]);
35386
- const [keyword, setKeyword] = useState65("");
35387
- const [pagination, setPagination] = useState65({
35705
+ const [options, setOptions] = useState66([]);
35706
+ const [selectLoading, setSelectLoading] = useState66(false);
35707
+ const [selectorOpen, setSelectorOpen] = useState66(false);
35708
+ const [tableLoading, setTableLoading] = useState66(false);
35709
+ const [tableData, setTableData] = useState66([]);
35710
+ const [keyword, setKeyword] = useState66("");
35711
+ const [pagination, setPagination] = useState66({
35388
35712
  current: 1,
35389
35713
  pageSize: DEFAULT_PAGE_SIZE,
35390
35714
  total: 0
35391
35715
  });
35392
- const [selectedRowKeys, setSelectedRowKeys] = useState65([]);
35393
- const [selectedRecords, setSelectedRecords] = useState65([]);
35394
- const formDataRef = useRef81(formData);
35395
- const associationFormRef = useRef81(associationForm);
35396
- useEffect76(() => {
35716
+ const [selectedRowKeys, setSelectedRowKeys] = useState66([]);
35717
+ const [selectedRecords, setSelectedRecords] = useState66([]);
35718
+ const formDataRef = useRef82(formData);
35719
+ const associationFormRef = useRef82(associationForm);
35720
+ useEffect78(() => {
35397
35721
  registerField(fieldId);
35398
35722
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
35399
35723
  setFieldValue(fieldId, normalizeValues(defaultValue));
35400
35724
  }
35401
35725
  return () => unregisterField(fieldId);
35402
35726
  }, [fieldId]);
35403
- useEffect76(() => {
35727
+ useEffect78(() => {
35404
35728
  formDataRef.current = formData;
35405
35729
  }, [formData]);
35406
- useEffect76(() => {
35730
+ useEffect78(() => {
35407
35731
  associationFormRef.current = associationForm;
35408
35732
  }, [associationForm]);
35409
35733
  const associationAppType = associationForm?.appType;
35410
35734
  const associationFormUuid = associationForm?.formUuid;
35411
35735
  const associationMainFieldId = associationForm?.mainFieldId;
35412
35736
  const canQuery = Boolean(associationAppType && associationFormUuid);
35413
- const filterRulesKey = useMemo45(
35737
+ const filterRulesKey = useMemo47(
35414
35738
  () => stableSerialize(associationForm?.dataFilterRules || []),
35415
35739
  [associationForm?.dataFilterRules]
35416
35740
  );
35417
- const currentFieldFilterKey = useMemo45(() => {
35741
+ const currentFieldFilterKey = useMemo47(() => {
35418
35742
  const rules2 = associationForm?.dataFilterRules || [];
35419
35743
  return stableSerialize(
35420
35744
  rules2.map((rule) => {
@@ -35423,11 +35747,11 @@ function AssociationFormField(props) {
35423
35747
  })
35424
35748
  );
35425
35749
  }, [formData, associationForm?.dataFilterRules]);
35426
- const filterDependencyKey = useMemo45(
35750
+ const filterDependencyKey = useMemo47(
35427
35751
  () => `${filterRulesKey}:${currentFieldFilterKey}`,
35428
35752
  [currentFieldFilterKey, filterRulesKey]
35429
35753
  );
35430
- const normalizeRecord = useCallback17(
35754
+ const normalizeRecord = useCallback18(
35431
35755
  (record2) => {
35432
35756
  const mainFieldValue = associationMainFieldId ? record2?.[associationMainFieldId] : void 0;
35433
35757
  const labelText = normalizeCellValue(mainFieldValue);
@@ -35440,7 +35764,7 @@ function AssociationFormField(props) {
35440
35764
  },
35441
35765
  [associationMainFieldId]
35442
35766
  );
35443
- const toValue = useCallback17(
35767
+ const toValue = useCallback18(
35444
35768
  (record2) => ({
35445
35769
  label: record2.__associationLabel,
35446
35770
  value: record2.__associationValue,
@@ -35448,7 +35772,7 @@ function AssociationFormField(props) {
35448
35772
  }),
35449
35773
  []
35450
35774
  );
35451
- const buildFilters = useCallback17(() => {
35775
+ const buildFilters = useCallback18(() => {
35452
35776
  void filterDependencyKey;
35453
35777
  const rules2 = associationFormRef.current?.dataFilterRules || [];
35454
35778
  const currentFormData = formDataRef.current;
@@ -35464,7 +35788,7 @@ function AssociationFormField(props) {
35464
35788
  };
35465
35789
  }).filter(Boolean);
35466
35790
  }, [filterDependencyKey]);
35467
- const fetchRecords = useCallback17(
35791
+ const fetchRecords = useCallback18(
35468
35792
  async (params) => {
35469
35793
  if (!canQuery) return { list: [], total: 0 };
35470
35794
  const filters = buildFilters();
@@ -35487,7 +35811,7 @@ function AssociationFormField(props) {
35487
35811
  },
35488
35812
  [api, associationAppType, associationFormUuid, buildFilters, canQuery, normalizeRecord]
35489
35813
  );
35490
- const loadOptions = useCallback17(
35814
+ const loadOptions = useCallback18(
35491
35815
  async (searchKeyWord) => {
35492
35816
  setSelectLoading(true);
35493
35817
  try {
@@ -35499,7 +35823,7 @@ function AssociationFormField(props) {
35499
35823
  },
35500
35824
  [fetchRecords, toValue]
35501
35825
  );
35502
- const loadTable = useCallback17(
35826
+ const loadTable = useCallback18(
35503
35827
  async (next) => {
35504
35828
  setTableLoading(true);
35505
35829
  const current = next?.current || 1;
@@ -35518,10 +35842,10 @@ function AssociationFormField(props) {
35518
35842
  },
35519
35843
  [fetchRecords, keyword, pagination.pageSize]
35520
35844
  );
35521
- useEffect76(() => {
35845
+ useEffect78(() => {
35522
35846
  void loadOptions();
35523
35847
  }, [loadOptions]);
35524
- useEffect76(() => {
35848
+ useEffect78(() => {
35525
35849
  setSelectedRowKeys(value.map((item) => item.value));
35526
35850
  setSelectedRecords(
35527
35851
  value.map(
@@ -35529,7 +35853,7 @@ function AssociationFormField(props) {
35529
35853
  ).filter(Boolean)
35530
35854
  );
35531
35855
  }, [normalizeRecord, value]);
35532
- const applyDataFilling = useCallback17(
35856
+ const applyDataFilling = useCallback18(
35533
35857
  (next) => {
35534
35858
  if (!associationForm?.dataFillingEnabled && !associationForm?.dataFillingRules?.mainRules) {
35535
35859
  return;
@@ -35543,7 +35867,7 @@ function AssociationFormField(props) {
35543
35867
  },
35544
35868
  [associationForm?.dataFillingEnabled, associationForm?.dataFillingRules, setFieldValue]
35545
35869
  );
35546
- const commitSelection = useCallback17(
35870
+ const commitSelection = useCallback18(
35547
35871
  (next) => {
35548
35872
  const normalized = multiple ? next : next.slice(0, 1);
35549
35873
  setFieldValue(fieldId, normalized);
@@ -35552,7 +35876,7 @@ function AssociationFormField(props) {
35552
35876
  },
35553
35877
  [applyDataFilling, fieldId, multiple, onChange, setFieldValue]
35554
35878
  );
35555
- const selectorColumns = useMemo45(() => {
35879
+ const selectorColumns = useMemo47(() => {
35556
35880
  const configured = associationForm?.selectorColumns || [];
35557
35881
  if (configured.length) {
35558
35882
  return configured.map((column) => {
@@ -35587,7 +35911,7 @@ function AssociationFormField(props) {
35587
35911
  }
35588
35912
  ];
35589
35913
  }, [associationForm?.mainFieldId, associationForm?.selectorColumns]);
35590
- const selectOptions = useMemo45(
35914
+ const selectOptions = useMemo47(
35591
35915
  () => [...options, ...value].filter(
35592
35916
  (item, index2, list) => list.findIndex((candidate) => candidate.value === item.value) === index2
35593
35917
  ).map((item) => ({ label: item.label, value: item.value })),
@@ -35795,7 +36119,7 @@ function AssociationFormField(props) {
35795
36119
  }
35796
36120
 
35797
36121
  // packages/sdk/src/components/fields/EditorField/index.tsx
35798
- import { useCallback as useCallback18, useEffect as useEffect77, useMemo as useMemo46, useRef as useRef82, useState as useState66 } from "react";
36122
+ import { useCallback as useCallback19, useEffect as useEffect79, useMemo as useMemo48, useRef as useRef83, useState as useState67 } from "react";
35799
36123
  import { Extension } from "@tiptap/core";
35800
36124
  import { EditorContent, useEditor } from "@tiptap/react";
35801
36125
  import StarterKit from "@tiptap/starter-kit";
@@ -36449,28 +36773,28 @@ function RichTextEditorCore({
36449
36773
  fieldId = "richText",
36450
36774
  mobile = false
36451
36775
  }) {
36452
- const inputRef = useRef82(null);
36453
- const [uploading, setUploading] = useState66(false);
36454
- const [uploadError, setUploadError] = useState66("");
36455
- const [charCount, setCharCount] = useState66(0);
36456
- const [linkOpen, setLinkOpen] = useState66(false);
36457
- const [linkUrl, setLinkUrl] = useState66("");
36458
- const [linkError, setLinkError] = useState66("");
36459
- const [imageUrlOpen, setImageUrlOpen] = useState66(false);
36460
- const [imageUrl, setImageUrl] = useState66("");
36461
- const [imageAlt, setImageAlt] = useState66("");
36462
- const [imageTitle, setImageTitle] = useState66("");
36463
- const [imageUrlError, setImageUrlError] = useState66("");
36464
- const [tableOpen, setTableOpen] = useState66(false);
36465
- const [tableRows, setTableRows] = useState66(3);
36466
- const [tableCols, setTableCols] = useState66(3);
36467
- const onChangeRef = useRef82(onChange);
36468
- useEffect77(() => {
36776
+ const inputRef = useRef83(null);
36777
+ const [uploading, setUploading] = useState67(false);
36778
+ const [uploadError, setUploadError] = useState67("");
36779
+ const [charCount, setCharCount] = useState67(0);
36780
+ const [linkOpen, setLinkOpen] = useState67(false);
36781
+ const [linkUrl, setLinkUrl] = useState67("");
36782
+ const [linkError, setLinkError] = useState67("");
36783
+ const [imageUrlOpen, setImageUrlOpen] = useState67(false);
36784
+ const [imageUrl, setImageUrl] = useState67("");
36785
+ const [imageAlt, setImageAlt] = useState67("");
36786
+ const [imageTitle, setImageTitle] = useState67("");
36787
+ const [imageUrlError, setImageUrlError] = useState67("");
36788
+ const [tableOpen, setTableOpen] = useState67(false);
36789
+ const [tableRows, setTableRows] = useState67(3);
36790
+ const [tableCols, setTableCols] = useState67(3);
36791
+ const onChangeRef = useRef83(onChange);
36792
+ useEffect79(() => {
36469
36793
  onChangeRef.current = onChange;
36470
36794
  }, [onChange]);
36471
- const actions = useMemo46(() => normalizeToolbarConfig(toolbarConfig), [toolbarConfig]);
36795
+ const actions = useMemo48(() => normalizeToolbarConfig(toolbarConfig), [toolbarConfig]);
36472
36796
  const visibleActions = mobile ? [] : actions;
36473
- const extensions = useMemo46(
36797
+ const extensions = useMemo48(
36474
36798
  () => [
36475
36799
  StarterKit.configure({
36476
36800
  heading: { levels: [1, 2, 3] },
@@ -36504,7 +36828,7 @@ function RichTextEditorCore({
36504
36828
  ],
36505
36829
  [maxLength, placeholder]
36506
36830
  );
36507
- const updateHtml = useCallback18((next) => {
36831
+ const updateHtml = useCallback19((next) => {
36508
36832
  onChangeRef.current?.(next);
36509
36833
  }, []);
36510
36834
  const editor = useEditor(
@@ -36534,11 +36858,11 @@ function RichTextEditorCore({
36534
36858
  },
36535
36859
  [fieldId, extensions, disabled, maxLength, updateHtml]
36536
36860
  );
36537
- useEffect77(() => {
36861
+ useEffect79(() => {
36538
36862
  if (!editor || isEditorDestroyed(editor)) return;
36539
36863
  editor.setEditable(!disabled);
36540
36864
  }, [disabled, editor]);
36541
- useEffect77(() => {
36865
+ useEffect79(() => {
36542
36866
  if (!editor || isEditorDestroyed(editor)) return;
36543
36867
  const currentHtml = getSafeEditorHtml(editor);
36544
36868
  if ((value || "") !== currentHtml) {
@@ -36546,7 +36870,7 @@ function RichTextEditorCore({
36546
36870
  }
36547
36871
  setCharCount(countCharacters(editor));
36548
36872
  }, [editor, value]);
36549
- const insertImageFiles = useCallback18(
36873
+ const insertImageFiles = useCallback19(
36550
36874
  async (files) => {
36551
36875
  if (!editor || isEditorDestroyed(editor) || disabled || files.length === 0) return;
36552
36876
  const validFiles = files.filter((file) => {
@@ -36576,7 +36900,7 @@ function RichTextEditorCore({
36576
36900
  },
36577
36901
  [allowedImageTypes, api, disabled, editor, maxImageSize, uploadBucketName]
36578
36902
  );
36579
- const openLinkModal = useCallback18(() => {
36903
+ const openLinkModal = useCallback19(() => {
36580
36904
  if (!editor || isEditorDestroyed(editor)) return;
36581
36905
  setLinkUrl(editor.getAttributes("link").href || "");
36582
36906
  setLinkError("");
@@ -36602,7 +36926,7 @@ function RichTextEditorCore({
36602
36926
  editor.chain().focus().extendMarkRange("link").unsetLink().run();
36603
36927
  setLinkOpen(false);
36604
36928
  };
36605
- const openImageUrlModal = useCallback18(() => {
36929
+ const openImageUrlModal = useCallback19(() => {
36606
36930
  setImageUrl("");
36607
36931
  setImageAlt("");
36608
36932
  setImageTitle("");
@@ -36852,19 +37176,19 @@ function EditorField(props) {
36852
37176
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
36853
37177
  const rawValue = formData[fieldId] ?? "";
36854
37178
  const value = normalizeRichTextHtml(rawValue);
36855
- useEffect77(() => {
37179
+ useEffect79(() => {
36856
37180
  registerField(fieldId);
36857
37181
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
36858
37182
  setFieldValue(fieldId, normalizeRichTextHtml(defaultValue));
36859
37183
  }
36860
37184
  return () => unregisterField(fieldId);
36861
37185
  }, [fieldId]);
36862
- useEffect77(() => {
37186
+ useEffect79(() => {
36863
37187
  if (rawValue && rawValue !== value) {
36864
37188
  setFieldValue(fieldId, value);
36865
37189
  }
36866
37190
  }, [fieldId, rawValue, setFieldValue, value]);
36867
- const updateHtml = useCallback18(
37191
+ const updateHtml = useCallback19(
36868
37192
  (next) => {
36869
37193
  setFieldValue(fieldId, next);
36870
37194
  onChange?.(next);
@@ -36917,7 +37241,7 @@ function EditorField(props) {
36917
37241
  }
36918
37242
 
36919
37243
  // packages/sdk/src/components/fields/SerialNumberField/index.tsx
36920
- import { useEffect as useEffect78 } from "react";
37244
+ import { useEffect as useEffect80 } from "react";
36921
37245
  import { Input as Input9 } from "antd";
36922
37246
  import { jsx as jsx70 } from "react/jsx-runtime";
36923
37247
  function SerialNumberField(props) {
@@ -36937,7 +37261,7 @@ function SerialNumberField(props) {
36937
37261
  const { formData, fieldBehaviors, setFieldValue, registerField, unregisterField } = useFormContext();
36938
37262
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "READONLY";
36939
37263
  const value = formData[fieldId] ?? "";
36940
- useEffect78(() => {
37264
+ useEffect80(() => {
36941
37265
  registerField(fieldId);
36942
37266
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
36943
37267
  setFieldValue(fieldId, defaultValue);
@@ -36979,7 +37303,7 @@ function SerialNumberField(props) {
36979
37303
  }
36980
37304
 
36981
37305
  // packages/sdk/src/components/fields/LocationField/index.tsx
36982
- import { useEffect as useEffect79, useState as useState67 } from "react";
37306
+ import { useEffect as useEffect81, useState as useState68 } from "react";
36983
37307
  import { Button as Button7, Space as Space7 } from "antd";
36984
37308
  import { jsx as jsx71, jsxs as jsxs30 } from "react/jsx-runtime";
36985
37309
  var getDingTalkApi = () => {
@@ -37021,9 +37345,9 @@ function LocationField(props) {
37021
37345
  const { formData, fieldBehaviors, setFieldValue, registerField, unregisterField, api } = useFormContext();
37022
37346
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
37023
37347
  const value = formData[fieldId];
37024
- const [locating, setLocating] = useState67(false);
37025
- const [error, setError] = useState67("");
37026
- useEffect79(() => {
37348
+ const [locating, setLocating] = useState68(false);
37349
+ const [error, setError] = useState68("");
37350
+ useEffect81(() => {
37027
37351
  registerField(fieldId);
37028
37352
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
37029
37353
  setFieldValue(fieldId, defaultValue);
@@ -37164,7 +37488,7 @@ function LocationField(props) {
37164
37488
  }
37165
37489
 
37166
37490
  // packages/sdk/src/components/fields/DigitalSignatureField/index.tsx
37167
- import { useCallback as useCallback19, useEffect as useEffect80, useRef as useRef83, useState as useState68 } from "react";
37491
+ import { useCallback as useCallback20, useEffect as useEffect82, useRef as useRef84, useState as useState69 } from "react";
37168
37492
  import { Button as Button8, Modal as Modal6, Space as Space8 } from "antd";
37169
37493
  import { jsx as jsx72, jsxs as jsxs31 } from "react/jsx-runtime";
37170
37494
  var CANVAS_HEIGHT = 260;
@@ -37198,21 +37522,21 @@ function DigitalSignatureField(props) {
37198
37522
  const { formData, fieldBehaviors, setFieldValue, registerField, unregisterField, api } = useFormContext();
37199
37523
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
37200
37524
  const value = formData[fieldId];
37201
- const [open, setOpen] = useState68(false);
37202
- const [saving, setSaving] = useState68(false);
37203
- const [drawn, setDrawn] = useState68(false);
37204
- const [error, setError] = useState68("");
37205
- const canvasRef = useRef83(null);
37206
- const drawingRef = useRef83(false);
37207
- const pointsRef = useRef83([]);
37208
- useEffect80(() => {
37525
+ const [open, setOpen] = useState69(false);
37526
+ const [saving, setSaving] = useState69(false);
37527
+ const [drawn, setDrawn] = useState69(false);
37528
+ const [error, setError] = useState69("");
37529
+ const canvasRef = useRef84(null);
37530
+ const drawingRef = useRef84(false);
37531
+ const pointsRef = useRef84([]);
37532
+ useEffect82(() => {
37209
37533
  registerField(fieldId);
37210
37534
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
37211
37535
  setFieldValue(fieldId, defaultValue);
37212
37536
  }
37213
37537
  return () => unregisterField(fieldId);
37214
37538
  }, [fieldId]);
37215
- const prepareCanvas = useCallback19(() => {
37539
+ const prepareCanvas = useCallback20(() => {
37216
37540
  const canvas = canvasRef.current;
37217
37541
  if (!canvas) return;
37218
37542
  const rect = canvas.getBoundingClientRect();
@@ -37234,7 +37558,7 @@ function DigitalSignatureField(props) {
37234
37558
  ctx2.lineJoin = "round";
37235
37559
  ctx2.strokeStyle = "#111827";
37236
37560
  }, []);
37237
- useEffect80(() => {
37561
+ useEffect82(() => {
37238
37562
  if (!open) return;
37239
37563
  pointsRef.current = [];
37240
37564
  setDrawn(false);
@@ -37413,7 +37737,7 @@ function DigitalSignatureField(props) {
37413
37737
  }
37414
37738
 
37415
37739
  // packages/sdk/src/components/fields/JSONField/index.tsx
37416
- import { useEffect as useEffect81 } from "react";
37740
+ import { useEffect as useEffect83 } from "react";
37417
37741
  import { jsx as jsx73 } from "react/jsx-runtime";
37418
37742
  var formatJson = (value) => {
37419
37743
  if (value === void 0 || value === null || value === "") return "--";
@@ -37440,7 +37764,7 @@ function JSONField(props) {
37440
37764
  const { formData, fieldBehaviors, setFieldValue, registerField, unregisterField } = useFormContext();
37441
37765
  const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "READONLY";
37442
37766
  const value = formData[fieldId];
37443
- useEffect81(() => {
37767
+ useEffect83(() => {
37444
37768
  registerField(fieldId);
37445
37769
  if (defaultValue !== void 0 && formData[fieldId] === void 0) {
37446
37770
  setFieldValue(fieldId, defaultValue);
@@ -38149,155 +38473,6 @@ function createFormRuntimeApi(config3) {
38149
38473
  return { ...defaults2, ...overrides, request };
38150
38474
  }
38151
38475
 
38152
- // packages/sdk/src/components/core/optionSource.ts
38153
- function normalizeOptionItem(row, fieldId) {
38154
- const rawValue = row?.[fieldId] ?? row?.value;
38155
- if (rawValue === void 0 || rawValue === null || rawValue === "") return null;
38156
- if (typeof rawValue === "object" && !Array.isArray(rawValue)) {
38157
- const value = rawValue.value ?? rawValue.id ?? rawValue.key ?? rawValue.label;
38158
- const label = rawValue.label ?? rawValue.name ?? rawValue.title ?? rawValue.value ?? value;
38159
- if (value === void 0 || value === null || value === "") return null;
38160
- return { value: String(value), label: String(label ?? value) };
38161
- }
38162
- const fallbackLabel = row?.label;
38163
- return {
38164
- value: String(rawValue),
38165
- label: fallbackLabel === void 0 || fallbackLabel === null ? String(rawValue) : String(fallbackLabel)
38166
- };
38167
- }
38168
- function extractComparableValue(value) {
38169
- if (value === void 0 || value === null || value === "") return value;
38170
- if (Array.isArray(value)) {
38171
- return value.map(extractComparableValue).filter((item) => item !== void 0 && item !== null && item !== "");
38172
- }
38173
- if (typeof value === "object") {
38174
- if ("start" in value || "end" in value) {
38175
- return [value.start, value.end].filter(
38176
- (item) => item !== void 0 && item !== null && item !== ""
38177
- );
38178
- }
38179
- return value.value ?? value.id ?? value.key ?? value.userId ?? value.userid ?? value.departmentId ?? value.deptId ?? value.label ?? value.name;
38180
- }
38181
- return value;
38182
- }
38183
- function normalizeFilterOperator(operator, value) {
38184
- const normalized = operator === "neq" ? "ne" : operator || "eq";
38185
- if (Array.isArray(value) && value.length > 0 && (normalized === "eq" || normalized === "contains")) {
38186
- return "in";
38187
- }
38188
- return normalized;
38189
- }
38190
- async function resolveOptions(config3, runtime, formData) {
38191
- switch (config3.type) {
38192
- case "custom":
38193
- return [];
38194
- // custom 类型直接用 props.options
38195
- case "linkedForm":
38196
- if (!config3.linkedForm) return [];
38197
- return resolveLinkedFormOptions(config3.linkedForm, runtime);
38198
- case "dataLinkage":
38199
- if (!config3.dataLinkage) return [];
38200
- return resolveDataLinkageOptions(config3.dataLinkage, runtime, formData);
38201
- default:
38202
- return [];
38203
- }
38204
- }
38205
- async function resolveLinkedFormOptions(config3, runtime) {
38206
- if (!runtime?.fetchFormData) return [];
38207
- try {
38208
- const filters = config3.filters?.map((f) => ({
38209
- fieldId: f.fieldId,
38210
- operator: normalizeFilterOperator(f.operator, extractComparableValue(f.value)),
38211
- value: extractComparableValue(f.value)
38212
- })) || [];
38213
- const result = await runtime.fetchFormData({
38214
- formUuid: config3.formUuid,
38215
- appType: runtime.appType || "",
38216
- filters,
38217
- sort: config3.sortField ? { field: config3.sortField, order: config3.sortOrder || "asc" } : void 0,
38218
- fieldId: config3.fieldId,
38219
- deduplicate: config3.deduplicate,
38220
- pageSize: 200
38221
- });
38222
- const items = result.data.map((row) => normalizeOptionItem(row, config3.fieldId)).filter((item) => Boolean(item));
38223
- if (config3.deduplicate) {
38224
- const seen = /* @__PURE__ */ new Set();
38225
- return items.filter((item) => {
38226
- if (seen.has(item.value)) return false;
38227
- seen.add(item.value);
38228
- return true;
38229
- });
38230
- }
38231
- return items;
38232
- } catch (e2) {
38233
- console.error("[FormComponents] resolveLinkedFormOptions failed:", e2);
38234
- return [];
38235
- }
38236
- }
38237
- async function resolveDataLinkageOptions(config3, runtime, formData) {
38238
- if (!runtime?.fetchFormData) return [];
38239
- try {
38240
- const filters = config3.conditions.map((condition) => {
38241
- const value = extractComparableValue(formData[condition.localFieldId]);
38242
- return {
38243
- fieldId: condition.remoteFieldId,
38244
- operator: normalizeFilterOperator(condition.operator, value),
38245
- value
38246
- };
38247
- });
38248
- const result = await runtime.fetchFormData({
38249
- formUuid: config3.formUuid,
38250
- appType: runtime.appType || "",
38251
- filters,
38252
- conditionLogic: config3.conditionLogic,
38253
- fieldId: config3.targetFieldId,
38254
- deduplicate: config3.deduplicate,
38255
- pageSize: 200
38256
- });
38257
- const items = result.data.map((row) => normalizeOptionItem(row, config3.targetFieldId)).filter((item) => Boolean(item));
38258
- if (config3.deduplicate) {
38259
- const seen = /* @__PURE__ */ new Set();
38260
- return items.filter((item) => {
38261
- if (seen.has(item.value)) return false;
38262
- seen.add(item.value);
38263
- return true;
38264
- });
38265
- }
38266
- return items;
38267
- } catch (e2) {
38268
- console.error("[FormComponents] resolveDataLinkageOptions failed:", e2);
38269
- return [];
38270
- }
38271
- }
38272
- async function resolveDefaultValueLinkage(config3, runtime, formData) {
38273
- if (!runtime?.fetchFormData) return void 0;
38274
- try {
38275
- const filters = config3.conditions.map((condition) => {
38276
- const value = extractComparableValue(formData[condition.localFieldId]);
38277
- return {
38278
- fieldId: condition.remoteFieldId,
38279
- operator: normalizeFilterOperator(condition.operator, value),
38280
- value
38281
- };
38282
- });
38283
- const result = await runtime.fetchFormData({
38284
- formUuid: config3.formUuid,
38285
- appType: runtime.appType || "",
38286
- filters,
38287
- conditionLogic: config3.conditionLogic,
38288
- fieldId: config3.targetFieldId,
38289
- pageSize: 200
38290
- });
38291
- if (result.data.length > 0) {
38292
- return result.data[0][config3.targetFieldId] ?? result.data[0].value ?? void 0;
38293
- }
38294
- return void 0;
38295
- } catch (e2) {
38296
- console.error("[FormComponents] resolveDefaultValueLinkage failed:", e2);
38297
- return void 0;
38298
- }
38299
- }
38300
-
38301
38476
  // packages/sdk/src/components/core/FormProvider.tsx
38302
38477
  var LINKAGE_DEBOUNCE_MS = 500;
38303
38478
  function isInactiveBehavior(behavior) {
@@ -38432,9 +38607,9 @@ function FormProvider3({
38432
38607
  runtime,
38433
38608
  children
38434
38609
  }) {
38435
- const api = useMemo47(() => createFormRuntimeApi(config3.api), [config3.api]);
38436
- const [runtimeDefaults, setRuntimeDefaults] = useState69({});
38437
- const effects = useMemo47(
38610
+ const api = useMemo49(() => createFormRuntimeApi(config3.api), [config3.api]);
38611
+ const [runtimeDefaults, setRuntimeDefaults] = useState70({});
38612
+ const effects = useMemo49(
38438
38613
  () => [
38439
38614
  ...schema.rules ?? [],
38440
38615
  ...schema.fields.flatMap((field) => field.optionEffects ?? []),
@@ -38442,18 +38617,18 @@ function FormProvider3({
38442
38617
  ],
38443
38618
  [schema.rules, schema.fields, config3.effects]
38444
38619
  );
38445
- const defaultRuntime = useMemo47(
38620
+ const defaultRuntime = useMemo49(
38446
38621
  () => ({
38447
38622
  appType: config3.appType,
38448
38623
  fetchFormData: (params) => fetchRuntimeFormData(api, config3.appType, params)
38449
38624
  }),
38450
38625
  [api, config3.appType]
38451
38626
  );
38452
- const mergedRuntime = useMemo47(
38627
+ const mergedRuntime = useMemo49(
38453
38628
  () => ({ ...defaultRuntime, ...schema.runtime, ...runtimeDefaults, ...runtime }),
38454
38629
  [defaultRuntime, schema.runtime, runtimeDefaults, runtime]
38455
38630
  );
38456
- const computedInitialValues = useMemo47(() => {
38631
+ const computedInitialValues = useMemo49(() => {
38457
38632
  const values = {};
38458
38633
  for (const field of schema.fields) {
38459
38634
  const defaultValue = resolveDefaultValue(field, mergedRuntime);
@@ -38463,11 +38638,11 @@ function FormProvider3({
38463
38638
  }
38464
38639
  return { ...values, ...initialValues };
38465
38640
  }, [schema, initialValues, mergedRuntime]);
38466
- const initialValuesRef = useRef84(computedInitialValues);
38467
- const [formData, setFormData] = useState69({ ...computedInitialValues });
38468
- const [fieldErrors, setFieldErrors] = useState69({});
38469
- const [registeredFields] = useState69(/* @__PURE__ */ new Set());
38470
- useEffect82(() => {
38641
+ const initialValuesRef = useRef85(computedInitialValues);
38642
+ const [formData, setFormData] = useState70({ ...computedInitialValues });
38643
+ const [fieldErrors, setFieldErrors] = useState70({});
38644
+ const [registeredFields] = useState70(/* @__PURE__ */ new Set());
38645
+ useEffect84(() => {
38471
38646
  if (!schema.fields.some((field) => needsCurrentUserRuntime(field.defaultShortcut?.type)))
38472
38647
  return;
38473
38648
  if (mergedRuntime.currentUser && mergedRuntime.currentDepartment) return;
@@ -38491,7 +38666,7 @@ function FormProvider3({
38491
38666
  cancelled = true;
38492
38667
  };
38493
38668
  }, [api, mergedRuntime.currentDepartment, mergedRuntime.currentUser, schema.fields]);
38494
- useEffect82(() => {
38669
+ useEffect84(() => {
38495
38670
  setFormData((prev) => {
38496
38671
  let changed = false;
38497
38672
  const next = { ...prev };
@@ -38505,7 +38680,7 @@ function FormProvider3({
38505
38680
  return changed ? next : prev;
38506
38681
  });
38507
38682
  }, [mergedRuntime, schema.fields]);
38508
- const fieldBehaviors = useMemo47(() => {
38683
+ const fieldBehaviors = useMemo49(() => {
38509
38684
  const baseBehaviors = {};
38510
38685
  for (const field of schema.fields) {
38511
38686
  baseBehaviors[field.fieldId] = field.behavior || "NORMAL";
@@ -38528,15 +38703,15 @@ function FormProvider3({
38528
38703
  }
38529
38704
  return computed;
38530
38705
  }, [schema, effects, config3.permissions, config3.mode, formData]);
38531
- const fieldOverrides = useMemo47(
38706
+ const fieldOverrides = useMemo49(
38532
38707
  () => evaluateFieldOverrides(effects, formData),
38533
38708
  [effects, formData]
38534
38709
  );
38535
- const layoutBehaviors = useMemo47(
38710
+ const layoutBehaviors = useMemo49(
38536
38711
  () => evaluateLayoutBehaviors(effects, formData),
38537
38712
  [effects, formData]
38538
38713
  );
38539
- useEffect82(() => {
38714
+ useEffect84(() => {
38540
38715
  const valueActions = getValueActions(effects, formData);
38541
38716
  if (valueActions.length === 0) return;
38542
38717
  let changed = false;
@@ -38559,7 +38734,7 @@ function FormProvider3({
38559
38734
  setFieldErrors(nextErrors);
38560
38735
  }
38561
38736
  }, [effects, formData, fieldErrors]);
38562
- const setFieldValue = useCallback20((fieldId, value) => {
38737
+ const setFieldValue = useCallback21((fieldId, value) => {
38563
38738
  setFormData((prev) => ({ ...prev, [fieldId]: value }));
38564
38739
  setFieldErrors((prev) => {
38565
38740
  if (prev[fieldId]) {
@@ -38570,9 +38745,9 @@ function FormProvider3({
38570
38745
  return prev;
38571
38746
  });
38572
38747
  }, []);
38573
- const getFieldValue = useCallback20((fieldId) => formData[fieldId], [formData]);
38574
- const getFormData2 = useCallback20(() => ({ ...formData }), [formData]);
38575
- const validateFieldById = useCallback20(
38748
+ const getFieldValue = useCallback21((fieldId) => formData[fieldId], [formData]);
38749
+ const getFormData2 = useCallback21(() => ({ ...formData }), [formData]);
38750
+ const validateFieldById = useCallback21(
38576
38751
  async (fieldId) => {
38577
38752
  const field = schema.fields.find((f) => f.fieldId === fieldId);
38578
38753
  if (!field) {
@@ -38633,7 +38808,7 @@ function FormProvider3({
38633
38808
  },
38634
38809
  [schema, formData, fieldBehaviors, fieldOverrides]
38635
38810
  );
38636
- const validateAllWithErrors = useCallback20(async () => {
38811
+ const validateAllWithErrors = useCallback21(async () => {
38637
38812
  const fieldRules = {};
38638
38813
  const validationData = { ...formData };
38639
38814
  for (const field of schema.fields) {
@@ -38657,28 +38832,28 @@ function FormProvider3({
38657
38832
  setFieldErrors(errors);
38658
38833
  return errors;
38659
38834
  }, [schema, formData, fieldBehaviors, fieldOverrides]);
38660
- const validateAll = useCallback20(async () => {
38835
+ const validateAll = useCallback21(async () => {
38661
38836
  const errors = await validateAllWithErrors();
38662
38837
  return Object.keys(errors).length === 0;
38663
38838
  }, [validateAllWithErrors]);
38664
- const resetForm = useCallback20(() => {
38839
+ const resetForm = useCallback21(() => {
38665
38840
  setFormData({ ...initialValuesRef.current });
38666
38841
  setFieldErrors({});
38667
38842
  }, []);
38668
- const registerField = useCallback20(
38843
+ const registerField = useCallback21(
38669
38844
  (fieldId) => {
38670
38845
  registeredFields.add(fieldId);
38671
38846
  },
38672
38847
  [registeredFields]
38673
38848
  );
38674
- const unregisterField = useCallback20(
38849
+ const unregisterField = useCallback21(
38675
38850
  (fieldId) => {
38676
38851
  registeredFields.delete(fieldId);
38677
38852
  },
38678
38853
  [registeredFields]
38679
38854
  );
38680
- const [dynamicOptions, setDynamicOptions] = useState69({});
38681
- useEffect82(() => {
38855
+ const [dynamicOptions, setDynamicOptions] = useState70({});
38856
+ useEffect84(() => {
38682
38857
  const loadDynamicOptions = async () => {
38683
38858
  const updates = {};
38684
38859
  for (const field of schema.fields) {
@@ -38696,7 +38871,7 @@ function FormProvider3({
38696
38871
  };
38697
38872
  loadDynamicOptions();
38698
38873
  }, [schema.fields, mergedRuntime]);
38699
- useEffect82(() => {
38874
+ useEffect84(() => {
38700
38875
  let cancelled = false;
38701
38876
  const loadDataLinkageOptions = async () => {
38702
38877
  const updates = {};
@@ -38722,7 +38897,7 @@ function FormProvider3({
38722
38897
  window.clearTimeout(timer);
38723
38898
  };
38724
38899
  }, [schema.fields, mergedRuntime, formData]);
38725
- useEffect82(() => {
38900
+ useEffect84(() => {
38726
38901
  let cancelled = false;
38727
38902
  const loadDefaultValueLinkages = async () => {
38728
38903
  const fields = schema.fields.filter((field) => field.defaultValueLinkage);
@@ -38756,7 +38931,7 @@ function FormProvider3({
38756
38931
  window.clearTimeout(timer);
38757
38932
  };
38758
38933
  }, [schema.fields, mergedRuntime, formData]);
38759
- const contextValue = useMemo47(
38934
+ const contextValue = useMemo49(
38760
38935
  () => ({
38761
38936
  mode: config3.mode,
38762
38937
  schema,
@@ -38767,6 +38942,7 @@ function FormProvider3({
38767
38942
  layoutBehaviors,
38768
38943
  dynamicOptions,
38769
38944
  api,
38945
+ runtime: mergedRuntime,
38770
38946
  config: {
38771
38947
  mode: config3.mode,
38772
38948
  formUuid: config3.formUuid,
@@ -38795,6 +38971,7 @@ function FormProvider3({
38795
38971
  layoutBehaviors,
38796
38972
  dynamicOptions,
38797
38973
  api,
38974
+ mergedRuntime,
38798
38975
  config3.appType,
38799
38976
  config3.formInstanceId,
38800
38977
  config3.submit,
@@ -38810,10 +38987,10 @@ function FormProvider3({
38810
38987
  ]
38811
38988
  );
38812
38989
  const registryComponents = components ?? defaultComponentRegistry;
38813
- return React234.createElement(
38990
+ return React235.createElement(
38814
38991
  FormContext.Provider,
38815
38992
  { value: contextValue },
38816
- React234.createElement(ComponentRegistryProvider, { components: registryComponents, children })
38993
+ React235.createElement(ComponentRegistryProvider, { components: registryComponents, children })
38817
38994
  );
38818
38995
  }
38819
38996
  function resolveDefaultValue(field, runtime) {
@@ -38924,7 +39101,7 @@ function coerceLinkedDefaultValue(field, value) {
38924
39101
  }
38925
39102
 
38926
39103
  // packages/sdk/src/components/core/FormRenderer.tsx
38927
- import React238 from "react";
39104
+ import React239 from "react";
38928
39105
 
38929
39106
  // packages/sdk/src/components/layout/FormSection/index.tsx
38930
39107
  import {
@@ -38933,7 +39110,7 @@ import {
38933
39110
  FileTextOutlined as FileTextOutlined2,
38934
39111
  UserOutlined as UserOutlined2
38935
39112
  } from "@ant-design/icons";
38936
- import { useState as useState70 } from "react";
39113
+ import { useState as useState71 } from "react";
38937
39114
  import { jsx as jsx74, jsxs as jsxs32 } from "react/jsx-runtime";
38938
39115
  var sectionIconMap = {
38939
39116
  user: UserOutlined2,
@@ -38958,7 +39135,7 @@ function FormSection({
38958
39135
  contentClassName,
38959
39136
  children
38960
39137
  }) {
38961
- const [collapsed, setCollapsed] = useState70(defaultCollapsed);
39138
+ const [collapsed, setCollapsed] = useState71(defaultCollapsed);
38962
39139
  const handleToggle = () => {
38963
39140
  if (collapsible) {
38964
39141
  setCollapsed((prev) => !prev);
@@ -39087,10 +39264,10 @@ function FormGrid({
39087
39264
  }
39088
39265
 
39089
39266
  // packages/sdk/src/components/layout/FormTabs/index.tsx
39090
- import { useState as useState71 } from "react";
39267
+ import { useState as useState72 } from "react";
39091
39268
  import { jsx as jsx76, jsxs as jsxs33 } from "react/jsx-runtime";
39092
39269
  function FormTabs({ items, defaultActiveKey, className, tabClassName }) {
39093
- const [activeKey, setActiveKey] = useState71(defaultActiveKey || items[0]?.key || "");
39270
+ const [activeKey, setActiveKey] = useState72(defaultActiveKey || items[0]?.key || "");
39094
39271
  const activeItem = items.find((item) => item.key === activeKey);
39095
39272
  return /* @__PURE__ */ jsxs33("div", { className: className ?? "w-full", "data-testid": "form-tabs", children: [
39096
39273
  /* @__PURE__ */ jsx76(
@@ -39119,10 +39296,10 @@ function FormTabs({ items, defaultActiveKey, className, tabClassName }) {
39119
39296
  }
39120
39297
 
39121
39298
  // packages/sdk/src/components/layout/FormSteps/index.tsx
39122
- import React237, { useState as useState72 } from "react";
39299
+ import React238, { useState as useState73 } from "react";
39123
39300
  import { jsx as jsx77, jsxs as jsxs34 } from "react/jsx-runtime";
39124
39301
  function FormSteps({ items, className, onStepChange }) {
39125
- const [currentStep, setCurrentStep] = useState72(0);
39302
+ const [currentStep, setCurrentStep] = useState73(0);
39126
39303
  const goTo = (step) => {
39127
39304
  setCurrentStep(step);
39128
39305
  onStepChange?.(step);
@@ -39138,7 +39315,7 @@ function FormSteps({ items, className, onStepChange }) {
39138
39315
  }
39139
39316
  };
39140
39317
  return /* @__PURE__ */ jsxs34("div", { className: className ?? "w-full", "data-testid": "form-steps", children: [
39141
- /* @__PURE__ */ jsx77("div", { className: "flex items-center mb-6", "data-testid": "form-steps-indicator", children: items.map((item, index2) => /* @__PURE__ */ jsxs34(React237.Fragment, { children: [
39318
+ /* @__PURE__ */ jsx77("div", { className: "flex items-center mb-6", "data-testid": "form-steps-indicator", children: items.map((item, index2) => /* @__PURE__ */ jsxs34(React238.Fragment, { children: [
39142
39319
  /* @__PURE__ */ jsxs34("div", { className: "flex items-center", children: [
39143
39320
  /* @__PURE__ */ jsx77(
39144
39321
  "div",
@@ -39239,7 +39416,7 @@ function FieldRenderer({
39239
39416
  return null;
39240
39417
  }
39241
39418
  const { fieldId, componentName: _, ...fieldProps } = field;
39242
- const element = React238.createElement(Component5, {
39419
+ const element = React239.createElement(Component5, {
39243
39420
  ...fieldProps,
39244
39421
  fieldId,
39245
39422
  className: fieldClassName ?? fieldProps.className
@@ -39403,7 +39580,7 @@ function FormRenderer({
39403
39580
  const gridClass = columnsClassMap[columns];
39404
39581
  const gapClass = sizeClassMap[size2];
39405
39582
  const containerClassName = ["sy-form-renderer", "sy-grid", gridClass, gapClass, className].filter(Boolean).join(" ");
39406
- const fieldMap = React238.useMemo(() => {
39583
+ const fieldMap = React239.useMemo(() => {
39407
39584
  return new Map(
39408
39585
  schema.fields.map((field) => [
39409
39586
  field.fieldId,
@@ -39474,7 +39651,7 @@ function isLayoutVisible(visibleWhen, formData) {
39474
39651
  }
39475
39652
 
39476
39653
  // packages/sdk/src/components/core/FormShell.tsx
39477
- import { useEffect as useEffect83, useMemo as useMemo48 } from "react";
39654
+ import { useEffect as useEffect85, useMemo as useMemo50 } from "react";
39478
39655
  import * as Antd2 from "antd";
39479
39656
  import { jsx as jsx79 } from "react/jsx-runtime";
39480
39657
  function normalizeMaxWidth(maxWidth) {
@@ -39504,10 +39681,10 @@ function FormShell({ children, appearance, className }) {
39504
39681
  const [form] = useAntForm();
39505
39682
  const { formData, setFieldValue } = useFormContext();
39506
39683
  const maxWidth = normalizeMaxWidth(appearance?.maxWidth);
39507
- useEffect83(() => {
39684
+ useEffect85(() => {
39508
39685
  form?.setFieldsValue?.(formData);
39509
39686
  }, [form, formData]);
39510
- const style2 = useMemo48(() => {
39687
+ const style2 = useMemo50(() => {
39511
39688
  if (!maxWidth) return void 0;
39512
39689
  return {
39513
39690
  maxWidth,
@@ -39543,7 +39720,7 @@ function FormShell({ children, appearance, className }) {
39543
39720
  }
39544
39721
 
39545
39722
  // packages/sdk/src/components/core/FormActions.tsx
39546
- import { useState as useState73, useCallback as useCallback21 } from "react";
39723
+ import { useState as useState74, useCallback as useCallback22 } from "react";
39547
39724
  import { Button as Button9 } from "antd";
39548
39725
 
39549
39726
  // packages/sdk/src/components/core/validationFeedback.ts
@@ -39586,9 +39763,9 @@ function FormActions({
39586
39763
  onSubmit
39587
39764
  }) {
39588
39765
  const { mode, validateAllWithErrors, getFormData: getFormData2, resetForm, api, config: config3 } = useFormContext();
39589
- const [isSubmitting, setIsSubmitting] = useState73(false);
39590
- const [submitError, setSubmitError] = useState73(null);
39591
- const handleSubmit = useCallback21(async () => {
39766
+ const [isSubmitting, setIsSubmitting] = useState74(false);
39767
+ const [submitError, setSubmitError] = useState74(null);
39768
+ const handleSubmit = useCallback22(async () => {
39592
39769
  setSubmitError(null);
39593
39770
  const valid = await validateAndNotify(validateAllWithErrors);
39594
39771
  if (!valid) return;
@@ -39624,7 +39801,7 @@ function FormActions({
39624
39801
  setIsSubmitting(false);
39625
39802
  }
39626
39803
  }, [api, config3, getFormData2, mode, onSubmit, validateAllWithErrors]);
39627
- const handleReset = useCallback21(() => {
39804
+ const handleReset = useCallback22(() => {
39628
39805
  resetForm();
39629
39806
  }, [resetForm]);
39630
39807
  if (mode === "readonly") return null;
@@ -40518,9 +40695,9 @@ function FormSummary({
40518
40695
  }
40519
40696
 
40520
40697
  // packages/sdk/src/components/hooks/useFormEngine.ts
40521
- import { useState as useState74, useCallback as useCallback22, useMemo as useMemo49, useRef as useRef85 } from "react";
40698
+ import { useState as useState75, useCallback as useCallback23, useMemo as useMemo51, useRef as useRef86 } from "react";
40522
40699
  function useFormEngine(schema, config3) {
40523
- const initialValues = useMemo49(() => {
40700
+ const initialValues = useMemo51(() => {
40524
40701
  const values = {};
40525
40702
  for (const field of schema.fields) {
40526
40703
  if (field.defaultValue !== void 0) {
@@ -40529,10 +40706,10 @@ function useFormEngine(schema, config3) {
40529
40706
  }
40530
40707
  return values;
40531
40708
  }, [schema]);
40532
- const initialValuesRef = useRef85(initialValues);
40533
- const [formData, setFormData] = useState74({ ...initialValues });
40534
- const [fieldErrors, setFieldErrors] = useState74({});
40535
- const fieldBehaviors = useMemo49(() => {
40709
+ const initialValuesRef = useRef86(initialValues);
40710
+ const [formData, setFormData] = useState75({ ...initialValues });
40711
+ const [fieldErrors, setFieldErrors] = useState75({});
40712
+ const fieldBehaviors = useMemo51(() => {
40536
40713
  const baseBehaviors = {};
40537
40714
  for (const field of schema.fields) {
40538
40715
  baseBehaviors[field.fieldId] = field.behavior || "NORMAL";
@@ -40555,7 +40732,7 @@ function useFormEngine(schema, config3) {
40555
40732
  }
40556
40733
  return computed;
40557
40734
  }, [schema, config3.effects, config3.permissions, config3.mode, formData]);
40558
- const setFieldValue = useCallback22((fieldId, value) => {
40735
+ const setFieldValue = useCallback23((fieldId, value) => {
40559
40736
  setFormData((prev) => ({ ...prev, [fieldId]: value }));
40560
40737
  setFieldErrors((prev) => {
40561
40738
  if (prev[fieldId]) {
@@ -40566,9 +40743,9 @@ function useFormEngine(schema, config3) {
40566
40743
  return prev;
40567
40744
  });
40568
40745
  }, []);
40569
- const getFieldValue = useCallback22((fieldId) => formData[fieldId], [formData]);
40570
- const getFormData2 = useCallback22(() => ({ ...formData }), [formData]);
40571
- const validateAll = useCallback22(async () => {
40746
+ const getFieldValue = useCallback23((fieldId) => formData[fieldId], [formData]);
40747
+ const getFormData2 = useCallback23(() => ({ ...formData }), [formData]);
40748
+ const validateAll = useCallback23(async () => {
40572
40749
  const fieldRules = {};
40573
40750
  for (const field of schema.fields) {
40574
40751
  const rules2 = [];
@@ -40586,7 +40763,7 @@ function useFormEngine(schema, config3) {
40586
40763
  setFieldErrors(errors);
40587
40764
  return Object.keys(errors).length === 0;
40588
40765
  }, [schema, formData]);
40589
- const resetForm = useCallback22(() => {
40766
+ const resetForm = useCallback23(() => {
40590
40767
  setFormData({ ...initialValuesRef.current });
40591
40768
  setFieldErrors({});
40592
40769
  }, []);
@@ -40604,12 +40781,12 @@ function useFormEngine(schema, config3) {
40604
40781
  }
40605
40782
 
40606
40783
  // packages/sdk/src/components/hooks/useFormData.ts
40607
- import { useState as useState75, useCallback as useCallback23, useRef as useRef86 } from "react";
40784
+ import { useState as useState76, useCallback as useCallback24, useRef as useRef87 } from "react";
40608
40785
  function useFormData(initialValues = {}) {
40609
- const [formData, setFormData] = useState75({ ...initialValues });
40610
- const [dirtyFields, setDirtyFields] = useState75(/* @__PURE__ */ new Set());
40611
- const initialValuesRef = useRef86(initialValues);
40612
- const setFieldValue = useCallback23((fieldId, value) => {
40786
+ const [formData, setFormData] = useState76({ ...initialValues });
40787
+ const [dirtyFields, setDirtyFields] = useState76(/* @__PURE__ */ new Set());
40788
+ const initialValuesRef = useRef87(initialValues);
40789
+ const setFieldValue = useCallback24((fieldId, value) => {
40613
40790
  setFormData((prev) => ({ ...prev, [fieldId]: value }));
40614
40791
  setDirtyFields((prev) => {
40615
40792
  const next = new Set(prev);
@@ -40617,16 +40794,16 @@ function useFormData(initialValues = {}) {
40617
40794
  return next;
40618
40795
  });
40619
40796
  }, []);
40620
- const getFieldValue = useCallback23(
40797
+ const getFieldValue = useCallback24(
40621
40798
  (fieldId) => {
40622
40799
  return formData[fieldId];
40623
40800
  },
40624
40801
  [formData]
40625
40802
  );
40626
- const getFormData2 = useCallback23(() => {
40803
+ const getFormData2 = useCallback24(() => {
40627
40804
  return { ...formData };
40628
40805
  }, [formData]);
40629
- const resetForm = useCallback23(() => {
40806
+ const resetForm = useCallback24(() => {
40630
40807
  setFormData({ ...initialValuesRef.current });
40631
40808
  setDirtyFields(/* @__PURE__ */ new Set());
40632
40809
  }, []);
@@ -40641,7 +40818,7 @@ function useFormData(initialValues = {}) {
40641
40818
  }
40642
40819
 
40643
40820
  // packages/sdk/src/components/hooks/useFieldBehavior.ts
40644
- import { useMemo as useMemo50 } from "react";
40821
+ import { useMemo as useMemo52 } from "react";
40645
40822
  function useFieldBehavior({
40646
40823
  fieldId,
40647
40824
  permissions,
@@ -40649,7 +40826,7 @@ function useFieldBehavior({
40649
40826
  formData,
40650
40827
  defaultBehavior = "NORMAL"
40651
40828
  }) {
40652
- return useMemo50(() => {
40829
+ return useMemo52(() => {
40653
40830
  if (permissions && permissions[fieldId]) {
40654
40831
  return permissions[fieldId];
40655
40832
  }
@@ -40663,11 +40840,11 @@ function useFieldBehavior({
40663
40840
  }
40664
40841
 
40665
40842
  // packages/sdk/src/components/hooks/useFormSubmit.ts
40666
- import { useState as useState76, useCallback as useCallback24 } from "react";
40843
+ import { useState as useState77, useCallback as useCallback25 } from "react";
40667
40844
  function useFormSubmit(config3) {
40668
- const [isSubmitting, setIsSubmitting] = useState76(false);
40669
- const [submitError, setSubmitError] = useState76(null);
40670
- const submit = useCallback24(
40845
+ const [isSubmitting, setIsSubmitting] = useState77(false);
40846
+ const [submitError, setSubmitError] = useState77(null);
40847
+ const submit = useCallback25(
40671
40848
  async (formData, validateFn) => {
40672
40849
  setSubmitError(null);
40673
40850
  const isValid = await validateFn();
@@ -40699,7 +40876,7 @@ function useFormSubmit(config3) {
40699
40876
  }
40700
40877
 
40701
40878
  // packages/sdk/src/components/hooks/useFieldPermission.ts
40702
- import { useMemo as useMemo51, useCallback as useCallback25 } from "react";
40879
+ import { useMemo as useMemo53, useCallback as useCallback26 } from "react";
40703
40880
 
40704
40881
  // packages/sdk/src/components/utils/permissions.ts
40705
40882
  var OPERATION_ALIASES = {
@@ -40772,7 +40949,7 @@ var normalizeFlowConfig = (config3) => {
40772
40949
  };
40773
40950
  function useFieldPermission(options) {
40774
40951
  const { viewPermissions, processDefinition, currentTask, isApprover, mode } = options;
40775
- const computeBehaviors = useCallback25(() => {
40952
+ const computeBehaviors = useCallback26(() => {
40776
40953
  const behaviors = {};
40777
40954
  if (!currentTask && viewPermissions) {
40778
40955
  return normalizeFieldBehaviors(viewPermissions, mode);
@@ -40817,12 +40994,12 @@ function useFieldPermission(options) {
40817
40994
  }
40818
40995
  return behaviors;
40819
40996
  }, [viewPermissions, processDefinition, currentTask, isApprover, mode]);
40820
- const fieldBehaviors = useMemo51(() => computeBehaviors(), [computeBehaviors]);
40997
+ const fieldBehaviors = useMemo53(() => computeBehaviors(), [computeBehaviors]);
40821
40998
  return { fieldBehaviors, computeBehaviors };
40822
40999
  }
40823
41000
 
40824
41001
  // packages/sdk/src/components/hooks/useFormDetail.ts
40825
- import { useState as useState77, useEffect as useEffect84, useCallback as useCallback26, useRef as useRef87 } from "react";
41002
+ import { useState as useState78, useEffect as useEffect86, useCallback as useCallback27, useRef as useRef88 } from "react";
40826
41003
 
40827
41004
  // packages/sdk/src/components/utils/formInstanceData.ts
40828
41005
  var FORM_INSTANCE_METADATA_KEYS = /* @__PURE__ */ new Set([
@@ -40981,24 +41158,24 @@ function useFormDetail(options) {
40981
41158
  const { formUuid, appType, formInstanceId, fieldIds, onPermissionDenied } = options;
40982
41159
  const { api } = useFormContext();
40983
41160
  const request = api.request;
40984
- const [loading, setLoading] = useState77(true);
40985
- const [mode, setMode] = useState77("readonly");
40986
- const [formData, setFormData] = useState77(null);
40987
- const [instanceInfo, setInstanceInfo] = useState77(null);
40988
- const [permissions, setPermissions] = useState77(null);
40989
- const mountedRef = useRef87(true);
40990
- const onPermissionDeniedRef = useRef87(onPermissionDenied);
41161
+ const [loading, setLoading] = useState78(true);
41162
+ const [mode, setMode] = useState78("readonly");
41163
+ const [formData, setFormData] = useState78(null);
41164
+ const [instanceInfo, setInstanceInfo] = useState78(null);
41165
+ const [permissions, setPermissions] = useState78(null);
41166
+ const mountedRef = useRef88(true);
41167
+ const onPermissionDeniedRef = useRef88(onPermissionDenied);
40991
41168
  const fieldIdsKey = fieldIds?.join("") ?? "";
40992
- useEffect84(() => {
41169
+ useEffect86(() => {
40993
41170
  mountedRef.current = true;
40994
41171
  return () => {
40995
41172
  mountedRef.current = false;
40996
41173
  };
40997
41174
  }, []);
40998
- useEffect84(() => {
41175
+ useEffect86(() => {
40999
41176
  onPermissionDeniedRef.current = onPermissionDenied;
41000
41177
  }, [onPermissionDenied]);
41001
- const loadData = useCallback26(async () => {
41178
+ const loadData = useCallback27(async () => {
41002
41179
  if (!mountedRef.current) return;
41003
41180
  setLoading(true);
41004
41181
  try {
@@ -41033,21 +41210,21 @@ function useFormDetail(options) {
41033
41210
  }
41034
41211
  }
41035
41212
  }, [request, formUuid, appType, formInstanceId, fieldIdsKey]);
41036
- useEffect84(() => {
41213
+ useEffect86(() => {
41037
41214
  loadData();
41038
41215
  }, [loadData]);
41039
41216
  const fieldBehaviors = normalizeFieldBehaviors(permissions, mode);
41040
41217
  const canEdit = hasViewOperation(permissions?.operations, "edit");
41041
41218
  const canDelete = hasViewOperation(permissions?.operations, "delete");
41042
41219
  const canViewChangeRecords = hasViewOperation(permissions?.operations, "change_records");
41043
- const switchToEdit = useCallback26(() => {
41220
+ const switchToEdit = useCallback27(() => {
41044
41221
  setMode("edit");
41045
41222
  loadData();
41046
41223
  }, [loadData]);
41047
- const switchToReadonly = useCallback26(() => {
41224
+ const switchToReadonly = useCallback27(() => {
41048
41225
  setMode("readonly");
41049
41226
  }, []);
41050
- const saveChanges = useCallback26(
41227
+ const saveChanges = useCallback27(
41051
41228
  async (values) => {
41052
41229
  try {
41053
41230
  await api.updateFormData({
@@ -41068,7 +41245,7 @@ function useFormDetail(options) {
41068
41245
  },
41069
41246
  [api, formInstanceId, formUuid, appType]
41070
41247
  );
41071
- const deleteInstance = useCallback26(async () => {
41248
+ const deleteInstance = useCallback27(async () => {
41072
41249
  try {
41073
41250
  await deleteFormData(request, { formInstanceId, appType, formUuid });
41074
41251
  return true;
@@ -41095,7 +41272,7 @@ function useFormDetail(options) {
41095
41272
  }
41096
41273
 
41097
41274
  // packages/sdk/src/components/hooks/useProcessDetail.ts
41098
- import { useState as useState78, useEffect as useEffect85, useCallback as useCallback27, useRef as useRef88, useMemo as useMemo52 } from "react";
41275
+ import { useState as useState79, useEffect as useEffect87, useCallback as useCallback28, useRef as useRef89, useMemo as useMemo54 } from "react";
41099
41276
  var DEFAULT_APPROVAL_ACTIONS = [
41100
41277
  { action: "agree", name: { zh_CN: "\u540C\u610F" } },
41101
41278
  { action: "rejected", name: { zh_CN: "\u62D2\u7EDD" } }
@@ -41123,29 +41300,29 @@ function useProcessDetail(options) {
41123
41300
  const { formUuid, appType, formInstanceId, fieldIds } = options;
41124
41301
  const { api } = useFormContext();
41125
41302
  const request = api.request;
41126
- const [loading, setLoading] = useState78(true);
41127
- const [mode, setMode] = useState78("readonly");
41128
- const [processInfo, setProcessInfo] = useState78(null);
41129
- const [progressList, setProgressList] = useState78([]);
41130
- const [formData, setFormData] = useState78(null);
41131
- const [instanceInfo, setInstanceInfo] = useState78(null);
41132
- const [accessDenied, setAccessDenied] = useState78(false);
41133
- const [loadError, setLoadError] = useState78(null);
41134
- const [isApprover, setIsApprover] = useState78(false);
41135
- const [canWithdraw, setCanWithdraw] = useState78(false);
41136
- const [approvalTasks, setApprovalTasks] = useState78([]);
41137
- const [permissions, setPermissions] = useState78(null);
41138
- const [processDefinition, setProcessDefinition] = useState78(null);
41139
- const [dataVersion, setDataVersion] = useState78(0);
41140
- const mountedRef = useRef88(true);
41303
+ const [loading, setLoading] = useState79(true);
41304
+ const [mode, setMode] = useState79("readonly");
41305
+ const [processInfo, setProcessInfo] = useState79(null);
41306
+ const [progressList, setProgressList] = useState79([]);
41307
+ const [formData, setFormData] = useState79(null);
41308
+ const [instanceInfo, setInstanceInfo] = useState79(null);
41309
+ const [accessDenied, setAccessDenied] = useState79(false);
41310
+ const [loadError, setLoadError] = useState79(null);
41311
+ const [isApprover, setIsApprover] = useState79(false);
41312
+ const [canWithdraw, setCanWithdraw] = useState79(false);
41313
+ const [approvalTasks, setApprovalTasks] = useState79([]);
41314
+ const [permissions, setPermissions] = useState79(null);
41315
+ const [processDefinition, setProcessDefinition] = useState79(null);
41316
+ const [dataVersion, setDataVersion] = useState79(0);
41317
+ const mountedRef = useRef89(true);
41141
41318
  const fieldIdsKey = fieldIds?.join("") ?? "";
41142
- useEffect85(() => {
41319
+ useEffect87(() => {
41143
41320
  mountedRef.current = true;
41144
41321
  return () => {
41145
41322
  mountedRef.current = false;
41146
41323
  };
41147
41324
  }, []);
41148
- const currentTask = useMemo52(
41325
+ const currentTask = useMemo54(
41149
41326
  () => mergeCurrentTask(processInfo?.currentTask, approvalTasks[0]),
41150
41327
  [processInfo?.currentTask, approvalTasks]
41151
41328
  );
@@ -41165,7 +41342,7 @@ function useProcessDetail(options) {
41165
41342
  isApprover: isProcessFinal ? false : isApprover,
41166
41343
  mode
41167
41344
  });
41168
- const activeActions = useMemo52(() => {
41345
+ const activeActions = useMemo54(() => {
41169
41346
  if (!isApprover || isProcessFinal) return [];
41170
41347
  const actions = currentTask?.actions && currentTask.actions.length > 0 ? [...currentTask.actions] : [...DEFAULT_APPROVAL_ACTIONS];
41171
41348
  if (canWithdraw && !actions.some((action) => action.action === "withdraw")) {
@@ -41173,7 +41350,7 @@ function useProcessDetail(options) {
41173
41350
  }
41174
41351
  return actions;
41175
41352
  }, [isApprover, isProcessFinal, currentTask?.actions, canWithdraw]);
41176
- const loadData = useCallback27(async () => {
41353
+ const loadData = useCallback28(async () => {
41177
41354
  if (!mountedRef.current) return;
41178
41355
  setLoading(true);
41179
41356
  setAccessDenied(false);
@@ -41255,24 +41432,24 @@ function useProcessDetail(options) {
41255
41432
  }
41256
41433
  }
41257
41434
  }, [request, formUuid, appType, formInstanceId, fieldIdsKey]);
41258
- useEffect85(() => {
41435
+ useEffect87(() => {
41259
41436
  loadData();
41260
41437
  }, [loadData]);
41261
- const switchToEdit = useCallback27(() => {
41438
+ const switchToEdit = useCallback28(() => {
41262
41439
  setMode("edit");
41263
41440
  void loadData();
41264
41441
  }, [loadData]);
41265
- const switchToReadonly = useCallback27(() => {
41442
+ const switchToReadonly = useCallback28(() => {
41266
41443
  setMode("readonly");
41267
41444
  }, []);
41268
- const refreshDetail = useCallback27(async () => {
41445
+ const refreshDetail = useCallback28(async () => {
41269
41446
  setMode("readonly");
41270
41447
  await loadData();
41271
41448
  }, [loadData]);
41272
- const refreshProgress = useCallback27(async () => {
41449
+ const refreshProgress = useCallback28(async () => {
41273
41450
  await refreshDetail();
41274
41451
  }, [refreshDetail]);
41275
- const saveChanges = useCallback27(
41452
+ const saveChanges = useCallback28(
41276
41453
  async (values) => {
41277
41454
  try {
41278
41455
  await api.updateFormData({
@@ -41291,7 +41468,7 @@ function useProcessDetail(options) {
41291
41468
  },
41292
41469
  [api, formInstanceId, formUuid, appType, loadData]
41293
41470
  );
41294
- const deleteInstance = useCallback27(async () => {
41471
+ const deleteInstance = useCallback28(async () => {
41295
41472
  try {
41296
41473
  await deleteFormData(request, { formInstanceId, appType, formUuid });
41297
41474
  return true;
@@ -41332,29 +41509,29 @@ function useProcessDetail(options) {
41332
41509
  }
41333
41510
 
41334
41511
  // packages/sdk/src/components/hooks/useApprovalActions.ts
41335
- import { useState as useState79, useCallback as useCallback28, useRef as useRef89, useEffect as useEffect86 } from "react";
41512
+ import { useState as useState80, useCallback as useCallback29, useRef as useRef90, useEffect as useEffect88 } from "react";
41336
41513
  function useApprovalActions(options) {
41337
41514
  const { formInstanceId, formUuid, appType, currentTaskId, onActionComplete, getFormValues } = options;
41338
41515
  const { api } = useFormContext();
41339
41516
  const request = api.request;
41340
- const [isLoading, setIsLoading] = useState79(false);
41341
- const [currentAction, setCurrentAction] = useState79(null);
41342
- const [returnableNodes, setReturnableNodes] = useState79([]);
41343
- const [returnPolicy, setReturnPolicy] = useState79(null);
41344
- const mountedRef = useRef89(true);
41345
- useEffect86(() => {
41517
+ const [isLoading, setIsLoading] = useState80(false);
41518
+ const [currentAction, setCurrentAction] = useState80(null);
41519
+ const [returnableNodes, setReturnableNodes] = useState80([]);
41520
+ const [returnPolicy, setReturnPolicy] = useState80(null);
41521
+ const mountedRef = useRef90(true);
41522
+ useEffect88(() => {
41346
41523
  mountedRef.current = true;
41347
41524
  return () => {
41348
41525
  mountedRef.current = false;
41349
41526
  };
41350
41527
  }, []);
41351
- const resetLoading = useCallback28(() => {
41528
+ const resetLoading = useCallback29(() => {
41352
41529
  if (mountedRef.current) {
41353
41530
  setIsLoading(false);
41354
41531
  setCurrentAction(null);
41355
41532
  }
41356
41533
  }, []);
41357
- const approve = useCallback28(
41534
+ const approve = useCallback29(
41358
41535
  async (comments) => {
41359
41536
  setIsLoading(true);
41360
41537
  setCurrentAction("approve");
@@ -41379,7 +41556,7 @@ function useApprovalActions(options) {
41379
41556
  },
41380
41557
  [request, formInstanceId, appType, formUuid, getFormValues, onActionComplete, resetLoading]
41381
41558
  );
41382
- const reject = useCallback28(
41559
+ const reject = useCallback29(
41383
41560
  async (comments) => {
41384
41561
  setIsLoading(true);
41385
41562
  setCurrentAction("reject");
@@ -41400,7 +41577,7 @@ function useApprovalActions(options) {
41400
41577
  },
41401
41578
  [request, formInstanceId, onActionComplete, resetLoading]
41402
41579
  );
41403
- const transfer = useCallback28(
41580
+ const transfer = useCallback29(
41404
41581
  async (userId, reason) => {
41405
41582
  if (!currentTaskId) {
41406
41583
  console.error("[useApprovalActions] transfer failed: no currentTaskId");
@@ -41425,7 +41602,7 @@ function useApprovalActions(options) {
41425
41602
  },
41426
41603
  [request, currentTaskId, onActionComplete, resetLoading]
41427
41604
  );
41428
- const returnTo = useCallback28(
41605
+ const returnTo = useCallback29(
41429
41606
  async (nodeId, reason) => {
41430
41607
  if (!currentTaskId) {
41431
41608
  console.error("[useApprovalActions] returnTo failed: no currentTaskId");
@@ -41450,7 +41627,7 @@ function useApprovalActions(options) {
41450
41627
  },
41451
41628
  [request, currentTaskId, onActionComplete, resetLoading]
41452
41629
  );
41453
- const withdraw = useCallback28(
41630
+ const withdraw = useCallback29(
41454
41631
  async (reason) => {
41455
41632
  setIsLoading(true);
41456
41633
  setCurrentAction("withdraw");
@@ -41470,7 +41647,7 @@ function useApprovalActions(options) {
41470
41647
  },
41471
41648
  [request, formInstanceId, onActionComplete, resetLoading]
41472
41649
  );
41473
- const save = useCallback28(async () => {
41650
+ const save = useCallback29(async () => {
41474
41651
  setIsLoading(true);
41475
41652
  setCurrentAction("save");
41476
41653
  try {
@@ -41490,7 +41667,7 @@ function useApprovalActions(options) {
41490
41667
  return false;
41491
41668
  }
41492
41669
  }, [request, formInstanceId, formUuid, appType, getFormValues, onActionComplete, resetLoading]);
41493
- const resubmit = useCallback28(
41670
+ const resubmit = useCallback29(
41494
41671
  async (comments, selectedApprovers) => {
41495
41672
  if (!currentTaskId) {
41496
41673
  console.error("[useApprovalActions] resubmit failed: no currentTaskId");
@@ -41520,7 +41697,7 @@ function useApprovalActions(options) {
41520
41697
  },
41521
41698
  [request, currentTaskId, formUuid, appType, getFormValues, onActionComplete, resetLoading]
41522
41699
  );
41523
- const callbackTask = useCallback28(
41700
+ const callbackTask = useCallback29(
41524
41701
  async (payload) => {
41525
41702
  if (!currentTaskId) {
41526
41703
  console.error("[useApprovalActions] callbackTask failed: no currentTaskId");
@@ -41544,7 +41721,7 @@ function useApprovalActions(options) {
41544
41721
  },
41545
41722
  [request, currentTaskId, onActionComplete, resetLoading]
41546
41723
  );
41547
- const loadReturnableNodes = useCallback28(async () => {
41724
+ const loadReturnableNodes = useCallback29(async () => {
41548
41725
  if (!currentTaskId) return [];
41549
41726
  try {
41550
41727
  const result = await getReturnableNodeResult(request, currentTaskId);
@@ -41580,7 +41757,7 @@ function useApprovalActions(options) {
41580
41757
  }
41581
41758
 
41582
41759
  // packages/sdk/src/components/hooks/useChangeRecords.ts
41583
- import { useState as useState80, useEffect as useEffect87, useCallback as useCallback29, useRef as useRef90 } from "react";
41760
+ import { useState as useState81, useEffect as useEffect89, useCallback as useCallback30, useRef as useRef91 } from "react";
41584
41761
  var normalizeChangeRecordList = (value) => {
41585
41762
  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;
41586
41763
  const records = Array.isArray(body) ? body : body?.records ?? body?.data ?? body?.list ?? body?.items ?? [];
@@ -41595,18 +41772,18 @@ function useChangeRecords(options) {
41595
41772
  const { formUuid, appType, formInstanceId, pageSize = 20, autoLoad = true } = options;
41596
41773
  const { api } = useFormContext();
41597
41774
  const request = api.request;
41598
- const [records, setRecords] = useState80([]);
41599
- const [loading, setLoading] = useState80(false);
41600
- const [total, setTotal] = useState80(0);
41601
- const [page, setPage] = useState80(1);
41602
- const mountedRef = useRef90(true);
41603
- useEffect87(() => {
41775
+ const [records, setRecords] = useState81([]);
41776
+ const [loading, setLoading] = useState81(false);
41777
+ const [total, setTotal] = useState81(0);
41778
+ const [page, setPage] = useState81(1);
41779
+ const mountedRef = useRef91(true);
41780
+ useEffect89(() => {
41604
41781
  mountedRef.current = true;
41605
41782
  return () => {
41606
41783
  mountedRef.current = false;
41607
41784
  };
41608
41785
  }, []);
41609
- const fetchRecords = useCallback29(
41786
+ const fetchRecords = useCallback30(
41610
41787
  async (pageNum, append) => {
41611
41788
  if (!mountedRef.current) return;
41612
41789
  setLoading(true);
@@ -41637,18 +41814,18 @@ function useChangeRecords(options) {
41637
41814
  },
41638
41815
  [request, formUuid, appType, formInstanceId, pageSize]
41639
41816
  );
41640
- useEffect87(() => {
41817
+ useEffect89(() => {
41641
41818
  if (autoLoad) {
41642
41819
  fetchRecords(1, false);
41643
41820
  }
41644
41821
  }, [autoLoad, fetchRecords]);
41645
41822
  const safeRecords = Array.isArray(records) ? records : [];
41646
41823
  const hasMore = safeRecords.length < total;
41647
- const loadMore = useCallback29(async () => {
41824
+ const loadMore = useCallback30(async () => {
41648
41825
  if (!hasMore || loading) return;
41649
41826
  await fetchRecords(page + 1, true);
41650
41827
  }, [hasMore, loading, page, fetchRecords]);
41651
- const refresh = useCallback29(async () => {
41828
+ const refresh = useCallback30(async () => {
41652
41829
  setRecords([]);
41653
41830
  setPage(1);
41654
41831
  setTotal(0);
@@ -41666,7 +41843,7 @@ function useChangeRecords(options) {
41666
41843
  }
41667
41844
 
41668
41845
  // packages/sdk/src/components/hooks/useFormNavigation.ts
41669
- import { useState as useState81, useCallback as useCallback30, useRef as useRef91, useEffect as useEffect88 } from "react";
41846
+ import { useState as useState82, useCallback as useCallback31, useRef as useRef92, useEffect as useEffect90 } from "react";
41670
41847
  var normalizeBasePath = (basePath) => {
41671
41848
  const normalized = String(basePath || "").replace(/^\/+|\/+$/g, "");
41672
41849
  return normalized ? `/${normalized}` : "";
@@ -41693,12 +41870,12 @@ function useFormNavigation(options) {
41693
41870
  basePath,
41694
41871
  onStay
41695
41872
  } = options;
41696
- const [isRedirecting, setIsRedirecting] = useState81(false);
41697
- const [countdown, setCountdown] = useState81(0);
41698
- const timerRef = useRef91(null);
41699
- const redirectTargetRef = useRef91(null);
41700
- const mountedRef = useRef91(true);
41701
- useEffect88(() => {
41873
+ const [isRedirecting, setIsRedirecting] = useState82(false);
41874
+ const [countdown, setCountdown] = useState82(0);
41875
+ const timerRef = useRef92(null);
41876
+ const redirectTargetRef = useRef92(null);
41877
+ const mountedRef = useRef92(true);
41878
+ useEffect90(() => {
41702
41879
  mountedRef.current = true;
41703
41880
  return () => {
41704
41881
  mountedRef.current = false;
@@ -41708,13 +41885,13 @@ function useFormNavigation(options) {
41708
41885
  }
41709
41886
  };
41710
41887
  }, []);
41711
- const navigateToDetail = useCallback30(
41888
+ const navigateToDetail = useCallback31(
41712
41889
  (formInstId) => {
41713
41890
  window.location.href = buildDetailUrl(appType, formUuid, formInstId, "formDetail", basePath);
41714
41891
  },
41715
41892
  [appType, basePath, formUuid]
41716
41893
  );
41717
- const navigateToProcessDetail = useCallback30(
41894
+ const navigateToProcessDetail = useCallback31(
41718
41895
  (formInstId) => {
41719
41896
  window.location.href = buildDetailUrl(
41720
41897
  appType,
@@ -41726,7 +41903,7 @@ function useFormNavigation(options) {
41726
41903
  },
41727
41904
  [appType, basePath, formUuid]
41728
41905
  );
41729
- const startRedirectCountdown = useCallback30(
41906
+ const startRedirectCountdown = useCallback31(
41730
41907
  (targetUrl) => {
41731
41908
  const totalSeconds = Math.ceil(redirectDelay / 1e3);
41732
41909
  setIsRedirecting(true);
@@ -41759,7 +41936,7 @@ function useFormNavigation(options) {
41759
41936
  },
41760
41937
  [redirectDelay]
41761
41938
  );
41762
- const cancelRedirect = useCallback30(() => {
41939
+ const cancelRedirect = useCallback31(() => {
41763
41940
  if (timerRef.current) {
41764
41941
  clearInterval(timerRef.current);
41765
41942
  timerRef.current = null;
@@ -41768,7 +41945,7 @@ function useFormNavigation(options) {
41768
41945
  setCountdown(0);
41769
41946
  redirectTargetRef.current = null;
41770
41947
  }, []);
41771
- const handlePostSubmit = useCallback30(
41948
+ const handlePostSubmit = useCallback31(
41772
41949
  (formInstId) => {
41773
41950
  if (mode === "stay") {
41774
41951
  onStay?.(formInstId);
@@ -41800,7 +41977,7 @@ function useFormNavigation(options) {
41800
41977
  }
41801
41978
 
41802
41979
  // packages/sdk/src/components/hooks/useDraftStorage.ts
41803
- import { useState as useState82, useCallback as useCallback31, useEffect as useEffect89 } from "react";
41980
+ import { useState as useState83, useCallback as useCallback32, useEffect as useEffect91 } from "react";
41804
41981
  function getDraftKey(appType, formUuid) {
41805
41982
  return `${appType}__${formUuid}__draft`;
41806
41983
  }
@@ -41820,10 +41997,10 @@ function readDraft(key) {
41820
41997
  function useDraftStorage(options) {
41821
41998
  const { appType, formUuid, autoRestore = false } = options;
41822
41999
  const key = getDraftKey(appType, formUuid);
41823
- const [hasDraft, setHasDraft] = useState82(false);
41824
- const [draftData, setDraftData] = useState82(null);
41825
- const [draftTimestamp, setDraftTimestamp] = useState82(null);
41826
- useEffect89(() => {
42000
+ const [hasDraft, setHasDraft] = useState83(false);
42001
+ const [draftData, setDraftData] = useState83(null);
42002
+ const [draftTimestamp, setDraftTimestamp] = useState83(null);
42003
+ useEffect91(() => {
41827
42004
  const stored = readDraft(key);
41828
42005
  if (stored) {
41829
42006
  setHasDraft(true);
@@ -41837,7 +42014,7 @@ function useDraftStorage(options) {
41837
42014
  setDraftTimestamp(null);
41838
42015
  }
41839
42016
  }, [key, autoRestore]);
41840
- const saveDraft = useCallback31(
42017
+ const saveDraft = useCallback32(
41841
42018
  (data) => {
41842
42019
  const payload = { data, ts: Date.now() };
41843
42020
  try {
@@ -41851,7 +42028,7 @@ function useDraftStorage(options) {
41851
42028
  },
41852
42029
  [key]
41853
42030
  );
41854
- const restoreDraft = useCallback31(() => {
42031
+ const restoreDraft = useCallback32(() => {
41855
42032
  const stored = readDraft(key);
41856
42033
  if (stored) {
41857
42034
  setDraftData(stored.data);
@@ -41859,7 +42036,7 @@ function useDraftStorage(options) {
41859
42036
  }
41860
42037
  return null;
41861
42038
  }, [key]);
41862
- const clearDraft = useCallback31(() => {
42039
+ const clearDraft = useCallback32(() => {
41863
42040
  try {
41864
42041
  localStorage.removeItem(key);
41865
42042
  } catch (error) {
@@ -41952,7 +42129,7 @@ var FormSummaryCard = ({
41952
42129
  };
41953
42130
 
41954
42131
  // packages/sdk/src/components/modules/RecordChangePanel.tsx
41955
- import { useState as useState83 } from "react";
42132
+ import { useState as useState84 } from "react";
41956
42133
  import { Button as Button10, Empty as Empty4, Pagination as Pagination2, Skeleton as Skeleton2, Tag as Tag6, Tooltip as Tooltip2 } from "antd";
41957
42134
  import {
41958
42135
  ArrowRightOutlined,
@@ -42004,7 +42181,7 @@ var RecordChangePanel = ({
42004
42181
  onPageChange,
42005
42182
  className = ""
42006
42183
  }) => {
42007
- const [expanded, setExpanded] = useState83(defaultExpanded);
42184
+ const [expanded, setExpanded] = useState84(defaultExpanded);
42008
42185
  const count = total ?? records.length;
42009
42186
  const handleToggle = () => {
42010
42187
  const next = !expanded;
@@ -42174,7 +42351,7 @@ var ChangeRecords = ({
42174
42351
  };
42175
42352
 
42176
42353
  // packages/sdk/src/components/modules/ApprovalTimeline.tsx
42177
- import { useMemo as useMemo53 } from "react";
42354
+ import { useMemo as useMemo55 } from "react";
42178
42355
  import {
42179
42356
  ApiOutlined,
42180
42357
  CheckCircleFilled,
@@ -42337,8 +42514,8 @@ var ApprovalTimeline = ({
42337
42514
  compactMode = false,
42338
42515
  showApproverInfo = true
42339
42516
  }) => {
42340
- const taskList = useMemo53(() => Array.isArray(tasks) ? tasks : [], [tasks]);
42341
- const groups = useMemo53(() => groupTasks(taskList), [taskList]);
42517
+ const taskList = useMemo55(() => Array.isArray(tasks) ? tasks : [], [tasks]);
42518
+ const groups = useMemo55(() => groupTasks(taskList), [taskList]);
42342
42519
  if (taskList.length === 0) {
42343
42520
  return /* @__PURE__ */ jsx86(
42344
42521
  "div",
@@ -42433,7 +42610,7 @@ var ApprovalTimeline = ({
42433
42610
  };
42434
42611
 
42435
42612
  // packages/sdk/src/components/modules/ApprovalActionBar.tsx
42436
- import React244, { useMemo as useMemo55, useState as useState85 } from "react";
42613
+ import React245, { useMemo as useMemo57, useState as useState86 } from "react";
42437
42614
  import { Form as Form6, Input as Input10, Modal as Modal7, Select as Select6 } from "antd";
42438
42615
  import {
42439
42616
  CheckOutlined,
@@ -42444,7 +42621,7 @@ import {
42444
42621
  } from "@ant-design/icons";
42445
42622
 
42446
42623
  // packages/sdk/src/components/modules/StickyActionBar.tsx
42447
- import { useEffect as useEffect90, useMemo as useMemo54, useState as useState84 } from "react";
42624
+ import { useEffect as useEffect92, useMemo as useMemo56, useState as useState85 } from "react";
42448
42625
  import { Button as Button11, Dropdown as Dropdown2 } from "antd";
42449
42626
  import { MoreOutlined } from "@ant-design/icons";
42450
42627
 
@@ -42480,14 +42657,14 @@ var StickyActionBar = ({
42480
42657
  position = "sticky",
42481
42658
  surface = "default"
42482
42659
  }) => {
42483
- const [isMobile, setIsMobile] = useState84(false);
42484
- useEffect90(() => {
42660
+ const [isMobile, setIsMobile] = useState85(false);
42661
+ useEffect92(() => {
42485
42662
  const update3 = () => setIsMobile(typeof window !== "undefined" && window.innerWidth <= 768);
42486
42663
  update3();
42487
42664
  window.addEventListener("resize", update3);
42488
42665
  return () => window.removeEventListener("resize", update3);
42489
42666
  }, []);
42490
- const visibleActions = useMemo54(
42667
+ const visibleActions = useMemo56(
42491
42668
  () => actions.filter((action) => action.visible !== false).sort((left, right) => getActionPriority(left) - getActionPriority(right)),
42492
42669
  [actions]
42493
42670
  );
@@ -42602,12 +42779,12 @@ function DefaultTransferSelector({
42602
42779
  value,
42603
42780
  onChange
42604
42781
  }) {
42605
- const formContext = React244.useContext(FormContext);
42782
+ const formContext = React245.useContext(FormContext);
42606
42783
  const { isMobile } = useDeviceDetect();
42607
- const fallbackApi = useMemo55(() => createFormRuntimeApi(), []);
42784
+ const fallbackApi = useMemo57(() => createFormRuntimeApi(), []);
42608
42785
  const api = formContext?.api ?? fallbackApi;
42609
- const [open, setOpen] = useState85(false);
42610
- const [selectedUsers, setSelectedUsers] = useState85([]);
42786
+ const [open, setOpen] = useState86(false);
42787
+ const [selectedUsers, setSelectedUsers] = useState86([]);
42611
42788
  const selectedLabel = selectedUsers[0] ? getUserName(selectedUsers[0]) : value;
42612
42789
  return /* @__PURE__ */ jsxs43(Fragment13, { children: [
42613
42790
  /* @__PURE__ */ jsx88(
@@ -42662,10 +42839,10 @@ var ApprovalActionBar = ({
42662
42839
  maxWidth
42663
42840
  }) => {
42664
42841
  const [form] = Form6.useForm();
42665
- const [modalAction, setModalAction] = useState85(null);
42666
- const [activeAction, setActiveAction] = useState85(null);
42667
- const [loading, setLoading] = useState85(false);
42668
- const visibleActions = useMemo55(
42842
+ const [modalAction, setModalAction] = useState86(null);
42843
+ const [activeAction, setActiveAction] = useState86(null);
42844
+ const [loading, setLoading] = useState86(false);
42845
+ const visibleActions = useMemo57(
42669
42846
  () => actions.filter((action) => !action.hidden).sort((a, b) => (actionPriority[a.action] ?? 50) - (actionPriority[b.action] ?? 50)),
42670
42847
  [actions]
42671
42848
  );
@@ -42842,7 +43019,7 @@ var ApprovalActionBar = ({
42842
43019
  };
42843
43020
 
42844
43021
  // packages/sdk/src/components/modules/ApprovalActions.tsx
42845
- import { useMemo as useMemo56, useState as useState86 } from "react";
43022
+ import { useMemo as useMemo58, useState as useState87 } from "react";
42846
43023
  import { Button as Button12, Dropdown as Dropdown3, Form as Form7, Input as Input11, Modal as Modal8 } from "antd";
42847
43024
  import { MoreOutlined as MoreOutlined2 } from "@ant-design/icons";
42848
43025
  import { Fragment as Fragment14, jsx as jsx89, jsxs as jsxs44 } from "react/jsx-runtime";
@@ -42870,11 +43047,11 @@ var ApprovalActions = ({
42870
43047
  className = ""
42871
43048
  }) => {
42872
43049
  const [form] = Form7.useForm();
42873
- const [modalAction, setModalAction] = useState86(null);
42874
- const [activeAction, setActiveAction] = useState86(null);
42875
- const [loading, setLoading] = useState86(false);
42876
- const [saveLoading, setSaveLoading] = useState86(false);
42877
- const renderableActions = useMemo56(
43050
+ const [modalAction, setModalAction] = useState87(null);
43051
+ const [activeAction, setActiveAction] = useState87(null);
43052
+ const [loading, setLoading] = useState87(false);
43053
+ const [saveLoading, setSaveLoading] = useState87(false);
43054
+ const renderableActions = useMemo58(
42878
43055
  () => actions.filter((action) => !action.hidden).sort((a, b) => (priority2[a.action] ?? 50) - (priority2[b.action] ?? 50)),
42879
43056
  [actions]
42880
43057
  );
@@ -43004,7 +43181,7 @@ var ApprovalActions = ({
43004
43181
  };
43005
43182
 
43006
43183
  // packages/sdk/src/components/modules/FormActionBar.tsx
43007
- import { useState as useState87 } from "react";
43184
+ import { useState as useState88 } from "react";
43008
43185
  import { Button as Button13 } from "antd";
43009
43186
  import { Fragment as Fragment15, jsx as jsx90, jsxs as jsxs45 } from "react/jsx-runtime";
43010
43187
  var FormActionBar = ({
@@ -43012,7 +43189,7 @@ var FormActionBar = ({
43012
43189
  position = "bottom-fixed",
43013
43190
  className = ""
43014
43191
  }) => {
43015
- const [loadingKeys, setLoadingKeys] = useState87(/* @__PURE__ */ new Set());
43192
+ const [loadingKeys, setLoadingKeys] = useState88(/* @__PURE__ */ new Set());
43016
43193
  const visibleActions = actions.filter((a) => a.visible !== false);
43017
43194
  const sortedActions = [...visibleActions].sort((a, b) => {
43018
43195
  if (a.type === "danger" && b.type !== "danger") return -1;
@@ -43312,7 +43489,7 @@ var ProcessPreview = ({
43312
43489
  };
43313
43490
 
43314
43491
  // packages/sdk/src/components/modules/DataManagementList.tsx
43315
- import { useCallback as useCallback36, useEffect as useEffect93, useMemo as useMemo61, useRef as useRef96, useState as useState92 } from "react";
43492
+ import { useCallback as useCallback37, useEffect as useEffect95, useMemo as useMemo63, useRef as useRef97, useState as useState93 } from "react";
43316
43493
  import {
43317
43494
  Alert as Alert2,
43318
43495
  Button as Button18,
@@ -43351,10 +43528,10 @@ import {
43351
43528
  } from "@ant-design/icons";
43352
43529
 
43353
43530
  // packages/sdk/src/components/templates/StandardFormPage.tsx
43354
- import { useMemo as useMemo60 } from "react";
43531
+ import { useMemo as useMemo62 } from "react";
43355
43532
 
43356
43533
  // packages/sdk/src/components/templates/FormDetailTemplate.tsx
43357
- import { useCallback as useCallback32, useMemo as useMemo57, useRef as useRef92, useState as useState88 } from "react";
43534
+ import { useCallback as useCallback33, useMemo as useMemo59, useRef as useRef93, useState as useState89 } from "react";
43358
43535
  import dayjs18 from "dayjs";
43359
43536
 
43360
43537
  // packages/sdk/src/components/templates/PageSkeleton.tsx
@@ -43450,10 +43627,10 @@ var InnerDetailContent = ({
43450
43627
  onSave,
43451
43628
  inDrawer = false
43452
43629
  }) => {
43453
- const formDataRef = useRef92(void 0);
43454
- const validateRef = useRef92(void 0);
43455
- const [accessDenied, setAccessDenied] = useState88(false);
43456
- const fieldIds = useMemo57(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
43630
+ const formDataRef = useRef93(void 0);
43631
+ const validateRef = useRef93(void 0);
43632
+ const [accessDenied, setAccessDenied] = useState89(false);
43633
+ const fieldIds = useMemo59(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
43457
43634
  const {
43458
43635
  loading,
43459
43636
  mode,
@@ -43488,7 +43665,7 @@ var InnerDetailContent = ({
43488
43665
  formInstanceId,
43489
43666
  autoLoad: enableChangeRecords && canViewChangeRecords
43490
43667
  });
43491
- const handleSave = useCallback32(async () => {
43668
+ const handleSave = useCallback33(async () => {
43492
43669
  if (validateRef.current && !await validateAndNotify(validateRef.current)) return;
43493
43670
  const values = formDataRef.current?.() ?? formData;
43494
43671
  if (!values) return;
@@ -43497,13 +43674,13 @@ var InnerDetailContent = ({
43497
43674
  onSave?.(values);
43498
43675
  }
43499
43676
  }, [formData, saveChanges, onSave]);
43500
- const handleDelete = useCallback32(async () => {
43677
+ const handleDelete = useCallback33(async () => {
43501
43678
  const success = await deleteInstance();
43502
43679
  if (success) {
43503
43680
  onDelete?.();
43504
43681
  }
43505
43682
  }, [deleteInstance, onDelete]);
43506
- const handleCancel = useCallback32(() => {
43683
+ const handleCancel = useCallback33(() => {
43507
43684
  switchToReadonly();
43508
43685
  }, [switchToReadonly]);
43509
43686
  const readonlyActions = [];
@@ -43630,12 +43807,12 @@ var FormDetailTemplate = (props) => {
43630
43807
  };
43631
43808
 
43632
43809
  // packages/sdk/src/components/templates/FormSubmitTemplate.tsx
43633
- import { useEffect as useEffect92, useRef as useRef94, useState as useState90, useCallback as useCallback34 } from "react";
43810
+ import { useEffect as useEffect94, useRef as useRef95, useState as useState91, useCallback as useCallback35 } from "react";
43634
43811
  import { Button as Button17, message as message3, Modal as Modal11, Select as Select8 } from "antd";
43635
43812
  import { CheckCircleFilled as CheckCircleFilled2 } from "@ant-design/icons";
43636
43813
 
43637
43814
  // packages/sdk/src/components/modules/InitiatorApproverSelector.tsx
43638
- import { useCallback as useCallback33, useEffect as useEffect91, useMemo as useMemo58, useRef as useRef93, useState as useState89 } from "react";
43815
+ import { useCallback as useCallback34, useEffect as useEffect93, useMemo as useMemo60, useRef as useRef94, useState as useState90 } from "react";
43639
43816
  import { Button as Button16, Empty as Empty6, Modal as Modal10, Select as Select7, Space as Space9, Tag as Tag7, Typography, message as message2 } from "antd";
43640
43817
  import { jsx as jsx97, jsxs as jsxs52 } from "react/jsx-runtime";
43641
43818
  var scopeText = {
@@ -43671,19 +43848,19 @@ var RequirementSelect = ({
43671
43848
  selectedUsers,
43672
43849
  onChange
43673
43850
  }) => {
43674
- const [pickerOpen, setPickerOpen] = useState89(false);
43675
- const initialCandidates = useMemo58(
43851
+ const [pickerOpen, setPickerOpen] = useState90(false);
43852
+ const initialCandidates = useMemo60(
43676
43853
  () => (requirement.candidateUsers || []).map(normalizeCandidate).filter(Boolean),
43677
43854
  [requirement.candidateUsers]
43678
43855
  );
43679
- const [optionsSource, setOptionsSource] = useState89(initialCandidates);
43680
- const [loading, setLoading] = useState89(false);
43681
- useEffect91(() => {
43856
+ const [optionsSource, setOptionsSource] = useState90(initialCandidates);
43857
+ const [loading, setLoading] = useState90(false);
43858
+ useEffect93(() => {
43682
43859
  setOptionsSource(
43683
43860
  (current) => mergeUsers(initialCandidates, mergeUsers(current, selectedUsers))
43684
43861
  );
43685
43862
  }, [initialCandidates, selectedUsers]);
43686
- const loadCandidates = useCallback33(
43863
+ const loadCandidates = useCallback34(
43687
43864
  async (keyword) => {
43688
43865
  setLoading(true);
43689
43866
  try {
@@ -43721,12 +43898,12 @@ var RequirementSelect = ({
43721
43898
  },
43722
43899
  [api, appType, formUuid, initialCandidates.length, requirement.nodeId, requirement.scope]
43723
43900
  );
43724
- useEffect91(() => {
43901
+ useEffect93(() => {
43725
43902
  if (requirement.scope !== "all" && open && formUuid && appType && requirement.nodeId) {
43726
43903
  void loadCandidates();
43727
43904
  }
43728
43905
  }, [appType, formUuid, loadCandidates, open, requirement.nodeId, requirement.scope]);
43729
- const options = useMemo58(
43906
+ const options = useMemo60(
43730
43907
  () => optionsSource.map((user) => ({
43731
43908
  value: user.id,
43732
43909
  label: getUserLabel(user)
@@ -43811,9 +43988,9 @@ var InitiatorApproverSelector = ({
43811
43988
  onOk,
43812
43989
  onCancel
43813
43990
  }) => {
43814
- const [selected, setSelected] = useState89({});
43815
- const wasOpenRef = useRef93(false);
43816
- useEffect91(() => {
43991
+ const [selected, setSelected] = useState90({});
43992
+ const wasOpenRef = useRef94(false);
43993
+ useEffect93(() => {
43817
43994
  if (open && !wasOpenRef.current) {
43818
43995
  setSelected(value || EMPTY_SELECTED_MAP);
43819
43996
  }
@@ -43969,26 +44146,26 @@ var InnerFormContent = ({
43969
44146
  inDrawer = false
43970
44147
  }) => {
43971
44148
  const { validateAllWithErrors, getFormData: getFormData2, setFieldValue, resetForm, api } = useFormContext();
43972
- const [submitted, setSubmitted] = useState90(false);
43973
- const [successInfo, setSuccessInfo] = useState90(null);
43974
- const [submitting, setSubmitting] = useState90(false);
43975
- const [departmentId, setDepartmentId] = useState90();
43976
- const [submissionDepartmentModalOpen, setSubmissionDepartmentModalOpen] = useState90(false);
43977
- const [submissionDepartmentOptions, setSubmissionDepartmentOptions] = useState90([]);
43978
- const [selectedSubmissionDepartmentId, setSelectedSubmissionDepartmentId] = useState90();
43979
- const submissionDepartmentResolverRef = useRef94(null);
43980
- const [previewOpen, setPreviewOpen] = useState90(false);
43981
- const [previewLoading, setPreviewLoading] = useState90(false);
43982
- const [previewRoutes, setPreviewRoutes] = useState90([]);
43983
- const [pendingFormData, setPendingFormData] = useState90(null);
43984
- const [pendingSubmissionDepartmentId, setPendingSubmissionDepartmentId] = useState90();
43985
- const [pendingInitiatorSelectedApprovers, setPendingInitiatorSelectedApprovers] = useState90();
43986
- const pendingSubmissionDepartmentIdRef = useRef94(void 0);
43987
- const pendingInitiatorSelectedApproversRef = useRef94(
44149
+ const [submitted, setSubmitted] = useState91(false);
44150
+ const [successInfo, setSuccessInfo] = useState91(null);
44151
+ const [submitting, setSubmitting] = useState91(false);
44152
+ const [departmentId, setDepartmentId] = useState91();
44153
+ const [submissionDepartmentModalOpen, setSubmissionDepartmentModalOpen] = useState91(false);
44154
+ const [submissionDepartmentOptions, setSubmissionDepartmentOptions] = useState91([]);
44155
+ const [selectedSubmissionDepartmentId, setSelectedSubmissionDepartmentId] = useState91();
44156
+ const submissionDepartmentResolverRef = useRef95(null);
44157
+ const [previewOpen, setPreviewOpen] = useState91(false);
44158
+ const [previewLoading, setPreviewLoading] = useState91(false);
44159
+ const [previewRoutes, setPreviewRoutes] = useState91([]);
44160
+ const [pendingFormData, setPendingFormData] = useState91(null);
44161
+ const [pendingSubmissionDepartmentId, setPendingSubmissionDepartmentId] = useState91();
44162
+ const [pendingInitiatorSelectedApprovers, setPendingInitiatorSelectedApprovers] = useState91();
44163
+ const pendingSubmissionDepartmentIdRef = useRef95(void 0);
44164
+ const pendingInitiatorSelectedApproversRef = useRef95(
43988
44165
  void 0
43989
44166
  );
43990
- const [initiatorApproverOpen, setInitiatorApproverOpen] = useState90(false);
43991
- const [initiatorApproverRequirements, setInitiatorApproverRequirements] = useState90([]);
44167
+ const [initiatorApproverOpen, setInitiatorApproverOpen] = useState91(false);
44168
+ const [initiatorApproverRequirements, setInitiatorApproverRequirements] = useState91([]);
43992
44169
  const { hasDraft, draftTimestamp, saveDraft, restoreDraft, clearDraft } = useDraftStorage({
43993
44170
  appType: config3.appType,
43994
44171
  formUuid: config3.formUuid
@@ -44000,20 +44177,20 @@ var InnerFormContent = ({
44000
44177
  mode: submitSuccessMode === "continue" ? "stay" : submitSuccessMode,
44001
44178
  basePath: config3.navigation?.basePath
44002
44179
  });
44003
- useEffect92(() => {
44180
+ useEffect94(() => {
44004
44181
  return () => {
44005
44182
  submissionDepartmentResolverRef.current?.(null);
44006
44183
  submissionDepartmentResolverRef.current = null;
44007
44184
  };
44008
44185
  }, []);
44009
- const closeSubmissionDepartmentModal = useCallback34((value = null) => {
44186
+ const closeSubmissionDepartmentModal = useCallback35((value = null) => {
44010
44187
  setSubmissionDepartmentModalOpen(false);
44011
44188
  setSubmissionDepartmentOptions([]);
44012
44189
  setSelectedSubmissionDepartmentId(void 0);
44013
44190
  submissionDepartmentResolverRef.current?.(value);
44014
44191
  submissionDepartmentResolverRef.current = null;
44015
44192
  }, []);
44016
- const promptSubmissionDepartmentSelection = useCallback34(
44193
+ const promptSubmissionDepartmentSelection = useCallback35(
44017
44194
  (options, preferredDepartmentId) => {
44018
44195
  return new Promise((resolve) => {
44019
44196
  const selected = options.some((option) => option.value === preferredDepartmentId) ? preferredDepartmentId : options[0]?.value;
@@ -44025,7 +44202,7 @@ var InnerFormContent = ({
44025
44202
  },
44026
44203
  []
44027
44204
  );
44028
- const resolveSubmissionDepartmentId = useCallback34(async () => {
44205
+ const resolveSubmissionDepartmentId = useCallback35(async () => {
44029
44206
  if (formType !== "process") {
44030
44207
  return void 0;
44031
44208
  }
@@ -44047,7 +44224,7 @@ var InnerFormContent = ({
44047
44224
  }
44048
44225
  return promptSubmissionDepartmentSelection(departments, departmentId);
44049
44226
  }, [api, config3.formUuid, departmentId, formType, promptSubmissionDepartmentSelection, schema]);
44050
- const performSubmit = useCallback34(
44227
+ const performSubmit = useCallback35(
44051
44228
  async (formData, submissionDepartmentId, initiatorSelectedApprovers) => {
44052
44229
  const submitData = normalizeFormDataForSubmit(schema, formData);
44053
44230
  setSubmitting(true);
@@ -44104,7 +44281,7 @@ var InnerFormContent = ({
44104
44281
  departmentId
44105
44282
  ]
44106
44283
  );
44107
- const continuePreparedSubmit = useCallback34(
44284
+ const continuePreparedSubmit = useCallback35(
44108
44285
  async (submitData, submissionDepartmentId, initiatorSelectedApprovers) => {
44109
44286
  if (formType === "process" && enableProcessPreview) {
44110
44287
  setPendingFormData(submitData);
@@ -44136,7 +44313,7 @@ var InnerFormContent = ({
44136
44313
  },
44137
44314
  [api.request, config3.appType, config3.formUuid, enableProcessPreview, formType, performSubmit]
44138
44315
  );
44139
- const prepareSubmit = useCallback34(async () => {
44316
+ const prepareSubmit = useCallback35(async () => {
44140
44317
  const valid = await validateAndNotify(validateAllWithErrors);
44141
44318
  if (!valid) return;
44142
44319
  const formData = getFormData2();
@@ -44192,7 +44369,7 @@ var InnerFormContent = ({
44192
44369
  resolveSubmissionDepartmentId,
44193
44370
  continuePreparedSubmit
44194
44371
  ]);
44195
- const handlePreviewConfirm = useCallback34(async () => {
44372
+ const handlePreviewConfirm = useCallback35(async () => {
44196
44373
  const data = pendingFormData ?? getFormData2();
44197
44374
  const submissionDepartmentId = pendingSubmissionDepartmentIdRef.current ?? pendingSubmissionDepartmentId;
44198
44375
  const initiatorSelectedApprovers = pendingInitiatorSelectedApproversRef.current ?? pendingInitiatorSelectedApprovers;
@@ -44210,7 +44387,7 @@ var InnerFormContent = ({
44210
44387
  pendingSubmissionDepartmentId,
44211
44388
  performSubmit
44212
44389
  ]);
44213
- const handleInitiatorApproverConfirm = useCallback34(
44390
+ const handleInitiatorApproverConfirm = useCallback35(
44214
44391
  async (selectedUsersByNode) => {
44215
44392
  const data = pendingFormData;
44216
44393
  if (!data) {
@@ -44226,7 +44403,7 @@ var InnerFormContent = ({
44226
44403
  },
44227
44404
  [continuePreparedSubmit, pendingFormData, pendingSubmissionDepartmentId]
44228
44405
  );
44229
- const handleInitiatorApproverCancel = useCallback34(() => {
44406
+ const handleInitiatorApproverCancel = useCallback35(() => {
44230
44407
  setInitiatorApproverOpen(false);
44231
44408
  setInitiatorApproverRequirements([]);
44232
44409
  setPendingFormData(null);
@@ -44235,23 +44412,23 @@ var InnerFormContent = ({
44235
44412
  pendingSubmissionDepartmentIdRef.current = void 0;
44236
44413
  pendingInitiatorSelectedApproversRef.current = void 0;
44237
44414
  }, []);
44238
- const handleSaveDraft = useCallback34(() => {
44415
+ const handleSaveDraft = useCallback35(() => {
44239
44416
  const data = getFormData2();
44240
44417
  saveDraft(data);
44241
44418
  }, [getFormData2, saveDraft]);
44242
- const handleRestoreDraft = useCallback34(() => {
44419
+ const handleRestoreDraft = useCallback35(() => {
44243
44420
  const data = restoreDraft();
44244
44421
  if (!data) return;
44245
44422
  Object.entries(data).forEach(([fieldId, value]) => {
44246
44423
  setFieldValue(fieldId, value);
44247
44424
  });
44248
44425
  }, [restoreDraft, setFieldValue]);
44249
- const handleContinue = useCallback34(() => {
44426
+ const handleContinue = useCallback35(() => {
44250
44427
  setSubmitted(false);
44251
44428
  setSuccessInfo(null);
44252
44429
  resetForm();
44253
44430
  }, [resetForm]);
44254
- const handleViewDetail = useCallback34(() => {
44431
+ const handleViewDetail = useCallback35(() => {
44255
44432
  if (!successInfo) return;
44256
44433
  if (formType === "process") {
44257
44434
  navigateToProcessDetail(successInfo.formInstanceId);
@@ -44472,7 +44649,7 @@ var FormSubmitTemplate = ({
44472
44649
  };
44473
44650
 
44474
44651
  // packages/sdk/src/components/templates/ProcessDetailTemplate.tsx
44475
- import { useCallback as useCallback35, useMemo as useMemo59, useRef as useRef95, useState as useState91 } from "react";
44652
+ import { useCallback as useCallback36, useMemo as useMemo61, useRef as useRef96, useState as useState92 } from "react";
44476
44653
  import dayjs19 from "dayjs";
44477
44654
  import { Form as AntForm, Input as Input12, Modal as Modal12, message as message4 } from "antd";
44478
44655
  import { jsx as jsx99, jsxs as jsxs54 } from "react/jsx-runtime";
@@ -44565,17 +44742,17 @@ var InnerProcessContent = ({
44565
44742
  onDelete,
44566
44743
  inDrawer = false
44567
44744
  }) => {
44568
- const formDataRef = useRef95(void 0);
44569
- const validateRef = useRef95(void 0);
44745
+ const formDataRef = useRef96(void 0);
44746
+ const validateRef = useRef96(void 0);
44570
44747
  const [withdrawForm] = AntForm.useForm();
44571
- const [withdrawOpen, setWithdrawOpen] = useState91(false);
44572
- const [withdrawLoading, setWithdrawLoading] = useState91(false);
44573
- const [saveLoading, setSaveLoading] = useState91(false);
44574
- const [deleteLoading, setDeleteLoading] = useState91(false);
44575
- const [initiatorApproverOpen, setInitiatorApproverOpen] = useState91(false);
44576
- const [initiatorApproverRequirements, setInitiatorApproverRequirements] = useState91([]);
44577
- const [pendingResubmitComments, setPendingResubmitComments] = useState91();
44578
- const fieldIds = useMemo59(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
44748
+ const [withdrawOpen, setWithdrawOpen] = useState92(false);
44749
+ const [withdrawLoading, setWithdrawLoading] = useState92(false);
44750
+ const [saveLoading, setSaveLoading] = useState92(false);
44751
+ const [deleteLoading, setDeleteLoading] = useState92(false);
44752
+ const [initiatorApproverOpen, setInitiatorApproverOpen] = useState92(false);
44753
+ const [initiatorApproverRequirements, setInitiatorApproverRequirements] = useState92([]);
44754
+ const [pendingResubmitComments, setPendingResubmitComments] = useState92();
44755
+ const fieldIds = useMemo61(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
44579
44756
  const { api } = useFormContext();
44580
44757
  const {
44581
44758
  loading,
@@ -44643,45 +44820,45 @@ var InnerProcessContent = ({
44643
44820
  formInstanceId,
44644
44821
  autoLoad: enableChangeRecords && canViewChangeRecords
44645
44822
  });
44646
- const validateForm = useCallback35(async () => {
44823
+ const validateForm = useCallback36(async () => {
44647
44824
  return validateRef.current ? validateAndNotify(validateRef.current) : true;
44648
44825
  }, []);
44649
- const handleApprove = useCallback35(
44826
+ const handleApprove = useCallback36(
44650
44827
  async (comments) => {
44651
44828
  if (!await validateForm()) return;
44652
44829
  await approve(comments);
44653
44830
  },
44654
44831
  [approve, validateForm]
44655
44832
  );
44656
- const handleReject = useCallback35(
44833
+ const handleReject = useCallback36(
44657
44834
  async (comments) => {
44658
44835
  await reject(comments);
44659
44836
  },
44660
44837
  [reject]
44661
44838
  );
44662
- const handleTransfer = useCallback35(
44839
+ const handleTransfer = useCallback36(
44663
44840
  async (userId, reason) => {
44664
44841
  await transfer(userId, reason);
44665
44842
  },
44666
44843
  [transfer]
44667
44844
  );
44668
- const handleReturn = useCallback35(
44845
+ const handleReturn = useCallback36(
44669
44846
  async (nodeId, reason) => {
44670
44847
  await returnTo(nodeId, reason);
44671
44848
  },
44672
44849
  [returnTo]
44673
44850
  );
44674
- const handleWithdraw = useCallback35(
44851
+ const handleWithdraw = useCallback36(
44675
44852
  async (reason) => {
44676
44853
  await withdraw(reason);
44677
44854
  },
44678
44855
  [withdraw]
44679
44856
  );
44680
- const handleSave = useCallback35(async () => {
44857
+ const handleSave = useCallback36(async () => {
44681
44858
  if (!await validateForm()) return;
44682
44859
  await save();
44683
44860
  }, [save, validateForm]);
44684
- const handleResubmit = useCallback35(
44861
+ const handleResubmit = useCallback36(
44685
44862
  async (comments) => {
44686
44863
  if (!await validateForm()) return;
44687
44864
  const values = formDataRef.current?.() ?? formData ?? {};
@@ -44715,7 +44892,7 @@ var InnerProcessContent = ({
44715
44892
  },
44716
44893
  [api.request, appType, currentTaskId, formData, formUuid, resubmit, validateForm]
44717
44894
  );
44718
- const handleInitiatorApproverConfirm = useCallback35(
44895
+ const handleInitiatorApproverConfirm = useCallback36(
44719
44896
  async (selectedUsersByNode) => {
44720
44897
  const selectedApprovers = normalizeSelectedApprovers2(selectedUsersByNode);
44721
44898
  setInitiatorApproverOpen(false);
@@ -44726,15 +44903,15 @@ var InnerProcessContent = ({
44726
44903
  },
44727
44904
  [pendingResubmitComments, resubmit]
44728
44905
  );
44729
- const handleInitiatorApproverCancel = useCallback35(() => {
44906
+ const handleInitiatorApproverCancel = useCallback36(() => {
44730
44907
  setInitiatorApproverOpen(false);
44731
44908
  setInitiatorApproverRequirements([]);
44732
44909
  setPendingResubmitComments(void 0);
44733
44910
  }, []);
44734
- const handleCallback = useCallback35(async () => {
44911
+ const handleCallback = useCallback36(async () => {
44735
44912
  await callbackTask();
44736
44913
  }, [callbackTask]);
44737
- const handleCompletedSave = useCallback35(async () => {
44914
+ const handleCompletedSave = useCallback36(async () => {
44738
44915
  if (!await validateForm()) return;
44739
44916
  const values = formDataRef.current?.() ?? formData;
44740
44917
  if (!values) return;
@@ -44748,7 +44925,7 @@ var InnerProcessContent = ({
44748
44925
  setSaveLoading(false);
44749
44926
  }
44750
44927
  }, [formData, onSave, saveChanges, validateForm]);
44751
- const handleCompletedDelete = useCallback35(async () => {
44928
+ const handleCompletedDelete = useCallback36(async () => {
44752
44929
  setDeleteLoading(true);
44753
44930
  try {
44754
44931
  const success = await deleteInstance();
@@ -44759,7 +44936,7 @@ var InnerProcessContent = ({
44759
44936
  setDeleteLoading(false);
44760
44937
  }
44761
44938
  }, [deleteInstance, onDelete]);
44762
- const handleFooterWithdraw = useCallback35(async () => {
44939
+ const handleFooterWithdraw = useCallback36(async () => {
44763
44940
  const values = await withdrawForm.validateFields();
44764
44941
  setWithdrawLoading(true);
44765
44942
  try {
@@ -44770,11 +44947,11 @@ var InnerProcessContent = ({
44770
44947
  setWithdrawLoading(false);
44771
44948
  }
44772
44949
  }, [handleWithdraw, withdrawForm]);
44773
- const handleFooterWithdrawCancel = useCallback35(() => {
44950
+ const handleFooterWithdrawCancel = useCallback36(() => {
44774
44951
  setWithdrawOpen(false);
44775
44952
  withdrawForm.resetFields();
44776
44953
  }, [withdrawForm]);
44777
- const bottomActions = useMemo59(() => {
44954
+ const bottomActions = useMemo61(() => {
44778
44955
  if (isApprover && !isOriginatorReturn && activeActions.length > 0) return [];
44779
44956
  if (isProcessCompleted) {
44780
44957
  if (mode === "readonly") {
@@ -45121,7 +45298,7 @@ var StandardFormPage = ({
45121
45298
  const formType = normalizeStandardFormType(
45122
45299
  schema.template?.formType || (resolvedMode === "process" ? "process" : "form")
45123
45300
  );
45124
- const submitApi = useMemo60(() => {
45301
+ const submitApi = useMemo62(() => {
45125
45302
  if (!onSubmit) return void 0;
45126
45303
  return {
45127
45304
  submitFormData: async (payload) => onSubmit(
@@ -45134,7 +45311,7 @@ var StandardFormPage = ({
45134
45311
  }
45135
45312
  };
45136
45313
  }, [formType, onSubmit]);
45137
- const api = useMemo60(() => {
45314
+ const api = useMemo62(() => {
45138
45315
  if (!externalApi && !submitApi) return void 0;
45139
45316
  return {
45140
45317
  ...externalApi ?? {},
@@ -45723,10 +45900,10 @@ function AsyncEntityFilterSelect({
45723
45900
  value,
45724
45901
  onChange
45725
45902
  }) {
45726
- const [options, setOptions] = useState92([]);
45727
- const [fetching, setFetching] = useState92(false);
45903
+ const [options, setOptions] = useState93([]);
45904
+ const [fetching, setFetching] = useState93(false);
45728
45905
  const multiple = normalizeOperator(operator) === "IN";
45729
- const loadOptions = useCallback36(
45906
+ const loadOptions = useCallback37(
45730
45907
  async (keyword = "") => {
45731
45908
  setFetching(true);
45732
45909
  try {
@@ -45768,7 +45945,7 @@ function AsyncEntityFilterSelect({
45768
45945
  },
45769
45946
  [api, entityType]
45770
45947
  );
45771
- useEffect93(() => {
45948
+ useEffect95(() => {
45772
45949
  void loadOptions();
45773
45950
  }, [loadOptions]);
45774
45951
  return /* @__PURE__ */ jsx101(
@@ -46077,7 +46254,7 @@ function ResizableColumnTitle({
46077
46254
  onResize: onResize2,
46078
46255
  onResizeEnd
46079
46256
  }) {
46080
- const dragRef = useRef96({ startX: 0, startWidth: width, latestWidth: width });
46257
+ const dragRef = useRef97({ startX: 0, startWidth: width, latestWidth: width });
46081
46258
  const handleMouseDown = (event) => {
46082
46259
  event.preventDefault();
46083
46260
  event.stopPropagation();
@@ -46142,86 +46319,86 @@ var DataManagementList = ({
46142
46319
  rowActions = [],
46143
46320
  maxVisibleRowActions
46144
46321
  }) => {
46145
- const rootRef = useRef96(null);
46146
- const api = useMemo61(() => {
46322
+ const rootRef = useRef97(null);
46323
+ const api = useMemo63(() => {
46147
46324
  if (typeof requestOverride === "function") {
46148
46325
  return createFormRuntimeApi({ request: requestOverride });
46149
46326
  }
46150
46327
  return createFormRuntimeApi(requestOverride);
46151
46328
  }, [requestOverride]);
46152
- const [fields, setFields] = useState92([]);
46153
- const [runtimeFormSchema, setRuntimeFormSchema] = useState92(null);
46154
- const [config3, setConfig] = useState92({});
46155
- const [formType, setFormType] = useState92("form");
46156
- const [showFields, setShowFields] = useState92([]);
46157
- const [lockFieldIds, setLockFieldIds] = useState92([]);
46158
- const [widths, setWidths] = useState92({});
46159
- const widthsRef = useRef96({});
46160
- const [sort, setSort] = useState92([]);
46161
- const [density, setDensity] = useState92("middle");
46162
- const [detailOpenMode, setDetailOpenMode] = useState92("drawer");
46163
- const [searchKeyWord, setSearchKeyWord] = useState92("");
46164
- const [filterGroup, setFilterGroup] = useState92(createGroup);
46165
- const [dataSource, setDataSource] = useState92([]);
46166
- const [total, setTotal] = useState92(0);
46167
- const [current, setCurrent] = useState92(1);
46168
- const [pageSize, setPageSize] = useState92(10);
46169
- const [loading, setLoading] = useState92(false);
46170
- const [schemaLoading, setSchemaLoading] = useState92(true);
46171
- const [selectedRowKeys, setSelectedRowKeys] = useState92([]);
46172
- const [filterOpen, setFilterOpen] = useState92(false);
46173
- const [columnOpen, setColumnOpen] = useState92(false);
46174
- const [exportOpen, setExportOpen] = useState92(false);
46175
- const [exportScope, setExportScope] = useState92("all");
46176
- const [exportFields, setExportFields] = useState92([]);
46177
- const [exporting, setExporting] = useState92(false);
46178
- const [importOpen, setImportOpen] = useState92(false);
46179
- const [importPreview, setImportPreview] = useState92([]);
46180
- const [importBase64, setImportBase64] = useState92("");
46181
- const [templateDownloading, setTemplateDownloading] = useState92(false);
46182
- const [recordsOpen, setRecordsOpen] = useState92(false);
46183
- const [recordTab, setRecordTab] = useState92("export");
46184
- const [transferRecords, setTransferRecords] = useState92([]);
46185
- const [batchApprovalOpen, setBatchApprovalOpen] = useState92(false);
46186
- const [batchApprovalAction, setBatchApprovalAction] = useState92(
46329
+ const [fields, setFields] = useState93([]);
46330
+ const [runtimeFormSchema, setRuntimeFormSchema] = useState93(null);
46331
+ const [config3, setConfig] = useState93({});
46332
+ const [formType, setFormType] = useState93("form");
46333
+ const [showFields, setShowFields] = useState93([]);
46334
+ const [lockFieldIds, setLockFieldIds] = useState93([]);
46335
+ const [widths, setWidths] = useState93({});
46336
+ const widthsRef = useRef97({});
46337
+ const [sort, setSort] = useState93([]);
46338
+ const [density, setDensity] = useState93("middle");
46339
+ const [detailOpenMode, setDetailOpenMode] = useState93("drawer");
46340
+ const [searchKeyWord, setSearchKeyWord] = useState93("");
46341
+ const [filterGroup, setFilterGroup] = useState93(createGroup);
46342
+ const [dataSource, setDataSource] = useState93([]);
46343
+ const [total, setTotal] = useState93(0);
46344
+ const [current, setCurrent] = useState93(1);
46345
+ const [pageSize, setPageSize] = useState93(10);
46346
+ const [loading, setLoading] = useState93(false);
46347
+ const [schemaLoading, setSchemaLoading] = useState93(true);
46348
+ const [selectedRowKeys, setSelectedRowKeys] = useState93([]);
46349
+ const [filterOpen, setFilterOpen] = useState93(false);
46350
+ const [columnOpen, setColumnOpen] = useState93(false);
46351
+ const [exportOpen, setExportOpen] = useState93(false);
46352
+ const [exportScope, setExportScope] = useState93("all");
46353
+ const [exportFields, setExportFields] = useState93([]);
46354
+ const [exporting, setExporting] = useState93(false);
46355
+ const [importOpen, setImportOpen] = useState93(false);
46356
+ const [importPreview, setImportPreview] = useState93([]);
46357
+ const [importBase64, setImportBase64] = useState93("");
46358
+ const [templateDownloading, setTemplateDownloading] = useState93(false);
46359
+ const [recordsOpen, setRecordsOpen] = useState93(false);
46360
+ const [recordTab, setRecordTab] = useState93("export");
46361
+ const [transferRecords, setTransferRecords] = useState93([]);
46362
+ const [batchApprovalOpen, setBatchApprovalOpen] = useState93(false);
46363
+ const [batchApprovalAction, setBatchApprovalAction] = useState93(
46187
46364
  "approved"
46188
46365
  );
46189
- const [batchApprovalComments, setBatchApprovalComments] = useState92("");
46190
- const [batchApproving, setBatchApproving] = useState92(false);
46191
- const [activeRecord, setActiveRecord] = useState92(null);
46192
- const [detailOpen, setDetailOpen] = useState92(false);
46193
- const [submitOpen, setSubmitOpen] = useState92(false);
46194
- const fetchStateRef = useRef96({});
46366
+ const [batchApprovalComments, setBatchApprovalComments] = useState93("");
46367
+ const [batchApproving, setBatchApproving] = useState93(false);
46368
+ const [activeRecord, setActiveRecord] = useState93(null);
46369
+ const [detailOpen, setDetailOpen] = useState93(false);
46370
+ const [submitOpen, setSubmitOpen] = useState93(false);
46371
+ const fetchStateRef = useRef97({});
46195
46372
  const isProcessForm = isProcessFormType(formType);
46196
46373
  const request = api.request;
46197
- const getPopupContainer = useCallback36(
46374
+ const getPopupContainer = useCallback37(
46198
46375
  (triggerNode) => resolveDataManagementPopupContainer(rootRef.current, triggerNode),
46199
46376
  []
46200
46377
  );
46201
- const getOverlayContainer = useCallback36(
46378
+ const getOverlayContainer = useCallback37(
46202
46379
  () => resolveDataManagementPortalContainer(rootRef.current),
46203
46380
  []
46204
46381
  );
46205
46382
  const drawerWidth = "min(960px, calc(100vw - 48px))";
46206
- const confirmDanger = useCallback36((title2, content, onOk) => {
46383
+ const confirmDanger = useCallback37((title2, content, onOk) => {
46207
46384
  if (confirmAction(title2, content)) onOk();
46208
46385
  }, []);
46209
- const visibleFields = useMemo61(
46386
+ const visibleFields = useMemo63(
46210
46387
  () => showFields.map((fieldId) => fields.find((field) => field.fieldId === fieldId)).filter(Boolean),
46211
46388
  [fields, showFields]
46212
46389
  );
46213
- const forcedShowFieldIds = useMemo61(
46390
+ const forcedShowFieldIds = useMemo63(
46214
46391
  () => new Set(forcedConfig?.showFields || []),
46215
46392
  [forcedConfig?.showFields]
46216
46393
  );
46217
- const forcedLockFieldIds = useMemo61(
46394
+ const forcedLockFieldIds = useMemo63(
46218
46395
  () => new Set(forcedConfig?.lockFieldIds || []),
46219
46396
  [forcedConfig?.lockFieldIds]
46220
46397
  );
46221
- useEffect93(() => {
46398
+ useEffect95(() => {
46222
46399
  widthsRef.current = widths;
46223
46400
  }, [widths]);
46224
- useEffect93(() => {
46401
+ useEffect95(() => {
46225
46402
  fetchStateRef.current = {
46226
46403
  current,
46227
46404
  pageSize,
@@ -46230,7 +46407,7 @@ var DataManagementList = ({
46230
46407
  sort
46231
46408
  };
46232
46409
  }, [current, filterGroup, pageSize, searchKeyWord, sort]);
46233
- const loadData = useCallback36(
46410
+ const loadData = useCallback37(
46234
46411
  async (overrides = {}) => {
46235
46412
  if (!appType || !formUuid) return;
46236
46413
  const fetchState = { ...fetchStateRef.current, ...overrides };
@@ -46274,7 +46451,7 @@ var DataManagementList = ({
46274
46451
  },
46275
46452
  [appType, forcedConfig, formUuid, request]
46276
46453
  );
46277
- useEffect93(() => {
46454
+ useEffect95(() => {
46278
46455
  let mounted = true;
46279
46456
  const loadSchemaAndConfig = async () => {
46280
46457
  if (!appType || !formUuid) return;
@@ -46356,7 +46533,7 @@ var DataManagementList = ({
46356
46533
  request,
46357
46534
  title
46358
46535
  ]);
46359
- const persistConfig = useCallback36(
46536
+ const persistConfig = useCallback37(
46360
46537
  async (patch) => {
46361
46538
  const personalPatch = stripForcedConfigPatch(patch, forcedConfig);
46362
46539
  const nextConfig = { ...config3, ...personalPatch };
@@ -46400,12 +46577,12 @@ var DataManagementList = ({
46400
46577
  const handleRemoveSort = (index2) => {
46401
46578
  setSort((prev) => prev.filter((_, itemIndex) => itemIndex !== index2));
46402
46579
  };
46403
- const updateColumnWidth = useCallback36((fieldId, width) => {
46580
+ const updateColumnWidth = useCallback37((fieldId, width) => {
46404
46581
  const nextWidth = Math.round(Math.max(96, Math.min(520, width)));
46405
46582
  widthsRef.current = { ...widthsRef.current, [fieldId]: nextWidth };
46406
46583
  setWidths(widthsRef.current);
46407
46584
  }, []);
46408
- const commitColumnWidth = useCallback36(
46585
+ const commitColumnWidth = useCallback37(
46409
46586
  (fieldId, width) => {
46410
46587
  const nextWidth = Math.round(Math.max(96, Math.min(520, width)));
46411
46588
  const nextWidths = { ...widthsRef.current, [fieldId]: nextWidth };
@@ -46415,7 +46592,7 @@ var DataManagementList = ({
46415
46592
  },
46416
46593
  [persistConfig]
46417
46594
  );
46418
- const handleDetail = useCallback36(
46595
+ const handleDetail = useCallback37(
46419
46596
  (record2) => {
46420
46597
  const formInstanceId = getRecordId(record2);
46421
46598
  if (!formInstanceId) {
@@ -46440,7 +46617,7 @@ var DataManagementList = ({
46440
46617
  },
46441
46618
  [appType, detailBasePath, detailOpenMode, detailPageUrlBuilder, formType, formUuid]
46442
46619
  );
46443
- const handleDelete = useCallback36(
46620
+ const handleDelete = useCallback37(
46444
46621
  async (ids) => {
46445
46622
  if (ids.length === 0) return;
46446
46623
  await deleteDataManagementRows(request, { appType, formUuid, formInstanceIds: ids });
@@ -46449,7 +46626,7 @@ var DataManagementList = ({
46449
46626
  },
46450
46627
  [appType, current, formUuid, loadData, pageSize, request]
46451
46628
  );
46452
- const getSelectedRecordIds = useCallback36(
46629
+ const getSelectedRecordIds = useCallback37(
46453
46630
  () => selectedRowKeys.map((key) => {
46454
46631
  const record2 = dataSource.find((item) => String(getRecordId(item)) === String(key));
46455
46632
  return String(getSelectedRecordId(record2, key));
@@ -46576,7 +46753,7 @@ var DataManagementList = ({
46576
46753
  ACTION_COLUMN_MIN_WIDTH,
46577
46754
  Math.min(rowActionCount, visibleRowActionLimit) * ACTION_BUTTON_ESTIMATED_WIDTH + (rowActionCount > visibleRowActionLimit ? ACTION_MORE_BUTTON_WIDTH : 0) + ACTION_COLUMN_HORIZONTAL_PADDING
46578
46755
  );
46579
- const columns = useMemo61(() => {
46756
+ const columns = useMemo63(() => {
46580
46757
  const baseColumns = visibleFields.map((field) => {
46581
46758
  const columnWidth = widths[field.fieldId] || field.width || 160;
46582
46759
  return {
@@ -46706,7 +46883,7 @@ var DataManagementList = ({
46706
46883
  actionColumnWidth
46707
46884
  )
46708
46885
  );
46709
- const importPreviewColumns = useMemo61(() => {
46886
+ const importPreviewColumns = useMemo63(() => {
46710
46887
  const keys2 = Array.from(
46711
46888
  new Set(importPreview.flatMap((record2) => Object.keys(record2 || {})))
46712
46889
  ).slice(0, 16);
@@ -47272,7 +47449,7 @@ var DataManagementList = ({
47272
47449
  };
47273
47450
 
47274
47451
  // packages/sdk/src/components/templates/LowcodePageRenderer.tsx
47275
- import React253, { useMemo as useMemo62 } from "react";
47452
+ import React254, { useMemo as useMemo64 } from "react";
47276
47453
  import { jsx as jsx102, jsxs as jsxs56 } from "react/jsx-runtime";
47277
47454
  function nodeChildren(node) {
47278
47455
  if (Array.isArray(node.children)) return node.children;
@@ -47302,7 +47479,7 @@ function createRuntimeRequest(context) {
47302
47479
  }
47303
47480
  function LowcodePageRenderer({ schema, context }) {
47304
47481
  const appType = context?.appType || schema.pageMeta.appType;
47305
- const requestOverride = useMemo62(() => createRuntimeRequest(context), [context]);
47482
+ const requestOverride = useMemo64(() => createRuntimeRequest(context), [context]);
47306
47483
  const renderNode = (node) => {
47307
47484
  const props = node.props || {};
47308
47485
  const children = nodeChildren(node);
@@ -47327,7 +47504,7 @@ function LowcodePageRenderer({ schema, context }) {
47327
47504
  if (node.type === "HeadingBlock") {
47328
47505
  const level = Math.min(Math.max(Number(props.level || 2), 1), 4);
47329
47506
  const tagName = `h${level}`;
47330
- return React253.createElement(
47507
+ return React254.createElement(
47331
47508
  tagName,
47332
47509
  { key: node.id, className: "sy-page-heading" },
47333
47510
  props.text || props.title || "\u6807\u9898"