Skip to content

Commit daa8f7c

Browse files
committed
Merge remote-tracking branch 'origin/main' into v14/bugfix/missing-css-vars
2 parents 77bbc30 + 8606a34 commit daa8f7c

30 files changed

+103
-85
lines changed

src/packages/block/block-grid/components/block-grid-area-config-entry/workspace/block-grid-area-type-workspace.context.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import type { UmbBlockGridTypeAreaType } from '../../../types.js';
22
import type { UmbPropertyDatasetContext } from '@umbraco-cms/backoffice/property';
33
import { UMB_PROPERTY_CONTEXT } from '@umbraco-cms/backoffice/property';
4-
import {
5-
type UmbInvariantDatasetWorkspaceContext,
6-
type UmbRoutableWorkspaceContext,
7-
type UmbWorkspaceContext,
8-
UmbWorkspaceRouteManager,
4+
import type {
5+
UmbInvariantDatasetWorkspaceContext,
6+
UmbRoutableWorkspaceContext,
7+
UmbWorkspaceContext,
98
} from '@umbraco-cms/backoffice/workspace';
109
import {
1110
UmbSubmittableWorkspaceContextBase,
@@ -69,7 +68,6 @@ export class UmbBlockGridAreaTypeWorkspaceContext
6968
if (value) {
7069
const blockTypeData = value.find((x: UmbBlockGridTypeAreaType) => x.key === unique);
7170
if (blockTypeData) {
72-
console.log(blockTypeData);
7371
this.#data.setValue(blockTypeData);
7472
return;
7573
}

src/packages/block/block-grid/context/block-grid-entry.context.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export class UmbBlockGridEntryContext
3030
implements UmbBlockGridScalableContext
3131
{
3232
//
33-
readonly columnSpan = this._layout.asObservablePart((x) => x?.columnSpan);
34-
readonly rowSpan = this._layout.asObservablePart((x) => x?.rowSpan);
33+
readonly columnSpan = this._layout.asObservablePart((x) => x ? x.columnSpan ?? null : undefined);
34+
readonly rowSpan = this._layout.asObservablePart((x) => x ? x.rowSpan ?? null : undefined);
3535
readonly layoutAreas = this._layout.asObservablePart((x) => x?.areas);
3636
readonly columnSpanOptions = this._blockType.asObservablePart((x) => x?.columnSpanOptions ?? []);
3737
readonly areaTypeGridColumns = this._blockType.asObservablePart((x) => x?.areaGridColumns);
@@ -208,7 +208,7 @@ export class UmbBlockGridEntryContext
208208
this.observe(
209209
observeMultiple([this.columnSpan, this.relevantColumnSpanOptions, this._entries.layoutColumns]),
210210
([columnSpan, relevantColumnSpanOptions, layoutColumns]) => {
211-
if (!layoutColumns) return;
211+
if (!layoutColumns || columnSpan === undefined) return;
212212
const newColumnSpan = this.#calcColumnSpan(
213213
columnSpan ?? layoutColumns,
214214
relevantColumnSpanOptions,
@@ -230,16 +230,15 @@ export class UmbBlockGridEntryContext
230230
this.observe(
231231
observeMultiple([this.minMaxRowSpan, this.rowSpan]),
232232
([minMax, rowSpan]) => {
233-
if (minMax) {
234-
const newRowSpan = Math.max(minMax[0], Math.min(rowSpan ?? 1, minMax[1]));
235-
if (newRowSpan !== rowSpan) {
236-
const layoutValue = this._layout.getValue();
237-
if (!layoutValue) return;
238-
this._layout.setValue({
239-
...layoutValue,
240-
rowSpan: newRowSpan,
241-
});
242-
}
233+
if (!minMax || rowSpan === undefined) return;
234+
const newRowSpan = Math.max(minMax[0], Math.min(rowSpan ?? 1, minMax[1]));
235+
if (newRowSpan !== rowSpan) {
236+
const layoutValue = this._layout.getValue();
237+
if (!layoutValue) return;
238+
this._layout.setValue({
239+
...layoutValue,
240+
rowSpan: newRowSpan,
241+
});
243242
}
244243
},
245244
'observeRowSpanValidation',
@@ -259,10 +258,8 @@ export class UmbBlockGridEntryContext
259258
return newColumnSpan;
260259
}
261260
} else {
262-
// Reset to the layoutColumns.
263-
if (layoutColumns !== columnSpan) {
264-
return layoutColumns;
265-
}
261+
// Fallback to the layoutColumns.
262+
return layoutColumns;
266263
}
267264
return columnSpan;
268265
}

src/packages/block/block-grid/property-editors/block-grid-type-configuration/property-editor-ui-block-grid-type-configuration.element.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ import {
1717
} from '@umbraco-cms/backoffice/property-editor';
1818
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
1919
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
20-
import { UMB_BLOCK_GRID_TYPE, type UmbBlockGridTypeGroupType } from '@umbraco-cms/backoffice/block-grid';
20+
import { UMB_BLOCK_GRID_TYPE, UMB_BLOCK_GRID_TYPE_WORKSPACE_MODAL, type UmbBlockGridTypeGroupType } from '@umbraco-cms/backoffice/block-grid';
2121
import type { UUIInputEvent } from '@umbraco-cms/backoffice/external/uui';
2222
import {
2323
UMB_PROPERTY_CONTEXT,
2424
UMB_PROPERTY_DATASET_CONTEXT,
2525
type UmbPropertyDatasetContext,
2626
} from '@umbraco-cms/backoffice/property';
27-
import { UMB_WORKSPACE_MODAL } from '@umbraco-cms/backoffice/modal';
2827
import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router';
2928
import { UmbSorterController } from '@umbraco-cms/backoffice/sorter';
3029

@@ -61,8 +60,8 @@ export class UmbPropertyEditorUIBlockGridTypeConfigurationElement
6160

6261
#datasetContext?: UmbPropertyDatasetContext;
6362
#blockTypeWorkspaceModalRegistration?: UmbModalRouteRegistrationController<
64-
typeof UMB_WORKSPACE_MODAL.DATA,
65-
typeof UMB_WORKSPACE_MODAL.VALUE
63+
typeof UMB_BLOCK_GRID_TYPE_WORKSPACE_MODAL.DATA,
64+
typeof UMB_BLOCK_GRID_TYPE_WORKSPACE_MODAL.VALUE
6665
>;
6766

6867
#value: Array<UmbBlockTypeWithGroupKey> = [];
@@ -105,11 +104,8 @@ export class UmbPropertyEditorUIBlockGridTypeConfigurationElement
105104
this.#observeBlockGroups();
106105
});
107106

108-
this.#blockTypeWorkspaceModalRegistration = new UmbModalRouteRegistrationController(this, UMB_WORKSPACE_MODAL)
107+
this.#blockTypeWorkspaceModalRegistration = new UmbModalRouteRegistrationController(this, UMB_BLOCK_GRID_TYPE_WORKSPACE_MODAL)
109108
.addAdditionalPath(UMB_BLOCK_GRID_TYPE)
110-
.onSetup(() => {
111-
return { data: { entityType: UMB_BLOCK_GRID_TYPE, preset: {} }, modal: { size: 'large' } };
112-
})
113109
.observeRouteBuilder((routeBuilder) => {
114110
const newpath = routeBuilder({});
115111
this._workspacePath = newpath;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { UMB_BLOCK_GRID_TYPE, type UmbBlockGridTypeModel } from '../types.js';
2+
import type { UmbWorkspaceModalData, UmbWorkspaceModalValue } from '@umbraco-cms/backoffice/modal';
3+
import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
4+
5+
export type UmbBlockGridTypeWorkspaceData = UmbWorkspaceModalData<UmbBlockGridTypeModel>;
6+
7+
export const UMB_BLOCK_GRID_TYPE_WORKSPACE_MODAL = new UmbModalToken<UmbBlockGridTypeWorkspaceData, UmbWorkspaceModalValue>(
8+
'Umb.Modal.Workspace',
9+
{
10+
modal: {
11+
type: 'sidebar',
12+
size: 'large',
13+
},
14+
data: { entityType: UMB_BLOCK_GRID_TYPE, preset: {allowAtRoot: true} },
15+
},
16+
// Recast the type, so the entityType data prop is not required:
17+
) as UmbModalToken<Omit<UmbWorkspaceModalData, 'entityType' | 'preset'>, UmbWorkspaceModalValue>;

src/packages/block/block-grid/workspace/block-grid-workspace.modal-token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ export const UMB_BLOCK_GRID_WORKSPACE_MODAL = new UmbModalToken<UmbBlockGridWork
1818
size: 'medium',
1919
},
2020
data: { entityType: 'block', preset: {}, originData: { index: -1, parentUnique: null } },
21-
// Recast the type, so the entityType data prop is not required:
2221
},
22+
// Recast the type, so the entityType data prop is not required:
2323
) as UmbModalToken<Omit<UmbWorkspaceModalData, 'entityType'>, UmbWorkspaceModalValue>;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export const UMB_BLOCK_GRID_TYPE_WORKSPACE_ALIAS = 'Umb.Workspace.BlockGridType';
22
export * from './block-grid-workspace.modal-token.js';
3+
export * from './block-grid-type-workspace.modal-token.js';

src/packages/block/block-list/workspace/block-list-workspace.modal-token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export const UMB_BLOCK_LIST_WORKSPACE_MODAL = new UmbModalToken<UmbBlockListWork
1616
size: 'medium',
1717
},
1818
data: { entityType: 'block', preset: {}, originData: { index: -1 } },
19-
// Recast the type, so the entityType data prop is not required:
2019
},
20+
// Recast the type, so the entityType data prop is not required:
2121
) as UmbModalToken<Omit<UmbWorkspaceModalData, 'entityType'>, UmbWorkspaceModalValue>;

