Skip to content

Commit f2c90e9

Browse files
Merge branch 'main' into v15/feature/emm-granular-user-permission
2 parents 2b8017d + 56e9ac8 commit f2c90e9

File tree

146 files changed

+3072
-1628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+3072
-1628
lines changed

src/external/backend-api/src/types.gen.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ export type DataTypeItemResponseModel = {
488488
id: string;
489489
name: string;
490490
editorUiAlias?: (string) | null;
491+
editorAlias: string;
491492
isDeletable: boolean;
492493
};
493494

src/libs/class-api/class.interface.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export interface UmbClassInterface extends UmbControllerHost {
1212
/**
1313
* @description Observe an Observable. An Observable is a declared source of data that can be observed. An observables is declared from a UmbState.
1414
* @param {Observable} source An Observable to observe from.
15-
* @param {ObserverCallback} callback Callback method called when data is changed.
15+
* @param {ObserverCallback | undefined} callback Callback method called when data is changed.
16+
* @param {UmbControllerAlias | null | undefined} controllerAlias Define an explicit controller alias. If not defined then one will be generated based on the callback function. If null is parsed no controller alias will be given.
1617
* @returns {UmbObserverController} Reference to the created Observer Controller instance.
1718
* @memberof UmbClassInterface
1819
*/
@@ -30,7 +31,7 @@ export interface UmbClassInterface extends UmbControllerHost {
3031
>(
3132
// This type dance checks if the Observable given could be undefined, if it potentially could be undefined it means that this potentially could return undefined and then call the callback with undefined. [NL]
3233
source: ObservableType,
33-
callback: ObserverCallback<SpecificT>,
34+
callback?: ObserverCallback<SpecificT>,
3435
controllerAlias?: UmbControllerAlias | null,
3536
): SpecificR;
3637

src/libs/extension-api/registry/extension.registry.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,21 @@ export class UmbExtensionRegistry<
414414
) as Observable<Array<T>>;
415415
}
416416

