enhance: show tooltip for positioned porperties

experiment/tanstack-table
Tienson Qin 2024-06-21 11:55:11 +08:00
parent 58bb273d8f
commit 9b86ff649f
2 changed files with 28 additions and 19 deletions

View File

@ -2317,7 +2317,7 @@
[:div.positioned-properties.flex.flex-row.items-center.gap-1.select-none.h-6.flex-wrap
(for [pid properties]
(when-let [property (db/entity pid)]
(pv/property-value block property (get block pid) opts)))]))))
(pv/property-value block property (get block pid) (assoc opts :show-tooltip? true))))]))))
(rum/defc ^:large-vars/cleanup-todo block-content < rum/reactive
[config {:block/keys [uuid content properties scheduled deadline format pre-block?] :as block} edit-input-id block-id slide?]

View File

@ -851,7 +851,8 @@
(values-cp toggle-fn)]))))
(rum/defcs property-value < rum/reactive
[state block property v opts]
[state block property v {:keys [show-tooltip?]
:as opts}]
(ui/catch-error
(ui/block-error "Something wrong" {})
(let [block-cp (state/get-component :block/blocks-container)
@ -876,22 +877,30 @@
(first v)
:else
v)
closed-values? (seq (:property/closed-values property))]
[:div.property-value-inner
{:data-type type
:class (str (when empty-value? "empty-value")
(when-not (:other-position? opts) " w-full"))}
(cond
(and multiple-values? (= type :default) (not closed-values?))
(property-normal-block-value block property v
(assoc opts :id (str (:db/id block) "-" (:db/id property))))
closed-values? (seq (:property/closed-values property))
value-cp [:div.property-value-inner
{:data-type type
:class (str (when empty-value? "empty-value")
(when-not (:other-position? opts) " w-full"))}
(cond
(and multiple-values? (= type :default) (not closed-values?))
(property-normal-block-value block property v
(assoc opts :id (str (:db/id block) "-" (:db/id property))))
multiple-values?
(multiple-values block property v opts schema)
multiple-values?
(multiple-values block property v opts schema)
:else
(property-scalar-value block property v
(merge
opts
{:editor-id editor-id
:dom-id dom-id})))])))
:else
(property-scalar-value block property v
(merge
opts
{:editor-id editor-id
:dom-id dom-id})))]]
(if show-tooltip?
(shui/tooltip-provider
(shui/tooltip
(shui/tooltip-trigger
value-cp)
(shui/tooltip-content
(str "Change " (:block/original-name property)))))
value-cp))))