@svadmin/ui 0.137.0 → 0.137.2
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.
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
const resources = $derived(adminContext.resources.filter((resource) => resource.meta?.['aboutVisible'] !== false));
|
|
12
12
|
const providerNames = $derived(adminContext.getDataProviderNames());
|
|
13
13
|
let { version: suppliedVersion, headingLevel = 'h1' }: { version?: string; headingLevel?: 'h1' | 'h2' } = $props();
|
|
14
|
-
const buildVersion = "0.137.
|
|
14
|
+
const buildVersion = "0.137.2";
|
|
15
15
|
const version = $derived(suppliedVersion ?? (
|
|
16
16
|
buildVersion.startsWith('__')
|
|
17
17
|
? (i18n.locale === 'zh-CN' ? '开发构建(未提供版本)' : 'Development build (version unavailable)')
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { AutoTableGridState } from './auto-table-grid.js';
|
|
4
4
|
import { definedOptions } from '@svadmin/core/options';
|
|
5
5
|
|
|
6
|
-
import { untrack } from 'svelte';
|
|
6
|
+
import { tick, untrack } from 'svelte';
|
|
7
7
|
import { cn } from '../utils.js';
|
|
8
8
|
import {
|
|
9
9
|
createTable,
|
|
@@ -949,7 +949,38 @@
|
|
|
949
949
|
markSavedViewDirty();
|
|
950
950
|
listState.pagination = { ...pagination, current: page };
|
|
951
951
|
}
|
|
952
|
-
function refreshList() {
|
|
952
|
+
async function refreshList(): Promise<void> {
|
|
953
|
+
if (!canRead || query.isFetching) return;
|
|
954
|
+
const previousPage = pagination.current ?? 1;
|
|
955
|
+
// 受控分页由宿主决定;内部列表刷新只对非受控分页回到第一页。
|
|
956
|
+
if (previousPage === 1 || externalPagination) {
|
|
957
|
+
await listResult.refetch();
|
|
958
|
+
return;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
markSavedViewDirty();
|
|
962
|
+
listState.pagination = { ...pagination, current: 1 };
|
|
963
|
+
try {
|
|
964
|
+
await tick();
|
|
965
|
+
const tenant = adminContext.queryKeyMatcher(resourceName).tenant;
|
|
966
|
+
const matchesFirstPage = (candidate: { queryKey: readonly unknown[] }): boolean => {
|
|
967
|
+
const descriptor = parseQueryKey(candidate.queryKey);
|
|
968
|
+
if (!descriptor || descriptor.kind !== 'data' || descriptor.action !== 'list'
|
|
969
|
+
|| descriptor.resource !== resourceName
|
|
970
|
+
|| (binding.dataProviderName ?? 'default') !== descriptor.provider
|
|
971
|
+
|| descriptor.tenant !== tenant) return false;
|
|
972
|
+
if (!descriptor.params || typeof descriptor.params !== 'object' || Array.isArray(descriptor.params)) return false;
|
|
973
|
+
const params = descriptor.params as { pagination?: { current?: unknown }; filters?: unknown; sorters?: unknown };
|
|
974
|
+
return params.pagination?.current === 1
|
|
975
|
+
&& JSON.stringify(params.filters ?? []) === JSON.stringify(queryFilters)
|
|
976
|
+
&& JSON.stringify(params.sorters ?? []) === JSON.stringify(querySorters);
|
|
977
|
+
};
|
|
978
|
+
await queryClient.refetchQueries({ type: 'active', predicate: matchesFirstPage });
|
|
979
|
+
} catch {
|
|
980
|
+
// The first-page query owns the error state and remains retryable in place.
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
function retryList(): void {
|
|
953
984
|
if (canRead && !query.isFetching) void listResult.refetch();
|
|
954
985
|
}
|
|
955
986
|
function refreshPermission() {
|
|
@@ -1541,7 +1572,7 @@
|
|
|
1541
1572
|
<DataState
|
|
1542
1573
|
state="error"
|
|
1543
1574
|
description={i18n.t('common.operationFailed')}
|
|
1544
|
-
retry={
|
|
1575
|
+
retry={retryList}
|
|
1545
1576
|
/>
|
|
1546
1577
|
{:else if gridBody && pageRecords.data.length > 0}
|
|
1547
1578
|
{@render gridBody({ records: pageRecords.data.map(copyTableRecord), columns: gridColumns, primaryKey: 'id',
|
|
@@ -116,6 +116,10 @@
|
|
|
116
116
|
event.preventDefault();
|
|
117
117
|
initialMenuFocus = event.key === 'ArrowUp' ? 'last' : 'first';
|
|
118
118
|
trigger.click();
|
|
119
|
+
} else if (trigger && event.key === 'Escape' && overflowOpen) {
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
restoreFocusOnClose = true;
|
|
122
|
+
overflowOpen = false;
|
|
119
123
|
} else if (content && event.key === 'Escape') {
|
|
120
124
|
event.preventDefault();
|
|
121
125
|
restoreFocusOnClose = true;
|