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
|
@@ -43652,6 +43652,7 @@ function AdminList(props) {
|
|
|
43652
43652
|
const [notificationApi, notificationHolder] = notification.useNotification();
|
|
43653
43653
|
const [modalApi, modalHolder] = Modal6.useModal();
|
|
43654
43654
|
const sourceKey = dataSource.key || "anonymous";
|
|
43655
|
+
const listIdentity = JSON.stringify([listKey, sourceKey]);
|
|
43655
43656
|
const [rawPreference, setRawPreference] = useState15(null);
|
|
43656
43657
|
const [preference, setPreference] = useState15(
|
|
43657
43658
|
() => mergeAdminListPreference({
|
|
@@ -43671,7 +43672,8 @@ function AdminList(props) {
|
|
|
43671
43672
|
const [settingsTab, setSettingsTab] = useState15("search");
|
|
43672
43673
|
const [columnSearch, setColumnSearch] = useState15("");
|
|
43673
43674
|
const [expanded, setExpanded] = useState15(false);
|
|
43674
|
-
const [
|
|
43675
|
+
const [readyIdentity, setReadyIdentity] = useState15(null);
|
|
43676
|
+
const ready = readyIdentity === listIdentity;
|
|
43675
43677
|
const [rows, setRows] = useState15([]);
|
|
43676
43678
|
const [total, setTotal] = useState15(0);
|
|
43677
43679
|
const [allowedColumnKeys, setAllowedColumnKeys] = useState15(void 0);
|
|
@@ -43694,9 +43696,12 @@ function AdminList(props) {
|
|
|
43694
43696
|
const [draggedSearchKey, setDraggedSearchKey] = useState15("");
|
|
43695
43697
|
const selectedKeysRef = useRef8([]);
|
|
43696
43698
|
const dataSourceRef = useRef8(dataSource);
|
|
43699
|
+
const listIdentityRef = useRef8(listIdentity);
|
|
43700
|
+
const requestVersionRef = useRef8(0);
|
|
43697
43701
|
const onQueryChangeRef = useRef8(onQueryChange);
|
|
43698
43702
|
const onSelectionChangeRef = useRef8(onSelectionChange);
|
|
43699
43703
|
dataSourceRef.current = dataSource;
|
|
43704
|
+
listIdentityRef.current = listIdentity;
|
|
43700
43705
|
onQueryChangeRef.current = onQueryChange;
|
|
43701
43706
|
onSelectionChangeRef.current = onSelectionChange;
|
|
43702
43707
|
const definitionFingerprint = JSON.stringify({
|
|
@@ -43767,10 +43772,19 @@ function AdminList(props) {
|
|
|
43767
43772
|
}, [rowKey, rowSelectable, rows]);
|
|
43768
43773
|
useEffect14(() => {
|
|
43769
43774
|
let active = true;
|
|
43770
|
-
|
|
43775
|
+
const initializationVersion = ++requestVersionRef.current;
|
|
43776
|
+
setReadyIdentity(null);
|
|
43777
|
+
setRows([]);
|
|
43778
|
+
setTotal(0);
|
|
43779
|
+
setAllowedColumnKeys(void 0);
|
|
43780
|
+
setHiddenFieldsCount(0);
|
|
43781
|
+
setLoading(false);
|
|
43782
|
+
setError(null);
|
|
43771
43783
|
const load = async () => {
|
|
43772
43784
|
const saved = dataSourceRef.current.preferences ? await dataSourceRef.current.preferences.get(listKey).catch(() => null) : null;
|
|
43773
|
-
if (!active)
|
|
43785
|
+
if (!active || initializationVersion !== requestVersionRef.current || listIdentityRef.current !== listIdentity) {
|
|
43786
|
+
return;
|
|
43787
|
+
}
|
|
43774
43788
|
setRawPreference(saved);
|
|
43775
43789
|
const merged = mergeAdminListPreference({
|
|
43776
43790
|
version: configVersion,
|
|
@@ -43798,7 +43812,7 @@ function AdminList(props) {
|
|
|
43798
43812
|
selectedKeysRef.current = [];
|
|
43799
43813
|
setSelectedKeys([]);
|
|
43800
43814
|
previousFingerprintRef.current = "";
|
|
43801
|
-
|
|
43815
|
+
setReadyIdentity(listIdentity);
|
|
43802
43816
|
};
|
|
43803
43817
|
void load();
|
|
43804
43818
|
return () => {
|
|
@@ -43810,8 +43824,7 @@ function AdminList(props) {
|
|
|
43810
43824
|
defaultVisibleSearchCount,
|
|
43811
43825
|
definitionFingerprint,
|
|
43812
43826
|
form,
|
|
43813
|
-
|
|
43814
|
-
sourceKey
|
|
43827
|
+
listIdentity
|
|
43815
43828
|
]);
|
|
43816
43829
|
useEffect14(() => {
|
|
43817
43830
|
if (!allowedColumnKeys) return;
|
|
@@ -43846,28 +43859,34 @@ function AdminList(props) {
|
|
|
43846
43859
|
]);
|
|
43847
43860
|
const loadData = useCallback12(async () => {
|
|
43848
43861
|
if (!ready) return;
|
|
43862
|
+
const requestVersion = ++requestVersionRef.current;
|
|
43863
|
+
const requestedIdentity = listIdentity;
|
|
43864
|
+
const requestedDataSource = dataSourceRef.current;
|
|
43865
|
+
const isCurrentRequest = () => requestVersion === requestVersionRef.current && requestedIdentity === listIdentityRef.current;
|
|
43849
43866
|
setLoading(true);
|
|
43850
43867
|
setError(null);
|
|
43851
43868
|
onQueryChangeRef.current?.(query);
|
|
43852
43869
|
try {
|
|
43853
|
-
const result = await
|
|
43870
|
+
const result = await requestedDataSource.query(query);
|
|
43871
|
+
if (!isCurrentRequest()) return;
|
|
43854
43872
|
setRows(result.rows || []);
|
|
43855
43873
|
setTotal(Math.max(0, Number(result.total || 0)));
|
|
43856
43874
|
setAllowedColumnKeys(result.allowedColumnKeys);
|
|
43857
43875
|
setHiddenFieldsCount(Math.max(0, Number(result.hiddenFieldsCount || 0)));
|
|
43858
43876
|
} catch (requestError) {
|
|
43877
|
+
if (!isCurrentRequest()) return;
|
|
43859
43878
|
setRows([]);
|
|
43860
43879
|
setTotal(0);
|
|
43861
43880
|
setError(
|
|
43862
43881
|
requestError instanceof Error ? requestError : new Error(String(requestError || "\u6570\u636E\u52A0\u8F7D\u5931\u8D25"))
|
|
43863
43882
|
);
|
|
43864
43883
|
} finally {
|
|
43865
|
-
setLoading(false);
|
|
43884
|
+
if (isCurrentRequest()) setLoading(false);
|
|
43866
43885
|
}
|
|
43867
|
-
}, [query, ready]);
|
|
43886
|
+
}, [listIdentity, query, ready]);
|
|
43868
43887
|
useEffect14(() => {
|
|
43869
43888
|
if (!ready) return;
|
|
43870
|
-
const fingerprint = queryFingerprint(query,
|
|
43889
|
+
const fingerprint = queryFingerprint(query, listIdentity);
|
|
43871
43890
|
if (previousFingerprintRef.current && previousFingerprintRef.current !== fingerprint && selectedKeysRef.current.length) {
|
|
43872
43891
|
clearSelection("\u67E5\u8BE2\u6761\u4EF6\u6216\u6392\u5E8F\u5DF2\u53D8\u5316\uFF0C\u5DF2\u6E05\u7A7A\u8DE8\u9875\u9009\u62E9");
|
|
43873
43892
|
}
|
|
@@ -43878,7 +43897,7 @@ function AdminList(props) {
|
|
|
43878
43897
|
loadData,
|
|
43879
43898
|
query,
|
|
43880
43899
|
ready,
|
|
43881
|
-
|
|
43900
|
+
listIdentity
|
|
43882
43901
|
]);
|
|
43883
43902
|
const visibleSearchFields = useMemo17(() => {
|
|
43884
43903
|
const searchMap = new Map(searchFields.map((field) => [field.key, field]));
|