|
1 | 1 | import type { UmbPropertyEditorConfig } from '../../../property-editor/index.js';
|
2 | 2 | import type { UmbPropertyTypeModel } from '../../types.js';
|
| 3 | +import { css, customElement, html, ifDefined, property, state } from '@umbraco-cms/backoffice/external/lit'; |
3 | 4 | import { UmbContentPropertyContext } from '@umbraco-cms/backoffice/content';
|
4 |
| -import type { UmbDataTypeDetailModel } from '@umbraco-cms/backoffice/data-type'; |
5 | 5 | 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'; |
8 | 7 | 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'; |
9 | 10 | import type { UmbObserverController } from '@umbraco-cms/backoffice/observable-api';
|
10 |
| -import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; |
| 11 | + |
11 | 12 | @customElement('umb-property-type-based-property')
|
12 | 13 | export class UmbPropertyTypeBasedPropertyElement extends UmbLitElement {
|
13 | 14 | @property({ type: Object, attribute: false })
|
14 |
| - public get property(): UmbPropertyTypeModel | undefined { |
15 |
| - return this._property; |
16 |
| - } |
17 | 15 | public set property(value: UmbPropertyTypeModel | undefined) {
|
18 | 16 | const oldProperty = this._property;
|
19 | 17 | this._property = value;
|
20 | 18 | if (this._property?.dataType.unique !== oldProperty?.dataType.unique) {
|
21 | 19 | this._observeDataType(this._property?.dataType.unique);
|
22 | 20 | }
|
23 | 21 | }
|
| 22 | + public get property(): UmbPropertyTypeModel | undefined { |
| 23 | + return this._property; |
| 24 | + } |
24 | 25 | private _property?: UmbPropertyTypeModel;
|
25 | 26 |
|
26 | 27 | @property({ type: String, attribute: 'data-path' })
|
@@ -73,16 +74,19 @@ export class UmbPropertyTypeBasedPropertyElement extends UmbLitElement {
|
73 | 74 | }
|
74 | 75 |
|
75 | 76 | 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 | + `; |
86 | 90 | }
|
87 | 91 |
|
88 | 92 | static override styles = [
|
|
0 commit comments