@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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PartialViewResource, } from '../../../../../external/backend-api/index.js';
|
|
2
|
+
import { tryExecuteAndNotify } from '../../../../../shared/resources/index.js';
|
|
3
|
+
export class UmbPartialViewsFolderServerDataSource {
|
|
4
|
+
#host;
|
|
5
|
+
constructor(host) {
|
|
6
|
+
this.#host = host;
|
|
7
|
+
}
|
|
8
|
+
createScaffold(parentId) {
|
|
9
|
+
throw new Error('Method not implemented.');
|
|
10
|
+
}
|
|
11
|
+
get(unique) {
|
|
12
|
+
return tryExecuteAndNotify(this.#host, PartialViewResource.getPartialViewFolder({ path: unique }));
|
|
13
|
+
}
|
|
14
|
+
insert(requestBody) {
|
|
15
|
+
return tryExecuteAndNotify(this.#host, PartialViewResource.postPartialViewFolder({ requestBody }));
|
|
16
|
+
}
|
|
17
|
+
update(unique, data) {
|
|
18
|
+
throw new Error('Method not implemented.');
|
|
19
|
+
}
|
|
20
|
+
delete(path) {
|
|
21
|
+
return tryExecuteAndNotify(this.#host, PartialViewResource.deletePartialViewFolder({ path }));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
2
2
|
export declare class UmbPartialViewsWorkspaceEditElement extends UmbLitElement {
|
|
3
3
|
#private;
|
|
4
|
-
private _name
|
|
4
|
+
private get _name();
|
|
5
|
+
private set _name(value);
|
|
5
6
|
private _content?;
|
|
7
|
+
private _path?;
|
|
8
|
+
private _ready?;
|
|
6
9
|
private _codeEditor?;
|
|
10
|
+
private _modalContext?;
|
|
11
|
+
private inputQuery$;
|
|
7
12
|
constructor();
|
|
8
13
|
render(): import("lit-html").TemplateResult<1>;
|
|
9
14
|
static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
|
package/dist-cms/packages/templating/partial-views/workspace/partial-views-workspace-edit.element.js
CHANGED
|
@@ -7,15 +7,34 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { UUITextStyles } from '../../../../external/uui/index.js';
|
|
8
8
|
import { css, html, customElement, query, state } from '../../../../external/lit/index.js';
|
|
9
9
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
10
|
+
import { UMB_MODAL_MANAGER_CONTEXT_TOKEN } from '../../../core/modal/index.js';
|
|
11
|
+
import { UMB_TEMPLATE_QUERY_BUILDER_MODAL } from '../../templates/modals/modal-tokens.js';
|
|
12
|
+
import { getQuerySnippet } from '../../utils.js';
|
|
13
|
+
import { Subject, debounceTime } from '../../../../external/rxjs/index.js';
|
|
10
14
|
export let UmbPartialViewsWorkspaceEditElement = class UmbPartialViewsWorkspaceEditElement extends UmbLitElement {
|
|
15
|
+
#name;
|
|
16
|
+
get _name() {
|
|
17
|
+
return this.#name;
|
|
18
|
+
}
|
|
19
|
+
set _name(value) {
|
|
20
|
+
this.#name = value?.replace('.cshtml', '');
|
|
21
|
+
this.requestUpdate();
|
|
22
|
+
}
|
|
11
23
|
#partialViewsWorkspaceContext;
|
|
12
24
|
#isNew;
|
|
13
25
|
constructor() {
|
|
14
26
|
super();
|
|
15
|
-
this
|
|
27
|
+
this.#name = '';
|
|
16
28
|
this._content = '';
|
|
29
|
+
this._path = '';
|
|
30
|
+
this._ready = false;
|
|
17
31
|
this.#isNew = false;
|
|
18
|
-
this.
|
|
32
|
+
this.inputQuery$ = new Subject();
|
|
33
|
+
this.consumeContext(UMB_MODAL_MANAGER_CONTEXT_TOKEN, (instance) => {
|
|
34
|
+
this._modalContext = instance;
|
|
35
|
+
});
|
|
36
|
+
//tODO: should this be called something else here?
|
|
37
|
+
this.consumeContext('UmbEntityWorkspaceContext', (workspaceContext) => {
|
|
19
38
|
this.#partialViewsWorkspaceContext = workspaceContext;
|
|
20
39
|
this.observe(this.#partialViewsWorkspaceContext.name, (name) => {
|
|
21
40
|
this._name = name;
|
|
@@ -23,44 +42,73 @@ export let UmbPartialViewsWorkspaceEditElement = class UmbPartialViewsWorkspaceE
|
|
|
23
42
|
this.observe(this.#partialViewsWorkspaceContext.content, (content) => {
|
|
24
43
|
this._content = content;
|
|
25
44
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
this.observe(this.#partialViewsWorkspaceContext.path, (path) => {
|
|
46
|
+
this._path = path;
|
|
47
|
+
});
|
|
48
|
+
this.observe(this.#partialViewsWorkspaceContext.isNew, (isNew) => {
|
|
49
|
+
this.#isNew = !!isNew;
|
|
50
|
+
});
|
|
51
|
+
this.observe(this.#partialViewsWorkspaceContext.isCodeEditorReady, (isReady) => {
|
|
52
|
+
this._ready = isReady;
|
|
53
|
+
});
|
|
54
|
+
this.inputQuery$.pipe(debounceTime(250)).subscribe((nameInputValue) => {
|
|
55
|
+
this.#partialViewsWorkspaceContext?.setName(`${nameInputValue}.cshtml`);
|
|
56
|
+
});
|
|
29
57
|
});
|
|
30
58
|
}
|
|
31
|
-
// TODO: temp code for testing create and save
|
|
32
59
|
#onNameInput(event) {
|
|
33
60
|
const target = event.target;
|
|
34
61
|
const value = target.value;
|
|
35
|
-
this
|
|
62
|
+
this.inputQuery$.next(value);
|
|
36
63
|
}
|
|
37
|
-
//TODO - debounce that
|
|
38
64
|
#onCodeEditorInput(event) {
|
|
39
65
|
const target = event.target;
|
|
40
66
|
const value = target.code;
|
|
41
67
|
this.#partialViewsWorkspaceContext?.setContent(value);
|
|
42
68
|
}
|
|
43
|
-
#
|
|
69
|
+
#insertSnippet(event) {
|
|
44
70
|
const target = event.target;
|
|
45
71
|
const value = target.value;
|
|
46
|
-
this._codeEditor?.insert(
|
|
72
|
+
this._codeEditor?.insert(value);
|
|
73
|
+
}
|
|
74
|
+
#openQueryBuilder() {
|
|
75
|
+
const queryBuilderModal = this._modalContext?.open(UMB_TEMPLATE_QUERY_BUILDER_MODAL);
|
|
76
|
+
queryBuilderModal?.onSubmit().then((queryBuilderModalResult) => {
|
|
77
|
+
if (queryBuilderModalResult.value)
|
|
78
|
+
this._codeEditor?.insert(getQuerySnippet(queryBuilderModalResult.value));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
#renderCodeEditor() {
|
|
82
|
+
return html `<umb-code-editor
|
|
83
|
+
language="razor"
|
|
84
|
+
id="content"
|
|
85
|
+
.code=${this._content ?? ''}
|
|
86
|
+
@input=${this.#onCodeEditorInput}></umb-code-editor>`;
|
|
47
87
|
}
|
|
48
88
|
render() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
89
|
+
return html `<umb-workspace-editor alias="Umb.Workspace.Template">
|
|
90
|
+
<div id="workspace-header" slot="header">
|
|
91
|
+
<uui-input
|
|
92
|
+
placeholder="Enter name..."
|
|
93
|
+
.value=${this._name}
|
|
94
|
+
@input=${this.#onNameInput}
|
|
95
|
+
label="template name"></uui-input>
|
|
96
|
+
<small>Views/Partials/${this._path}</small>
|
|
97
|
+
</div>
|
|
52
98
|
<uui-box>
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
99
|
+
<div slot="header" id="code-editor-menu-container">
|
|
100
|
+
<umb-templating-insert-menu @insert=${this.#insertSnippet}></umb-templating-insert-menu>
|
|
101
|
+
<uui-button look="secondary" id="query-builder-button" label="Query builder" @click=${this.#openQueryBuilder}>
|
|
102
|
+
<uui-icon name="umb:wand"></uui-icon>Query builder
|
|
103
|
+
</uui-button>
|
|
104
|
+
</div>
|
|
105
|
+
${this._ready
|
|
106
|
+
? this.#renderCodeEditor()
|
|
107
|
+
: html `<div id="loader-container">
|
|
108
|
+
<uui-loader></uui-loader>
|
|
109
|
+
</div>`}
|
|
62
110
|
</uui-box>
|
|
63
|
-
</umb-
|
|
111
|
+
</umb-workspace-editor>`;
|
|
64
112
|
}
|
|
65
113
|
static { this.styles = [
|
|
66
114
|
UUITextStyles,
|
|
@@ -71,28 +119,76 @@ export let UmbPartialViewsWorkspaceEditElement = class UmbPartialViewsWorkspaceE
|
|
|
71
119
|
height: 100%;
|
|
72
120
|
}
|
|
73
121
|
|
|
122
|
+
#loader-container {
|
|
123
|
+
display: grid;
|
|
124
|
+
place-items: center;
|
|
125
|
+
min-height: calc(100dvh - 360px);
|
|
126
|
+
}
|
|
127
|
+
|
|
74
128
|
umb-code-editor {
|
|
75
|
-
--editor-height: calc(
|
|
129
|
+
--editor-height: calc(100dvh - 300px);
|
|
76
130
|
}
|
|
77
131
|
|
|
78
132
|
uui-box {
|
|
79
|
-
|
|
133
|
+
min-height: calc(100dvh - 300px);
|
|
134
|
+
margin: var(--uui-size-layout-1);
|
|
80
135
|
--uui-box-default-padding: 0;
|
|
136
|
+
/* remove header border bottom as code editor looks better in this box */
|
|
137
|
+
--uui-color-divider-standalone: transparent;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
#workspace-header {
|
|
141
|
+
width: 100%;
|
|
81
142
|
}
|
|
82
143
|
|
|
83
144
|
uui-input {
|
|
84
145
|
width: 100%;
|
|
85
|
-
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
#code-editor-menu-container uui-icon:not([name='umb:delete']) {
|
|
149
|
+
margin-right: var(--uui-size-space-3);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
#insert-menu {
|
|
153
|
+
margin: 0;
|
|
154
|
+
padding: 0;
|
|
155
|
+
margin-top: var(--uui-size-space-3);
|
|
156
|
+
background-color: var(--uui-color-surface);
|
|
157
|
+
box-shadow: var(--uui-shadow-depth-3);
|
|
158
|
+
min-width: calc(100% + var(--uui-size-8, 24px));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
#insert-menu > li,
|
|
162
|
+
ul {
|
|
163
|
+
padding: 0;
|
|
164
|
+
width: 100%;
|
|
165
|
+
list-style: none;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.insert-menu-item {
|
|
169
|
+
width: 100%;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
#code-editor-menu-container {
|
|
173
|
+
display: flex;
|
|
174
|
+
justify-content: flex-end;
|
|
175
|
+
gap: var(--uui-size-space-3);
|
|
86
176
|
}
|
|
87
177
|
`,
|
|
88
178
|
]; }
|
|
89
179
|
};
|
|
90
180
|
__decorate([
|
|
91
181
|
state()
|
|
92
|
-
], UmbPartialViewsWorkspaceEditElement.prototype, "_name",
|
|
182
|
+
], UmbPartialViewsWorkspaceEditElement.prototype, "_name", null);
|
|
93
183
|
__decorate([
|
|
94
184
|
state()
|
|
95
185
|
], UmbPartialViewsWorkspaceEditElement.prototype, "_content", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
state()
|
|
188
|
+
], UmbPartialViewsWorkspaceEditElement.prototype, "_path", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
state()
|
|
191
|
+
], UmbPartialViewsWorkspaceEditElement.prototype, "_ready", void 0);
|
|
96
192
|
__decorate([
|
|
97
193
|
query('umb-code-editor')
|
|
98
194
|
], UmbPartialViewsWorkspaceEditElement.prototype, "_codeEditor", void 0);
|
package/dist-cms/packages/templating/partial-views/workspace/partial-views-workspace.context.d.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { UmbPartialViewsRepository } from '../repository/partial-views.repository.js';
|
|
2
|
-
import {
|
|
2
|
+
import { PartialViewDetails } from '../config.js';
|
|
3
3
|
import { UmbControllerHostElement } from '../../../../libs/controller-api/index.js';
|
|
4
4
|
import { UmbWorkspaceContext } from '../../../core/workspace/index.js';
|
|
5
|
-
export declare class UmbPartialViewsWorkspaceContext extends UmbWorkspaceContext<UmbPartialViewsRepository,
|
|
5
|
+
export declare class UmbPartialViewsWorkspaceContext extends UmbWorkspaceContext<UmbPartialViewsRepository, PartialViewDetails> {
|
|
6
6
|
#private;
|
|
7
7
|
getEntityId(): string | undefined;
|
|
8
8
|
getEntityType(): string;
|
|
9
9
|
save(): Promise<void>;
|
|
10
10
|
destroy(): void;
|
|
11
|
-
data: import("rxjs").Observable<
|
|
11
|
+
data: import("rxjs").Observable<import("../../../../external/backend-api/index.js").TextFileResponseModelBaseModel | undefined>;
|
|
12
12
|
name: import("rxjs").Observable<string | undefined>;
|
|
13
|
-
content: import("rxjs").Observable<string |
|
|
13
|
+
content: import("rxjs").Observable<string | undefined>;
|
|
14
|
+
path: import("rxjs").Observable<string | undefined>;
|
|
15
|
+
isCodeEditorReady: import("rxjs").Observable<boolean>;
|
|
14
16
|
constructor(host: UmbControllerHostElement);
|
|
15
|
-
getData():
|
|
17
|
+
getData(): import("../../../../external/backend-api/index.js").TextFileResponseModelBaseModel | undefined;
|
|
16
18
|
setName(value: string): void;
|
|
17
19
|
setContent(value: string): void;
|
|
18
20
|
load(entityKey: string): Promise<void>;
|
|
19
|
-
create(parentKey: string | null): Promise<void>;
|
|
21
|
+
create(parentKey: string | null, name?: string): Promise<void>;
|
|
20
22
|
}
|
package/dist-cms/packages/templating/partial-views/workspace/partial-views-workspace.context.js
CHANGED
|
@@ -1,26 +1,62 @@
|
|
|
1
1
|
import { UmbPartialViewsRepository } from '../repository/partial-views.repository.js';
|
|
2
|
-
import { createObservablePart, UmbDeepState } from '../../../../libs/observable-api/index.js';
|
|
2
|
+
import { createObservablePart, UmbBooleanState, UmbDeepState } from '../../../../libs/observable-api/index.js';
|
|
3
3
|
import { UmbWorkspaceContext } from '../../../core/workspace/index.js';
|
|
4
|
+
import { loadCodeEditor } from '../../code-editor/index.js';
|
|
4
5
|
export class UmbPartialViewsWorkspaceContext extends UmbWorkspaceContext {
|
|
5
6
|
getEntityId() {
|
|
6
|
-
|
|
7
|
+
return this.getData()?.path;
|
|
7
8
|
}
|
|
8
9
|
getEntityType() {
|
|
9
10
|
throw new Error('Method not implemented.');
|
|
10
11
|
}
|
|
11
12
|
save() {
|
|
12
|
-
|
|
13
|
+
const partialView = this.getData();
|
|
14
|
+
if (!partialView)
|
|
15
|
+
return Promise.reject('Something went wrong, there is no data for partial view you want to save...');
|
|
16
|
+
if (this.getIsNew()) {
|
|
17
|
+
const createRequestBody = {
|
|
18
|
+
name: partialView.name,
|
|
19
|
+
content: partialView.content,
|
|
20
|
+
parentPath: partialView.path + '/',
|
|
21
|
+
};
|
|
22
|
+
this.repository.create(createRequestBody);
|
|
23
|
+
console.log('create');
|
|
24
|
+
return Promise.resolve();
|
|
25
|
+
}
|
|
26
|
+
if (!partialView.path)
|
|
27
|
+
return Promise.reject('There is no path');
|
|
28
|
+
const updateRequestBody = {
|
|
29
|
+
name: partialView.name,
|
|
30
|
+
existingPath: partialView.path,
|
|
31
|
+
content: partialView.content,
|
|
32
|
+
};
|
|
33
|
+
this.repository.save(partialView.path, updateRequestBody);
|
|
34
|
+
return Promise.resolve();
|
|
13
35
|
}
|
|
14
36
|
destroy() {
|
|
15
37
|
throw new Error('Method not implemented.');
|
|
16
38
|
}
|
|
17
39
|
#data;
|
|
40
|
+
#isCodeEditorReady;
|
|
18
41
|
constructor(host) {
|
|
19
42
|
super(host, new UmbPartialViewsRepository(host));
|
|
20
43
|
this.#data = new UmbDeepState(undefined);
|
|
21
44
|
this.data = this.#data.asObservable();
|
|
22
45
|
this.name = createObservablePart(this.#data, (data) => data?.name);
|
|
23
46
|
this.content = createObservablePart(this.#data, (data) => data?.content);
|
|
47
|
+
this.path = createObservablePart(this.#data, (data) => data?.path);
|
|
48
|
+
this.#isCodeEditorReady = new UmbBooleanState(false);
|
|
49
|
+
this.isCodeEditorReady = this.#isCodeEditorReady.asObservable();
|
|
50
|
+
this.#loadCodeEditor();
|
|
51
|
+
}
|
|
52
|
+
async #loadCodeEditor() {
|
|
53
|
+
try {
|
|
54
|
+
await loadCodeEditor();
|
|
55
|
+
this.#isCodeEditorReady.next(true);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error(error);
|
|
59
|
+
}
|
|
24
60
|
}
|
|
25
61
|
getData() {
|
|
26
62
|
return this.#data.getValue();
|
|
@@ -38,11 +74,16 @@ export class UmbPartialViewsWorkspaceContext extends UmbWorkspaceContext {
|
|
|
38
74
|
this.#data.next(data);
|
|
39
75
|
}
|
|
40
76
|
}
|
|
41
|
-
async create(parentKey) {
|
|
42
|
-
const { data } = await this.repository.createScaffold(parentKey);
|
|
77
|
+
async create(parentKey, name = 'Empty') {
|
|
78
|
+
const { data } = await this.repository.createScaffold(parentKey, name);
|
|
79
|
+
const newPartial = {
|
|
80
|
+
...data,
|
|
81
|
+
name: '',
|
|
82
|
+
path: parentKey ?? '',
|
|
83
|
+
};
|
|
43
84
|
if (!data)
|
|
44
85
|
return;
|
|
45
86
|
this.setIsNew(true);
|
|
46
|
-
this.#data.next(
|
|
87
|
+
this.#data.next(newPartial);
|
|
47
88
|
}
|
|
48
89
|
}
|
package/dist-cms/packages/templating/partial-views/workspace/partial-views-workspace.element.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
2
2
|
import { UmbRoute } from '../../../../shared/router/index.js';
|
|
3
3
|
import './partial-views-workspace-edit.element.js';
|
|
4
|
+
import '../../components/insert-menu/templating-insert-menu.element.js';
|
|
4
5
|
export declare class UmbPartialViewsWorkspaceElement extends UmbLitElement {
|
|
5
6
|
#private;
|
|
6
7
|
_routes: UmbRoute[];
|
package/dist-cms/packages/templating/partial-views/workspace/partial-views-workspace.element.js
CHANGED
|
@@ -9,6 +9,7 @@ import { UUITextStyles } from '../../../../external/uui/index.js';
|
|
|
9
9
|
import { css, html, customElement, state } from '../../../../external/lit/index.js';
|
|
10
10
|
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
11
11
|
import './partial-views-workspace-edit.element.js';
|
|
12
|
+
import '../../components/insert-menu/templating-insert-menu.element.js';
|
|
12
13
|
import { UmbWorkspaceIsNewRedirectController } from '../../../core/workspace/index.js';
|
|
13
14
|
export let UmbPartialViewsWorkspaceElement = class UmbPartialViewsWorkspaceElement extends UmbLitElement {
|
|
14
15
|
constructor() {
|
|
@@ -17,11 +18,13 @@ export let UmbPartialViewsWorkspaceElement = class UmbPartialViewsWorkspaceEleme
|
|
|
17
18
|
this.#element = document.createElement('umb-partial-views-workspace-edit');
|
|
18
19
|
this._routes = [
|
|
19
20
|
{
|
|
20
|
-
path: 'create/:parentKey',
|
|
21
|
+
path: 'create/:parentKey/:snippetName',
|
|
21
22
|
component: () => this.#element,
|
|
22
23
|
setup: async (component, info) => {
|
|
23
24
|
const parentKey = info.match.params.parentKey;
|
|
24
|
-
|
|
25
|
+
const decodePath = decodeURIComponent(parentKey);
|
|
26
|
+
const snippetName = info.match.params.snippetName;
|
|
27
|
+
this.#partialViewsWorkspaceContext.create(decodePath === 'null' ? null : parentKey, snippetName);
|
|
25
28
|
new UmbWorkspaceIsNewRedirectController(this, this.#partialViewsWorkspaceContext, this.shadowRoot.querySelector('umb-router-slot'));
|
|
26
29
|
},
|
|
27
30
|
},
|
|
@@ -30,7 +33,8 @@ export let UmbPartialViewsWorkspaceElement = class UmbPartialViewsWorkspaceEleme
|
|
|
30
33
|
component: () => this.#element,
|
|
31
34
|
setup: (component, info) => {
|
|
32
35
|
const key = info.match.params.key;
|
|
33
|
-
|
|
36
|
+
const decodePath = decodeURIComponent(key).replace('-cshtml', '.cshtml');
|
|
37
|
+
this.#partialViewsWorkspaceContext.load(decodePath);
|
|
34
38
|
},
|
|
35
39
|
},
|
|
36
40
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DataSourceResponse } from '../index.js';
|
|
2
|
-
export interface UmbDataSource<CreateRequestType, CreateResponseType, UpdateRequestType, ResponseType
|
|
3
|
-
createScaffold(parentId: string | null): Promise<DataSourceResponse<CreateRequestType>>;
|
|
2
|
+
export interface UmbDataSource<CreateRequestType, CreateResponseType, UpdateRequestType, ResponseType, CreateScaffoldPresetType = Partial<CreateRequestType>> {
|
|
3
|
+
createScaffold(parentId: string | null, preset?: Partial<CreateRequestType> | CreateScaffoldPresetType): Promise<DataSourceResponse<CreateRequestType>>;
|
|
4
4
|
get(unique: string): Promise<DataSourceResponse<ResponseType>>;
|
|
5
5
|
insert(data: CreateRequestType): Promise<DataSourceResponse<CreateResponseType>>;
|
|
6
6
|
update(unique: string, data: UpdateRequestType): Promise<DataSourceResponse<ResponseType>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DataSourceResponse, UmbDataSourceErrorResponse } from './data-source/index.js';
|
|
2
2
|
import { Observable } from '../../external/rxjs/index.js';
|
|
3
|
-
export interface UmbDetailRepository<CreateRequestType = any, CreateResponseType = any, UpdateRequestType = any, ResponseType = any
|
|
4
|
-
createScaffold(parentId: string | null, preset?: Partial<CreateRequestType>): Promise<DataSourceResponse<CreateRequestType>>;
|
|
3
|
+
export interface UmbDetailRepository<CreateRequestType = any, CreateResponseType = any, UpdateRequestType = any, ResponseType = any, CreateScaffoldPresetType = Partial<CreateRequestType>> {
|
|
4
|
+
createScaffold(parentId: string | null, preset?: Partial<CreateRequestType> | CreateScaffoldPresetType): Promise<DataSourceResponse<CreateRequestType>>;
|
|
5
5
|
requestById(id: string): Promise<DataSourceResponse<ResponseType | undefined>>;
|
|
6
6
|
byId(id: string): Promise<Observable<ResponseType | undefined>>;
|
|
7
7
|
create(data: CreateRequestType): Promise<DataSourceResponse<CreateResponseType>>;
|