diff --git a/src/views/manage/FileManageView.vue b/src/views/manage/FileManageView.vue index 1d8c6ce..0b64aed 100644 --- a/src/views/manage/FileManageView.vue +++ b/src/views/manage/FileManageView.vue @@ -953,29 +953,29 @@ -
+
{{ t('fileManage.form.code') }}
-+
{{ selectedFileDetail.code }}
-+
{{ selectedFileDetail.displayRetrieveUrl }}
+
{{ t('fileManage.statusInsight') }}
-{{ item.label }}
-+
{{ item.label }}
+{{ item.value }}
{{ item.label }}
-+
{{ item.label }}
+{{ item.value }}
+
{{ item.displayDescription }}
-{{ event.displayTitle }}
{{ event.displayMeta }}
{{ event.displayDescription }}
+{{ event.displayDescription }}
{{ item.label }}
+{{ item.label }}
{{ item.value }} @@ -1870,88 +1870,117 @@ const visibleDetailTimeline = computed(() => isLifecycleExpanded.value ? detailTimelineRows.value : detailTimelineRows.value.slice(0, 3) ) -const LIFECYCLE_ANIMATION_MS = 180 +const LIFECYCLE_ENTER_MS = 160 +const LIFECYCLE_LEAVE_MS = 120 +const lifecycleEasing = 'cubic-bezier(0.22, 1, 0.36, 1)' +const lifecycleExitEasing = 'cubic-bezier(0.4, 0, 1, 1)' +const reducedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)') + const getAnimationDelay = (element: Element) => { const row = element as HTMLElement const siblingIndex = Array.from(row.parentElement?.children || []).indexOf(row) - return Math.min(Math.max(siblingIndex, 0) * 18, 72) + return Math.min(Math.max(siblingIndex, 0) * 12, 36) } + +const playDetailAnimation = ( + element: HTMLElement, + keyframes: Keyframe[], + options: KeyframeAnimationOptions, + done: () => void +) => { + if (reducedMotionQuery.matches) { + done() + return + } + + element.getAnimations().forEach((animation) => animation.cancel()) + const animation = element.animate(keyframes, { fill: 'both', ...options }) + const finish = () => done() + animation.addEventListener('finish', finish, { once: true }) + animation.addEventListener('cancel', finish, { once: true }) +} + const beforeLifecycleRowEnter = (element: Element) => { const row = element as HTMLElement - row.style.height = '0px' - row.style.opacity = '0' - row.style.overflow = 'clip' - row.style.transform = 'translate3d(0, -0.35rem, 0) scale(0.985)' + row.style.willChange = 'transform, opacity' } const enterLifecycleRow = (element: Element, done: () => void) => { const row = element as HTMLElement - const delay = getAnimationDelay(row) - const height = row.scrollHeight - requestAnimationFrame(() => { - row.style.transition = `height ${LIFECYCLE_ANIMATION_MS}ms cubic-bezier(0.22, 1, 0.36, 1) ${delay}ms, opacity ${LIFECYCLE_ANIMATION_MS}ms cubic-bezier(0.22, 1, 0.36, 1) ${delay}ms, transform ${LIFECYCLE_ANIMATION_MS}ms cubic-bezier(0.22, 1, 0.36, 1) ${delay}ms` - row.style.height = `${height}px` - row.style.opacity = '1' - row.style.transform = 'translate3d(0, 0, 0) scale(1)' - window.setTimeout(() => { - row.style.transition = '' - row.style.height = '' - row.style.overflow = '' + playDetailAnimation( + row, + [ + { opacity: 0, transform: 'translate3d(0, -6px, 0) scale(0.985)' }, + { opacity: 1, transform: 'translate3d(0, 0, 0) scale(1)' } + ], + { duration: LIFECYCLE_ENTER_MS, delay: getAnimationDelay(row), easing: lifecycleEasing }, + () => { + row.style.willChange = '' done() - }, LIFECYCLE_ANIMATION_MS + delay) - }) + } + ) } const leaveLifecycleRow = (element: Element, done: () => void) => { const row = element as HTMLElement - row.style.height = `${row.scrollHeight}px` - row.style.overflow = 'clip' - row.style.transition = `height 140ms cubic-bezier(0.4, 0, 1, 1), opacity 140ms cubic-bezier(0.4, 0, 1, 1), transform 140ms cubic-bezier(0.4, 0, 1, 1)` - requestAnimationFrame(() => { - row.style.height = '0px' - row.style.opacity = '0' - row.style.transform = 'translate3d(0, -0.25rem, 0) scale(0.985)' - window.setTimeout(done, 140) - }) + row.style.willChange = 'transform, opacity' + playDetailAnimation( + row, + [ + { opacity: 1, transform: 'translate3d(0, 0, 0) scale(1)' }, + { opacity: 0, transform: 'translate3d(0, -4px, 0) scale(0.99)' } + ], + { duration: LIFECYCLE_LEAVE_MS, easing: lifecycleExitEasing }, + () => { + row.style.willChange = '' + done() + } + ) } const beforeRetrievalPanelEnter = (element: Element) => { const panel = element as HTMLElement panel.style.height = '0px' - panel.style.opacity = '0' - panel.style.transform = 'translate3d(0, -0.25rem, 0)' panel.style.overflow = 'clip' + panel.style.willChange = 'height, opacity, transform' } const enterRetrievalPanel = (element: Element, done: () => void) => { const panel = element as HTMLElement const height = panel.scrollHeight - requestAnimationFrame(() => { - panel.style.transition = `height ${LIFECYCLE_ANIMATION_MS}ms cubic-bezier(0.22, 1, 0.36, 1), opacity ${LIFECYCLE_ANIMATION_MS}ms cubic-bezier(0.22, 1, 0.36, 1), transform ${LIFECYCLE_ANIMATION_MS}ms cubic-bezier(0.22, 1, 0.36, 1)` - panel.style.height = `${height}px` - panel.style.opacity = '1' - panel.style.transform = 'translate3d(0, 0, 0)' - window.setTimeout(done, LIFECYCLE_ANIMATION_MS) - }) + playDetailAnimation( + panel, + [ + { height: '0px', opacity: 0, transform: 'translate3d(0, -4px, 0)' }, + { height: `${height}px`, opacity: 1, transform: 'translate3d(0, 0, 0)' } + ], + { duration: LIFECYCLE_ENTER_MS, easing: lifecycleEasing }, + done + ) } const afterRetrievalPanelEnter = (element: Element) => { const panel = element as HTMLElement panel.style.height = '' - panel.style.opacity = '' - panel.style.transform = '' - panel.style.transition = '' panel.style.overflow = '' + panel.style.willChange = '' } const beforeRetrievalPanelLeave = (element: Element) => { const panel = element as HTMLElement panel.style.height = `${panel.scrollHeight}px` panel.style.overflow = 'clip' + panel.style.willChange = 'height, opacity, transform' } const leaveRetrievalPanel = (element: Element, done: () => void) => { const panel = element as HTMLElement - requestAnimationFrame(() => { - panel.style.transition = `height 140ms cubic-bezier(0.4, 0, 1, 1), opacity 140ms cubic-bezier(0.4, 0, 1, 1), transform 140ms cubic-bezier(0.4, 0, 1, 1)` - panel.style.height = '0px' - panel.style.opacity = '0' - panel.style.transform = 'translate3d(0, -0.25rem, 0)' - window.setTimeout(done, 140) - }) + const height = panel.scrollHeight + playDetailAnimation( + panel, + [ + { height: `${height}px`, opacity: 1, transform: 'translate3d(0, 0, 0)' }, + { height: '0px', opacity: 0, transform: 'translate3d(0, -4px, 0)' } + ], + { duration: LIFECYCLE_LEAVE_MS, easing: lifecycleExitEasing }, + () => { + panel.style.willChange = '' + done() + } + ) } watch( () => selectedFileDetail.value?.id,