|
@@ -622,18 +622,6 @@
|
|
|
(for [[k v] properties]
|
|
(for [[k v] properties]
|
|
|
(property-cp block k v opts))))))
|
|
(property-cp block k v opts))))))
|
|
|
|
|
|
|
|
-(rum/defcs hidden-properties < (rum/local true ::hide?)
|
|
|
|
|
- [state block hidden-properties opts]
|
|
|
|
|
- (let [*hide? (::hide? state)]
|
|
|
|
|
- [:div.hidden-properties.flex.flex-col.gap-1
|
|
|
|
|
- [:a.text-sm.flex.flex-row.items-center.fade-link.select-none
|
|
|
|
|
- {:on-click #(swap! *hide? not)}
|
|
|
|
|
- [:span {:style {:margin-left -1}}
|
|
|
|
|
- (ui/rotating-arrow @*hide?)]
|
|
|
|
|
- [:div {:style {:margin-left 3}} "Hidden properties"]]
|
|
|
|
|
- (when-not @*hide?
|
|
|
|
|
- (properties-section block hidden-properties opts))]))
|
|
|
|
|
-
|
|
|
|
|
;; TODO: Remove :page-configure? as it only ever seems to be set to true
|
|
;; TODO: Remove :page-configure? as it only ever seems to be set to true
|
|
|
(rum/defcs ^:large-vars/cleanup-todo properties-area < rum/reactive
|
|
(rum/defcs ^:large-vars/cleanup-todo properties-area < rum/reactive
|
|
|
{:init (fn [state]
|
|
{:init (fn [state]
|
|
@@ -661,10 +649,13 @@
|
|
|
(seq properties))
|
|
(seq properties))
|
|
|
remove-built-in-properties
|
|
remove-built-in-properties
|
|
|
(remove (fn [[id _]] ((set classes-properties) id))))
|
|
(remove (fn [[id _]] ((set classes-properties) id))))
|
|
|
|
|
+ root-block? (= (:id opts) (str (:block/uuid block)))
|
|
|
;; This section produces own-properties and full-hidden-properties
|
|
;; This section produces own-properties and full-hidden-properties
|
|
|
hide-with-property-id (fn [property-id]
|
|
hide-with-property-id (fn [property-id]
|
|
|
- (let [eid (if (uuid? property-id) [:block/uuid property-id] property-id)]
|
|
|
|
|
- (boolean (:hide? (:block/schema (db/entity eid))))))
|
|
|
|
|
|
|
+ (if root-block?
|
|
|
|
|
+ false
|
|
|
|
|
+ (let [eid (if (uuid? property-id) [:block/uuid property-id] property-id)]
|
|
|
|
|
+ (boolean (:hide? (:block/schema (db/entity eid)))))))
|
|
|
property-hide-f (cond
|
|
property-hide-f (cond
|
|
|
config/publishing?
|
|
config/publishing?
|
|
|
;; Publishing is read only so hide all blank properties as they
|
|
;; Publishing is read only so hide all blank properties as they
|
|
@@ -680,16 +671,15 @@
|
|
|
(nil? property-value)))
|
|
(nil? property-value)))
|
|
|
:else
|
|
:else
|
|
|
(comp hide-with-property-id first))
|
|
(comp hide-with-property-id first))
|
|
|
- {block-hidden-properties true
|
|
|
|
|
|
|
+ {_block-hidden-properties true
|
|
|
block-own-properties' false} (group-by property-hide-f block-own-properties)
|
|
block-own-properties' false} (group-by property-hide-f block-own-properties)
|
|
|
- {class-hidden-properties true
|
|
|
|
|
|
|
+ {_class-hidden-properties true
|
|
|
class-own-properties false} (group-by property-hide-f
|
|
class-own-properties false} (group-by property-hide-f
|
|
|
(map (fn [id] [id (get block-properties id)]) classes-properties))
|
|
(map (fn [id] [id (get block-properties id)]) classes-properties))
|
|
|
own-properties (->>
|
|
own-properties (->>
|
|
|
(if one-class?
|
|
(if one-class?
|
|
|
(concat block-own-properties' class-own-properties)
|
|
(concat block-own-properties' class-own-properties)
|
|
|
block-own-properties'))
|
|
block-own-properties'))
|
|
|
- full-hidden-properties (concat block-hidden-properties class-hidden-properties)
|
|
|
|
|
class->properties (loop [classes all-classes
|
|
class->properties (loop [classes all-classes
|
|
|
properties #{}
|
|
properties #{}
|
|
|
result []]
|
|
result []]
|
|
@@ -702,7 +692,7 @@
|
|
|
(conj result [class cur-properties])))
|
|
(conj result [class cur-properties])))
|
|
|
result))
|
|
result))
|
|
|
keyboard-triggered? (= (state/sub :editor/new-property-input-id) edit-input-id)]
|
|
keyboard-triggered? (= (state/sub :editor/new-property-input-id) edit-input-id)]
|
|
|
- (when-not (and (empty? block-own-properties)
|
|
|
|
|
|
|
+ (when-not (and (empty? block-own-properties')
|
|
|
(empty? class->properties)
|
|
(empty? class->properties)
|
|
|
(not (:page-configure? opts))
|
|
(not (:page-configure? opts))
|
|
|
(not keyboard-triggered?))
|
|
(not keyboard-triggered?))
|
|
@@ -714,8 +704,8 @@
|
|
|
(update :class conj "select-none"))
|
|
(update :class conj "select-none"))
|
|
|
(properties-section block (if class-schema? properties own-properties) opts)
|
|
(properties-section block (if class-schema? properties own-properties) opts)
|
|
|
|
|
|
|
|
- (when (and (seq full-hidden-properties) (not class-schema?) (not config/publishing?))
|
|
|
|
|
- (hidden-properties block full-hidden-properties opts))
|
|
|
|
|
|
|
+ ;; (when (and (seq full-hidden-properties) (not class-schema?) (not config/publishing?))
|
|
|
|
|
+ ;; (hidden-properties block full-hidden-properties opts))
|
|
|
|
|
|
|
|
(rum/with-key (new-property block id keyboard-triggered? opts) (str id "-add-property"))
|
|
(rum/with-key (new-property block id keyboard-triggered? opts) (str id "-add-property"))
|
|
|
|
|
|