rickbutterfield
12/09/2024, 10:42 AMsection
have to have a sectionView
by default or is there any way you could route workspaces in there? Effectively I'm looking for a sectionView
to be able to have a configurable header
slot but that only appears to be in a workspace?rickbutterfield
12/09/2024, 1:34 PMsection
loads a sectionView
which in turn renders a new workspace
. The workspace
then has to have an attached context to know what workspaceView
entities to render.
ts
export class SectionViewElement extends UmbLitElement implements UmbSectionViewElement {
constructor() {
super();
}
override render() {
return html`<custom-workspace-root></custom-workspace-root>`;
}
}
ts
const workspace: ManifestWorkspace = {
type: 'workspace',
alias: CUSTOM_WORKSPACE_ALIAS,
name: 'Custom Workspace',
element: () => import('./workspace.element'),
meta: {
entityType: 'custom-entity'
}
}
const workspaceContext: ManifestWorkspaceContext = {
type: 'workspaceContext',
alias: CUSTOM_CONTEXT_ALIAS,
name: 'Custom Workspace Context',
js: () => import('./workspace.context'),
conditions: [
{
alias: 'Umb.Condition.WorkspaceAlias',
match: CUSTOM_WORKSPACE_ALIAS
}
]
}
ts
export class CustomWorkspaceRootElement extends UmbElementMixin(LitElement) {
#workspaceContext: CustomWorkspaceContext;
constructor() {
super();
this.#workspaceContext = new CustomWorkspaceContext(this);
}
override render() {
return html`
<umb-workspace-editor .enforceNoFooter=${true}>
</umb-workspace-editor>
`;
}
}
rickbutterfield
12/09/2024, 1:35 PMUmbWorkspaceContext
...
ts
export class CustomWorkspaceContext extends UmbControllerBase implements UmbWorkspaceContext {
public readonly workspaceAlias: string = CUSTOM_WORKSPACE_ALIAS;
getEntityType(): string {
return CUSTOM_ENTITY_TYPE;
}
constructor(host: UmbControllerHost) {
super(host);
this.provideContext(UMB_WORKSPACE_CONTEXT, this);
}
}
export default CustomWorkspaceContext;
export const CUSTOM_CONTEXT_TOKEN = new UmbContextToken<CustomWorkspaceContext>(
'CustomWorkspaceContext',
);
Niels Lyngsø
12/09/2024, 9:08 PM<umb-workspace entity-type="MyEntityType">
🤓
In this way it will be loaded via the extension registry and handled properly.
UmbWorkspaceContext
is intended for the api
of the workspace, so you do not need to implement that for an extension of the type workspaceContext
Also I assume your Workspace Context does not get initialized, cause there is a bug where this would have to be implemented by the specific Workspace, and I assume yu havent implemented that. We should make sure that extensions of type Workspace Context is initialized despite the workspace implementation. We are looking into this soon, so that may reach 15.2.Niels Lyngsø
12/10/2024, 7:51 AMworkspace/[entity-type]
also you can add more routes to sections, also sections that you did not create, the extension type is called sectionRoute