src/packages/block/block-rte/workspace/block-rte-workspace.modal-token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export const UMB_BLOCK_RTE_WORKSPACE_MODAL = new UmbModalToken<UmbBlockRteWorksp
1212
size: 'medium',
1313
},
1414
data: { entityType: 'block', preset: {}, originData: {} },
15-
// Recast the type, so the entityType data prop is not required:
1615
},
16+
// Recast the type, so the entityType data prop is not required:
1717
) as UmbModalToken<Omit<UmbWorkspaceModalData, 'entityType'>, UmbWorkspaceModalValue>;

src/packages/block/block-type/workspace/block-type-workspace.context.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
UmbSubmittableWorkspaceContextBase,
1111
UmbInvariantWorkspacePropertyDatasetContext,
1212
UmbWorkspaceIsNewRedirectController,
13-
UmbWorkspaceRouteManager,
1413
} from '@umbraco-cms/backoffice/workspace';
1514
import { UmbArrayState, UmbObjectState, appendToFrozenArray } from '@umbraco-cms/backoffice/observable-api';
1615
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
@@ -99,12 +98,22 @@ export class UmbBlockTypeWorkspaceContext<BlockTypeData extends UmbBlockTypeWith
9998

10099
async create(contentElementTypeId: string, groupKey?: string | null) {
101100
this.resetState();
102-
//Only set groupKey property if it exists
103-
const data: BlockTypeData = {
104-
contentElementTypeKey: contentElementTypeId,
105-
...(groupKey && { groupKey: groupKey }),
101+
102+
103+
let data: BlockTypeData = {
104+
contentElementTypeKey: contentElementTypeId
106105
} as BlockTypeData;
107106

107+
// If we have a modal context, we blend in the modal preset data: [NL]
108+
if (this.modalContext) {
109+
data = { ...data, ...this.modalContext.data.preset };
110+
}
111+
112+
// Only set groupKey property if it has been parsed to this method
113+
if (groupKey) {
114+
data.groupKey = groupKey;
115+
}
116+
108117
this.setIsNew(true);
109118
this.#data.setValue(data);
110119
return { data };

src/packages/block/block/conditions/block-workspace-has-settings.condition.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { UMB_BLOCK_WORKSPACE_CONTEXT } from '../workspace/block-workspace.context-token.js';
21
import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
32
import type { BlockWorkspaceHasSettingsConditionConfig } from '@umbraco-cms/backoffice/extension-registry';
43
import type { UmbConditionControllerArguments, UmbExtensionCondition } from '@umbraco-cms/backoffice/extension-api';
54
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
5+
import { UMB_BLOCK_WORKSPACE_CONTEXT } from '../workspace/block-workspace.context-token.js';
66

77
export class UmbBlockWorkspaceHasSettingsCondition
88
extends UmbConditionBase<BlockWorkspaceHasSettingsConditionConfig>
@@ -18,7 +18,7 @@ export class UmbBlockWorkspaceHasSettingsCondition
1818
this.observe(
1919
context.settings.contentTypeId,
2020
(settingsContentTypeId) => {
21-
this.permitted = !!settingsContentTypeId;
21+
this.permitted = settingsContentTypeId !== undefined;
2222
},
2323
'observeSettingsElementTypeId',
2424
);

0 commit comments

Comments
 (0)