@umbraco-cms/backoffice 14.0.0-3aaba617 → 14.0.0-41f35ef1
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 +94 -35
- package/dist-cms/mocks/data/template.data.d.ts +5 -23
- package/dist-cms/mocks/data/template.data.js +44 -21
- package/dist-cms/mocks/handlers/template.handlers.js +4 -0
- package/dist-cms/packages/core/components/button-with-dropdown/button-with-dropdown.element.d.ts +2 -0
- package/dist-cms/packages/core/components/button-with-dropdown/button-with-dropdown.element.js +4 -4
- package/dist-cms/packages/core/components/code-block/code-block.element.d.ts +6 -1
- package/dist-cms/packages/core/components/code-block/code-block.element.js +93 -19
- package/dist-cms/packages/core/components/index.d.ts +1 -0
- package/dist-cms/packages/core/components/index.js +1 -1
- package/dist-cms/packages/core/modal/token/dictionary-item-picker-modal.token.d.ts +0 -1
- package/dist-cms/packages/core/modal/token/dictionary-item-picker-modal.token.js +1 -2
- package/dist-cms/packages/core/tree/tree.context.js +8 -11
- package/dist-cms/packages/templating/components/insert-menu/templating-insert-menu.element.js +3 -31
- package/dist-cms/packages/templating/modals/insert-choose-type-sidebar.element.d.ts +2 -4
- package/dist-cms/packages/templating/modals/insert-choose-type-sidebar.element.js +5 -27
- package/dist-cms/packages/templating/modals/insert-section-modal/insert-section-input.element.js +1 -0
- package/dist-cms/packages/templating/modals/insert-section-modal/insert-section-modal.element.js +5 -4
- package/dist-cms/packages/templating/modals/manifests.d.ts +0 -1
- package/dist-cms/packages/templating/modals/manifests.js +0 -7
- package/dist-cms/packages/templating/templates/components/alias-input/alias-input.js +1 -1
- package/dist-cms/packages/templating/templates/index.d.ts +2 -0
- package/dist-cms/packages/templating/templates/index.js +2 -0
- package/dist-cms/packages/templating/templates/manifests.d.ts +1 -1
- package/dist-cms/packages/templating/templates/manifests.js +2 -0
- package/dist-cms/packages/templating/templates/modals/manifests.d.ts +3 -0
- package/dist-cms/packages/templating/templates/modals/manifests.js +10 -0
- package/dist-cms/packages/templating/templates/modals/modal-tokens.d.ts +3 -0
- package/dist-cms/packages/templating/templates/modals/modal-tokens.js +6 -0
- package/dist-cms/packages/templating/templates/modals/query-builder/query-builder-filter.element.d.ts +24 -0
- package/dist-cms/packages/templating/templates/modals/query-builder/query-builder-filter.element.js +157 -0
- package/dist-cms/packages/templating/templates/modals/query-builder/query-builder.element.d.ts +28 -0
- package/dist-cms/packages/templating/templates/modals/query-builder/query-builder.element.js +277 -0
- package/dist-cms/packages/templating/templates/repository/sources/template.query-builder.server.data.d.ts +33 -0
- package/dist-cms/packages/templating/templates/repository/sources/template.query-builder.server.data.js +37 -0
- package/dist-cms/packages/templating/templates/repository/template.repository.d.ts +11 -7
- package/dist-cms/packages/templating/templates/repository/template.repository.js +28 -14
- package/dist-cms/packages/templating/templates/workspace/template-workspace-editor.element.js +21 -3
- package/dist-cms/packages/templating/templates/workspace/template-workspace.context.js +2 -1
- package/dist-cms/packages/templating/templates/workspace/template-workspace.element.d.ts +1 -0
- package/dist-cms/packages/templating/templates/workspace/template-workspace.element.js +2 -1
- package/dist-cms/tsconfig.tsbuildinfo +1 -1
- package/dist-cms/vscode-html-custom-data.json +40 -7
- package/package.json +1 -1
- package/dist-cms/packages/templating/modals/insert-value-sidebar.element.d.ts +0 -19
- package/dist-cms/packages/templating/modals/insert-value-sidebar.element.js +0 -135
package/dist-cms/packages/templating/components/insert-menu/templating-insert-menu.element.js
CHANGED
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { UMB_MODAL_TEMPLATING_INSERT_CHOOSE_TYPE_SIDEBAR_ALIAS } from '../../modals/manifests.js';
|
|
8
8
|
import { UmbDictionaryRepository } from '../../../translation/dictionary/repository/dictionary.repository.js';
|
|
9
9
|
import { getInsertDictionarySnippet, getInsertPartialSnippet } from '../../utils.js';
|
|
10
|
-
import { CodeSnippetType
|
|
10
|
+
import { CodeSnippetType } from '../../modals/insert-choose-type-sidebar.element.js';
|
|
11
11
|
import { customElement, property, css, html } from '../../../../external/lit/index.js';
|
|
12
12
|
import { UUITextStyles } from '../../../../external/uui/index.js';
|
|
13
13
|
import { UMB_DICTIONARY_ITEM_PICKER_MODAL, UMB_MODAL_MANAGER_CONTEXT_TOKEN, UMB_PARTIAL_VIEW_PICKER_MODAL, UmbModalToken, } from '../../../core/modal/index.js';
|
|
@@ -30,10 +30,6 @@ export let UmbTemplatingInsertMenuElement = class UmbTemplatingInsertMenuElement
|
|
|
30
30
|
const { data } = await this.#dictionaryRepository.requestById(id);
|
|
31
31
|
this.value = getInsertDictionarySnippet(data?.name ?? '');
|
|
32
32
|
};
|
|
33
|
-
this.#getUmbracoFieldValueSnippet = async (value) => {
|
|
34
|
-
this.value = value;
|
|
35
|
-
this.#dispatchInsertEvent();
|
|
36
|
-
};
|
|
37
33
|
this.#getPartialViewSnippet = async (modalResult) => {
|
|
38
34
|
this.value = getInsertPartialSnippet(modalResult.selection?.[0] ?? '');
|
|
39
35
|
};
|
|
@@ -53,10 +49,6 @@ export let UmbTemplatingInsertMenuElement = class UmbTemplatingInsertMenuElement
|
|
|
53
49
|
async determineInsertValue(modalResult) {
|
|
54
50
|
const { type, value } = modalResult;
|
|
55
51
|
switch (type) {
|
|
56
|
-
case CodeSnippetType.umbracoField: {
|
|
57
|
-
this.#getUmbracoFieldValueSnippet(value);
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
52
|
case CodeSnippetType.partialView: {
|
|
61
53
|
this.#getPartialViewSnippet(value);
|
|
62
54
|
break;
|
|
@@ -72,16 +64,8 @@ export let UmbTemplatingInsertMenuElement = class UmbTemplatingInsertMenuElement
|
|
|
72
64
|
}
|
|
73
65
|
}
|
|
74
66
|
#getDictionaryItemSnippet;
|
|
75
|
-
#getUmbracoFieldValueSnippet;
|
|
76
67
|
#getPartialViewSnippet;
|
|
77
68
|
#openChooseTypeModal;
|
|
78
|
-
#openInsertValueSidebar() {
|
|
79
|
-
this.#openModal = this._modalContext?.open(UMB_MODAL_TEMPLATING_INSERT_FIELD_SIDEBAR_MODAL);
|
|
80
|
-
this.#openModal?.onSubmit().then((value) => {
|
|
81
|
-
this.value = value;
|
|
82
|
-
this.#dispatchInsertEvent();
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
69
|
#openInsertPartialViewSidebar() {
|
|
86
70
|
this.#openModal = this._modalContext?.open(UMB_PARTIAL_VIEW_PICKER_MODAL);
|
|
87
71
|
this.#openModal?.onSubmit().then((value) => {
|
|
@@ -106,7 +90,7 @@ export let UmbTemplatingInsertMenuElement = class UmbTemplatingInsertMenuElement
|
|
|
106
90
|
render() {
|
|
107
91
|
return html `
|
|
108
92
|
<uui-button-group>
|
|
109
|
-
<uui-button look="secondary" @click=${this.#openChooseTypeModal}>
|
|
93
|
+
<uui-button look="secondary" @click=${this.#openChooseTypeModal} label="Choose value to insert">
|
|
110
94
|
<uui-icon name="umb:add"></uui-icon>Insert</uui-button
|
|
111
95
|
>
|
|
112
96
|
<umb-button-with-dropdown
|
|
@@ -116,18 +100,6 @@ export let UmbTemplatingInsertMenuElement = class UmbTemplatingInsertMenuElement
|
|
|
116
100
|
id="insert-button"
|
|
117
101
|
label="open insert menu">
|
|
118
102
|
<ul id="insert-menu" slot="dropdown">
|
|
119
|
-
<!--
|
|
120
|
-
TODO: uncomment when insert value has endpoint and is properly implemented
|
|
121
|
-
<li>
|
|
122
|
-
<uui-menu-item
|
|
123
|
-
class="insert-menu-item"
|
|
124
|
-
target="_blank"
|
|
125
|
-
label="Value"
|
|
126
|
-
title="Value"
|
|
127
|
-
>
|
|
128
|
-
</uui-menu-item>
|
|
129
|
-
</li> -->
|
|
130
|
-
|
|
131
103
|
<li>
|
|
132
104
|
<uui-menu-item
|
|
133
105
|
class="insert-menu-item"
|
|
@@ -200,7 +172,7 @@ __decorate([
|
|
|
200
172
|
property()
|
|
201
173
|
], UmbTemplatingInsertMenuElement.prototype, "value", void 0);
|
|
202
174
|
__decorate([
|
|
203
|
-
property()
|
|
175
|
+
property({ type: Boolean })
|
|
204
176
|
], UmbTemplatingInsertMenuElement.prototype, "hidePartialView", void 0);
|
|
205
177
|
UmbTemplatingInsertMenuElement = __decorate([
|
|
206
178
|
customElement('umb-templating-insert-menu')
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { UmbModalBaseElement } from '../../../shared/modal/index.js';
|
|
2
|
-
import {
|
|
3
|
-
export declare const UMB_MODAL_TEMPLATING_INSERT_FIELD_SIDEBAR_MODAL: UmbModalToken<object, unknown>;
|
|
2
|
+
import { UmbDictionaryItemPickerModalResult } from '../../core/modal/index.js';
|
|
4
3
|
export interface ChooseInsertTypeModalData {
|
|
5
4
|
hidePartialViews?: boolean;
|
|
6
5
|
}
|
|
7
6
|
export declare enum CodeSnippetType {
|
|
8
7
|
partialView = "partialView",
|
|
9
|
-
umbracoField = "umbracoField",
|
|
10
8
|
dictionaryItem = "dictionaryItem",
|
|
11
9
|
macro = "macro"
|
|
12
10
|
}
|
|
@@ -20,7 +18,7 @@ export default class UmbChooseInsertTypeModalElement extends UmbModalBaseElement
|
|
|
20
18
|
private _modalContext?;
|
|
21
19
|
constructor();
|
|
22
20
|
render(): import("lit-html").TemplateResult<1>;
|
|
23
|
-
static styles: import("@lit/reactive-element/css-tag
|
|
21
|
+
static styles: import("@lit/reactive-element/css-tag").CSSResult[];
|
|
24
22
|
}
|
|
25
23
|
declare global {
|
|
26
24
|
interface HTMLElementTagNameMap {
|
|
@@ -4,19 +4,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { UMB_MODAL_TEMPLATING_INSERT_FIELD_SIDEBAR_ALIAS } from './manifests.js';
|
|
8
7
|
import { UUITextStyles } from '../../../external/uui/index.js';
|
|
9
8
|
import { css, html, customElement } from '../../../external/lit/index.js';
|
|
10
9
|
import { UmbModalBaseElement } from '../../../shared/modal/index.js';
|
|
11
|
-
import { UMB_MODAL_MANAGER_CONTEXT_TOKEN,
|
|
12
|
-
export const UMB_MODAL_TEMPLATING_INSERT_FIELD_SIDEBAR_MODAL = new UmbModalToken(UMB_MODAL_TEMPLATING_INSERT_FIELD_SIDEBAR_ALIAS, {
|
|
13
|
-
type: 'sidebar',
|
|
14
|
-
size: 'small',
|
|
15
|
-
});
|
|
10
|
+
import { UMB_MODAL_MANAGER_CONTEXT_TOKEN, UMB_PARTIAL_VIEW_PICKER_MODAL, UMB_DICTIONARY_ITEM_PICKER_MODAL, } from '../../core/modal/index.js';
|
|
16
11
|
export var CodeSnippetType;
|
|
17
12
|
(function (CodeSnippetType) {
|
|
18
13
|
CodeSnippetType["partialView"] = "partialView";
|
|
19
|
-
CodeSnippetType["umbracoField"] = "umbracoField";
|
|
20
14
|
CodeSnippetType["dictionaryItem"] = "dictionaryItem";
|
|
21
15
|
CodeSnippetType["macro"] = "macro";
|
|
22
16
|
})(CodeSnippetType || (CodeSnippetType = {}));
|
|
@@ -31,13 +25,6 @@ let UmbChooseInsertTypeModalElement = class UmbChooseInsertTypeModalElement exte
|
|
|
31
25
|
});
|
|
32
26
|
}
|
|
33
27
|
#openModal;
|
|
34
|
-
#openInsertValueSidebar() {
|
|
35
|
-
this.#openModal = this._modalContext?.open(UMB_MODAL_TEMPLATING_INSERT_FIELD_SIDEBAR_MODAL);
|
|
36
|
-
this.#openModal?.onSubmit().then((chosenValue) => {
|
|
37
|
-
if (chosenValue)
|
|
38
|
-
this.modalContext?.submit({ value: chosenValue, type: CodeSnippetType.umbracoField });
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
28
|
#openInsertPartialViewSidebar() {
|
|
42
29
|
this.#openModal = this._modalContext?.open(UMB_PARTIAL_VIEW_PICKER_MODAL);
|
|
43
30
|
this.#openModal?.onSubmit().then((partialViewPickerModalResult) => {
|
|
@@ -57,16 +44,6 @@ let UmbChooseInsertTypeModalElement = class UmbChooseInsertTypeModalElement exte
|
|
|
57
44
|
this.modalContext?.submit({ value: dictionaryItemPickerModalResult, type: CodeSnippetType.dictionaryItem });
|
|
58
45
|
});
|
|
59
46
|
}
|
|
60
|
-
//TODO: insert this when we have insert value implemented
|
|
61
|
-
#renderInsertValueButton() {
|
|
62
|
-
return html `<uui-button @click=${this.#openInsertValueSidebar} look="placeholder" label="Insert value"
|
|
63
|
-
><h3>Value</h3>
|
|
64
|
-
<p>
|
|
65
|
-
Displays the value of a named field from the current page, with options to modify the value or fallback to
|
|
66
|
-
alternative values.
|
|
67
|
-
</p></uui-button
|
|
68
|
-
>`;
|
|
69
|
-
}
|
|
70
47
|
//TODO: insert this when we have partial views
|
|
71
48
|
#renderInsertPartialViewButton() {
|
|
72
49
|
return html `${this.data?.hidePartialViews
|
|
@@ -94,7 +71,7 @@ let UmbChooseInsertTypeModalElement = class UmbChooseInsertTypeModalElement exte
|
|
|
94
71
|
</uui-box>
|
|
95
72
|
</div>
|
|
96
73
|
<div slot="actions">
|
|
97
|
-
<uui-button @click=${this._close} look="secondary">Close</uui-button>
|
|
74
|
+
<uui-button @click=${this._close} look="secondary" label="Close">Close</uui-button>
|
|
98
75
|
</div>
|
|
99
76
|
</umb-body-layout>
|
|
100
77
|
`;
|
|
@@ -110,8 +87,9 @@ let UmbChooseInsertTypeModalElement = class UmbChooseInsertTypeModalElement exte
|
|
|
110
87
|
|
|
111
88
|
#main {
|
|
112
89
|
box-sizing: border-box;
|
|
113
|
-
|
|
114
|
-
|
|
90
|
+
height: calc(
|
|
91
|
+
100dvh - var(--umb-header-layout-height) - var(--umb-footer-layout-height) - 2 * var(--uui-size-layout-1)
|
|
92
|
+
);
|
|
115
93
|
}
|
|
116
94
|
|
|
117
95
|
#main uui-button:not(:last-of-type) {
|
package/dist-cms/packages/templating/modals/insert-section-modal/insert-section-input.element.js
CHANGED
|
@@ -52,6 +52,7 @@ export let UmbInsertSectionCheckboxElement = class UmbInsertSectionCheckboxEleme
|
|
|
52
52
|
<uui-input
|
|
53
53
|
required
|
|
54
54
|
placeholder="Enter section name"
|
|
55
|
+
label="Section name"
|
|
55
56
|
id="section-name-input"></uui-input> </uui-form-layout-item
|
|
56
57
|
>${this.showMandatory
|
|
57
58
|
? html `<p slot="if-checked">
|
package/dist-cms/packages/templating/modals/insert-section-modal/insert-section-modal.element.js
CHANGED
|
@@ -91,8 +91,8 @@ let UmbTemplatingInsertSectionModalElement = class UmbTemplatingInsertSectionMod
|
|
|
91
91
|
</uui-box>
|
|
92
92
|
</div>
|
|
93
93
|
<div slot="actions">
|
|
94
|
-
<uui-button @click=${this.#close} look="secondary">Close</uui-button>
|
|
95
|
-
<uui-button @click=${this.#submit} look="primary" color="positive">Submit</uui-button>
|
|
94
|
+
<uui-button @click=${this.#close} look="secondary" label="Close">Close</uui-button>
|
|
95
|
+
<uui-button @click=${this.#submit} look="primary" color="positive" label="Submit">Submit</uui-button>
|
|
96
96
|
</div>
|
|
97
97
|
</umb-body-layout>
|
|
98
98
|
`;
|
|
@@ -108,8 +108,9 @@ let UmbTemplatingInsertSectionModalElement = class UmbTemplatingInsertSectionMod
|
|
|
108
108
|
|
|
109
109
|
#main {
|
|
110
110
|
box-sizing: border-box;
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
height: calc(
|
|
112
|
+
100dvh - var(--umb-header-layout-height) - var(--umb-footer-layout-height) - 2 * var(--uui-size-layout-1)
|
|
113
|
+
);
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
#main umb-insert-section-checkbox:not(:last-of-type) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ManifestModal } from '../../core/extension-registry/index.js';
|
|
2
2
|
export declare const UMB_MODAL_TEMPLATING_INSERT_CHOOSE_TYPE_SIDEBAR_ALIAS = "Umb.Modal.Templating.Insert.ChooseType.Sidebar";
|
|
3
|
-
export declare const UMB_MODAL_TEMPLATING_INSERT_FIELD_SIDEBAR_ALIAS = "Umb.Modal.Templating.Insert.Value.Sidebar";
|
|
4
3
|
export declare const UMB_MODAL_TEMPLATING_INSERT_SECTION_SIDEBAR_ALIAS = "Umb.Modal.Templating.Insert.Section.Sidebar";
|
|
5
4
|
export declare const manifests: ManifestModal[];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { UMB_PARTIAL_VIEW_PICKER_MODAL_ALIAS } from '../../core/modal/index.js';
|
|
2
2
|
export const UMB_MODAL_TEMPLATING_INSERT_CHOOSE_TYPE_SIDEBAR_ALIAS = 'Umb.Modal.Templating.Insert.ChooseType.Sidebar';
|
|
3
|
-
export const UMB_MODAL_TEMPLATING_INSERT_FIELD_SIDEBAR_ALIAS = 'Umb.Modal.Templating.Insert.Value.Sidebar';
|
|
4
3
|
export const UMB_MODAL_TEMPLATING_INSERT_SECTION_SIDEBAR_ALIAS = 'Umb.Modal.Templating.Insert.Section.Sidebar';
|
|
5
4
|
const modals = [
|
|
6
5
|
{
|
|
@@ -9,12 +8,6 @@ const modals = [
|
|
|
9
8
|
name: 'Choose insert type sidebar',
|
|
10
9
|
loader: () => import('./insert-choose-type-sidebar.element.js'),
|
|
11
10
|
},
|
|
12
|
-
{
|
|
13
|
-
type: 'modal',
|
|
14
|
-
alias: UMB_MODAL_TEMPLATING_INSERT_FIELD_SIDEBAR_ALIAS,
|
|
15
|
-
name: 'Insert value type sidebar',
|
|
16
|
-
loader: () => import('./insert-value-sidebar.element.js'),
|
|
17
|
-
},
|
|
18
11
|
{
|
|
19
12
|
type: 'modal',
|
|
20
13
|
alias: UMB_PARTIAL_VIEW_PICKER_MODAL_ALIAS,
|
|
@@ -16,7 +16,7 @@ export let UmbTemplateAliasInputElement = class UmbTemplateAliasInputElement ext
|
|
|
16
16
|
}
|
|
17
17
|
render() {
|
|
18
18
|
return html `
|
|
19
|
-
<uui-button compact @click=${this.#handleClick}>
|
|
19
|
+
<uui-button compact @click=${this.#handleClick} label="unlock alias input">
|
|
20
20
|
<uui-symbol-lock .open=${this.isOpen} ></uui-symbol-lock>
|
|
21
21
|
</uui-button>
|
|
22
22
|
<input placeholder="Enter alias..." .value=${this.value} ?disabled=${!this.isOpen} @input=${this.#setValue}></input>
|
|
@@ -1 +1 @@
|
|
|
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").ManifestItemStore | import("../../core/index.js").ManifestTree | import("../../core/index.js").ManifestTreeItem | import("../../core/index.js").ManifestWorkspace | import("../../core/index.js").ManifestWorkspaceAction | import("../../core/index.js").ManifestWorkspaceEditorView)[];
|
|
1
|
+
export declare const manifests: (import("../../core/index.js").ManifestEntityAction | import("../../core/index.js").ManifestMenuItemTreeKind | import("../../core/index.js").ManifestModal | import("../../core/index.js").ManifestRepository | import("../../core/index.js").ManifestStore | import("../../core/index.js").ManifestTreeStore | import("../../core/index.js").ManifestItemStore | import("../../core/index.js").ManifestTree | import("../../core/index.js").ManifestTreeItem | import("../../core/index.js").ManifestWorkspace | import("../../core/index.js").ManifestWorkspaceAction | import("../../core/index.js").ManifestWorkspaceEditorView)[];
|
|
@@ -3,7 +3,9 @@ import { manifests as menuItemManifests } from './menu-item/manifests.js';
|
|
|
3
3
|
import { manifests as treeManifests } from './tree/manifests.js';
|
|
4
4
|
import { manifests as entityActionsManifests } from './entity-actions/manifests.js';
|
|
5
5
|
import { manifests as workspaceManifests } from './workspace/manifests.js';
|
|
6
|
+
import { manifests as modalManifests } from './modals/manifests.js';
|
|
6
7
|
export const manifests = [
|
|
8
|
+
...modalManifests,
|
|
7
9
|
...repositoryManifests,
|
|
8
10
|
...menuItemManifests,
|
|
9
11
|
...treeManifests,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const UMB_MODAL_TEMPLATING_QUERY_BUILDER_SIDEBAR_ALIAS = 'Umb.Modal.Templating.Query.Builder.Sidebar';
|
|
2
|
+
const modals = [
|
|
3
|
+
{
|
|
4
|
+
type: 'modal',
|
|
5
|
+
alias: UMB_MODAL_TEMPLATING_QUERY_BUILDER_SIDEBAR_ALIAS,
|
|
6
|
+
name: 'Template query builder',
|
|
7
|
+
loader: () => import('./query-builder/query-builder.element.js'),
|
|
8
|
+
},
|
|
9
|
+
];
|
|
10
|
+
export const manifests = [...modals];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TemplateQueryBuilderModalData, TemplateQueryBuilderModalResult } from './query-builder/query-builder.element.js';
|
|
2
|
+
import { UmbModalToken } from '../../../core/modal/index.js';
|
|
3
|
+
export declare const UMB_TEMPLATE_QUERY_BUILDER_MODAL: UmbModalToken<TemplateQueryBuilderModalData, TemplateQueryBuilderModalResult>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UMB_MODAL_TEMPLATING_QUERY_BUILDER_SIDEBAR_ALIAS } from './manifests.js';
|
|
2
|
+
import { UmbModalToken } from '../../../core/modal/index.js';
|
|
3
|
+
export const UMB_TEMPLATE_QUERY_BUILDER_MODAL = new UmbModalToken(UMB_MODAL_TEMPLATING_QUERY_BUILDER_SIDEBAR_ALIAS, {
|
|
4
|
+
type: 'sidebar',
|
|
5
|
+
size: 'large',
|
|
6
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PropertyValueMap } from 'lit';
|
|
2
|
+
import { UmbLitElement } from '../../../../../shared/lit-element/index.js';
|
|
3
|
+
import { TemplateQueryExecuteFilterPresentationModel, TemplateQueryPropertyTypeModel, TemplateQuerySettingsResponseModel } from '../../../../../external/backend-api/index.js';
|
|
4
|
+
export declare class UmbQueryBuilderFilterElement extends UmbLitElement {
|
|
5
|
+
#private;
|
|
6
|
+
private _propertyAliasDropdown?;
|
|
7
|
+
private _operatorDropdown?;
|
|
8
|
+
filter: TemplateQueryExecuteFilterPresentationModel;
|
|
9
|
+
unremovable: boolean;
|
|
10
|
+
settings?: TemplateQuerySettingsResponseModel;
|
|
11
|
+
currentPropertyType: TemplateQueryPropertyTypeModel | null;
|
|
12
|
+
get isFilterValid(): boolean;
|
|
13
|
+
protected willUpdate(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
14
|
+
private _renderOperatorsDropdown;
|
|
15
|
+
private _renderConstraintValueInput;
|
|
16
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
17
|
+
static styles: import("lit").CSSResult[];
|
|
18
|
+
}
|
|
19
|
+
export default UmbQueryBuilderFilterElement;
|
|
20
|
+
declare global {
|
|
21
|
+
interface HTMLElementTagNameMap {
|
|
22
|
+
'umb-query-builder-filter': UmbQueryBuilderFilterElement;
|
|
23
|
+
}
|
|
24
|
+
}
|
package/dist-cms/packages/templating/templates/modals/query-builder/query-builder-filter.element.js
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
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 '@umbraco-ui/uui-css';
|
|
8
|
+
import { css, html } from 'lit';
|
|
9
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
10
|
+
import { UmbLitElement } from '../../../../../shared/lit-element/index.js';
|
|
11
|
+
import { TemplateQueryPropertyTypeModel, } from '../../../../../external/backend-api/index.js';
|
|
12
|
+
export let UmbQueryBuilderFilterElement = class UmbQueryBuilderFilterElement extends UmbLitElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.filter = {};
|
|
16
|
+
this.unremovable = false;
|
|
17
|
+
this.currentPropertyType = null;
|
|
18
|
+
this.#setPropertyAlias = (e) => {
|
|
19
|
+
const target = e.target;
|
|
20
|
+
const oldCurrentPropertyType = this.currentPropertyType;
|
|
21
|
+
this.filter = { ...this.filter, propertyAlias: target.value };
|
|
22
|
+
this.currentPropertyType =
|
|
23
|
+
this.settings?.properties?.find((p) => p.alias === this.filter.propertyAlias)?.type ?? null;
|
|
24
|
+
if (oldCurrentPropertyType !== this.currentPropertyType)
|
|
25
|
+
this.#resetOperator();
|
|
26
|
+
this._propertyAliasDropdown?.closePopover();
|
|
27
|
+
};
|
|
28
|
+
this.#setConstrainValue = (e) => {
|
|
29
|
+
const target = e.target;
|
|
30
|
+
this.filter = { ...this.filter, constraintValue: target.value };
|
|
31
|
+
};
|
|
32
|
+
this.#setOperator = (e) => {
|
|
33
|
+
const target = e.target;
|
|
34
|
+
this.filter = { ...this.filter, operator: target.value };
|
|
35
|
+
this._operatorDropdown?.closePopover();
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
#setPropertyAlias;
|
|
39
|
+
#setConstrainValue;
|
|
40
|
+
#setOperator;
|
|
41
|
+
#resetOperator() {
|
|
42
|
+
this.filter = { ...this.filter, operator: undefined };
|
|
43
|
+
}
|
|
44
|
+
#resetFilter() {
|
|
45
|
+
this.filter = {};
|
|
46
|
+
}
|
|
47
|
+
#removeOrReset() {
|
|
48
|
+
if (this.unremovable)
|
|
49
|
+
this.#resetFilter();
|
|
50
|
+
else
|
|
51
|
+
this.dispatchEvent(new Event('remove-filter'));
|
|
52
|
+
}
|
|
53
|
+
#addFilter() {
|
|
54
|
+
this.dispatchEvent(new Event('add-filter'));
|
|
55
|
+
}
|
|
56
|
+
get isFilterValid() {
|
|
57
|
+
return Object.keys(this.filter).length === 3 && Object.values(this.filter).every((v) => !!v);
|
|
58
|
+
}
|
|
59
|
+
willUpdate(_changedProperties) {
|
|
60
|
+
if (_changedProperties.has('filter')) {
|
|
61
|
+
if (this.isFilterValid) {
|
|
62
|
+
this.dispatchEvent(new Event('update-query'));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
_renderOperatorsDropdown() {
|
|
67
|
+
return html `<umb-button-with-dropdown look="outline" id="operator-dropdown" label="choose operator">
|
|
68
|
+
${this.filter?.operator ?? ''}
|
|
69
|
+
<uui-combobox-list slot="dropdown" @change=${this.#setOperator} class="options-list">
|
|
70
|
+
${this.settings?.operators
|
|
71
|
+
?.filter((operator) => this.currentPropertyType ? operator.applicableTypes?.includes(this.currentPropertyType) : true)
|
|
72
|
+
.map((operator) => html `<uui-combobox-list-option .value=${operator.operator ?? ''}
|
|
73
|
+
>${operator.operator}</uui-combobox-list-option
|
|
74
|
+
>`)}</uui-combobox-list
|
|
75
|
+
>
|
|
76
|
+
</umb-button-with-dropdown>`;
|
|
77
|
+
}
|
|
78
|
+
_renderConstraintValueInput() {
|
|
79
|
+
switch (this.currentPropertyType) {
|
|
80
|
+
case TemplateQueryPropertyTypeModel.INTEGER:
|
|
81
|
+
return html `<uui-input type="number" @change=${this.#setConstrainValue} label="constrain value"></uui-input>`;
|
|
82
|
+
case TemplateQueryPropertyTypeModel.STRING:
|
|
83
|
+
return html `<uui-input type="text" @change=${this.#setConstrainValue} label="constrain value"></uui-input>`;
|
|
84
|
+
case TemplateQueryPropertyTypeModel.DATE_TIME:
|
|
85
|
+
return html `<uui-input type="date" @change=${this.#setConstrainValue} label="constrain value"></uui-input>`;
|
|
86
|
+
default:
|
|
87
|
+
return html `<uui-input type="text" @change=${this.#setConstrainValue} label="constrain value"></uui-input>`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
render() {
|
|
91
|
+
return html `
|
|
92
|
+
<span>${this.unremovable ? 'where' : 'and'}</span>
|
|
93
|
+
<umb-button-with-dropdown look="outline" id="property-alias-dropdown" label="Property alias"
|
|
94
|
+
>${this.filter?.propertyAlias ?? ''}
|
|
95
|
+
<uui-combobox-list slot="dropdown" @change=${this.#setPropertyAlias} class="options-list">
|
|
96
|
+
${this.settings?.properties?.map((property) => html `<uui-combobox-list-option tabindex="0" .value=${property.alias ?? ''}
|
|
97
|
+
>${property.alias}</uui-combobox-list-option
|
|
98
|
+
>`)}
|
|
99
|
+
</uui-combobox-list></umb-button-with-dropdown
|
|
100
|
+
>
|
|
101
|
+
${this.filter?.propertyAlias ? this._renderOperatorsDropdown() : ''}
|
|
102
|
+
${this.filter?.operator ? this._renderConstraintValueInput() : ''}
|
|
103
|
+
<uui-button-group>
|
|
104
|
+
<uui-button title="Add filter" label="Add filter" compact @click=${this.#addFilter}
|
|
105
|
+
><uui-icon name="add"></uui-icon
|
|
106
|
+
></uui-button>
|
|
107
|
+
<uui-button title="Remove filter" label="Remove filter" compact @click=${this.#removeOrReset}
|
|
108
|
+
><uui-icon name="delete"></uui-icon
|
|
109
|
+
></uui-button>
|
|
110
|
+
</uui-button-group>
|
|
111
|
+
`;
|
|
112
|
+
}
|
|
113
|
+
static { this.styles = [
|
|
114
|
+
UUITextStyles,
|
|
115
|
+
css `
|
|
116
|
+
:host {
|
|
117
|
+
display: flex;
|
|
118
|
+
gap: 10px;
|
|
119
|
+
border-bottom: 1px solid #f3f3f5;
|
|
120
|
+
align-items: center;
|
|
121
|
+
padding: 20px 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.options-list {
|
|
125
|
+
min-width: 25ch;
|
|
126
|
+
background-color: var(--uui-color-surface);
|
|
127
|
+
box-shadow: var(--uui-shadow-depth-3);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
uui-combobox-list-option {
|
|
131
|
+
padding: 8px 20px;
|
|
132
|
+
}
|
|
133
|
+
`,
|
|
134
|
+
]; }
|
|
135
|
+
};
|
|
136
|
+
__decorate([
|
|
137
|
+
query('#property-alias-dropdown')
|
|
138
|
+
], UmbQueryBuilderFilterElement.prototype, "_propertyAliasDropdown", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
query('#operator-dropdown')
|
|
141
|
+
], UmbQueryBuilderFilterElement.prototype, "_operatorDropdown", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
property({ type: Object, attribute: false })
|
|
144
|
+
], UmbQueryBuilderFilterElement.prototype, "filter", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
property({ type: Boolean })
|
|
147
|
+
], UmbQueryBuilderFilterElement.prototype, "unremovable", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
property({ type: Object, attribute: false })
|
|
150
|
+
], UmbQueryBuilderFilterElement.prototype, "settings", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
state()
|
|
153
|
+
], UmbQueryBuilderFilterElement.prototype, "currentPropertyType", void 0);
|
|
154
|
+
UmbQueryBuilderFilterElement = __decorate([
|
|
155
|
+
customElement('umb-query-builder-filter')
|
|
156
|
+
], UmbQueryBuilderFilterElement);
|
|
157
|
+
export default UmbQueryBuilderFilterElement;
|
package/dist-cms/packages/templating/templates/modals/query-builder/query-builder.element.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { UmbModalBaseElement } from '../../../../../shared/modal/index.js';
|
|
2
|
+
import './query-builder-filter.element.js';
|
|
3
|
+
export interface TemplateQueryBuilderModalData {
|
|
4
|
+
hidePartialViews?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface TemplateQueryBuilderModalResult {
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
export default class UmbChooseInsertTypeModalElement extends UmbModalBaseElement<TemplateQueryBuilderModalData, TemplateQueryBuilderModalResult> {
|
|
10
|
+
#private;
|
|
11
|
+
private _contentTypeDropdown?;
|
|
12
|
+
private _sortDropdown?;
|
|
13
|
+
private _filterContainer?;
|
|
14
|
+
private _filterElements;
|
|
15
|
+
private _templateQuery?;
|
|
16
|
+
private _queryRequest;
|
|
17
|
+
private _queryBuilderSettings?;
|
|
18
|
+
private _selectedRootContentName;
|
|
19
|
+
private _defaultSortDirection;
|
|
20
|
+
constructor();
|
|
21
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
22
|
+
static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
'umb-templating-query-builder-modal': UmbChooseInsertTypeModalElement;
|
|
27
|
+
}
|
|
28
|
+
}
|