@umbraco-cms/backoffice 14.0.0--preview005-b4989b95 → 14.0.0--preview005-d06b80f2
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/app/app.element.js +1 -0
- package/dist-cms/custom-elements.json +1 -1
- package/dist-cms/packages/block/block/modals/block-catalogue/block-catalogue-modal.element.d.ts +1 -2
- package/dist-cms/packages/block/block/modals/block-catalogue/block-catalogue-modal.element.js +22 -26
- package/dist-cms/packages/block/block/modals/block-catalogue/block-catalogue-modal.token.d.ts +2 -5
- package/dist-cms/packages/block/block-grid/property-editors/block-grid-editor/property-editor-ui-block-grid.element.d.ts +11 -7
- package/dist-cms/packages/block/block-grid/property-editors/block-grid-editor/property-editor-ui-block-grid.element.js +119 -71
- package/dist-cms/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.d.ts +4 -3
- package/dist-cms/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.js +39 -7
- package/dist-cms/shared/auth/auth.context.d.ts +35 -1
- package/dist-cms/shared/auth/auth.context.js +50 -3
- package/dist-cms/shared/auth/index.d.ts +1 -0
- package/dist-cms/shared/auth/index.js +1 -0
- package/dist-cms/shared/auth/models/openApiConfiguration.d.ts +28 -0
- package/dist-cms/shared/auth/models/openApiConfiguration.js +1 -0
- package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
- package/dist-cms/vscode-html-custom-data.json +3 -3
- package/package.json +1 -1
|
@@ -138,6 +138,7 @@ async function _UmbAppElement_setAuthStatus() {
|
|
|
138
138
|
// Instruct all requests to use the auth flow to get and use the access_token for all subsequent requests
|
|
139
139
|
OpenAPI.TOKEN = () => __classPrivateFieldGet(this, _UmbAppElement_authContext, "f").getLatestToken();
|
|
140
140
|
OpenAPI.WITH_CREDENTIALS = true;
|
|
141
|
+
OpenAPI.CREDENTIALS = 'include';
|
|
141
142
|
};
|
|
142
143
|
_UmbAppElement_redirect = function _UmbAppElement_redirect() {
|
|
143
144
|
// If there is a ?code parameter in the url, then we are in the middle of the oauth flow
|
package/dist-cms/packages/block/block/modals/block-catalogue/block-catalogue-modal.element.d.ts
CHANGED
|
@@ -2,8 +2,7 @@ import type { UmbBlockCatalogueModalData, UmbBlockCatalogueModalValue } from '..
|
|
|
2
2
|
import { UmbModalBaseElement } from '../../../../core/modal/index.js';
|
|
3
3
|
export declare class UmbBlockCatalogueModalElement extends UmbModalBaseElement<UmbBlockCatalogueModalData, UmbBlockCatalogueModalValue> {
|
|
4
4
|
#private;
|
|
5
|
-
private
|
|
6
|
-
private _blockGroups;
|
|
5
|
+
private _groupedBlocks;
|
|
7
6
|
_openClipboard?: boolean;
|
|
8
7
|
_workspacePath?: string;
|
|
9
8
|
constructor();
|
package/dist-cms/packages/block/block/modals/block-catalogue/block-catalogue-modal.element.js
CHANGED
|
@@ -12,14 +12,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
var _UmbBlockCatalogueModalElement_instances, _UmbBlockCatalogueModalElement_renderClipboard, _UmbBlockCatalogueModalElement_renderCreateEmpty, _UmbBlockCatalogueModalElement_renderViews;
|
|
13
13
|
import { UMB_BLOCK_WORKSPACE_MODAL } from '../../workspace/index.js';
|
|
14
14
|
import { css, html, customElement, state, repeat, ifDefined, nothing } from '../../../../../external/lit/index.js';
|
|
15
|
-
import { groupBy } from '../../../../../external/lodash/index.js';
|
|
16
15
|
import { UMB_MODAL_CONTEXT, UmbModalBaseElement, UmbModalRouteRegistrationController, } from '../../../../core/modal/index.js';
|
|
17
16
|
let UmbBlockCatalogueModalElement = class UmbBlockCatalogueModalElement extends UmbModalBaseElement {
|
|
18
17
|
constructor() {
|
|
19
18
|
super();
|
|
20
19
|
_UmbBlockCatalogueModalElement_instances.add(this);
|
|
21
|
-
this.
|
|
22
|
-
this._blockGroups = [];
|
|
20
|
+
this._groupedBlocks = [];
|
|
23
21
|
this.consumeContext(UMB_MODAL_CONTEXT, (modalContext) => {
|
|
24
22
|
new UmbModalRouteRegistrationController(this, UMB_BLOCK_WORKSPACE_MODAL)
|
|
25
23
|
//.addAdditionalPath('block') // No need for additional path specification in this context as this is for sure the only workspace we want to open here.
|
|
@@ -42,15 +40,15 @@ let UmbBlockCatalogueModalElement = class UmbBlockCatalogueModalElement extends
|
|
|
42
40
|
if (!this.data)
|
|
43
41
|
return;
|
|
44
42
|
this._openClipboard = this.data.openClipboard ?? false;
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
const blocks = this.data.blocks ?? [];
|
|
44
|
+
const blockGroups = this.data.blockGroups ?? [];
|
|
45
|
+
const noGroupBlocks = blocks.filter((block) => !blockGroups.find((group) => group.key === block.groupKey));
|
|
46
|
+
const grouped = blockGroups.map((group) => ({
|
|
47
|
+
name: group.name ?? '',
|
|
48
|
+
blocks: blocks.filter((block) => block.groupKey === group.key),
|
|
49
|
+
}));
|
|
50
|
+
this._groupedBlocks = [{ blocks: noGroupBlocks }, ...grouped];
|
|
47
51
|
}
|
|
48
|
-
/*
|
|
49
|
-
#onClickBlock(contentElementTypeKey: string) {
|
|
50
|
-
this.modalContext?.updateValue({ key: contentElementTypeKey });
|
|
51
|
-
this.modalContext?.submit();
|
|
52
|
-
}
|
|
53
|
-
*/
|
|
54
52
|
render() {
|
|
55
53
|
return html `
|
|
56
54
|
<umb-body-layout headline="${this.localize.term('blockEditor_addBlock')}">
|
|
@@ -72,14 +70,9 @@ _UmbBlockCatalogueModalElement_renderClipboard = function _UmbBlockCatalogueModa
|
|
|
72
70
|
return html `Clipboard`;
|
|
73
71
|
};
|
|
74
72
|
_UmbBlockCatalogueModalElement_renderCreateEmpty = function _UmbBlockCatalogueModalElement_renderCreateEmpty() {
|
|
75
|
-
const blockArrays = groupBy(this._blocks, 'groupKey');
|
|
76
|
-
const mappedGroupsAndBlocks = Object.entries(blockArrays).map(([key, value]) => {
|
|
77
|
-
const group = this._blockGroups.find((group) => group.key === key);
|
|
78
|
-
return { name: group?.name, blocks: value };
|
|
79
|
-
});
|
|
80
73
|
return html `
|
|
81
|
-
${
|
|
82
|
-
${group.name ? html `<
|
|
74
|
+
${this._groupedBlocks.map((group) => html `
|
|
75
|
+
${group.name ? html `<h4>${group.name}</h4>` : nothing}
|
|
83
76
|
<div class="blockGroup">
|
|
84
77
|
${repeat(group.blocks, (block) => block.contentElementTypeKey, (block) => html `
|
|
85
78
|
<uui-card-block-type
|
|
@@ -97,12 +90,18 @@ _UmbBlockCatalogueModalElement_renderCreateEmpty = function _UmbBlockCatalogueMo
|
|
|
97
90
|
_UmbBlockCatalogueModalElement_renderViews = function _UmbBlockCatalogueModalElement_renderViews() {
|
|
98
91
|
return html `
|
|
99
92
|
<uui-tab-group slot="navigation">
|
|
100
|
-
<uui-tab
|
|
101
|
-
|
|
93
|
+
<uui-tab
|
|
94
|
+
label=${this.localize.term('blockEditor_tabCreateEmpty')}
|
|
95
|
+
?active=${!this._openClipboard}
|
|
96
|
+
@click=${() => (this._openClipboard = false)}>
|
|
97
|
+
<umb-localize key=${this.localize.term('blockEditor_tabCreateEmpty')}>Create Empty</umb-localize>
|
|
102
98
|
<uui-icon slot="icon" name="icon-add"></uui-icon>
|
|
103
99
|
</uui-tab>
|
|
104
|
-
<uui-tab
|
|
105
|
-
|
|
100
|
+
<uui-tab
|
|
101
|
+
label=${this.localize.term('blockEditor_tabClipboard')}
|
|
102
|
+
?active=${this._openClipboard}
|
|
103
|
+
@click=${() => (this._openClipboard = true)}>
|
|
104
|
+
<umb-localize key=${this.localize.term('blockEditor_tabClipboard')}>Clipboard</umb-localize>
|
|
106
105
|
<uui-icon slot="icon" name="icon-paste-in"></uui-icon>
|
|
107
106
|
</uui-tab>
|
|
108
107
|
</uui-tab-group>
|
|
@@ -125,10 +124,7 @@ UmbBlockCatalogueModalElement.styles = [
|
|
|
125
124
|
];
|
|
126
125
|
__decorate([
|
|
127
126
|
state()
|
|
128
|
-
], UmbBlockCatalogueModalElement.prototype, "
|
|
129
|
-
__decorate([
|
|
130
|
-
state()
|
|
131
|
-
], UmbBlockCatalogueModalElement.prototype, "_blockGroups", void 0);
|
|
127
|
+
], UmbBlockCatalogueModalElement.prototype, "_groupedBlocks", void 0);
|
|
132
128
|
__decorate([
|
|
133
129
|
state()
|
|
134
130
|
], UmbBlockCatalogueModalElement.prototype, "_openClipboard", void 0);
|
package/dist-cms/packages/block/block/modals/block-catalogue/block-catalogue-modal.token.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import type { UmbBlockTypeBaseModel, UmbBlockWorkspaceData } from '../../../index.js';
|
|
1
|
+
import type { UmbBlockTypeBaseModel, UmbBlockTypeGroup, UmbBlockWorkspaceData } from '../../../index.js';
|
|
2
2
|
import { UmbModalToken } from '../../../../core/modal/index.js';
|
|
3
3
|
export interface UmbBlockCatalogueModalData {
|
|
4
4
|
blocks: Array<UmbBlockTypeBaseModel>;
|
|
5
|
-
blockGroups?: Array<
|
|
6
|
-
name: string;
|
|
7
|
-
key: string;
|
|
8
|
-
}>;
|
|
5
|
+
blockGroups?: Array<UmbBlockTypeGroup>;
|
|
9
6
|
openClipboard?: boolean;
|
|
10
7
|
blockOriginData: UmbBlockWorkspaceData['originData'];
|
|
11
8
|
}
|
|
@@ -5,15 +5,19 @@ import type { UmbPropertyEditorConfigCollection } from '../../../../core/propert
|
|
|
5
5
|
* @element umb-property-editor-ui-block-grid
|
|
6
6
|
*/
|
|
7
7
|
export declare class UmbPropertyEditorUIBlockGridElement extends UmbLitElement implements UmbPropertyEditorUiElement {
|
|
8
|
+
#private;
|
|
8
9
|
value: string;
|
|
9
|
-
|
|
10
|
-
private
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
private
|
|
10
|
+
private _limitMin?;
|
|
11
|
+
private _limitMax?;
|
|
12
|
+
private _blocks?;
|
|
13
|
+
private _blockGroups?;
|
|
14
|
+
private _layouts;
|
|
15
|
+
private _catalogueRouteBuilder?;
|
|
16
|
+
private _directRoute?;
|
|
17
|
+
private _createButtonLabel;
|
|
18
|
+
set config(config: UmbPropertyEditorConfigCollection | undefined);
|
|
14
19
|
constructor();
|
|
15
|
-
|
|
16
|
-
render(): import("lit-html").TemplateResult<1> | "loading...";
|
|
20
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
17
21
|
static styles: import("../../../../../external/lit/index.js").CSSResult[];
|
|
18
22
|
}
|
|
19
23
|
export default UmbPropertyEditorUIBlockGridElement;
|
|
@@ -4,104 +4,152 @@ 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
|
-
|
|
8
|
-
|
|
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 _UmbPropertyEditorUIBlockGridElement_catalogueModal;
|
|
19
|
+
import { html, customElement, property, state, css } from '../../../../../external/lit/index.js';
|
|
9
20
|
import { UmbTextStyles } from '../../../../../shared/style/index.js';
|
|
10
21
|
import { UmbLitElement } from '../../../../../shared/lit-element/index.js';
|
|
22
|
+
import { UMB_BLOCK_CATALOGUE_MODAL, } from '../../../index.js';
|
|
23
|
+
import { UmbModalRouteRegistrationController } from '../../../../core/modal/index.js';
|
|
24
|
+
import { UMB_PROPERTY_CONTEXT } from '../../../../core/property/index.js';
|
|
11
25
|
/**
|
|
12
26
|
* @element umb-property-editor-ui-block-grid
|
|
13
27
|
*/
|
|
14
28
|
let UmbPropertyEditorUIBlockGridElement = class UmbPropertyEditorUIBlockGridElement extends UmbLitElement {
|
|
29
|
+
set config(config) {
|
|
30
|
+
if (!config)
|
|
31
|
+
return;
|
|
32
|
+
const validationLimit = config.getValueByAlias('validationLimit');
|
|
33
|
+
this._limitMin = validationLimit?.min;
|
|
34
|
+
this._limitMax = validationLimit?.max;
|
|
35
|
+
this._blocks = config.getValueByAlias('blocks') ?? [];
|
|
36
|
+
this._blockGroups = config.getValueByAlias('blockGroups') ?? [];
|
|
37
|
+
const customCreateButtonLabel = config.getValueByAlias('createLabel');
|
|
38
|
+
if (customCreateButtonLabel) {
|
|
39
|
+
this._createButtonLabel = customCreateButtonLabel;
|
|
40
|
+
}
|
|
41
|
+
else if (this._blocks.length === 1) {
|
|
42
|
+
this._createButtonLabel = this.localize.term('blockEditor_addThis', [this._blocks[0].label]);
|
|
43
|
+
}
|
|
44
|
+
//const useInlineEditingAsDefault = config.getValueByAlias<boolean>('useInlineEditingAsDefault');
|
|
45
|
+
//this.#context.setInlineEditingMode(useInlineEditingAsDefault);
|
|
46
|
+
//config.useSingleBlockMode
|
|
47
|
+
//config.useLiveEditing
|
|
48
|
+
//config.useInlineEditingAsDefault
|
|
49
|
+
this.style.maxWidth = config.getValueByAlias('maxPropertyWidth') ?? '';
|
|
50
|
+
//this.#context.setEditorConfiguration(config);
|
|
51
|
+
}
|
|
15
52
|
constructor() {
|
|
16
53
|
super();
|
|
54
|
+
_UmbPropertyEditorUIBlockGridElement_catalogueModal.set(this, void 0);
|
|
17
55
|
this.value = '';
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.
|
|
23
|
-
});
|
|
56
|
+
this._layouts = [];
|
|
57
|
+
this._createButtonLabel = this.localize.term('blockEditor_addBlock');
|
|
58
|
+
this.consumeContext(UMB_PROPERTY_CONTEXT, (propertyContext) => {
|
|
59
|
+
this.observe(propertyContext?.alias, (alias) => {
|
|
60
|
+
__classPrivateFieldGet(this, _UmbPropertyEditorUIBlockGridElement_catalogueModal, "f").setUniquePathValue('propertyAlias', alias);
|
|
61
|
+
}, 'observePropertyAlias');
|
|
24
62
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (component instanceof HTMLElement) {
|
|
37
|
-
component.name = 'block-grid-1';
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
path: 'modal-2',
|
|
43
|
-
component: () => {
|
|
44
|
-
return import('./property-editor-ui-block-grid-inner-test.element.js');
|
|
45
|
-
},
|
|
46
|
-
setup: (component) => {
|
|
47
|
-
if (component instanceof HTMLElement) {
|
|
48
|
-
component.name = 'block-grid-2';
|
|
49
|
-
}
|
|
50
|
-
},
|
|
63
|
+
__classPrivateFieldSet(this, _UmbPropertyEditorUIBlockGridElement_catalogueModal, new UmbModalRouteRegistrationController(this, UMB_BLOCK_CATALOGUE_MODAL)
|
|
64
|
+
.addUniquePaths(['propertyAlias'])
|
|
65
|
+
.addAdditionalPath(':view/:index')
|
|
66
|
+
.onSetup((routingInfo) => {
|
|
67
|
+
const index = routingInfo.index ? parseInt(routingInfo.index) : -1;
|
|
68
|
+
return {
|
|
69
|
+
data: {
|
|
70
|
+
blocks: this._blocks ?? [],
|
|
71
|
+
blockGroups: this._blockGroups ?? [],
|
|
72
|
+
openClipboard: routingInfo.view === 'clipboard',
|
|
73
|
+
blockOriginData: { index: index },
|
|
51
74
|
},
|
|
52
|
-
|
|
53
|
-
}
|
|
75
|
+
};
|
|
76
|
+
})
|
|
77
|
+
.observeRouteBuilder((routeBuilder) => {
|
|
78
|
+
this._catalogueRouteBuilder = routeBuilder;
|
|
79
|
+
}), "f");
|
|
54
80
|
}
|
|
55
81
|
render() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
.routes="${this._routes}"
|
|
75
|
-
@init=${(event) => {
|
|
76
|
-
this._routerPath = event.target.absoluteRouterPath;
|
|
77
|
-
}}
|
|
78
|
-
@change=${(event) => {
|
|
79
|
-
this._activePath = event.target.localActiveViewPath;
|
|
80
|
-
}}>
|
|
81
|
-
</umb-variant-router-slot>
|
|
82
|
-
</div>`
|
|
83
|
-
: 'loading...';
|
|
82
|
+
if (this._blocks?.length === 1) {
|
|
83
|
+
const elementKey = this._blocks[0].contentElementTypeKey;
|
|
84
|
+
this._directRoute =
|
|
85
|
+
this._catalogueRouteBuilder?.({ view: 'create', index: -1 }) + 'modal/umb-modal-workspace/create/' + elementKey;
|
|
86
|
+
}
|
|
87
|
+
return html `<uui-button-group>
|
|
88
|
+
<uui-button
|
|
89
|
+
id="add-button"
|
|
90
|
+
look="placeholder"
|
|
91
|
+
label=${this._createButtonLabel}
|
|
92
|
+
href=${this._directRoute ?? this._catalogueRouteBuilder?.({ view: 'create', index: -1 }) ?? ''}></uui-button>
|
|
93
|
+
<uui-button
|
|
94
|
+
label=${this.localize.term('content_createFromClipboard')}
|
|
95
|
+
look="placeholder"
|
|
96
|
+
href=${this._catalogueRouteBuilder?.({ view: 'clipboard', index: -1 }) ?? ''}>
|
|
97
|
+
<uui-icon name="icon-paste-in"></uui-icon>
|
|
98
|
+
</uui-button>
|
|
99
|
+
</uui-button-group>`;
|
|
84
100
|
}
|
|
85
101
|
};
|
|
86
|
-
|
|
102
|
+
_UmbPropertyEditorUIBlockGridElement_catalogueModal = new WeakMap();
|
|
103
|
+
UmbPropertyEditorUIBlockGridElement.styles = [
|
|
104
|
+
UmbTextStyles,
|
|
105
|
+
css `
|
|
106
|
+
:host {
|
|
107
|
+
display: grid;
|
|
108
|
+
gap: 1px;
|
|
109
|
+
}
|
|
110
|
+
> div {
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
align-items: stretch;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
uui-button-group {
|
|
117
|
+
padding-top: 1px;
|
|
118
|
+
display: grid;
|
|
119
|
+
grid-template-columns: 1fr auto;
|
|
120
|
+
}
|
|
121
|
+
`,
|
|
122
|
+
];
|
|
87
123
|
__decorate([
|
|
88
124
|
property()
|
|
89
125
|
], UmbPropertyEditorUIBlockGridElement.prototype, "value", void 0);
|
|
90
126
|
__decorate([
|
|
91
|
-
|
|
92
|
-
], UmbPropertyEditorUIBlockGridElement.prototype, "
|
|
127
|
+
state()
|
|
128
|
+
], UmbPropertyEditorUIBlockGridElement.prototype, "_limitMin", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
state()
|
|
131
|
+
], UmbPropertyEditorUIBlockGridElement.prototype, "_limitMax", void 0);
|
|
93
132
|
__decorate([
|
|
94
133
|
state()
|
|
95
|
-
], UmbPropertyEditorUIBlockGridElement.prototype, "
|
|
134
|
+
], UmbPropertyEditorUIBlockGridElement.prototype, "_blocks", void 0);
|
|
96
135
|
__decorate([
|
|
97
136
|
state()
|
|
98
|
-
], UmbPropertyEditorUIBlockGridElement.prototype, "
|
|
137
|
+
], UmbPropertyEditorUIBlockGridElement.prototype, "_blockGroups", void 0);
|
|
99
138
|
__decorate([
|
|
100
139
|
state()
|
|
101
|
-
], UmbPropertyEditorUIBlockGridElement.prototype, "
|
|
140
|
+
], UmbPropertyEditorUIBlockGridElement.prototype, "_layouts", void 0);
|
|
102
141
|
__decorate([
|
|
103
142
|
state()
|
|
104
|
-
], UmbPropertyEditorUIBlockGridElement.prototype, "
|
|
143
|
+
], UmbPropertyEditorUIBlockGridElement.prototype, "_catalogueRouteBuilder", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
state()
|
|
146
|
+
], UmbPropertyEditorUIBlockGridElement.prototype, "_directRoute", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
state()
|
|
149
|
+
], UmbPropertyEditorUIBlockGridElement.prototype, "_createButtonLabel", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
property({ attribute: false })
|
|
152
|
+
], UmbPropertyEditorUIBlockGridElement.prototype, "config", null);
|
|
105
153
|
UmbPropertyEditorUIBlockGridElement = __decorate([
|
|
106
154
|
customElement('umb-property-editor-ui-block-grid')
|
|
107
155
|
], UmbPropertyEditorUIBlockGridElement);
|
|
@@ -3,7 +3,6 @@ import type { UmbPropertyEditorUiElement } from '../../../../core/extension-regi
|
|
|
3
3
|
import { UmbLitElement } from '../../../../../shared/lit-element/index.js';
|
|
4
4
|
import type { UmbPropertyEditorConfigCollection } from '../../../../core/property-editor/index.js';
|
|
5
5
|
import type { UmbBlockLayoutBaseModel, UmbBlockValueType } from '../../../index.js';
|
|
6
|
-
import type { UmbModalRouteBuilder } from '../../../../core/modal/index.js';
|
|
7
6
|
export interface UmbBlockListLayoutModel extends UmbBlockLayoutBaseModel {
|
|
8
7
|
}
|
|
9
8
|
export interface UmbBlockListValueModel extends UmbBlockValueType<UmbBlockListLayoutModel> {
|
|
@@ -16,12 +15,14 @@ export declare class UmbPropertyEditorUIBlockListElement extends UmbLitElement i
|
|
|
16
15
|
private _value;
|
|
17
16
|
get value(): UmbBlockListValueModel;
|
|
18
17
|
set value(value: UmbBlockListValueModel | undefined);
|
|
18
|
+
private _createButtonLabel;
|
|
19
19
|
set config(config: UmbPropertyEditorConfigCollection | undefined);
|
|
20
20
|
private _limitMin?;
|
|
21
21
|
private _limitMax?;
|
|
22
22
|
private _blocks?;
|
|
23
|
-
_layouts
|
|
24
|
-
_catalogueRouteBuilder
|
|
23
|
+
private _layouts;
|
|
24
|
+
private _catalogueRouteBuilder?;
|
|
25
|
+
private _directRoute?;
|
|
25
26
|
constructor();
|
|
26
27
|
render(): import("lit-html").TemplateResult<1>;
|
|
27
28
|
static styles: import("../../../../../external/lit/index.js").CSSResult[];
|
|
@@ -9,7 +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
|
|
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 _UmbPropertyEditorUIBlockListElement_sorter, _UmbPropertyEditorUIBlockListElement_catalogueModal, _UmbPropertyEditorUIBlockListElement_context;
|
|
13
19
|
import { UmbBlockListManagerContext } from '../../manager/block-list-manager.context.js';
|
|
14
20
|
import '../../components/block-list-block/index.js';
|
|
15
21
|
import { UMB_BLOCK_LIST_PROPERTY_EDITOR_ALIAS } from './manifests.js';
|
|
@@ -20,6 +26,7 @@ import { UMB_BLOCK_CATALOGUE_MODAL } from '../../../index.js';
|
|
|
20
26
|
import { UmbModalRouteRegistrationController } from '../../../../core/modal/index.js';
|
|
21
27
|
import { UmbChangeEvent } from '../../../../core/event/index.js';
|
|
22
28
|
import { UmbSorterController } from '../../../../core/sorter/index.js';
|
|
29
|
+
import { UMB_PROPERTY_CONTEXT } from '../../../../core/property/index.js';
|
|
23
30
|
const SORTER_CONFIG = {
|
|
24
31
|
getUniqueOfElement: (element) => {
|
|
25
32
|
return element.getAttribute('data-udi');
|
|
@@ -56,6 +63,13 @@ let UmbPropertyEditorUIBlockListElement = class UmbPropertyEditorUIBlockListElem
|
|
|
56
63
|
this._limitMax = validationLimit?.max;
|
|
57
64
|
const blocks = config.getValueByAlias('blocks') ?? [];
|
|
58
65
|
__classPrivateFieldGet(this, _UmbPropertyEditorUIBlockListElement_context, "f").setBlockTypes(blocks);
|
|
66
|
+
const customCreateButtonLabel = config.getValueByAlias('createLabel');
|
|
67
|
+
if (customCreateButtonLabel) {
|
|
68
|
+
this._createButtonLabel = customCreateButtonLabel;
|
|
69
|
+
}
|
|
70
|
+
else if (blocks.length === 1) {
|
|
71
|
+
this._createButtonLabel = `${this.localize.term('general_add')} ${blocks[0].label}`;
|
|
72
|
+
}
|
|
59
73
|
const useInlineEditingAsDefault = config.getValueByAlias('useInlineEditingAsDefault');
|
|
60
74
|
__classPrivateFieldGet(this, _UmbPropertyEditorUIBlockListElement_context, "f").setInlineEditingMode(useInlineEditingAsDefault);
|
|
61
75
|
//config.useSingleBlockMode
|
|
@@ -73,13 +87,20 @@ let UmbPropertyEditorUIBlockListElement = class UmbPropertyEditorUIBlockListElem
|
|
|
73
87
|
__classPrivateFieldGet(this, _UmbPropertyEditorUIBlockListElement_context, "f").setLayouts(model);
|
|
74
88
|
},
|
|
75
89
|
}));
|
|
90
|
+
_UmbPropertyEditorUIBlockListElement_catalogueModal.set(this, void 0);
|
|
76
91
|
this._value = {
|
|
77
92
|
layout: {},
|
|
78
93
|
contentData: [],
|
|
79
94
|
settingsData: [],
|
|
80
95
|
};
|
|
96
|
+
this._createButtonLabel = this.localize.term('content_createEmpty');
|
|
81
97
|
this._layouts = [];
|
|
82
98
|
_UmbPropertyEditorUIBlockListElement_context.set(this, new UmbBlockListManagerContext(this));
|
|
99
|
+
this.consumeContext(UMB_PROPERTY_CONTEXT, (propertyContext) => {
|
|
100
|
+
this.observe(propertyContext?.alias, (alias) => {
|
|
101
|
+
__classPrivateFieldGet(this, _UmbPropertyEditorUIBlockListElement_catalogueModal, "f").setUniquePathValue('propertyAlias', alias);
|
|
102
|
+
}, 'observePropertyAlias');
|
|
103
|
+
});
|
|
83
104
|
// TODO: Prevent initial notification from these observes:
|
|
84
105
|
this.observe(__classPrivateFieldGet(this, _UmbPropertyEditorUIBlockListElement_context, "f").layouts, (layouts) => {
|
|
85
106
|
this._value = { ...this._value, layout: { [UMB_BLOCK_LIST_PROPERTY_EDITOR_ALIAS]: layouts } };
|
|
@@ -105,7 +126,8 @@ let UmbPropertyEditorUIBlockListElement = class UmbPropertyEditorUIBlockListElem
|
|
|
105
126
|
this.observe(__classPrivateFieldGet(this, _UmbPropertyEditorUIBlockListElement_context, "f").blockTypes, (blockTypes) => {
|
|
106
127
|
this._blocks = blockTypes;
|
|
107
128
|
});
|
|
108
|
-
new UmbModalRouteRegistrationController(this, UMB_BLOCK_CATALOGUE_MODAL)
|
|
129
|
+
__classPrivateFieldSet(this, _UmbPropertyEditorUIBlockListElement_catalogueModal, new UmbModalRouteRegistrationController(this, UMB_BLOCK_CATALOGUE_MODAL)
|
|
130
|
+
.addUniquePaths(['propertyAlias'])
|
|
109
131
|
.addAdditionalPath(':view/:index')
|
|
110
132
|
.onSetup((routingInfo) => {
|
|
111
133
|
const index = routingInfo.index ? parseInt(routingInfo.index) : -1;
|
|
@@ -119,9 +141,14 @@ let UmbPropertyEditorUIBlockListElement = class UmbPropertyEditorUIBlockListElem
|
|
|
119
141
|
})
|
|
120
142
|
.observeRouteBuilder((routeBuilder) => {
|
|
121
143
|
this._catalogueRouteBuilder = routeBuilder;
|
|
122
|
-
});
|
|
144
|
+
}), "f");
|
|
123
145
|
}
|
|
124
146
|
render() {
|
|
147
|
+
if (this._blocks?.length === 1) {
|
|
148
|
+
const elementKey = this._blocks[0].contentElementTypeKey;
|
|
149
|
+
this._directRoute =
|
|
150
|
+
this._catalogueRouteBuilder?.({ view: 'create', index: -1 }) + 'modal/umb-modal-workspace/create/' + elementKey;
|
|
151
|
+
}
|
|
125
152
|
return html ` ${repeat(this._layouts, (x) => x.contentUdi, (layoutEntry, index) => html `<uui-button-inline-create
|
|
126
153
|
href=${this._catalogueRouteBuilder?.({ view: 'create', index: index }) ?? ''}></uui-button-inline-create>
|
|
127
154
|
<umb-property-editor-ui-block-list-block data-udi=${layoutEntry.contentUdi} .layout=${layoutEntry}>
|
|
@@ -130,10 +157,8 @@ let UmbPropertyEditorUIBlockListElement = class UmbPropertyEditorUIBlockListElem
|
|
|
130
157
|
<uui-button
|
|
131
158
|
id="add-button"
|
|
132
159
|
look="placeholder"
|
|
133
|
-
label=${this.
|
|
134
|
-
href=${this._catalogueRouteBuilder?.({ view: 'create', index: -1 }) ?? ''}>
|
|
135
|
-
${this.localize.term('content_createEmpty')}
|
|
136
|
-
</uui-button>
|
|
160
|
+
label=${this._createButtonLabel}
|
|
161
|
+
href=${this._directRoute ?? this._catalogueRouteBuilder?.({ view: 'create', index: -1 }) ?? ''}></uui-button>
|
|
137
162
|
<uui-button
|
|
138
163
|
label=${this.localize.term('content_createFromClipboard')}
|
|
139
164
|
look="placeholder"
|
|
@@ -144,6 +169,7 @@ let UmbPropertyEditorUIBlockListElement = class UmbPropertyEditorUIBlockListElem
|
|
|
144
169
|
}
|
|
145
170
|
};
|
|
146
171
|
_UmbPropertyEditorUIBlockListElement_sorter = new WeakMap();
|
|
172
|
+
_UmbPropertyEditorUIBlockListElement_catalogueModal = new WeakMap();
|
|
147
173
|
_UmbPropertyEditorUIBlockListElement_context = new WeakMap();
|
|
148
174
|
UmbPropertyEditorUIBlockListElement.styles = [
|
|
149
175
|
UmbTextStyles,
|
|
@@ -168,6 +194,9 @@ UmbPropertyEditorUIBlockListElement.styles = [
|
|
|
168
194
|
__decorate([
|
|
169
195
|
property({ attribute: false })
|
|
170
196
|
], UmbPropertyEditorUIBlockListElement.prototype, "value", null);
|
|
197
|
+
__decorate([
|
|
198
|
+
state()
|
|
199
|
+
], UmbPropertyEditorUIBlockListElement.prototype, "_createButtonLabel", void 0);
|
|
171
200
|
__decorate([
|
|
172
201
|
property({ attribute: false })
|
|
173
202
|
], UmbPropertyEditorUIBlockListElement.prototype, "config", null);
|
|
@@ -186,6 +215,9 @@ __decorate([
|
|
|
186
215
|
__decorate([
|
|
187
216
|
state()
|
|
188
217
|
], UmbPropertyEditorUIBlockListElement.prototype, "_catalogueRouteBuilder", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
state()
|
|
220
|
+
], UmbPropertyEditorUIBlockListElement.prototype, "_directRoute", void 0);
|
|
189
221
|
UmbPropertyEditorUIBlockListElement = __decorate([
|
|
190
222
|
customElement('umb-property-editor-ui-block-list')
|
|
191
223
|
], UmbPropertyEditorUIBlockListElement);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { UmbOpenApiConfiguration } from './models/openApiConfiguration.js';
|
|
1
2
|
import type { UmbControllerHostElement } from '../../libs/controller-api/index.js';
|
|
2
3
|
import { UmbBaseController } from '../../libs/class-api/index.js';
|
|
3
4
|
export declare class UmbAuthContext extends UmbBaseController {
|
|
@@ -28,7 +29,7 @@ export declare class UmbAuthContext extends UmbBaseController {
|
|
|
28
29
|
*
|
|
29
30
|
* NB! The user may experience being redirected to the login screen if the token is expired.
|
|
30
31
|
*
|
|
31
|
-
* @example
|
|
32
|
+
* @example <caption>Using the latest token</caption>
|
|
32
33
|
* ```js
|
|
33
34
|
* const token = await authContext.getLatestToken();
|
|
34
35
|
* const result = await fetch('https://my-api.com', { headers: { Authorization: `Bearer ${token}` } });
|
|
@@ -48,4 +49,37 @@ export declare class UmbAuthContext extends UmbBaseController {
|
|
|
48
49
|
* @memberof UmbAuthContext
|
|
49
50
|
*/
|
|
50
51
|
signOut(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Get the server url to the Management API.
|
|
54
|
+
* @memberof UmbAuthContext
|
|
55
|
+
* @example <caption>Using the server url</caption>
|
|
56
|
+
* ```js
|
|
57
|
+
* const serverUrl = authContext.getServerUrl();
|
|
58
|
+
* OpenAPI.BASE = serverUrl;
|
|
59
|
+
* ```
|
|
60
|
+
* @example <caption></caption>
|
|
61
|
+
* ```js
|
|
62
|
+
* const serverUrl = authContext.getServerUrl();
|
|
63
|
+
* const token = await authContext.getLatestToken();
|
|
64
|
+
* const result = await fetch(`${serverUrl}/umbraco/management/api/v1/my-resource`, { headers: { Authorization: `Bearer ${token}` } });
|
|
65
|
+
* ```
|
|
66
|
+
* @returns The server url to the Management API
|
|
67
|
+
*/
|
|
68
|
+
getServerUrl(): string;
|
|
69
|
+
/**
|
|
70
|
+
* Get the default OpenAPI configuration, which is set up to communicate with the Management API.
|
|
71
|
+
* @remark This is useful if you want to communicate with your own resources generated by the [openapi-typescript-codegen](https://github.com/ferdikoomen/openapi-typescript-codegen) library.
|
|
72
|
+
* @memberof UmbAuthContext
|
|
73
|
+
*
|
|
74
|
+
* @example <caption>Using the default OpenAPI configuration</caption>
|
|
75
|
+
* ```js
|
|
76
|
+
* const defaultOpenApi = authContext.getOpenApiConfiguration();
|
|
77
|
+
* OpenAPI.BASE = defaultOpenApi.base;
|
|
78
|
+
* OpenAPI.WITH_CREDENTIALS = defaultOpenApi.withCredentials;
|
|
79
|
+
* OpenAPI.CREDENTIALS = defaultOpenApi.credentials;
|
|
80
|
+
* OpenAPI.TOKEN = defaultOpenApi.token;
|
|
81
|
+
* ```
|
|
82
|
+
* @returns The default OpenAPI configuration
|
|
83
|
+
*/
|
|
84
|
+
getOpenApiConfiguration(): UmbOpenApiConfiguration;
|
|
51
85
|
}
|