openxiangda 1.0.246 → 1.0.248
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/lib/cli.js +46 -4
- package/lib/role-resolution.js +57 -0
- package/openxiangda-skills/skills/openxiangda-permission-settings/SKILL.md +5 -0
- package/package.json +4 -1
- package/packages/sdk/dist/runtime/index.cjs +30 -11
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.mjs +30 -11
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +30 -11
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.mjs +30 -11
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
- package/packages/sdk/source/admin-list/AdminList.tsx +36 -11
|
@@ -43678,6 +43678,7 @@ function AdminList(props) {
|
|
|
43678
43678
|
const [notificationApi, notificationHolder] = import_antd12.notification.useNotification();
|
|
43679
43679
|
const [modalApi, modalHolder] = import_antd12.Modal.useModal();
|
|
43680
43680
|
const sourceKey = dataSource.key || "anonymous";
|
|
43681
|
+
const listIdentity = JSON.stringify([listKey, sourceKey]);
|
|
43681
43682
|
const [rawPreference, setRawPreference] = (0, import_react21.useState)(null);
|
|
43682
43683
|
const [preference, setPreference] = (0, import_react21.useState)(
|
|
43683
43684
|
() => mergeAdminListPreference({
|
|
@@ -43697,7 +43698,8 @@ function AdminList(props) {
|
|
|
43697
43698
|
const [settingsTab, setSettingsTab] = (0, import_react21.useState)("search");
|
|
43698
43699
|
const [columnSearch, setColumnSearch] = (0, import_react21.useState)("");
|
|
43699
43700
|
const [expanded, setExpanded] = (0, import_react21.useState)(false);
|
|
43700
|
-
const [
|
|
43701
|
+
const [readyIdentity, setReadyIdentity] = (0, import_react21.useState)(null);
|
|
43702
|
+
const ready = readyIdentity === listIdentity;
|
|
43701
43703
|
const [rows, setRows] = (0, import_react21.useState)([]);
|
|
43702
43704
|
const [total, setTotal] = (0, import_react21.useState)(0);
|
|
43703
43705
|
const [allowedColumnKeys, setAllowedColumnKeys] = (0, import_react21.useState)(void 0);
|
|
@@ -43720,9 +43722,12 @@ function AdminList(props) {
|
|
|
43720
43722
|
const [draggedSearchKey, setDraggedSearchKey] = (0, import_react21.useState)("");
|
|
43721
43723
|
const selectedKeysRef = (0, import_react21.useRef)([]);
|
|
43722
43724
|
const dataSourceRef = (0, import_react21.useRef)(dataSource);
|
|
43725
|
+
const listIdentityRef = (0, import_react21.useRef)(listIdentity);
|
|
43726
|
+
const requestVersionRef = (0, import_react21.useRef)(0);
|
|
43723
43727
|
const onQueryChangeRef = (0, import_react21.useRef)(onQueryChange);
|
|
43724
43728
|
const onSelectionChangeRef = (0, import_react21.useRef)(onSelectionChange);
|
|
43725
43729
|
dataSourceRef.current = dataSource;
|
|
43730
|
+
listIdentityRef.current = listIdentity;
|
|
43726
43731
|
onQueryChangeRef.current = onQueryChange;
|
|
43727
43732
|
onSelectionChangeRef.current = onSelectionChange;
|
|
43728
43733
|
const definitionFingerprint = JSON.stringify({
|
|
@@ -43793,10 +43798,19 @@ function AdminList(props) {
|
|
|
43793
43798
|
}, [rowKey, rowSelectable, rows]);
|
|
43794
43799
|
(0, import_react21.useEffect)(() => {
|
|
43795
43800
|
let active = true;
|
|
43796
|
-
|
|
43801
|
+
const initializationVersion = ++requestVersionRef.current;
|
|
43802
|
+
setReadyIdentity(null);
|
|
43803
|
+
setRows([]);
|
|
43804
|
+
setTotal(0);
|
|
43805
|
+
setAllowedColumnKeys(void 0);
|
|
43806
|
+
setHiddenFieldsCount(0);
|
|
43807
|
+
setLoading(false);
|
|
43808
|
+
setError(null);
|
|
43797
43809
|
const load = async () => {
|
|
43798
43810
|
const saved = dataSourceRef.current.preferences ? await dataSourceRef.current.preferences.get(listKey).catch(() => null) : null;
|
|
43799
|
-
if (!active)
|
|
43811
|
+
if (!active || initializationVersion !== requestVersionRef.current || listIdentityRef.current !== listIdentity) {
|
|
43812
|
+
return;
|
|
43813
|
+
}
|
|
43800
43814
|
setRawPreference(saved);
|
|
43801
43815
|
const merged = mergeAdminListPreference({
|
|
43802
43816
|
version: configVersion,
|
|
@@ -43824,7 +43838,7 @@ function AdminList(props) {
|
|
|
43824
43838
|
selectedKeysRef.current = [];
|
|
43825
43839
|
setSelectedKeys([]);
|
|
43826
43840
|
previousFingerprintRef.current = "";
|
|
43827
|
-
|
|
43841
|
+
setReadyIdentity(listIdentity);
|
|
43828
43842
|
};
|
|
43829
43843
|
void load();
|
|
43830
43844
|
return () => {
|
|
@@ -43836,8 +43850,7 @@ function AdminList(props) {
|
|
|
43836
43850
|
defaultVisibleSearchCount,
|
|
43837
43851
|
definitionFingerprint,
|
|
43838
43852
|
form,
|
|
43839
|
-
|
|
43840
|
-
sourceKey
|
|
43853
|
+
listIdentity
|
|
43841
43854
|
]);
|
|
43842
43855
|
(0, import_react21.useEffect)(() => {
|
|
43843
43856
|
if (!allowedColumnKeys) return;
|
|
@@ -43872,28 +43885,34 @@ function AdminList(props) {
|
|
|
43872
43885
|
]);
|
|
43873
43886
|
const loadData = (0, import_react21.useCallback)(async () => {
|
|
43874
43887
|
if (!ready) return;
|
|
43888
|
+
const requestVersion = ++requestVersionRef.current;
|
|
43889
|
+
const requestedIdentity = listIdentity;
|
|
43890
|
+
const requestedDataSource = dataSourceRef.current;
|
|
43891
|
+
const isCurrentRequest = () => requestVersion === requestVersionRef.current && requestedIdentity === listIdentityRef.current;
|
|
43875
43892
|
setLoading(true);
|
|
43876
43893
|
setError(null);
|
|
43877
43894
|
onQueryChangeRef.current?.(query);
|
|
43878
43895
|
try {
|
|
43879
|
-
const result = await
|
|
43896
|
+
const result = await requestedDataSource.query(query);
|
|
43897
|
+
if (!isCurrentRequest()) return;
|
|
43880
43898
|
setRows(result.rows || []);
|
|
43881
43899
|
setTotal(Math.max(0, Number(result.total || 0)));
|
|
43882
43900
|
setAllowedColumnKeys(result.allowedColumnKeys);
|
|
43883
43901
|
setHiddenFieldsCount(Math.max(0, Number(result.hiddenFieldsCount || 0)));
|
|
43884
43902
|
} catch (requestError) {
|
|
43903
|
+
if (!isCurrentRequest()) return;
|
|
43885
43904
|
setRows([]);
|
|
43886
43905
|
setTotal(0);
|
|
43887
43906
|
setError(
|
|
43888
43907
|
requestError instanceof Error ? requestError : new Error(String(requestError || "\u6570\u636E\u52A0\u8F7D\u5931\u8D25"))
|
|
43889
43908
|
);
|
|
43890
43909
|
} finally {
|
|
43891
|
-
setLoading(false);
|
|
43910
|
+
if (isCurrentRequest()) setLoading(false);
|
|
43892
43911
|
}
|
|
43893
|
-
}, [query, ready]);
|
|
43912
|
+
}, [listIdentity, query, ready]);
|
|
43894
43913
|
(0, import_react21.useEffect)(() => {
|
|
43895
43914
|
if (!ready) return;
|
|
43896
|
-
const fingerprint = queryFingerprint(query,
|
|
43915
|
+
const fingerprint = queryFingerprint(query, listIdentity);
|
|
43897
43916
|
if (previousFingerprintRef.current && previousFingerprintRef.current !== fingerprint && selectedKeysRef.current.length) {
|
|
43898
43917
|
clearSelection("\u67E5\u8BE2\u6761\u4EF6\u6216\u6392\u5E8F\u5DF2\u53D8\u5316\uFF0C\u5DF2\u6E05\u7A7A\u8DE8\u9875\u9009\u62E9");
|
|
43899
43918
|
}
|
|
@@ -43904,7 +43923,7 @@ function AdminList(props) {
|
|
|
43904
43923
|
loadData,
|
|
43905
43924
|
query,
|
|
43906
43925
|
ready,
|
|
43907
|
-
|
|
43926
|
+
listIdentity
|
|
43908
43927
|
]);
|
|
43909
43928
|
const visibleSearchFields = (0, import_react21.useMemo)(() => {
|
|
43910
43929
|
const searchMap = new Map(searchFields.map((field) => [field.key, field]));
|