Skip to content

Commit 472be3d

Browse files
nielslyngsoeCopilotandr317c
authored
Content Type Designer tabs sorting improvement (#20074)
* fix style and localization * Update src/Umbraco.Web.UI.Client/src/packages/content/content-type/workspace/views/design/content-type-design-editor.element.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix class name as well * minor fixes to sorting of tabs * clean up * add data-marks * Updated package version to include test fixes for tab name --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Andreas Zerbst <andr317c@live.dk>
1 parent f07d691 commit 472be3d

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/Umbraco.Web.UI.Client/src/packages/content/content-type/structure/content-type-container-structure-helper.class.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export class UmbContentTypeContainerStructureHelper<T extends UmbContentTypeMode
5555
this.#initRejector = reject;
5656
});
5757

58+
this.#childContainersMerged.sortBy((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0));
5859
this.#legacyMergedChildContainers.sortBy((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0));
5960
}
6061

src/Umbraco.Web.UI.Client/src/packages/content/content-type/structure/content-type-structure-manager.class.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,12 +941,13 @@ export class UmbContentTypeStructureManager<
941941
for (const container of containers) {
942942
const path = getContainerChainKey(container, containerByIdCache, chainCache);
943943
const key = path?.join('|') ?? null;
944+
const isOwner = this.isOwnerContainer(container.id);
944945
if (!mergedMap.has(key)) {
945946
// Store the first occurrence
946947
mergedMap.set(key, {
947948
key: key,
948949
ids: [container.id],
949-
ownerId: this.isOwnerContainer(container.id) ? container.id : undefined,
950+
ownerId: isOwner ? container.id : undefined,
950951
parentIds: new Set([container.parent?.id ?? null]),
951952
path: path,
952953
type: container.type,
@@ -958,7 +959,11 @@ export class UmbContentTypeStructureManager<
958959
const existing = mergedMap.get(key)!;
959960
existing.ids.push(container.id);
960961
existing.parentIds.add(container.parent?.id ?? null);
961-
existing.ownerId ??= this.isOwnerContainer(container.id) ? container.id : undefined;
962+
existing.ownerId ??= isOwner ? container.id : undefined;
963+
if (isOwner) {
964+
// If this is the owner container, then we should update the sort order to ensure it is the one from the owner instance: [NL]
965+
existing.sortOrder = container.sortOrder;
966+
}
962967
}
963968
}
964969

src/Umbraco.Web.UI.Client/src/packages/content/content-type/workspace/views/design/content-type-design-editor.element.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ export class UmbContentTypeDesignEditorElement extends UmbLitElement implements
3737
getUniqueOfElement: (element) => element.getAttribute('data-umb-tab-key'),
3838
getUniqueOfModel: (tab) => tab.key,
3939
identifier: 'content-type-tabs-sorter',
40-
itemSelector: 'uui-tab',
40+
itemSelector: 'uui-tab:not(#root-tab)',
4141
containerSelector: 'uui-tab-group',
4242
disabledItemSelector: ':not([sortable])',
43+
ignorerSelector: 'uui-input',
4344
resolvePlacement: (args) => args.relatedRect.left + args.relatedRect.width * 0.5 > args.pointerX,
4445
onChange: ({ model }) => {
4546
this._tabs = model;
@@ -724,6 +725,10 @@ export class UmbContentTypeDesignEditorElement extends UmbLitElement implements
724725
justify-content: center;
725726
gap: var(--uui-size-space-2);
726727
margin-right: calc(var(--uui-size-space-3) * -1);
728+
pointer-events: none;
729+
}
730+
.tab-inner > uui-input {
731+
pointer-events: auto;
727732
}
728733
729734
.not-active uui-button {

0 commit comments

Comments
 (0)