관리자 목록 more vert 메뉴 통일 및 태그 메뉴 정렬 수정
AdminRowMoreMenu 공통 컴포넌트로 글·태그·페이지·미디어·네비게이션 행 액션을 ⋮ 팝오버로 통일. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
45
composables/useAdminRowMenu.js
Normal file
45
composables/useAdminRowMenu.js
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* 관리자 테이블·목록 행 more vert 메뉴 열림 상태
|
||||
* @returns {{ openMenuId: import('vue').Ref<string>, closeMenu: () => void }}
|
||||
*/
|
||||
export const useAdminRowMenu = () => {
|
||||
const openMenuId = ref('')
|
||||
|
||||
/**
|
||||
* 열린 메뉴를 닫는다.
|
||||
* @returns {void}
|
||||
*/
|
||||
const closeMenu = () => {
|
||||
openMenuId.value = ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 문서 바깥 클릭 시 메뉴를 닫는다.
|
||||
* @param {PointerEvent} event - 포인터 이벤트
|
||||
* @returns {void}
|
||||
*/
|
||||
const onDocumentPointerDown = (event) => {
|
||||
if (!openMenuId.value || !(event.target instanceof HTMLElement)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (event.target.closest('[data-admin-row-menu]')) {
|
||||
return
|
||||
}
|
||||
|
||||
closeMenu()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
document.addEventListener('pointerdown', onDocumentPointerDown)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
document.removeEventListener('pointerdown', onDocumentPointerDown)
|
||||
})
|
||||
|
||||
return {
|
||||
openMenuId,
|
||||
closeMenu
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user