@umbraco-cms/backoffice 14.0.0--preview004-eaff2f45 → 14.0.0--preview004-15ed40b3
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/apps/backoffice/backoffice.element.js +1 -0
- package/dist-cms/custom-elements.json +103 -0
- package/dist-cms/mocks/browser-handlers.js +22 -20
- package/dist-cms/mocks/data/data-type.data.js +9 -0
- package/dist-cms/mocks/data/document-type/document-type.data.js +20 -0
- package/dist-cms/mocks/data/scripts.data.js +5 -5
- package/dist-cms/mocks/data/static-file.data.d.ts +15 -0
- package/dist-cms/mocks/data/static-file.data.js +46 -0
- package/dist-cms/mocks/data/utils.js +2 -2
- package/dist-cms/mocks/handlers/static-file.handlers.d.ts +1 -0
- package/dist-cms/mocks/handlers/static-file.handlers.js +35 -0
- package/dist-cms/packages/core/modal/token/index.d.ts +10 -10
- package/dist-cms/packages/core/modal/token/index.js +10 -10
- package/dist-cms/packages/documents/documents/components/input-document/input-document.context.js +2 -1
- package/dist-cms/packages/documents/documents/property-editors/document-picker/property-editor-ui-document-picker.element.js +4 -4
- package/dist-cms/packages/documents/documents/repository/document.repository.js +2 -2
- package/dist-cms/packages/static-file/components/index.d.ts +1 -0
- package/dist-cms/packages/static-file/components/index.js +1 -0
- package/dist-cms/packages/static-file/components/input-static-file/index.d.ts +2 -0
- package/dist-cms/packages/static-file/components/input-static-file/index.js +2 -0
- package/dist-cms/packages/static-file/components/input-static-file/input-static-file.context.d.ts +6 -0
- package/dist-cms/packages/static-file/components/input-static-file/input-static-file.context.js +8 -0
- package/dist-cms/packages/static-file/components/input-static-file/input-static-file.element.d.ts +50 -0
- package/dist-cms/packages/static-file/components/input-static-file/input-static-file.element.js +137 -0
- package/dist-cms/packages/static-file/entity.d.ts +2 -0
- package/dist-cms/packages/static-file/entity.js +2 -0
- package/dist-cms/packages/static-file/index.d.ts +3 -0
- package/dist-cms/packages/static-file/index.js +3 -0
- package/dist-cms/packages/static-file/manifests.d.ts +1 -0
- package/dist-cms/packages/static-file/manifests.js +4 -0
- package/dist-cms/packages/static-file/modals/index.d.ts +1 -0
- package/dist-cms/packages/static-file/modals/index.js +1 -0
- package/dist-cms/packages/static-file/modals/static-file-picker-modal.token.d.ts +5 -0
- package/dist-cms/packages/static-file/modals/static-file-picker-modal.token.js +11 -0
- package/dist-cms/packages/static-file/property-editors/manifests.d.ts +1 -0
- package/dist-cms/packages/static-file/property-editors/manifests.js +2 -0
- package/dist-cms/packages/static-file/property-editors/static-file-picker/manifests.d.ts +2 -0
- package/dist-cms/packages/static-file/property-editors/static-file-picker/manifests.js +11 -0
- package/dist-cms/packages/static-file/property-editors/static-file-picker/property-editor-ui-static-file-picker.element.d.ts +20 -0
- package/dist-cms/packages/static-file/property-editors/static-file-picker/property-editor-ui-static-file-picker.element.js +59 -0
- package/dist-cms/packages/static-file/repository/index.d.ts +2 -0
- package/dist-cms/packages/static-file/repository/index.js +2 -0
- package/dist-cms/packages/static-file/repository/manifests.d.ts +5 -0
- package/dist-cms/packages/static-file/repository/manifests.js +26 -0
- package/dist-cms/packages/static-file/repository/static-file-tree.repository.d.ts +18 -0
- package/dist-cms/packages/static-file/repository/static-file-tree.repository.js +21 -0
- package/dist-cms/packages/static-file/repository/static-file-tree.server.data-source.d.ts +18 -0
- package/dist-cms/packages/static-file/repository/static-file-tree.server.data-source.js +46 -0
- package/dist-cms/packages/static-file/repository/static-file-tree.store.d.ts +18 -0
- package/dist-cms/packages/static-file/repository/static-file-tree.store.js +19 -0
- package/dist-cms/packages/static-file/repository/types.d.ts +5 -0
- package/dist-cms/packages/static-file/repository/types.js +1 -0
- package/dist-cms/packages/static-file/tree/manifests.d.ts +2 -0
- package/dist-cms/packages/static-file/tree/manifests.js +11 -0
- package/dist-cms/packages/static-file/umbraco-package.d.ts +7 -0
- package/dist-cms/packages/static-file/umbraco-package.js +9 -0
- package/dist-cms/packages/templating/stylesheets/tree/stylesheet-tree.server.data-source.d.ts +1 -1
- package/dist-cms/packages/templating/stylesheets/tree/stylesheet-tree.server.data-source.js +1 -1
- package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
- package/dist-cms/vscode-html-custom-data.json +40 -0
- package/package.json +2 -1
- package/dist-cms/packages/documents/documents/repository/document.tree.store.d.ts +0 -18
- package/dist-cms/packages/documents/documents/repository/document.tree.store.js +0 -19
package/dist-cms/packages/static-file/components/input-static-file/input-static-file.element.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
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 { UmbStaticFilePickerContext } from './input-static-file.context.js';
|
|
8
|
+
import { css, html, customElement, property, state, ifDefined, repeat } from '../../../../external/lit/index.js';
|
|
9
|
+
import { FormControlMixin } from '../../../../external/uui/index.js';
|
|
10
|
+
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
11
|
+
import { splitStringToArray } from '../../../../shared/utils/index.js';
|
|
12
|
+
let UmbInputStaticFileElement = class UmbInputStaticFileElement extends FormControlMixin(UmbLitElement) {
|
|
13
|
+
/**
|
|
14
|
+
* This is a minimum amount of selected files in this input.
|
|
15
|
+
* @type {number}
|
|
16
|
+
* @attr
|
|
17
|
+
* @default 0
|
|
18
|
+
*/
|
|
19
|
+
get min() {
|
|
20
|
+
return this.#pickerContext.min;
|
|
21
|
+
}
|
|
22
|
+
set min(value) {
|
|
23
|
+
this.#pickerContext.min = value;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* This is a maximum amount of selected files in this input.
|
|
27
|
+
* @type {number}
|
|
28
|
+
* @attr
|
|
29
|
+
* @default Infinity
|
|
30
|
+
*/
|
|
31
|
+
get max() {
|
|
32
|
+
return this.#pickerContext.max;
|
|
33
|
+
}
|
|
34
|
+
set max(value) {
|
|
35
|
+
this.#pickerContext.max = value;
|
|
36
|
+
}
|
|
37
|
+
get selectedPaths() {
|
|
38
|
+
return this.#pickerContext.getSelection();
|
|
39
|
+
}
|
|
40
|
+
set selectedPaths(paths) {
|
|
41
|
+
this.#pickerContext.setSelection(paths);
|
|
42
|
+
}
|
|
43
|
+
set value(pathsString) {
|
|
44
|
+
// Its with full purpose we don't call super.value, as thats being handled by the observation of the context selection.
|
|
45
|
+
this.selectedPaths = splitStringToArray(pathsString);
|
|
46
|
+
}
|
|
47
|
+
#pickerContext;
|
|
48
|
+
constructor() {
|
|
49
|
+
super();
|
|
50
|
+
/**
|
|
51
|
+
* Min validation message.
|
|
52
|
+
* @type {boolean}
|
|
53
|
+
* @attr
|
|
54
|
+
* @default
|
|
55
|
+
*/
|
|
56
|
+
this.minMessage = 'This field need more files';
|
|
57
|
+
/**
|
|
58
|
+
* Max validation message.
|
|
59
|
+
* @type {boolean}
|
|
60
|
+
* @attr
|
|
61
|
+
* @default
|
|
62
|
+
*/
|
|
63
|
+
this.maxMessage = 'This field exceeds the allowed amount of files';
|
|
64
|
+
this.#pickerContext = new UmbStaticFilePickerContext(this);
|
|
65
|
+
this.addValidator('rangeUnderflow', () => this.minMessage, () => !!this.min && this.#pickerContext.getSelection().length < this.min);
|
|
66
|
+
this.addValidator('rangeOverflow', () => this.maxMessage, () => !!this.max && this.#pickerContext.getSelection().length > this.max);
|
|
67
|
+
this.observe(this.#pickerContext.selection, (selection) => (super.value = selection.join(',')));
|
|
68
|
+
this.observe(this.#pickerContext.selectedItems, (selectedItems) => (this._items = selectedItems));
|
|
69
|
+
}
|
|
70
|
+
getFormElement() {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
render() {
|
|
74
|
+
return html `
|
|
75
|
+
${this._items
|
|
76
|
+
? html ` <uui-ref-list
|
|
77
|
+
>${repeat(this._items, (item) => item.path, (item) => this._renderItem(item))}
|
|
78
|
+
</uui-ref-list>`
|
|
79
|
+
: ''}
|
|
80
|
+
${this.#renderAddButton()}
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
#renderAddButton() {
|
|
84
|
+
if (this.max > 0 && this.selectedPaths.length >= this.max)
|
|
85
|
+
return;
|
|
86
|
+
return html `<uui-button
|
|
87
|
+
id="add-button"
|
|
88
|
+
look="placeholder"
|
|
89
|
+
@click=${() => this.#pickerContext.openPicker()}
|
|
90
|
+
label=${this.localize.term('general_add')}></uui-button>`;
|
|
91
|
+
}
|
|
92
|
+
_renderItem(item) {
|
|
93
|
+
if (!item.path)
|
|
94
|
+
return;
|
|
95
|
+
return html `
|
|
96
|
+
<uui-ref-node name=${ifDefined(item.name)} detail=${ifDefined(item.path)}>
|
|
97
|
+
<!-- TODO: implement is trashed <uui-tag size="s" slot="tag" color="danger">Trashed</uui-tag> -->
|
|
98
|
+
<uui-action-bar slot="actions">
|
|
99
|
+
<uui-button @click=${() => this.#pickerContext.requestRemoveItem(item.path)} label="Remove file ${item.name}"
|
|
100
|
+
>Remove</uui-button
|
|
101
|
+
>
|
|
102
|
+
</uui-action-bar>
|
|
103
|
+
</uui-ref-node>
|
|
104
|
+
`;
|
|
105
|
+
}
|
|
106
|
+
static { this.styles = [
|
|
107
|
+
css `
|
|
108
|
+
#add-button {
|
|
109
|
+
width: 100%;
|
|
110
|
+
}
|
|
111
|
+
`,
|
|
112
|
+
]; }
|
|
113
|
+
};
|
|
114
|
+
__decorate([
|
|
115
|
+
property({ type: Number })
|
|
116
|
+
], UmbInputStaticFileElement.prototype, "min", null);
|
|
117
|
+
__decorate([
|
|
118
|
+
property({ type: String, attribute: 'min-message' })
|
|
119
|
+
], UmbInputStaticFileElement.prototype, "minMessage", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
property({ type: Number })
|
|
122
|
+
], UmbInputStaticFileElement.prototype, "max", null);
|
|
123
|
+
__decorate([
|
|
124
|
+
property({ type: String, attribute: 'min-message' })
|
|
125
|
+
], UmbInputStaticFileElement.prototype, "maxMessage", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
property()
|
|
128
|
+
// get value is handled by super class.
|
|
129
|
+
], UmbInputStaticFileElement.prototype, "value", null);
|
|
130
|
+
__decorate([
|
|
131
|
+
state()
|
|
132
|
+
], UmbInputStaticFileElement.prototype, "_items", void 0);
|
|
133
|
+
UmbInputStaticFileElement = __decorate([
|
|
134
|
+
customElement('umb-input-static-file')
|
|
135
|
+
], UmbInputStaticFileElement);
|
|
136
|
+
export { UmbInputStaticFileElement };
|
|
137
|
+
export default UmbInputStaticFileElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const manifests: (import("../core/index.js").ManifestPropertyEditorUi | import("../core/index.js").ManifestTree | import("../core/index.js").ManifestTreeItem | import("../core/index.js").ManifestTreeStore | import("../core/index.js").ManifestRepository<import("../../libs/extension-api/index.js").UmbApi>)[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { manifests as propertyEditorManifests } from './property-editors/manifests.js';
|
|
2
|
+
import { manifests as repositoryManifests } from './repository/manifests.js';
|
|
3
|
+
import { manifests as treeManifests } from './tree/manifests.js';
|
|
4
|
+
export const manifests = [...repositoryManifests, ...propertyEditorManifests, ...treeManifests];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './static-file-picker-modal.token.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './static-file-picker-modal.token.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { StaticFileItemResponseModel } from '../../../external/backend-api/index.js';
|
|
2
|
+
import { UmbModalToken, UmbPickerModalValue, UmbTreePickerModalData } from '../../core/modal/index.js';
|
|
3
|
+
export type UmbStaticFilePickerModalData = UmbTreePickerModalData<StaticFileItemResponseModel>;
|
|
4
|
+
export type UmbStaticFilePickerModalValue = UmbPickerModalValue;
|
|
5
|
+
export declare const UMB_STATIC_FILE_PICKER_MODAL: UmbModalToken<UmbStaticFilePickerModalData, UmbPickerModalValue>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UMB_STATIC_FILE_TREE_ALIAS } from '../index.js';
|
|
2
|
+
import { UmbModalToken } from '../../core/modal/index.js';
|
|
3
|
+
export const UMB_STATIC_FILE_PICKER_MODAL = new UmbModalToken('Umb.Modal.TreePicker', {
|
|
4
|
+
modal: {
|
|
5
|
+
type: 'sidebar',
|
|
6
|
+
size: 'small',
|
|
7
|
+
},
|
|
8
|
+
data: {
|
|
9
|
+
treeAlias: UMB_STATIC_FILE_TREE_ALIAS,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const manifests: import("../../core/index.js").ManifestPropertyEditorUi[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const manifest = {
|
|
2
|
+
type: 'propertyEditorUi',
|
|
3
|
+
alias: 'Umb.PropertyEditorUi.StaticFilePicker',
|
|
4
|
+
name: 'Static File Picker Property Editor UI',
|
|
5
|
+
js: () => import('./property-editor-ui-static-file-picker.element.js'),
|
|
6
|
+
meta: {
|
|
7
|
+
label: 'Static File Picker',
|
|
8
|
+
icon: 'icon-document',
|
|
9
|
+
group: 'common',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { UmbPropertyEditorUiElement } from '../../../core/extension-registry/index.js';
|
|
2
|
+
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
3
|
+
import type { UmbPropertyEditorConfigCollection } from '../../../core/property-editor/index.js';
|
|
4
|
+
import '../../components/input-static-file/index.js';
|
|
5
|
+
export declare class UmbPropertyEditorUIStaticFilePickerElement extends UmbLitElement implements UmbPropertyEditorUiElement {
|
|
6
|
+
private _value;
|
|
7
|
+
get value(): Array<string>;
|
|
8
|
+
set value(value: Array<string>);
|
|
9
|
+
set config(config: UmbPropertyEditorConfigCollection | undefined);
|
|
10
|
+
private _limitMin?;
|
|
11
|
+
private _limitMax?;
|
|
12
|
+
private _onChange;
|
|
13
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
+
}
|
|
15
|
+
export default UmbPropertyEditorUIStaticFilePickerElement;
|
|
16
|
+
declare global {
|
|
17
|
+
interface HTMLElementTagNameMap {
|
|
18
|
+
'umb-property-editor-ui-static-file-picker': UmbPropertyEditorUIStaticFilePickerElement;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { html, customElement, property, state } from '../../../../external/lit/index.js';
|
|
8
|
+
import { UmbLitElement } from '../../../../shared/lit-element/index.js';
|
|
9
|
+
import '../../components/input-static-file/index.js';
|
|
10
|
+
let UmbPropertyEditorUIStaticFilePickerElement = class UmbPropertyEditorUIStaticFilePickerElement extends UmbLitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this._value = [];
|
|
14
|
+
}
|
|
15
|
+
get value() {
|
|
16
|
+
return this._value;
|
|
17
|
+
}
|
|
18
|
+
set value(value) {
|
|
19
|
+
this._value = value || [];
|
|
20
|
+
}
|
|
21
|
+
set config(config) {
|
|
22
|
+
const validationLimit = config?.find((x) => x.alias === 'validationLimit');
|
|
23
|
+
this._limitMin = validationLimit?.value?.min;
|
|
24
|
+
this._limitMax = validationLimit?.value?.max;
|
|
25
|
+
}
|
|
26
|
+
_onChange(event) {
|
|
27
|
+
this.value = event.target.selectedPaths;
|
|
28
|
+
this.dispatchEvent(new CustomEvent('property-value-change'));
|
|
29
|
+
}
|
|
30
|
+
// TODO: Implement mandatory?
|
|
31
|
+
render() {
|
|
32
|
+
return html `
|
|
33
|
+
<umb-input-static-file
|
|
34
|
+
@change=${this._onChange}
|
|
35
|
+
.selectedIds=${this._value}
|
|
36
|
+
.min=${this._limitMin ?? 0}
|
|
37
|
+
.max=${this._limitMax ?? Infinity}
|
|
38
|
+
>Add</umb-input-static-file
|
|
39
|
+
>
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
__decorate([
|
|
44
|
+
property({ type: Array })
|
|
45
|
+
], UmbPropertyEditorUIStaticFilePickerElement.prototype, "value", null);
|
|
46
|
+
__decorate([
|
|
47
|
+
property({ attribute: false })
|
|
48
|
+
], UmbPropertyEditorUIStaticFilePickerElement.prototype, "config", null);
|
|
49
|
+
__decorate([
|
|
50
|
+
state()
|
|
51
|
+
], UmbPropertyEditorUIStaticFilePickerElement.prototype, "_limitMin", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
state()
|
|
54
|
+
], UmbPropertyEditorUIStaticFilePickerElement.prototype, "_limitMax", void 0);
|
|
55
|
+
UmbPropertyEditorUIStaticFilePickerElement = __decorate([
|
|
56
|
+
customElement('umb-property-editor-ui-static-file-picker')
|
|
57
|
+
], UmbPropertyEditorUIStaticFilePickerElement);
|
|
58
|
+
export { UmbPropertyEditorUIStaticFilePickerElement };
|
|
59
|
+
export default UmbPropertyEditorUIStaticFilePickerElement;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ManifestRepository, ManifestTree, ManifestTreeStore } from '../../core/extension-registry/index.js';
|
|
2
|
+
export declare const UMB_STATIC_FILE_TREE_REPOSITORY_ALIAS = "Umb.Repository.StaticFile.Tree";
|
|
3
|
+
export declare const UMB_STATIC_FILE_TREE_STORE_ALIAS = "Umb.Store.StaticFile.Tree";
|
|
4
|
+
export declare const UMB_STATIC_FILE_TREE_ALIAS = "Umb.Tree.StaticFile";
|
|
5
|
+
export declare const manifests: (ManifestTree | ManifestTreeStore | ManifestRepository<import("../../../libs/extension-api/index.js").UmbApi>)[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { UmbStaticFileTreeRepository } from './static-file-tree.repository.js';
|
|
2
|
+
import { UmbStaticFileTreeStore } from './static-file-tree.store.js';
|
|
3
|
+
export const UMB_STATIC_FILE_TREE_REPOSITORY_ALIAS = 'Umb.Repository.StaticFile.Tree';
|
|
4
|
+
export const UMB_STATIC_FILE_TREE_STORE_ALIAS = 'Umb.Store.StaticFile.Tree';
|
|
5
|
+
export const UMB_STATIC_FILE_TREE_ALIAS = 'Umb.Tree.StaticFile';
|
|
6
|
+
const treeRepository = {
|
|
7
|
+
type: 'repository',
|
|
8
|
+
alias: UMB_STATIC_FILE_TREE_REPOSITORY_ALIAS,
|
|
9
|
+
name: 'Static File Tree Repository',
|
|
10
|
+
api: UmbStaticFileTreeRepository,
|
|
11
|
+
};
|
|
12
|
+
const treeStore = {
|
|
13
|
+
type: 'treeStore',
|
|
14
|
+
alias: UMB_STATIC_FILE_TREE_STORE_ALIAS,
|
|
15
|
+
name: 'Static File Tree Store',
|
|
16
|
+
api: UmbStaticFileTreeStore,
|
|
17
|
+
};
|
|
18
|
+
const tree = {
|
|
19
|
+
type: 'tree',
|
|
20
|
+
alias: UMB_STATIC_FILE_TREE_ALIAS,
|
|
21
|
+
name: 'Static File Tree',
|
|
22
|
+
meta: {
|
|
23
|
+
repositoryAlias: UMB_STATIC_FILE_TREE_REPOSITORY_ALIAS,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export const manifests = [treeRepository, treeStore, tree];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UmbStaticFileTreeItemModel, UmbStaticFileTreeRootModel } from './types.js';
|
|
2
|
+
import { UmbTreeRepositoryBase } from '../../core/tree/index.js';
|
|
3
|
+
import { type UmbControllerHost } from '../../../libs/controller-api/index.js';
|
|
4
|
+
import { UmbApi } from '../../../libs/extension-api/index.js';
|
|
5
|
+
export declare class UmbStaticFileTreeRepository extends UmbTreeRepositoryBase<UmbStaticFileTreeItemModel, UmbStaticFileTreeRootModel> implements UmbApi {
|
|
6
|
+
constructor(host: UmbControllerHost);
|
|
7
|
+
requestTreeRoot(): Promise<{
|
|
8
|
+
data: {
|
|
9
|
+
path: null;
|
|
10
|
+
entityType: string;
|
|
11
|
+
name: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
hasChildren: boolean;
|
|
14
|
+
isContainer: boolean;
|
|
15
|
+
isFolder: boolean;
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UMB_STATIC_FILE_ROOT_ENTITY_TYPE } from '../entity.js';
|
|
2
|
+
import { UmbStaticFileTreeServerDataSource } from './static-file-tree.server.data-source.js';
|
|
3
|
+
import { UMB_STATIC_FILE_TREE_STORE_CONTEXT } from './static-file-tree.store.js';
|
|
4
|
+
import { UmbTreeRepositoryBase } from '../../core/tree/index.js';
|
|
5
|
+
export class UmbStaticFileTreeRepository extends UmbTreeRepositoryBase {
|
|
6
|
+
constructor(host) {
|
|
7
|
+
super(host, UmbStaticFileTreeServerDataSource, UMB_STATIC_FILE_TREE_STORE_CONTEXT);
|
|
8
|
+
}
|
|
9
|
+
async requestTreeRoot() {
|
|
10
|
+
const data = {
|
|
11
|
+
path: null,
|
|
12
|
+
entityType: UMB_STATIC_FILE_ROOT_ENTITY_TYPE,
|
|
13
|
+
name: 'StaticFiles',
|
|
14
|
+
icon: 'icon-folder',
|
|
15
|
+
hasChildren: true,
|
|
16
|
+
isContainer: false,
|
|
17
|
+
isFolder: true,
|
|
18
|
+
};
|
|
19
|
+
return { data };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UmbStaticFileTreeItemModel } from './types.js';
|
|
2
|
+
import { UmbTreeServerDataSourceBase } from '../../core/tree/index.js';
|
|
3
|
+
import { type FileSystemTreeItemPresentationModel } from '../../../external/backend-api/index.js';
|
|
4
|
+
import type { UmbControllerHost } from '../../../libs/controller-api/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* A data source for the Static File tree that fetches data from the server
|
|
7
|
+
* @export
|
|
8
|
+
* @class UmbStaticFileTreeServerDataSource
|
|
9
|
+
* @implements {UmbTreeServerDataSourceBase}
|
|
10
|
+
*/
|
|
11
|
+
export declare class UmbStaticFileTreeServerDataSource extends UmbTreeServerDataSourceBase<FileSystemTreeItemPresentationModel, UmbStaticFileTreeItemModel> {
|
|
12
|
+
/**
|
|
13
|
+
* Creates an instance of UmbStylesheetTreeServerDataSource.
|
|
14
|
+
* @param {UmbControllerHost} host
|
|
15
|
+
* @memberof UmbStylesheetTreeServerDataSource
|
|
16
|
+
*/
|
|
17
|
+
constructor(host: UmbControllerHost);
|
|
18
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { UMB_STATIC_FILE_ENTITY_TYPE } from '../entity.js';
|
|
2
|
+
import { UmbTreeServerDataSourceBase } from '../../core/tree/index.js';
|
|
3
|
+
import { StaticFileResource } from '../../../external/backend-api/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* A data source for the Static File tree that fetches data from the server
|
|
6
|
+
* @export
|
|
7
|
+
* @class UmbStaticFileTreeServerDataSource
|
|
8
|
+
* @implements {UmbTreeServerDataSourceBase}
|
|
9
|
+
*/
|
|
10
|
+
export class UmbStaticFileTreeServerDataSource extends UmbTreeServerDataSourceBase {
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of UmbStylesheetTreeServerDataSource.
|
|
13
|
+
* @param {UmbControllerHost} host
|
|
14
|
+
* @memberof UmbStylesheetTreeServerDataSource
|
|
15
|
+
*/
|
|
16
|
+
constructor(host) {
|
|
17
|
+
super(host, {
|
|
18
|
+
getRootItems,
|
|
19
|
+
getChildrenOf,
|
|
20
|
+
mapper,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// eslint-disable-next-line local-rules/no-direct-api-import
|
|
25
|
+
const getRootItems = () => StaticFileResource.getTreeStaticFileRoot({});
|
|
26
|
+
const getChildrenOf = (parentUnique) => {
|
|
27
|
+
if (parentUnique === null) {
|
|
28
|
+
return getRootItems();
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
// eslint-disable-next-line local-rules/no-direct-api-import
|
|
32
|
+
return StaticFileResource.getTreeStaticFileChildren({
|
|
33
|
+
path: parentUnique,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const mapper = (item) => {
|
|
38
|
+
return {
|
|
39
|
+
path: item.path,
|
|
40
|
+
name: item.name,
|
|
41
|
+
entityType: UMB_STATIC_FILE_ENTITY_TYPE,
|
|
42
|
+
isFolder: item.isFolder,
|
|
43
|
+
hasChildren: item.hasChildren,
|
|
44
|
+
isContainer: false,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UmbContextToken } from '../../../libs/context-api/index.js';
|
|
2
|
+
import { UmbControllerHostElement } from '../../../libs/controller-api/index.js';
|
|
3
|
+
import { UmbEntityTreeStore } from '../../core/tree/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* @export
|
|
6
|
+
* @class UmbStaticFileTreeStore
|
|
7
|
+
* @extends {UmbStoreBase}
|
|
8
|
+
* @description - Tree Data Store for Static File Items
|
|
9
|
+
*/
|
|
10
|
+
export declare class UmbStaticFileTreeStore extends UmbEntityTreeStore {
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of UmbStaticFileTreeStore.
|
|
13
|
+
* @param {UmbControllerHostElement} host
|
|
14
|
+
* @memberof UmbStaticFileTreeStore
|
|
15
|
+
*/
|
|
16
|
+
constructor(host: UmbControllerHostElement);
|
|
17
|
+
}
|
|
18
|
+
export declare const UMB_STATIC_FILE_TREE_STORE_CONTEXT: UmbContextToken<UmbStaticFileTreeStore, UmbStaticFileTreeStore>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UmbContextToken } from '../../../libs/context-api/index.js';
|
|
2
|
+
import { UmbEntityTreeStore } from '../../core/tree/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* @export
|
|
5
|
+
* @class UmbStaticFileTreeStore
|
|
6
|
+
* @extends {UmbStoreBase}
|
|
7
|
+
* @description - Tree Data Store for Static File Items
|
|
8
|
+
*/
|
|
9
|
+
export class UmbStaticFileTreeStore extends UmbEntityTreeStore {
|
|
10
|
+
/**
|
|
11
|
+
* Creates an instance of UmbStaticFileTreeStore.
|
|
12
|
+
* @param {UmbControllerHostElement} host
|
|
13
|
+
* @memberof UmbStaticFileTreeStore
|
|
14
|
+
*/
|
|
15
|
+
constructor(host) {
|
|
16
|
+
super(host, UMB_STATIC_FILE_TREE_STORE_CONTEXT.toString());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export const UMB_STATIC_FILE_TREE_STORE_CONTEXT = new UmbContextToken('UmbStaticFileTreeStore');
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { UmbFileSystemTreeItemModel, UmbFileSystemTreeRootModel } from '../../core/tree/index.js';
|
|
2
|
+
export interface UmbStaticFileTreeItemModel extends UmbFileSystemTreeItemModel {
|
|
3
|
+
}
|
|
4
|
+
export interface UmbStaticFileTreeRootModel extends UmbFileSystemTreeRootModel {
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UMB_STATIC_FILE_ENTITY_TYPE, UMB_STATIC_FILE_ROOT_ENTITY_TYPE } from '../entity.js';
|
|
2
|
+
const treeItem = {
|
|
3
|
+
type: 'treeItem',
|
|
4
|
+
kind: 'fileSystem',
|
|
5
|
+
alias: 'Umb.TreeItem.StaticFile',
|
|
6
|
+
name: 'Static File Tree Item',
|
|
7
|
+
meta: {
|
|
8
|
+
entityTypes: [UMB_STATIC_FILE_ENTITY_TYPE, UMB_STATIC_FILE_ROOT_ENTITY_TYPE],
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
export const manifests = [treeItem];
|
package/dist-cms/packages/templating/stylesheets/tree/stylesheet-tree.server.data-source.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { UmbTreeServerDataSourceBase } from '../../../core/tree/index.js';
|
|
|
6
6
|
* A data source for the Stylesheet tree that fetches data from the server
|
|
7
7
|
* @export
|
|
8
8
|
* @class UmbStylesheetTreeServerDataSource
|
|
9
|
-
* @implements {
|
|
9
|
+
* @implements {UmbTreeServerDataSourceBase}
|
|
10
10
|
*/
|
|
11
11
|
export declare class UmbStylesheetTreeServerDataSource extends UmbTreeServerDataSourceBase<FileSystemTreeItemPresentationModel, UmbStylesheetTreeItemModel> {
|
|
12
12
|
/**
|
|
@@ -4,7 +4,7 @@ import { UmbTreeServerDataSourceBase } from '../../../core/tree/index.js';
|
|
|
4
4
|
* A data source for the Stylesheet tree that fetches data from the server
|
|
5
5
|
* @export
|
|
6
6
|
* @class UmbStylesheetTreeServerDataSource
|
|
7
|
-
* @implements {
|
|
7
|
+
* @implements {UmbTreeServerDataSourceBase}
|
|
8
8
|
*/
|
|
9
9
|
export class UmbStylesheetTreeServerDataSource extends UmbTreeServerDataSourceBase {
|
|
10
10
|
/**
|