Skip to content

Commit 8d62d91

Browse files
authored
Allow to sort attributes for parent and sub class together (#10816)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
1 parent c6738a0 commit 8d62d91

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

plugins/card-resources/src/components/settings/ProperitiesSection.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
showHeader={false}
6363
disabled={false}
6464
isCard
65+
showAll
6566
>
6667
<div slot="header">
6768
<ButtonIcon

plugins/setting-resources/src/components/ClassAttributes.svelte

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
export let showHeader: boolean = true
4848
export let disabled: boolean = true
4949
export let isCard: boolean = false
50+
export let showAll: boolean = false
5051
export let attributeMapper:
5152
| {
5253
component: AnySvelteComponent
@@ -112,6 +113,10 @@
112113
const classUpdated = (_clazz: Ref<Class<Doc>>, to: Ref<Class<Doc>>): void => {
113114
selected = undefined
114115
const h = client.getHierarchy()
116+
if (showAll && !h.isMixin(_class)) {
117+
classes = []
118+
return
119+
}
115120
const toAncestors = new Set(h.getAncestors(to))
116121
classes = h
117122
.getAncestors(_class)
@@ -213,6 +218,7 @@
213218
{_class}
214219
{ofClass}
215220
{attributeMapper}
221+
showAll={showAll && !hierarchy.isMixin(_class)}
216222
{selected}
217223
on:deselect={handleDeselect}
218224
on:select={handleSelect}
@@ -230,6 +236,7 @@
230236
{ofClass}
231237
{attributeMapper}
232238
{selected}
239+
showAll={showAll && !hierarchy.isMixin(_class)}
233240
notUseOfClass
234241
on:deselect={handleDeselect}
235242
on:select={handleSelect}
@@ -244,6 +251,7 @@
244251
{ofClass}
245252
{attributeMapper}
246253
{selected}
254+
showAll={showAll && !hierarchy.isMixin(_class)}
247255
on:deselect={handleDeselect}
248256
on:select={handleSelect}
249257
/>

plugins/setting-resources/src/components/ClassAttributesList.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
export let ofClass: Ref<Class<Doc>> | undefined = undefined
4848
export let notUseOfClass: boolean = false
4949
export let selected: AnyAttribute | undefined = undefined
50+
export let showAll: boolean = false
5051
5152
export let attributeMapper:
5253
| {
@@ -73,9 +74,8 @@
7374
7475
function getCustomAttributes (_class: Ref<Class<Doc>>): AnyAttribute[] {
7576
const cl = hierarchy.getClass(_class)
76-
const attributes = Array.from(
77-
hierarchy.getAllAttributes(_class, _class === ofClass && !notUseOfClass ? core.class.Doc : cl.extends).values()
78-
).sort((a, b) => {
77+
const to = showAll ? ofClass : _class === ofClass && !notUseOfClass ? core.class.Doc : cl.extends
78+
const attributes = Array.from(hierarchy.getAllAttributes(_class, to).values()).sort((a, b) => {
7979
const rankA = a.rank ?? toRank(a._id) ?? ''
8080
const rankB = b.rank ?? toRank(b._id) ?? ''
8181
return rankA.localeCompare(rankB)

0 commit comments

Comments
 (0)