enhance: put remove property after search results

experiment/tanstack-table
Tienson Qin 2024-05-22 17:52:52 +08:00
parent f4e251f655
commit e7cd76644b
2 changed files with 11 additions and 7 deletions

View File

@ -234,12 +234,13 @@
(let [selected-choices (->> selected-choices (let [selected-choices (->> selected-choices
(remove nil?) (remove nil?)
(remove #(= :logseq.property/empty-placeholder %))) (remove #(= :logseq.property/empty-placeholder %)))
clear-value (str "No " (:block/original-name property)) clear-value (str "Remove property " (:block/original-name property))
items' (->> items' (->>
(if (and (seq selected-choices) (not multiple-choices?)) (if (and (seq selected-choices) (not multiple-choices?))
(cons {:value clear-value (concat items
:label clear-value} [{:value clear-value
items) :label clear-value
:clear? true}])
items) items)
(remove #(= :logseq.property/empty-placeholder (:value %)))) (remove #(= :logseq.property/empty-placeholder (:value %))))
k :on-chosen k :on-chosen

View File

@ -79,9 +79,12 @@
*toggle (::toggle state) *toggle (::toggle state)
*selected-choices (::selected-choices state) *selected-choices (::selected-choices state)
selected-choices (rum/react *selected-choices) selected-choices (rum/react *selected-choices)
full-choices (->> (concat (map (fn [v] {:value v}) selected-choices) items) full-choices (cond->>
(util/distinct-by-last-wins :value) (->> (concat (map (fn [v] {:value v}) selected-choices) items)
(remove nil?)) (util/distinct-by-last-wins :value)
(remove nil?))
(seq @input)
(remove :clear?))
search-result' (->> search-result' (->>
(cond-> (search/fuzzy-search full-choices @input :limit limit :extract-fn extract-fn) (cond-> (search/fuzzy-search full-choices @input :limit limit :extract-fn extract-fn)
(fn? transform-fn) (fn? transform-fn)