@kevairy/template 0.1.6 → 0.1.7

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.
Files changed (43) hide show
  1. package/package.json +1 -1
  2. package/template/.agents/skills/kevairy-ui/SKILL.md +4 -0
  3. package/template/.agents/skills/kevairy-ui/references/component-catalog.md +1 -0
  4. package/template/.agents/skills/kevairy-ui/references/form-drawer.md +22 -0
  5. package/template/AGENTS.md +12 -0
  6. package/template/README.md +14 -0
  7. package/template/package.json +3 -2
  8. package/template/public/licenses/noto-sans-sc-OFL.txt +93 -0
  9. package/template/src/assets/images/svg/500.svg +5 -0
  10. package/template/src/assets/styles/core/el-ui.scss +0 -3
  11. package/template/src/assets/styles/core/router-transition.scss +36 -4
  12. package/template/src/assets/styles/core/tailwind.css +3 -0
  13. package/template/src/assets/styles/custom/search-table.scss +8 -0
  14. package/template/src/assets/styles/custom/typography.scss +88 -0
  15. package/template/src/components/core/feedback/art-page-loading/index.vue +1 -1
  16. package/template/src/components/core/layouts/art-header-bar/index.vue +21 -1
  17. package/template/src/components/core/layouts/art-menus/art-horizontal-menu/widget/HorizontalSubmenu.vue +7 -1
  18. package/template/src/components/core/layouts/art-menus/art-sidebar-menu/index.vue +1 -0
  19. package/template/src/components/core/layouts/art-menus/art-sidebar-menu/style.scss +2 -1
  20. package/template/src/components/core/layouts/art-menus/art-sidebar-menu/theme.scss +7 -0
  21. package/template/src/components/core/layouts/art-menus/art-sidebar-menu/widget/SidebarSubmenu.vue +2 -2
  22. package/template/src/components/core/layouts/art-work-tab/index.vue +8 -15
  23. package/template/src/components/core/views/exception/ArtException.vue +8 -5
  24. package/template/src/hooks/core/useChart.ts +22 -2
  25. package/template/src/locales/langs/en.json +1 -1
  26. package/template/src/locales/langs/zh.json +1 -1
  27. package/template/src/main.ts +3 -0
  28. package/template/src/router/core/access.ts +11 -0
  29. package/template/src/types/router/index.ts +2 -0
  30. package/template/src/utils/ui/loading.ts +7 -1
  31. package/template/src/views/examples/crud-workspace/index.vue +103 -30
  32. package/template/src/views/examples/search-table/index.vue +1 -1
  33. package/template/src/views/exception/500/index.vue +35 -32
  34. package/template/src/views/index/index.vue +58 -2
  35. package/template/src/views/index/style.scss +91 -13
  36. package/template/tests/e2e/drawer.spec.ts +85 -0
  37. package/template/tests/e2e/form-drawer.spec.ts +128 -0
  38. package/template/tests/e2e/layout-motion.spec.ts +189 -0
  39. package/template/tests/e2e/search-table.spec.ts +6 -5
  40. package/template/tests/e2e/session-recovery.spec.ts +6 -8
  41. package/template/tests/e2e/typography.spec.ts +118 -0
  42. package/template/tests/unit/permissions/rules.spec.ts +29 -0
  43. package/template/vite.config.ts +2 -0
@@ -257,7 +257,7 @@
257
257
  "500": "Sorry, there was an error on the server",
258
258
  "gohome": "Go Home",
259
259
  "retryDescription": "The page could not be loaded. Retry initialization, or contact your administrator if the problem continues.",
260
- "retry": "Retry loading",
260
+ "retry": "Retry",
261
261
  "resourceFailure": "Page resources could not be loaded. A new version may have been deployed. Reload to fetch the latest resources.",
262
262
  "reload": "Reload and retry"
263
263
  },
@@ -257,7 +257,7 @@
257
257
  "500": "抱歉,服务器出错了",
258
258
  "gohome": "返回首页",
259
259
  "retryDescription": "页面加载失败,可以重试初始化。若仍无法恢复,请联系管理员。",
