corrected to new field names
This commit is contained in:
committed by
Jacob Overgaard
parent
0053577d7d
commit
0a38673a21
@@ -39,12 +39,12 @@ export class UmbPropertyTypeBasedPropertyElement extends UmbLitElement {
|
||||
await this._dataTypeDetailRepository.byUnique(dataTypeUnique),
|
||||
(dataType) => {
|
||||
this._dataTypeData = dataType?.values;
|
||||
this._propertyEditorUiAlias = dataType?.propertyEditorUiAlias || undefined;
|
||||
this._propertyEditorUiAlias = dataType?.editorUiAlias || undefined;
|
||||
// If there is no UI, we will look up the Property editor model to find the default UI alias:
|
||||
if (!this._propertyEditorUiAlias && dataType?.propertyEditorAlias) {
|
||||
//use 'dataType.propertyEditorAlias' to look up the extension in the registry:
|
||||
if (!this._propertyEditorUiAlias && dataType?.editorAlias) {
|
||||
//use 'dataType.editorAlias' to look up the extension in the registry:
|
||||
this.observe(
|
||||
umbExtensionsRegistry.getByTypeAndAlias('propertyEditorSchema', dataType.propertyEditorAlias),
|
||||
umbExtensionsRegistry.getByTypeAndAlias('propertyEditorSchema', dataType.editorAlias),
|
||||
(extension) => {
|
||||
if (!extension) return;
|
||||
this._propertyEditorUiAlias = extension?.meta.defaultPropertyEditorUiAlias;
|
||||
|
||||
@@ -28,8 +28,8 @@ export class UmbRefDataTypeElement extends UmbElementMixin(UUIRefNodeElement) {
|
||||
(dataType) => {
|
||||
if (dataType) {
|
||||
this.name = dataType.name ?? '';
|
||||
this.propertyEditorUiAlias = dataType.propertyEditorUiAlias ?? '';
|
||||
this.propertyEditorSchemaAlias = dataType.propertyEditorAlias ?? '';
|
||||
this.propertyEditorUiAlias = dataType.editorUiAlias ?? '';
|
||||
this.propertyEditorSchemaAlias = dataType.editorAlias ?? '';
|
||||
}
|
||||
},
|
||||
'dataType',
|
||||
|
||||
@@ -39,8 +39,8 @@ export class UmbDataTypeServerDataSource implements UmbDetailDataSource<UmbDataT
|
||||
unique: UmbId.new(),
|
||||
parentUnique,
|
||||
name: '',
|
||||
propertyEditorAlias: undefined,
|
||||
propertyEditorUiAlias: null,
|
||||
editorAlias: undefined,
|
||||
editorUiAlias: null,
|
||||
values: [],
|
||||
};
|
||||
|
||||
@@ -68,8 +68,8 @@ export class UmbDataTypeServerDataSource implements UmbDetailDataSource<UmbDataT
|
||||
unique: data.id,
|
||||
parentUnique: data.parentId || null,
|
||||
name: data.name,
|
||||
propertyEditorAlias: data.editorAlias,
|
||||
propertyEditorUiAlias: data.editorUiAlias || null,
|
||||
editorAlias: data.editorAlias,
|
||||
editorUiAlias: data.editorUiAlias || null,
|
||||
values: data.values as Array<UmbDataTypePropertyModel>,
|
||||
};
|
||||
|
||||
@@ -85,15 +85,15 @@ export class UmbDataTypeServerDataSource implements UmbDetailDataSource<UmbDataT
|
||||
async create(dataType: UmbDataTypeDetailModel) {
|
||||
if (!dataType) throw new Error('Data Type is missing');
|
||||
if (!dataType.unique) throw new Error('Data Type unique is missing');
|
||||
if (!dataType.propertyEditorAlias) throw new Error('Property Editor Alias is missing');
|
||||
if (!dataType.editorAlias) throw new Error('Property Editor Alias is missing');
|
||||
|
||||
// TODO: make data mapper to prevent errors
|
||||
const requestBody: CreateDataTypeRequestModel = {
|
||||
id: dataType.unique,
|
||||
parentId: dataType.parentUnique,
|
||||
name: dataType.name,
|
||||
editorAlias: dataType.propertyEditorAlias,
|
||||
editorUiAlias: dataType.propertyEditorUiAlias,
|
||||
editorAlias: dataType.editorAlias,
|
||||
editorUiAlias: dataType.editorUiAlias,
|
||||
values: dataType.values,
|
||||
};
|
||||
|
||||
@@ -120,13 +120,13 @@ export class UmbDataTypeServerDataSource implements UmbDetailDataSource<UmbDataT
|
||||
*/
|
||||
async update(data: UmbDataTypeDetailModel) {
|
||||
if (!data.unique) throw new Error('Unique is missing');
|
||||
if (!data.propertyEditorAlias) throw new Error('Property Editor Alias is missing');
|
||||
if (!data.editorAlias) throw new Error('Property Editor Alias is missing');
|
||||
|
||||
// TODO: make data mapper to prevent errors
|
||||
const requestBody: DataTypeModelBaseModel = {
|
||||
name: data.name,
|
||||
editorAlias: data.propertyEditorAlias,
|
||||
editorUiAlias: data.propertyEditorUiAlias,
|
||||
editorAlias: data.editorAlias,
|
||||
editorUiAlias: data.editorUiAlias,
|
||||
values: data.values,
|
||||
};
|
||||
|
||||
|
||||
@@ -21,9 +21,7 @@ export class UmbDataTypeDetailStore extends UmbDetailStoreBase<UmbDataTypeDetail
|
||||
|
||||
withPropertyEditorUiAlias(propertyEditorUiAlias: string) {
|
||||
// TODO: Use a model for the data-type tree items: ^^Most likely it should be parsed to the UmbEntityTreeStore as a generic type.
|
||||
return this._data.asObservablePart((items) =>
|
||||
items.filter((item) => item.propertyEditorUiAlias === propertyEditorUiAlias),
|
||||
);
|
||||
return this._data.asObservablePart((items) => items.filter((item) => item.editorUiAlias === propertyEditorUiAlias));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ export interface UmbDataTypeDetailModel {
|
||||
unique: string;
|
||||
parentUnique: string | null;
|
||||
name: string;
|
||||
propertyEditorAlias: string | undefined;
|
||||
propertyEditorUiAlias: string | null;
|
||||
editorAlias: string | undefined;
|
||||
editorUiAlias: string | null;
|
||||
values: Array<UmbDataTypePropertyModel>;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ export class UmbDataTypeWorkspaceContext
|
||||
readonly name = this.#data.asObservablePart((data) => data?.name);
|
||||
readonly unique = this.#data.asObservablePart((data) => data?.unique);
|
||||
|
||||
readonly propertyEditorUiAlias = this.#data.asObservablePart((data) => data?.propertyEditorUiAlias);
|
||||
readonly propertyEditorSchemaAlias = this.#data.asObservablePart((data) => data?.propertyEditorAlias);
|
||||
readonly propertyEditorUiAlias = this.#data.asObservablePart((data) => data?.editorUiAlias);
|
||||
readonly propertyEditorSchemaAlias = this.#data.asObservablePart((data) => data?.editorAlias);
|
||||
|
||||
#properties = new UmbArrayState<PropertyEditorConfigProperty>([], (x) => x.alias);
|
||||
readonly properties = this.#properties.asObservable();
|
||||
@@ -231,10 +231,10 @@ export class UmbDataTypeWorkspaceContext
|
||||
}
|
||||
|
||||
setPropertyEditorSchemaAlias(alias?: string) {
|
||||
this.#data.update({ propertyEditorAlias: alias });
|
||||
this.#data.update({ editorAlias: alias });
|
||||
}
|
||||
setPropertyEditorUiAlias(alias?: string) {
|
||||
this.#data.update({ propertyEditorUiAlias: alias });
|
||||
this.#data.update({ editorUiAlias: alias });
|
||||
}
|
||||
|
||||
async propertyValueByAlias<ReturnType = unknown>(propertyAlias: string) {
|
||||
|
||||
@@ -41,11 +41,11 @@ export class UmbWorkspaceViewDataTypeInfoElement extends UmbLitElement implement
|
||||
<div slot="editor">${this._dataType?.unique}</div>
|
||||
</umb-property-layout>
|
||||
<umb-property-layout label="Property Editor Alias">
|
||||
<div slot="editor">${this._dataType?.propertyEditorAlias}</div>
|
||||
<div slot="editor">${this._dataType?.editorAlias}</div>
|
||||
</umb-property-layout>
|
||||
|
||||
<umb-property-layout label="Property Editor UI Alias">
|
||||
<div slot="editor">${this._dataType?.propertyEditorUiAlias}</div>
|
||||
<div slot="editor">${this._dataType?.editorUiAlias}</div>
|
||||
</umb-property-layout>
|
||||
</uui-box>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user