set up document blueprint tree and workspace
This commit is contained in:
@@ -33,6 +33,8 @@ import { UmbIconStore } from '../core/stores/icon/icon.store';
|
||||
import { UmbUserGroupStore } from '../core/stores/user/user-group.store';
|
||||
import { UmbCurrentUserHistoryStore } from '../core/stores/current-user-history/current-user-history.store';
|
||||
import { UmbDictionaryStore } from '../core/stores/dictionary/dictionary.store';
|
||||
import { UmbDocumentBlueprintStore } from '../core/stores/document-blueprint/document-blueprint.store';
|
||||
|
||||
import { manifests as sectionManifests } from './sections/manifests';
|
||||
import { manifests as propertyEditorModelManifests } from './property-editors/models/manifests';
|
||||
import { manifests as propertyEditorUIManifests } from './property-editors/uis/manifests';
|
||||
@@ -41,8 +43,10 @@ import { manifests as editorManifests } from './workspaces/manifests';
|
||||
import { manifests as propertyActionManifests } from './property-actions/manifests';
|
||||
import { manifests as externalLoginProviderManifests } from './external-login-providers/manifests';
|
||||
import { manifests as userDashboards } from './user-dashboards/manifests';
|
||||
|
||||
import { UmbContextConsumerMixin, UmbContextProviderMixin } from '@umbraco-cms/context-api';
|
||||
import { umbExtensionsRegistry } from '@umbraco-cms/extensions-registry';
|
||||
|
||||
import type { ManifestTypes } from '@umbraco-cms/models';
|
||||
|
||||
@defineElement('umb-backoffice')
|
||||
@@ -92,6 +96,7 @@ export class UmbBackofficeElement extends UmbContextConsumerMixin(UmbContextProv
|
||||
this.provideContext('umbSectionStore', new UmbSectionStore());
|
||||
this.provideContext('umbCurrentUserHistoryStore', new UmbCurrentUserHistoryStore());
|
||||
this.provideContext('umbDictionaryStore', new UmbDictionaryStore());
|
||||
this.provideContext('umbDocumentBlueprintStore', new UmbDocumentBlueprintStore());
|
||||
}
|
||||
|
||||
private _registerExtensions(manifests: Array<ManifestTypes> | Array<ManifestTypes>) {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { ManifestTree } from '@umbraco-cms/extensions-registry';
|
||||
|
||||
const treeAlias = 'Umb.Tree.DocumentBlueprints';
|
||||
|
||||
const tree: ManifestTree = {
|
||||
type: 'tree',
|
||||
alias: treeAlias,
|
||||
name: 'Document Blueprints Tree',
|
||||
weight: 400,
|
||||
meta: {
|
||||
label: 'Document Blueprints',
|
||||
icon: 'umb:blueprint',
|
||||
sections: ['Umb.Section.Settings'],
|
||||
rootNodeEntityType: 'document-blueprint-root',
|
||||
},
|
||||
};
|
||||
|
||||
export const manifests = [tree];
|
||||
@@ -1,5 +1,6 @@
|
||||
import { manifests as dataTypeTreeManifests } from './data-types/manifests';
|
||||
import { manifests as dictionaryTreeManifests } from './dictionary/manifests';
|
||||
import { manifests as documentBlueprintTreeManifests } from './document-blueprints/manifests';
|
||||
import { manifests as documentTypeTreeManifests } from './document-types/manifests';
|
||||
import { manifests as documentTreeManifests } from './documents/manifests';
|
||||
import { manifests as extensionTreeManifests } from './extensions/manifests';
|
||||
@@ -14,6 +15,7 @@ import type { ManifestTree, ManifestTreeItemAction } from '@umbraco-cms/models';
|
||||
export const manifests: Array<ManifestTree | ManifestTreeItemAction> = [
|
||||
...dataTypeTreeManifests,
|
||||
...dictionaryTreeManifests,
|
||||
...documentBlueprintTreeManifests,
|
||||
...documentTypeTreeManifests,
|
||||
...documentTreeManifests,
|
||||
...extensionTreeManifests,
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { html, LitElement } from 'lit';
|
||||
import { customElement } from 'lit/decorators.js';
|
||||
|
||||
@customElement('umb-workspace-document-blueprint-root')
|
||||
export class UmbWorkspaceDocumentBlueprintRootElement extends LitElement {
|
||||
render() {
|
||||
return html` <div>Document Blueprint Root Workspace</div> `;
|
||||
}
|
||||
}
|
||||
|
||||
export default UmbWorkspaceDocumentBlueprintRootElement;
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'umb-workspace-document-blueprint-root': UmbWorkspaceDocumentBlueprintRootElement;
|
||||
}
|
||||
}
|
||||
@@ -136,4 +136,13 @@ export const manifests: Array<ManifestWorkspace> = [
|
||||
entityType: 'dictionary',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'workspace',
|
||||
alias: 'Umb.Workspace.DocumentBlueprintRoot',
|
||||
name: 'Document Blueprint Root Workspace',
|
||||
loader: () => import('./document-blueprint/workspace-document-blueprint-root.element'),
|
||||
meta: {
|
||||
entityType: 'document-blueprint-root',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { UmbEntityData } from './entity.data';
|
||||
import type { DocumentBlueprintDetails } from '@umbraco-cms/models';
|
||||
|
||||
export const data: Array<DocumentBlueprintDetails> = [
|
||||
{
|
||||
name: 'Document Blueprint 1',
|
||||
type: 'document-blueprint',
|
||||
key: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
|
||||
icon: 'umb:blueprint',
|
||||
documentTypeKey: 'd81c7957-153c-4b5a-aa6f-b434a4964624',
|
||||
properties: [],
|
||||
data: [],
|
||||
},
|
||||
{
|
||||
name: 'Document Blueprint 2',
|
||||
type: 'document-blueprint',
|
||||
key: '3fa85f64-5717-4562-b3qc-2c963f66afa6',
|
||||
icon: 'umb:blueprint',
|
||||
documentTypeKey: 'a99e4018-3ffc-486b-aa76-eecea9593d17',
|
||||
properties: [],
|
||||
data: [],
|
||||
},
|
||||
];
|
||||
|
||||
// Temp mocked database
|
||||
// TODO: all properties are optional in the server schema. I don't think this is correct.
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
class UmbDocumentBlueprintData extends UmbEntityData<DocumentBlueprintDetails> {
|
||||
constructor() {
|
||||
super(data);
|
||||
}
|
||||
}
|
||||
|
||||
export const umbDocumentBlueprintData = new UmbDocumentBlueprintData();
|
||||
@@ -131,3 +131,14 @@ export interface MemberGroupDetails extends EntityTreeItem {
|
||||
export interface DictionaryDetails extends EntityTreeItem {
|
||||
key: string; // TODO: Remove this when the backend is fixed
|
||||
}
|
||||
|
||||
// Document Blueprint
|
||||
export interface DocumentBlueprintDetails {
|
||||
key: string;
|
||||
name: string;
|
||||
type: 'document-blueprint';
|
||||
properties: Array<any>;
|
||||
data: Array<any>;
|
||||
icon: string;
|
||||
documentTypeKey: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { map, Observable } from 'rxjs';
|
||||
import { UmbNodeStoreBase } from '../store';
|
||||
import type { DocumentBlueprintDetails, DocumentDetails } from '@umbraco-cms/models';
|
||||
import { DocumentBlueprintTreeItem } from '@umbraco-cms/backend-api';
|
||||
|
||||
export type UmbDocumentStoreItemType = DocumentBlueprintDetails | DocumentBlueprintTreeItem;
|
||||
|
||||
const isDocumentBlueprintDetails = (
|
||||
documentBlueprint: DocumentBlueprintDetails | DocumentBlueprintTreeItem
|
||||
): documentBlueprint is DocumentBlueprintDetails => {
|
||||
return (documentBlueprint as DocumentBlueprintDetails).data !== undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @class UmbDocumentStore
|
||||
* @extends {UmbDocumentStoreBase<DocumentDetails | DocumentTreeItem>}
|
||||
* @description - Data Store for Documents
|
||||
*/
|
||||
export class UmbDocumentBlueprintStore extends UmbNodeStoreBase<UmbDocumentStoreItemType> {
|
||||
getByKey(key: string): Observable<DocumentDetails | null> {
|
||||
// TODO: implement call to end point
|
||||
return this.items.pipe(
|
||||
map(
|
||||
(documentBlueprints) =>
|
||||
(documentBlueprints.find(
|
||||
(documentBlueprint) => documentBlueprint.key === key && isDocumentBlueprintDetails(documentBlueprint)
|
||||
) as DocumentDetails) || null
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: implement call to end point
|
||||
save(): any {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user