From e7cd76644b05df114d1a3b7a2d77ed4e63ddd98b Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Wed, 22 May 2024 17:52:52 +0800 Subject: [PATCH] enhance: put remove property after search results --- src/main/frontend/components/property/value.cljs | 9 +++++---- src/main/frontend/components/select.cljs | 9 ++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/frontend/components/property/value.cljs b/src/main/frontend/components/property/value.cljs index 238a1d19b..c2c1450eb 100644 --- a/src/main/frontend/components/property/value.cljs +++ b/src/main/frontend/components/property/value.cljs @@ -234,12 +234,13 @@ (let [selected-choices (->> selected-choices (remove nil?) (remove #(= :logseq.property/empty-placeholder %))) - clear-value (str "No " (:block/original-name property)) + clear-value (str "Remove property " (:block/original-name property)) items' (->> (if (and (seq selected-choices) (not multiple-choices?)) - (cons {:value clear-value - :label clear-value} - items) + (concat items + [{:value clear-value + :label clear-value + :clear? true}]) items) (remove #(= :logseq.property/empty-placeholder (:value %)))) k :on-chosen diff --git a/src/main/frontend/components/select.cljs b/src/main/frontend/components/select.cljs index 7cce04dbc..2cf92edcc 100644 --- a/src/main/frontend/components/select.cljs +++ b/src/main/frontend/components/select.cljs @@ -79,9 +79,12 @@ *toggle (::toggle state) *selected-choices (::selected-choices state) selected-choices (rum/react *selected-choices) - full-choices (->> (concat (map (fn [v] {:value v}) selected-choices) items) - (util/distinct-by-last-wins :value) - (remove nil?)) + full-choices (cond->> + (->> (concat (map (fn [v] {:value v}) selected-choices) items) + (util/distinct-by-last-wins :value) + (remove nil?)) + (seq @input) + (remove :clear?)) search-result' (->> (cond-> (search/fuzzy-search full-choices @input :limit limit :extract-fn extract-fn) (fn? transform-fn)