openxiangda 1.0.123 → 1.0.124
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/package.json +1 -1
- package/packages/sdk/dist/runtime/index.cjs +89 -10
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.mjs +137 -58
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +91 -12
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.d.mts +9 -3
- package/packages/sdk/dist/runtime/react.d.ts +9 -3
- package/packages/sdk/dist/runtime/react.mjs +92 -13
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
|
@@ -34507,10 +34507,18 @@ var OpenXiangdaProvider = ({
|
|
|
34507
34507
|
const [accessToken, setAccessTokenState] = useState61(null);
|
|
34508
34508
|
const accessTokenRef = useRef82(null);
|
|
34509
34509
|
const setAccessToken = useCallback22(
|
|
34510
|
-
(nextAccessToken) => {
|
|
34510
|
+
(nextAccessToken, options = {}) => {
|
|
34511
|
+
if (!nextAccessToken && options.clearIfToken && accessTokenRef.current?.token !== options.clearIfToken) {
|
|
34512
|
+
return;
|
|
34513
|
+
}
|
|
34511
34514
|
const normalizedAccessToken = nextAccessToken || null;
|
|
34512
|
-
|
|
34513
|
-
|
|
34515
|
+
const nextState = normalizedAccessToken ? {
|
|
34516
|
+
token: normalizedAccessToken,
|
|
34517
|
+
scope: options.scope || "default",
|
|
34518
|
+
path: options.path || null
|
|
34519
|
+
} : null;
|
|
34520
|
+
accessTokenRef.current = nextState;
|
|
34521
|
+
setAccessTokenState(nextState);
|
|
34514
34522
|
},
|
|
34515
34523
|
[]
|
|
34516
34524
|
);
|
|
@@ -34536,7 +34544,13 @@ var OpenXiangdaProvider = ({
|
|
|
34536
34544
|
return;
|
|
34537
34545
|
}
|
|
34538
34546
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
34539
|
-
const requestFetch = options.accessToken !== void 0 ? createAuthorizedFetch(
|
|
34547
|
+
const requestFetch = options.accessToken !== void 0 ? createAuthorizedFetch(
|
|
34548
|
+
resolvedFetch,
|
|
34549
|
+
createAccessTokenState(
|
|
34550
|
+
options.accessToken || null,
|
|
34551
|
+
options.accessTokenOptions
|
|
34552
|
+
)
|
|
34553
|
+
) : createAuthorizedFetch(resolvedFetch, accessTokenRef.current);
|
|
34540
34554
|
try {
|
|
34541
34555
|
const response = await requestFetch(
|
|
34542
34556
|
buildServiceUrl3(
|
|
@@ -34946,9 +34960,11 @@ var buildServiceUrl3 = (servicePrefix, path) => {
|
|
|
34946
34960
|
var createAuthorizedFetch = (baseFetch, accessToken) => {
|
|
34947
34961
|
if (!accessToken) return baseFetch;
|
|
34948
34962
|
return ((input, init = {}) => {
|
|
34963
|
+
const token = resolveAccessTokenForCurrentRoute(accessToken);
|
|
34964
|
+
if (!token) return baseFetch(input, init);
|
|
34949
34965
|
const headers = new Headers(init.headers || {});
|
|
34950
34966
|
if (!headers.has("authorization")) {
|
|
34951
|
-
headers.set("authorization", `Bearer ${
|
|
34967
|
+
headers.set("authorization", `Bearer ${token}`);
|
|
34952
34968
|
}
|
|
34953
34969
|
return baseFetch(input, {
|
|
34954
34970
|
...init,
|
|
@@ -34956,6 +34972,34 @@ var createAuthorizedFetch = (baseFetch, accessToken) => {
|
|
|
34956
34972
|
});
|
|
34957
34973
|
});
|
|
34958
34974
|
};
|
|
34975
|
+
var createAccessTokenState = (accessToken, options = {}) => accessToken ? {
|
|
34976
|
+
token: accessToken,
|
|
34977
|
+
scope: options.scope || "default",
|
|
34978
|
+
path: options.path || null
|
|
34979
|
+
} : null;
|
|
34980
|
+
var resolveAccessTokenForCurrentRoute = (accessToken) => {
|
|
34981
|
+
if (accessToken.scope !== "public") return accessToken.token;
|
|
34982
|
+
const scopedPath = normalizeRoutePath(accessToken.path);
|
|
34983
|
+
const currentPath = normalizeRoutePath(getCurrentPathname2());
|
|
34984
|
+
if (!scopedPath) {
|
|
34985
|
+
return isPublicRoutePath(currentPath) ? accessToken.token : null;
|
|
34986
|
+
}
|
|
34987
|
+
if (currentPath === scopedPath || isPublicRoutePath(currentPath) && currentPath.startsWith(`${scopedPath}/`)) {
|
|
34988
|
+
return accessToken.token;
|
|
34989
|
+
}
|
|
34990
|
+
return null;
|
|
34991
|
+
};
|
|
34992
|
+
var normalizeRoutePath = (path) => {
|
|
34993
|
+
const text = String(path || "").trim();
|
|
34994
|
+
if (!text) return "";
|
|
34995
|
+
try {
|
|
34996
|
+
const base = typeof window !== "undefined" ? window.location.origin : "http://localhost";
|
|
34997
|
+
return new URL(text, base).pathname.replace(/\/+$/, "") || "/";
|
|
34998
|
+
} catch {
|
|
34999
|
+
return text.split(/[?#]/, 1)[0].replace(/\/+$/, "") || "/";
|
|
35000
|
+
}
|
|
35001
|
+
};
|
|
35002
|
+
var isPublicRoutePath = (path) => /\/public(?:\/|$)/.test(path);
|
|
34959
35003
|
var readJsonPayload = async (response) => {
|
|
34960
35004
|
try {
|
|
34961
35005
|
return await response.json();
|
|
@@ -35056,6 +35100,7 @@ var attachCallback = (loginUrl, callback) => {
|
|
|
35056
35100
|
}
|
|
35057
35101
|
};
|
|
35058
35102
|
var getCurrentHref4 = () => typeof window === "undefined" ? "" : window.location.href;
|
|
35103
|
+
var getCurrentPathname2 = () => typeof window === "undefined" ? "" : window.location.pathname;
|
|
35059
35104
|
var getCurrentHostname2 = () => typeof window === "undefined" ? "" : window.location.hostname;
|
|
35060
35105
|
var getRuntimeEnv = (key) => {
|
|
35061
35106
|
const env = typeof process !== "undefined" ? process.env : void 0;
|
|
@@ -35126,7 +35171,7 @@ var resolveAppTypeFromLocation = () => {
|
|
|
35126
35171
|
};
|
|
35127
35172
|
|
|
35128
35173
|
// packages/sdk/src/runtime/react/publicAccess.tsx
|
|
35129
|
-
import { useCallback as useCallback23, useEffect as useEffect62, useMemo as useMemo43, useState as useState62 } from "react";
|
|
35174
|
+
import { useCallback as useCallback23, useEffect as useEffect62, useMemo as useMemo43, useRef as useRef83, useState as useState62 } from "react";
|
|
35130
35175
|
import { Fragment as Fragment10, jsx as jsx12 } from "react/jsx-runtime";
|
|
35131
35176
|
var usePublicAccess = (options = {}) => {
|
|
35132
35177
|
const runtime = useOpenXiangda();
|
|
@@ -35147,6 +35192,8 @@ var usePublicAccess = (options = {}) => {
|
|
|
35147
35192
|
const [session, setSession] = useState62(null);
|
|
35148
35193
|
const [error, setError] = useState62(null);
|
|
35149
35194
|
const [loading, setLoading] = useState62(Boolean(autoStart));
|
|
35195
|
+
const activeSessionRef = useRef83(null);
|
|
35196
|
+
const mountedRef = useRef83(true);
|
|
35150
35197
|
const sessionInputKey = JSON.stringify(sessionInput);
|
|
35151
35198
|
const stableSessionInput = useMemo43(() => sessionInput, [sessionInputKey]);
|
|
35152
35199
|
const client = useMemo43(
|
|
@@ -35162,15 +35209,31 @@ var usePublicAccess = (options = {}) => {
|
|
|
35162
35209
|
setLoading(true);
|
|
35163
35210
|
setError(null);
|
|
35164
35211
|
try {
|
|
35212
|
+
const resolvedPath = input.path || stableSessionInput.path || readPathFromLocation();
|
|
35165
35213
|
const data = await client.startSession({
|
|
35166
35214
|
...stableSessionInput,
|
|
35167
35215
|
...input,
|
|
35168
35216
|
ticket: input.ticket || stableSessionInput.ticket || readTicketFromLocation(),
|
|
35169
|
-
path:
|
|
35217
|
+
path: resolvedPath
|
|
35170
35218
|
});
|
|
35219
|
+
if (!mountedRef.current) return data;
|
|
35220
|
+
activeSessionRef.current = {
|
|
35221
|
+
accessToken: data.accessToken,
|
|
35222
|
+
path: resolvedPath
|
|
35223
|
+
};
|
|
35171
35224
|
setSession(data);
|
|
35172
|
-
setAccessToken(data.accessToken
|
|
35173
|
-
|
|
35225
|
+
setAccessToken(data.accessToken, {
|
|
35226
|
+
scope: "public",
|
|
35227
|
+
path: resolvedPath
|
|
35228
|
+
});
|
|
35229
|
+
await reloadRuntime({
|
|
35230
|
+
accessToken: data.accessToken,
|
|
35231
|
+
accessTokenOptions: {
|
|
35232
|
+
scope: "public",
|
|
35233
|
+
path: resolvedPath
|
|
35234
|
+
}
|
|
35235
|
+
});
|
|
35236
|
+
if (!mountedRef.current) return data;
|
|
35174
35237
|
setLoading(false);
|
|
35175
35238
|
return data;
|
|
35176
35239
|
} catch (caught) {
|
|
@@ -35178,8 +35241,10 @@ var usePublicAccess = (options = {}) => {
|
|
|
35178
35241
|
caught instanceof Error ? caught.message : "\u516C\u5F00\u8BBF\u95EE\u4F1A\u8BDD\u521B\u5EFA\u5931\u8D25",
|
|
35179
35242
|
{ payload: caught }
|
|
35180
35243
|
);
|
|
35181
|
-
|
|
35182
|
-
|
|
35244
|
+
if (mountedRef.current) {
|
|
35245
|
+
setError(nextError);
|
|
35246
|
+
setLoading(false);
|
|
35247
|
+
}
|
|
35183
35248
|
throw nextError;
|
|
35184
35249
|
}
|
|
35185
35250
|
},
|
|
@@ -35189,6 +35254,20 @@ var usePublicAccess = (options = {}) => {
|
|
|
35189
35254
|
if (!autoStart) return;
|
|
35190
35255
|
void startSession().catch(() => void 0);
|
|
35191
35256
|
}, [autoStart, startSession]);
|
|
35257
|
+
useEffect62(
|
|
35258
|
+
() => {
|
|
35259
|
+
mountedRef.current = true;
|
|
35260
|
+
return () => {
|
|
35261
|
+
mountedRef.current = false;
|
|
35262
|
+
const activeSession = activeSessionRef.current;
|
|
35263
|
+
if (!activeSession) return;
|
|
35264
|
+
activeSessionRef.current = null;
|
|
35265
|
+
setAccessToken(null, { clearIfToken: activeSession.accessToken });
|
|
35266
|
+
void reloadRuntime({ accessToken: null });
|
|
35267
|
+
};
|
|
35268
|
+
},
|
|
35269
|
+
[reloadRuntime, setAccessToken]
|
|
35270
|
+
);
|
|
35192
35271
|
return {
|
|
35193
35272
|
loading,
|
|
35194
35273
|
error,
|
|
@@ -35969,7 +36048,7 @@ function createFormRuntimeApi(config3) {
|
|
|
35969
36048
|
}
|
|
35970
36049
|
|
|
35971
36050
|
// packages/sdk/src/components/modules/DataManagementList.tsx
|
|
35972
|
-
import { useCallback as useCallback39, useEffect as useEffect101, useMemo as useMemo67, useRef as
|
|
36051
|
+
import { useCallback as useCallback39, useEffect as useEffect101, useMemo as useMemo67, useRef as useRef99, useState as useState93 } from "react";
|
|
35973
36052
|
import {
|
|
35974
36053
|
Alert as Alert3,
|
|
35975
36054
|
Button as Button16,
|
|
@@ -36011,11 +36090,11 @@ import {
|
|
|
36011
36090
|
import { useMemo as useMemo66 } from "react";
|
|
36012
36091
|
|
|
36013
36092
|
// packages/sdk/src/components/templates/FormDetailTemplate.tsx
|
|
36014
|
-
import { useCallback as useCallback31, useMemo as useMemo61, useRef as
|
|
36093
|
+
import { useCallback as useCallback31, useMemo as useMemo61, useRef as useRef93, useState as useState85 } from "react";
|
|
36015
36094
|
import dayjs19 from "dayjs";
|
|
36016
36095
|
|
|
36017
36096
|
// packages/sdk/src/components/core/FormProvider.tsx
|
|
36018
|
-
import React244, { useCallback as useCallback28, useEffect as useEffect92, useRef as
|
|
36097
|
+
import React244, { useCallback as useCallback28, useEffect as useEffect92, useRef as useRef90, useState as useState78, useMemo as useMemo59 } from "react";
|
|
36019
36098
|
|
|
36020
36099
|
// packages/sdk/src/components/core/FormContext.ts
|
|
36021
36100
|
import { createContext as createContext11, useContext as useContext17 } from "react";
|
|
@@ -36858,7 +36937,7 @@ function renderReadonlyOptions(options, coloredOptions, tagWhenPlain = false) {
|
|
|
36858
36937
|
}
|
|
36859
36938
|
|
|
36860
36939
|
// packages/sdk/src/components/fields/SelectField/useLinkedFormRemoteOptions.ts
|
|
36861
|
-
import { useCallback as useCallback24, useEffect as useEffect66, useMemo as useMemo44, useRef as
|
|
36940
|
+
import { useCallback as useCallback24, useEffect as useEffect66, useMemo as useMemo44, useRef as useRef84, useState as useState63 } from "react";
|
|
36862
36941
|
|
|
36863
36942
|
// packages/sdk/src/components/core/optionSource.ts
|
|
36864
36943
|
var DEFAULT_OPTION_PAGE_SIZE = 200;
|
|
@@ -37075,8 +37154,8 @@ function useLinkedFormRemoteOptions(optionSource, baseOptions, selectedOptions)
|
|
|
37075
37154
|
const minChars = linkedForm?.remoteSearchMinChars ?? 0;
|
|
37076
37155
|
const [remoteOptions, setRemoteOptions] = useState63(null);
|
|
37077
37156
|
const [loading, setLoading] = useState63(false);
|
|
37078
|
-
const timerRef =
|
|
37079
|
-
const requestRef =
|
|
37157
|
+
const timerRef = useRef84(null);
|
|
37158
|
+
const requestRef = useRef84(0);
|
|
37080
37159
|
const reset = useCallback24(() => {
|
|
37081
37160
|
requestRef.current += 1;
|
|
37082
37161
|
if (timerRef.current) {
|
|
@@ -41409,7 +41488,7 @@ function UserSelectField(props) {
|
|
|
41409
41488
|
import { useEffect as useEffect83 } from "react";
|
|
41410
41489
|
|
|
41411
41490
|
// packages/sdk/src/components/fields/DepartmentSelectField/DepartmentSelectFieldPC.tsx
|
|
41412
|
-
import { useEffect as useEffect81, useMemo as useMemo53, useRef as
|
|
41491
|
+
import { useEffect as useEffect81, useMemo as useMemo53, useRef as useRef85, useState as useState71 } from "react";
|
|
41413
41492
|
import { TreeSelect as TreeSelect2 } from "antd";
|
|
41414
41493
|
|
|
41415
41494
|
// packages/sdk/src/components/fields/shared/DepartmentPicker.tsx
|
|
@@ -41704,7 +41783,7 @@ function DepartmentSelectFieldPC({
|
|
|
41704
41783
|
const value = useMemo53(() => normalizeDepartmentArray(rawValue), [rawValue]);
|
|
41705
41784
|
const disabled = behavior === "DISABLED";
|
|
41706
41785
|
const configuredTreeData = treeData ?? EMPTY_TREE_DATA;
|
|
41707
|
-
const remoteLoadedRef =
|
|
41786
|
+
const remoteLoadedRef = useRef85(false);
|
|
41708
41787
|
const [loadedTreeData, setLoadedTreeData] = useState71(configuredTreeData);
|
|
41709
41788
|
const [pickerOpen, setPickerOpen] = useState71(false);
|
|
41710
41789
|
useEffect81(() => {
|
|
@@ -41812,7 +41891,7 @@ function DepartmentSelectFieldPC({
|
|
|
41812
41891
|
}
|
|
41813
41892
|
|
|
41814
41893
|
// packages/sdk/src/components/fields/DepartmentSelectField/DepartmentSelectFieldMobile.tsx
|
|
41815
|
-
import { useEffect as useEffect82, useMemo as useMemo54, useRef as
|
|
41894
|
+
import { useEffect as useEffect82, useMemo as useMemo54, useRef as useRef86, useState as useState72 } from "react";
|
|
41816
41895
|
import { jsx as jsx74, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
41817
41896
|
var EMPTY_TREE_DATA2 = [];
|
|
41818
41897
|
function toDepartmentValue2(item) {
|
|
@@ -41846,7 +41925,7 @@ function DepartmentSelectFieldMobile({
|
|
|
41846
41925
|
const disabled = behavior === "DISABLED";
|
|
41847
41926
|
const [showPicker, setShowPicker] = useState72(false);
|
|
41848
41927
|
const configuredTreeData = treeData ?? EMPTY_TREE_DATA2;
|
|
41849
|
-
const remoteLoadedRef =
|
|
41928
|
+
const remoteLoadedRef = useRef86(false);
|
|
41850
41929
|
const [loadedTreeData, setLoadedTreeData] = useState72(configuredTreeData);
|
|
41851
41930
|
useEffect82(() => {
|
|
41852
41931
|
if (configuredTreeData.length) {
|
|
@@ -42356,7 +42435,7 @@ function AddressField(props) {
|
|
|
42356
42435
|
}
|
|
42357
42436
|
|
|
42358
42437
|
// packages/sdk/src/components/fields/AssociationFormField/index.tsx
|
|
42359
|
-
import { useCallback as useCallback25, useEffect as useEffect86, useMemo as useMemo57, useRef as
|
|
42438
|
+
import { useCallback as useCallback25, useEffect as useEffect86, useMemo as useMemo57, useRef as useRef87, useState as useState74 } from "react";
|
|
42360
42439
|
import { Button as Button9, Drawer, Input as Input9, Modal as Modal7, Select as Select6, Space as Space7, Spin as Spin4, Table, Tag as Tag6 } from "antd";
|
|
42361
42440
|
import { jsx as jsx79, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
42362
42441
|
var DEFAULT_PAGE_SIZE = 10;
|
|
@@ -42434,8 +42513,8 @@ function AssociationFormField(props) {
|
|
|
42434
42513
|
});
|
|
42435
42514
|
const [selectedRowKeys, setSelectedRowKeys] = useState74([]);
|
|
42436
42515
|
const [selectedRecords, setSelectedRecords] = useState74([]);
|
|
42437
|
-
const formDataRef =
|
|
42438
|
-
const associationFormRef =
|
|
42516
|
+
const formDataRef = useRef87(formData);
|
|
42517
|
+
const associationFormRef = useRef87(associationForm);
|
|
42439
42518
|
useEffect86(() => {
|
|
42440
42519
|
registerField(fieldId);
|
|
42441
42520
|
if (defaultValue !== void 0 && formData[fieldId] === void 0) {
|
|
@@ -42838,7 +42917,7 @@ function AssociationFormField(props) {
|
|
|
42838
42917
|
}
|
|
42839
42918
|
|
|
42840
42919
|
// packages/sdk/src/components/fields/EditorField/index.tsx
|
|
42841
|
-
import { useCallback as useCallback26, useEffect as useEffect87, useMemo as useMemo58, useRef as
|
|
42920
|
+
import { useCallback as useCallback26, useEffect as useEffect87, useMemo as useMemo58, useRef as useRef88, useState as useState75 } from "react";
|
|
42842
42921
|
import { Extension } from "@tiptap/core";
|
|
42843
42922
|
import { EditorContent, useEditor } from "@tiptap/react";
|
|
42844
42923
|
import StarterKit from "@tiptap/starter-kit";
|
|
@@ -43492,7 +43571,7 @@ function RichTextEditorCore({
|
|
|
43492
43571
|
fieldId = "richText",
|
|
43493
43572
|
mobile = false
|
|
43494
43573
|
}) {
|
|
43495
|
-
const inputRef =
|
|
43574
|
+
const inputRef = useRef88(null);
|
|
43496
43575
|
const [uploading, setUploading] = useState75(false);
|
|
43497
43576
|
const [uploadError, setUploadError] = useState75("");
|
|
43498
43577
|
const [charCount, setCharCount] = useState75(0);
|
|
@@ -43507,7 +43586,7 @@ function RichTextEditorCore({
|
|
|
43507
43586
|
const [tableOpen, setTableOpen] = useState75(false);
|
|
43508
43587
|
const [tableRows, setTableRows] = useState75(3);
|
|
43509
43588
|
const [tableCols, setTableCols] = useState75(3);
|
|
43510
|
-
const onChangeRef =
|
|
43589
|
+
const onChangeRef = useRef88(onChange);
|
|
43511
43590
|
useEffect87(() => {
|
|
43512
43591
|
onChangeRef.current = onChange;
|
|
43513
43592
|
}, [onChange]);
|
|
@@ -44207,7 +44286,7 @@ function LocationField(props) {
|
|
|
44207
44286
|
}
|
|
44208
44287
|
|
|
44209
44288
|
// packages/sdk/src/components/fields/DigitalSignatureField/index.tsx
|
|
44210
|
-
import { useCallback as useCallback27, useEffect as useEffect90, useRef as
|
|
44289
|
+
import { useCallback as useCallback27, useEffect as useEffect90, useRef as useRef89, useState as useState77 } from "react";
|
|
44211
44290
|
import { Button as Button12, Modal as Modal9, Space as Space10 } from "antd";
|
|
44212
44291
|
import { jsx as jsx83, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
44213
44292
|
var CANVAS_HEIGHT = 260;
|
|
@@ -44245,9 +44324,9 @@ function DigitalSignatureField(props) {
|
|
|
44245
44324
|
const [saving, setSaving] = useState77(false);
|
|
44246
44325
|
const [drawn, setDrawn] = useState77(false);
|
|
44247
44326
|
const [error, setError] = useState77("");
|
|
44248
|
-
const canvasRef =
|
|
44249
|
-
const drawingRef =
|
|
44250
|
-
const pointsRef =
|
|
44327
|
+
const canvasRef = useRef89(null);
|
|
44328
|
+
const drawingRef = useRef89(false);
|
|
44329
|
+
const pointsRef = useRef89([]);
|
|
44251
44330
|
useEffect90(() => {
|
|
44252
44331
|
registerField(fieldId);
|
|
44253
44332
|
if (defaultValue !== void 0 && formData[fieldId] === void 0) {
|
|
@@ -44986,7 +45065,7 @@ function FormProvider3({
|
|
|
44986
45065
|
}
|
|
44987
45066
|
return { ...values, ...initialValues };
|
|
44988
45067
|
}, [schema, initialValues, mergedRuntime]);
|
|
44989
|
-
const initialValuesRef =
|
|
45068
|
+
const initialValuesRef = useRef90(computedInitialValues);
|
|
44990
45069
|
const [formData, setFormData] = useState78({ ...computedInitialValues });
|
|
44991
45070
|
const [fieldErrors, setFieldErrors] = useState78({});
|
|
44992
45071
|
const [registeredFields] = useState78(/* @__PURE__ */ new Set());
|
|
@@ -46098,7 +46177,7 @@ async function validateAndNotify(validateAllWithErrors) {
|
|
|
46098
46177
|
}
|
|
46099
46178
|
|
|
46100
46179
|
// packages/sdk/src/components/hooks/useFormDetail.ts
|
|
46101
|
-
import { useState as useState82, useEffect as useEffect94, useCallback as useCallback29, useRef as
|
|
46180
|
+
import { useState as useState82, useEffect as useEffect94, useCallback as useCallback29, useRef as useRef91 } from "react";
|
|
46102
46181
|
|
|
46103
46182
|
// packages/sdk/src/components/utils/formInstanceData.ts
|
|
46104
46183
|
var FORM_INSTANCE_METADATA_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -46300,8 +46379,8 @@ function useFormDetail(options) {
|
|
|
46300
46379
|
const [formData, setFormData] = useState82(null);
|
|
46301
46380
|
const [instanceInfo, setInstanceInfo] = useState82(null);
|
|
46302
46381
|
const [permissions, setPermissions] = useState82(null);
|
|
46303
|
-
const mountedRef =
|
|
46304
|
-
const onPermissionDeniedRef =
|
|
46382
|
+
const mountedRef = useRef91(true);
|
|
46383
|
+
const onPermissionDeniedRef = useRef91(onPermissionDenied);
|
|
46305
46384
|
const fieldIdsKey = fieldIds?.join("") ?? "";
|
|
46306
46385
|
useEffect94(() => {
|
|
46307
46386
|
mountedRef.current = true;
|
|
@@ -46409,7 +46488,7 @@ function useFormDetail(options) {
|
|
|
46409
46488
|
}
|
|
46410
46489
|
|
|
46411
46490
|
// packages/sdk/src/components/hooks/useChangeRecords.ts
|
|
46412
|
-
import { useState as useState83, useEffect as useEffect95, useCallback as useCallback30, useRef as
|
|
46491
|
+
import { useState as useState83, useEffect as useEffect95, useCallback as useCallback30, useRef as useRef92 } from "react";
|
|
46413
46492
|
var normalizeChangeRecordList = (value) => {
|
|
46414
46493
|
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;
|
|
46415
46494
|
const records = Array.isArray(body) ? body : body?.records ?? body?.data ?? body?.list ?? body?.items ?? [];
|
|
@@ -46428,7 +46507,7 @@ function useChangeRecords(options) {
|
|
|
46428
46507
|
const [loading, setLoading] = useState83(false);
|
|
46429
46508
|
const [total, setTotal] = useState83(0);
|
|
46430
46509
|
const [page, setPage] = useState83(1);
|
|
46431
|
-
const mountedRef =
|
|
46510
|
+
const mountedRef = useRef92(true);
|
|
46432
46511
|
useEffect95(() => {
|
|
46433
46512
|
mountedRef.current = true;
|
|
46434
46513
|
return () => {
|
|
@@ -46894,8 +46973,8 @@ var InnerDetailContent = ({
|
|
|
46894
46973
|
onSave,
|
|
46895
46974
|
inDrawer = false
|
|
46896
46975
|
}) => {
|
|
46897
|
-
const formDataRef =
|
|
46898
|
-
const validateRef =
|
|
46976
|
+
const formDataRef = useRef93(void 0);
|
|
46977
|
+
const validateRef = useRef93(void 0);
|
|
46899
46978
|
const [accessDenied, setAccessDenied] = useState85(false);
|
|
46900
46979
|
const fieldIds = useMemo61(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
|
|
46901
46980
|
const {
|
|
@@ -47074,7 +47153,7 @@ var FormDetailTemplate = (props) => {
|
|
|
47074
47153
|
};
|
|
47075
47154
|
|
|
47076
47155
|
// packages/sdk/src/components/templates/FormSubmitTemplate.tsx
|
|
47077
|
-
import { useEffect as useEffect98, useRef as
|
|
47156
|
+
import { useEffect as useEffect98, useRef as useRef95, useState as useState88, useCallback as useCallback34 } from "react";
|
|
47078
47157
|
import { Button as Button15, message as message4, Modal as Modal10, Select as Select8 } from "antd";
|
|
47079
47158
|
import { CheckCircleFilled as CheckCircleFilled2 } from "@ant-design/icons";
|
|
47080
47159
|
|
|
@@ -47159,7 +47238,7 @@ function useDraftStorage(options) {
|
|
|
47159
47238
|
}
|
|
47160
47239
|
|
|
47161
47240
|
// packages/sdk/src/components/hooks/useFormNavigation.ts
|
|
47162
|
-
import { useState as useState87, useCallback as useCallback33, useRef as
|
|
47241
|
+
import { useState as useState87, useCallback as useCallback33, useRef as useRef94, useEffect as useEffect97 } from "react";
|
|
47163
47242
|
var normalizeBasePath = (basePath) => {
|
|
47164
47243
|
const normalized = String(basePath || "").replace(/^\/+|\/+$/g, "");
|
|
47165
47244
|
return normalized ? `/${normalized}` : "";
|
|
@@ -47193,9 +47272,9 @@ function useFormNavigation(options) {
|
|
|
47193
47272
|
} = options;
|
|
47194
47273
|
const [isRedirecting, setIsRedirecting] = useState87(false);
|
|
47195
47274
|
const [countdown, setCountdown] = useState87(0);
|
|
47196
|
-
const timerRef =
|
|
47197
|
-
const redirectTargetRef =
|
|
47198
|
-
const mountedRef =
|
|
47275
|
+
const timerRef = useRef94(null);
|
|
47276
|
+
const redirectTargetRef = useRef94(null);
|
|
47277
|
+
const mountedRef = useRef94(true);
|
|
47199
47278
|
useEffect97(() => {
|
|
47200
47279
|
mountedRef.current = true;
|
|
47201
47280
|
return () => {
|
|
@@ -47472,15 +47551,15 @@ var InnerFormContent = ({
|
|
|
47472
47551
|
const [submissionDepartmentModalOpen, setSubmissionDepartmentModalOpen] = useState88(false);
|
|
47473
47552
|
const [submissionDepartmentOptions, setSubmissionDepartmentOptions] = useState88([]);
|
|
47474
47553
|
const [selectedSubmissionDepartmentId, setSelectedSubmissionDepartmentId] = useState88();
|
|
47475
|
-
const submissionDepartmentResolverRef =
|
|
47554
|
+
const submissionDepartmentResolverRef = useRef95(null);
|
|
47476
47555
|
const [previewOpen, setPreviewOpen] = useState88(false);
|
|
47477
47556
|
const [previewLoading, setPreviewLoading] = useState88(false);
|
|
47478
47557
|
const [previewRoutes, setPreviewRoutes] = useState88([]);
|
|
47479
47558
|
const [pendingFormData, setPendingFormData] = useState88(null);
|
|
47480
47559
|
const [pendingSubmissionDepartmentId, setPendingSubmissionDepartmentId] = useState88();
|
|
47481
47560
|
const [pendingInitiatorSelectedApprovers, setPendingInitiatorSelectedApprovers] = useState88();
|
|
47482
|
-
const pendingSubmissionDepartmentIdRef =
|
|
47483
|
-
const pendingInitiatorSelectedApproversRef =
|
|
47561
|
+
const pendingSubmissionDepartmentIdRef = useRef95(void 0);
|
|
47562
|
+
const pendingInitiatorSelectedApproversRef = useRef95(
|
|
47484
47563
|
void 0
|
|
47485
47564
|
);
|
|
47486
47565
|
const [initiatorApproverOpen, setInitiatorApproverOpen] = useState88(false);
|
|
@@ -47988,12 +48067,12 @@ var FormSubmitTemplate = ({
|
|
|
47988
48067
|
};
|
|
47989
48068
|
|
|
47990
48069
|
// packages/sdk/src/components/templates/ProcessDetailTemplate.tsx
|
|
47991
|
-
import { useCallback as useCallback38, useMemo as useMemo65, useRef as
|
|
48070
|
+
import { useCallback as useCallback38, useMemo as useMemo65, useRef as useRef98, useState as useState92 } from "react";
|
|
47992
48071
|
import dayjs20 from "dayjs";
|
|
47993
48072
|
import { Form as AntForm, Input as Input13, Modal as Modal12, message as message5 } from "antd";
|
|
47994
48073
|
|
|
47995
48074
|
// packages/sdk/src/components/hooks/useProcessDetail.ts
|
|
47996
|
-
import { useState as useState89, useEffect as useEffect99, useCallback as useCallback36, useRef as
|
|
48075
|
+
import { useState as useState89, useEffect as useEffect99, useCallback as useCallback36, useRef as useRef96, useMemo as useMemo63 } from "react";
|
|
47997
48076
|
|
|
47998
48077
|
// packages/sdk/src/components/hooks/useFieldPermission.ts
|
|
47999
48078
|
import { useMemo as useMemo62, useCallback as useCallback35 } from "react";
|
|
@@ -48120,7 +48199,7 @@ function useProcessDetail(options) {
|
|
|
48120
48199
|
const [permissions, setPermissions] = useState89(null);
|
|
48121
48200
|
const [processDefinition, setProcessDefinition] = useState89(null);
|
|
48122
48201
|
const [dataVersion, setDataVersion] = useState89(0);
|
|
48123
|
-
const mountedRef =
|
|
48202
|
+
const mountedRef = useRef96(true);
|
|
48124
48203
|
const fieldIdsKey = fieldIds?.join("") ?? "";
|
|
48125
48204
|
useEffect99(() => {
|
|
48126
48205
|
mountedRef.current = true;
|
|
@@ -48315,7 +48394,7 @@ function useProcessDetail(options) {
|
|
|
48315
48394
|
}
|
|
48316
48395
|
|
|
48317
48396
|
// packages/sdk/src/components/hooks/useApprovalActions.ts
|
|
48318
|
-
import { useState as useState90, useCallback as useCallback37, useRef as
|
|
48397
|
+
import { useState as useState90, useCallback as useCallback37, useRef as useRef97, useEffect as useEffect100 } from "react";
|
|
48319
48398
|
function useApprovalActions(options) {
|
|
48320
48399
|
const { formInstanceId, formUuid, appType, currentTaskId, onActionComplete, getFormValues } = options;
|
|
48321
48400
|
const { api } = useFormContext();
|
|
@@ -48324,7 +48403,7 @@ function useApprovalActions(options) {
|
|
|
48324
48403
|
const [currentAction, setCurrentAction] = useState90(null);
|
|
48325
48404
|
const [returnableNodes, setReturnableNodes] = useState90([]);
|
|
48326
48405
|
const [returnPolicy, setReturnPolicy] = useState90(null);
|
|
48327
|
-
const mountedRef =
|
|
48406
|
+
const mountedRef = useRef97(true);
|
|
48328
48407
|
useEffect100(() => {
|
|
48329
48408
|
mountedRef.current = true;
|
|
48330
48409
|
return () => {
|
|
@@ -48952,8 +49031,8 @@ var InnerProcessContent = ({
|
|
|
48952
49031
|
onDelete,
|
|
48953
49032
|
inDrawer = false
|
|
48954
49033
|
}) => {
|
|
48955
|
-
const formDataRef =
|
|
48956
|
-
const validateRef =
|
|
49034
|
+
const formDataRef = useRef98(void 0);
|
|
49035
|
+
const validateRef = useRef98(void 0);
|
|
48957
49036
|
const [withdrawForm] = AntForm.useForm();
|
|
48958
49037
|
const [withdrawOpen, setWithdrawOpen] = useState92(false);
|
|
48959
49038
|
const [withdrawLoading, setWithdrawLoading] = useState92(false);
|
|
@@ -50840,7 +50919,7 @@ function ResizableColumnTitle({
|
|
|
50840
50919
|
onResize: onResize2,
|
|
50841
50920
|
onResizeEnd
|
|
50842
50921
|
}) {
|
|
50843
|
-
const dragRef =
|
|
50922
|
+
const dragRef = useRef99({ startX: 0, startWidth: width, latestWidth: width });
|
|
50844
50923
|
const handleMouseDown = (event) => {
|
|
50845
50924
|
event.preventDefault();
|
|
50846
50925
|
event.stopPropagation();
|
|
@@ -50905,7 +50984,7 @@ var DataManagementList = ({
|
|
|
50905
50984
|
rowActions = [],
|
|
50906
50985
|
maxVisibleRowActions
|
|
50907
50986
|
}) => {
|
|
50908
|
-
const rootRef =
|
|
50987
|
+
const rootRef = useRef99(null);
|
|
50909
50988
|
const api = useMemo67(() => {
|
|
50910
50989
|
if (typeof requestOverride === "function") {
|
|
50911
50990
|
return createFormRuntimeApi({ request: requestOverride });
|
|
@@ -50919,7 +50998,7 @@ var DataManagementList = ({
|
|
|
50919
50998
|
const [showFields, setShowFields] = useState93([]);
|
|
50920
50999
|
const [lockFieldIds, setLockFieldIds] = useState93([]);
|
|
50921
51000
|
const [widths, setWidths] = useState93({});
|
|
50922
|
-
const widthsRef =
|
|
51001
|
+
const widthsRef = useRef99({});
|
|
50923
51002
|
const [sort, setSort] = useState93([]);
|
|
50924
51003
|
const [density, setDensity] = useState93("middle");
|
|
50925
51004
|
const [detailOpenMode, setDetailOpenMode] = useState93("drawer");
|
|
@@ -50954,7 +51033,7 @@ var DataManagementList = ({
|
|
|
50954
51033
|
const [activeRecord, setActiveRecord] = useState93(null);
|
|
50955
51034
|
const [detailOpen, setDetailOpen] = useState93(false);
|
|
50956
51035
|
const [submitOpen, setSubmitOpen] = useState93(false);
|
|
50957
|
-
const fetchStateRef =
|
|
51036
|
+
const fetchStateRef = useRef99({});
|
|
50958
51037
|
const isProcessForm = isProcessFormType(formType);
|
|
50959
51038
|
const request = api.request;
|
|
50960
51039
|
const getPopupContainer = useCallback39(
|