minor optimizations

This commit is contained in:
Niels Lyngsø
2024-04-16 10:45:05 +02:00
parent e5389d9534
commit d787617deb
2 changed files with 12 additions and 5 deletions

View File

@@ -91,8 +91,8 @@ export class UmbContentTypeDesignEditorPropertiesElement extends UmbLitElement {
return this._containerId;
}
public set containerId(value: string | null | undefined) {
if (value === this._containerId) return;
const oldValue = this._containerId;
if (value === oldValue) return;
this._containerId = value;
this.#propertyStructureHelper.setContainerId(value);
this.#addPropertyModal.setUniquePathValue('container-id', value === null ? 'root' : value);

View File

@@ -23,8 +23,8 @@ import {
export class UmbContentTypeDesignEditorPropertyElement extends UmbLitElement {
//
#dataTypeDetailRepository = new UmbDataTypeDetailRepository(this);
#settingsModal;
#dataTypeUnique?: string;
@property({ attribute: false })
public set propertyStructureHelper(value: UmbContentTypePropertyStructureHelper<UmbContentTypeModel> | undefined) {
@@ -49,6 +49,7 @@ export class UmbContentTypeDesignEditorPropertyElement extends UmbLitElement {
}
public set property(value: UmbPropertyTypeModel | UmbPropertyTypeScaffoldModel | undefined) {
const oldValue = this._property;
if (value === oldValue) return;
this._property = value;
this.#checkInherited();
this.#settingsModal.setUniquePathValue('propertyId', value?.id);
@@ -141,9 +142,15 @@ export class UmbContentTypeDesignEditorPropertyElement extends UmbLitElement {
this._aliasLocked = !this._aliasLocked;
}
async #setDataType(dataTypeId: string | undefined) {
if (!dataTypeId) return;
this.#dataTypeDetailRepository.requestByUnique(dataTypeId).then((x) => (this._dataTypeName = x?.data?.name));
async #setDataType(dataTypeUnique: string | undefined) {
if (!dataTypeUnique) {
this._dataTypeName = undefined;
this.#dataTypeUnique = undefined;
return;
}
if (dataTypeUnique === this.#dataTypeUnique) return;
this.#dataTypeUnique = dataTypeUnique;
this.#dataTypeDetailRepository.requestByUnique(dataTypeUnique).then((x) => (this._dataTypeName = x?.data?.name));
}
async #requestRemove(e: Event) {