Skip to content

Commit ce8d5e4

Browse files
authored
Merge branch 'main' into v14/bugfix/pickers-undefined-value
2 parents 0485086 + d8fa5e7 commit ce8d5e4

File tree

37 files changed

+284
-122
lines changed

37 files changed

+284
-122
lines changed

src/apps/installer/user/installer-user.element.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,35 @@ export class UmbInstallerUserElement extends UmbLitElement {
99
@state()
1010
private _userFormData?: { name: string; password: string; email: string; subscribeToNewsletter: boolean };
1111

12-
private _installerContext?: UmbInstallerContext;
12+
@state()
13+
private _minimumPasswordLength = 10;
14+
15+
#installerContext?: UmbInstallerContext;
1316

1417
constructor() {
1518
super();
1619

1720
this.consumeContext(UMB_INSTALLER_CONTEXT, (installerContext) => {
18-
this._installerContext = installerContext;
21+
this.#installerContext = installerContext;
1922
this._observeInstallerData();
2023
});
2124
}
2225

2326
private _observeInstallerData() {
24-
if (!this._installerContext) return;
27+
if (!this.#installerContext) return;
2528

26-
this.observe(this._installerContext.data, ({ user }) => {
29+
this.observe(this.#installerContext.data, ({ user }) => {
2730
this._userFormData = {
2831
name: user.name,
2932
password: user.password,
3033
email: user.email,
3134
subscribeToNewsletter: user.subscribeToNewsletter ?? false,
3235
};
3336
});
37+
38+
this.observe(this.#installerContext.settings, (settings) => {
39+
this._minimumPasswordLength = settings?.user.minCharLength ?? this._minimumPasswordLength;
40+
});
3441
}
3542

3643
private _handleSubmit = (e: SubmitEvent) => {
@@ -48,8 +55,8 @@ export class UmbInstallerUserElement extends UmbLitElement {
4855
const email = formData.get('email') as string;
4956
const subscribeToNewsletter = formData.has('subscribeToNewsletter');
5057

51-
this._installerContext?.appendData({ user: { name, password, email, subscribeToNewsletter } });
52-
this._installerContext?.nextStep();
58+
this.#installerContext?.appendData({ user: { name, password, email, subscribeToNewsletter } });
59+
this.#installerContext?.nextStep();
5360
};
5461

5562
override render() {
@@ -87,6 +94,7 @@ export class UmbInstallerUserElement extends UmbLitElement {
8794
id="password"
8895
name="password"
8996
label="password"
97+
minlength=${this._minimumPasswordLength}
9098
.value=${this._userFormData?.password}
9199
required
92100
required-message="Password is required"></uui-input-password>

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 };

0 commit comments

Comments
 (0)