Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
showHeader={false}
disabled={false}
isCard
showAll
>
<div slot="header">
<ButtonIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
export let showHeader: boolean = true
export let disabled: boolean = true
export let isCard: boolean = false
export let showAll: boolean = false
export let attributeMapper:
| {
component: AnySvelteComponent
Expand Down Expand Up @@ -112,6 +113,10 @@
const classUpdated = (_clazz: Ref<Class<Doc>>, to: Ref<Class<Doc>>): void => {
selected = undefined
const h = client.getHierarchy()
if (showAll && !h.isMixin(_class)) {
classes = []
return
}
const toAncestors = new Set(h.getAncestors(to))
classes = h
.getAncestors(_class)
Expand Down Expand Up @@ -213,6 +218,7 @@
{_class}
{ofClass}
{attributeMapper}
showAll={showAll && !hierarchy.isMixin(_class)}
{selected}
on:deselect={handleDeselect}
on:select={handleSelect}
Expand All @@ -230,6 +236,7 @@
{ofClass}
{attributeMapper}
{selected}
showAll={showAll && !hierarchy.isMixin(_class)}
notUseOfClass
on:deselect={handleDeselect}
on:select={handleSelect}
Expand All @@ -244,6 +251,7 @@
{ofClass}
{attributeMapper}
{selected}
showAll={showAll && !hierarchy.isMixin(_class)}
on:deselect={handleDeselect}
on:select={handleSelect}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
export let ofClass: Ref<Class<Doc>> | undefined = undefined
export let notUseOfClass: boolean = false
export let selected: AnyAttribute | undefined = undefined
export let showAll: boolean = false

export let attributeMapper:
| {
Expand All @@ -73,9 +74,8 @@

function getCustomAttributes (_class: Ref<Class<Doc>>): AnyAttribute[] {
const cl = hierarchy.getClass(_class)
const attributes = Array.from(
hierarchy.getAllAttributes(_class, _class === ofClass && !notUseOfClass ? core.class.Doc : cl.extends).values()
).sort((a, b) => {
const to = showAll ? ofClass : _class === ofClass && !notUseOfClass ? core.class.Doc : cl.extends
const attributes = Array.from(hierarchy.getAllAttributes(_class, to).values()).sort((a, b) => {
const rankA = a.rank ?? toRank(a._id) ?? ''
const rankB = b.rank ?? toRank(b._id) ?? ''
return rankA.localeCompare(rankB)
Expand Down
Loading