mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
fix: multiple fixes for property validation
- couldn't use :default block property values - couldn't add new closed number value - couldn't select existing :page or :date closed values - editor/CLI validation wasn't working - see failing db-graph-test job - update schema for closed-value Part of LOG-2871. Also fixed typo in ui.cljs
This commit is contained in:
@@ -25,9 +25,17 @@
|
||||
:or {new-closed-value? false}}]
|
||||
(into {}
|
||||
(map (fn [[property-type property-val-schema]]
|
||||
(if (db-property-type/property-types-with-db property-type)
|
||||
(cond
|
||||
(db-property-type/closed-values-schema-types property-type)
|
||||
(let [[_ schema-opts schema-fn] property-val-schema
|
||||
schema-fn' (if (db-property-type/property-types-with-db property-type) #(schema-fn (db/get-db) %) schema-fn)]
|
||||
[property-type [:fn
|
||||
schema-opts
|
||||
#((db-property-type/type-or-closed-value? schema-fn') (db/get-db) property % new-closed-value?)]])
|
||||
(db-property-type/property-types-with-db property-type)
|
||||
(let [[_ schema-opts schema-fn] property-val-schema]
|
||||
[property-type [:fn schema-opts #(schema-fn (db/get-db) property % new-closed-value?)]])
|
||||
[property-type [:fn schema-opts #(schema-fn (db/get-db) %)]])
|
||||
:else
|
||||
[property-type property-val-schema]))
|
||||
db-property-type/builtin-schema-types)))
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@
|
||||
value-block (when (uuid? value) (db/entity [:block/uuid value]))
|
||||
validate-message (db-property-handler/validate-property-value
|
||||
(get (db-property-handler/builtin-schema-types property {:new-closed-value? true}) property-type)
|
||||
value)]
|
||||
resolved-value)]
|
||||
(cond
|
||||
(nil? resolved-value)
|
||||
nil
|
||||
@@ -310,6 +310,7 @@
|
||||
metadata {:created-from-property (:block/uuid property)}
|
||||
new-block (cond->
|
||||
{:block/type #{"closed value"}
|
||||
:block/format :markdown
|
||||
:block/uuid block-id
|
||||
:block/page page-id
|
||||
:block/metadata metadata
|
||||
|
||||
@@ -1038,7 +1038,7 @@
|
||||
:icon-props icon-props
|
||||
:button-props (merge
|
||||
(dissoc option
|
||||
:background :href :class :intent :small? :large? :icon :icon-props :disabled? button-props)
|
||||
:background :href :class :intent :small? :large? :icon :icon-props :disabled? :button-props)
|
||||
button-props)
|
||||
:class (if (= intent "border-link") (str class " border") class)
|
||||
:muted disabled?
|
||||
|
||||
Reference in New Issue
Block a user