mirror of
https://github.com/logseq/logseq.git
synced 2026-05-18 01:42:19 +00:00
fix: close table header dropdown on item click
This commit is contained in:
@@ -133,6 +133,16 @@
|
||||
|
||||
(defonce *last-header-action-target (atom nil))
|
||||
|
||||
(defn- header-dropdown-click-should-hide?
|
||||
[target]
|
||||
(let [menu-item (some-> target (.closest "[role='menuitem']"))
|
||||
submenu-trigger? (= "menu" (some-> menu-item (.getAttribute "aria-haspopup")))]
|
||||
(boolean
|
||||
(and target
|
||||
(not (util/input? target))
|
||||
menu-item
|
||||
(not submenu-trigger?)))))
|
||||
|
||||
(defn header-cp
|
||||
[{:keys [view-entity column-set-sorting! state]} column]
|
||||
(let [sorting (:sorting state)
|
||||
@@ -194,6 +204,10 @@
|
||||
:align "start"
|
||||
:as-dropdown? true
|
||||
:dropdown-menu? true
|
||||
:content-props {:on-click (fn [^js e]
|
||||
(when-let [target (.-target e)]
|
||||
(when (header-dropdown-click-should-hide? target)
|
||||
(shui/popup-hide! popup-id))))}
|
||||
:on-before-hide (fn []
|
||||
(reset! *last-header-action-target el)
|
||||
(js/setTimeout #(reset! *last-header-action-target nil) 128))})))))}
|
||||
|
||||
Reference in New Issue
Block a user