From 681c3451967efc180a4f8d643ddb6e1f60dfae45 Mon Sep 17 00:00:00 2001 From: charlie Date: Sat, 14 Sep 2024 14:28:41 +0800 Subject: [PATCH] enhance(ui): incorrect separator item for the property dropdown editor --- .../frontend/components/property/config.cljs | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/main/frontend/components/property/config.cljs b/src/main/frontend/components/property/config.cljs index 65be88c8a..8128fdfd2 100644 --- a/src/main/frontend/components/property/config.cljs +++ b/src/main/frontend/components/property/config.cljs @@ -550,23 +550,26 @@ (update-cardinality-fn))))})) (shui/dropdown-menu-separator) - (when (and (not (contains? #{:logseq.property/parent :logseq.property.class/properties} (:db/ident property))) - (not - (and (= :default (get-in property [:block/schema :type])) - (empty? (:property/closed-values property)) - (contains? #{nil :properties} (:position property-schema))))) - (let [position (:position property-schema)] - (dropdown-editor-menuitem {:icon :float-left :title "UI position" :desc (some->> position (get position-labels) (:title)) - :item-props {:class "ui__position-trigger-item"} - :submenu-content (fn [ops] (ui-position-sub-pane property (assoc ops :position position)))}))) - (when (not (contains? #{:logseq.property/parent :logseq.property.class/properties} (:db/ident property))) - (dropdown-editor-menuitem {:icon :eye-off :title "Hide by default" :toggle-checked? (boolean (:hide? property-schema)) - :on-toggle-checked-change #(db-property-handler/upsert-property! (:db/ident property) - (assoc property-schema :hide? %) {})})) + (let [group' (->> [:<> + (when (and (not (contains? #{:logseq.property/parent :logseq.property.class/properties} (:db/ident property))) + (not + (and (= :default (get-in property [:block/schema :type])) + (empty? (:property/closed-values property)) + (contains? #{nil :properties} (:position property-schema))))) + (let [position (:position property-schema)] + (dropdown-editor-menuitem {:icon :float-left :title "UI position" :desc (some->> position (get position-labels) (:title)) + :item-props {:class "ui__position-trigger-item"} + :submenu-content (fn [ops] (ui-position-sub-pane property (assoc ops :position position)))}))) - (when owner-block - (shui/dropdown-menu-separator)) + (when (not (contains? #{:logseq.property/parent :logseq.property.class/properties} (:db/ident property))) + (dropdown-editor-menuitem {:icon :eye-off :title "Hide by default" :toggle-checked? (boolean (:hide? property-schema)) + :on-toggle-checked-change #(db-property-handler/upsert-property! (:db/ident property) + (assoc property-schema :hide? %) {})}))] + (remove nil?) + (into []))] + (when (and owner-block (> (count group') 1)) + (conj group' (shui/dropdown-menu-separator)))) (when owner-block (dropdown-editor-menuitem