@umbraco-cms/backoffice 14.0.0-8a5fc0ad → 14.0.0-9986c334
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cms/mocks/data/partial-views.data.d.ts +19 -3
- package/dist-cms/mocks/data/partial-views.data.js +277 -10
- package/dist-cms/mocks/data/utils.d.ts +2 -1
- package/dist-cms/mocks/data/utils.js +5 -0
- package/dist-cms/mocks/handlers/partial-views.handlers.d.ts +2 -1
- package/dist-cms/mocks/handlers/partial-views.handlers.js +37 -5
- package/dist-cms/packages/core/entity-action/common/create-folder/create-folder.action.d.ts +8 -0
- package/dist-cms/packages/core/entity-action/common/create-folder/create-folder.action.js +21 -0
- package/dist-cms/packages/core/entity-action/common/index.d.ts +1 -0
- package/dist-cms/packages/core/entity-action/common/index.js +1 -0
- package/dist-cms/packages/core/modal/common/folder/folder-modal.element.js +4 -1
- package/dist-cms/packages/core/modal/token/folder-modal.token.d.ts +1 -0
- package/dist-cms/packages/core/tree/file-system-tree-item/file-system-tree-item.context.d.ts +1 -0
- package/dist-cms/packages/core/tree/file-system-tree-item/file-system-tree-item.context.js +12 -0
- package/dist-cms/packages/core/tree/file-system-tree-item/file-system-tree-item.element.js +1 -0
- package/dist-cms/packages/core/workspace/workspace-action/workspace-action.element.js +12 -4
- package/dist-cms/packages/templating/manifests.d.ts +6 -1
- package/dist-cms/packages/templating/partial-views/config.d.ts +3 -4
- package/dist-cms/packages/templating/partial-views/config.js +1 -0
- package/dist-cms/packages/templating/partial-views/entity-actions/create/create-empty.action.js +1 -1
- package/dist-cms/packages/templating/partial-views/entity-actions/create/create-from-snippet.action.d.ts +10 -1
- package/dist-cms/packages/templating/partial-views/entity-actions/create/create-from-snippet.action.js +16 -1
- package/dist-cms/packages/templating/partial-views/entity-actions/create/create-from-snippet.modal.d.ts +16 -0
- package/dist-cms/packages/templating/partial-views/entity-actions/create/create-from-snippet.modal.js +73 -0
- package/dist-cms/packages/templating/partial-views/entity-actions/manifests.d.ts +6 -1
- package/dist-cms/packages/templating/partial-views/entity-actions/manifests.js +43 -5
- package/dist-cms/packages/templating/partial-views/manifests.d.ts +6 -1
- package/dist-cms/packages/templating/partial-views/repository/partial-views.repository.d.ts +39 -23
- package/dist-cms/packages/templating/partial-views/repository/partial-views.repository.js +66 -19
- package/dist-cms/packages/templating/partial-views/repository/sources/partial-views.detail.server.data.d.ts +48 -13
- package/dist-cms/packages/templating/partial-views/repository/sources/partial-views.detail.server.data.js +56 -17
- package/dist-cms/packages/templating/partial-views/repository/sources/partial-views.folder.server.data.d.ts +17 -0
- package/dist-cms/packages/templating/partial-views/repository/sources/partial-views.folder.server.data.js +23 -0
- package/dist-cms/packages/templating/partial-views/workspace/partial-views-workspace-edit.element.d.ts +6 -1
- package/dist-cms/packages/templating/partial-views/workspace/partial-views-workspace-edit.element.js +123 -27
- package/dist-cms/packages/templating/partial-views/workspace/partial-views-workspace.context.d.ts +8 -6
- package/dist-cms/packages/templating/partial-views/workspace/partial-views-workspace.context.js +47 -6
- package/dist-cms/packages/templating/partial-views/workspace/partial-views-workspace.element.d.ts +1 -0
- package/dist-cms/packages/templating/partial-views/workspace/partial-views-workspace.element.js +7 -3
- package/dist-cms/shared/repository/data-source/data-source.interface.d.ts +2 -2
- package/dist-cms/shared/repository/detail-repository.interface.d.ts +2 -2
- package/dist-cms/tsconfig.tsbuildinfo +1 -1
- package/dist-cms/vscode-html-custom-data.json +1 -1
- package/package.json +1 -1
package/dist-cms/packages/templating/partial-views/entity-actions/create/create-empty.action.js
CHANGED
|
@@ -4,6 +4,6 @@ export class UmbCreateEmptyPartialViewAction extends UmbEntityActionBase {
|
|
|
4
4
|
super(host, repositoryAlias, unique);
|
|
5
5
|
}
|
|
6
6
|
async execute() {
|
|
7
|
-
|
|
7
|
+
history.pushState(null, '', `section/settings/workspace/partial-view/create/${this.unique ?? 'null'}/Empty`);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { UmbEntityActionBase } from '../../../../core/entity-action/index.js';
|
|
2
2
|
import { UmbControllerHostElement } from '../../../../../libs/controller-api/index.js';
|
|
3
|
+
import { UmbPartialViewsRepository } from '../../repository/index.js';
|
|
4
|
+
import { UmbModalToken } from '../../../../core/modal/index.js';
|
|
5
|
+
import { SnippetItemResponseModel } from '../../../../../external/backend-api/index.js';
|
|
6
|
+
export interface UmbCreateFromSnippetPartialViewModalData {
|
|
7
|
+
snippets: SnippetItemResponseModel[];
|
|
8
|
+
}
|
|
9
|
+
export type UmbConfirmModalResult = undefined;
|
|
10
|
+
export declare const UMB_PARTIAL_VIEW_FROM_SNIPPET_MODAL: UmbModalToken<UmbCreateFromSnippetPartialViewModalData, string>;
|
|
3
11
|
export declare class UmbCreateFromSnippetPartialViewAction<T extends {
|
|
4
12
|
copy(): Promise<void>;
|
|
5
|
-
}> extends UmbEntityActionBase<
|
|
13
|
+
}> extends UmbEntityActionBase<UmbPartialViewsRepository> {
|
|
14
|
+
#private;
|
|
6
15
|
constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string);
|
|
7
16
|
execute(): Promise<void>;
|
|
8
17
|
}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import { UmbEntityActionBase } from '../../../../core/entity-action/index.js';
|
|
2
|
+
import { UmbContextConsumerController } from '../../../../../libs/context-api/index.js';
|
|
3
|
+
import { UMB_MODAL_MANAGER_CONTEXT_TOKEN, UmbModalToken, } from '../../../../core/modal/index.js';
|
|
4
|
+
export const UMB_PARTIAL_VIEW_FROM_SNIPPET_MODAL = new UmbModalToken('Umb.Modal.CreateFromSnippetPartialView', {
|
|
5
|
+
type: 'sidebar',
|
|
6
|
+
});
|
|
2
7
|
export class UmbCreateFromSnippetPartialViewAction extends UmbEntityActionBase {
|
|
3
8
|
constructor(host, repositoryAlias, unique) {
|
|
4
9
|
super(host, repositoryAlias, unique);
|
|
10
|
+
new UmbContextConsumerController(this.host, UMB_MODAL_MANAGER_CONTEXT_TOKEN, (instance) => {
|
|
11
|
+
this.#modalContext = instance;
|
|
12
|
+
});
|
|
5
13
|
}
|
|
14
|
+
#modalContext;
|
|
6
15
|
async execute() {
|
|
7
|
-
|
|
16
|
+
const snippets = (await this.repository?.getSnippets({}))?.data?.items ?? [];
|
|
17
|
+
const modalContext = this.#modalContext?.open(UMB_PARTIAL_VIEW_FROM_SNIPPET_MODAL, {
|
|
18
|
+
snippets,
|
|
19
|
+
});
|
|
20
|
+
await modalContext?.onSubmit().then((snippetName) => {
|
|
21
|
+
history.pushState(null, '', `section/settings/workspace/partial-view/create/${this.unique ?? 'null'}/${snippetName}`);
|
|
22
|
+
});
|
|
8
23
|
}
|
|
9
24
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { UmbModalBaseElement } from '../../../../../shared/modal/index.js';
|
|
2
|
+
import { UmbCreateFromSnippetPartialViewModalData } from './create-from-snippet.action.js';
|
|
3
|
+
import { SnippetItemResponseModel } from '../../../../../external/backend-api/index.js';
|
|
4
|
+
export default class UmbPartialViewCreateFromSnippetModalElement extends UmbModalBaseElement<UmbCreateFromSnippetPartialViewModalData, string> {
|
|
5
|
+
_snippets: Array<SnippetItemResponseModel>;
|
|
6
|
+
connectedCallback(): void;
|
|
7
|
+
private _submit;
|
|
8
|
+
private _close;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
'umb-partial-view-create-from-snippet-modal': UmbPartialViewCreateFromSnippetModalElement;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { UUITextStyles } from '../../../../../external/uui/index.js';
|
|
8
|
+
import { css, html, customElement, state } from '../../../../../external/lit/index.js';
|
|
9
|
+
import { UmbModalBaseElement } from '../../../../../shared/modal/index.js';
|
|
10
|
+
let UmbPartialViewCreateFromSnippetModalElement = class UmbPartialViewCreateFromSnippetModalElement extends UmbModalBaseElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this._snippets = [];
|
|
14
|
+
}
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
super.connectedCallback();
|
|
17
|
+
this._snippets = this.data?.snippets ?? [];
|
|
18
|
+
}
|
|
19
|
+
_submit(snippetName) {
|
|
20
|
+
this.modalContext?.submit(snippetName);
|
|
21
|
+
}
|
|
22
|
+
_close() {
|
|
23
|
+
this.modalContext?.reject();
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
return html `
|
|
27
|
+
<umb-body-layout headline="Create partial view from snippet">
|
|
28
|
+
<div id="main">
|
|
29
|
+
<uui-box>
|
|
30
|
+
${this._snippets.map((snippet) => html `<uui-menu-item label="${snippet.name ?? ''}" @click-label=${() => this._submit(snippet.name ?? '')}
|
|
31
|
+
><uui-icon name="umb:article" slot="icon"></uui-icon
|
|
32
|
+
></uui-menu-item>`)}
|
|
33
|
+
</uui-box>
|
|
34
|
+
</div>
|
|
35
|
+
<div slot="actions">
|
|
36
|
+
<uui-button @click=${this._close} look="secondary">Close</uui-button>
|
|
37
|
+
</div>
|
|
38
|
+
</umb-body-layout>
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
static { this.styles = [
|
|
42
|
+
UUITextStyles,
|
|
43
|
+
css `
|
|
44
|
+
:host {
|
|
45
|
+
display: block;
|
|
46
|
+
color: var(--uui-color-text);
|
|
47
|
+
--umb-header-layout-height: 70px;
|
|
48
|
+
}
|
|
49
|
+
#main {
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
height: calc(
|
|
52
|
+
100dvh - var(--umb-header-layout-height) - var(--umb-footer-layout-height) - 2 * var(--uui-size-layout-1)
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#main uui-button {
|
|
57
|
+
width: 100%;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
h3,
|
|
61
|
+
p {
|
|
62
|
+
text-align: left;
|
|
63
|
+
}
|
|
64
|
+
`,
|
|
65
|
+
]; }
|
|
66
|
+
};
|
|
67
|
+
__decorate([
|
|
68
|
+
state()
|
|
69
|
+
], UmbPartialViewCreateFromSnippetModalElement.prototype, "_snippets", void 0);
|
|
70
|
+
UmbPartialViewCreateFromSnippetModalElement = __decorate([
|
|
71
|
+
customElement('umb-partial-view-create-from-snippet-modal')
|
|
72
|
+
], UmbPartialViewCreateFromSnippetModalElement);
|
|
73
|
+
export default UmbPartialViewCreateFromSnippetModalElement;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { ManifestEntityAction } from '../../../core/extension-registry/index.js';
|
|
2
|
-
export declare const manifests: ManifestEntityAction
|
|
2
|
+
export declare const manifests: (ManifestEntityAction | {
|
|
3
|
+
type: string;
|
|
4
|
+
alias: string;
|
|
5
|
+
name: string;
|
|
6
|
+
loader: () => Promise<typeof import("./create/create-from-snippet.modal.js")>;
|
|
7
|
+
})[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PARTIAL_VIEW_ENTITY_TYPE, PARTIAL_VIEW_FOLDER_ENTITY_TYPE, PARTIAL_VIEW_REPOSITORY_ALIAS } from '../config.js';
|
|
1
|
+
import { PARTIAL_VIEW_ENTITY_TYPE, PARTIAL_VIEW_FOLDER_EMPTY_ENTITY_TYPE, PARTIAL_VIEW_FOLDER_ENTITY_TYPE, PARTIAL_VIEW_REPOSITORY_ALIAS, PARTIAL_VIEW_ROOT_ENTITY_TYPE, } from '../config.js';
|
|
2
2
|
import { UmbCreateFromSnippetPartialViewAction } from './create/create-from-snippet.action.js';
|
|
3
3
|
import { UmbCreateEmptyPartialViewAction } from './create/create-empty.action.js';
|
|
4
|
-
import { UmbDeleteEntityAction } from '../../../core/entity-action/index.js';
|
|
4
|
+
import { UmbCreateFolderEntityAction, UmbDeleteEntityAction, UmbDeleteFolderEntityAction, } from '../../../core/entity-action/index.js';
|
|
5
5
|
//TODO: this is temporary until we have a proper way of registering actions for folder types in a specific tree
|
|
6
6
|
//Actions for partial view files
|
|
7
7
|
const partialViewActions = [
|
|
@@ -34,7 +34,7 @@ const partialViewFolderActions = [
|
|
|
34
34
|
repositoryAlias: PARTIAL_VIEW_REPOSITORY_ALIAS,
|
|
35
35
|
},
|
|
36
36
|
conditions: {
|
|
37
|
-
entityTypes: [PARTIAL_VIEW_FOLDER_ENTITY_TYPE],
|
|
37
|
+
entityTypes: [PARTIAL_VIEW_FOLDER_ENTITY_TYPE, PARTIAL_VIEW_ROOT_ENTITY_TYPE],
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
{
|
|
@@ -48,8 +48,46 @@ const partialViewFolderActions = [
|
|
|
48
48
|
repositoryAlias: PARTIAL_VIEW_REPOSITORY_ALIAS,
|
|
49
49
|
},
|
|
50
50
|
conditions: {
|
|
51
|
-
entityTypes: [PARTIAL_VIEW_FOLDER_ENTITY_TYPE],
|
|
51
|
+
entityTypes: [PARTIAL_VIEW_FOLDER_ENTITY_TYPE, PARTIAL_VIEW_ROOT_ENTITY_TYPE],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: 'entityAction',
|
|
56
|
+
alias: 'Umb.EntityAction.PartialViewFolder.DeleteFolder',
|
|
57
|
+
name: 'Remove empty folder',
|
|
58
|
+
meta: {
|
|
59
|
+
icon: 'umb:trash',
|
|
60
|
+
label: 'Remove folder',
|
|
61
|
+
api: UmbDeleteFolderEntityAction,
|
|
62
|
+
repositoryAlias: PARTIAL_VIEW_REPOSITORY_ALIAS,
|
|
63
|
+
},
|
|
64
|
+
conditions: {
|
|
65
|
+
entityTypes: [PARTIAL_VIEW_FOLDER_EMPTY_ENTITY_TYPE],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: 'entityAction',
|
|
70
|
+
alias: 'Umb.EntityAction.PartialViewFolder.CreateFolder',
|
|
71
|
+
name: 'Create empty folder',
|
|
72
|
+
meta: {
|
|
73
|
+
icon: 'umb:add',
|
|
74
|
+
label: 'Create folder',
|
|
75
|
+
api: UmbCreateFolderEntityAction,
|
|
76
|
+
repositoryAlias: PARTIAL_VIEW_REPOSITORY_ALIAS,
|
|
77
|
+
},
|
|
78
|
+
conditions: {
|
|
79
|
+
entityTypes: [
|
|
80
|
+
PARTIAL_VIEW_FOLDER_EMPTY_ENTITY_TYPE,
|
|
81
|
+
PARTIAL_VIEW_FOLDER_ENTITY_TYPE,
|
|
82
|
+
PARTIAL_VIEW_ROOT_ENTITY_TYPE,
|
|
83
|
+
],
|
|
52
84
|
},
|
|
53
85
|
},
|
|
54
86
|
];
|
|
55
|
-
|
|
87
|
+
const createFromSnippetActionModal = {
|
|
88
|
+
type: 'modal',
|
|
89
|
+
alias: 'Umb.Modal.CreateFromSnippetPartialView',
|
|
90
|
+
name: 'Choose insert type sidebar',
|
|
91
|
+
loader: () => import('./create/create-from-snippet.modal.js'),
|
|
92
|
+
};
|
|
93
|
+
export const manifests = [...partialViewActions, ...partialViewFolderActions, createFromSnippetActionModal];
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export declare const manifests: (import("../../core/index.js").ManifestEntityAction | import("../../core/index.js").ManifestMenuItemTreeKind | import("../../core/index.js").ManifestRepository | import("../../core/index.js").ManifestStore | import("../../core/index.js").ManifestTreeStore | import("../../core/index.js").ManifestTree | import("../../core/index.js").ManifestTreeItem | import("../../core/index.js").ManifestWorkspace | import("../../core/index.js").ManifestWorkspaceAction
|
|
1
|
+
export declare const manifests: (import("../../core/index.js").ManifestEntityAction | import("../../core/index.js").ManifestMenuItemTreeKind | import("../../core/index.js").ManifestRepository | import("../../core/index.js").ManifestStore | import("../../core/index.js").ManifestTreeStore | import("../../core/index.js").ManifestTree | import("../../core/index.js").ManifestTreeItem | import("../../core/index.js").ManifestWorkspace | import("../../core/index.js").ManifestWorkspaceAction | {
|
|
2
|
+
type: string;
|
|
3
|
+
alias: string;
|
|
4
|
+
name: string;
|
|
5
|
+
loader: () => Promise<typeof import("./entity-actions/create/create-from-snippet.modal.js")>;
|
|
6
|
+
})[];
|
|
@@ -1,19 +1,28 @@
|
|
|
1
|
+
import { PartialViewGetFolderResponse } from './sources/partial-views.folder.server.data.js';
|
|
1
2
|
import { Observable } from '../../../../external/rxjs/index.js';
|
|
2
3
|
import { UmbControllerHostElement } from '../../../../libs/controller-api/index.js';
|
|
3
|
-
import {
|
|
4
|
-
import { UmbDetailRepository, UmbTreeRepository } from '../../../../shared/repository/index.js';
|
|
5
|
-
export declare class UmbPartialViewsRepository implements UmbTreeRepository<
|
|
4
|
+
import { CreateFolderRequestModel, CreatePartialViewRequestModel, FileSystemTreeItemPresentationModel, FolderModelBaseModel, FolderReponseModel, PagedSnippetItemResponseModel, PartialViewItemResponseModel, PartialViewResponseModel, ProblemDetails, TextFileResponseModelBaseModel, UpdatePartialViewRequestModel } from '../../../../external/backend-api/index.js';
|
|
5
|
+
import { DataSourceResponse, UmbDataSourceErrorResponse, UmbDetailRepository, UmbFolderRepository, UmbTreeRepository } from '../../../../shared/repository/index.js';
|
|
6
|
+
export declare class UmbPartialViewsRepository implements UmbTreeRepository<FileSystemTreeItemPresentationModel>, UmbDetailRepository<CreatePartialViewRequestModel, string, UpdatePartialViewRequestModel, PartialViewResponseModel, string>, UmbFolderRepository {
|
|
6
7
|
#private;
|
|
7
8
|
constructor(host: UmbControllerHostElement);
|
|
8
|
-
|
|
9
|
-
data?:
|
|
9
|
+
createFolderScaffold(parentId: string | null): Promise<{
|
|
10
|
+
data?: FolderReponseModel | undefined;
|
|
10
11
|
error?: ProblemDetails | undefined;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
}>;
|
|
13
|
+
createFolder(requestBody: CreateFolderRequestModel): Promise<{
|
|
14
|
+
data?: string | undefined;
|
|
15
|
+
error?: ProblemDetails | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
requestFolder(unique: string): Promise<{
|
|
18
|
+
data?: PartialViewGetFolderResponse | undefined;
|
|
19
|
+
error?: ProblemDetails | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
updateFolder(unique: string, folder: FolderModelBaseModel): Promise<{
|
|
22
|
+
data?: FolderModelBaseModel | undefined;
|
|
23
|
+
error?: ProblemDetails | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
deleteFolder(path: string): Promise<{
|
|
17
26
|
error?: ProblemDetails | undefined;
|
|
18
27
|
}>;
|
|
19
28
|
requestTreeRoot(): Promise<{
|
|
@@ -29,12 +38,12 @@ export declare class UmbPartialViewsRepository implements UmbTreeRepository<Enti
|
|
|
29
38
|
requestRootTreeItems(): Promise<{
|
|
30
39
|
data: import("../../../../external/backend-api/index.js").PagedFileSystemTreeItemPresentationModel | undefined;
|
|
31
40
|
error: import("../../../../external/backend-api/index.js").ApiError | import("../../../../external/backend-api/index.js").CancelError | undefined;
|
|
32
|
-
asObservable: () => Observable<
|
|
41
|
+
asObservable: () => Observable<FileSystemTreeItemPresentationModel[]>;
|
|
33
42
|
}>;
|
|
34
43
|
requestTreeItemsOf(path: string | null): Promise<{
|
|
35
44
|
data: any;
|
|
36
45
|
error: any;
|
|
37
|
-
asObservable: () => Observable<
|
|
46
|
+
asObservable: () => Observable<FileSystemTreeItemPresentationModel[]>;
|
|
38
47
|
}>;
|
|
39
48
|
requestTreeItems(keys: Array<string>): Promise<{
|
|
40
49
|
data: undefined;
|
|
@@ -43,17 +52,24 @@ export declare class UmbPartialViewsRepository implements UmbTreeRepository<Enti
|
|
|
43
52
|
} | {
|
|
44
53
|
data: any;
|
|
45
54
|
error: any;
|
|
46
|
-
asObservable: () => Observable<
|
|
55
|
+
asObservable: () => Observable<FileSystemTreeItemPresentationModel[]>;
|
|
47
56
|
}>;
|
|
48
|
-
rootTreeItems(): Promise<Observable<
|
|
49
|
-
treeItemsOf(parentPath: string | null): Promise<Observable<
|
|
50
|
-
treeItems(paths: Array<string>): Promise<Observable<
|
|
57
|
+
rootTreeItems(): Promise<Observable<FileSystemTreeItemPresentationModel[]>>;
|
|
58
|
+
treeItemsOf(parentPath: string | null): Promise<Observable<FileSystemTreeItemPresentationModel[]>>;
|
|
59
|
+
treeItems(paths: Array<string>): Promise<Observable<FileSystemTreeItemPresentationModel[]>>;
|
|
51
60
|
requestByKey(path: string): Promise<{
|
|
52
|
-
data: undefined;
|
|
53
|
-
error: undefined;
|
|
61
|
+
data: TextFileResponseModelBaseModel | undefined;
|
|
62
|
+
error: import("../../../../external/backend-api/index.js").ApiError | import("../../../../external/backend-api/index.js").CancelError | undefined;
|
|
54
63
|
}>;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
requestById(id: string): Promise<DataSourceResponse<any>>;
|
|
65
|
+
byId(id: string): Promise<Observable<any>>;
|
|
66
|
+
createScaffold(parentId: string | null, preset: string): Promise<DataSourceResponse<TextFileResponseModelBaseModel>>;
|
|
67
|
+
create(data: CreatePartialViewRequestModel): Promise<DataSourceResponse<any>>;
|
|
68
|
+
save(id: string, requestBody: UpdatePartialViewRequestModel): Promise<UmbDataSourceErrorResponse>;
|
|
69
|
+
delete(id: string): Promise<UmbDataSourceErrorResponse>;
|
|
70
|
+
getSnippets({ skip, take }: {
|
|
71
|
+
skip?: number | undefined;
|
|
72
|
+
take?: number | undefined;
|
|
73
|
+
}): Promise<DataSourceResponse<PagedSnippetItemResponseModel>>;
|
|
74
|
+
requestItems(keys: Array<string>): Promise<DataSourceResponse<PartialViewItemResponseModel[]>>;
|
|
59
75
|
}
|
|
@@ -1,34 +1,63 @@
|
|
|
1
|
+
import { PARTIAL_VIEW_ROOT_ENTITY_TYPE } from '../config.js';
|
|
1
2
|
import { UmbPartialViewDetailServerDataSource } from './sources/partial-views.detail.server.data.js';
|
|
2
3
|
import { UmbPartialViewsTreeServerDataSource } from './sources/partial-views.tree.server.data.js';
|
|
3
4
|
import { UMB_PARTIAL_VIEW_TREE_STORE_CONTEXT_TOKEN } from './partial-views.tree.store.js';
|
|
5
|
+
import { UmbPartialViewsFolderServerDataSource, } from './sources/partial-views.folder.server.data.js';
|
|
4
6
|
import { UmbContextConsumerController } from '../../../../libs/context-api/index.js';
|
|
5
|
-
import { PARTIAL_VIEW_ROOT_ENTITY_TYPE } from '../config.js';
|
|
6
7
|
export class UmbPartialViewsRepository {
|
|
7
8
|
#init;
|
|
8
9
|
#host;
|
|
9
10
|
#treeDataSource;
|
|
10
11
|
#detailDataSource;
|
|
12
|
+
#folderDataSource;
|
|
11
13
|
#treeStore;
|
|
12
14
|
constructor(host) {
|
|
13
15
|
this.#host = host;
|
|
14
16
|
this.#treeDataSource = new UmbPartialViewsTreeServerDataSource(this.#host);
|
|
15
17
|
this.#detailDataSource = new UmbPartialViewDetailServerDataSource(this.#host);
|
|
18
|
+
this.#folderDataSource = new UmbPartialViewsFolderServerDataSource(this.#host);
|
|
16
19
|
this.#init = Promise.all([
|
|
17
20
|
new UmbContextConsumerController(this.#host, UMB_PARTIAL_VIEW_TREE_STORE_CONTEXT_TOKEN, (instance) => {
|
|
18
21
|
this.#treeStore = instance;
|
|
19
22
|
}),
|
|
20
23
|
]);
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
//#region FOLDER
|
|
26
|
+
createFolderScaffold(parentId) {
|
|
27
|
+
const data = {
|
|
28
|
+
name: '',
|
|
29
|
+
parentId,
|
|
30
|
+
};
|
|
31
|
+
return Promise.resolve({ data, error: undefined });
|
|
24
32
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
async createFolder(requestBody) {
|
|
34
|
+
await this.#init;
|
|
35
|
+
const req = {
|
|
36
|
+
parentPath: requestBody.parentId,
|
|
37
|
+
name: requestBody.name,
|
|
38
|
+
};
|
|
39
|
+
const promise = this.#folderDataSource.insert(req);
|
|
40
|
+
await promise;
|
|
41
|
+
this.requestTreeItemsOf(requestBody.parentId ? requestBody.parentId : null);
|
|
42
|
+
return promise;
|
|
43
|
+
}
|
|
44
|
+
async requestFolder(unique) {
|
|
45
|
+
await this.#init;
|
|
46
|
+
return this.#folderDataSource.get(unique);
|
|
47
|
+
}
|
|
48
|
+
updateFolder(unique, folder) {
|
|
29
49
|
throw new Error('Method not implemented.');
|
|
30
50
|
}
|
|
31
|
-
|
|
51
|
+
async deleteFolder(path) {
|
|
52
|
+
await this.#init;
|
|
53
|
+
const { data } = await this.requestFolder(path);
|
|
54
|
+
const promise = this.#folderDataSource.delete(path);
|
|
55
|
+
await promise;
|
|
56
|
+
this.requestTreeItemsOf(data?.parentPath ? data?.parentPath : null);
|
|
57
|
+
return promise;
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region TREE
|
|
32
61
|
async requestTreeRoot() {
|
|
33
62
|
await this.#init;
|
|
34
63
|
const data = {
|
|
@@ -54,7 +83,7 @@ export class UmbPartialViewsRepository {
|
|
|
54
83
|
return this.requestRootTreeItems();
|
|
55
84
|
}
|
|
56
85
|
await this.#init;
|
|
57
|
-
const { data, error } = await this.#treeDataSource.getChildrenOf({ path });
|
|
86
|
+
const { data, error } = await this.#treeDataSource.getChildrenOf({ path, skip: 0, take: 100 });
|
|
58
87
|
if (data) {
|
|
59
88
|
this.#treeStore.appendItems(data.items);
|
|
60
89
|
}
|
|
@@ -85,7 +114,8 @@ export class UmbPartialViewsRepository {
|
|
|
85
114
|
await this.#init;
|
|
86
115
|
return this.#treeStore.items(paths);
|
|
87
116
|
}
|
|
88
|
-
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region DETAILS
|
|
89
119
|
async requestByKey(path) {
|
|
90
120
|
if (!path)
|
|
91
121
|
throw new Error('Path is missing');
|
|
@@ -93,17 +123,34 @@ export class UmbPartialViewsRepository {
|
|
|
93
123
|
const { data, error } = await this.#detailDataSource.get(path);
|
|
94
124
|
return { data, error };
|
|
95
125
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
126
|
+
requestById(id) {
|
|
127
|
+
throw new Error('Method not implemented.');
|
|
128
|
+
}
|
|
129
|
+
byId(id) {
|
|
130
|
+
throw new Error('Method not implemented.');
|
|
131
|
+
}
|
|
132
|
+
createScaffold(parentId, preset) {
|
|
133
|
+
return this.#detailDataSource.createScaffold(parentId, preset);
|
|
134
|
+
}
|
|
135
|
+
async create(data) {
|
|
136
|
+
const promise = this.#detailDataSource.insert(data);
|
|
137
|
+
await promise;
|
|
138
|
+
this.requestTreeItemsOf(data.parentPath ? data.parentPath : null);
|
|
139
|
+
return promise;
|
|
140
|
+
}
|
|
141
|
+
save(id, requestBody) {
|
|
142
|
+
return this.#detailDataSource.update(id, requestBody);
|
|
99
143
|
}
|
|
100
|
-
async
|
|
101
|
-
|
|
144
|
+
async delete(id) {
|
|
145
|
+
const promise = this.#detailDataSource.delete(id);
|
|
146
|
+
const parentPath = id.substring(0, id.lastIndexOf('/'));
|
|
147
|
+
this.requestTreeItemsOf(parentPath ? parentPath : null);
|
|
148
|
+
return promise;
|
|
102
149
|
}
|
|
103
|
-
|
|
104
|
-
return
|
|
150
|
+
getSnippets({ skip = 0, take = 100 }) {
|
|
151
|
+
return this.#detailDataSource.getSnippets({ skip, take });
|
|
105
152
|
}
|
|
106
|
-
|
|
107
|
-
return
|
|
153
|
+
requestItems(keys) {
|
|
154
|
+
return this.#detailDataSource.getItems(keys);
|
|
108
155
|
}
|
|
109
156
|
}
|
|
@@ -1,26 +1,61 @@
|
|
|
1
1
|
import { PartialViewDetails } from '../../config.js';
|
|
2
|
+
import { CreatePartialViewRequestModel, PagedSnippetItemResponseModel, PartialViewItemResponseModel, PartialViewResponseModel, UpdatePartialViewRequestModel } from '../../../../../external/backend-api/index.js';
|
|
2
3
|
import type { UmbControllerHostElement } from '../../../../../libs/controller-api/index.js';
|
|
3
4
|
import { DataSourceResponse, UmbDataSource } from '../../../../../shared/repository/index.js';
|
|
4
|
-
export declare class UmbPartialViewDetailServerDataSource implements UmbDataSource<
|
|
5
|
+
export declare class UmbPartialViewDetailServerDataSource implements UmbDataSource<CreatePartialViewRequestModel, string, UpdatePartialViewRequestModel, PartialViewResponseModel, string> {
|
|
5
6
|
#private;
|
|
7
|
+
constructor(host: UmbControllerHostElement);
|
|
6
8
|
/**
|
|
7
|
-
* Creates
|
|
8
|
-
*
|
|
9
|
+
* Creates a new partial view scaffold
|
|
10
|
+
*
|
|
11
|
+
* @param {(string | null)} [parentId=null] You can leave this empty
|
|
12
|
+
* @param {string} preset Name of the snippet to use as a preset
|
|
13
|
+
* @return {*} {Promise<DataSourceResponse<PartialViewDetails>>}
|
|
9
14
|
* @memberof UmbPartialViewDetailServerDataSource
|
|
10
15
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
createScaffold(parentId: string | null | undefined, preset: string): Promise<DataSourceResponse<PartialViewDetails>>;
|
|
17
|
+
/**
|
|
18
|
+
* Get possible snippets for partial views
|
|
19
|
+
*
|
|
20
|
+
* @param {*} { skip = 0, take = 100 }
|
|
21
|
+
* @return {*} {Promise<DataSourceResponse<PagedSnippetItemResponseModel>>}
|
|
22
|
+
* @memberof UmbPartialViewDetailServerDataSource
|
|
23
|
+
*/
|
|
24
|
+
getSnippets({ skip, take }: {
|
|
25
|
+
skip?: number | undefined;
|
|
26
|
+
take?: number | undefined;
|
|
27
|
+
}): Promise<DataSourceResponse<PagedSnippetItemResponseModel>>;
|
|
13
28
|
/**
|
|
14
|
-
* Fetches a
|
|
29
|
+
* Fetches a partial view with the given path from the server
|
|
15
30
|
* @param {string} path
|
|
16
31
|
* @return {*}
|
|
17
32
|
* @memberof UmbStylesheetServerDataSource
|
|
18
33
|
*/
|
|
19
|
-
get(path: string): Promise<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
get(path: string): Promise<DataSourceResponse<import("../../../../../external/backend-api/index.js").TextFileResponseModelBaseModel>>;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new partial view
|
|
37
|
+
*
|
|
38
|
+
* @param {CreatePartialViewRequestModel} requestBody
|
|
39
|
+
* @return {*} {Promise<DataSourceResponse<string>>}
|
|
40
|
+
* @memberof UmbPartialViewDetailServerDataSource
|
|
41
|
+
*/
|
|
42
|
+
insert(requestBody: CreatePartialViewRequestModel): Promise<DataSourceResponse<string>>;
|
|
43
|
+
/**
|
|
44
|
+
* Updates a partial view
|
|
45
|
+
*
|
|
46
|
+
* @param {string} [unique='']
|
|
47
|
+
* @param {UpdatePartialViewRequestModel} requestBody
|
|
48
|
+
* @return {*} {Promise<DataSourceResponse<any>>}
|
|
49
|
+
* @memberof UmbPartialViewDetailServerDataSource
|
|
50
|
+
*/
|
|
51
|
+
update(unique: string | undefined, requestBody: UpdatePartialViewRequestModel): Promise<DataSourceResponse<any>>;
|
|
52
|
+
/**
|
|
53
|
+
* Deletes a partial view
|
|
54
|
+
*
|
|
55
|
+
* @param {string} path
|
|
56
|
+
* @return {*} {Promise<DataSourceResponse>}
|
|
57
|
+
* @memberof UmbPartialViewDetailServerDataSource
|
|
58
|
+
*/
|
|
59
|
+
delete(path: string): Promise<DataSourceResponse>;
|
|
60
|
+
getItems(keys: Array<string>): Promise<DataSourceResponse<PartialViewItemResponseModel[]>>;
|
|
26
61
|
}
|
|
@@ -1,36 +1,75 @@
|
|
|
1
|
-
|
|
1
|
+
import { PartialViewResource, } from '../../../../../external/backend-api/index.js';
|
|
2
|
+
import { tryExecuteAndNotify } from '../../../../../shared/resources/index.js';
|
|
2
3
|
export class UmbPartialViewDetailServerDataSource {
|
|
3
4
|
#host;
|
|
5
|
+
constructor(host) {
|
|
6
|
+
this.#host = host;
|
|
7
|
+
}
|
|
4
8
|
/**
|
|
5
|
-
* Creates
|
|
6
|
-
*
|
|
9
|
+
* Creates a new partial view scaffold
|
|
10
|
+
*
|
|
11
|
+
* @param {(string | null)} [parentId=null] You can leave this empty
|
|
12
|
+
* @param {string} preset Name of the snippet to use as a preset
|
|
13
|
+
* @return {*} {Promise<DataSourceResponse<PartialViewDetails>>}
|
|
7
14
|
* @memberof UmbPartialViewDetailServerDataSource
|
|
8
15
|
*/
|
|
9
|
-
|
|
10
|
-
this.#host
|
|
16
|
+
createScaffold(parentId = null, preset) {
|
|
17
|
+
return tryExecuteAndNotify(this.#host, PartialViewResource.getPartialViewSnippetByName({ name: preset }));
|
|
11
18
|
}
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Get possible snippets for partial views
|
|
21
|
+
*
|
|
22
|
+
* @param {*} { skip = 0, take = 100 }
|
|
23
|
+
* @return {*} {Promise<DataSourceResponse<PagedSnippetItemResponseModel>>}
|
|
24
|
+
* @memberof UmbPartialViewDetailServerDataSource
|
|
25
|
+
*/
|
|
26
|
+
getSnippets({ skip = 0, take = 100 }) {
|
|
27
|
+
return tryExecuteAndNotify(this.#host, PartialViewResource.getPartialViewSnippet({ skip, take }));
|
|
14
28
|
}
|
|
15
29
|
/**
|
|
16
|
-
* Fetches a
|
|
30
|
+
* Fetches a partial view with the given path from the server
|
|
17
31
|
* @param {string} path
|
|
18
32
|
* @return {*}
|
|
19
33
|
* @memberof UmbStylesheetServerDataSource
|
|
20
34
|
*/
|
|
21
|
-
|
|
35
|
+
get(path) {
|
|
22
36
|
if (!path)
|
|
23
37
|
throw new Error('Path is missing');
|
|
24
|
-
|
|
25
|
-
return { data: undefined, error: undefined };
|
|
38
|
+
return tryExecuteAndNotify(this.#host, PartialViewResource.getPartialView({ path }));
|
|
26
39
|
}
|
|
27
|
-
|
|
28
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new partial view
|
|
42
|
+
*
|
|
43
|
+
* @param {CreatePartialViewRequestModel} requestBody
|
|
44
|
+
* @return {*} {Promise<DataSourceResponse<string>>}
|
|
45
|
+
* @memberof UmbPartialViewDetailServerDataSource
|
|
46
|
+
*/
|
|
47
|
+
insert(requestBody) {
|
|
48
|
+
return tryExecuteAndNotify(this.#host, PartialViewResource.postPartialView({ requestBody }));
|
|
49
|
+
}
|
|
50
|
+
//TODO the parameters here are bit ugly, since unique is already in the request body parameter, but it has to be done to marry the UmbDataSource interface an backend API together... maybe come up with some nicer solution
|
|
51
|
+
/**
|
|
52
|
+
* Updates a partial view
|
|
53
|
+
*
|
|
54
|
+
* @param {string} [unique='']
|
|
55
|
+
* @param {UpdatePartialViewRequestModel} requestBody
|
|
56
|
+
* @return {*} {Promise<DataSourceResponse<any>>}
|
|
57
|
+
* @memberof UmbPartialViewDetailServerDataSource
|
|
58
|
+
*/
|
|
59
|
+
update(unique = '', requestBody) {
|
|
60
|
+
return tryExecuteAndNotify(this.#host, PartialViewResource.putPartialView({ requestBody }));
|
|
29
61
|
}
|
|
30
|
-
|
|
31
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Deletes a partial view
|
|
64
|
+
*
|
|
65
|
+
* @param {string} path
|
|
66
|
+
* @return {*} {Promise<DataSourceResponse>}
|
|
67
|
+
* @memberof UmbPartialViewDetailServerDataSource
|
|
68
|
+
*/
|
|
69
|
+
delete(path) {
|
|
70
|
+
return tryExecuteAndNotify(this.#host, PartialViewResource.deletePartialView({ path }));
|
|
32
71
|
}
|
|
33
|
-
|
|
34
|
-
|
|
72
|
+
getItems(keys) {
|
|
73
|
+
return tryExecuteAndNotify(this.#host, PartialViewResource.getPartialViewItem({ id: keys }));
|
|
35
74
|
}
|
|
36
75
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CreateFolderRequestModel, FolderModelBaseModel, FolderReponseModel } from '../../../../../external/backend-api/index.js';
|
|
2
|
+
import { UmbControllerHostElement } from '../../../../../libs/controller-api/index.js';
|
|
3
|
+
import { DataSourceResponse, UmbFolderDataSource } from '../../../../../shared/repository/index.js';
|
|
4
|
+
export type PartialViewGetFolderResponse = {
|
|
5
|
+
path: string;
|
|
6
|
+
parentPath: string;
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class UmbPartialViewsFolderServerDataSource implements UmbFolderDataSource {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(host: UmbControllerHostElement);
|
|
12
|
+
createScaffold(parentId: string | null): Promise<DataSourceResponse<FolderReponseModel>>;
|
|
13
|
+
get(unique: string): Promise<DataSourceResponse<PartialViewGetFolderResponse>>;
|
|
14
|
+
insert(requestBody: CreateFolderRequestModel): Promise<DataSourceResponse<string>>;
|
|
15
|
+
update(unique: string, data: CreateFolderRequestModel): Promise<DataSourceResponse<FolderModelBaseModel>>;
|
|
16
|
+
delete(path: string): Promise<DataSourceResponse<unknown>>;
|
|
17
|
+
}
|