|
|
@@ -556,6 +556,16 @@
|
|
|
(:block/order (db/entity k)))) properties)]
|
|
|
(ordered-properties block properties' opts))))
|
|
|
|
|
|
+(rum/defc hidden-properties-cp
|
|
|
+ [block hidden-properties {:keys [root-block? sidebar-properties?] :as opts}]
|
|
|
+ (when (and (seq hidden-properties) (or root-block? sidebar-properties?))
|
|
|
+ [:details.my-1
|
|
|
+ [:summary.text-sm.opacity-50.hover:opacity-90.cursor-pointer
|
|
|
+ {:style {:margin-left 11}}
|
|
|
+ [:span.ml-1 "Hidden properties"]]
|
|
|
+ [:div.mt-1
|
|
|
+ (properties-section block hidden-properties opts)]]))
|
|
|
+
|
|
|
(rum/defcs ^:large-vars/cleanup-todo properties-area < rum/reactive db-mixins/query
|
|
|
{:init (fn [state]
|
|
|
(let [target-block (first (:rum/args state))
|
|
|
@@ -574,7 +584,7 @@
|
|
|
(and (set? ids) (contains? ids (:block/uuid block))))))
|
|
|
properties (:block/properties block)
|
|
|
remove-built-in-or-other-position-properties
|
|
|
- (fn [properties]
|
|
|
+ (fn [properties show-in-hidden-properties?]
|
|
|
(remove (fn [property]
|
|
|
(let [id (if (vector? property) (first property) property)]
|
|
|
(or
|
|
|
@@ -585,10 +595,10 @@
|
|
|
(and (not (ldb/public-built-in-property? ent))
|
|
|
(ldb/built-in? ent))
|
|
|
;; other position
|
|
|
- (when-not (or show-properties?
|
|
|
- (and (:sidebar? opts) (= (:id opts) (str (:block/uuid block))))
|
|
|
- (and page-title? (not journal-page?))
|
|
|
- show-empty-and-hidden-properties?)
|
|
|
+ (when-not (or
|
|
|
+ (and page-title? (not journal-page?))
|
|
|
+ show-empty-and-hidden-properties?
|
|
|
+ show-in-hidden-properties?)
|
|
|
(outliner-property/property-with-other-position? ent))
|
|
|
|
|
|
(and (:gallery-view? opts)
|
|
|
@@ -598,7 +608,6 @@
|
|
|
classes-properties-set (set (map :db/ident classes-properties))
|
|
|
block-own-properties (->> properties
|
|
|
(remove (fn [[id _]] (classes-properties-set id))))
|
|
|
- root-block? (= (:id opts) (str (:block/uuid block)))
|
|
|
state-hide-empty-properties? (:ui/hide-empty-properties? (state/get-config))
|
|
|
;; This section produces own-properties and full-hidden-properties
|
|
|
hide-with-property-id (fn [property-id]
|
|
|
@@ -609,17 +618,11 @@
|
|
|
false
|
|
|
state-hide-empty-properties?
|
|
|
(nil? (get block property-id))
|
|
|
+ (and (:logseq.property/hide-empty-value property)
|
|
|
+ (nil? (get properties property-id)))
|
|
|
+ true
|
|
|
:else
|
|
|
- ;; sidebar or tag dialog properties ignore these checks
|
|
|
- (when-not (or show-properties? page-title?)
|
|
|
- (cond
|
|
|
- root-block?
|
|
|
- false
|
|
|
- (and (:logseq.property/hide-empty-value property)
|
|
|
- (nil? (get properties property-id)))
|
|
|
- true
|
|
|
- :else
|
|
|
- (boolean (:logseq.property/hide? property))))))))
|
|
|
+ (boolean (:logseq.property/hide? property))))))
|
|
|
property-hide-f (cond
|
|
|
config/publishing?
|
|
|
;; Publishing is read only so hide all blank properties as they
|
|
|
@@ -635,7 +638,7 @@
|
|
|
(nil? property-value)))
|
|
|
:else
|
|
|
(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)
|
|
|
class-properties (loop [classes all-classes
|
|
|
properties (set (map first block-own-properties'))
|
|
|
@@ -643,19 +646,28 @@
|
|
|
(if-let [class (first classes)]
|
|
|
(let [cur-properties (->> (db-property/get-class-ordered-properties class)
|
|
|
(map :db/ident)
|
|
|
- (remove properties)
|
|
|
- (remove hide-with-property-id))]
|
|
|
+ (remove properties))]
|
|
|
(recur (rest classes)
|
|
|
(set/union properties (set cur-properties))
|
|
|
(if (seq cur-properties)
|
|
|
(into result cur-properties)
|
|
|
result)))
|
|
|
result))
|
|
|
- full-properties (->> (concat block-own-properties'
|
|
|
- (map (fn [p] [p (get block p)]) class-properties))
|
|
|
- remove-built-in-or-other-position-properties)]
|
|
|
+ full-properties (-> (concat block-own-properties'
|
|
|
+ (remove property-hide-f (map (fn [p] [p (get block p)]) class-properties)))
|
|
|
+ (remove-built-in-or-other-position-properties false))
|
|
|
+ hidden-properties (-> (concat block-hidden-properties
|
|
|
+ (filter property-hide-f (map (fn [p] [p (get block p)]) class-properties)))
|
|
|
+ (remove-built-in-or-other-position-properties true))
|
|
|
+ root-block? (or (= (str (:block/uuid block))
|
|
|
+ (state/get-current-page))
|
|
|
+ (and (= (str (:block/uuid block)) (:id opts))
|
|
|
+ (not (entity-util/page? block))))]
|
|
|
(cond
|
|
|
- (empty? full-properties)
|
|
|
+ (and (empty? full-properties) (seq hidden-properties) (not root-block?) (not sidebar-properties?))
|
|
|
+ nil
|
|
|
+
|
|
|
+ (and (empty? full-properties) (empty? hidden-properties))
|
|
|
(when show-properties?
|
|
|
(rum/with-key (new-property block opts) (str id "-add-property")))
|
|
|
|
|
|
@@ -673,6 +685,10 @@
|
|
|
[:<>
|
|
|
(properties-section block properties' opts)
|
|
|
|
|
|
+ (when-not class?
|
|
|
+ (hidden-properties-cp block hidden-properties
|
|
|
+ (assoc opts :root-block? root-block?)))
|
|
|
+
|
|
|
(when (and page? (not class?))
|
|
|
(rum/with-key (new-property block opts) (str id "-add-property")))
|
|
|
|
|
|
@@ -689,4 +705,6 @@
|
|
|
"Tag properties are inherited by all nodes using the tag. For example, each #Task node inherits 'Status' and 'Priority'."]]
|
|
|
[:div.ml-4
|
|
|
(properties-section block properties opts')
|
|
|
+ (hidden-properties-cp block hidden-properties
|
|
|
+ (assoc opts :root-block? root-block?))
|
|
|
(rum/with-key (new-property block opts') (str id "-class-add-property"))]]))]]))))
|