openxiangda 1.0.153 → 1.0.155
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/openxiangda-skills/SKILL.md +1 -0
- package/openxiangda-skills/references/component-guide.md +2 -0
- package/openxiangda-skills/references/pages/page-sdk.md +19 -0
- package/openxiangda-skills/references/troubleshooting.md +18 -5
- package/openxiangda-skills/skills/openxiangda-form/SKILL.md +1 -0
- package/openxiangda-skills/skills/openxiangda-page/SKILL.md +1 -0
- package/package.json +1 -1
- package/packages/sdk/dist/components/index.cjs +41 -1
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.d.mts +2 -1
- package/packages/sdk/dist/components/index.d.ts +2 -1
- package/packages/sdk/dist/components/index.mjs +41 -1
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/index.cjs +846 -796
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.d.mts +1 -1
- package/packages/sdk/dist/runtime/index.d.ts +1 -1
- package/packages/sdk/dist/runtime/index.mjs +232 -182
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +274 -224
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.d.mts +10 -2
- package/packages/sdk/dist/runtime/react.d.ts +10 -2
- package/packages/sdk/dist/runtime/react.mjs +146 -96
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
- package/templates/openxiangda-react-spa/AGENTS.md +1 -0
|
@@ -2941,9 +2941,8 @@ var usePageRoute = () => {
|
|
|
2941
2941
|
return usePageContext().route;
|
|
2942
2942
|
};
|
|
2943
2943
|
|
|
2944
|
-
// packages/sdk/src/runtime/react/
|
|
2945
|
-
import
|
|
2946
|
-
import { Empty as Empty3 } from "antd";
|
|
2944
|
+
// packages/sdk/src/runtime/react/formRuntime.ts
|
|
2945
|
+
import { useMemo as useMemo4 } from "react";
|
|
2947
2946
|
|
|
2948
2947
|
// packages/sdk/src/components/core/imageCompression.ts
|
|
2949
2948
|
var DEFAULT_THUMB = {
|
|
@@ -3796,6 +3795,73 @@ function createFormRuntimeApi(config) {
|
|
|
3796
3795
|
return { ...defaults, ...overrides, request };
|
|
3797
3796
|
}
|
|
3798
3797
|
|
|
3798
|
+
// packages/sdk/src/runtime/react/formRuntime.ts
|
|
3799
|
+
var normalizeMethod2 = (method) => {
|
|
3800
|
+
const value = String(method || "get").toLowerCase();
|
|
3801
|
+
return ["get", "post", "put", "delete", "patch"].includes(value) ? value : "get";
|
|
3802
|
+
};
|
|
3803
|
+
var normalizeHeaders = (headers) => {
|
|
3804
|
+
if (!headers) return void 0;
|
|
3805
|
+
return Object.fromEntries(new Headers(headers).entries());
|
|
3806
|
+
};
|
|
3807
|
+
var toPageRequest = (config) => ({
|
|
3808
|
+
path: config.url,
|
|
3809
|
+
method: normalizeMethod2(config.method),
|
|
3810
|
+
query: config.params,
|
|
3811
|
+
body: config.data,
|
|
3812
|
+
headers: normalizeHeaders(config.headers)
|
|
3813
|
+
});
|
|
3814
|
+
var toRuntimeResponse = (response) => {
|
|
3815
|
+
if (response.raw && typeof response.raw === "object") {
|
|
3816
|
+
return response.raw;
|
|
3817
|
+
}
|
|
3818
|
+
return {
|
|
3819
|
+
code: Number(response.code) || 200,
|
|
3820
|
+
success: response.success,
|
|
3821
|
+
message: response.message,
|
|
3822
|
+
data: response.result,
|
|
3823
|
+
result: response.result
|
|
3824
|
+
};
|
|
3825
|
+
};
|
|
3826
|
+
var unwrapPageResult = (response) => response.result ?? response.data ?? null;
|
|
3827
|
+
var createPageFormRuntimeApi = (sdk) => {
|
|
3828
|
+
const request = async (config) => {
|
|
3829
|
+
const options = toPageRequest(config);
|
|
3830
|
+
if (config.responseType === "blob") {
|
|
3831
|
+
const response = await sdk.transport.download(options);
|
|
3832
|
+
return response.blob;
|
|
3833
|
+
}
|
|
3834
|
+
return toRuntimeResponse(await sdk.transport.request(options));
|
|
3835
|
+
};
|
|
3836
|
+
return createFormRuntimeApi({
|
|
3837
|
+
request,
|
|
3838
|
+
createFileAccessTicket: async (bucketName, objectName, fileName, purpose = "preview", options = {}) => unwrapPageResult(
|
|
3839
|
+
await sdk.createFileAccessTicket(
|
|
3840
|
+
bucketName,
|
|
3841
|
+
objectName,
|
|
3842
|
+
fileName,
|
|
3843
|
+
purpose,
|
|
3844
|
+
options
|
|
3845
|
+
)
|
|
3846
|
+
),
|
|
3847
|
+
createDownloadTicket: async (bucketName, objectName, fileName) => unwrapPageResult(
|
|
3848
|
+
await sdk.request({
|
|
3849
|
+
path: "/file/download-ticket",
|
|
3850
|
+
method: "post",
|
|
3851
|
+
body: { bucketName, objectName, fileName }
|
|
3852
|
+
})
|
|
3853
|
+
)
|
|
3854
|
+
});
|
|
3855
|
+
};
|
|
3856
|
+
var usePageFormRuntimeApi = () => {
|
|
3857
|
+
const sdk = usePageSdk();
|
|
3858
|
+
return useMemo4(() => createPageFormRuntimeApi(sdk), [sdk]);
|
|
3859
|
+
};
|
|
3860
|
+
|
|
3861
|
+
// packages/sdk/src/runtime/react/filePreview.tsx
|
|
3862
|
+
import React6, { useMemo as useMemo7, useState as useState6 } from "react";
|
|
3863
|
+
import { Empty as Empty3 } from "antd";
|
|
3864
|
+
|
|
3799
3865
|
// packages/sdk/src/components/fields/shared/fieldFormat.ts
|
|
3800
3866
|
function createUid(prefix = "field") {
|
|
3801
3867
|
return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
@@ -4097,6 +4163,45 @@ var normalizePreviewBlobResponse = (response) => {
|
|
|
4097
4163
|
if (blob) return blob;
|
|
4098
4164
|
throw new Error(getBinaryResponseMessage(payload) || "\u6587\u4EF6\u5185\u5BB9\u54CD\u5E94\u4E0D\u662F\u4E8C\u8FDB\u5236\u6570\u636E");
|
|
4099
4165
|
};
|
|
4166
|
+
var isZipBytes = (bytes) => bytes.length >= 4 && bytes[0] === 80 && bytes[1] === 75 && (bytes[2] === 3 && bytes[3] === 4 || bytes[2] === 5 && bytes[3] === 6 || bytes[2] === 7 && bytes[3] === 8);
|
|
4167
|
+
var decodeBase64ZipBlob = async (blob) => {
|
|
4168
|
+
const prefix = (await blob.slice(0, 96).text()).replace(/^\uFEFF/, "").replace(/\s+/g, "");
|
|
4169
|
+
if (!prefix.startsWith("UEsDB")) return blob;
|
|
4170
|
+
if (blob.size > 32 * 1024 * 1024) {
|
|
4171
|
+
throw new Error("Base64 \u6587\u4EF6\u8D85\u8FC7\u6D4F\u89C8\u5668\u517C\u5BB9\u89E3\u7801\u4E0A\u9650");
|
|
4172
|
+
}
|
|
4173
|
+
const base64 = (await blob.text()).replace(/^\uFEFF/, "").replace(/\s+/g, "");
|
|
4174
|
+
if (!/^[A-Za-z0-9+/]+={0,2}$/.test(base64)) {
|
|
4175
|
+
throw new Error("\u6587\u4EF6\u5185\u5BB9\u662F\u65E0\u6548\u7684 Base64 \u4E8C\u8FDB\u5236\u6570\u636E");
|
|
4176
|
+
}
|
|
4177
|
+
let binary = "";
|
|
4178
|
+
try {
|
|
4179
|
+
binary = globalThis.atob(base64);
|
|
4180
|
+
} catch {
|
|
4181
|
+
throw new Error("\u6587\u4EF6\u5185\u5BB9\u662F\u65E0\u6548\u7684 Base64 \u4E8C\u8FDB\u5236\u6570\u636E");
|
|
4182
|
+
}
|
|
4183
|
+
const bytes = new Uint8Array(binary.length);
|
|
4184
|
+
for (let index = 0; index < binary.length; index += 1) {
|
|
4185
|
+
bytes[index] = binary.charCodeAt(index);
|
|
4186
|
+
}
|
|
4187
|
+
if (!isZipBytes(bytes)) {
|
|
4188
|
+
throw new Error("Base64 \u6587\u4EF6\u89E3\u7801\u540E\u4E0D\u662F\u6709\u6548\u7684 Office \u6587\u6863");
|
|
4189
|
+
}
|
|
4190
|
+
if (globalThis.btoa(binary).replace(/=+$/, "") !== base64.replace(/=+$/, "")) {
|
|
4191
|
+
throw new Error("\u6587\u4EF6\u5185\u5BB9\u662F\u65E0\u6548\u7684 Base64 \u4E8C\u8FDB\u5236\u6570\u636E");
|
|
4192
|
+
}
|
|
4193
|
+
return new Blob([bytes], { type: blob.type || "application/zip" });
|
|
4194
|
+
};
|
|
4195
|
+
var normalizePreviewBlobContent = async (response) => {
|
|
4196
|
+
const blob = normalizePreviewBlobResponse(response);
|
|
4197
|
+
if (String(blob.type || "").toLowerCase().includes("application/json")) {
|
|
4198
|
+
const payload = await blob.text().then((value) => JSON.parse(value)).catch(() => null);
|
|
4199
|
+
if (payload) {
|
|
4200
|
+
throw new Error(getBinaryResponseMessage(payload) || "\u6587\u4EF6\u5185\u5BB9\u8BF7\u6C42\u5931\u8D25");
|
|
4201
|
+
}
|
|
4202
|
+
}
|
|
4203
|
+
return decodeBase64ZipBlob(blob);
|
|
4204
|
+
};
|
|
4100
4205
|
var isDirectStorageItem = (item) => item.provider === "oss" || item.uploadProvider === "oss" || item.uploadProvider === "builtin-oss" || Boolean(item.storageCode);
|
|
4101
4206
|
var getPreviewItemKey = (item, index = 0) => getAttachmentItemIdentity(item) || item.id || item.uid || `${item.name || "file"}-${index}`;
|
|
4102
4207
|
var getPreviewSourceUrl = (item) => item.previewUrl || item.publicUrl || item.url || "";
|
|
@@ -4270,7 +4375,7 @@ var prepareFilePreview = async (options) => {
|
|
|
4270
4375
|
};
|
|
4271
4376
|
var loadPreviewBlob = async (request, url) => {
|
|
4272
4377
|
const response = await request({ url, method: "get", responseType: "blob" });
|
|
4273
|
-
return
|
|
4378
|
+
return normalizePreviewBlobContent(response);
|
|
4274
4379
|
};
|
|
4275
4380
|
var convertHeicPreview = async (request, url) => {
|
|
4276
4381
|
const source = await loadPreviewBlob(request, url);
|
|
@@ -4288,7 +4393,7 @@ var convertHeicPreview = async (request, url) => {
|
|
|
4288
4393
|
};
|
|
4289
4394
|
|
|
4290
4395
|
// packages/sdk/src/components/file-preview/FilePreviewContent.tsx
|
|
4291
|
-
import { useEffect as useEffect3, useMemo as
|
|
4396
|
+
import { useEffect as useEffect3, useMemo as useMemo5, useRef as useRef2, useState as useState3 } from "react";
|
|
4292
4397
|
import { Alert, Button, Empty, Image as Image2, Spin, Table, Tabs, Typography } from "antd";
|
|
4293
4398
|
import { DownloadOutlined, FileOutlined, ReloadOutlined } from "@ant-design/icons";
|
|
4294
4399
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
@@ -4733,7 +4838,7 @@ var OnlyOfficePreview = ({
|
|
|
4733
4838
|
configUrl,
|
|
4734
4839
|
ticket
|
|
4735
4840
|
}) => {
|
|
4736
|
-
const editorId =
|
|
4841
|
+
const editorId = useMemo5(
|
|
4737
4842
|
() => `openxiangda-onlyoffice-${String(ticket || "editor").replace(/[^a-zA-Z0-9_-]/g, "")}`,
|
|
4738
4843
|
[ticket]
|
|
4739
4844
|
);
|
|
@@ -5109,7 +5214,7 @@ var FilePreviewPage = ({
|
|
|
5109
5214
|
};
|
|
5110
5215
|
|
|
5111
5216
|
// packages/sdk/src/components/file-preview/useFilePreview.tsx
|
|
5112
|
-
import { useCallback as useCallback4, useEffect as useEffect5, useMemo as
|
|
5217
|
+
import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo6, useState as useState5 } from "react";
|
|
5113
5218
|
import { Alert as Alert3, Button as Button3, Image as Image3, Modal, Spin as Spin3, Typography as Typography3 } from "antd";
|
|
5114
5219
|
import { CloseOutlined, DownloadOutlined as DownloadOutlined3 } from "@ant-design/icons";
|
|
5115
5220
|
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
@@ -5138,7 +5243,7 @@ var useFilePreviewController = ({
|
|
|
5138
5243
|
enabled = true,
|
|
5139
5244
|
requireServerCapability = true
|
|
5140
5245
|
}) => {
|
|
5141
|
-
const itemSignature =
|
|
5246
|
+
const itemSignature = useMemo6(
|
|
5142
5247
|
() => items.map(
|
|
5143
5248
|
(item, index) => [
|
|
5144
5249
|
getPreviewItemKey(item, index),
|
|
@@ -5501,63 +5606,6 @@ function FileStatusText({
|
|
|
5501
5606
|
// packages/sdk/src/runtime/react/filePreview.tsx
|
|
5502
5607
|
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
5503
5608
|
var EMPTY_ITEMS = [];
|
|
5504
|
-
var normalizeMethod2 = (method) => {
|
|
5505
|
-
const value = String(method || "get").toLowerCase();
|
|
5506
|
-
return ["get", "post", "put", "delete", "patch"].includes(value) ? value : "get";
|
|
5507
|
-
};
|
|
5508
|
-
var normalizeHeaders = (headers) => {
|
|
5509
|
-
if (!headers) return void 0;
|
|
5510
|
-
return Object.fromEntries(new Headers(headers).entries());
|
|
5511
|
-
};
|
|
5512
|
-
var toPageRequest = (config) => ({
|
|
5513
|
-
path: config.url,
|
|
5514
|
-
method: normalizeMethod2(config.method),
|
|
5515
|
-
query: config.params,
|
|
5516
|
-
body: config.data,
|
|
5517
|
-
headers: normalizeHeaders(config.headers)
|
|
5518
|
-
});
|
|
5519
|
-
var toRuntimeResponse = (response) => {
|
|
5520
|
-
if (response.raw && typeof response.raw === "object") {
|
|
5521
|
-
return response.raw;
|
|
5522
|
-
}
|
|
5523
|
-
return {
|
|
5524
|
-
code: Number(response.code) || 200,
|
|
5525
|
-
success: response.success,
|
|
5526
|
-
message: response.message,
|
|
5527
|
-
data: response.result,
|
|
5528
|
-
result: response.result
|
|
5529
|
-
};
|
|
5530
|
-
};
|
|
5531
|
-
var unwrapPageResult = (response) => response.result ?? response.data ?? null;
|
|
5532
|
-
var createPageFileRuntimeApi = (sdk) => {
|
|
5533
|
-
const request = async (config) => {
|
|
5534
|
-
const options = toPageRequest(config);
|
|
5535
|
-
if (config.responseType === "blob") {
|
|
5536
|
-
const response = await sdk.transport.download(options);
|
|
5537
|
-
return response.blob;
|
|
5538
|
-
}
|
|
5539
|
-
return toRuntimeResponse(await sdk.transport.request(options));
|
|
5540
|
-
};
|
|
5541
|
-
return createFormRuntimeApi({
|
|
5542
|
-
request,
|
|
5543
|
-
createFileAccessTicket: async (bucketName, objectName, fileName, purpose = "preview", options = {}) => unwrapPageResult(
|
|
5544
|
-
await sdk.createFileAccessTicket(
|
|
5545
|
-
bucketName,
|
|
5546
|
-
objectName,
|
|
5547
|
-
fileName,
|
|
5548
|
-
purpose,
|
|
5549
|
-
options
|
|
5550
|
-
)
|
|
5551
|
-
),
|
|
5552
|
-
createDownloadTicket: async (bucketName, objectName, fileName) => unwrapPageResult(
|
|
5553
|
-
await sdk.request({
|
|
5554
|
-
path: "/file/download-ticket",
|
|
5555
|
-
method: "post",
|
|
5556
|
-
body: { bucketName, objectName, fileName }
|
|
5557
|
-
})
|
|
5558
|
-
)
|
|
5559
|
-
});
|
|
5560
|
-
};
|
|
5561
5609
|
var useFilePreview = ({
|
|
5562
5610
|
items = EMPTY_ITEMS,
|
|
5563
5611
|
appType,
|
|
@@ -5566,7 +5614,7 @@ var useFilePreview = ({
|
|
|
5566
5614
|
requireServerCapability = true
|
|
5567
5615
|
}) => {
|
|
5568
5616
|
const sdk = usePageSdk();
|
|
5569
|
-
const api =
|
|
5617
|
+
const api = useMemo7(() => createPageFormRuntimeApi(sdk), [sdk]);
|
|
5570
5618
|
const preview = useFilePreviewController({
|
|
5571
5619
|
items,
|
|
5572
5620
|
api,
|
|
@@ -5754,7 +5802,7 @@ var ImagePreviewGrid = ({
|
|
|
5754
5802
|
};
|
|
5755
5803
|
|
|
5756
5804
|
// packages/sdk/src/runtime/react/workflow.tsx
|
|
5757
|
-
import { useCallback as useCallback8, useEffect as useEffect10, useMemo as
|
|
5805
|
+
import { useCallback as useCallback8, useEffect as useEffect10, useMemo as useMemo13, useRef as useRef5, useState as useState11 } from "react";
|
|
5758
5806
|
import { Form, Input as Input2, Modal as Modal5, Select as Select2 } from "antd";
|
|
5759
5807
|
import {
|
|
5760
5808
|
CheckOutlined,
|
|
@@ -5766,7 +5814,7 @@ import {
|
|
|
5766
5814
|
} from "@ant-design/icons";
|
|
5767
5815
|
|
|
5768
5816
|
// packages/sdk/src/components/modules/StickyActionBar.tsx
|
|
5769
|
-
import { useEffect as useEffect6, useMemo as
|
|
5817
|
+
import { useEffect as useEffect6, useMemo as useMemo8, useState as useState7 } from "react";
|
|
5770
5818
|
import { Button as Button4, Dropdown, Tooltip as Tooltip2 } from "antd";
|
|
5771
5819
|
import { MoreOutlined } from "@ant-design/icons";
|
|
5772
5820
|
|
|
@@ -5809,7 +5857,7 @@ var StickyActionBar = ({
|
|
|
5809
5857
|
window.addEventListener("resize", update);
|
|
5810
5858
|
return () => window.removeEventListener("resize", update);
|
|
5811
5859
|
}, []);
|
|
5812
|
-
const visibleActions =
|
|
5860
|
+
const visibleActions = useMemo8(
|
|
5813
5861
|
() => actions.filter((action) => action.visible !== false).sort((left, right) => getActionPriority(left) - getActionPriority(right)),
|
|
5814
5862
|
[actions]
|
|
5815
5863
|
);
|
|
@@ -5878,7 +5926,7 @@ var StickyActionBar = ({
|
|
|
5878
5926
|
};
|
|
5879
5927
|
|
|
5880
5928
|
// packages/sdk/src/components/modules/ApprovalTimeline.tsx
|
|
5881
|
-
import { useMemo as
|
|
5929
|
+
import { useMemo as useMemo9 } from "react";
|
|
5882
5930
|
import {
|
|
5883
5931
|
ApiOutlined,
|
|
5884
5932
|
CheckCircleFilled,
|
|
@@ -6056,8 +6104,8 @@ var ApprovalTimeline = ({
|
|
|
6056
6104
|
compactMode = false,
|
|
6057
6105
|
showApproverInfo = true
|
|
6058
6106
|
}) => {
|
|
6059
|
-
const taskList =
|
|
6060
|
-
const groups =
|
|
6107
|
+
const taskList = useMemo9(() => Array.isArray(tasks) ? tasks : [], [tasks]);
|
|
6108
|
+
const groups = useMemo9(() => groupTasks(taskList), [taskList]);
|
|
6061
6109
|
if (taskList.length === 0) {
|
|
6062
6110
|
return /* @__PURE__ */ jsx9(
|
|
6063
6111
|
"div",
|
|
@@ -6203,7 +6251,7 @@ var ProcessPreview = ({
|
|
|
6203
6251
|
};
|
|
6204
6252
|
|
|
6205
6253
|
// packages/sdk/src/components/modules/InitiatorApproverSelector.tsx
|
|
6206
|
-
import { useCallback as useCallback7, useEffect as useEffect9, useMemo as
|
|
6254
|
+
import { useCallback as useCallback7, useEffect as useEffect9, useMemo as useMemo12, useRef as useRef4, useState as useState10 } from "react";
|
|
6207
6255
|
import { Button as Button7, Empty as Empty5, Modal as Modal4, Select, Space as Space2, Tag as Tag3, Typography as Typography4, message as message2 } from "antd";
|
|
6208
6256
|
|
|
6209
6257
|
// packages/sdk/src/components/core/processApi.ts
|
|
@@ -6567,7 +6615,7 @@ async function getViewPermission(request, params) {
|
|
|
6567
6615
|
}
|
|
6568
6616
|
|
|
6569
6617
|
// packages/sdk/src/components/fields/shared/UserPicker.tsx
|
|
6570
|
-
import { useCallback as useCallback6, useEffect as useEffect8, useMemo as
|
|
6618
|
+
import { useCallback as useCallback6, useEffect as useEffect8, useMemo as useMemo11, useState as useState9 } from "react";
|
|
6571
6619
|
import {
|
|
6572
6620
|
Avatar,
|
|
6573
6621
|
Button as Button6,
|
|
@@ -6586,7 +6634,7 @@ import { SearchOutlined, TeamOutlined, UserOutlined as UserOutlined3 } from "@an
|
|
|
6586
6634
|
import * as MobileAntd from "antd-mobile";
|
|
6587
6635
|
|
|
6588
6636
|
// packages/sdk/src/components/fields/shared/useLazyDepartmentTree.ts
|
|
6589
|
-
import { useCallback as useCallback5, useEffect as useEffect7, useMemo as
|
|
6637
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useMemo as useMemo10, useRef as useRef3, useState as useState8 } from "react";
|
|
6590
6638
|
var toLazyNode = (node) => {
|
|
6591
6639
|
const normalized = normalizeDepartmentNode(node);
|
|
6592
6640
|
const id = getDepartmentId(normalized);
|
|
@@ -6696,7 +6744,7 @@ function useLazyDepartmentTree(api, configuredTreeData) {
|
|
|
6696
6744
|
},
|
|
6697
6745
|
[api, setTreeData]
|
|
6698
6746
|
);
|
|
6699
|
-
const indexes =
|
|
6747
|
+
const indexes = useMemo10(() => buildIndexes(treeData), [treeData]);
|
|
6700
6748
|
useEffect7(() => {
|
|
6701
6749
|
void loadRootDepartments();
|
|
6702
6750
|
}, [loadRootDepartments]);
|
|
@@ -6757,7 +6805,7 @@ function UserPickerPanel({
|
|
|
6757
6805
|
const selectedIds = selected.map(getUserId);
|
|
6758
6806
|
const MobileSearchBar = getMobileComponent("SearchBar");
|
|
6759
6807
|
const activeMemberKeyword = (mobile ? mobileKeyword : memberKeyword).trim();
|
|
6760
|
-
const staticUsers =
|
|
6808
|
+
const staticUsers = useMemo11(() => normalizeUsers(dataSource), [dataSource]);
|
|
6761
6809
|
const hasStaticUserSource = staticUsers.length > 0;
|
|
6762
6810
|
useEffect8(() => {
|
|
6763
6811
|
if (mobile) return;
|
|
@@ -6850,7 +6898,7 @@ function UserPickerPanel({
|
|
|
6850
6898
|
memberReloadKey,
|
|
6851
6899
|
staticUsers
|
|
6852
6900
|
]);
|
|
6853
|
-
const currentPath =
|
|
6901
|
+
const currentPath = useMemo11(() => {
|
|
6854
6902
|
if (!currentDeptId) return [];
|
|
6855
6903
|
const path = [];
|
|
6856
6904
|
let cursor = currentDeptId;
|
|
@@ -6862,7 +6910,7 @@ function UserPickerPanel({
|
|
|
6862
6910
|
}
|
|
6863
6911
|
return path;
|
|
6864
6912
|
}, [currentDeptId, nodeMap, parentMap]);
|
|
6865
|
-
const mobileDepartments =
|
|
6913
|
+
const mobileDepartments = useMemo11(() => {
|
|
6866
6914
|
const keyword = mobileKeyword.trim().toLowerCase();
|
|
6867
6915
|
if (keyword) {
|
|
6868
6916
|
return flatNodes.filter((item) => item.name.toLowerCase().includes(keyword)).map((item) => item.node);
|
|
@@ -7127,7 +7175,7 @@ var RequirementSelect = ({
|
|
|
7127
7175
|
onChange
|
|
7128
7176
|
}) => {
|
|
7129
7177
|
const [pickerOpen, setPickerOpen] = useState10(false);
|
|
7130
|
-
const initialCandidates =
|
|
7178
|
+
const initialCandidates = useMemo12(
|
|
7131
7179
|
() => (requirement.candidateUsers || []).map(normalizeCandidate).filter(Boolean),
|
|
7132
7180
|
[requirement.candidateUsers]
|
|
7133
7181
|
);
|
|
@@ -7181,7 +7229,7 @@ var RequirementSelect = ({
|
|
|
7181
7229
|
void loadCandidates();
|
|
7182
7230
|
}
|
|
7183
7231
|
}, [appType, formUuid, loadCandidates, open, requirement.nodeId, requirement.scope]);
|
|
7184
|
-
const options =
|
|
7232
|
+
const options = useMemo12(
|
|
7185
7233
|
() => optionsSource.map((user) => ({
|
|
7186
7234
|
value: user.id,
|
|
7187
7235
|
label: getUserLabel(user)
|
|
@@ -7619,7 +7667,7 @@ var ProcessActionBar = ({
|
|
|
7619
7667
|
}
|
|
7620
7668
|
void actions.executeOperation(operation);
|
|
7621
7669
|
};
|
|
7622
|
-
const actionConfigs =
|
|
7670
|
+
const actionConfigs = useMemo13(
|
|
7623
7671
|
() => operations.map((operation) => ({
|
|
7624
7672
|
key: operation.key,
|
|
7625
7673
|
label: operation.label || operation.key,
|
|
@@ -7738,7 +7786,7 @@ import {
|
|
|
7738
7786
|
useCallback as useCallback10,
|
|
7739
7787
|
useContext as useContext2,
|
|
7740
7788
|
useEffect as useEffect12,
|
|
7741
|
-
useMemo as
|
|
7789
|
+
useMemo as useMemo15,
|
|
7742
7790
|
useRef as useRef6,
|
|
7743
7791
|
useState as useState13
|
|
7744
7792
|
} from "react";
|
|
@@ -8133,7 +8181,7 @@ var mountBrowserPageRuntime = async (options) => {
|
|
|
8133
8181
|
import {
|
|
8134
8182
|
useCallback as useCallback9,
|
|
8135
8183
|
useEffect as useEffect11,
|
|
8136
|
-
useMemo as
|
|
8184
|
+
useMemo as useMemo14,
|
|
8137
8185
|
useState as useState12
|
|
8138
8186
|
} from "react";
|
|
8139
8187
|
import {
|
|
@@ -8157,7 +8205,7 @@ import {
|
|
|
8157
8205
|
import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
8158
8206
|
var useAuth = (options = {}) => {
|
|
8159
8207
|
const runtime = useOpenXiangda();
|
|
8160
|
-
const client =
|
|
8208
|
+
const client = useMemo14(
|
|
8161
8209
|
() => createAuthClient({
|
|
8162
8210
|
appType: options.appType || runtime.appType,
|
|
8163
8211
|
servicePrefix: options.servicePrefix || runtime.servicePrefix,
|
|
@@ -8172,7 +8220,7 @@ var useAuth = (options = {}) => {
|
|
|
8172
8220
|
runtime.servicePrefix
|
|
8173
8221
|
]
|
|
8174
8222
|
);
|
|
8175
|
-
return
|
|
8223
|
+
return useMemo14(
|
|
8176
8224
|
() => ({
|
|
8177
8225
|
client,
|
|
8178
8226
|
getMethods: client.getMethods,
|
|
@@ -8272,7 +8320,7 @@ var LoginPage = ({
|
|
|
8272
8320
|
const ssoMethod = findMethod(methods, "sso");
|
|
8273
8321
|
const guestMethod = findMethod(methods, "guest");
|
|
8274
8322
|
const allowRegister = methodsState.data?.registration?.mode !== "reject";
|
|
8275
|
-
const tabItems =
|
|
8323
|
+
const tabItems = useMemo14(() => {
|
|
8276
8324
|
const items = [];
|
|
8277
8325
|
if (passwordMethod) {
|
|
8278
8326
|
items.push({
|
|
@@ -8738,8 +8786,8 @@ var OpenXiangdaProvider = ({
|
|
|
8738
8786
|
fetchImpl,
|
|
8739
8787
|
children
|
|
8740
8788
|
}) => {
|
|
8741
|
-
const resolvedFetch =
|
|
8742
|
-
const resolvedAppType =
|
|
8789
|
+
const resolvedFetch = useMemo15(() => createBoundFetch(fetchImpl), [fetchImpl]);
|
|
8790
|
+
const resolvedAppType = useMemo15(
|
|
8743
8791
|
() => appType || resolveAppTypeFromLocation(),
|
|
8744
8792
|
[appType]
|
|
8745
8793
|
);
|
|
@@ -8853,7 +8901,7 @@ var OpenXiangdaProvider = ({
|
|
|
8853
8901
|
}
|
|
8854
8902
|
return refreshRequestRef.current;
|
|
8855
8903
|
}, [applyAccessToken, resolvedAppType, resolvedFetch, servicePrefix]);
|
|
8856
|
-
const authorizedFetch =
|
|
8904
|
+
const authorizedFetch = useMemo15(
|
|
8857
8905
|
() => createAuthorizedFetch({
|
|
8858
8906
|
appType: resolvedAppType,
|
|
8859
8907
|
baseFetch: resolvedFetch,
|
|
@@ -8941,7 +8989,7 @@ var OpenXiangdaProvider = ({
|
|
|
8941
8989
|
useEffect12(() => {
|
|
8942
8990
|
void reload();
|
|
8943
8991
|
}, [reload]);
|
|
8944
|
-
const value =
|
|
8992
|
+
const value = useMemo15(
|
|
8945
8993
|
() => ({
|
|
8946
8994
|
...state,
|
|
8947
8995
|
appType: resolvedAppType,
|
|
@@ -8984,7 +9032,7 @@ var OpenXiangdaPageProvider = ({
|
|
|
8984
9032
|
navigation
|
|
8985
9033
|
}) => {
|
|
8986
9034
|
const runtime = useOpenXiangda();
|
|
8987
|
-
const context =
|
|
9035
|
+
const context = useMemo15(() => {
|
|
8988
9036
|
const bootstrap = runtime.data;
|
|
8989
9037
|
const app = toRuntimeRecord(bootstrap?.app);
|
|
8990
9038
|
const user = toRuntimeRecord(bootstrap?.user);
|
|
@@ -9310,7 +9358,7 @@ var useRuntimeAuth = () => {
|
|
|
9310
9358
|
},
|
|
9311
9359
|
[logout, redirectToLogin]
|
|
9312
9360
|
);
|
|
9313
|
-
return
|
|
9361
|
+
return useMemo15(
|
|
9314
9362
|
() => ({
|
|
9315
9363
|
logout,
|
|
9316
9364
|
logoutAndRedirect,
|
|
@@ -9680,7 +9728,7 @@ var resolveAppTypeFromLocation = () => {
|
|
|
9680
9728
|
};
|
|
9681
9729
|
|
|
9682
9730
|
// packages/sdk/src/runtime/react/publicAccess.tsx
|
|
9683
|
-
import { useCallback as useCallback11, useEffect as useEffect13, useMemo as
|
|
9731
|
+
import { useCallback as useCallback11, useEffect as useEffect13, useMemo as useMemo16, useRef as useRef7, useState as useState14 } from "react";
|
|
9684
9732
|
import { Fragment as Fragment7, jsx as jsx16 } from "react/jsx-runtime";
|
|
9685
9733
|
var usePublicAccess = (options = {}) => {
|
|
9686
9734
|
const runtime = useOpenXiangda();
|
|
@@ -9704,8 +9752,8 @@ var usePublicAccess = (options = {}) => {
|
|
|
9704
9752
|
const activeSessionRef = useRef7(null);
|
|
9705
9753
|
const mountedRef = useRef7(true);
|
|
9706
9754
|
const sessionInputKey = JSON.stringify(sessionInput);
|
|
9707
|
-
const stableSessionInput =
|
|
9708
|
-
const client =
|
|
9755
|
+
const stableSessionInput = useMemo16(() => sessionInput, [sessionInputKey]);
|
|
9756
|
+
const client = useMemo16(
|
|
9709
9757
|
() => createPublicAccessClient({
|
|
9710
9758
|
appType,
|
|
9711
9759
|
servicePrefix,
|
|
@@ -9805,11 +9853,11 @@ var readTicketFromLocation = () => {
|
|
|
9805
9853
|
var readPathFromLocation = () => typeof window === "undefined" ? void 0 : window.location.pathname;
|
|
9806
9854
|
|
|
9807
9855
|
// packages/sdk/src/runtime/host/builtinRouteRenderer.tsx
|
|
9808
|
-
import { useCallback as useCallback29, useEffect as useEffect54, useMemo as
|
|
9856
|
+
import { useCallback as useCallback29, useEffect as useEffect54, useMemo as useMemo41, useState as useState46 } from "react";
|
|
9809
9857
|
import { Alert as Alert7, Button as Button19, Card as Card2, Empty as Empty11, Spin as Spin9, Typography as Typography6 } from "antd";
|
|
9810
9858
|
|
|
9811
9859
|
// packages/sdk/src/components/modules/DataManagementList.tsx
|
|
9812
|
-
import { useCallback as useCallback28, useEffect as useEffect53, useMemo as
|
|
9860
|
+
import { useCallback as useCallback28, useEffect as useEffect53, useMemo as useMemo40, useRef as useRef24, useState as useState45 } from "react";
|
|
9813
9861
|
import {
|
|
9814
9862
|
Alert as Alert6,
|
|
9815
9863
|
Button as Button18,
|
|
@@ -9848,14 +9896,14 @@ import {
|
|
|
9848
9896
|
} from "@ant-design/icons";
|
|
9849
9897
|
|
|
9850
9898
|
// packages/sdk/src/components/templates/StandardFormPage.tsx
|
|
9851
|
-
import { useMemo as
|
|
9899
|
+
import { useMemo as useMemo39 } from "react";
|
|
9852
9900
|
|
|
9853
9901
|
// packages/sdk/src/components/templates/FormDetailTemplate.tsx
|
|
9854
|
-
import { useCallback as useCallback20, useMemo as
|
|
9902
|
+
import { useCallback as useCallback20, useMemo as useMemo34, useRef as useRef18, useState as useState37 } from "react";
|
|
9855
9903
|
import dayjs10 from "dayjs";
|
|
9856
9904
|
|
|
9857
9905
|
// packages/sdk/src/components/core/FormProvider.tsx
|
|
9858
|
-
import React58, { useCallback as useCallback17, useEffect as useEffect44, useRef as useRef15, useState as useState30, useMemo as
|
|
9906
|
+
import React58, { useCallback as useCallback17, useEffect as useEffect44, useRef as useRef15, useState as useState30, useMemo as useMemo32 } from "react";
|
|
9859
9907
|
|
|
9860
9908
|
// packages/sdk/src/components/core/FormContext.ts
|
|
9861
9909
|
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
@@ -10626,7 +10674,7 @@ function TextAreaField(props) {
|
|
|
10626
10674
|
import { useEffect as useEffect19 } from "react";
|
|
10627
10675
|
|
|
10628
10676
|
// packages/sdk/src/components/fields/SelectField/SelectFieldPC.tsx
|
|
10629
|
-
import { useMemo as
|
|
10677
|
+
import { useMemo as useMemo18 } from "react";
|
|
10630
10678
|
import { Select as Select3 } from "antd";
|
|
10631
10679
|
|
|
10632
10680
|
// packages/sdk/src/components/fields/shared/optionDisplay.tsx
|
|
@@ -10701,7 +10749,7 @@ function renderReadonlyOptions(options, coloredOptions, tagWhenPlain = false) {
|
|
|
10701
10749
|
}
|
|
10702
10750
|
|
|
10703
10751
|
// packages/sdk/src/components/fields/SelectField/useLinkedFormRemoteOptions.ts
|
|
10704
|
-
import { useCallback as useCallback12, useEffect as useEffect17, useMemo as
|
|
10752
|
+
import { useCallback as useCallback12, useEffect as useEffect17, useMemo as useMemo17, useRef as useRef8, useState as useState15 } from "react";
|
|
10705
10753
|
|
|
10706
10754
|
// packages/sdk/src/components/core/optionSource.ts
|
|
10707
10755
|
var DEFAULT_OPTION_PAGE_SIZE = 200;
|
|
@@ -10964,7 +11012,7 @@ function useLinkedFormRemoteOptions(optionSource, baseOptions, selectedOptions)
|
|
|
10964
11012
|
},
|
|
10965
11013
|
[]
|
|
10966
11014
|
);
|
|
10967
|
-
const options =
|
|
11015
|
+
const options = useMemo17(
|
|
10968
11016
|
() => mergeOptionItems(remoteOptions ?? baseOptions, selectedOptions),
|
|
10969
11017
|
[baseOptions, remoteOptions, selectedOptions]
|
|
10970
11018
|
);
|
|
@@ -11012,7 +11060,7 @@ function SelectFieldPC({
|
|
|
11012
11060
|
const { formData, setFieldValue } = useFormContext();
|
|
11013
11061
|
const value = controlledValue !== void 0 ? controlledValue : formData[fieldId];
|
|
11014
11062
|
const disabled = behavior === "DISABLED";
|
|
11015
|
-
const selectedOptions =
|
|
11063
|
+
const selectedOptions = useMemo18(() => value ? [value] : [], [value]);
|
|
11016
11064
|
const remote = useLinkedFormRemoteOptions(optionSource, options, selectedOptions);
|
|
11017
11065
|
const displayOptions = remote.options;
|
|
11018
11066
|
const handleChange = (val) => {
|
|
@@ -11053,7 +11101,7 @@ function SelectFieldPC({
|
|
|
11053
11101
|
}
|
|
11054
11102
|
|
|
11055
11103
|
// packages/sdk/src/components/fields/SelectField/SelectFieldMobile.tsx
|
|
11056
|
-
import { useEffect as useEffect18, useMemo as
|
|
11104
|
+
import { useEffect as useEffect18, useMemo as useMemo19, useState as useState16 } from "react";
|
|
11057
11105
|
|
|
11058
11106
|
// packages/sdk/src/components/fields/shared/MobileField.tsx
|
|
11059
11107
|
import { Popup } from "antd-mobile";
|
|
@@ -11237,7 +11285,7 @@ function SelectFieldMobile({
|
|
|
11237
11285
|
const [visible, setVisible] = useState16(false);
|
|
11238
11286
|
const [search, setSearch] = useState16("");
|
|
11239
11287
|
const [tempValue, setTempValue] = useState16(value ?? null);
|
|
11240
|
-
const selectedOptions =
|
|
11288
|
+
const selectedOptions = useMemo19(() => value ? [value] : tempValue ? [tempValue] : [], [
|
|
11241
11289
|
tempValue,
|
|
11242
11290
|
value
|
|
11243
11291
|
]);
|
|
@@ -11248,7 +11296,7 @@ function SelectFieldMobile({
|
|
|
11248
11296
|
reset: resetRemoteOptions,
|
|
11249
11297
|
search: searchRemoteOptions
|
|
11250
11298
|
} = useLinkedFormRemoteOptions(optionSource, options, selectedOptions);
|
|
11251
|
-
const filteredOptions =
|
|
11299
|
+
const filteredOptions = useMemo19(() => {
|
|
11252
11300
|
if (remoteEnabled) return remoteOptions;
|
|
11253
11301
|
const keyword = search.trim().toLowerCase();
|
|
11254
11302
|
if (!keyword) return options;
|
|
@@ -11453,7 +11501,7 @@ function MultiSelectFieldPC({
|
|
|
11453
11501
|
}
|
|
11454
11502
|
|
|
11455
11503
|
// packages/sdk/src/components/fields/MultiSelectField/MultiSelectFieldMobile.tsx
|
|
11456
|
-
import { useMemo as
|
|
11504
|
+
import { useMemo as useMemo20, useState as useState17 } from "react";
|
|
11457
11505
|
import { jsx as jsx37, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
11458
11506
|
function MultiSelectFieldMobile({
|
|
11459
11507
|
fieldId,
|
|
@@ -11473,14 +11521,14 @@ function MultiSelectFieldMobile({
|
|
|
11473
11521
|
const [visible, setVisible] = useState17(false);
|
|
11474
11522
|
const [search, setSearch] = useState17("");
|
|
11475
11523
|
const [tempValues, setTempValues] = useState17(value);
|
|
11476
|
-
const filteredOptions =
|
|
11524
|
+
const filteredOptions = useMemo20(() => {
|
|
11477
11525
|
const keyword = search.trim().toLowerCase();
|
|
11478
11526
|
if (!keyword) return options;
|
|
11479
11527
|
return options.filter(
|
|
11480
11528
|
(option) => String(option.label ?? option.value).toLowerCase().includes(keyword)
|
|
11481
11529
|
);
|
|
11482
11530
|
}, [options, search]);
|
|
11483
|
-
const tempValueSet =
|
|
11531
|
+
const tempValueSet = useMemo20(
|
|
11484
11532
|
() => new Set(tempValues.map((option) => option.value)),
|
|
11485
11533
|
[tempValues]
|
|
11486
11534
|
);
|
|
@@ -14294,7 +14342,7 @@ function ImageField(props) {
|
|
|
14294
14342
|
import { useEffect as useEffect27 } from "react";
|
|
14295
14343
|
|
|
14296
14344
|
// packages/sdk/src/components/fields/SubFormField/SubFormCell.tsx
|
|
14297
|
-
import { useMemo as
|
|
14345
|
+
import { useMemo as useMemo21 } from "react";
|
|
14298
14346
|
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
14299
14347
|
var stringifyFallbackValue = (value) => {
|
|
14300
14348
|
if (value === void 0 || value === null) return "";
|
|
@@ -14315,7 +14363,7 @@ function SubFormCell({
|
|
|
14315
14363
|
const scopedFieldId = `${parentFieldId}.${rowIndex}.${column.fieldId}`;
|
|
14316
14364
|
const cellValue = row[column.fieldId];
|
|
14317
14365
|
const resolvedBehavior = behavior === "DISABLED" || behavior === "READONLY" ? behavior : column.behavior ?? behavior ?? "NORMAL";
|
|
14318
|
-
const childContext =
|
|
14366
|
+
const childContext = useMemo21(
|
|
14319
14367
|
() => ({
|
|
14320
14368
|
...parentContext,
|
|
14321
14369
|
formData: {
|
|
@@ -14637,7 +14685,7 @@ function SubFormField(props) {
|
|
|
14637
14685
|
import { useEffect as useEffect31 } from "react";
|
|
14638
14686
|
|
|
14639
14687
|
// packages/sdk/src/components/fields/UserSelectField/UserSelectFieldPC.tsx
|
|
14640
|
-
import { useEffect as useEffect28, useMemo as
|
|
14688
|
+
import { useEffect as useEffect28, useMemo as useMemo22, useState as useState20 } from "react";
|
|
14641
14689
|
import { Select as Select5 } from "antd";
|
|
14642
14690
|
import { jsx as jsx71, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
14643
14691
|
function UserSelectFieldPC({
|
|
@@ -14657,7 +14705,7 @@ function UserSelectFieldPC({
|
|
|
14657
14705
|
}) {
|
|
14658
14706
|
const { formData, setFieldValue, api } = useFormContext();
|
|
14659
14707
|
const rawValue = formData[fieldId];
|
|
14660
|
-
const value =
|
|
14708
|
+
const value = useMemo22(() => normalizeUserArray(rawValue), [rawValue]);
|
|
14661
14709
|
const disabled = behavior === "DISABLED";
|
|
14662
14710
|
const [optionsSource, setOptionsSource] = useState20(
|
|
14663
14711
|
() => dataSource.map(normalizeUser)
|
|
@@ -14751,7 +14799,7 @@ function UserSelectFieldPC({
|
|
|
14751
14799
|
setFieldValue(fieldId, normalized);
|
|
14752
14800
|
onChange?.(normalized);
|
|
14753
14801
|
};
|
|
14754
|
-
const options =
|
|
14802
|
+
const options = useMemo22(
|
|
14755
14803
|
() => optionsSource.map((u) => ({
|
|
14756
14804
|
value: getUserId(u),
|
|
14757
14805
|
label: formatUserDisplay(u, displayFormat)
|
|
@@ -14815,7 +14863,7 @@ function getUserNameLikeId(user) {
|
|
|
14815
14863
|
}
|
|
14816
14864
|
|
|
14817
14865
|
// packages/sdk/src/components/fields/UserSelectField/UserSelectFieldMobile.tsx
|
|
14818
|
-
import { useEffect as useEffect29, useMemo as
|
|
14866
|
+
import { useEffect as useEffect29, useMemo as useMemo23, useState as useState21 } from "react";
|
|
14819
14867
|
import * as MobileAntd2 from "antd-mobile";
|
|
14820
14868
|
import { jsx as jsx72, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
14821
14869
|
var getMobilePopup = () => {
|
|
@@ -14840,7 +14888,7 @@ function UserSelectFieldMobile({
|
|
|
14840
14888
|
}) {
|
|
14841
14889
|
const { formData, setFieldValue, api } = useFormContext();
|
|
14842
14890
|
const rawValue = formData[fieldId];
|
|
14843
|
-
const value =
|
|
14891
|
+
const value = useMemo23(() => normalizeUserArray(rawValue), [rawValue]);
|
|
14844
14892
|
const disabled = behavior === "DISABLED";
|
|
14845
14893
|
const [showPicker, setShowPicker] = useState21(false);
|
|
14846
14894
|
const [optionsSource, setOptionsSource] = useState21(
|
|
@@ -14948,7 +14996,7 @@ function UserSelectFieldMobile({
|
|
|
14948
14996
|
}
|
|
14949
14997
|
|
|
14950
14998
|
// packages/sdk/src/components/fields/UserSelectField/UserSelectFieldReadonly.tsx
|
|
14951
|
-
import { useEffect as useEffect30, useMemo as
|
|
14999
|
+
import { useEffect as useEffect30, useMemo as useMemo24 } from "react";
|
|
14952
15000
|
import { jsx as jsx73 } from "react/jsx-runtime";
|
|
14953
15001
|
function UserSelectFieldReadonly({
|
|
14954
15002
|
fieldId,
|
|
@@ -14957,7 +15005,7 @@ function UserSelectFieldReadonly({
|
|
|
14957
15005
|
}) {
|
|
14958
15006
|
const { formData, setFieldValue, api } = useFormContext();
|
|
14959
15007
|
const rawValue = formData[fieldId];
|
|
14960
|
-
const value =
|
|
15008
|
+
const value = useMemo24(() => normalizeUserArray(rawValue), [rawValue]);
|
|
14961
15009
|
useEffect30(() => {
|
|
14962
15010
|
const missing = value.filter((item) => getUserNameLikeId2(item));
|
|
14963
15011
|
if (missing.length === 0) return;
|
|
@@ -15038,7 +15086,7 @@ function UserSelectField(props) {
|
|
|
15038
15086
|
import { useEffect as useEffect35 } from "react";
|
|
15039
15087
|
|
|
15040
15088
|
// packages/sdk/src/components/fields/DepartmentSelectField/DepartmentSelectFieldPC.tsx
|
|
15041
|
-
import { useEffect as useEffect33, useMemo as
|
|
15089
|
+
import { useEffect as useEffect33, useMemo as useMemo26, useRef as useRef10, useState as useState23 } from "react";
|
|
15042
15090
|
import { TreeSelect } from "antd";
|
|
15043
15091
|
|
|
15044
15092
|
// packages/sdk/src/components/fields/shared/departmentSearch.ts
|
|
@@ -15057,7 +15105,7 @@ function getDepartmentPathText(department, separator = "/") {
|
|
|
15057
15105
|
}
|
|
15058
15106
|
|
|
15059
15107
|
// packages/sdk/src/components/fields/shared/DepartmentPicker.tsx
|
|
15060
|
-
import { useEffect as useEffect32, useMemo as
|
|
15108
|
+
import { useEffect as useEffect32, useMemo as useMemo25, useRef as useRef9, useState as useState22 } from "react";
|
|
15061
15109
|
import { Button as Button9, Checkbox as Checkbox3, Empty as Empty7, Input as Input8, List as List2, Modal as Modal6, Space as Space4, Spin as Spin5, Tag as Tag5, Tree as Tree2 } from "antd";
|
|
15062
15110
|
import { ApartmentOutlined, SearchOutlined as SearchOutlined3 } from "@ant-design/icons";
|
|
15063
15111
|
import * as MobileAntd3 from "antd-mobile";
|
|
@@ -15158,11 +15206,11 @@ function DepartmentPickerPanel({
|
|
|
15158
15206
|
window.clearTimeout(timer);
|
|
15159
15207
|
};
|
|
15160
15208
|
}, [api, canRemoteSearch, searchDebounceMs, trimmedKeyword]);
|
|
15161
|
-
const filteredTreeData =
|
|
15209
|
+
const filteredTreeData = useMemo25(
|
|
15162
15210
|
() => showSearch ? matchSearch(loadedTreeData, trimmedKeyword) : loadedTreeData,
|
|
15163
15211
|
[loadedTreeData, showSearch, trimmedKeyword]
|
|
15164
15212
|
);
|
|
15165
|
-
const currentPath =
|
|
15213
|
+
const currentPath = useMemo25(() => {
|
|
15166
15214
|
if (!currentDeptId) return [];
|
|
15167
15215
|
const path = [];
|
|
15168
15216
|
let cursor = currentDeptId;
|
|
@@ -15174,7 +15222,7 @@ function DepartmentPickerPanel({
|
|
|
15174
15222
|
}
|
|
15175
15223
|
return path;
|
|
15176
15224
|
}, [currentDeptId, nodeMap, parentMap]);
|
|
15177
|
-
const mobileList =
|
|
15225
|
+
const mobileList = useMemo25(() => {
|
|
15178
15226
|
if (canRemoteSearch) {
|
|
15179
15227
|
return remoteSearchResults;
|
|
15180
15228
|
}
|
|
@@ -15492,7 +15540,7 @@ function DepartmentSelectFieldPC({
|
|
|
15492
15540
|
}) {
|
|
15493
15541
|
const { formData, setFieldValue, api } = useFormContext();
|
|
15494
15542
|
const rawValue = formData[fieldId];
|
|
15495
|
-
const value =
|
|
15543
|
+
const value = useMemo26(() => normalizeDepartmentArray(rawValue), [rawValue]);
|
|
15496
15544
|
const disabled = behavior === "DISABLED";
|
|
15497
15545
|
const configuredTreeData = treeData ?? EMPTY_TREE_DATA;
|
|
15498
15546
|
const remoteLoadedRef = useRef10(false);
|
|
@@ -15550,7 +15598,7 @@ function DepartmentSelectFieldPC({
|
|
|
15550
15598
|
}, [api, canRemoteSearch, searchDebounceMs, trimmedSearchKeyword]);
|
|
15551
15599
|
const scopedTreeData = filterTreeByScope(loadedTreeData, scopeType, specifiedDepts);
|
|
15552
15600
|
const allDepts = flattenDepartments(scopedTreeData);
|
|
15553
|
-
const scopedRemoteSearchResults =
|
|
15601
|
+
const scopedRemoteSearchResults = useMemo26(() => {
|
|
15554
15602
|
if (scopeType !== "specified" || !specifiedDepts?.length) {
|
|
15555
15603
|
return remoteSearchResults;
|
|
15556
15604
|
}
|
|
@@ -15561,7 +15609,7 @@ function DepartmentSelectFieldPC({
|
|
|
15561
15609
|
return node.path?.some((item) => specifiedSet.has(item.id));
|
|
15562
15610
|
});
|
|
15563
15611
|
}, [remoteSearchResults, scopeType, specifiedDepts]);
|
|
15564
|
-
const remoteDeptMap =
|
|
15612
|
+
const remoteDeptMap = useMemo26(() => {
|
|
15565
15613
|
const map = /* @__PURE__ */ new Map();
|
|
15566
15614
|
scopedRemoteSearchResults.forEach((node) => map.set(getDepartmentId(node), node));
|
|
15567
15615
|
return map;
|
|
@@ -15690,7 +15738,7 @@ function DepartmentSelectFieldPC({
|
|
|
15690
15738
|
}
|
|
15691
15739
|
|
|
15692
15740
|
// packages/sdk/src/components/fields/DepartmentSelectField/DepartmentSelectFieldMobile.tsx
|
|
15693
|
-
import { useEffect as useEffect34, useMemo as
|
|
15741
|
+
import { useEffect as useEffect34, useMemo as useMemo27, useRef as useRef11, useState as useState24 } from "react";
|
|
15694
15742
|
import * as MobileAntd4 from "antd-mobile";
|
|
15695
15743
|
import { jsx as jsx77, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
15696
15744
|
var EMPTY_TREE_DATA2 = [];
|
|
@@ -15725,7 +15773,7 @@ function DepartmentSelectFieldMobile({
|
|
|
15725
15773
|
}) {
|
|
15726
15774
|
const { formData, setFieldValue, api } = useFormContext();
|
|
15727
15775
|
const rawValue = formData[fieldId];
|
|
15728
|
-
const value =
|
|
15776
|
+
const value = useMemo27(() => normalizeDepartmentArray(rawValue), [rawValue]);
|
|
15729
15777
|
const disabled = behavior === "DISABLED";
|
|
15730
15778
|
const [showPicker, setShowPicker] = useState24(false);
|
|
15731
15779
|
const configuredTreeData = treeData ?? EMPTY_TREE_DATA2;
|
|
@@ -15830,7 +15878,7 @@ function DepartmentSelectFieldMobile({
|
|
|
15830
15878
|
}
|
|
15831
15879
|
|
|
15832
15880
|
// packages/sdk/src/components/fields/DepartmentSelectField/DepartmentSelectFieldReadonly.tsx
|
|
15833
|
-
import { useMemo as
|
|
15881
|
+
import { useMemo as useMemo28 } from "react";
|
|
15834
15882
|
import { jsx as jsx78 } from "react/jsx-runtime";
|
|
15835
15883
|
function DepartmentSelectFieldReadonly({
|
|
15836
15884
|
fieldId,
|
|
@@ -15840,7 +15888,7 @@ function DepartmentSelectFieldReadonly({
|
|
|
15840
15888
|
}) {
|
|
15841
15889
|
const { formData } = useFormContext();
|
|
15842
15890
|
const rawValue = formData[fieldId];
|
|
15843
|
-
const value =
|
|
15891
|
+
const value = useMemo28(() => normalizeDepartmentArray(rawValue), [rawValue]);
|
|
15844
15892
|
const display = value.length > 0 ? value.map(
|
|
15845
15893
|
(d) => showFullPath ? getDepartmentFullPath(getDepartmentId(d), treeData) || getDepartmentName(d) : getDepartmentName(d)
|
|
15846
15894
|
).join(", ") : "--";
|
|
@@ -15988,7 +16036,7 @@ function CascadeSelectField(props) {
|
|
|
15988
16036
|
}
|
|
15989
16037
|
|
|
15990
16038
|
// packages/sdk/src/components/fields/AddressField/index.tsx
|
|
15991
|
-
import { useCallback as useCallback13, useEffect as useEffect37, useMemo as
|
|
16039
|
+
import { useCallback as useCallback13, useEffect as useEffect37, useMemo as useMemo29, useState as useState25 } from "react";
|
|
15992
16040
|
import { Button as Button10, Cascader as Cascader2, Input as Input9, Space as Space5, Spin as Spin6 } from "antd";
|
|
15993
16041
|
import * as MobileAntd5 from "antd-mobile";
|
|
15994
16042
|
import { jsx as jsx81, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
@@ -16134,7 +16182,7 @@ function AddressField(props) {
|
|
|
16134
16182
|
const { isMobile } = useDeviceDetect();
|
|
16135
16183
|
const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
|
|
16136
16184
|
const rawValue = formData[fieldId];
|
|
16137
|
-
const value =
|
|
16185
|
+
const value = useMemo29(() => normalizeAddressValue(rawValue), [rawValue]);
|
|
16138
16186
|
const [options, setOptions] = useState25([]);
|
|
16139
16187
|
const [loadingRoots, setLoadingRoots] = useState25(false);
|
|
16140
16188
|
const [mobileOpen, setMobileOpen] = useState25(false);
|
|
@@ -16143,9 +16191,9 @@ function AddressField(props) {
|
|
|
16143
16191
|
const [mobileLoading, setMobileLoading] = useState25(false);
|
|
16144
16192
|
const [tempValue, setTempValue] = useState25();
|
|
16145
16193
|
const depth = modeDepth(mode);
|
|
16146
|
-
const levels =
|
|
16147
|
-
const valuePath =
|
|
16148
|
-
const displayOptions =
|
|
16194
|
+
const levels = useMemo29(() => activeLevels(mode), [mode]);
|
|
16195
|
+
const valuePath = useMemo29(() => valueToPath(value, levels), [levels, value]);
|
|
16196
|
+
const displayOptions = useMemo29(
|
|
16149
16197
|
() => mergeValuePathIntoOptions(options, value, levels, depth),
|
|
16150
16198
|
[depth, levels, options, value]
|
|
16151
16199
|
);
|
|
@@ -16396,7 +16444,7 @@ function AddressField(props) {
|
|
|
16396
16444
|
}
|
|
16397
16445
|
|
|
16398
16446
|
// packages/sdk/src/components/fields/AssociationFormField/index.tsx
|
|
16399
|
-
import { useCallback as useCallback14, useEffect as useEffect38, useMemo as
|
|
16447
|
+
import { useCallback as useCallback14, useEffect as useEffect38, useMemo as useMemo30, useRef as useRef12, useState as useState26 } from "react";
|
|
16400
16448
|
import { Button as Button11, Drawer, Input as Input10, Modal as Modal7, Select as Select6, Space as Space6, Spin as Spin7, Table as Table2, Tag as Tag6 } from "antd";
|
|
16401
16449
|
import { jsx as jsx82, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
16402
16450
|
var DEFAULT_PAGE_SIZE = 10;
|
|
@@ -16459,7 +16507,7 @@ function AssociationFormField(props) {
|
|
|
16459
16507
|
const { isMobile } = useDeviceDetect();
|
|
16460
16508
|
const behavior = propBehavior ?? fieldBehaviors[fieldId] ?? "NORMAL";
|
|
16461
16509
|
const rawValue = formData[fieldId];
|
|
16462
|
-
const value =
|
|
16510
|
+
const value = useMemo30(() => normalizeValues(rawValue), [rawValue]);
|
|
16463
16511
|
const disabled = behavior === "DISABLED";
|
|
16464
16512
|
const [options, setOptions] = useState26([]);
|
|
16465
16513
|
const [selectLoading, setSelectLoading] = useState26(false);
|
|
@@ -16493,11 +16541,11 @@ function AssociationFormField(props) {
|
|
|
16493
16541
|
const associationFormUuid = associationForm?.formUuid;
|
|
16494
16542
|
const associationMainFieldId = associationForm?.mainFieldId;
|
|
16495
16543
|
const canQuery = Boolean(associationAppType && associationFormUuid);
|
|
16496
|
-
const filterRulesKey =
|
|
16544
|
+
const filterRulesKey = useMemo30(
|
|
16497
16545
|
() => stableSerialize(associationForm?.dataFilterRules || []),
|
|
16498
16546
|
[associationForm?.dataFilterRules]
|
|
16499
16547
|
);
|
|
16500
|
-
const currentFieldFilterKey =
|
|
16548
|
+
const currentFieldFilterKey = useMemo30(() => {
|
|
16501
16549
|
const rules = associationForm?.dataFilterRules || [];
|
|
16502
16550
|
return stableSerialize(
|
|
16503
16551
|
rules.map((rule) => {
|
|
@@ -16506,7 +16554,7 @@ function AssociationFormField(props) {
|
|
|
16506
16554
|
})
|
|
16507
16555
|
);
|
|
16508
16556
|
}, [formData, associationForm?.dataFilterRules]);
|
|
16509
|
-
const filterDependencyKey =
|
|
16557
|
+
const filterDependencyKey = useMemo30(
|
|
16510
16558
|
() => `${filterRulesKey}:${currentFieldFilterKey}`,
|
|
16511
16559
|
[currentFieldFilterKey, filterRulesKey]
|
|
16512
16560
|
);
|
|
@@ -16635,7 +16683,7 @@ function AssociationFormField(props) {
|
|
|
16635
16683
|
},
|
|
16636
16684
|
[applyDataFilling, fieldId, multiple, onChange, setFieldValue]
|
|
16637
16685
|
);
|
|
16638
|
-
const selectorColumns =
|
|
16686
|
+
const selectorColumns = useMemo30(() => {
|
|
16639
16687
|
const configured = associationForm?.selectorColumns || [];
|
|
16640
16688
|
if (configured.length) {
|
|
16641
16689
|
return configured.map((column) => {
|
|
@@ -16670,7 +16718,7 @@ function AssociationFormField(props) {
|
|
|
16670
16718
|
}
|
|
16671
16719
|
];
|
|
16672
16720
|
}, [associationForm?.mainFieldId, associationForm?.selectorColumns]);
|
|
16673
|
-
const selectOptions =
|
|
16721
|
+
const selectOptions = useMemo30(
|
|
16674
16722
|
() => [...options, ...value].filter(
|
|
16675
16723
|
(item, index, list) => list.findIndex((candidate) => candidate.value === item.value) === index
|
|
16676
16724
|
).map((item) => ({ label: item.label, value: item.value })),
|
|
@@ -16878,7 +16926,7 @@ function AssociationFormField(props) {
|
|
|
16878
16926
|
}
|
|
16879
16927
|
|
|
16880
16928
|
// packages/sdk/src/components/fields/EditorField/index.tsx
|
|
16881
|
-
import { useCallback as useCallback15, useEffect as useEffect39, useMemo as
|
|
16929
|
+
import { useCallback as useCallback15, useEffect as useEffect39, useMemo as useMemo31, useRef as useRef13, useState as useState27 } from "react";
|
|
16882
16930
|
import { Extension } from "@tiptap/core";
|
|
16883
16931
|
import { EditorContent, useEditor } from "@tiptap/react";
|
|
16884
16932
|
import StarterKit from "@tiptap/starter-kit";
|
|
@@ -17551,9 +17599,9 @@ function RichTextEditorCore({
|
|
|
17551
17599
|
useEffect39(() => {
|
|
17552
17600
|
onChangeRef.current = onChange;
|
|
17553
17601
|
}, [onChange]);
|
|
17554
|
-
const actions =
|
|
17602
|
+
const actions = useMemo31(() => normalizeToolbarConfig(toolbarConfig), [toolbarConfig]);
|
|
17555
17603
|
const visibleActions = mobile ? [] : actions;
|
|
17556
|
-
const extensions =
|
|
17604
|
+
const extensions = useMemo31(
|
|
17557
17605
|
() => [
|
|
17558
17606
|
StarterKit.configure({
|
|
17559
17607
|
heading: { levels: [1, 2, 3] },
|
|
@@ -18995,9 +19043,9 @@ function FormProvider({
|
|
|
18995
19043
|
runtime,
|
|
18996
19044
|
children
|
|
18997
19045
|
}) {
|
|
18998
|
-
const api =
|
|
19046
|
+
const api = useMemo32(() => createFormRuntimeApi(config.api), [config.api]);
|
|
18999
19047
|
const [runtimeDefaults, setRuntimeDefaults] = useState30({});
|
|
19000
|
-
const effects =
|
|
19048
|
+
const effects = useMemo32(
|
|
19001
19049
|
() => [
|
|
19002
19050
|
...schema.rules ?? [],
|
|
19003
19051
|
...schema.fields.flatMap((field) => field.optionEffects ?? []),
|
|
@@ -19005,18 +19053,18 @@ function FormProvider({
|
|
|
19005
19053
|
],
|
|
19006
19054
|
[schema.rules, schema.fields, config.effects]
|
|
19007
19055
|
);
|
|
19008
|
-
const defaultRuntime =
|
|
19056
|
+
const defaultRuntime = useMemo32(
|
|
19009
19057
|
() => ({
|
|
19010
19058
|
appType: config.appType,
|
|
19011
19059
|
fetchFormData: (params) => fetchRuntimeFormData(api, config.appType, params)
|
|
19012
19060
|
}),
|
|
19013
19061
|
[api, config.appType]
|
|
19014
19062
|
);
|
|
19015
|
-
const mergedRuntime =
|
|
19063
|
+
const mergedRuntime = useMemo32(
|
|
19016
19064
|
() => ({ ...defaultRuntime, ...schema.runtime, ...runtimeDefaults, ...runtime }),
|
|
19017
19065
|
[defaultRuntime, schema.runtime, runtimeDefaults, runtime]
|
|
19018
19066
|
);
|
|
19019
|
-
const computedInitialValues =
|
|
19067
|
+
const computedInitialValues = useMemo32(() => {
|
|
19020
19068
|
const values = {};
|
|
19021
19069
|
for (const field of schema.fields) {
|
|
19022
19070
|
const defaultValue = resolveDefaultValue(field, mergedRuntime);
|
|
@@ -19068,7 +19116,7 @@ function FormProvider({
|
|
|
19068
19116
|
return changed ? next : prev;
|
|
19069
19117
|
});
|
|
19070
19118
|
}, [mergedRuntime, schema.fields]);
|
|
19071
|
-
const fieldBehaviors =
|
|
19119
|
+
const fieldBehaviors = useMemo32(() => {
|
|
19072
19120
|
const baseBehaviors = {};
|
|
19073
19121
|
for (const field of schema.fields) {
|
|
19074
19122
|
baseBehaviors[field.fieldId] = field.behavior || "NORMAL";
|
|
@@ -19091,11 +19139,11 @@ function FormProvider({
|
|
|
19091
19139
|
}
|
|
19092
19140
|
return computed;
|
|
19093
19141
|
}, [schema, effects, config.permissions, config.mode, formData]);
|
|
19094
|
-
const fieldOverrides =
|
|
19142
|
+
const fieldOverrides = useMemo32(
|
|
19095
19143
|
() => evaluateFieldOverrides(effects, formData),
|
|
19096
19144
|
[effects, formData]
|
|
19097
19145
|
);
|
|
19098
|
-
const layoutBehaviors =
|
|
19146
|
+
const layoutBehaviors = useMemo32(
|
|
19099
19147
|
() => evaluateLayoutBehaviors(effects, formData),
|
|
19100
19148
|
[effects, formData]
|
|
19101
19149
|
);
|
|
@@ -19319,7 +19367,7 @@ function FormProvider({
|
|
|
19319
19367
|
window.clearTimeout(timer);
|
|
19320
19368
|
};
|
|
19321
19369
|
}, [schema.fields, mergedRuntime, formData]);
|
|
19322
|
-
const contextValue =
|
|
19370
|
+
const contextValue = useMemo32(
|
|
19323
19371
|
() => ({
|
|
19324
19372
|
mode: config.mode,
|
|
19325
19373
|
schema,
|
|
@@ -20039,7 +20087,7 @@ function isLayoutVisible(visibleWhen, formData) {
|
|
|
20039
20087
|
}
|
|
20040
20088
|
|
|
20041
20089
|
// packages/sdk/src/components/core/FormShell.tsx
|
|
20042
|
-
import { useEffect as useEffect45, useMemo as
|
|
20090
|
+
import { useEffect as useEffect45, useMemo as useMemo33 } from "react";
|
|
20043
20091
|
import * as Antd2 from "antd";
|
|
20044
20092
|
import { jsx as jsx93 } from "react/jsx-runtime";
|
|
20045
20093
|
function normalizeMaxWidth(maxWidth) {
|
|
@@ -20072,7 +20120,7 @@ function FormShell({ children, appearance, className }) {
|
|
|
20072
20120
|
useEffect45(() => {
|
|
20073
20121
|
form?.setFieldsValue?.(formData);
|
|
20074
20122
|
}, [form, formData]);
|
|
20075
|
-
const style =
|
|
20123
|
+
const style = useMemo33(() => {
|
|
20076
20124
|
if (!maxWidth) return void 0;
|
|
20077
20125
|
return {
|
|
20078
20126
|
maxWidth,
|
|
@@ -20937,7 +20985,7 @@ var InnerDetailContent = ({
|
|
|
20937
20985
|
const formDataRef = useRef18(void 0);
|
|
20938
20986
|
const validateRef = useRef18(void 0);
|
|
20939
20987
|
const [accessDenied, setAccessDenied] = useState37(false);
|
|
20940
|
-
const fieldIds =
|
|
20988
|
+
const fieldIds = useMemo34(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
|
|
20941
20989
|
const {
|
|
20942
20990
|
loading,
|
|
20943
20991
|
mode,
|
|
@@ -22045,15 +22093,15 @@ var FormSubmitTemplate = ({
|
|
|
22045
22093
|
};
|
|
22046
22094
|
|
|
22047
22095
|
// packages/sdk/src/components/templates/ProcessDetailTemplate.tsx
|
|
22048
|
-
import { useCallback as useCallback27, useMemo as
|
|
22096
|
+
import { useCallback as useCallback27, useMemo as useMemo38, useRef as useRef23, useState as useState44 } from "react";
|
|
22049
22097
|
import dayjs11 from "dayjs";
|
|
22050
22098
|
import { Form as AntForm, Input as Input14, Modal as Modal12, message as message5 } from "antd";
|
|
22051
22099
|
|
|
22052
22100
|
// packages/sdk/src/components/hooks/useProcessDetail.ts
|
|
22053
|
-
import { useState as useState41, useEffect as useEffect51, useCallback as useCallback25, useRef as useRef21, useMemo as
|
|
22101
|
+
import { useState as useState41, useEffect as useEffect51, useCallback as useCallback25, useRef as useRef21, useMemo as useMemo36 } from "react";
|
|
22054
22102
|
|
|
22055
22103
|
// packages/sdk/src/components/hooks/useFieldPermission.ts
|
|
22056
|
-
import { useMemo as
|
|
22104
|
+
import { useMemo as useMemo35, useCallback as useCallback24 } from "react";
|
|
22057
22105
|
var normalizeBehavior = (value) => {
|
|
22058
22106
|
if (value === "EDITABLE") return "NORMAL";
|
|
22059
22107
|
if (value === "READ_ONLY") return "READONLY";
|
|
@@ -22131,7 +22179,7 @@ function useFieldPermission(options) {
|
|
|
22131
22179
|
}
|
|
22132
22180
|
return behaviors;
|
|
22133
22181
|
}, [viewPermissions, processDefinition, currentTask, isApprover, mode]);
|
|
22134
|
-
const fieldBehaviors =
|
|
22182
|
+
const fieldBehaviors = useMemo35(() => computeBehaviors(), [computeBehaviors]);
|
|
22135
22183
|
return { fieldBehaviors, computeBehaviors };
|
|
22136
22184
|
}
|
|
22137
22185
|
|
|
@@ -22185,7 +22233,7 @@ function useProcessDetail(options) {
|
|
|
22185
22233
|
mountedRef.current = false;
|
|
22186
22234
|
};
|
|
22187
22235
|
}, []);
|
|
22188
|
-
const currentTask =
|
|
22236
|
+
const currentTask = useMemo36(
|
|
22189
22237
|
() => mergeCurrentTask(processInfo?.currentTask, approvalTasks[0]),
|
|
22190
22238
|
[processInfo?.currentTask, approvalTasks]
|
|
22191
22239
|
);
|
|
@@ -22205,7 +22253,7 @@ function useProcessDetail(options) {
|
|
|
22205
22253
|
isApprover: isProcessFinal ? false : isApprover,
|
|
22206
22254
|
mode
|
|
22207
22255
|
});
|
|
22208
|
-
const activeActions =
|
|
22256
|
+
const activeActions = useMemo36(() => {
|
|
22209
22257
|
if (!isApprover || isProcessFinal) return [];
|
|
22210
22258
|
const actions = currentTask?.actions && currentTask.actions.length > 0 ? [...currentTask.actions] : [...DEFAULT_APPROVAL_ACTIONS];
|
|
22211
22259
|
if (canWithdraw && !actions.some((action) => action.action === "withdraw")) {
|
|
@@ -22620,7 +22668,7 @@ function useApprovalActions(options) {
|
|
|
22620
22668
|
}
|
|
22621
22669
|
|
|
22622
22670
|
// packages/sdk/src/components/modules/ApprovalActionBar.tsx
|
|
22623
|
-
import React67, { useMemo as
|
|
22671
|
+
import React67, { useMemo as useMemo37, useState as useState43 } from "react";
|
|
22624
22672
|
import { Form as Form5, Input as Input13, Modal as Modal11, Select as Select9 } from "antd";
|
|
22625
22673
|
import {
|
|
22626
22674
|
CheckOutlined as CheckOutlined2,
|
|
@@ -22681,7 +22729,7 @@ function DefaultTransferSelector({
|
|
|
22681
22729
|
}) {
|
|
22682
22730
|
const formContext = React67.useContext(FormContext);
|
|
22683
22731
|
const { isMobile } = useDeviceDetect();
|
|
22684
|
-
const fallbackApi =
|
|
22732
|
+
const fallbackApi = useMemo37(() => createFormRuntimeApi(), []);
|
|
22685
22733
|
const api = formContext?.api ?? fallbackApi;
|
|
22686
22734
|
const [open, setOpen] = useState43(false);
|
|
22687
22735
|
const [selectedUsers, setSelectedUsers] = useState43([]);
|
|
@@ -22742,7 +22790,7 @@ var ApprovalActionBar = ({
|
|
|
22742
22790
|
const [modalAction, setModalAction] = useState43(null);
|
|
22743
22791
|
const [activeAction, setActiveAction] = useState43(null);
|
|
22744
22792
|
const [loading, setLoading] = useState43(false);
|
|
22745
|
-
const visibleActions =
|
|
22793
|
+
const visibleActions = useMemo37(
|
|
22746
22794
|
() => actions.filter((action) => !action.hidden).sort((a, b) => (actionPriority2[a.action] ?? 50) - (actionPriority2[b.action] ?? 50)),
|
|
22747
22795
|
[actions]
|
|
22748
22796
|
);
|
|
@@ -23019,7 +23067,7 @@ var InnerProcessContent = ({
|
|
|
23019
23067
|
const [initiatorApproverOpen, setInitiatorApproverOpen] = useState44(false);
|
|
23020
23068
|
const [initiatorApproverRequirements, setInitiatorApproverRequirements] = useState44([]);
|
|
23021
23069
|
const [pendingResubmitComments, setPendingResubmitComments] = useState44();
|
|
23022
|
-
const fieldIds =
|
|
23070
|
+
const fieldIds = useMemo38(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
|
|
23023
23071
|
const { api } = useFormContext();
|
|
23024
23072
|
const {
|
|
23025
23073
|
loading,
|
|
@@ -23218,7 +23266,7 @@ var InnerProcessContent = ({
|
|
|
23218
23266
|
setWithdrawOpen(false);
|
|
23219
23267
|
withdrawForm.resetFields();
|
|
23220
23268
|
}, [withdrawForm]);
|
|
23221
|
-
const bottomActions =
|
|
23269
|
+
const bottomActions = useMemo38(() => {
|
|
23222
23270
|
if (isApprover && !isOriginatorReturn && activeActions.length > 0) return [];
|
|
23223
23271
|
if (isProcessCompleted) {
|
|
23224
23272
|
if (mode === "readonly") {
|
|
@@ -23568,7 +23616,7 @@ var StandardFormPage = ({
|
|
|
23568
23616
|
const formType = normalizeStandardFormType(
|
|
23569
23617
|
schema.template?.formType || (resolvedMode === "process" ? "process" : "form")
|
|
23570
23618
|
);
|
|
23571
|
-
const submitApi =
|
|
23619
|
+
const submitApi = useMemo39(() => {
|
|
23572
23620
|
if (!onSubmit) return void 0;
|
|
23573
23621
|
return {
|
|
23574
23622
|
submitFormData: async (payload) => onSubmit(
|
|
@@ -23582,7 +23630,7 @@ var StandardFormPage = ({
|
|
|
23582
23630
|
startProcessFromExistingInstance: async (payload) => onSubmit(payload)
|
|
23583
23631
|
};
|
|
23584
23632
|
}, [formType, onSubmit]);
|
|
23585
|
-
const api =
|
|
23633
|
+
const api = useMemo39(() => {
|
|
23586
23634
|
if (!externalApi && !submitApi) return void 0;
|
|
23587
23635
|
return {
|
|
23588
23636
|
...externalApi ?? {},
|
|
@@ -25071,7 +25119,7 @@ var DataManagementList = ({
|
|
|
25071
25119
|
actionOverrides
|
|
25072
25120
|
}) => {
|
|
25073
25121
|
const rootRef = useRef24(null);
|
|
25074
|
-
const api =
|
|
25122
|
+
const api = useMemo40(() => {
|
|
25075
25123
|
if (typeof requestOverride === "function") {
|
|
25076
25124
|
return createFormRuntimeApi({ request: requestOverride });
|
|
25077
25125
|
}
|
|
@@ -25164,7 +25212,7 @@ var DataManagementList = ({
|
|
|
25164
25212
|
mounted = false;
|
|
25165
25213
|
};
|
|
25166
25214
|
}, [appType, formUuid, permissionMode, request]);
|
|
25167
|
-
const baseActionCan =
|
|
25215
|
+
const baseActionCan = useMemo40(() => {
|
|
25168
25216
|
if (permissionMode === "auto") {
|
|
25169
25217
|
return FORM_ACTION_PERMISSIONS.reduce((result, action) => {
|
|
25170
25218
|
result[action] = Boolean(actionSummary?.can?.[action]);
|
|
@@ -25198,15 +25246,15 @@ var DataManagementList = ({
|
|
|
25198
25246
|
const canExport = canAction("export");
|
|
25199
25247
|
const canImport = canAction("import");
|
|
25200
25248
|
const canWorkflow = canAction("workflow");
|
|
25201
|
-
const visibleFields =
|
|
25249
|
+
const visibleFields = useMemo40(
|
|
25202
25250
|
() => showFields.map((fieldId) => fields.find((field) => field.fieldId === fieldId)).filter(Boolean),
|
|
25203
25251
|
[fields, showFields]
|
|
25204
25252
|
);
|
|
25205
|
-
const forcedShowFieldIds =
|
|
25253
|
+
const forcedShowFieldIds = useMemo40(
|
|
25206
25254
|
() => new Set(forcedConfig?.showFields || []),
|
|
25207
25255
|
[forcedConfig?.showFields]
|
|
25208
25256
|
);
|
|
25209
|
-
const forcedLockFieldIds =
|
|
25257
|
+
const forcedLockFieldIds = useMemo40(
|
|
25210
25258
|
() => new Set(forcedConfig?.lockFieldIds || []),
|
|
25211
25259
|
[forcedConfig?.lockFieldIds]
|
|
25212
25260
|
);
|
|
@@ -25600,7 +25648,7 @@ var DataManagementList = ({
|
|
|
25600
25648
|
ACTION_COLUMN_MIN_WIDTH,
|
|
25601
25649
|
Math.min(rowActionCount, visibleRowActionLimit) * ACTION_BUTTON_ESTIMATED_WIDTH + (rowActionCount > visibleRowActionLimit ? ACTION_MORE_BUTTON_WIDTH : 0) + ACTION_COLUMN_HORIZONTAL_PADDING
|
|
25602
25650
|
);
|
|
25603
|
-
const columns =
|
|
25651
|
+
const columns = useMemo40(() => {
|
|
25604
25652
|
const baseColumns = visibleFields.map((field) => {
|
|
25605
25653
|
const columnWidth = widths[field.fieldId] || field.width || 160;
|
|
25606
25654
|
return {
|
|
@@ -25732,7 +25780,7 @@ var DataManagementList = ({
|
|
|
25732
25780
|
actionColumnWidth
|
|
25733
25781
|
)
|
|
25734
25782
|
);
|
|
25735
|
-
const importPreviewColumns =
|
|
25783
|
+
const importPreviewColumns = useMemo40(() => {
|
|
25736
25784
|
const keys = Array.from(
|
|
25737
25785
|
new Set(importPreview.flatMap((record) => Object.keys(record || {})))
|
|
25738
25786
|
).slice(0, 16);
|
|
@@ -26495,12 +26543,12 @@ function BuiltinRouteRenderer({
|
|
|
26495
26543
|
const [error, setError] = useState46("");
|
|
26496
26544
|
const [reloadKey, setReloadKey] = useState46(0);
|
|
26497
26545
|
const requestConfig = requestOverride && typeof requestOverride === "object" ? requestOverride : void 0;
|
|
26498
|
-
const request =
|
|
26546
|
+
const request = useMemo41(() => {
|
|
26499
26547
|
if (typeof requestOverride === "function") return requestOverride;
|
|
26500
26548
|
if (requestConfig?.request) return requestConfig.request;
|
|
26501
26549
|
return createBuiltinRouteRequest(requestConfig?.baseUrl || normalizedServicePrefix, fetchImpl);
|
|
26502
26550
|
}, [fetchImpl, normalizedServicePrefix, requestConfig, requestOverride]);
|
|
26503
|
-
const api =
|
|
26551
|
+
const api = useMemo41(
|
|
26504
26552
|
() => createFormRuntimeApi({
|
|
26505
26553
|
baseUrl: normalizedServicePrefix,
|
|
26506
26554
|
...requestConfig || {},
|
|
@@ -26511,7 +26559,7 @@ function BuiltinRouteRenderer({
|
|
|
26511
26559
|
const appType = appTypeProp || route?.appType || "";
|
|
26512
26560
|
const formUuid = route ? pickRouteValue(route, "formUuid", "menuFormUuid") : "";
|
|
26513
26561
|
const formInstId = route ? pickRouteValue(route, "formInstId", "formInstanceId") : "";
|
|
26514
|
-
const routeConfig =
|
|
26562
|
+
const routeConfig = useMemo41(
|
|
26515
26563
|
() => route ? resolveRouteConfig(route, config) : {},
|
|
26516
26564
|
[config, route]
|
|
26517
26565
|
);
|
|
@@ -26689,6 +26737,7 @@ export {
|
|
|
26689
26737
|
createBrowserPageBridge,
|
|
26690
26738
|
createBrowserPageContext,
|
|
26691
26739
|
createBuiltinRouteRequest,
|
|
26740
|
+
createPageFormRuntimeApi,
|
|
26692
26741
|
createPageSdk,
|
|
26693
26742
|
createPublicAccessClient,
|
|
26694
26743
|
createReactPage,
|
|
@@ -26718,6 +26767,7 @@ export {
|
|
|
26718
26767
|
useNavigation,
|
|
26719
26768
|
useOpenXiangda,
|
|
26720
26769
|
usePageContext,
|
|
26770
|
+
usePageFormRuntimeApi,
|
|
26721
26771
|
usePageProps,
|
|
26722
26772
|
usePageRoute,
|
|
26723
26773
|
usePageSdk,
|