260
- "retry": "重新加载页面",
260
+ "retry": "重试访问",
261
261
  "resourceFailure": "页面资源加载失败,可能刚刚发布了新版本。刷新后将重新加载资源。",
262
262
  "reload": "刷新并重试"
263
263
  },
@@ -3,10 +3,13 @@ import { createApp } from 'vue'
3
3
  import { initStore } from './store' // Store
4
4
  import { initRouter } from './router' // Router
5
5
  import language from './locales' // 国际化
6
+ import '@fontsource-variable/noto-sans-sc' // 本地中文可变字体
6
7
  import '@styles/core/tailwind.css' // tailwind
7
8
  import 'element-plus/dist/index.css' // Element Plus 基础样式(覆盖组件包内部依赖)
8
9
  import '@styles/index.scss' // 样式
9
10
  import '@kevairy/components/style.css' // 公共组件样式
11
+ import '@styles/custom/search-table.scss' // 应用表格配色
12
+ import '@styles/custom/typography.scss' // 统一字体排版
10
13
  import '@utils/sys/console.ts' // 控制台输出内容
11
14
  import { setupGlobDirectives } from './directives'
12
15
  import { setupErrorHandle, setupGlobalErrorHandlers } from './utils/sys/error-handle'
@@ -67,6 +67,17 @@ export function filterAccessibleRoutes(
67
67
  (!route.component || route.component === '/index/index')
68
68
  )
69
69
  return []
70
+ // 先完成父子权限校验,再折叠仅用于路由和权限组织的单页菜单容器。
71
+ // 访问守卫仍基于原始路由树校验全部祖先限制。
72
+ if (
73
+ route.meta.isMenuWrapper &&
74
+ !route.meta.isHide &&
75
+ children?.length === 1 &&
76
+ !children[0].meta.isHide
77
+ ) {
78
+ const child = children[0]
79
+ return [{ ...child, path: child.path.startsWith('/') ? child.path : `/${child.path}` }]
80
+ }
70
81
  let redirect = route.redirect
71
82
  if (
72
83
  children?.length &&
@@ -54,6 +54,8 @@ export interface RouteMeta extends Record<string | number | symbol, unknown> {
54
54
  }>
55
55
  /** 是否为一级菜单 */
56
56
  isFirstLevel?: boolean
57
+ /** 单页菜单容器;授权过滤后折叠显示,访问仍校验原始祖先权限。 */
58
+ isMenuWrapper?: boolean
57
59
  /** 角色权限 */
58
60
  roles?: string[]
59
61
  /** 进入页面所需的操作权限,与 authList 的动作描述分离。 */
@@ -28,7 +28,7 @@
28
28
  * @module utils/ui/loading
29
29
  * @author Art Design Pro Team
30
30
  */
31
- import { createVNode, render } from 'vue'
31
+ import { createVNode, readonly, render, shallowRef } from 'vue'
32
32
  import ArtPageLoading from '@/components/core/feedback/art-page-loading/index.vue'
33
33
  import AppConfig from '@/config'
34
34
 
@@ -45,6 +45,7 @@ let previousBodyOverflow = ''
45
45
  let loadingStartedAt = 0
46
46
  let hideTimer: number | null = null
47
47
  let isLeaving = false
48
+ const isVisible = shallowRef(false)
48
49
 
49
50
  const prefersReducedMotion = (): boolean =>
50
51
  window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false
@@ -95,6 +96,7 @@ const closeLoadingImmediately = (): void => {
95
96
  loadingInstance = null
96
97
  loadingStartedAt = 0
97
98
  isLeaving = false
99
+ isVisible.value = false
98
100
  }
99
101
  }
100
102
 
@@ -114,6 +116,9 @@ const startLoadingExit = (): void => {
114
116
  }
115
117
 
