Skip to content

Commit 25292c8

Browse files
committed
Passed the validation object through to the umb-property
1 parent 773a155 commit 25292c8

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

src/packages/core/content-type/components/property-type-based-property/property-type-based-property.element.ts

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
import type { UmbPropertyEditorConfig } from '../../../property-editor/index.js';
22
import type { UmbPropertyTypeModel } from '../../types.js';
3+
import { css, customElement, html, ifDefined, property, state } from '@umbraco-cms/backoffice/external/lit';
34
import { UmbContentPropertyContext } from '@umbraco-cms/backoffice/content';
4-
import type { UmbDataTypeDetailModel } from '@umbraco-cms/backoffice/data-type';
55
import { UmbDataTypeDetailRepository } from '@umbraco-cms/backoffice/data-type';
6-
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
7-
import { css, html, ifDefined, customElement, property, state } from '@umbraco-cms/backoffice/external/lit';
6+
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
87
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
8+
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
9+
import type { UmbDataTypeDetailModel } from '@umbraco-cms/backoffice/data-type';
910
import type { UmbObserverController } from '@umbraco-cms/backoffice/observable-api';
10-
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
11+
1112
@customElement('umb-property-type-based-property')
1213
export class UmbPropertyTypeBasedPropertyElement extends UmbLitElement {
1314
@property({ type: Object, attribute: false })
14-
public get property(): UmbPropertyTypeModel | undefined {
15-
return this._property;
16-
}
1715
public set property(value: UmbPropertyTypeModel | undefined) {
1816
const oldProperty = this._property;
1917
this._property = value;
2018
if (this._property?.dataType.unique !== oldProperty?.dataType.unique) {
2119
this._observeDataType(this._property?.dataType.unique);
2220
}
2321
}
22+
public get property(): UmbPropertyTypeModel | undefined {
23+
return this._property;
24+
}
2425
private _property?: UmbPropertyTypeModel;
2526

2627
@property({ type: String, attribute: 'data-path' })
@@ -73,16 +74,19 @@ export class UmbPropertyTypeBasedPropertyElement extends UmbLitElement {
7374
}
7475

7576
override render() {
76-
return this._propertyEditorUiAlias && this._property?.alias
77-
? html`<umb-property
78-
.dataPath=${this.dataPath}
79-
.alias=${this._property.alias}
80-
.label=${this._property.name}
81-
.description=${this._property.description ?? undefined}
82-
.appearance=${this._property.appearance}
83-
property-editor-ui-alias=${ifDefined(this._propertyEditorUiAlias)}
84-
.config=${this._dataTypeData}></umb-property>`
85-
: '';
77+
if (!this._propertyEditorUiAlias || !this._property?.alias) return;
78+
return html`
79+
<umb-property
80+
.dataPath=${this.dataPath}
81+
.alias=${this._property.alias}
82+
.label=${this._property.name}
83+
.description=${this._property.description ?? undefined}
84+
.appearance=${this._property.appearance}
85+
property-editor-ui-alias=${ifDefined(this._propertyEditorUiAlias)}
86+
.config=${this._dataTypeData}
87+
.validation=${this._property.validation}>
88+
</umb-property>
89+
`;
8690
}
8791

8892
static override styles = [

0 commit comments

Comments
 (0)