417+
// TODO: Write test for this method:
418+
getByTypeAndFilter<
419+
Key extends string,
420+
T extends ManifestBase = SpecificManifestTypeOrManifestBase<ManifestTypes, Key>,
421+
>(type: Key, filter: (ext: T) => boolean): Array<T> {
422+
const exts = this._extensions
423+
.getValue()
424+
.filter((ext) => ext.type === type && filter(ext as unknown as T)) as unknown as T[];
425+
if (exts.length === 0) {
426+
return [];
427+
}
428+
const kinds = this._kinds.getValue();
429+
return exts.map((ext) => (ext?.kind ? (this.#mergeExtensionWithKinds([ext, kinds]) ?? ext) : ext));
430+
}
431+
417432
/**
418433
* Get an observable of extensions by types and a given filter method.
419434
* This will return the all extensions that matches the types and which filter method returns true.

src/libs/observable-api/states/array-state.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
2323
/**
2424
* @function sortBy
2525
* @param {(a: T, b: T) => number} sortMethod - A method to be used for sorting every time data is set.
26+
* @returns {UmbArrayState<T>} Reference to it self.
2627
* @description - A sort method to this Subject.
2728
* @example <caption>Example add sort method</caption>
2829
* const data = [
@@ -53,7 +54,7 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
5354
* // myState.value is equal 'Goodnight'.
5455
*/
5556
override setValue(value: T[]) {
56-
if (this.#sortMethod) {
57+
if (value && this.#sortMethod) {
5758
super.setValue([...value].sort(this.#sortMethod));
5859
} else {
5960
super.setValue(value);
@@ -76,6 +77,7 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
7677
remove(uniques: unknown[]) {
7778
if (this.getUniqueMethod) {
7879
let next = this.getValue();
80+
if (!next) return this;
7981
uniques.forEach((unique) => {
8082
next = next.filter((x) => {
8183
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -105,6 +107,7 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
105107
removeOne(unique: unknown) {
106108
if (this.getUniqueMethod) {
107109
let next = this.getValue();
110+
if (!next) return this;
108111
next = next.filter((x) => {
109112
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
110113
// @ts-ignore
@@ -138,7 +141,10 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
138141
* ]
139142
*/
140143
filter(predicate: (value: T, index: number, array: T[]) => boolean) {
141-
this.setValue(this.getValue().filter(predicate));
144+
const value = this.getValue();
145+
if (value) {
146+
this.setValue(value.filter(predicate));
147+
}
142148
return this;
143149
}
144150

src/mocks/data/data-type/data-type.db.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const itemResponseMapper = (item: UmbMockDataTypeModel): DataTypeItemResponseMod
8282
return {
8383
id: item.id,
8484
name: item.name,
85+
editorAlias: item.editorAlias,
8586
isDeletable: item.isDeletable,
8687
};
8788
};

src/mocks/data/document/document.data.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,20 @@ export const data: Array<UmbMockDocumentModel> = [
9696
<li>Aenean massa cum sociis natoque penatibus.</li>
9797
</ul>
9898
<p>
99-
Lorem ipsum dolor sit amet, consectetuer adipiscing
99+
Lorem ipsum dolor sit amet, consectetuer adipiscing
100100
elit. Aenean commodo ligula eget dolor.
101101
</p>
102102
<p>
103103
<blockquote>
104-
Lorem ipsum dolor sit amet, consectetuer
105-
adipiscing elit. Aenean commodo ligula eget dolor.
106-
Aenean massa <strong>strong</strong>. Cum sociis
107-
natoque penatibus et magnis dis parturient montes,
108-
nascetur ridiculus mus. Donec quam felis, ultricies
109-
nec, pellentesque eu, pretium quis, sem. Nulla consequat
110-
massa quis enim. Donec pede justo, fringilla vel,
111-
aliquet nec, vulputate eget, arcu. In <em>em</em>
112-
enim justo, rhoncus ut, imperdiet a, venenatis vitae,
104+
Lorem ipsum dolor sit amet, consectetuer
105+
adipiscing elit. Aenean commodo ligula eget dolor.
106+
Aenean massa <strong>strong</strong>. Cum sociis
107+
natoque penatibus et magnis dis parturient montes,
108+
nascetur ridiculus mus. Donec quam felis, ultricies
109+
nec, pellentesque eu, pretium quis, sem. Nulla consequat
110+
massa quis enim. Donec pede justo, fringilla vel,
111+
aliquet nec, vulputate eget, arcu. In <em>em</em>
112+
enim justo, rhoncus ut, imperdiet a, venenatis vitae,
113113
justo. Nullam <a class="external ext" href="#">link</a>
114114
dictum felis eu pede mollis pretium.
115115
</blockquote>
@@ -275,43 +275,43 @@ export const data: Array<UmbMockDocumentModel> = [
275275
layout: {
276276
'Umbraco.BlockList': [
277277
{
278-
contentUdi: '1234',
279-
settingsUdi: '5678',
278+
contentKey: '1234',
279+
settingsKey: '5678',
280280
},
281281
],
282282
},
283283
contentData: [
284284
{
285-
udi: '1234',
285+
key: '1234',
286286
contentTypeKey: '4f68ba66-6fb2-4778-83b8-6ab4ca3a7c5c',
287287
elementProperty: 'Hello world',
288288
},
289289
],
290290
settingsData: [
291291
{
292-
udi: '5678',
292+
key: '5678',
293293
contentTypeKey: 'all-property-editors-document-type-id',
294294
elementProperty: 'Hello world',
295295
textBox: 'Hello world 123',
296296
blockList: {
297297
layout: {
298298
'Umbraco.BlockList': [
299299
{
300-
contentUdi: '1234b',
301-
settingsUdi: '5678b',
300+
contentKey: '1234b',
301+
settingsKey: '5678b',
302302
},
303303
],
304304
},
305305
contentData: [
306306
{
307-
udi: '1234b',
307+
key: '1234b',
308308
contentTypeKey: '4f68ba66-6fb2-4778-83b8-6ab4ca3a7c5c',
309309
elementProperty: 'Hello world',
310310
},
311311
],
312312
settingsData: [
313313
{
314-
udi: '5678b',
314+
key: '5678b',
315315
contentTypeKey: 'all-property-editors-document-type-id',
316316
elementProperty: 'Hello world',
317317
},
@@ -425,21 +425,21 @@ export const data: Array<UmbMockDocumentModel> = [
425425
layout: {
426426
'Umbraco.BlockGrid': [
427427
{
428-
contentUdi: '1234',
429-
settingsUdi: '5678',
428+
contentKey: '1234',
429+
settingsKey: '5678',
430430
columnSpan: 12,
431431
areas: [
432432
{
433433
key: 'area1_key',
434434
items: [
435435
{
436-
contentUdi: 'a1234',
437-
settingsUdi: 'a5678',
436+
contentKey: 'a1234',
437+
settingsKey: 'a5678',
438438
columnSpan: 3,
439439
rowSpan: 2,
440440
},
441441
{
442-
contentUdi: 'c1234',
442+
contentKey: 'c1234',
443443
columnSpan: 3,
444444
},
445445
],
@@ -448,8 +448,8 @@ export const data: Array<UmbMockDocumentModel> = [
448448
key: 'area2_key',
449449
items: [
450450
{
451-
contentUdi: 'b1234',
452-
settingsUdi: 'b5678',
451+
contentKey: 'b1234',
452+
settingsKey: 'b5678',
453453
columnSpan: 6,
454454
areas: [],
455455
},
@@ -461,39 +461,39 @@ export const data: Array<UmbMockDocumentModel> = [
461461
},
462462
contentData: [
463463
{
464-
udi: '1234',
464+
key: '1234',
465465
contentTypeKey: '4f68ba66-6fb2-4778-83b8-6ab4ca3a7c5c',
466466
elementProperty: 'Hello world',
467467
},
468468
{
469-
udi: 'a1234',
469+
key: 'a1234',
470470
contentTypeKey: '4f68ba66-6fb2-4778-83b8-6ab4ca3a7c5c',
471471
elementProperty: 'Hello world from area 1',
472472
},
473473
{
474-
udi: 'b1234',
474+
key: 'b1234',
475475
contentTypeKey: '4f68ba66-6fb2-4778-83b8-6ab4ca3a7c5c',
476476
elementProperty: 'Hello world from area 2',
477477
},
478478
{
479-
udi: 'c1234',
479+
key: 'c1234',
480480
contentTypeKey: '4f68ba66-6fb2-4778-83b8-6ab4ca3a7c5c',
481481
elementProperty: 'Hello CCC from area 1',
482482
},
483483
],
484484
settingsData: [
485485
{
486-
udi: '5678',
486+
key: '5678',
487487
contentTypeKey: 'all-property-editors-document-type-id',
488488
elementProperty: 'Hello world',
489489
},
490490
{
491-
udi: 'a5678',
491+
key: 'a5678',
492492
contentTypeKey: 'all-property-editors-document-type-id',
493493
elementProperty: 'Hello world from area 1 settings',
494494
},
495495
{
496-
udi: 'b5678',
496+
key: 'b5678',
497497
contentTypeKey: '4f68ba66-6fb2-4778-83b8-6ab4ca3a7c5c',
498498
elementProperty: 'Hello world from area 2 settings',
499499
},

src/packages/block/block-custom-view/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface UmbBlockEditorCustomViewProperties<
1818
manifest?: ManifestBlockEditorCustomView;
1919
config?: Partial<UmbBlockEditorCustomViewConfiguration>;
2020
blockType?: BlockType;
21-
contentUdi?: string;
21+
contentKey?: string;
2222
label?: string;
2323
icon?: string;
2424
index?: number;
@@ -27,6 +27,7 @@ export interface UmbBlockEditorCustomViewProperties<
2727
settings?: UmbBlockDataType;
2828
contentInvalid?: boolean;
2929
settingsInvalid?: boolean;
30+
unpublished?: boolean;
3031
}
3132

3233
export interface UmbBlockEditorCustomViewElement<

src/packages/block/block-grid/components/block-grid-block-inline/block-grid-block-inline.element.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { UmbPropertyTypeModel } from '@umbraco-cms/backoffice/content-type'
66
import '../block-grid-areas-container/index.js';
77
import '../ref-grid-block/index.js';
88
import type { UmbBlockEditorCustomViewConfiguration } from '@umbraco-cms/backoffice/block-custom-view';
9+
import type { UmbBlockDataType } from '@umbraco-cms/backoffice/block';
910

1011
/**
1112
* @element umb-block-grid-block-inline
@@ -16,9 +17,18 @@ export class UmbBlockGridBlockInlineElement extends UmbLitElement {
1617
@property({ attribute: false })
1718
label?: string;
1819

20+
@property({ type: String, reflect: false })
21+
icon?: string;
22+
1923
@property({ attribute: false })
2024
config?: UmbBlockEditorCustomViewConfiguration;
2125

26+
@property({ type: Boolean, reflect: true })
27+
unpublished?: boolean;
28+
29+
@property({ attribute: false })
30+
content?: UmbBlockDataType;
31+
2232
@state()
2333
_inlineProperty: UmbPropertyTypeModel | undefined;
2434

@@ -39,7 +49,9 @@ export class UmbBlockGridBlockInlineElement extends UmbLitElement {
3949
}
4050

4151
override render() {
42-
return html`<umb-ref-grid-block standalone .name=${this.label ?? ''} href=${this.config?.editContentPath ?? ''}>
52+
return html`<umb-ref-grid-block standalone href=${this.config?.editContentPath ?? ''}>
53+
<umb-icon slot="icon" .name=${this.icon}></umb-icon>
54+
<umb-ufm-render slot="name" inline .markdown=${this.label} .value=${this.content}></umb-ufm-render>
4355
<umb-property-type-based-property
4456
.property=${this._inlineProperty}
4557
slot="areas"></umb-property-type-based-property>
@@ -55,6 +67,10 @@ export class UmbBlockGridBlockInlineElement extends UmbLitElement {
5567
umb-block-grid-areas-container::part(area) {
5668
margin: var(--uui-size-2);
5769
}
70+
:host([unpublished]) umb-icon,
71+
:host([unpublished]) umb-ufm-render {
72+
opacity: 0.6;
73+
}
5874
`,
5975
];
6076
}

src/packages/block/block-grid/components/block-grid-block/block-grid-block.element.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { UMB_BLOCK_GRID_ENTRY_CONTEXT } from '../../context/block-grid-entry.context-token.js';
21
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
3-
import { css, customElement, html, property, state } from '@umbraco-cms/backoffice/external/lit';
2+
import { css, customElement, html, property } from '@umbraco-cms/backoffice/external/lit';
43
import type { UmbBlockDataType } from '@umbraco-cms/backoffice/block';
54
import type { UmbBlockEditorCustomViewConfiguration } from '@umbraco-cms/backoffice/block-custom-view';
65

@@ -17,29 +16,22 @@ export class UmbBlockGridBlockElement extends UmbLitElement {
1716
@property({ attribute: false })
1817
label?: string;
1918

19+
@property({ type: String, reflect: false })
20+
icon?: string;
21+
2022
@property({ attribute: false })
2123
config?: UmbBlockEditorCustomViewConfiguration;
2224

23-
@state()
24-
_content?: UmbBlockDataType;
25-
26-
constructor() {
27-
super();
25+
@property({ type: Boolean, reflect: true })
26+
unpublished?: boolean;
2827

29-
this.consumeContext(UMB_BLOCK_GRID_ENTRY_CONTEXT, (context) => {
30-
this.observe(
31-
context.content,
32-
(content) => {
33-
this._content = content;
34-
},
35-
'observeContent',
36-
);
37-
});
38-
}
28+
@property({ attribute: false })
29+
content?: UmbBlockDataType;
3930

4031
override render() {
4132
return html`<umb-ref-grid-block standalone href=${this.config?.editContentPath ?? ''}>
42-
<umb-ufm-render inline .markdown=${this.label} .value=${this._content}></umb-ufm-render>
33+
<umb-icon slot="icon" .name=${this.icon}></umb-icon>
34+
<umb-ufm-render slot="name" inline .markdown=${this.label} .value=${this.content}></umb-ufm-render>
4335
<umb-block-grid-areas-container slot="areas"></umb-block-grid-areas-container>
4436
</umb-ref-grid-block>`;
4537
}
@@ -52,6 +44,10 @@ export class UmbBlockGridBlockElement extends UmbLitElement {
5244
umb-block-grid-areas-container::part(area) {
5345
margin: var(--uui-size-2);
5446
}
47+
:host([unpublished]) umb-icon,
48+
:host([unpublished]) umb-ufm-render {
49+
opacity: 0.6;
50+
}
5551
`,
5652
];
5753
}

0 commit comments

Comments
 (0)