116
118
  export const loadingService = {
119
+ // 布局在遮罩移除后开始入场,避免动画在加载层下提前播放。
120
+ isVisible: readonly(isVisible),
121
+
117
122
  /**
118
123
  * 显示 loading
119
124
  * @returns 关闭 loading 的函数
@@ -125,6 +130,7 @@ export const loadingService = {
125
130
  if (!loadingInstance) {
126
131
  loadingStartedAt = Date.now()
127
132
  loadingInstance = createLoading()
133
+ isVisible.value = true
128
134
  } else if (wasLeaving) {
129
135
  isLeaving = false
130
136
  loadingStartedAt = Date.now()
@@ -15,7 +15,7 @@
15
15
  <section class="table-shell" aria-label="资源列表">
16
16
  <KvSearchTablePage
17
17
  ref="tableRef"
18
- title="资源目录"
18
+ aria-label="资源目录搜索表格"
19
19
  row-key="id"
20
20
  :search-items="searchItems"
21
21
  :columns="columns"
@@ -39,6 +39,7 @@
39
39
  </template>
40
40
  <template #operation="{ row }">
41
41
  <div class="row-actions">
42
+ <ElButton link type="primary" @click="openDetails(row)">查看</ElButton>
42
43
  <ElButton link type="primary" @click="openEdit(row)">编辑</ElButton>
43
44
  <ElButton link type="danger" @click="removeOne(row)">删除</ElButton>
44
45
  </div>
@@ -46,16 +47,50 @@
46
47
  </KvSearchTablePage>
47
48
  </section>
48
49
 
49
- <KvDialog
50
- v-model="dialogVisible"
50
+ <KvDrawer v-model="detailsVisible" title="资源详情" @closed="selectedResource = undefined">
51
+ <section v-if="selectedResource" class="resource-details art-card">
52
+ <KvSectionTitle title="基本信息" />
53
+ <dl class="resource-details__fields">
54
+ <div
55
+ ><dt>资源名称</dt><dd>{{ selectedResource.name }}</dd></div
56
+ >
57
+ <div
58
+ ><dt>资源编码</dt><dd>{{ selectedResource.code }}</dd></div
59
+ >
60
+ <div
61
+ ><dt>负责人</dt><dd>{{ selectedResource.owner }}</dd></div
62
+ >
63
+ <div>
64
+ <dt>状态</dt>
65
+ <dd
66
+ ><ElTag :type="getStatusMeta(selectedResource.status).type">{{
67
+ getStatusMeta(selectedResource.status).label
68
+ }}</ElTag></dd
69
+ >
70
+ </div>
71
+ <div
72
+ ><dt>更新时间</dt><dd>{{ selectedResource.updatedAt }}</dd></div
73
+ >
74
+ </dl>
75
+ </section>
76
+ </KvDrawer>
77
+
78
+ <KvFormDrawer
79
+ v-model="drawerVisible"
51
80
  :title="editingId ? '编辑资源' : '新增资源'"
52
- width="min(560px, calc(100vw - 24px))"
53
- draggable
54
- resizable
55
- destroy-on-close
81
+ :submitting="saving"
82
+ :dirty="dirty"
83
+ @submit="saveResource"
56
84
  @closed="resetForm"
57
85
  >
58
- <ElForm ref="formRef" :model="form" :rules="rules" label-position="top">
86
+ <ElForm
87
+ ref="formRef"
88
+ :model="form"
89
+ :rules="rules"
90
+ :disabled="saving"
91
+ label-position="top"
92
+ @submit.prevent="saveResource"
93
+ >
59
94
  <div class="form-grid">
60
95
  <ElFormItem label="资源名称" prop="name">
61
96
  <ElInput v-model.trim="form.name" placeholder="例如:事件中心" autocomplete="off" />
@@ -78,16 +113,12 @@
78
113
  </ElFormItem>
79
114
  </div>
80
115
  </ElForm>
81
- <template #footer>
82
- <ElButton @click="dialogVisible = false">取消</ElButton>
83
- <ElButton type="primary" :loading="saving" @click="saveResource">保存</ElButton>
84
- </template>
85
- </KvDialog>
116
+ </KvFormDrawer>
86
117
  </main>
87
118
  </template>
88
119
 
89
120
  <script setup lang="ts">
90
- import { KvDialog, KvSearchTablePage } from '@kevairy/components'
121
+ import { KvDrawer, KvFormDrawer, KvSearchTablePage, KvSectionTitle } from '@kevairy/components'
91
122
  import type { ColumnOption, PagedTableRequest, SearchFormItem } from '@kevairy/components'
92
123
  import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
93
124
 
@@ -192,7 +223,7 @@
192
223
  { prop: 'owner', label: '负责人', minWidth: 130 },
193
224
  { prop: 'status', label: '状态', width: 100, useSlot: true },
194
225
  { prop: 'updatedAt', label: '更新时间', minWidth: 170 },
195
- { prop: 'operation', label: '操作', width: 130, fixed: 'right', disabled: true, useSlot: true }
226
+ { prop: 'operation', label: '操作', width: 170, fixed: 'right', disabled: true, useSlot: true }
196
227
  ]
197
228
 
198
229
  const fetchPage = async ({ query, current, size, signal }: PagedTableRequest<ResourceQuery>) => {
@@ -218,11 +249,23 @@
218
249
 
219
250
  const tableRef = ref<{ refresh: () => Promise<void> | void }>()
220
251
  const formRef = ref<FormInstance>()
221
- const dialogVisible = ref(false)
252
+ const drawerVisible = ref(false)
253
+ const detailsVisible = ref(false)
254
+ const selectedResource = ref<ResourceRecord>()
255
+ const openDetails = (row: ResourceRecord) => {
256
+ selectedResource.value = row
257
+ detailsVisible.value = true
258
+ }
222
259
  const saving = ref(false)
223
260
  const editingId = ref<number>()
224
261
  const createForm = () => ({ name: '', code: '', owner: '', status: 'draft' as ResourceStatus })
225
262
  const form = reactive(createForm())
263
+ const initialForm = ref(createForm())
264
+ const dirty = computed(() =>
265
+ (Object.keys(initialForm.value) as (keyof typeof form)[]).some(
266
+ (key) => form[key] !== initialForm.value[key]
267
+ )
268
+ )
226
269
  const rules: FormRules = {
227
270
  name: [{ required: true, message: '请输入资源名称', trigger: 'blur' }],
228
271
  code: [
@@ -237,31 +280,39 @@
237
280
  }
238
281
  const resetForm = () => {
239
282
  editingId.value = undefined
240
- Object.assign(form, createForm())
283
+ initialForm.value = createForm()
284
+ Object.assign(form, initialForm.value)
241
285
  formRef.value?.clearValidate()
242
286
  }
243
287
  const openCreate = () => {
244
288
  resetForm()
245
- dialogVisible.value = true
289
+ drawerVisible.value = true
246
290
  }
247
291
  const openEdit = (row: ResourceRecord) => {
248
292
  editingId.value = row.id
249
- Object.assign(form, row)
250
- dialogVisible.value = true
293
+ initialForm.value = { name: row.name, code: row.code, owner: row.owner, status: row.status }
294
+ Object.assign(form, initialForm.value)
295
+ drawerVisible.value = true
251
296
  }
252
297
  const saveResource = async () => {
253
- if (!(await formRef.value?.validate().catch(() => false))) return
298
+ if (saving.value) return
254
299
  saving.value = true
255
- await new Promise((resolve) => window.setTimeout(resolve, 420))
256
- if (editingId.value) {
257
- const index = records.value.findIndex((item) => item.id === editingId.value)
258
- if (index >= 0) records.value[index] = { ...records.value[index], ...form, updatedAt: '刚刚' }
259
- } else {
260
- records.value.unshift({ id: Date.now(), ...form, updatedAt: '刚刚' })
300
+ try {
301
+ if (!(await formRef.value?.validate().catch(() => false))) return
302
+ await new Promise((resolve) => window.setTimeout(resolve, 420))
303
+ if (editingId.value) {
304
+ const index = records.value.findIndex((item) => item.id === editingId.value)
305
+ if (index >= 0)
306
+ records.value[index] = { ...records.value[index], ...form, updatedAt: '刚刚' }
307
+ } else {
308
+ records.value.unshift({ id: Date.now(), ...form, updatedAt: '刚刚' })
309
+ }
310
+ // Programmatic closing after a successful save skips the discard confirmation.
311
+ drawerVisible.value = false
312
+ ElMessage.success(editingId.value ? '资源已更新' : '资源已创建')
313
+ } finally {
314
+ saving.value = false
261
315
  }
262
- saving.value = false
263
- dialogVisible.value = false
264
- ElMessage.success(editingId.value ? '资源已更新' : '资源已创建')
265
316
  await tableRef.value?.refresh()
266
317
  }
267
318
  const confirmRemove = (count: number) =>
@@ -295,6 +346,28 @@
295
346
  </script>
296
347
 
297
348
  <style scoped lang="scss">
349
+ .resource-details {
350
+ padding: 22px;
351
+ }
352
+
353
+ .resource-details__fields {
354
+ display: grid;
355
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
356
+ gap: 24px 36px;
357
+ margin: 24px 0 0;
358
+
359
+ dt {
360
+ margin-bottom: 8px;
361
+ font-size: 12px;
362
+ color: var(--el-text-color-secondary);
363
+ }
364
+
365
+ dd {
366
+ margin: 0;
367
+ overflow-wrap: anywhere;
368
+ }
369
+ }
370
+
298
371
  .crud-page {
299
372
  display: flex;
300
373
  flex-direction: column;
@@ -11,7 +11,7 @@
11
11
  <section class="table-shell" aria-label="服务目录">
12
12
  <KvSearchTablePage
13
13
  data-testid="service-search-table"
14
- title="服务目录"
14
+ aria-label="服务目录搜索表格"
15
15
  row-key="id"
16
16
  :search-items="searchItems"
17
17
  :columns="serviceTableColumns"
@@ -1,53 +1,56 @@
1
1
  <template>
2
- <main class="page-content">
3
- <KvStatus
4
- type="error"
5
- title="500"
6
- :description="
7
- errorMessage ||
8
- $t(
9
- resourceRecoveryNeeded
10
- ? 'exceptionPage.resourceFailure'
11
- : 'exceptionPage.retryDescription'
12
- )
13
- "
14
- :action-text="
15
- $t(
16
- retrying
17
- ? 'access.checking'
18
- : resourceRecoveryNeeded
19
- ? 'exceptionPage.reload'
20
- : 'exceptionPage.retry'
21
- )
22
- "
23
- @action="retry"
24
- />
2
+ <main>
3
+ <ArtException
4
+ role="alert"
5
+ :data="{
6
+ title: '500',
7
+ desc: errorMessage || $t('exceptionPage.retryDescription'),
8
+ btnText: actionText,
9
+ imgUrl
10
+ }"
11
+ >
12
+ <template #title>
13
+ <h1 class="mb-4 text-5xl font-semibold text-g-900">500</h1>
14
+ </template>
15
+ <template #action>
16
+ <ElButton
17
+ type="primary"
18
+ size="large"
19
+ :loading="retrying"
20
+ class="mt-5 min-h-11"
21
+ @click="retry"
22
+ >
23
+ {{ actionText }}
24
+ </ElButton>
25
+ </template>
26
+ </ArtException>
25
27
  </main>
26
28
  </template>
27
29
 
28
30
  <script setup lang="ts">
29
- import { ref } from 'vue'
30
- import { KvStatus } from '@kevairy/components'
31
+ import { computed, ref } from 'vue'
32
+ import { ElButton } from 'element-plus'
33
+ import { useI18n } from 'vue-i18n'
34
+ import ArtException from '@/components/core/views/exception/ArtException.vue'
35
+ // 恢复页的插图随入口内联,资源加载失败时无需再请求图片。
36
+ import errorSvg from '@imgs/svg/500.svg?raw'
31
37
  import { router } from '@/router'
32
38
  import { resetRouterState } from '@/router/guards/beforeEach'
33
- import { useUserStore } from '@/store/modules/user'
34
- import { resourceRecoveryNeeded, reloadFailedPage } from '@/utils/sys/recovery'
35
39
  import { isRequestCanceled } from '@/utils/http/error'
36
40
 
37
41
  defineOptions({ name: 'Exception500' })
42
+ const { t } = useI18n()
43
+ const imgUrl = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(errorSvg)}`
38
44
  const retrying = ref(false)
39
45
  const errorMessage = ref('')
46
+ const actionText = computed(() => t(retrying.value ? 'access.checking' : 'exceptionPage.retry'))
40
47
  const retry = async () => {
41
48
  if (retrying.value) return
42
- if (resourceRecoveryNeeded.value) {
43
- reloadFailedPage()
44
- return
45
- }
46
49
  retrying.value = true
47
50
  errorMessage.value = ''
48
51
  try {
49
52
  resetRouterState(0)
50
- await router.replace(useUserStore().isLogin ? '/' : '/auth/login')
53
+ await router.replace('/')
51
54
  } catch (error) {
52
55
  if (!isRequestCanceled(error))
53
56
  errorMessage.value = error instanceof Error ? error.message : String(error)
@@ -1,7 +1,13 @@
1
1
  <!-- 布局容器 -->
2
2
  <template>
3
- <div class="app-layout">
4
- <aside id="app-sidebar">
3
+ <div
4
+ class="app-layout"
5
+ :class="{
6
+ 'layout-pending': canAnimateEntrance && entrancePhase === 'pending',
7
+ 'layout-entering': canAnimateEntrance && entrancePhase === 'entering'
8
+ }"
9
+ >
10
+ <aside id="app-sidebar" ref="sidebarRef">
5
11
  <ArtSidebarMenu />
6
12
  </aside>
7
13
 
@@ -21,7 +27,57 @@
21
27
  </template>
22
28
 
23
29
  <script setup lang="ts">
30
+ import { computed, onMounted, ref, watch } from 'vue'
31
+ import { useRoute } from 'vue-router'
32
+ import { useResizeObserver, useTimeoutFn, useWindowSize } from '@vueuse/core'
33
+ import { provideKvDrawerLayout } from '@kevairy/components'
34
+ import { useSettingStore } from '@/store/modules/setting'
35
+ import { loadingService } from '@/utils/ui/loading'
36
+
24
37
  defineOptions({ name: 'AppLayout' })
38
+
39
+ const route = useRoute()
40
+ const settingStore = useSettingStore()
41
+ const sidebarRef = ref<HTMLElement>()
42
+ const sidebarWidth = ref(0)
43
+ const { width: viewportWidth } = useWindowSize()
44
+ useResizeObserver(sidebarRef, ([entry]) => {
45
+ if (entry) sidebarWidth.value = entry.target.getBoundingClientRect().width
46
+ })
47
+ provideKvDrawerLayout(() =>
48
+ viewportWidth.value <= 800 || route.matched.some((r) => r.meta.isFullPage)
49
+ ? 0
50
+ : sidebarWidth.value
51
+ )
52
+ const entrancePhase = ref<'pending' | 'entering' | 'done'>('pending')
53
+ const canAnimateEntrance = computed(
54
+ () => Boolean(settingStore.pageTransition) && !route.matched.some((r) => r.meta.isFullPage)
55
+ )
56
+ const { start: finishEntrance, stop: stopEntrance } = useTimeoutFn(
57
+ () => {
58
+ entrancePhase.value = 'done'
59
+ },
60
+ 500,
61
+ { immediate: false }
62
+ )
63
+
64
+ const startEntrance = () => {
65
+ if (loadingService.isVisible.value || entrancePhase.value !== 'pending') return
66
+ entrancePhase.value = 'entering'
67
+ finishEntrance()
68
+ }
69
+
70
+ onMounted(startEntrance)
71
+ watch(loadingService.isVisible, startEntrance)
72
+
73
+ // 路由切换只播放内容区过渡,快速导航或全屏切换也不重播布局入场。
74
+ watch(
75
+ () => route.path,
76
+ () => {
77
+ entrancePhase.value = 'done'
78
+ stopEntrance()
79
+ }
80
+ )
25
81
  </script>
26
82
 
27
83
  <style lang="scss" scoped>
@@ -1,4 +1,7 @@
1
1
  .app-layout {
2
+ --art-page-gutter: 12px;
3
+ --layout-motion-easing: cubic-bezier(0.22, 1, 0.36, 1);
4
+
2
5
  display: flex;
3
6
  width: 100%;
4
7
  min-height: 100vh;
@@ -29,7 +32,7 @@
29
32
 
30
33
  :deep(.layout-content) {
31
34
  box-sizing: border-box;
32
- width: calc(100% - 40px);
35
+ width: calc(100% - var(--art-page-gutter) * 2);
33
36
  margin: auto;
34
37
 
35
38
  // 子页面默认 style
@@ -46,6 +49,82 @@
46
49
  }
47
50
  }
48
51
 
52
+ // 仅首次布局入场使用;结束后移除类,不保留 transform,保证固定定位和弹层正常。
53
+ @media (prefers-reduced-motion: no-preference) {
54
+ .layout-pending {
55
+ #app-sidebar,
56
+ #app-header,
57
+ #app-content {
58
+ opacity: 0;
59
+ }
60
+ }
61
+
62
+ .layout-entering {
63
+ #app-sidebar {
64
+ --layout-enter-x: -12px;
65
+ --layout-enter-y: 0px;
66
+
67
+ animation: layout-reveal 240ms var(--layout-motion-easing) backwards;
68
+ }
69
+
70
+ #app-header {
71
+ --layout-enter-x: 0px;
72
+ --layout-enter-y: -8px;
73
+
74
+ animation: layout-reveal 220ms var(--layout-motion-easing) 40ms backwards;
75
+ }
76
+
77
+ #app-content {
78
+ // 外层撑满视口剩余高度,只淡入,避免位移扩大主容器的滚动范围。
79
+ animation: layout-reveal-opacity 280ms var(--layout-motion-easing) 90ms backwards;
80
+
81
+ :deep(.art-page-view) {
82
+ // 只在入场期间约束内部区块的视觉溢出,不创建额外滚动容器。
83
+ overflow: clip;
84
+ }
85
+
86
+ // 只分组页面区块与搜索/表格容器,不逐行处理表格,也不影响 Teleport 弹窗。
87
+ :deep(
88
+ .art-page-view
89
+ > :is(section:not(.kv-search-table-page), article, header, .el-card):nth-child(-n + 4)
90
+ ),
91
+ :deep(.kv-search-table:not(.is-fullscreen) > :is(.kv-search-bar, .kv-search-table__card)) {
92
+ --layout-enter-y: 6px;
93
+
94
+ animation: layout-reveal 220ms var(--layout-motion-easing) 90ms backwards;
95
+
96
+ @for $index from 2 through 4 {
97
+ &:nth-child(#{$index}) {
98
+ animation-delay: 90ms + ($index - 1) * 35ms;
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }
104
+
105
+ @keyframes layout-reveal-opacity {
106
+ from {
107
+ opacity: 0;
108
+ }
109
+
110
+ to {
111
+ opacity: 1;
112
+ }
113
+ }
114
+
115
+ @keyframes layout-reveal {
116
+ from {
117
+ opacity: 0;
118
+ transform: translate3d(var(--layout-enter-x, 0), var(--layout-enter-y, 0), 0);
119
+ }
120
+
121
+ to {
122
+ opacity: 1;
123
+ transform: none;
124
+ }
125
+ }
126
+ }
127
+
49
128
  @media only screen and (width <= 1180px) {
50
129
  .app-layout {
51
130
  #app-main {
@@ -70,24 +149,23 @@
70
149
  width: 100%;
71
150
  height: auto;
72
151
  overflow: visible;
152
+ }
153
+ }
154
+ }
73
155
 
74
- #app-content {
75
- :deep(.layout-content) {
76
- width: calc(100% - 40px);
77
- }
78
- }
156
+ // 移动端菜单是独立抽屉,保留它自己的开合效果,避免变换祖先影响遮罩定位。
157
+ @media (width <= 800px) and (prefers-reduced-motion: no-preference) {
158
+ .layout-pending,
159
+ .layout-entering {
160
+ #app-sidebar {
161
+ opacity: 1;
162
+ animation: none;
79
163
  }
80
164
  }
81
165
  }
82
166
 
83
167
  @media only screen and (width <= 640px) {
84
168
  .app-layout {
85
- #app-main {
86
- #app-content {
87
- :deep(.layout-content) {
88
- width: calc(100% - 30px);
89
- }
90
- }
91
- }
169
+ --art-page-gutter: 8px;
92
170
  }
93
171
  }