Skip to content

Commit 0442b9e

Browse files
authored
additional context name for 'content property context' (#19375)
rename to UmbPropertyTypeBasedPropertyContext
1 parent 62cedee commit 0442b9e

File tree

6 files changed

+32
-16
lines changed

6 files changed

+32
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
export * from './property-type-based-property.element.js';
2+
export * from './property-type-based-property.context-token.js';
3+
export * from './property-type-based-property.context.js';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type { UmbPropertyTypeBasedPropertyContext } from './property-type-based-property.context.js';
2+
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
3+
4+
export const UMB_PROPERTY_TYPE_BASED_PROPERTY_CONTEXT = new UmbContextToken<UmbPropertyTypeBasedPropertyContext>(
5+
'UmbPropertyTypeBasedPropertyContext',
6+
);
7+
8+
/**
9+
* @deprecated Use `UMB_PROPERTY_TYPE_BASED_PROPERTY_CONTEXT` instead.
10+
* This will be removed in v.18
11+
*/
12+
export const UMB_CONTENT_PROPERTY_CONTEXT = new UmbContextToken<UmbPropertyTypeBasedPropertyContext>(
13+
'UmbContentPropertyContext',
14+
);
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
import { UMB_CONTENT_PROPERTY_CONTEXT } from './content-property.context-token.js';
1+
import { UMB_PROPERTY_TYPE_BASED_PROPERTY_CONTEXT } from './property-type-based-property.context-token.js';
22
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
33
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
44
import { UmbObjectState } from '@umbraco-cms/backoffice/observable-api';
55
import type { UmbPropertyTypeModel } from '@umbraco-cms/backoffice/content-type';
66

7-
export class UmbContentPropertyContext extends UmbContextBase {
7+
export class UmbPropertyTypeBasedPropertyContext extends UmbContextBase {
88
#dataType = new UmbObjectState<UmbPropertyTypeModel['dataType'] | undefined>(undefined);
99
dataType = this.#dataType.asObservable();
1010

1111
constructor(host: UmbControllerHost) {
12-
super(host, UMB_CONTENT_PROPERTY_CONTEXT);
12+
super(host, UMB_PROPERTY_TYPE_BASED_PROPERTY_CONTEXT);
1313
}
1414

1515
setDataType(dataType: UmbPropertyTypeModel['dataType'] | undefined) {
1616
this.#dataType.setValue(dataType);
1717
}
1818
}
19+
20+
/**
21+
* @deprecated Use `UmbPropertyTypeBasedPropertyContext` instead.
22+
* This will be removed in v.18
23+
*/
24+
export { UmbPropertyTypeBasedPropertyContext as UmbContentPropertyContext };

src/Umbraco.Web.UI.Client/src/packages/content/content/components/property-type-based-property/property-type-based-property.element.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UmbContentPropertyContext } from '../../content-property.context.js';
1+
import { UmbPropertyTypeBasedPropertyContext } from './property-type-based-property.context.js';
22
import type { UmbPropertyEditorConfig } from '@umbraco-cms/backoffice/property-editor';
33
import { css, customElement, html, ifDefined, property, state } from '@umbraco-cms/backoffice/external/lit';
44
import { UmbDataTypeDetailRepository } from '@umbraco-cms/backoffice/data-type';
@@ -57,17 +57,18 @@ export class UmbPropertyTypeBasedPropertyElement extends UmbLitElement {
5757
private _isUnsupported?: boolean;
5858

5959
@state()
60-
private _dataTypeData?: UmbPropertyEditorConfig;
60+
private _dataTypeValues?: UmbPropertyEditorConfig;
6161

6262
private _dataTypeDetailRepository = new UmbDataTypeDetailRepository(this);
6363
private _dataTypeObserver?: UmbObserverController<UmbDataTypeDetailModel | undefined>;
6464

65-
#contentPropertyContext = new UmbContentPropertyContext(this);
65+
#context = new UmbPropertyTypeBasedPropertyContext(this);
6666

6767
private async _checkSchemaSupport() {
6868
if (!this._ownerEntityType || !this._propertyEditorSchemaAlias) return;
6969

7070
if (this._ownerEntityType in UMB_UNSUPPORTED_EDITOR_SCHEMA_ALIASES) {
71+
// TODO: We should get rid of this system, f your reading this please dont rely on this, we will get rid of it in the future. [NL]
7172
this._isUnsupported = UMB_UNSUPPORTED_EDITOR_SCHEMA_ALIASES[this._ownerEntityType].includes(
7273
this._propertyEditorSchemaAlias,
7374
);
@@ -83,9 +84,9 @@ export class UmbPropertyTypeBasedPropertyElement extends UmbLitElement {
8384
await this._dataTypeDetailRepository.byUnique(dataTypeUnique),
8485
(dataType) => {
8586
const contextValue = dataType ? { unique: dataType.unique } : undefined;
86-
this.#contentPropertyContext.setDataType(contextValue);
87+
this.#context.setDataType(contextValue);
8788

88-
this._dataTypeData = dataType?.values;
89+
this._dataTypeValues = dataType?.values;
8990
this._propertyEditorUiAlias = dataType?.editorUiAlias || undefined;
9091
this._propertyEditorSchemaAlias = dataType?.editorAlias || undefined;
9192
this._checkSchemaSupport();
@@ -127,7 +128,7 @@ export class UmbPropertyTypeBasedPropertyElement extends UmbLitElement {
127128
.description=${this._property.description ?? undefined}
128129
.appearance=${this._property.appearance}
129130
property-editor-ui-alias=${ifDefined(this._propertyEditorUiAlias)}
130-
.config=${this._dataTypeData}
131+
.config=${this._dataTypeValues}
131132
.validation=${this._property.validation}
132133
?readonly=${this.readonly}>
133134
</umb-property>

src/Umbraco.Web.UI.Client/src/packages/content/content/content-property.context-token.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/Umbraco.Web.UI.Client/src/packages/content/content/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
export { UMB_CONTENT_PROPERTY_CONTEXT } from './content-property.context-token.js';
2-
export { UmbContentPropertyContext } from './content-property.context.js';
3-
41
export * from './collection/index.js';
52
export * from './components/index.js';
63
export * from './constants.js';

0 commit comments

Comments
 (0)