@umbraco-cms/backoffice 14.0.0--preview006-2c37be92 → 14.0.0--preview006-e9aeae87
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/custom-elements.json +11 -0
- package/dist-cms/packages/documents/document-types/index.d.ts +1 -0
- package/dist-cms/packages/documents/document-types/index.js +1 -0
- package/dist-cms/packages/documents/document-types/manifests.js +2 -0
- package/dist-cms/packages/documents/document-types/modals/composition-picker/composition-picker-modal.element.d.ts +17 -0
- package/dist-cms/packages/documents/document-types/modals/composition-picker/composition-picker-modal.element.js +184 -0
- package/dist-cms/packages/documents/document-types/modals/composition-picker/composition-picker-modal.token.d.ts +11 -0
- package/dist-cms/packages/documents/document-types/modals/composition-picker/composition-picker-modal.token.js +7 -0
- package/dist-cms/packages/documents/document-types/modals/composition-picker/index.d.ts +2 -0
- package/dist-cms/packages/documents/document-types/modals/composition-picker/index.js +2 -0
- package/dist-cms/packages/documents/document-types/modals/index.d.ts +1 -0
- package/dist-cms/packages/documents/document-types/modals/index.js +1 -0
- package/dist-cms/packages/documents/document-types/modals/manifests.d.ts +2 -0
- package/dist-cms/packages/documents/document-types/modals/manifests.js +9 -0
- package/dist-cms/packages/documents/document-types/repository/composition/document-type-composition.repository.d.ts +15 -0
- package/dist-cms/packages/documents/document-types/repository/composition/document-type-composition.repository.js +28 -0
- package/dist-cms/packages/documents/document-types/repository/composition/document-type-composition.server.data-source.d.ts +36 -0
- package/dist-cms/packages/documents/document-types/repository/composition/document-type-composition.server.data-source.js +75 -0
- package/dist-cms/packages/documents/document-types/repository/composition/index.d.ts +2 -0
- package/dist-cms/packages/documents/document-types/repository/composition/index.js +2 -0
- package/dist-cms/packages/documents/document-types/repository/composition/manifests.d.ts +3 -0
- package/dist-cms/packages/documents/document-types/repository/composition/manifests.js +9 -0
- package/dist-cms/packages/documents/document-types/repository/detail/document-type-detail.server.data-source.js +1 -0
- package/dist-cms/packages/documents/document-types/repository/index.d.ts +1 -0
- package/dist-cms/packages/documents/document-types/repository/index.js +1 -0
- package/dist-cms/packages/documents/document-types/repository/manifests.js +2 -1
- package/dist-cms/packages/documents/document-types/types.d.ts +18 -0
- package/dist-cms/packages/documents/document-types/workspace/views/design/document-type-workspace-view-edit.element.d.ts +2 -1
- package/dist-cms/packages/documents/document-types/workspace/views/design/document-type-workspace-view-edit.element.js +31 -2
- package/dist-cms/packages/user/user/collection/index.d.ts +1 -0
- package/dist-cms/packages/user/user/collection/index.js +1 -0
- package/dist-cms/packages/user/user/index.d.ts +1 -0
- package/dist-cms/packages/user/user/index.js +1 -0
- package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
- package/dist-cms/vscode-html-custom-data.json +6 -1
- package/package.json +1 -1
|
@@ -6070,6 +6070,17 @@
|
|
|
6070
6070
|
}
|
|
6071
6071
|
]
|
|
6072
6072
|
},
|
|
6073
|
+
{
|
|
6074
|
+
"name": "umb-composition-picker-modal",
|
|
6075
|
+
"path": "./../src/packages/documents/document-types/modals/composition-picker/composition-picker-modal.element.ts",
|
|
6076
|
+
"properties": [
|
|
6077
|
+
{
|
|
6078
|
+
"name": "styles",
|
|
6079
|
+
"type": "array",
|
|
6080
|
+
"default": "[null]"
|
|
6081
|
+
}
|
|
6082
|
+
]
|
|
6083
|
+
},
|
|
6073
6084
|
{
|
|
6074
6085
|
"name": "umb-property-editor-ui-document-type-picker",
|
|
6075
6086
|
"path": "./../src/packages/documents/document-types/property-editors/document-type-picker/property-editor-ui-document-type-picker.element.ts",
|
|
@@ -4,6 +4,7 @@ import { manifests as propertyEditorManifests } from './property-editors/manifes
|
|
|
4
4
|
import { manifests as repositoryManifests } from './repository/manifests.js';
|
|
5
5
|
import { manifests as treeManifests } from './tree/manifests.js';
|
|
6
6
|
import { manifests as workspaceManifests } from './workspace/manifests.js';
|
|
7
|
+
import { manifests as modalManifests } from './modals/manifests.js';
|
|
7
8
|
export const manifests = [
|
|
8
9
|
...entityActionsManifests,
|
|
9
10
|
...menuItemManifests,
|
|
@@ -11,4 +12,5 @@ export const manifests = [
|
|
|
11
12
|
...repositoryManifests,
|
|
12
13
|
...treeManifests,
|
|
13
14
|
...workspaceManifests,
|
|
15
|
+
...modalManifests,
|
|
14
16
|
];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { UmbCompositionPickerModalData, UmbCompositionPickerModalValue } from './composition-picker-modal.token.js';
|
|
2
|
+
import { UmbModalBaseElement } from '../../../../core/modal/index.js';
|
|
3
|
+
export declare class UmbCompositionPickerModalElement extends UmbModalBaseElement<UmbCompositionPickerModalData, UmbCompositionPickerModalValue> {
|
|
4
|
+
#private;
|
|
5
|
+
private _references;
|
|
6
|
+
private _compatibleCompositions?;
|
|
7
|
+
private _selection;
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
|
|
11
|
+
}
|
|
12
|
+
export default UmbCompositionPickerModalElement;
|
|
13
|
+
declare global {
|
|
14
|
+
interface HTMLElementTagNameMap {
|
|
15
|
+
'umb-composition-picker-modal': UmbCompositionPickerModalElement;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
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
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
14
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
15
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
16
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
17
|
+
};
|
|
18
|
+
var _UmbCompositionPickerModalElement_instances, _UmbCompositionPickerModalElement_compositionRepository, _UmbCompositionPickerModalElement_unique, _UmbCompositionPickerModalElement_requestReference, _UmbCompositionPickerModalElement_requestAvailableCompositions, _UmbCompositionPickerModalElement_renderHasReference, _UmbCompositionPickerModalElement_renderAvailableCompositions, _UmbCompositionPickerModalElement_onSelectionAdd, _UmbCompositionPickerModalElement_onSelectionRemove, _UmbCompositionPickerModalElement_renderCompositionsItems;
|
|
19
|
+
import { UmbDocumentTypeCompositionRepository } from '../../repository/index.js';
|
|
20
|
+
import { css, html, customElement, state, repeat, nothing } from '../../../../../external/lit/index.js';
|
|
21
|
+
import { UmbModalBaseElement } from '../../../../core/modal/index.js';
|
|
22
|
+
let UmbCompositionPickerModalElement = class UmbCompositionPickerModalElement extends UmbModalBaseElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
_UmbCompositionPickerModalElement_instances.add(this);
|
|
26
|
+
_UmbCompositionPickerModalElement_compositionRepository.set(this, new UmbDocumentTypeCompositionRepository(this));
|
|
27
|
+
_UmbCompositionPickerModalElement_unique.set(this, void 0);
|
|
28
|
+
this._references = [];
|
|
29
|
+
this._selection = [];
|
|
30
|
+
}
|
|
31
|
+
connectedCallback() {
|
|
32
|
+
super.connectedCallback();
|
|
33
|
+
this._selection = this.data?.selection ?? [];
|
|
34
|
+
this.modalContext?.setValue({ selection: this._selection });
|
|
35
|
+
__classPrivateFieldGet(this, _UmbCompositionPickerModalElement_instances, "m", _UmbCompositionPickerModalElement_requestReference).call(this);
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
return html `
|
|
39
|
+
<umb-body-layout headline="${this.localize.term('contentTypeEditor_compositions')}">
|
|
40
|
+
${this._references.length ? __classPrivateFieldGet(this, _UmbCompositionPickerModalElement_instances, "m", _UmbCompositionPickerModalElement_renderHasReference).call(this) : __classPrivateFieldGet(this, _UmbCompositionPickerModalElement_instances, "m", _UmbCompositionPickerModalElement_renderAvailableCompositions).call(this)}
|
|
41
|
+
<div slot="actions">
|
|
42
|
+
<uui-button label=${this.localize.term('general_close')} @click=${this._rejectModal}></uui-button>
|
|
43
|
+
${!this._references.length
|
|
44
|
+
? html `<uui-button
|
|
45
|
+
label=${this.localize.term('general_submit')}
|
|
46
|
+
look="primary"
|
|
47
|
+
color="positive"
|
|
48
|
+
@click=${this._submitModal}></uui-button>`
|
|
49
|
+
: nothing}
|
|
50
|
+
</div>
|
|
51
|
+
</umb-body-layout>
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
_UmbCompositionPickerModalElement_compositionRepository = new WeakMap();
|
|
56
|
+
_UmbCompositionPickerModalElement_unique = new WeakMap();
|
|
57
|
+
_UmbCompositionPickerModalElement_instances = new WeakSet();
|
|
58
|
+
_UmbCompositionPickerModalElement_requestReference = async function _UmbCompositionPickerModalElement_requestReference() {
|
|
59
|
+
__classPrivateFieldSet(this, _UmbCompositionPickerModalElement_unique, this.data?.unique, "f");
|
|
60
|
+
if (!__classPrivateFieldGet(this, _UmbCompositionPickerModalElement_unique, "f"))
|
|
61
|
+
return;
|
|
62
|
+
const { data } = await __classPrivateFieldGet(this, _UmbCompositionPickerModalElement_compositionRepository, "f").getReferences(__classPrivateFieldGet(this, _UmbCompositionPickerModalElement_unique, "f"));
|
|
63
|
+
this._references = data ?? [];
|
|
64
|
+
if (!this._references.length) {
|
|
65
|
+
__classPrivateFieldGet(this, _UmbCompositionPickerModalElement_instances, "m", _UmbCompositionPickerModalElement_requestAvailableCompositions).call(this);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
_UmbCompositionPickerModalElement_requestAvailableCompositions = async function _UmbCompositionPickerModalElement_requestAvailableCompositions() {
|
|
69
|
+
if (!__classPrivateFieldGet(this, _UmbCompositionPickerModalElement_unique, "f"))
|
|
70
|
+
return;
|
|
71
|
+
const isElement = this.data?.isElement;
|
|
72
|
+
const currentPropertyAliases = this.data?.currentPropertyAliases;
|
|
73
|
+
const { data } = await __classPrivateFieldGet(this, _UmbCompositionPickerModalElement_compositionRepository, "f").availableCompositions({
|
|
74
|
+
unique: __classPrivateFieldGet(this, _UmbCompositionPickerModalElement_unique, "f"),
|
|
75
|
+
isElement: isElement ?? false,
|
|
76
|
+
currentCompositeUniques: this._selection,
|
|
77
|
+
currentPropertyAliases: currentPropertyAliases ?? [],
|
|
78
|
+
});
|
|
79
|
+
if (!data)
|
|
80
|
+
return;
|
|
81
|
+
const folders = Array.from(new Set(data.map((c) => '/' + c.folderPath.join('/'))));
|
|
82
|
+
this._compatibleCompositions = folders.map((path) => ({
|
|
83
|
+
path,
|
|
84
|
+
compositions: data.filter((c) => '/' + c.folderPath.join('/') === path),
|
|
85
|
+
}));
|
|
86
|
+
};
|
|
87
|
+
_UmbCompositionPickerModalElement_renderHasReference = function _UmbCompositionPickerModalElement_renderHasReference() {
|
|
88
|
+
return html ` <umb-localize key="contentTypeEditor_compositionInUse">
|
|
89
|
+
This Content Type is used in a composition, and therefore cannot be composed itself.
|
|
90
|
+
</umb-localize>
|
|
91
|
+
<h4>
|
|
92
|
+
<umb-localize key="contentTypeEditor_compositionUsageHeading">Where is this composition used?</umb-localize>
|
|
93
|
+
</h4>
|
|
94
|
+
<umb-localize key="contentTypeEditor_compositionUsageSpecification">
|
|
95
|
+
This composition is currently used in the composition of the following Content Types:
|
|
96
|
+
</umb-localize>
|
|
97
|
+
<div class="reference-list">
|
|
98
|
+
${repeat(this._references, (item) => item.unique, (item) => html `<uui-ref-node-document-type
|
|
99
|
+
href=${'/section/settings/workspace/document-type/edit/' + item.unique}
|
|
100
|
+
name=${item.name}>
|
|
101
|
+
<uui-icon slot="icon" name=${item.icon}></uui-icon>
|
|
102
|
+
</uui-ref-node-document-type>`)}
|
|
103
|
+
</div>`;
|
|
104
|
+
};
|
|
105
|
+
_UmbCompositionPickerModalElement_renderAvailableCompositions = function _UmbCompositionPickerModalElement_renderAvailableCompositions() {
|
|
106
|
+
if (this._compatibleCompositions) {
|
|
107
|
+
return html `<umb-localize key="contentTypeEditor_compositionsDescription">
|
|
108
|
+
Inherit tabs and properties from an existing Document Type. New tabs will be<br />added to the current
|
|
109
|
+
Document Type or merged if a tab with an identical name exists.<br />
|
|
110
|
+
</umb-localize>
|
|
111
|
+
<!--- TODO: Implement search functionality
|
|
112
|
+
<uui-input id="search" placeholder=this.localize.term('placeholders_filter')>
|
|
113
|
+
<uui-icon name="icon-search" slot="prepend"></uui-icon>
|
|
114
|
+
</uui-input> -->
|
|
115
|
+
<div class="compositions-list">
|
|
116
|
+
${repeat(this._compatibleCompositions, (folder) => folder.path, (folder) => html `${this._compatibleCompositions.length > 1
|
|
117
|
+
? html `<strong><uui-icon name="icon-folder"></uui-icon>${folder.path}</strong>`
|
|
118
|
+
: nothing}
|
|
119
|
+
${__classPrivateFieldGet(this, _UmbCompositionPickerModalElement_instances, "m", _UmbCompositionPickerModalElement_renderCompositionsItems).call(this, folder.compositions)}`)}
|
|
120
|
+
</div>`;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
return html `<umb-localize key="contentTypeEditor_noAvailableCompositions">
|
|
124
|
+
There are no Content Types available to use as a composition
|
|
125
|
+
</umb-localize>`;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
_UmbCompositionPickerModalElement_onSelectionAdd = function _UmbCompositionPickerModalElement_onSelectionAdd(unique) {
|
|
129
|
+
this._selection = [...this._selection, unique];
|
|
130
|
+
this.modalContext?.setValue({ selection: this._selection });
|
|
131
|
+
};
|
|
132
|
+
_UmbCompositionPickerModalElement_onSelectionRemove = function _UmbCompositionPickerModalElement_onSelectionRemove(unique) {
|
|
133
|
+
this._selection = this._selection.filter((s) => s !== unique);
|
|
134
|
+
this.modalContext?.setValue({ selection: this._selection });
|
|
135
|
+
};
|
|
136
|
+
_UmbCompositionPickerModalElement_renderCompositionsItems = function _UmbCompositionPickerModalElement_renderCompositionsItems(compositionsList) {
|
|
137
|
+
return repeat(compositionsList, (compositions) => compositions.unique, (compositions) => html `<uui-menu-item
|
|
138
|
+
label=${compositions.name}
|
|
139
|
+
selectable
|
|
140
|
+
@selected=${() => __classPrivateFieldGet(this, _UmbCompositionPickerModalElement_instances, "m", _UmbCompositionPickerModalElement_onSelectionAdd).call(this, compositions.unique)}
|
|
141
|
+
@deselected=${() => __classPrivateFieldGet(this, _UmbCompositionPickerModalElement_instances, "m", _UmbCompositionPickerModalElement_onSelectionRemove).call(this, compositions.unique)}
|
|
142
|
+
?selected=${this._selection.find((unique) => unique === compositions.unique)}>
|
|
143
|
+
<uui-icon name=${compositions.icon} slot="icon"></uui-icon>
|
|
144
|
+
</uui-menu-item>`);
|
|
145
|
+
};
|
|
146
|
+
UmbCompositionPickerModalElement.styles = [
|
|
147
|
+
css `
|
|
148
|
+
uui-input {
|
|
149
|
+
margin: var(--uui-size-6) 0;
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
#search uui-icon {
|
|
155
|
+
padding-left: var(--uui-size-3);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.reference-list {
|
|
159
|
+
margin-block: var(--uui-size-3);
|
|
160
|
+
display: grid;
|
|
161
|
+
gap: var(--uui-size-1);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.compositions-list strong {
|
|
165
|
+
display: flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
gap: var(--uui-size-3);
|
|
168
|
+
}
|
|
169
|
+
`,
|
|
170
|
+
];
|
|
171
|
+
__decorate([
|
|
172
|
+
state()
|
|
173
|
+
], UmbCompositionPickerModalElement.prototype, "_references", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
state()
|
|
176
|
+
], UmbCompositionPickerModalElement.prototype, "_compatibleCompositions", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
state()
|
|
179
|
+
], UmbCompositionPickerModalElement.prototype, "_selection", void 0);
|
|
180
|
+
UmbCompositionPickerModalElement = __decorate([
|
|
181
|
+
customElement('umb-composition-picker-modal')
|
|
182
|
+
], UmbCompositionPickerModalElement);
|
|
183
|
+
export { UmbCompositionPickerModalElement };
|
|
184
|
+
export default UmbCompositionPickerModalElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UmbModalToken } from '../../../../core/modal/index.js';
|
|
2
|
+
export interface UmbCompositionPickerModalData {
|
|
3
|
+
selection: Array<string>;
|
|
4
|
+
unique: string;
|
|
5
|
+
isElement: boolean;
|
|
6
|
+
currentPropertyAliases: Array<string>;
|
|
7
|
+
}
|
|
8
|
+
export interface UmbCompositionPickerModalValue {
|
|
9
|
+
selection: Array<string>;
|
|
10
|
+
}
|
|
11
|
+
export declare const UMB_COMPOSITION_PICKER_MODAL: UmbModalToken<UmbCompositionPickerModalData, UmbCompositionPickerModalValue>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './composition-picker/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './composition-picker/index.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { UmbControllerHost } from '../../../../../libs/controller-api/index.js';
|
|
2
|
+
import type { UmbDocumentTypeCompositionRequestModel } from '../../index.js';
|
|
3
|
+
import { UmbRepositoryBase } from '../../../../core/repository/index.js';
|
|
4
|
+
export declare class UmbDocumentTypeCompositionRepository extends UmbRepositoryBase {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(host: UmbControllerHost);
|
|
7
|
+
getReferences(unique: string): Promise<{
|
|
8
|
+
data: import("../../index.js").UmbDocumentTypeCompositionReferenceModel[] | undefined;
|
|
9
|
+
error: import("../../../../../external/backend-api/index.js").ApiError | import("../../../../../external/backend-api/index.js").CancelError | undefined;
|
|
10
|
+
}>;
|
|
11
|
+
availableCompositions(args: UmbDocumentTypeCompositionRequestModel): Promise<{
|
|
12
|
+
data: import("../../index.js").UmbDocumentTypeCompositionCompatibleModel[] | undefined;
|
|
13
|
+
error: import("../../../../../external/backend-api/index.js").ApiError | import("../../../../../external/backend-api/index.js").CancelError | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _UmbDocumentTypeCompositionRepository_compositionSource;
|
|
13
|
+
import { UmbDocumentTypeCompositionServerDataSource } from './document-type-composition.server.data-source.js';
|
|
14
|
+
import { UmbRepositoryBase } from '../../../../core/repository/index.js';
|
|
15
|
+
export class UmbDocumentTypeCompositionRepository extends UmbRepositoryBase {
|
|
16
|
+
constructor(host) {
|
|
17
|
+
super(host);
|
|
18
|
+
_UmbDocumentTypeCompositionRepository_compositionSource.set(this, void 0);
|
|
19
|
+
__classPrivateFieldSet(this, _UmbDocumentTypeCompositionRepository_compositionSource, new UmbDocumentTypeCompositionServerDataSource(this), "f");
|
|
20
|
+
}
|
|
21
|
+
async getReferences(unique) {
|
|
22
|
+
return __classPrivateFieldGet(this, _UmbDocumentTypeCompositionRepository_compositionSource, "f").getReferences(unique);
|
|
23
|
+
}
|
|
24
|
+
async availableCompositions(args) {
|
|
25
|
+
return __classPrivateFieldGet(this, _UmbDocumentTypeCompositionRepository_compositionSource, "f").availableCompositions(args);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
_UmbDocumentTypeCompositionRepository_compositionSource = new WeakMap();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { UmbDocumentTypeCompositionCompatibleModel, UmbDocumentTypeCompositionReferenceModel, UmbDocumentTypeCompositionRequestModel } from '../../types.js';
|
|
2
|
+
import type { UmbControllerHost } from '../../../../../libs/controller-api/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* A data source for the Document Type Composition that fetches data from the server
|
|
5
|
+
* @export
|
|
6
|
+
* @class UmbDocumentTypeCompositionServerDataSource
|
|
7
|
+
*/
|
|
8
|
+
export declare class UmbDocumentTypeCompositionServerDataSource {
|
|
9
|
+
#private;
|
|
10
|
+
/**
|
|
11
|
+
* Creates an instance of UmbDocumentTypeCompositionServerDataSource.
|
|
12
|
+
* @param {UmbControllerHost} host
|
|
13
|
+
* @memberof UmbDocumentTypeCompositionServerDataSource
|
|
14
|
+
*/
|
|
15
|
+
constructor(host: UmbControllerHost);
|
|
16
|
+
/**
|
|
17
|
+
* Fetches the compatible compositions for a document type from the server
|
|
18
|
+
* @param {string} unique
|
|
19
|
+
* @return {*}
|
|
20
|
+
* @memberof UmbDocumentTypeCompositionServerDataSource
|
|
21
|
+
*/
|
|
22
|
+
getReferences(unique: string): Promise<{
|
|
23
|
+
data: UmbDocumentTypeCompositionReferenceModel[] | undefined;
|
|
24
|
+
error: import("../../../../../external/backend-api/index.js").ApiError | import("../../../../../external/backend-api/index.js").CancelError | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Updates the compositions for a document type on the server
|
|
28
|
+
* @param {DocumentTypeCompositionRequestModel} requestBody
|
|
29
|
+
* @return {*}
|
|
30
|
+
* @memberof UmbDocumentTypeCompositionServerDataSource
|
|
31
|
+
*/
|
|
32
|
+
availableCompositions(args: UmbDocumentTypeCompositionRequestModel): Promise<{
|
|
33
|
+
data: UmbDocumentTypeCompositionCompatibleModel[] | undefined;
|
|
34
|
+
error: import("../../../../../external/backend-api/index.js").ApiError | import("../../../../../external/backend-api/index.js").CancelError | undefined;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _UmbDocumentTypeCompositionServerDataSource_host;
|
|
13
|
+
import { DocumentTypeResource, } from '../../../../../external/backend-api/index.js';
|
|
14
|
+
import { tryExecuteAndNotify } from '../../../../../shared/resources/index.js';
|
|
15
|
+
/**
|
|
16
|
+
* A data source for the Document Type Composition that fetches data from the server
|
|
17
|
+
* @export
|
|
18
|
+
* @class UmbDocumentTypeCompositionServerDataSource
|
|
19
|
+
*/
|
|
20
|
+
export class UmbDocumentTypeCompositionServerDataSource {
|
|
21
|
+
/**
|
|
22
|
+
* Creates an instance of UmbDocumentTypeCompositionServerDataSource.
|
|
23
|
+
* @param {UmbControllerHost} host
|
|
24
|
+
* @memberof UmbDocumentTypeCompositionServerDataSource
|
|
25
|
+
*/
|
|
26
|
+
constructor(host) {
|
|
27
|
+
_UmbDocumentTypeCompositionServerDataSource_host.set(this, void 0);
|
|
28
|
+
__classPrivateFieldSet(this, _UmbDocumentTypeCompositionServerDataSource_host, host, "f");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Fetches the compatible compositions for a document type from the server
|
|
32
|
+
* @param {string} unique
|
|
33
|
+
* @return {*}
|
|
34
|
+
* @memberof UmbDocumentTypeCompositionServerDataSource
|
|
35
|
+
*/
|
|
36
|
+
async getReferences(unique) {
|
|
37
|
+
const response = await tryExecuteAndNotify(__classPrivateFieldGet(this, _UmbDocumentTypeCompositionServerDataSource_host, "f"), DocumentTypeResource.getDocumentTypeByIdCompositionReferences({ id: unique }));
|
|
38
|
+
const error = response.error;
|
|
39
|
+
const data = response.data?.map((reference) => {
|
|
40
|
+
return {
|
|
41
|
+
unique: reference.id,
|
|
42
|
+
icon: reference.icon,
|
|
43
|
+
name: reference.name,
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
return { data, error };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Updates the compositions for a document type on the server
|
|
50
|
+
* @param {DocumentTypeCompositionRequestModel} requestBody
|
|
51
|
+
* @return {*}
|
|
52
|
+
* @memberof UmbDocumentTypeCompositionServerDataSource
|
|
53
|
+
*/
|
|
54
|
+
async availableCompositions(args) {
|
|
55
|
+
const requestBody = {
|
|
56
|
+
id: args.unique,
|
|
57
|
+
isElement: args.isElement,
|
|
58
|
+
currentCompositeIds: args.currentCompositeUniques,
|
|
59
|
+
currentPropertyAliases: args.currentPropertyAliases,
|
|
60
|
+
};
|
|
61
|
+
const response = await tryExecuteAndNotify(__classPrivateFieldGet(this, _UmbDocumentTypeCompositionServerDataSource_host, "f"), DocumentTypeResource.postDocumentTypeAvailableCompositions({ requestBody }));
|
|
62
|
+
const error = response.error;
|
|
63
|
+
const data = response.data?.map((composition) => {
|
|
64
|
+
return {
|
|
65
|
+
unique: composition.id,
|
|
66
|
+
name: composition.name,
|
|
67
|
+
icon: composition.icon,
|
|
68
|
+
folderPath: composition.folderPath,
|
|
69
|
+
isCompatible: composition.isCompatible,
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
return { data, error };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
_UmbDocumentTypeCompositionServerDataSource_host = new WeakMap();
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ManifestRepository } from '../../../../core/extension-registry/index.js';
|
|
2
|
+
export declare const UMB_DOCUMENT_TYPE_COMPOSITION_REPOSITORY_ALIAS = "Umb.Repository.DocumentType.Composition";
|
|
3
|
+
export declare const manifests: ManifestRepository<import("../../../../../libs/extension-api/index.js").UmbApi>[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UmbDocumentTypeCompositionRepository } from './document-type-composition.repository.js';
|
|
2
|
+
export const UMB_DOCUMENT_TYPE_COMPOSITION_REPOSITORY_ALIAS = 'Umb.Repository.DocumentType.Composition';
|
|
3
|
+
const queryRepository = {
|
|
4
|
+
type: 'repository',
|
|
5
|
+
alias: UMB_DOCUMENT_TYPE_COMPOSITION_REPOSITORY_ALIAS,
|
|
6
|
+
name: 'Document Type Composition Repository',
|
|
7
|
+
api: UmbDocumentTypeCompositionRepository,
|
|
8
|
+
};
|
|
9
|
+
export const manifests = [queryRepository];
|
|
@@ -136,6 +136,7 @@ export class UmbDocumentTypeDetailServerDataSource {
|
|
|
136
136
|
throw new Error('Media Type unique is missing');
|
|
137
137
|
// TODO: make data mapper to prevent errors
|
|
138
138
|
const requestBody = {
|
|
139
|
+
folder: model.parentUnique ? { id: model.parentUnique } : null,
|
|
139
140
|
alias: model.alias,
|
|
140
141
|
name: model.name,
|
|
141
142
|
description: model.description,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { manifests as detailManifests } from './detail/manifests.js';
|
|
2
2
|
import { manifests as itemManifests } from './item/manifests.js';
|
|
3
|
-
|
|
3
|
+
import { manifests as compositionManifests } from './composition/manifests.js';
|
|
4
|
+
export const manifests = [...detailManifests, ...itemManifests, ...compositionManifests];
|
|
@@ -11,3 +11,21 @@ export interface UmbDocumentTypeDetailModel extends UmbContentTypeModel {
|
|
|
11
11
|
} | null;
|
|
12
12
|
cleanup: ContentTypeCleanupBaseModel;
|
|
13
13
|
}
|
|
14
|
+
export interface UmbDocumentTypeCompositionRequestModel {
|
|
15
|
+
unique: string;
|
|
16
|
+
isElement: boolean;
|
|
17
|
+
currentPropertyAliases: Array<string>;
|
|
18
|
+
currentCompositeUniques: Array<string>;
|
|
19
|
+
}
|
|
20
|
+
export interface UmbDocumentTypeCompositionCompatibleModel {
|
|
21
|
+
unique: string;
|
|
22
|
+
name: string;
|
|
23
|
+
icon: string;
|
|
24
|
+
folderPath: Array<string>;
|
|
25
|
+
isCompatible: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface UmbDocumentTypeCompositionReferenceModel {
|
|
28
|
+
unique: string;
|
|
29
|
+
name: string;
|
|
30
|
+
icon: string;
|
|
31
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UmbLitElement } from '../../../../../core/lit-element/index.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type PropertyTypeContainerModelBaseModel } from '../../../../../../external/backend-api/index.js';
|
|
3
3
|
import type { UmbWorkspaceViewElement } from '../../../../../core/extension-registry/index.js';
|
|
4
4
|
import type { UmbSorterConfig } from '../../../../../core/sorter/index.js';
|
|
5
5
|
import { UmbSorterController } from '../../../../../core/sorter/index.js';
|
|
@@ -17,6 +17,7 @@ export declare class UmbDocumentTypeWorkspaceViewEditElement extends UmbLitEleme
|
|
|
17
17
|
private _workspaceContext?;
|
|
18
18
|
private _tabsStructureHelper;
|
|
19
19
|
private _modalManagerContext?;
|
|
20
|
+
private _compositionConfiguration?;
|
|
20
21
|
constructor();
|
|
21
22
|
private _observeRootGroups;
|
|
22
23
|
private _createRoutes;
|
|
@@ -9,11 +9,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _UmbDocumentTypeWorkspaceViewEditElement_instances, _UmbDocumentTypeWorkspaceViewEditElement_changeMode, _UmbDocumentTypeWorkspaceViewEditElement_requestRemoveTab, _UmbDocumentTypeWorkspaceViewEditElement_remove, _UmbDocumentTypeWorkspaceViewEditElement_addTab, _UmbDocumentTypeWorkspaceViewEditElement_focusInput, _UmbDocumentTypeWorkspaceViewEditElement_tabNameChanged, _UmbDocumentTypeWorkspaceViewEditElement_changeOrderNumber;
|
|
12
|
+
var _UmbDocumentTypeWorkspaceViewEditElement_instances, _UmbDocumentTypeWorkspaceViewEditElement_changeMode, _UmbDocumentTypeWorkspaceViewEditElement_requestRemoveTab, _UmbDocumentTypeWorkspaceViewEditElement_remove, _UmbDocumentTypeWorkspaceViewEditElement_addTab, _UmbDocumentTypeWorkspaceViewEditElement_focusInput, _UmbDocumentTypeWorkspaceViewEditElement_tabNameChanged, _UmbDocumentTypeWorkspaceViewEditElement_openCompositionModal, _UmbDocumentTypeWorkspaceViewEditElement_changeOrderNumber;
|
|
13
|
+
import { UMB_COMPOSITION_PICKER_MODAL } from '../../../modals/index.js';
|
|
13
14
|
import { css, html, customElement, state, repeat, nothing, ifDefined } from '../../../../../../external/lit/index.js';
|
|
14
15
|
import { UmbContentTypeContainerStructureHelper } from '../../../../../core/content-type/index.js';
|
|
15
16
|
import { encodeFolderName } from '../../../../../../shared/router/index.js';
|
|
16
17
|
import { UmbLitElement } from '../../../../../core/lit-element/index.js';
|
|
18
|
+
import { CompositionTypeModel, } from '../../../../../../external/backend-api/index.js';
|
|
17
19
|
import { UMB_WORKSPACE_CONTEXT } from '../../../../../core/workspace/index.js';
|
|
18
20
|
import { UMB_CONFIRM_MODAL, UMB_MODAL_MANAGER_CONTEXT } from '../../../../../core/modal/index.js';
|
|
19
21
|
import { UmbTextStyles } from '../../../../../../shared/style/index.js';
|
|
@@ -81,6 +83,16 @@ let UmbDocumentTypeWorkspaceViewEditElement = class UmbDocumentTypeWorkspaceView
|
|
|
81
83
|
this._workspaceContext = workspaceContext;
|
|
82
84
|
this._tabsStructureHelper.setStructureManager(workspaceContext.structure);
|
|
83
85
|
this.observe(this._workspaceContext.isSorting, (isSorting) => (this.sortModeActive = isSorting), '_observeIsSorting');
|
|
86
|
+
const unique = this._workspaceContext.getEntityId();
|
|
87
|
+
//TODO Figure out the correct data that needs to be sent to the compositions modal. Do we really have to send isElement, currentPropertyAliases - isn't unique enough?
|
|
88
|
+
this.observe(this._workspaceContext.structure.contentTypes, (contentTypes) => {
|
|
89
|
+
this._compositionConfiguration = {
|
|
90
|
+
unique: unique ?? '',
|
|
91
|
+
selection: contentTypes.map((contentType) => contentType.unique).filter((id) => id !== unique),
|
|
92
|
+
isElement: contentTypes.find((contentType) => contentType.unique === unique)?.isElement ?? false,
|
|
93
|
+
currentPropertyAliases: [],
|
|
94
|
+
};
|
|
95
|
+
});
|
|
84
96
|
this._observeRootGroups();
|
|
85
97
|
});
|
|
86
98
|
this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (context) => {
|
|
@@ -169,7 +181,11 @@ let UmbDocumentTypeWorkspaceViewEditElement = class UmbDocumentTypeWorkspaceView
|
|
|
169
181
|
? this.localize.term('general_reorderDone')
|
|
170
182
|
: this.localize.term('general_reorder');
|
|
171
183
|
return html `<div class="tab-actions">
|
|
172
|
-
<uui-button
|
|
184
|
+
<uui-button
|
|
185
|
+
look="outline"
|
|
186
|
+
label=${this.localize.term('contentTypeEditor_compositions')}
|
|
187
|
+
compact
|
|
188
|
+
@click=${__classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditElement_instances, "m", _UmbDocumentTypeWorkspaceViewEditElement_openCompositionModal)}>
|
|
173
189
|
<uui-icon name="icon-merge"></uui-icon>
|
|
174
190
|
${this.localize.term('contentTypeEditor_compositions')}
|
|
175
191
|
</uui-button>
|
|
@@ -338,6 +354,16 @@ _UmbDocumentTypeWorkspaceViewEditElement_tabNameChanged = async function _UmbDoc
|
|
|
338
354
|
// Update the current URL, so we are still on this specific tab:
|
|
339
355
|
window.history.replaceState(null, '', this._routerPath + '/tab/' + encodeFolderName(newName));
|
|
340
356
|
};
|
|
357
|
+
_UmbDocumentTypeWorkspaceViewEditElement_openCompositionModal = async function _UmbDocumentTypeWorkspaceViewEditElement_openCompositionModal() {
|
|
358
|
+
const modalContext = this._modalManagerContext?.open(UMB_COMPOSITION_PICKER_MODAL, {
|
|
359
|
+
data: this._compositionConfiguration,
|
|
360
|
+
});
|
|
361
|
+
await modalContext?.onSubmit();
|
|
362
|
+
if (!modalContext?.value)
|
|
363
|
+
return;
|
|
364
|
+
const compositionIds = modalContext.getValue().selection;
|
|
365
|
+
this._workspaceContext?.setCompositions(compositionIds.map((unique) => ({ contentType: { unique }, compositionType: CompositionTypeModel.COMPOSITION })));
|
|
366
|
+
};
|
|
341
367
|
_UmbDocumentTypeWorkspaceViewEditElement_changeOrderNumber = function _UmbDocumentTypeWorkspaceViewEditElement_changeOrderNumber(tab, e) {
|
|
342
368
|
if (!e.target.value || !tab.id)
|
|
343
369
|
return;
|
|
@@ -456,6 +482,9 @@ __decorate([
|
|
|
456
482
|
__decorate([
|
|
457
483
|
state()
|
|
458
484
|
], UmbDocumentTypeWorkspaceViewEditElement.prototype, "_buttonDisabled", void 0);
|
|
485
|
+
__decorate([
|
|
486
|
+
state()
|
|
487
|
+
], UmbDocumentTypeWorkspaceViewEditElement.prototype, "_compositionConfiguration", void 0);
|
|
459
488
|
UmbDocumentTypeWorkspaceViewEditElement = __decorate([
|
|
460
489
|
customElement('umb-document-type-workspace-view-edit')
|
|
461
490
|
], UmbDocumentTypeWorkspaceViewEditElement);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './repository/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './repository/index.js';
|