🐛 Fix move empty variant values to the end when component is selected (#7009)

* 🐛 Move empty variant values to the end when component is selected

* 📎 PR changes
This commit is contained in:
luisδμ 2025-07-30 12:29:51 +02:00 committed by GitHub
parent 31f37a20e3
commit 9834f0596b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -927,6 +927,14 @@
[:div ":touched " (str (:touched shape))])])])))
(defn- move-empty-items-to-end
"Creates a new vector with the empty items at the end"
[v]
(-> []
(into (remove empty?) v)
(into (filter empty?) v)))
(mf/defc variant-menu*
[{:keys [shapes]}]
(let [multi? (> (count shapes) 1)
@ -1064,8 +1072,11 @@
(when-not multi?
[:div {:class (stl/css :variant-property-list)}
(for [[pos property] (map vector (range) properties)]
(let [meta (str/join ", " (:value property))]
(for [[pos property] (map-indexed vector properties)]
(let [meta (->> (:value property)
(move-empty-items-to-end)
(replace {"" "--"})
(str/join ", "))]
[:div {:key (str (:id shape) pos)
:class (stl/css :variant-property-row)}
[:> input-with-meta* {:value (:name property)