update URL as tab name changes
This commit is contained in:
@@ -147,7 +147,7 @@ export class UmbDocumentTypeWorkspaceViewEditElement extends UmbLitElement {
|
||||
// TODO: make better url folder name:
|
||||
const path = this._routerPath + '/tab/' + encodeURI(tab.name || '');
|
||||
return html`<uui-tab label=${tab.name!} .active=${path === this._activePath} href=${path}>
|
||||
${path === this._activePath
|
||||
${path === this._activePath && this._tabsStructureHelper.isOwnerContainer(tab.id!)
|
||||
? html` <uui-input
|
||||
label="Tab name"
|
||||
look="placeholder"
|
||||
@@ -155,11 +155,12 @@ export class UmbDocumentTypeWorkspaceViewEditElement extends UmbLitElement {
|
||||
placeholder="Enter a name"
|
||||
@change=${(e: InputEvent) => {
|
||||
const newName = (e.target as HTMLInputElement).value;
|
||||
// Update the current URL, so we are still on this specific tab:
|
||||
window.history.replaceState(null, '', this._routerPath + '/tab/' + encodeURI(newName));
|
||||
this._tabsStructureHelper.partialUpdateContainer(tab.id, {
|
||||
name: newName,
|
||||
});
|
||||
|
||||
// Update the current URL, so we are still on this specific tab:
|
||||
window.history.replaceState(null, '', this._routerPath + '/tab/' + encodeURI(newName));
|
||||
}}>
|
||||
<!-- todo only if its part of root: -->
|
||||
<uui-button
|
||||
|
||||
@@ -18,6 +18,7 @@ export class UmbWorkspaceContainerStructureHelper {
|
||||
private _ownerKey?: string;
|
||||
|
||||
// Containers defined in data might be more than actual containers to display as we merge them by name.
|
||||
// Owner containers are the containers defining the total of this container(Multiple containers with the same name and type)
|
||||
private _ownerContainers: PropertyTypeContainerResponseModelBaseModel[] = [];
|
||||
|
||||
// State containing the merged containers (only one pr. name):
|
||||
@@ -151,6 +152,15 @@ export class UmbWorkspaceContainerStructureHelper {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if the container is an owner container.
|
||||
*/
|
||||
isOwnerContainer(groupId?: string) {
|
||||
if (!this.#workspaceContext || !groupId) return;
|
||||
|
||||
return this._ownerContainers.find((x) => x.id === groupId) !== undefined;
|
||||
}
|
||||
|
||||
/** Manipulate methods: */
|
||||
|
||||
async addContainer(ownerId?: string, sortOrder?: number) {
|
||||
|
||||
@@ -221,7 +221,7 @@ export class UmbWorkspacePropertyStructureManager<R extends UmbDocumentTypeRepos
|
||||
async updateProperty(
|
||||
documentTypeId: string | null,
|
||||
propertyId: string,
|
||||
partialUpdate: Partial<DocumentTypePropertyTypeResponseModel>
|
||||
partialUpdate: Partial<PropertyTypeResponseModelBaseModel>
|
||||
) {
|
||||
await this.#init;
|
||||
documentTypeId = documentTypeId ?? this.#rootDocumentTypeId!;
|
||||
|
||||
Reference in New Issue
Block a user