apply scaffold model + add null checks for dataType

This commit is contained in:
Mads Rasmussen
2024-01-30 15:34:28 +01:00
parent 539e0bf06b
commit d571b136fd
4 changed files with 11 additions and 12 deletions

View File

@@ -5,10 +5,9 @@ import { css, html, customElement, state, repeat, when } from '@umbraco-cms/back
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import type {
UmbDataTypePickerFlowDataTypePickerModalData,
UmbDataTypePickerFlowDataTypePickerModalValue} from '@umbraco-cms/backoffice/modal';
import {
UmbModalBaseElement,
UmbDataTypePickerFlowDataTypePickerModalValue,
} from '@umbraco-cms/backoffice/modal';
import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
@customElement('umb-data-type-picker-flow-data-type-picker-modal')
export class UmbDataTypePickerFlowDataTypePickerModalElement extends UmbModalBaseElement<

View File

@@ -182,7 +182,7 @@ export class UmbDocumentTypeWorkspaceViewEditPropertiesElement extends UmbLitEle
);
return html`<umb-document-type-workspace-view-edit-property
data-umb-property-id=${ifDefined(property.id)}
data-umb-property-id=${property.id}
owner-document-type-id=${ifDefined(inheritedFromDocument?.unique)}
owner-document-type-name=${ifDefined(inheritedFromDocument?.name)}
?inherited=${property.container?.id !== this.containerId}

View File

@@ -13,7 +13,7 @@ import {
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
import { generateAlias } from '@umbraco-cms/backoffice/utils';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import type { UmbPropertyTypeModel } from '@umbraco-cms/backoffice/content-type';
import type { UmbPropertyTypeModel, UmbPropertyTypeScaffoldModel } from '@umbraco-cms/backoffice/content-type';
/**
* @element umb-document-type-workspace-view-edit-property
@@ -22,22 +22,22 @@ import type { UmbPropertyTypeModel } from '@umbraco-cms/backoffice/content-type'
*/
@customElement('umb-document-type-workspace-view-edit-property')
export class UmbDocumentTypeWorkspacePropertyElement extends UmbLitElement {
private _property?: UmbPropertyTypeModel | undefined;
private _property?: UmbPropertyTypeModel | UmbPropertyTypeScaffoldModel | undefined;
/**
* Property, the data object for the property.
* @type {UmbPropertyTypeModel}
* @type {UmbPropertyTypeModel | UmbPropertyTypeScaffoldModel | undefined}
* @attr
* @default undefined
*/
@property({ type: Object })
public get property(): UmbPropertyTypeModel | undefined {
public get property(): UmbPropertyTypeModel | UmbPropertyTypeScaffoldModel | undefined {
return this._property;
}
public set property(value: UmbPropertyTypeModel | undefined) {
public set property(value: UmbPropertyTypeModel | UmbPropertyTypeScaffoldModel | undefined) {
const oldValue = this._property;
this._property = value;
this.#modalRegistration.setUniquePathValue('propertyId', value?.id?.toString());
this.setDataType(this._property?.dataType.unique);
this.setDataType(this._property?.dataType?.unique);
this.requestUpdate('property', oldValue);
}
@@ -295,7 +295,7 @@ export class UmbDocumentTypeWorkspacePropertyElement extends UmbLitElement {
renderPropertyTags() {
return this.property
? html`<div class="types">
${this.property.dataType.unique ? html`<uui-tag look="default">${this._dataTypeName}</uui-tag>` : nothing}
${this.property.dataType?.unique ? html`<uui-tag look="default">${this._dataTypeName}</uui-tag>` : nothing}
${this.property.variesByCulture
? html`<uui-tag look="default">
<uui-icon name="icon-shuffle"></uui-icon> ${this.localize.term('contentTypeEditor_cultureVariantLabel')}

View File

@@ -295,7 +295,7 @@ export class UmbMediaTypeWorkspacePropertyElement extends UmbLitElement {
renderPropertyTags() {
return this.property
? html`<div class="types">
${this.property.dataType.unique ? html`<uui-tag look="default">${this._dataTypeName}</uui-tag>` : nothing}
${this.property.dataType?.unique ? html`<uui-tag look="default">${this._dataTypeName}</uui-tag>` : nothing}
${this.property.variesByCulture
? html`<uui-tag look="default">
<uui-icon name="icon-shuffle"></uui-icon> ${this.localize.term('contentTypeEditor_cultureVariantLabel')}