openxiangda 1.0.129 → 1.0.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/cli.js +68 -8
- package/openxiangda-skills/references/pages/page-sdk.md +4 -0
- package/openxiangda-skills/skills/openxiangda-permission-settings/SKILL.md +6 -0
- package/openxiangda-skills/skills/openxiangda-workflow-automation/SKILL.md +1 -1
- package/package.json +2 -1
- package/packages/sdk/dist/components/index.cjs +168 -17
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.mjs +301 -150
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/index.cjs +168 -17
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.mjs +285 -134
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// packages/sdk/src/components/core/FormProvider.tsx
|
|
2
|
-
import React45, { useCallback as
|
|
2
|
+
import React45, { useCallback as useCallback8, useEffect as useEffect32, useRef as useRef8, useState as useState18, useMemo as useMemo18 } from "react";
|
|
3
3
|
|
|
4
4
|
// packages/sdk/src/components/core/FormContext.ts
|
|
5
5
|
import { createContext, useContext } from "react";
|
|
@@ -6874,7 +6874,7 @@ function CascadeSelectField(props) {
|
|
|
6874
6874
|
}
|
|
6875
6875
|
|
|
6876
6876
|
// packages/sdk/src/components/fields/AddressField/index.tsx
|
|
6877
|
-
import { useEffect as useEffect25, useMemo as useMemo15, useState as useState13 } from "react";
|
|
6877
|
+
import { useCallback as useCallback4, useEffect as useEffect25, useMemo as useMemo15, useState as useState13 } from "react";
|
|
6878
6878
|
import { Button as Button3, Cascader as Cascader2, Input as Input7, Space as Space3, Spin as Spin3 } from "antd";
|
|
6879
6879
|
import * as MobileAntd5 from "antd-mobile";
|
|
6880
6880
|
import { jsx as jsx67, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
@@ -6894,7 +6894,42 @@ var modeDepth = (mode) => {
|
|
|
6894
6894
|
return 3;
|
|
6895
6895
|
};
|
|
6896
6896
|
var activeLevels = (mode) => LEVELS.slice(0, modeDepth(mode));
|
|
6897
|
-
var
|
|
6897
|
+
var stringifyValue = (value) => {
|
|
6898
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
6899
|
+
return String(value);
|
|
6900
|
+
};
|
|
6901
|
+
var normalizeAddressPart = (part) => {
|
|
6902
|
+
if (part === void 0 || part === null || part === "") return void 0;
|
|
6903
|
+
if (typeof part === "object") {
|
|
6904
|
+
const value2 = stringifyValue(part.value ?? part.adcode ?? part.code ?? part.id ?? part.label);
|
|
6905
|
+
if (!value2) return void 0;
|
|
6906
|
+
const label = stringifyValue(part.label ?? part.name ?? part.title) ?? "";
|
|
6907
|
+
return { label, value: value2 };
|
|
6908
|
+
}
|
|
6909
|
+
const value = stringifyValue(part);
|
|
6910
|
+
return value ? { label: "", value } : void 0;
|
|
6911
|
+
};
|
|
6912
|
+
var normalizeAddressValue = (raw) => {
|
|
6913
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
6914
|
+
const next = {};
|
|
6915
|
+
LEVELS.forEach((level) => {
|
|
6916
|
+
const part = normalizeAddressPart(raw[level]);
|
|
6917
|
+
if (part) next[level] = part;
|
|
6918
|
+
});
|
|
6919
|
+
if (raw.detail !== void 0 && raw.detail !== null) {
|
|
6920
|
+
next.detail = String(raw.detail);
|
|
6921
|
+
}
|
|
6922
|
+
if (typeof raw.fullAddress === "string" && raw.fullAddress) {
|
|
6923
|
+
next.fullAddress = raw.fullAddress;
|
|
6924
|
+
}
|
|
6925
|
+
return Object.keys(next).length > 0 ? next : void 0;
|
|
6926
|
+
};
|
|
6927
|
+
var getDisplayLabel = (part) => {
|
|
6928
|
+
const label = part?.label?.trim();
|
|
6929
|
+
if (!label) return void 0;
|
|
6930
|
+
return label === part?.value ? void 0 : label;
|
|
6931
|
+
};
|
|
6932
|
+
var valueToPath = (value, levels) => levels.map((level) => value?.[level]?.value).filter(Boolean);
|
|
6898
6933
|
var normalizeDivision = (item, level, depth, index) => ({
|
|
6899
6934
|
label: String(item.name || item.label || item.adcode || item.value),
|
|
6900
6935
|
value: String(item.adcode || item.value || item.id),
|
|
@@ -6903,7 +6938,66 @@ var normalizeDivision = (item, level, depth, index) => ({
|
|
|
6903
6938
|
});
|
|
6904
6939
|
var composeFullAddress = (value, levels = LEVELS) => {
|
|
6905
6940
|
if (!value) return "";
|
|
6906
|
-
return [...levels.map((level) => value[level]
|
|
6941
|
+
return [...levels.map((level) => getDisplayLabel(value[level])), value.detail].filter(Boolean).join("");
|
|
6942
|
+
};
|
|
6943
|
+
var mergeValuePathIntoOptions = (source, value, levels, depth) => {
|
|
6944
|
+
if (!value) return source;
|
|
6945
|
+
const mergeAt = (items, index) => {
|
|
6946
|
+
const level = levels[index];
|
|
6947
|
+
const part = level ? value[level] : void 0;
|
|
6948
|
+
if (!level || !part?.value) return items;
|
|
6949
|
+
let matched = false;
|
|
6950
|
+
const nextItems = items.map((item) => {
|
|
6951
|
+
if (String(item.value) !== part.value) return item;
|
|
6952
|
+
matched = true;
|
|
6953
|
+
const label = getDisplayLabel(part) ?? getDisplayLabel(item) ?? "\u5730\u5740\u52A0\u8F7D\u4E2D";
|
|
6954
|
+
const hasNextPath = Boolean(levels[index + 1] && value[levels[index + 1]]?.value);
|
|
6955
|
+
return {
|
|
6956
|
+
...item,
|
|
6957
|
+
label,
|
|
6958
|
+
level: item.level ?? level,
|
|
6959
|
+
isLeaf: index + 1 >= depth || !hasNextPath && item.isLeaf === true,
|
|
6960
|
+
children: hasNextPath ? mergeAt(item.children ?? [], index + 1) : item.children
|
|
6961
|
+
};
|
|
6962
|
+
});
|
|
6963
|
+
if (!matched) {
|
|
6964
|
+
const hasNextPath = Boolean(levels[index + 1] && value[levels[index + 1]]?.value);
|
|
6965
|
+
const option = {
|
|
6966
|
+
label: getDisplayLabel(part) ?? "\u5730\u5740\u52A0\u8F7D\u4E2D",
|
|
6967
|
+
value: part.value,
|
|
6968
|
+
level,
|
|
6969
|
+
isLeaf: index + 1 >= depth
|
|
6970
|
+
};
|
|
6971
|
+
if (hasNextPath) option.children = mergeAt([], index + 1);
|
|
6972
|
+
nextItems.push(option);
|
|
6973
|
+
}
|
|
6974
|
+
return nextItems;
|
|
6975
|
+
};
|
|
6976
|
+
return mergeAt(source, 0);
|
|
6977
|
+
};
|
|
6978
|
+
var setNestedChildren = (source, selectedOptions, children) => {
|
|
6979
|
+
const [current, ...rest] = selectedOptions;
|
|
6980
|
+
if (!current) return source;
|
|
6981
|
+
const currentValue = String(current.value);
|
|
6982
|
+
let matched = false;
|
|
6983
|
+
const next = source.map((item) => {
|
|
6984
|
+
if (String(item.value) !== currentValue) return item;
|
|
6985
|
+
matched = true;
|
|
6986
|
+
return {
|
|
6987
|
+
...item,
|
|
6988
|
+
children: rest.length ? setNestedChildren(item.children ?? [], rest, children) : children
|
|
6989
|
+
};
|
|
6990
|
+
});
|
|
6991
|
+
if (!matched) {
|
|
6992
|
+
next.push({
|
|
6993
|
+
label: String(current.label || current.value),
|
|
6994
|
+
value: currentValue,
|
|
6995
|
+
level: current.level,
|
|
6996
|
+
isLeaf: false,
|
|
6997
|
+
children: rest.length ? setNestedChildren([], rest, children) : children
|
|
6998
|
+
});
|
|
6999
|
+
}
|
|
7000
|
+
return next;
|
|
6907
7001
|
};
|
|
6908
7002
|
function AddressField(props) {
|
|
6909
7003
|
const {
|
|
@@ -6925,7 +7019,8 @@ function AddressField(props) {
|
|
|
6925
7019
|
const { formData, fieldBehaviors, setFieldValue, registerField, unregisterField, api } = useFormContext();
|
|
6926
7020
|
const { isMobile } = useDeviceDetect();
|
|
6927
7021
|
const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
|
|
6928
|
-
const
|
|
7022
|
+
const rawValue = formData[fieldId];
|
|
7023
|
+
const value = useMemo15(() => normalizeAddressValue(rawValue), [rawValue]);
|
|
6929
7024
|
const [options, setOptions] = useState13([]);
|
|
6930
7025
|
const [loadingRoots, setLoadingRoots] = useState13(false);
|
|
6931
7026
|
const [mobileOpen, setMobileOpen] = useState13(false);
|
|
@@ -6935,24 +7030,78 @@ function AddressField(props) {
|
|
|
6935
7030
|
const [tempValue, setTempValue] = useState13();
|
|
6936
7031
|
const depth = modeDepth(mode);
|
|
6937
7032
|
const levels = useMemo15(() => activeLevels(mode), [mode]);
|
|
7033
|
+
const valuePath = useMemo15(() => valueToPath(value, levels), [levels, value]);
|
|
7034
|
+
const displayOptions = useMemo15(
|
|
7035
|
+
() => mergeValuePathIntoOptions(options, value, levels, depth),
|
|
7036
|
+
[depth, levels, options, value]
|
|
7037
|
+
);
|
|
6938
7038
|
const detailEnabled = mode === "province-city-district-street-detail";
|
|
6939
7039
|
const disabled = behavior === "DISABLED";
|
|
6940
7040
|
const MobilePopup = getMobileComponent3("Popup");
|
|
6941
7041
|
useEffect25(() => {
|
|
6942
7042
|
registerField(fieldId);
|
|
6943
|
-
|
|
7043
|
+
return () => unregisterField(fieldId);
|
|
7044
|
+
}, [fieldId, registerField, unregisterField]);
|
|
7045
|
+
useEffect25(() => {
|
|
7046
|
+
if (defaultValue !== void 0 && rawValue === void 0) {
|
|
6944
7047
|
setFieldValue(fieldId, defaultValue);
|
|
6945
7048
|
}
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
7049
|
+
}, [defaultValue, fieldId, rawValue, setFieldValue]);
|
|
7050
|
+
const loadDivisions = useCallback4(
|
|
7051
|
+
async (parentAdcode, level, index) => {
|
|
7052
|
+
const list = await api.getChinaDivisions(parentAdcode);
|
|
7053
|
+
return list.map((item) => normalizeDivision(item, level, depth, index));
|
|
7054
|
+
},
|
|
7055
|
+
[api, depth]
|
|
7056
|
+
);
|
|
6952
7057
|
useEffect25(() => {
|
|
7058
|
+
let mounted = true;
|
|
6953
7059
|
setLoadingRoots(true);
|
|
6954
|
-
loadDivisions(void 0, "province", 0).then(
|
|
6955
|
-
|
|
7060
|
+
loadDivisions(void 0, "province", 0).then((nextOptions) => {
|
|
7061
|
+
if (mounted) setOptions(nextOptions);
|
|
7062
|
+
}).finally(() => {
|
|
7063
|
+
if (mounted) setLoadingRoots(false);
|
|
7064
|
+
});
|
|
7065
|
+
return () => {
|
|
7066
|
+
mounted = false;
|
|
7067
|
+
};
|
|
7068
|
+
}, [loadDivisions]);
|
|
7069
|
+
useEffect25(() => {
|
|
7070
|
+
if (!value) return;
|
|
7071
|
+
let cancelled = false;
|
|
7072
|
+
const hydrateMissingLabels = async () => {
|
|
7073
|
+
let nextValue = { ...value };
|
|
7074
|
+
let changed = false;
|
|
7075
|
+
let parentAdcode;
|
|
7076
|
+
for (let index = 0; index < levels.length; index += 1) {
|
|
7077
|
+
const level = levels[index];
|
|
7078
|
+
const part = nextValue[level];
|
|
7079
|
+
if (!part?.value) break;
|
|
7080
|
+
if (!getDisplayLabel(part)) {
|
|
7081
|
+
const divisions = await loadDivisions(parentAdcode, level, index);
|
|
7082
|
+
const matched = divisions.find((option) => option.value === part.value);
|
|
7083
|
+
if (matched) {
|
|
7084
|
+
nextValue = { ...nextValue, [level]: { label: matched.label, value: matched.value } };
|
|
7085
|
+
changed = true;
|
|
7086
|
+
}
|
|
7087
|
+
}
|
|
7088
|
+
parentAdcode = part.value;
|
|
7089
|
+
}
|
|
7090
|
+
const fullAddress = composeFullAddress(nextValue, levels);
|
|
7091
|
+
if (fullAddress && nextValue.fullAddress !== fullAddress) {
|
|
7092
|
+
nextValue = { ...nextValue, fullAddress };
|
|
7093
|
+
changed = true;
|
|
7094
|
+
}
|
|
7095
|
+
if (!cancelled && changed) {
|
|
7096
|
+
setFieldValue(fieldId, nextValue);
|
|
7097
|
+
}
|
|
7098
|
+
};
|
|
7099
|
+
hydrateMissingLabels().catch(() => {
|
|
7100
|
+
});
|
|
7101
|
+
return () => {
|
|
7102
|
+
cancelled = true;
|
|
7103
|
+
};
|
|
7104
|
+
}, [fieldId, levels, loadDivisions, setFieldValue, value]);
|
|
6956
7105
|
useEffect25(() => {
|
|
6957
7106
|
if (!mobileOpen) return;
|
|
6958
7107
|
const level = levels[mobileLevelIndex] || "province";
|
|
@@ -6960,7 +7109,7 @@ function AddressField(props) {
|
|
|
6960
7109
|
const parentAdcode = parentLevel ? tempValue?.[parentLevel]?.value : void 0;
|
|
6961
7110
|
setMobileLoading(true);
|
|
6962
7111
|
loadDivisions(parentAdcode, level, mobileLevelIndex).then(setMobileOptions).finally(() => setMobileLoading(false));
|
|
6963
|
-
}, [mobileOpen, mobileLevelIndex, tempValue, levels]);
|
|
7112
|
+
}, [loadDivisions, mobileOpen, mobileLevelIndex, tempValue, levels]);
|
|
6964
7113
|
if (behavior === "HIDDEN") return null;
|
|
6965
7114
|
const setAddressValue = (next) => {
|
|
6966
7115
|
const normalized = next ? { ...next, fullAddress: composeFullAddress(next, levels) } : void 0;
|
|
@@ -7096,18 +7245,20 @@ function AddressField(props) {
|
|
|
7096
7245
|
Cascader2,
|
|
7097
7246
|
{
|
|
7098
7247
|
style: { width: "100%" },
|
|
7099
|
-
options,
|
|
7248
|
+
options: displayOptions,
|
|
7100
7249
|
allowClear,
|
|
7101
7250
|
disabled,
|
|
7102
|
-
value:
|
|
7251
|
+
value: valuePath,
|
|
7103
7252
|
placeholder: props.placeholder || "\u8BF7\u9009\u62E9\u5730\u5740",
|
|
7104
7253
|
loading: loadingRoots,
|
|
7254
|
+
displayRender: (labels) => labels.filter(Boolean).join(" / ") || (valuePath.length ? "\u5730\u5740\u52A0\u8F7D\u4E2D" : ""),
|
|
7105
7255
|
loadData: async (selectedOptions) => {
|
|
7106
7256
|
const target = selectedOptions[selectedOptions.length - 1];
|
|
7107
7257
|
const nextLevel = levels[selectedOptions.length] ?? "street";
|
|
7108
7258
|
const children = await loadDivisions(target.value, nextLevel, selectedOptions.length);
|
|
7109
|
-
|
|
7110
|
-
|
|
7259
|
+
setOptions(
|
|
7260
|
+
(currentOptions) => setNestedChildren(currentOptions, selectedOptions, children)
|
|
7261
|
+
);
|
|
7111
7262
|
},
|
|
7112
7263
|
onChange: (_path, selectedOptions) => {
|
|
7113
7264
|
if (!selectedOptions?.length) {
|
|
@@ -7131,7 +7282,7 @@ function AddressField(props) {
|
|
|
7131
7282
|
}
|
|
7132
7283
|
|
|
7133
7284
|
// packages/sdk/src/components/fields/AssociationFormField/index.tsx
|
|
7134
|
-
import { useCallback as
|
|
7285
|
+
import { useCallback as useCallback5, useEffect as useEffect26, useMemo as useMemo16, useRef as useRef5, useState as useState14 } from "react";
|
|
7135
7286
|
import { Button as Button4, Drawer, Input as Input8, Modal as Modal3, Select as Select4, Space as Space4, Spin as Spin4, Table, Tag as Tag4 } from "antd";
|
|
7136
7287
|
import { jsx as jsx68, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7137
7288
|
var DEFAULT_PAGE_SIZE = 10;
|
|
@@ -7245,7 +7396,7 @@ function AssociationFormField(props) {
|
|
|
7245
7396
|
() => `${filterRulesKey}:${currentFieldFilterKey}`,
|
|
7246
7397
|
[currentFieldFilterKey, filterRulesKey]
|
|
7247
7398
|
);
|
|
7248
|
-
const normalizeRecord =
|
|
7399
|
+
const normalizeRecord = useCallback5(
|
|
7249
7400
|
(record) => {
|
|
7250
7401
|
const mainFieldValue = associationMainFieldId ? record?.[associationMainFieldId] : void 0;
|
|
7251
7402
|
const labelText = normalizeCellValue(mainFieldValue);
|
|
@@ -7258,7 +7409,7 @@ function AssociationFormField(props) {
|
|
|
7258
7409
|
},
|
|
7259
7410
|
[associationMainFieldId]
|
|
7260
7411
|
);
|
|
7261
|
-
const toValue =
|
|
7412
|
+
const toValue = useCallback5(
|
|
7262
7413
|
(record) => ({
|
|
7263
7414
|
label: record.__associationLabel,
|
|
7264
7415
|
value: record.__associationValue,
|
|
@@ -7266,7 +7417,7 @@ function AssociationFormField(props) {
|
|
|
7266
7417
|
}),
|
|
7267
7418
|
[]
|
|
7268
7419
|
);
|
|
7269
|
-
const buildFilters =
|
|
7420
|
+
const buildFilters = useCallback5(() => {
|
|
7270
7421
|
void filterDependencyKey;
|
|
7271
7422
|
const rules = associationFormRef.current?.dataFilterRules || [];
|
|
7272
7423
|
const currentFormData = formDataRef.current;
|
|
@@ -7282,7 +7433,7 @@ function AssociationFormField(props) {
|
|
|
7282
7433
|
};
|
|
7283
7434
|
}).filter(Boolean);
|
|
7284
7435
|
}, [filterDependencyKey]);
|
|
7285
|
-
const fetchRecords =
|
|
7436
|
+
const fetchRecords = useCallback5(
|
|
7286
7437
|
async (params) => {
|
|
7287
7438
|
if (!canQuery) return { list: [], total: 0 };
|
|
7288
7439
|
const filters = buildFilters();
|
|
@@ -7305,7 +7456,7 @@ function AssociationFormField(props) {
|
|
|
7305
7456
|
},
|
|
7306
7457
|
[api, associationAppType, associationFormUuid, buildFilters, canQuery, normalizeRecord]
|
|
7307
7458
|
);
|
|
7308
|
-
const loadOptions =
|
|
7459
|
+
const loadOptions = useCallback5(
|
|
7309
7460
|
async (searchKeyWord) => {
|
|
7310
7461
|
setSelectLoading(true);
|
|
7311
7462
|
try {
|
|
@@ -7317,7 +7468,7 @@ function AssociationFormField(props) {
|
|
|
7317
7468
|
},
|
|
7318
7469
|
[fetchRecords, toValue]
|
|
7319
7470
|
);
|
|
7320
|
-
const loadTable =
|
|
7471
|
+
const loadTable = useCallback5(
|
|
7321
7472
|
async (next) => {
|
|
7322
7473
|
setTableLoading(true);
|
|
7323
7474
|
const current = next?.current || 1;
|
|
@@ -7347,7 +7498,7 @@ function AssociationFormField(props) {
|
|
|
7347
7498
|
).filter(Boolean)
|
|
7348
7499
|
);
|
|
7349
7500
|
}, [normalizeRecord, value]);
|
|
7350
|
-
const applyDataFilling =
|
|
7501
|
+
const applyDataFilling = useCallback5(
|
|
7351
7502
|
(next) => {
|
|
7352
7503
|
if (!associationForm?.dataFillingEnabled && !associationForm?.dataFillingRules?.mainRules) {
|
|
7353
7504
|
return;
|
|
@@ -7361,7 +7512,7 @@ function AssociationFormField(props) {
|
|
|
7361
7512
|
},
|
|
7362
7513
|
[associationForm?.dataFillingEnabled, associationForm?.dataFillingRules, setFieldValue]
|
|
7363
7514
|
);
|
|
7364
|
-
const commitSelection =
|
|
7515
|
+
const commitSelection = useCallback5(
|
|
7365
7516
|
(next) => {
|
|
7366
7517
|
const normalized = multiple ? next : next.slice(0, 1);
|
|
7367
7518
|
setFieldValue(fieldId, normalized);
|
|
@@ -7613,7 +7764,7 @@ function AssociationFormField(props) {
|
|
|
7613
7764
|
}
|
|
7614
7765
|
|
|
7615
7766
|
// packages/sdk/src/components/fields/EditorField/index.tsx
|
|
7616
|
-
import { useCallback as
|
|
7767
|
+
import { useCallback as useCallback6, useEffect as useEffect27, useMemo as useMemo17, useRef as useRef6, useState as useState15 } from "react";
|
|
7617
7768
|
import { Extension } from "@tiptap/core";
|
|
7618
7769
|
import { EditorContent, useEditor } from "@tiptap/react";
|
|
7619
7770
|
import StarterKit from "@tiptap/starter-kit";
|
|
@@ -8322,7 +8473,7 @@ function RichTextEditorCore({
|
|
|
8322
8473
|
],
|
|
8323
8474
|
[maxLength, placeholder]
|
|
8324
8475
|
);
|
|
8325
|
-
const updateHtml =
|
|
8476
|
+
const updateHtml = useCallback6((next) => {
|
|
8326
8477
|
onChangeRef.current?.(next);
|
|
8327
8478
|
}, []);
|
|
8328
8479
|
const editor = useEditor(
|
|
@@ -8364,7 +8515,7 @@ function RichTextEditorCore({
|
|
|
8364
8515
|
}
|
|
8365
8516
|
setCharCount(countCharacters(editor));
|
|
8366
8517
|
}, [editor, value]);
|
|
8367
|
-
const insertImageFiles =
|
|
8518
|
+
const insertImageFiles = useCallback6(
|
|
8368
8519
|
async (files) => {
|
|
8369
8520
|
if (!editor || isEditorDestroyed(editor) || disabled || files.length === 0) return;
|
|
8370
8521
|
const validFiles = files.filter((file) => {
|
|
@@ -8394,7 +8545,7 @@ function RichTextEditorCore({
|
|
|
8394
8545
|
},
|
|
8395
8546
|
[allowedImageTypes, api, disabled, editor, maxImageSize, uploadBucketName]
|
|
8396
8547
|
);
|
|
8397
|
-
const openLinkModal =
|
|
8548
|
+
const openLinkModal = useCallback6(() => {
|
|
8398
8549
|
if (!editor || isEditorDestroyed(editor)) return;
|
|
8399
8550
|
setLinkUrl(editor.getAttributes("link").href || "");
|
|
8400
8551
|
setLinkError("");
|
|
@@ -8420,7 +8571,7 @@ function RichTextEditorCore({
|
|
|
8420
8571
|
editor.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
8421
8572
|
setLinkOpen(false);
|
|
8422
8573
|
};
|
|
8423
|
-
const openImageUrlModal =
|
|
8574
|
+
const openImageUrlModal = useCallback6(() => {
|
|
8424
8575
|
setImageUrl("");
|
|
8425
8576
|
setImageAlt("");
|
|
8426
8577
|
setImageTitle("");
|
|
@@ -8682,7 +8833,7 @@ function EditorField(props) {
|
|
|
8682
8833
|
setFieldValue(fieldId, value);
|
|
8683
8834
|
}
|
|
8684
8835
|
}, [fieldId, rawValue, setFieldValue, value]);
|
|
8685
|
-
const updateHtml =
|
|
8836
|
+
const updateHtml = useCallback6(
|
|
8686
8837
|
(next) => {
|
|
8687
8838
|
setFieldValue(fieldId, next);
|
|
8688
8839
|
onChange?.(next);
|
|
@@ -8982,7 +9133,7 @@ function LocationField(props) {
|
|
|
8982
9133
|
}
|
|
8983
9134
|
|
|
8984
9135
|
// packages/sdk/src/components/fields/DigitalSignatureField/index.tsx
|
|
8985
|
-
import { useCallback as
|
|
9136
|
+
import { useCallback as useCallback7, useEffect as useEffect30, useRef as useRef7, useState as useState17 } from "react";
|
|
8986
9137
|
import { Button as Button7, Modal as Modal5, Space as Space7 } from "antd";
|
|
8987
9138
|
import { jsx as jsx72, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
8988
9139
|
var CANVAS_HEIGHT = 260;
|
|
@@ -9030,7 +9181,7 @@ function DigitalSignatureField(props) {
|
|
|
9030
9181
|
}
|
|
9031
9182
|
return () => unregisterField(fieldId);
|
|
9032
9183
|
}, [fieldId]);
|
|
9033
|
-
const prepareCanvas =
|
|
9184
|
+
const prepareCanvas = useCallback7(() => {
|
|
9034
9185
|
const canvas = canvasRef.current;
|
|
9035
9186
|
if (!canvas) return;
|
|
9036
9187
|
const rect = canvas.getBoundingClientRect();
|
|
@@ -10640,7 +10791,7 @@ function FormProvider({
|
|
|
10640
10791
|
setFieldErrors(nextErrors);
|
|
10641
10792
|
}
|
|
10642
10793
|
}, [effects, formData, fieldErrors]);
|
|
10643
|
-
const setFieldValue =
|
|
10794
|
+
const setFieldValue = useCallback8((fieldId, value) => {
|
|
10644
10795
|
setFormData((prev) => ({ ...prev, [fieldId]: value }));
|
|
10645
10796
|
setFieldErrors((prev) => {
|
|
10646
10797
|
if (prev[fieldId]) {
|
|
@@ -10651,9 +10802,9 @@ function FormProvider({
|
|
|
10651
10802
|
return prev;
|
|
10652
10803
|
});
|
|
10653
10804
|
}, []);
|
|
10654
|
-
const getFieldValue =
|
|
10655
|
-
const getFormData2 =
|
|
10656
|
-
const validateFieldById =
|
|
10805
|
+
const getFieldValue = useCallback8((fieldId) => formData[fieldId], [formData]);
|
|
10806
|
+
const getFormData2 = useCallback8(() => ({ ...formData }), [formData]);
|
|
10807
|
+
const validateFieldById = useCallback8(
|
|
10657
10808
|
async (fieldId) => {
|
|
10658
10809
|
const field = schema.fields.find((f) => f.fieldId === fieldId);
|
|
10659
10810
|
if (!field) {
|
|
@@ -10714,7 +10865,7 @@ function FormProvider({
|
|
|
10714
10865
|
},
|
|
10715
10866
|
[schema, formData, fieldBehaviors, fieldOverrides]
|
|
10716
10867
|
);
|
|
10717
|
-
const validateAllWithErrors =
|
|
10868
|
+
const validateAllWithErrors = useCallback8(async () => {
|
|
10718
10869
|
const fieldRules = {};
|
|
10719
10870
|
const validationData = { ...formData };
|
|
10720
10871
|
for (const field of schema.fields) {
|
|
@@ -10738,21 +10889,21 @@ function FormProvider({
|
|
|
10738
10889
|
setFieldErrors(errors);
|
|
10739
10890
|
return errors;
|
|
10740
10891
|
}, [schema, formData, fieldBehaviors, fieldOverrides]);
|
|
10741
|
-
const validateAll =
|
|
10892
|
+
const validateAll = useCallback8(async () => {
|
|
10742
10893
|
const errors = await validateAllWithErrors();
|
|
10743
10894
|
return Object.keys(errors).length === 0;
|
|
10744
10895
|
}, [validateAllWithErrors]);
|
|
10745
|
-
const resetForm =
|
|
10896
|
+
const resetForm = useCallback8(() => {
|
|
10746
10897
|
setFormData({ ...initialValuesRef.current });
|
|
10747
10898
|
setFieldErrors({});
|
|
10748
10899
|
}, []);
|
|
10749
|
-
const registerField =
|
|
10900
|
+
const registerField = useCallback8(
|
|
10750
10901
|
(fieldId) => {
|
|
10751
10902
|
registeredFields.add(fieldId);
|
|
10752
10903
|
},
|
|
10753
10904
|
[registeredFields]
|
|
10754
10905
|
);
|
|
10755
|
-
const unregisterField =
|
|
10906
|
+
const unregisterField = useCallback8(
|
|
10756
10907
|
(fieldId) => {
|
|
10757
10908
|
registeredFields.delete(fieldId);
|
|
10758
10909
|
},
|
|
@@ -11626,7 +11777,7 @@ function FormShell({ children, appearance, className }) {
|
|
|
11626
11777
|
}
|
|
11627
11778
|
|
|
11628
11779
|
// packages/sdk/src/components/core/FormActions.tsx
|
|
11629
|
-
import { useState as useState22, useCallback as
|
|
11780
|
+
import { useState as useState22, useCallback as useCallback9 } from "react";
|
|
11630
11781
|
import { Button as Button8 } from "antd";
|
|
11631
11782
|
|
|
11632
11783
|
// packages/sdk/src/components/core/validationFeedback.ts
|
|
@@ -11671,7 +11822,7 @@ function FormActions({
|
|
|
11671
11822
|
const { mode, validateAllWithErrors, getFormData: getFormData2, resetForm, api, config } = useFormContext();
|
|
11672
11823
|
const [isSubmitting, setIsSubmitting] = useState22(false);
|
|
11673
11824
|
const [submitError, setSubmitError] = useState22(null);
|
|
11674
|
-
const handleSubmit =
|
|
11825
|
+
const handleSubmit = useCallback9(async () => {
|
|
11675
11826
|
setSubmitError(null);
|
|
11676
11827
|
const valid = await validateAndNotify(validateAllWithErrors);
|
|
11677
11828
|
if (!valid) return;
|
|
@@ -11707,7 +11858,7 @@ function FormActions({
|
|
|
11707
11858
|
setIsSubmitting(false);
|
|
11708
11859
|
}
|
|
11709
11860
|
}, [api, config, getFormData2, mode, onSubmit, validateAllWithErrors]);
|
|
11710
|
-
const handleReset =
|
|
11861
|
+
const handleReset = useCallback9(() => {
|
|
11711
11862
|
resetForm();
|
|
11712
11863
|
}, [resetForm]);
|
|
11713
11864
|
if (mode === "readonly") return null;
|
|
@@ -12601,7 +12752,7 @@ function FormSummary({
|
|
|
12601
12752
|
}
|
|
12602
12753
|
|
|
12603
12754
|
// packages/sdk/src/components/hooks/useFormEngine.ts
|
|
12604
|
-
import { useState as useState23, useCallback as
|
|
12755
|
+
import { useState as useState23, useCallback as useCallback10, useMemo as useMemo20, useRef as useRef9 } from "react";
|
|
12605
12756
|
function useFormEngine(schema, config) {
|
|
12606
12757
|
const initialValues = useMemo20(() => {
|
|
12607
12758
|
const values = {};
|
|
@@ -12638,7 +12789,7 @@ function useFormEngine(schema, config) {
|
|
|
12638
12789
|
}
|
|
12639
12790
|
return computed;
|
|
12640
12791
|
}, [schema, config.effects, config.permissions, config.mode, formData]);
|
|
12641
|
-
const setFieldValue =
|
|
12792
|
+
const setFieldValue = useCallback10((fieldId, value) => {
|
|
12642
12793
|
setFormData((prev) => ({ ...prev, [fieldId]: value }));
|
|
12643
12794
|
setFieldErrors((prev) => {
|
|
12644
12795
|
if (prev[fieldId]) {
|
|
@@ -12649,9 +12800,9 @@ function useFormEngine(schema, config) {
|
|
|
12649
12800
|
return prev;
|
|
12650
12801
|
});
|
|
12651
12802
|
}, []);
|
|
12652
|
-
const getFieldValue =
|
|
12653
|
-
const getFormData2 =
|
|
12654
|
-
const validateAll =
|
|
12803
|
+
const getFieldValue = useCallback10((fieldId) => formData[fieldId], [formData]);
|
|
12804
|
+
const getFormData2 = useCallback10(() => ({ ...formData }), [formData]);
|
|
12805
|
+
const validateAll = useCallback10(async () => {
|
|
12655
12806
|
const fieldRules = {};
|
|
12656
12807
|
for (const field of schema.fields) {
|
|
12657
12808
|
const rules = [];
|
|
@@ -12669,7 +12820,7 @@ function useFormEngine(schema, config) {
|
|
|
12669
12820
|
setFieldErrors(errors);
|
|
12670
12821
|
return Object.keys(errors).length === 0;
|
|
12671
12822
|
}, [schema, formData]);
|
|
12672
|
-
const resetForm =
|
|
12823
|
+
const resetForm = useCallback10(() => {
|
|
12673
12824
|
setFormData({ ...initialValuesRef.current });
|
|
12674
12825
|
setFieldErrors({});
|
|
12675
12826
|
}, []);
|
|
@@ -12687,12 +12838,12 @@ function useFormEngine(schema, config) {
|
|
|
12687
12838
|
}
|
|
12688
12839
|
|
|
12689
12840
|
// packages/sdk/src/components/hooks/useFormData.ts
|
|
12690
|
-
import { useState as useState24, useCallback as
|
|
12841
|
+
import { useState as useState24, useCallback as useCallback11, useRef as useRef10 } from "react";
|
|
12691
12842
|
function useFormData(initialValues = {}) {
|
|
12692
12843
|
const [formData, setFormData] = useState24({ ...initialValues });
|
|
12693
12844
|
const [dirtyFields, setDirtyFields] = useState24(/* @__PURE__ */ new Set());
|
|
12694
12845
|
const initialValuesRef = useRef10(initialValues);
|
|
12695
|
-
const setFieldValue =
|
|
12846
|
+
const setFieldValue = useCallback11((fieldId, value) => {
|
|
12696
12847
|
setFormData((prev) => ({ ...prev, [fieldId]: value }));
|
|
12697
12848
|
setDirtyFields((prev) => {
|
|
12698
12849
|
const next = new Set(prev);
|
|
@@ -12700,16 +12851,16 @@ function useFormData(initialValues = {}) {
|
|
|
12700
12851
|
return next;
|
|
12701
12852
|
});
|
|
12702
12853
|
}, []);
|
|
12703
|
-
const getFieldValue =
|
|
12854
|
+
const getFieldValue = useCallback11(
|
|
12704
12855
|
(fieldId) => {
|
|
12705
12856
|
return formData[fieldId];
|
|
12706
12857
|
},
|
|
12707
12858
|
[formData]
|
|
12708
12859
|
);
|
|
12709
|
-
const getFormData2 =
|
|
12860
|
+
const getFormData2 = useCallback11(() => {
|
|
12710
12861
|
return { ...formData };
|
|
12711
12862
|
}, [formData]);
|
|
12712
|
-
const resetForm =
|
|
12863
|
+
const resetForm = useCallback11(() => {
|
|
12713
12864
|
setFormData({ ...initialValuesRef.current });
|
|
12714
12865
|
setDirtyFields(/* @__PURE__ */ new Set());
|
|
12715
12866
|
}, []);
|
|
@@ -12746,11 +12897,11 @@ function useFieldBehavior({
|
|
|
12746
12897
|
}
|
|
12747
12898
|
|
|
12748
12899
|
// packages/sdk/src/components/hooks/useFormSubmit.ts
|
|
12749
|
-
import { useState as useState25, useCallback as
|
|
12900
|
+
import { useState as useState25, useCallback as useCallback12 } from "react";
|
|
12750
12901
|
function useFormSubmit(config) {
|
|
12751
12902
|
const [isSubmitting, setIsSubmitting] = useState25(false);
|
|
12752
12903
|
const [submitError, setSubmitError] = useState25(null);
|
|
12753
|
-
const submit =
|
|
12904
|
+
const submit = useCallback12(
|
|
12754
12905
|
async (formData, validateFn) => {
|
|
12755
12906
|
setSubmitError(null);
|
|
12756
12907
|
const isValid = await validateFn();
|
|
@@ -12782,7 +12933,7 @@ function useFormSubmit(config) {
|
|
|
12782
12933
|
}
|
|
12783
12934
|
|
|
12784
12935
|
// packages/sdk/src/components/hooks/useFieldPermission.ts
|
|
12785
|
-
import { useMemo as useMemo22, useCallback as
|
|
12936
|
+
import { useMemo as useMemo22, useCallback as useCallback13 } from "react";
|
|
12786
12937
|
|
|
12787
12938
|
// packages/sdk/src/components/utils/permissions.ts
|
|
12788
12939
|
var OPERATION_ALIASES = {
|
|
@@ -12855,7 +13006,7 @@ var normalizeFlowConfig = (config) => {
|
|
|
12855
13006
|
};
|
|
12856
13007
|
function useFieldPermission(options) {
|
|
12857
13008
|
const { viewPermissions, processDefinition, currentTask, isApprover, mode } = options;
|
|
12858
|
-
const computeBehaviors =
|
|
13009
|
+
const computeBehaviors = useCallback13(() => {
|
|
12859
13010
|
const behaviors = {};
|
|
12860
13011
|
if (!currentTask && viewPermissions) {
|
|
12861
13012
|
return normalizeFieldBehaviors(viewPermissions, mode);
|
|
@@ -12905,7 +13056,7 @@ function useFieldPermission(options) {
|
|
|
12905
13056
|
}
|
|
12906
13057
|
|
|
12907
13058
|
// packages/sdk/src/components/hooks/useFormDetail.ts
|
|
12908
|
-
import { useState as useState26, useEffect as useEffect34, useCallback as
|
|
13059
|
+
import { useState as useState26, useEffect as useEffect34, useCallback as useCallback14, useRef as useRef11 } from "react";
|
|
12909
13060
|
|
|
12910
13061
|
// packages/sdk/src/components/utils/formInstanceData.ts
|
|
12911
13062
|
var FORM_INSTANCE_METADATA_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -13081,7 +13232,7 @@ function useFormDetail(options) {
|
|
|
13081
13232
|
useEffect34(() => {
|
|
13082
13233
|
onPermissionDeniedRef.current = onPermissionDenied;
|
|
13083
13234
|
}, [onPermissionDenied]);
|
|
13084
|
-
const loadData =
|
|
13235
|
+
const loadData = useCallback14(async () => {
|
|
13085
13236
|
if (!mountedRef.current) return;
|
|
13086
13237
|
setLoading(true);
|
|
13087
13238
|
try {
|
|
@@ -13123,14 +13274,14 @@ function useFormDetail(options) {
|
|
|
13123
13274
|
const canEdit = hasViewOperation(permissions?.operations, "edit");
|
|
13124
13275
|
const canDelete = hasViewOperation(permissions?.operations, "delete");
|
|
13125
13276
|
const canViewChangeRecords = hasViewOperation(permissions?.operations, "change_records");
|
|
13126
|
-
const switchToEdit =
|
|
13277
|
+
const switchToEdit = useCallback14(() => {
|
|
13127
13278
|
setMode("edit");
|
|
13128
13279
|
loadData();
|
|
13129
13280
|
}, [loadData]);
|
|
13130
|
-
const switchToReadonly =
|
|
13281
|
+
const switchToReadonly = useCallback14(() => {
|
|
13131
13282
|
setMode("readonly");
|
|
13132
13283
|
}, []);
|
|
13133
|
-
const saveChanges =
|
|
13284
|
+
const saveChanges = useCallback14(
|
|
13134
13285
|
async (values) => {
|
|
13135
13286
|
try {
|
|
13136
13287
|
await api.updateFormData({
|
|
@@ -13151,7 +13302,7 @@ function useFormDetail(options) {
|
|
|
13151
13302
|
},
|
|
13152
13303
|
[api, formInstanceId, formUuid, appType]
|
|
13153
13304
|
);
|
|
13154
|
-
const deleteInstance =
|
|
13305
|
+
const deleteInstance = useCallback14(async () => {
|
|
13155
13306
|
try {
|
|
13156
13307
|
await deleteFormData(request, { formInstanceId, appType, formUuid });
|
|
13157
13308
|
return true;
|
|
@@ -13178,7 +13329,7 @@ function useFormDetail(options) {
|
|
|
13178
13329
|
}
|
|
13179
13330
|
|
|
13180
13331
|
// packages/sdk/src/components/hooks/useProcessDetail.ts
|
|
13181
|
-
import { useState as useState27, useEffect as useEffect35, useCallback as
|
|
13332
|
+
import { useState as useState27, useEffect as useEffect35, useCallback as useCallback15, useRef as useRef12, useMemo as useMemo23 } from "react";
|
|
13182
13333
|
var DEFAULT_APPROVAL_ACTIONS = [
|
|
13183
13334
|
{ action: "agree", name: { zh_CN: "\u540C\u610F" } },
|
|
13184
13335
|
{ action: "rejected", name: { zh_CN: "\u62D2\u7EDD" } }
|
|
@@ -13256,7 +13407,7 @@ function useProcessDetail(options) {
|
|
|
13256
13407
|
}
|
|
13257
13408
|
return actions;
|
|
13258
13409
|
}, [isApprover, isProcessFinal, currentTask?.actions, canWithdraw]);
|
|
13259
|
-
const loadData =
|
|
13410
|
+
const loadData = useCallback15(async () => {
|
|
13260
13411
|
if (!mountedRef.current) return;
|
|
13261
13412
|
setLoading(true);
|
|
13262
13413
|
setAccessDenied(false);
|
|
@@ -13341,21 +13492,21 @@ function useProcessDetail(options) {
|
|
|
13341
13492
|
useEffect35(() => {
|
|
13342
13493
|
loadData();
|
|
13343
13494
|
}, [loadData]);
|
|
13344
|
-
const switchToEdit =
|
|
13495
|
+
const switchToEdit = useCallback15(() => {
|
|
13345
13496
|
setMode("edit");
|
|
13346
13497
|
void loadData();
|
|
13347
13498
|
}, [loadData]);
|
|
13348
|
-
const switchToReadonly =
|
|
13499
|
+
const switchToReadonly = useCallback15(() => {
|
|
13349
13500
|
setMode("readonly");
|
|
13350
13501
|
}, []);
|
|
13351
|
-
const refreshDetail =
|
|
13502
|
+
const refreshDetail = useCallback15(async () => {
|
|
13352
13503
|
setMode("readonly");
|
|
13353
13504
|
await loadData();
|
|
13354
13505
|
}, [loadData]);
|
|
13355
|
-
const refreshProgress =
|
|
13506
|
+
const refreshProgress = useCallback15(async () => {
|
|
13356
13507
|
await refreshDetail();
|
|
13357
13508
|
}, [refreshDetail]);
|
|
13358
|
-
const saveChanges =
|
|
13509
|
+
const saveChanges = useCallback15(
|
|
13359
13510
|
async (values) => {
|
|
13360
13511
|
try {
|
|
13361
13512
|
await api.updateFormData({
|
|
@@ -13374,7 +13525,7 @@ function useProcessDetail(options) {
|
|
|
13374
13525
|
},
|
|
13375
13526
|
[api, formInstanceId, formUuid, appType, loadData]
|
|
13376
13527
|
);
|
|
13377
|
-
const deleteInstance =
|
|
13528
|
+
const deleteInstance = useCallback15(async () => {
|
|
13378
13529
|
try {
|
|
13379
13530
|
await deleteFormData(request, { formInstanceId, appType, formUuid });
|
|
13380
13531
|
return true;
|
|
@@ -13415,7 +13566,7 @@ function useProcessDetail(options) {
|
|
|
13415
13566
|
}
|
|
13416
13567
|
|
|
13417
13568
|
// packages/sdk/src/components/hooks/useApprovalActions.ts
|
|
13418
|
-
import { useState as useState28, useCallback as
|
|
13569
|
+
import { useState as useState28, useCallback as useCallback16, useRef as useRef13, useEffect as useEffect36 } from "react";
|
|
13419
13570
|
function useApprovalActions(options) {
|
|
13420
13571
|
const { formInstanceId, formUuid, appType, currentTaskId, onActionComplete, getFormValues } = options;
|
|
13421
13572
|
const { api } = useFormContext();
|
|
@@ -13431,13 +13582,13 @@ function useApprovalActions(options) {
|
|
|
13431
13582
|
mountedRef.current = false;
|
|
13432
13583
|
};
|
|
13433
13584
|
}, []);
|
|
13434
|
-
const resetLoading =
|
|
13585
|
+
const resetLoading = useCallback16(() => {
|
|
13435
13586
|
if (mountedRef.current) {
|
|
13436
13587
|
setIsLoading(false);
|
|
13437
13588
|
setCurrentAction(null);
|
|
13438
13589
|
}
|
|
13439
13590
|
}, []);
|
|
13440
|
-
const approve =
|
|
13591
|
+
const approve = useCallback16(
|
|
13441
13592
|
async (comments) => {
|
|
13442
13593
|
setIsLoading(true);
|
|
13443
13594
|
setCurrentAction("approve");
|
|
@@ -13462,7 +13613,7 @@ function useApprovalActions(options) {
|
|
|
13462
13613
|
},
|
|
13463
13614
|
[request, formInstanceId, appType, formUuid, getFormValues, onActionComplete, resetLoading]
|
|
13464
13615
|
);
|
|
13465
|
-
const reject =
|
|
13616
|
+
const reject = useCallback16(
|
|
13466
13617
|
async (comments) => {
|
|
13467
13618
|
setIsLoading(true);
|
|
13468
13619
|
setCurrentAction("reject");
|
|
@@ -13483,7 +13634,7 @@ function useApprovalActions(options) {
|
|
|
13483
13634
|
},
|
|
13484
13635
|
[request, formInstanceId, onActionComplete, resetLoading]
|
|
13485
13636
|
);
|
|
13486
|
-
const transfer =
|
|
13637
|
+
const transfer = useCallback16(
|
|
13487
13638
|
async (userId, reason) => {
|
|
13488
13639
|
if (!currentTaskId) {
|
|
13489
13640
|
console.error("[useApprovalActions] transfer failed: no currentTaskId");
|
|
@@ -13508,7 +13659,7 @@ function useApprovalActions(options) {
|
|
|
13508
13659
|
},
|
|
13509
13660
|
[request, currentTaskId, onActionComplete, resetLoading]
|
|
13510
13661
|
);
|
|
13511
|
-
const returnTo =
|
|
13662
|
+
const returnTo = useCallback16(
|
|
13512
13663
|
async (nodeId, reason) => {
|
|
13513
13664
|
if (!currentTaskId) {
|
|
13514
13665
|
console.error("[useApprovalActions] returnTo failed: no currentTaskId");
|
|
@@ -13533,7 +13684,7 @@ function useApprovalActions(options) {
|
|
|
13533
13684
|
},
|
|
13534
13685
|
[request, currentTaskId, onActionComplete, resetLoading]
|
|
13535
13686
|
);
|
|
13536
|
-
const withdraw =
|
|
13687
|
+
const withdraw = useCallback16(
|
|
13537
13688
|
async (reason) => {
|
|
13538
13689
|
setIsLoading(true);
|
|
13539
13690
|
setCurrentAction("withdraw");
|
|
@@ -13553,7 +13704,7 @@ function useApprovalActions(options) {
|
|
|
13553
13704
|
},
|
|
13554
13705
|
[request, formInstanceId, onActionComplete, resetLoading]
|
|
13555
13706
|
);
|
|
13556
|
-
const save =
|
|
13707
|
+
const save = useCallback16(async () => {
|
|
13557
13708
|
setIsLoading(true);
|
|
13558
13709
|
setCurrentAction("save");
|
|
13559
13710
|
try {
|
|
@@ -13573,7 +13724,7 @@ function useApprovalActions(options) {
|
|
|
13573
13724
|
return false;
|
|
13574
13725
|
}
|
|
13575
13726
|
}, [request, formInstanceId, formUuid, appType, getFormValues, onActionComplete, resetLoading]);
|
|
13576
|
-
const resubmit =
|
|
13727
|
+
const resubmit = useCallback16(
|
|
13577
13728
|
async (comments, selectedApprovers) => {
|
|
13578
13729
|
if (!currentTaskId) {
|
|
13579
13730
|
console.error("[useApprovalActions] resubmit failed: no currentTaskId");
|
|
@@ -13603,7 +13754,7 @@ function useApprovalActions(options) {
|
|
|
13603
13754
|
},
|
|
13604
13755
|
[request, currentTaskId, formUuid, appType, getFormValues, onActionComplete, resetLoading]
|
|
13605
13756
|
);
|
|
13606
|
-
const callbackTask =
|
|
13757
|
+
const callbackTask = useCallback16(
|
|
13607
13758
|
async (payload) => {
|
|
13608
13759
|
if (!currentTaskId) {
|
|
13609
13760
|
console.error("[useApprovalActions] callbackTask failed: no currentTaskId");
|
|
@@ -13627,7 +13778,7 @@ function useApprovalActions(options) {
|
|
|
13627
13778
|
},
|
|
13628
13779
|
[request, currentTaskId, onActionComplete, resetLoading]
|
|
13629
13780
|
);
|
|
13630
|
-
const loadReturnableNodes =
|
|
13781
|
+
const loadReturnableNodes = useCallback16(async () => {
|
|
13631
13782
|
if (!currentTaskId) return [];
|
|
13632
13783
|
try {
|
|
13633
13784
|
const result = await getReturnableNodeResult(request, currentTaskId);
|
|
@@ -13663,7 +13814,7 @@ function useApprovalActions(options) {
|
|
|
13663
13814
|
}
|
|
13664
13815
|
|
|
13665
13816
|
// packages/sdk/src/components/hooks/useChangeRecords.ts
|
|
13666
|
-
import { useState as useState29, useEffect as useEffect37, useCallback as
|
|
13817
|
+
import { useState as useState29, useEffect as useEffect37, useCallback as useCallback17, useRef as useRef14 } from "react";
|
|
13667
13818
|
var normalizeChangeRecordList = (value) => {
|
|
13668
13819
|
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;
|
|
13669
13820
|
const records = Array.isArray(body) ? body : body?.records ?? body?.data ?? body?.list ?? body?.items ?? [];
|
|
@@ -13689,7 +13840,7 @@ function useChangeRecords(options) {
|
|
|
13689
13840
|
mountedRef.current = false;
|
|
13690
13841
|
};
|
|
13691
13842
|
}, []);
|
|
13692
|
-
const fetchRecords =
|
|
13843
|
+
const fetchRecords = useCallback17(
|
|
13693
13844
|
async (pageNum, append) => {
|
|
13694
13845
|
if (!mountedRef.current) return;
|
|
13695
13846
|
setLoading(true);
|
|
@@ -13727,11 +13878,11 @@ function useChangeRecords(options) {
|
|
|
13727
13878
|
}, [autoLoad, fetchRecords]);
|
|
13728
13879
|
const safeRecords = Array.isArray(records) ? records : [];
|
|
13729
13880
|
const hasMore = safeRecords.length < total;
|
|
13730
|
-
const loadMore =
|
|
13881
|
+
const loadMore = useCallback17(async () => {
|
|
13731
13882
|
if (!hasMore || loading) return;
|
|
13732
13883
|
await fetchRecords(page + 1, true);
|
|
13733
13884
|
}, [hasMore, loading, page, fetchRecords]);
|
|
13734
|
-
const refresh =
|
|
13885
|
+
const refresh = useCallback17(async () => {
|
|
13735
13886
|
setRecords([]);
|
|
13736
13887
|
setPage(1);
|
|
13737
13888
|
setTotal(0);
|
|
@@ -13749,7 +13900,7 @@ function useChangeRecords(options) {
|
|
|
13749
13900
|
}
|
|
13750
13901
|
|
|
13751
13902
|
// packages/sdk/src/components/hooks/useFormNavigation.ts
|
|
13752
|
-
import { useState as useState30, useCallback as
|
|
13903
|
+
import { useState as useState30, useCallback as useCallback18, useRef as useRef15, useEffect as useEffect38 } from "react";
|
|
13753
13904
|
var normalizeBasePath = (basePath) => {
|
|
13754
13905
|
const normalized = String(basePath || "").replace(/^\/+|\/+$/g, "");
|
|
13755
13906
|
return normalized ? `/${normalized}` : "";
|
|
@@ -13796,13 +13947,13 @@ function useFormNavigation(options) {
|
|
|
13796
13947
|
}
|
|
13797
13948
|
};
|
|
13798
13949
|
}, []);
|
|
13799
|
-
const navigateToDetail =
|
|
13950
|
+
const navigateToDetail = useCallback18(
|
|
13800
13951
|
(formInstId) => {
|
|
13801
13952
|
window.location.href = buildDetailUrl(appType, formUuid, formInstId, "formDetail", basePath);
|
|
13802
13953
|
},
|
|
13803
13954
|
[appType, basePath, formUuid]
|
|
13804
13955
|
);
|
|
13805
|
-
const navigateToProcessDetail =
|
|
13956
|
+
const navigateToProcessDetail = useCallback18(
|
|
13806
13957
|
(formInstId) => {
|
|
13807
13958
|
window.location.href = buildDetailUrl(
|
|
13808
13959
|
appType,
|
|
@@ -13814,7 +13965,7 @@ function useFormNavigation(options) {
|
|
|
13814
13965
|
},
|
|
13815
13966
|
[appType, basePath, formUuid]
|
|
13816
13967
|
);
|
|
13817
|
-
const startRedirectCountdown =
|
|
13968
|
+
const startRedirectCountdown = useCallback18(
|
|
13818
13969
|
(targetUrl) => {
|
|
13819
13970
|
const totalSeconds = Math.ceil(redirectDelay / 1e3);
|
|
13820
13971
|
setIsRedirecting(true);
|
|
@@ -13847,7 +13998,7 @@ function useFormNavigation(options) {
|
|
|
13847
13998
|
},
|
|
13848
13999
|
[redirectDelay]
|
|
13849
14000
|
);
|
|
13850
|
-
const cancelRedirect =
|
|
14001
|
+
const cancelRedirect = useCallback18(() => {
|
|
13851
14002
|
if (timerRef.current) {
|
|
13852
14003
|
clearInterval(timerRef.current);
|
|
13853
14004
|
timerRef.current = null;
|
|
@@ -13856,7 +14007,7 @@ function useFormNavigation(options) {
|
|
|
13856
14007
|
setCountdown(0);
|
|
13857
14008
|
redirectTargetRef.current = null;
|
|
13858
14009
|
}, []);
|
|
13859
|
-
const handlePostSubmit =
|
|
14010
|
+
const handlePostSubmit = useCallback18(
|
|
13860
14011
|
(formInstId) => {
|
|
13861
14012
|
if (mode === "stay") {
|
|
13862
14013
|
onStay?.(formInstId);
|
|
@@ -13888,7 +14039,7 @@ function useFormNavigation(options) {
|
|
|
13888
14039
|
}
|
|
13889
14040
|
|
|
13890
14041
|
// packages/sdk/src/components/hooks/useDraftStorage.ts
|
|
13891
|
-
import { useState as useState31, useCallback as
|
|
14042
|
+
import { useState as useState31, useCallback as useCallback19, useEffect as useEffect39 } from "react";
|
|
13892
14043
|
function getDraftKey(appType, formUuid) {
|
|
13893
14044
|
return `${appType}__${formUuid}__draft`;
|
|
13894
14045
|
}
|
|
@@ -13925,7 +14076,7 @@ function useDraftStorage(options) {
|
|
|
13925
14076
|
setDraftTimestamp(null);
|
|
13926
14077
|
}
|
|
13927
14078
|
}, [key, autoRestore]);
|
|
13928
|
-
const saveDraft =
|
|
14079
|
+
const saveDraft = useCallback19(
|
|
13929
14080
|
(data) => {
|
|
13930
14081
|
const payload = { data, ts: Date.now() };
|
|
13931
14082
|
try {
|
|
@@ -13939,7 +14090,7 @@ function useDraftStorage(options) {
|
|
|
13939
14090
|
},
|
|
13940
14091
|
[key]
|
|
13941
14092
|
);
|
|
13942
|
-
const restoreDraft =
|
|
14093
|
+
const restoreDraft = useCallback19(() => {
|
|
13943
14094
|
const stored = readDraft(key);
|
|
13944
14095
|
if (stored) {
|
|
13945
14096
|
setDraftData(stored.data);
|
|
@@ -13947,7 +14098,7 @@ function useDraftStorage(options) {
|
|
|
13947
14098
|
}
|
|
13948
14099
|
return null;
|
|
13949
14100
|
}, [key]);
|
|
13950
|
-
const clearDraft =
|
|
14101
|
+
const clearDraft = useCallback19(() => {
|
|
13951
14102
|
try {
|
|
13952
14103
|
localStorage.removeItem(key);
|
|
13953
14104
|
} catch (error) {
|
|
@@ -15404,7 +15555,7 @@ var ProcessPreview = ({
|
|
|
15404
15555
|
};
|
|
15405
15556
|
|
|
15406
15557
|
// packages/sdk/src/components/modules/DataManagementList.tsx
|
|
15407
|
-
import { useCallback as
|
|
15558
|
+
import { useCallback as useCallback24, useEffect as useEffect43, useMemo as useMemo32, useRef as useRef20, useState as useState41 } from "react";
|
|
15408
15559
|
import {
|
|
15409
15560
|
Alert as Alert2,
|
|
15410
15561
|
Button as Button17,
|
|
@@ -15446,7 +15597,7 @@ import {
|
|
|
15446
15597
|
import { useMemo as useMemo31 } from "react";
|
|
15447
15598
|
|
|
15448
15599
|
// packages/sdk/src/components/templates/FormDetailTemplate.tsx
|
|
15449
|
-
import { useCallback as
|
|
15600
|
+
import { useCallback as useCallback20, useMemo as useMemo28, useRef as useRef16, useState as useState37 } from "react";
|
|
15450
15601
|
import dayjs9 from "dayjs";
|
|
15451
15602
|
|
|
15452
15603
|
// packages/sdk/src/components/templates/PageSkeleton.tsx
|
|
@@ -15580,7 +15731,7 @@ var InnerDetailContent = ({
|
|
|
15580
15731
|
formInstanceId,
|
|
15581
15732
|
autoLoad: enableChangeRecords && canViewChangeRecords
|
|
15582
15733
|
});
|
|
15583
|
-
const handleSave =
|
|
15734
|
+
const handleSave = useCallback20(async () => {
|
|
15584
15735
|
if (validateRef.current && !await validateAndNotify(validateRef.current)) return;
|
|
15585
15736
|
const values = formDataRef.current?.() ?? formData;
|
|
15586
15737
|
if (!values) return;
|
|
@@ -15589,13 +15740,13 @@ var InnerDetailContent = ({
|
|
|
15589
15740
|
onSave?.(values);
|
|
15590
15741
|
}
|
|
15591
15742
|
}, [formData, saveChanges, onSave]);
|
|
15592
|
-
const handleDelete =
|
|
15743
|
+
const handleDelete = useCallback20(async () => {
|
|
15593
15744
|
const success = await deleteInstance();
|
|
15594
15745
|
if (success) {
|
|
15595
15746
|
onDelete?.();
|
|
15596
15747
|
}
|
|
15597
15748
|
}, [deleteInstance, onDelete]);
|
|
15598
|
-
const handleCancel =
|
|
15749
|
+
const handleCancel = useCallback20(() => {
|
|
15599
15750
|
switchToReadonly();
|
|
15600
15751
|
}, [switchToReadonly]);
|
|
15601
15752
|
const readonlyActions = [];
|
|
@@ -15722,12 +15873,12 @@ var FormDetailTemplate = (props) => {
|
|
|
15722
15873
|
};
|
|
15723
15874
|
|
|
15724
15875
|
// packages/sdk/src/components/templates/FormSubmitTemplate.tsx
|
|
15725
|
-
import { useEffect as useEffect42, useRef as useRef18, useState as useState39, useCallback as
|
|
15876
|
+
import { useEffect as useEffect42, useRef as useRef18, useState as useState39, useCallback as useCallback22 } from "react";
|
|
15726
15877
|
import { Button as Button16, message as message3, Modal as Modal10, Select as Select8 } from "antd";
|
|
15727
15878
|
import { CheckCircleFilled as CheckCircleFilled2 } from "@ant-design/icons";
|
|
15728
15879
|
|
|
15729
15880
|
// packages/sdk/src/components/modules/InitiatorApproverSelector.tsx
|
|
15730
|
-
import { useCallback as
|
|
15881
|
+
import { useCallback as useCallback21, useEffect as useEffect41, useMemo as useMemo29, useRef as useRef17, useState as useState38 } from "react";
|
|
15731
15882
|
import { Button as Button15, Empty as Empty5, Modal as Modal9, Select as Select7, Space as Space8, Tag as Tag6, Typography, message as message2 } from "antd";
|
|
15732
15883
|
import { jsx as jsx97, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
15733
15884
|
var scopeText = {
|
|
@@ -15775,7 +15926,7 @@ var RequirementSelect = ({
|
|
|
15775
15926
|
(current) => mergeUsers(initialCandidates, mergeUsers(current, selectedUsers))
|
|
15776
15927
|
);
|
|
15777
15928
|
}, [initialCandidates, selectedUsers]);
|
|
15778
|
-
const loadCandidates =
|
|
15929
|
+
const loadCandidates = useCallback21(
|
|
15779
15930
|
async (keyword) => {
|
|
15780
15931
|
setLoading(true);
|
|
15781
15932
|
try {
|
|
@@ -16105,14 +16256,14 @@ var InnerFormContent = ({
|
|
|
16105
16256
|
submissionDepartmentResolverRef.current = null;
|
|
16106
16257
|
};
|
|
16107
16258
|
}, []);
|
|
16108
|
-
const closeSubmissionDepartmentModal =
|
|
16259
|
+
const closeSubmissionDepartmentModal = useCallback22((value = null) => {
|
|
16109
16260
|
setSubmissionDepartmentModalOpen(false);
|
|
16110
16261
|
setSubmissionDepartmentOptions([]);
|
|
16111
16262
|
setSelectedSubmissionDepartmentId(void 0);
|
|
16112
16263
|
submissionDepartmentResolverRef.current?.(value);
|
|
16113
16264
|
submissionDepartmentResolverRef.current = null;
|
|
16114
16265
|
}, []);
|
|
16115
|
-
const promptSubmissionDepartmentSelection =
|
|
16266
|
+
const promptSubmissionDepartmentSelection = useCallback22(
|
|
16116
16267
|
(options, preferredDepartmentId) => {
|
|
16117
16268
|
return new Promise((resolve) => {
|
|
16118
16269
|
const selected = options.some((option) => option.value === preferredDepartmentId) ? preferredDepartmentId : options[0]?.value;
|
|
@@ -16124,7 +16275,7 @@ var InnerFormContent = ({
|
|
|
16124
16275
|
},
|
|
16125
16276
|
[]
|
|
16126
16277
|
);
|
|
16127
|
-
const resolveSubmissionDepartmentId =
|
|
16278
|
+
const resolveSubmissionDepartmentId = useCallback22(async () => {
|
|
16128
16279
|
if (formType !== "process") {
|
|
16129
16280
|
return void 0;
|
|
16130
16281
|
}
|
|
@@ -16146,7 +16297,7 @@ var InnerFormContent = ({
|
|
|
16146
16297
|
}
|
|
16147
16298
|
return promptSubmissionDepartmentSelection(departments, departmentId);
|
|
16148
16299
|
}, [api, config.formUuid, departmentId, formType, promptSubmissionDepartmentSelection, schema]);
|
|
16149
|
-
const performSubmit =
|
|
16300
|
+
const performSubmit = useCallback22(
|
|
16150
16301
|
async (formData, submissionDepartmentId, initiatorSelectedApprovers) => {
|
|
16151
16302
|
const submitData = normalizeFormDataForSubmit(schema, formData);
|
|
16152
16303
|
setSubmitting(true);
|
|
@@ -16222,7 +16373,7 @@ var InnerFormContent = ({
|
|
|
16222
16373
|
departmentId
|
|
16223
16374
|
]
|
|
16224
16375
|
);
|
|
16225
|
-
const continuePreparedSubmit =
|
|
16376
|
+
const continuePreparedSubmit = useCallback22(
|
|
16226
16377
|
async (submitData, submissionDepartmentId, initiatorSelectedApprovers) => {
|
|
16227
16378
|
if (formType === "process" && enableProcessPreview && !isSaveDraftSubmitBehavior(config)) {
|
|
16228
16379
|
setPendingFormData(submitData);
|
|
@@ -16254,7 +16405,7 @@ var InnerFormContent = ({
|
|
|
16254
16405
|
},
|
|
16255
16406
|
[api.request, config, enableProcessPreview, formType, performSubmit]
|
|
16256
16407
|
);
|
|
16257
|
-
const prepareSubmit =
|
|
16408
|
+
const prepareSubmit = useCallback22(async () => {
|
|
16258
16409
|
const valid = await validateAndNotify(validateAllWithErrors);
|
|
16259
16410
|
if (!valid) return;
|
|
16260
16411
|
const formData = getFormData2();
|
|
@@ -16311,7 +16462,7 @@ var InnerFormContent = ({
|
|
|
16311
16462
|
resolveSubmissionDepartmentId,
|
|
16312
16463
|
continuePreparedSubmit
|
|
16313
16464
|
]);
|
|
16314
|
-
const handlePreviewConfirm =
|
|
16465
|
+
const handlePreviewConfirm = useCallback22(async () => {
|
|
16315
16466
|
const data = pendingFormData ?? getFormData2();
|
|
16316
16467
|
const submissionDepartmentId = pendingSubmissionDepartmentIdRef.current ?? pendingSubmissionDepartmentId;
|
|
16317
16468
|
const initiatorSelectedApprovers = pendingInitiatorSelectedApproversRef.current ?? pendingInitiatorSelectedApprovers;
|
|
@@ -16329,7 +16480,7 @@ var InnerFormContent = ({
|
|
|
16329
16480
|
pendingSubmissionDepartmentId,
|
|
16330
16481
|
performSubmit
|
|
16331
16482
|
]);
|
|
16332
|
-
const handleInitiatorApproverConfirm =
|
|
16483
|
+
const handleInitiatorApproverConfirm = useCallback22(
|
|
16333
16484
|
async (selectedUsersByNode) => {
|
|
16334
16485
|
const data = pendingFormData;
|
|
16335
16486
|
if (!data) {
|
|
@@ -16345,7 +16496,7 @@ var InnerFormContent = ({
|
|
|
16345
16496
|
},
|
|
16346
16497
|
[continuePreparedSubmit, pendingFormData, pendingSubmissionDepartmentId]
|
|
16347
16498
|
);
|
|
16348
|
-
const handleInitiatorApproverCancel =
|
|
16499
|
+
const handleInitiatorApproverCancel = useCallback22(() => {
|
|
16349
16500
|
setInitiatorApproverOpen(false);
|
|
16350
16501
|
setInitiatorApproverRequirements([]);
|
|
16351
16502
|
setPendingFormData(null);
|
|
@@ -16354,23 +16505,23 @@ var InnerFormContent = ({
|
|
|
16354
16505
|
pendingSubmissionDepartmentIdRef.current = void 0;
|
|
16355
16506
|
pendingInitiatorSelectedApproversRef.current = void 0;
|
|
16356
16507
|
}, []);
|
|
16357
|
-
const handleSaveDraft =
|
|
16508
|
+
const handleSaveDraft = useCallback22(() => {
|
|
16358
16509
|
const data = getFormData2();
|
|
16359
16510
|
saveDraft(data);
|
|
16360
16511
|
}, [getFormData2, saveDraft]);
|
|
16361
|
-
const handleRestoreDraft =
|
|
16512
|
+
const handleRestoreDraft = useCallback22(() => {
|
|
16362
16513
|
const data = restoreDraft();
|
|
16363
16514
|
if (!data) return;
|
|
16364
16515
|
Object.entries(data).forEach(([fieldId, value]) => {
|
|
16365
16516
|
setFieldValue(fieldId, value);
|
|
16366
16517
|
});
|
|
16367
16518
|
}, [restoreDraft, setFieldValue]);
|
|
16368
|
-
const handleContinue =
|
|
16519
|
+
const handleContinue = useCallback22(() => {
|
|
16369
16520
|
setSubmitted(false);
|
|
16370
16521
|
setSuccessInfo(null);
|
|
16371
16522
|
resetForm();
|
|
16372
16523
|
}, [resetForm]);
|
|
16373
|
-
const handleViewDetail =
|
|
16524
|
+
const handleViewDetail = useCallback22(() => {
|
|
16374
16525
|
if (!successInfo) return;
|
|
16375
16526
|
if (formType === "process") {
|
|
16376
16527
|
navigateToProcessDetail(successInfo.formInstanceId);
|
|
@@ -16591,7 +16742,7 @@ var FormSubmitTemplate = ({
|
|
|
16591
16742
|
};
|
|
16592
16743
|
|
|
16593
16744
|
// packages/sdk/src/components/templates/ProcessDetailTemplate.tsx
|
|
16594
|
-
import { useCallback as
|
|
16745
|
+
import { useCallback as useCallback23, useMemo as useMemo30, useRef as useRef19, useState as useState40 } from "react";
|
|
16595
16746
|
import dayjs10 from "dayjs";
|
|
16596
16747
|
import { Form as AntForm, Input as Input13, Modal as Modal11, message as message4 } from "antd";
|
|
16597
16748
|
import { jsx as jsx99, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
@@ -16762,45 +16913,45 @@ var InnerProcessContent = ({
|
|
|
16762
16913
|
formInstanceId,
|
|
16763
16914
|
autoLoad: enableChangeRecords && canViewChangeRecords
|
|
16764
16915
|
});
|
|
16765
|
-
const validateForm =
|
|
16916
|
+
const validateForm = useCallback23(async () => {
|
|
16766
16917
|
return validateRef.current ? validateAndNotify(validateRef.current) : true;
|
|
16767
16918
|
}, []);
|
|
16768
|
-
const handleApprove =
|
|
16919
|
+
const handleApprove = useCallback23(
|
|
16769
16920
|
async (comments) => {
|
|
16770
16921
|
if (!await validateForm()) return;
|
|
16771
16922
|
await approve(comments);
|
|
16772
16923
|
},
|
|
16773
16924
|
[approve, validateForm]
|
|
16774
16925
|
);
|
|
16775
|
-
const handleReject =
|
|
16926
|
+
const handleReject = useCallback23(
|
|
16776
16927
|
async (comments) => {
|
|
16777
16928
|
await reject(comments);
|
|
16778
16929
|
},
|
|
16779
16930
|
[reject]
|
|
16780
16931
|
);
|
|
16781
|
-
const handleTransfer =
|
|
16932
|
+
const handleTransfer = useCallback23(
|
|
16782
16933
|
async (userId, reason) => {
|
|
16783
16934
|
await transfer(userId, reason);
|
|
16784
16935
|
},
|
|
16785
16936
|
[transfer]
|
|
16786
16937
|
);
|
|
16787
|
-
const handleReturn =
|
|
16938
|
+
const handleReturn = useCallback23(
|
|
16788
16939
|
async (nodeId, reason) => {
|
|
16789
16940
|
await returnTo(nodeId, reason);
|
|
16790
16941
|
},
|
|
16791
16942
|
[returnTo]
|
|
16792
16943
|
);
|
|
16793
|
-
const handleWithdraw =
|
|
16944
|
+
const handleWithdraw = useCallback23(
|
|
16794
16945
|
async (reason) => {
|
|
16795
16946
|
await withdraw(reason);
|
|
16796
16947
|
},
|
|
16797
16948
|
[withdraw]
|
|
16798
16949
|
);
|
|
16799
|
-
const handleSave =
|
|
16950
|
+
const handleSave = useCallback23(async () => {
|
|
16800
16951
|
if (!await validateForm()) return;
|
|
16801
16952
|
await save();
|
|
16802
16953
|
}, [save, validateForm]);
|
|
16803
|
-
const handleResubmit =
|
|
16954
|
+
const handleResubmit = useCallback23(
|
|
16804
16955
|
async (comments) => {
|
|
16805
16956
|
if (!await validateForm()) return;
|
|
16806
16957
|
const values = formDataRef.current?.() ?? formData ?? {};
|
|
@@ -16834,7 +16985,7 @@ var InnerProcessContent = ({
|
|
|
16834
16985
|
},
|
|
16835
16986
|
[api.request, appType, currentTaskId, formData, formUuid, resubmit, validateForm]
|
|
16836
16987
|
);
|
|
16837
|
-
const handleInitiatorApproverConfirm =
|
|
16988
|
+
const handleInitiatorApproverConfirm = useCallback23(
|
|
16838
16989
|
async (selectedUsersByNode) => {
|
|
16839
16990
|
const selectedApprovers = normalizeSelectedApprovers2(selectedUsersByNode);
|
|
16840
16991
|
setInitiatorApproverOpen(false);
|
|
@@ -16845,15 +16996,15 @@ var InnerProcessContent = ({
|
|
|
16845
16996
|
},
|
|
16846
16997
|
[pendingResubmitComments, resubmit]
|
|
16847
16998
|
);
|
|
16848
|
-
const handleInitiatorApproverCancel =
|
|
16999
|
+
const handleInitiatorApproverCancel = useCallback23(() => {
|
|
16849
17000
|
setInitiatorApproverOpen(false);
|
|
16850
17001
|
setInitiatorApproverRequirements([]);
|
|
16851
17002
|
setPendingResubmitComments(void 0);
|
|
16852
17003
|
}, []);
|
|
16853
|
-
const handleCallback =
|
|
17004
|
+
const handleCallback = useCallback23(async () => {
|
|
16854
17005
|
await callbackTask();
|
|
16855
17006
|
}, [callbackTask]);
|
|
16856
|
-
const handleCompletedSave =
|
|
17007
|
+
const handleCompletedSave = useCallback23(async () => {
|
|
16857
17008
|
if (!await validateForm()) return;
|
|
16858
17009
|
const values = formDataRef.current?.() ?? formData;
|
|
16859
17010
|
if (!values) return;
|
|
@@ -16867,7 +17018,7 @@ var InnerProcessContent = ({
|
|
|
16867
17018
|
setSaveLoading(false);
|
|
16868
17019
|
}
|
|
16869
17020
|
}, [formData, onSave, saveChanges, validateForm]);
|
|
16870
|
-
const handleCompletedDelete =
|
|
17021
|
+
const handleCompletedDelete = useCallback23(async () => {
|
|
16871
17022
|
setDeleteLoading(true);
|
|
16872
17023
|
try {
|
|
16873
17024
|
const success = await deleteInstance();
|
|
@@ -16878,7 +17029,7 @@ var InnerProcessContent = ({
|
|
|
16878
17029
|
setDeleteLoading(false);
|
|
16879
17030
|
}
|
|
16880
17031
|
}, [deleteInstance, onDelete]);
|
|
16881
|
-
const handleFooterWithdraw =
|
|
17032
|
+
const handleFooterWithdraw = useCallback23(async () => {
|
|
16882
17033
|
const values = await withdrawForm.validateFields();
|
|
16883
17034
|
setWithdrawLoading(true);
|
|
16884
17035
|
try {
|
|
@@ -16889,7 +17040,7 @@ var InnerProcessContent = ({
|
|
|
16889
17040
|
setWithdrawLoading(false);
|
|
16890
17041
|
}
|
|
16891
17042
|
}, [handleWithdraw, withdrawForm]);
|
|
16892
|
-
const handleFooterWithdrawCancel =
|
|
17043
|
+
const handleFooterWithdrawCancel = useCallback23(() => {
|
|
16893
17044
|
setWithdrawOpen(false);
|
|
16894
17045
|
withdrawForm.resetFields();
|
|
16895
17046
|
}, [withdrawForm]);
|
|
@@ -17850,7 +18001,7 @@ function AsyncEntityFilterSelect({
|
|
|
17850
18001
|
const [options, setOptions] = useState41([]);
|
|
17851
18002
|
const [fetching, setFetching] = useState41(false);
|
|
17852
18003
|
const multiple = normalizeOperator(operator) === "IN";
|
|
17853
|
-
const loadOptions =
|
|
18004
|
+
const loadOptions = useCallback24(
|
|
17854
18005
|
async (keyword = "") => {
|
|
17855
18006
|
setFetching(true);
|
|
17856
18007
|
try {
|
|
@@ -18320,16 +18471,16 @@ var DataManagementList = ({
|
|
|
18320
18471
|
const fetchStateRef = useRef20({});
|
|
18321
18472
|
const isProcessForm = isProcessFormType(formType);
|
|
18322
18473
|
const request = api.request;
|
|
18323
|
-
const getPopupContainer =
|
|
18474
|
+
const getPopupContainer = useCallback24(
|
|
18324
18475
|
(triggerNode) => resolveDataManagementPopupContainer(rootRef.current, triggerNode),
|
|
18325
18476
|
[]
|
|
18326
18477
|
);
|
|
18327
|
-
const getOverlayContainer =
|
|
18478
|
+
const getOverlayContainer = useCallback24(
|
|
18328
18479
|
() => resolveDataManagementPortalContainer(rootRef.current),
|
|
18329
18480
|
[]
|
|
18330
18481
|
);
|
|
18331
18482
|
const drawerWidth = "min(960px, calc(100vw - 48px))";
|
|
18332
|
-
const confirmDanger =
|
|
18483
|
+
const confirmDanger = useCallback24((title2, content, onOk) => {
|
|
18333
18484
|
if (confirmAction(title2, content)) onOk();
|
|
18334
18485
|
}, []);
|
|
18335
18486
|
const visibleFields = useMemo32(
|
|
@@ -18356,7 +18507,7 @@ var DataManagementList = ({
|
|
|
18356
18507
|
sort
|
|
18357
18508
|
};
|
|
18358
18509
|
}, [current, filterGroup, pageSize, searchKeyWord, sort]);
|
|
18359
|
-
const loadData =
|
|
18510
|
+
const loadData = useCallback24(
|
|
18360
18511
|
async (overrides = {}) => {
|
|
18361
18512
|
if (!appType || !formUuid) return;
|
|
18362
18513
|
const fetchState = { ...fetchStateRef.current, ...overrides };
|
|
@@ -18482,7 +18633,7 @@ var DataManagementList = ({
|
|
|
18482
18633
|
request,
|
|
18483
18634
|
title
|
|
18484
18635
|
]);
|
|
18485
|
-
const persistConfig =
|
|
18636
|
+
const persistConfig = useCallback24(
|
|
18486
18637
|
async (patch) => {
|
|
18487
18638
|
const personalPatch = stripForcedConfigPatch(patch, forcedConfig);
|
|
18488
18639
|
const nextConfig = { ...config, ...personalPatch };
|
|
@@ -18526,12 +18677,12 @@ var DataManagementList = ({
|
|
|
18526
18677
|
const handleRemoveSort = (index) => {
|
|
18527
18678
|
setSort((prev) => prev.filter((_, itemIndex) => itemIndex !== index));
|
|
18528
18679
|
};
|
|
18529
|
-
const updateColumnWidth =
|
|
18680
|
+
const updateColumnWidth = useCallback24((fieldId, width) => {
|
|
18530
18681
|
const nextWidth = Math.round(Math.max(96, Math.min(520, width)));
|
|
18531
18682
|
widthsRef.current = { ...widthsRef.current, [fieldId]: nextWidth };
|
|
18532
18683
|
setWidths(widthsRef.current);
|
|
18533
18684
|
}, []);
|
|
18534
|
-
const commitColumnWidth =
|
|
18685
|
+
const commitColumnWidth = useCallback24(
|
|
18535
18686
|
(fieldId, width) => {
|
|
18536
18687
|
const nextWidth = Math.round(Math.max(96, Math.min(520, width)));
|
|
18537
18688
|
const nextWidths = { ...widthsRef.current, [fieldId]: nextWidth };
|
|
@@ -18541,7 +18692,7 @@ var DataManagementList = ({
|
|
|
18541
18692
|
},
|
|
18542
18693
|
[persistConfig]
|
|
18543
18694
|
);
|
|
18544
|
-
const handleDetail =
|
|
18695
|
+
const handleDetail = useCallback24(
|
|
18545
18696
|
(record) => {
|
|
18546
18697
|
const formInstanceId = getRecordId(record);
|
|
18547
18698
|
if (!formInstanceId) {
|
|
@@ -18566,7 +18717,7 @@ var DataManagementList = ({
|
|
|
18566
18717
|
},
|
|
18567
18718
|
[appType, detailBasePath, detailOpenMode, detailPageUrlBuilder, formType, formUuid]
|
|
18568
18719
|
);
|
|
18569
|
-
const handleDelete =
|
|
18720
|
+
const handleDelete = useCallback24(
|
|
18570
18721
|
async (ids) => {
|
|
18571
18722
|
if (ids.length === 0) return;
|
|
18572
18723
|
await deleteDataManagementRows(request, { appType, formUuid, formInstanceIds: ids });
|
|
@@ -18575,7 +18726,7 @@ var DataManagementList = ({
|
|
|
18575
18726
|
},
|
|
18576
18727
|
[appType, current, formUuid, loadData, pageSize, request]
|
|
18577
18728
|
);
|
|
18578
|
-
const getSelectedRecordIds =
|
|
18729
|
+
const getSelectedRecordIds = useCallback24(
|
|
18579
18730
|
() => selectedRowKeys.map((key) => {
|
|
18580
18731
|
const record = dataSource.find((item) => String(getRecordId(item)) === String(key));
|
|
18581
18732
|
return String(getSelectedRecordId(record, key));
|