Skip to content

Commit

Permalink
Merge pull request #2411 from umbraco/v15/feature/property-type-cleanup
Browse files Browse the repository at this point in the history
Chore: Property Type Clean up
  • Loading branch information
madsrasmussen authored Oct 7, 2024
2 parents dadaecd + bf92222 commit 82bac3f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export class UmbBlockElementManager extends UmbControllerBase {
/**
* @function propertyValueByAlias
* @param {string} propertyAlias - Property Alias to observe the value of.
* @param {UmbVariantId | undefined} variantId - Optional variantId to filter by.
* @returns {Promise<Observable<ReturnType | undefined> | undefined>} - Promise which resolves to an Observable
* @description Get an Observable for the value of this property.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export class UmbPropertyTypeBasedPropertyElement extends UmbLitElement {
if (this._isUnsupported) {
return html`<umb-unsupported-property
.alias=${this._property.alias}
.ownerEntityType=${this._ownerEntityType}
.schema=${this._propertyEditorSchemaAlias!}></umb-unsupported-property>`;
}
return html`
Expand Down
28 changes: 14 additions & 14 deletions src/packages/core/property/property/property.context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class UmbPropertyContext<ValueType = any> extends UmbContextBase<UmbPrope

/**
* Set the alias of this property.
* @param {(string | undefined)} alias
* @param {string | undefined} alias - The alias of the property
* @memberof UmbPropertyContext
*/
public setAlias(alias: string | undefined): void {
Expand All @@ -174,7 +174,7 @@ export class UmbPropertyContext<ValueType = any> extends UmbContextBase<UmbPrope

/**
* Set the label of this property.
* @param {(string | undefined)} label
* @param {(string | undefined)} label - The label of the property
* @memberof UmbPropertyContext
*/
public setLabel(label: string | undefined): void {
Expand All @@ -183,7 +183,7 @@ export class UmbPropertyContext<ValueType = any> extends UmbContextBase<UmbPrope

/**
* Get the label of this property.
* @returns {*} {(string | undefined)}
* @returns {(string | undefined)} - the label
* @memberof UmbPropertyContext
*/
public getLabel(): string | undefined {
Expand All @@ -210,7 +210,7 @@ export class UmbPropertyContext<ValueType = any> extends UmbContextBase<UmbPrope

/**
* Set the appearance of this property.
* @param {(UmbPropertyTypeAppearanceModel | undefined)} appearance
* @param {UmbPropertyTypeAppearanceModel | undefined} appearance - the appearance properties of this property
* @memberof UmbPropertyContext
*/
public setAppearance(appearance: UmbPropertyTypeAppearanceModel | undefined): void {
Expand All @@ -219,7 +219,7 @@ export class UmbPropertyContext<ValueType = any> extends UmbContextBase<UmbPrope

/**
* Get the appearance of this property.
* @returns {*} {(UmbPropertyTypeAppearanceModel | undefined)}
* @returns {UmbPropertyTypeAppearanceModel | undefined}- the appearance properties of this property
* @memberof UmbPropertyContext
*/
public getAppearance(): UmbPropertyTypeAppearanceModel | undefined {
Expand All @@ -228,7 +228,7 @@ export class UmbPropertyContext<ValueType = any> extends UmbContextBase<UmbPrope

/**
* Set the value of this property.
* @param value {ValueType} the whole value to be set
* @param {unknown} value - the whole value to be set
*/
public setValue(value: ValueType | undefined): void {
const alias = this.#alias.getValue();
Expand All @@ -239,15 +239,15 @@ export class UmbPropertyContext<ValueType = any> extends UmbContextBase<UmbPrope
/**
* Gets the current value of this property.
* Notice this is not reactive, you should us the `value` observable for that.
* @returns {ValueType}
* @returns {unknown} - the current value of this property
*/
public getValue(): ValueType | undefined {
return this.#value.getValue();
}

/**
* Set the config of this property.
* @param {(Array<UmbPropertyEditorConfigProperty> | undefined)} config
* @param {Array<UmbPropertyEditorConfigProperty> | undefined} config - Array of configurations for this property
* @memberof UmbPropertyContext
*/
public setConfig(config: Array<UmbPropertyEditorConfigProperty> | undefined): void {
Expand All @@ -256,7 +256,7 @@ export class UmbPropertyContext<ValueType = any> extends UmbContextBase<UmbPrope

/**
* Get the config of this property.
* @returns {*} {(Array<UmbPropertyEditorConfigProperty> | undefined)}
* @returns {Array<UmbPropertyEditorConfigProperty> | undefined} - Array of configurations for this property
* @memberof UmbPropertyContext
*/
public getConfig(): Array<UmbPropertyEditorConfigProperty> | undefined {
Expand All @@ -265,7 +265,7 @@ export class UmbPropertyContext<ValueType = any> extends UmbContextBase<UmbPrope

/**
* Set the variant ID of this property.
* @param {(UmbVariantId | undefined)} variantId
* @param {UmbVariantId | undefined} variantId - The property Variant ID, not necessary the same as the Property Dataset Context VariantId.
* @memberof UmbPropertyContext
*/
public setVariantId(variantId: UmbVariantId | undefined): void {
Expand All @@ -274,7 +274,7 @@ export class UmbPropertyContext<ValueType = any> extends UmbContextBase<UmbPrope

/**
* Get the variant ID of this property.
* @returns {*} {(UmbVariantId | undefined)}
* @returns {UmbVariantId | undefined} - The property Variant ID, not necessary the same as the Property Dataset Context VariantId.
* @memberof UmbPropertyContext
*/
public getVariantId(): UmbVariantId | undefined {
Expand All @@ -283,7 +283,7 @@ export class UmbPropertyContext<ValueType = any> extends UmbContextBase<UmbPrope

/**
* Set the validation of this property.
* @param {(UmbPropertyTypeValidationModel | undefined)} validation
* @param {UmbPropertyTypeValidationModel | undefined} validation - Object holding the Validation Properties.
* @memberof UmbPropertyContext
*/
public setValidation(validation: UmbPropertyTypeValidationModel | undefined): void {
Expand All @@ -292,7 +292,7 @@ export class UmbPropertyContext<ValueType = any> extends UmbContextBase<UmbPrope

/**
* Get the validation of this property.
* @returns {*} {(UmbPropertyTypeValidationModel | undefined)}
* @returns {UmbPropertyTypeValidationModel | undefined} - Object holding the Validation Properties.
* @memberof UmbPropertyContext
*/
public getValidation(): UmbPropertyTypeValidationModel | undefined {
Expand All @@ -301,7 +301,7 @@ export class UmbPropertyContext<ValueType = any> extends UmbContextBase<UmbPrope

/**
* Get the read only state of this property
* @returns {*} {boolean}
* @returns {boolean} - If property is in read-only mode.
* @memberof UmbPropertyContext
*/
public getIsReadOnly(): boolean {
Expand Down
18 changes: 8 additions & 10 deletions src/packages/core/property/property/property.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export class UmbPropertyElement extends UmbLitElement {
/**
* Label. Name of the property
* @type {string}
* @attr
* @default
*/
@property({ type: String })
Expand All @@ -46,7 +45,6 @@ export class UmbPropertyElement extends UmbLitElement {
/**
* Description: render a description underneath the label.
* @type {string}
* @attr
* @default
*/
@property({ type: String })
Expand All @@ -72,7 +70,6 @@ export class UmbPropertyElement extends UmbLitElement {
* Alias
* @public
* @type {string}
* @attr
* @default
*/
@property({ type: String })
Expand All @@ -87,7 +84,6 @@ export class UmbPropertyElement extends UmbLitElement {
* Property Editor UI Alias. Render the Property Editor UI registered for this alias.
* @public
* @type {string}
* @attr
* @default
*/
@property({ type: String, attribute: 'property-editor-ui-alias' })
Expand All @@ -104,7 +100,6 @@ export class UmbPropertyElement extends UmbLitElement {
* Config. Configuration to pass to the Property Editor UI. This is also the configuration data stored on the Data Type.
* @public
* @type {string}
* @attr
* @default
*/
@property({ type: Array, attribute: false })
Expand All @@ -130,7 +125,6 @@ export class UmbPropertyElement extends UmbLitElement {
* DataPath, declare the path to the value of the data that this property represents.
* @public
* @type {string}
* @attr
* @default
*/
@property({ type: String, attribute: 'data-path' })
Expand Down Expand Up @@ -235,10 +229,14 @@ export class UmbPropertyElement extends UmbLitElement {
null,
);

this.observe(this.#propertyContext.isReadOnly, (value) => {
this._isReadOnly = value;
this._element?.toggleAttribute('readonly', value);
});
this.observe(
this.#propertyContext.isReadOnly,
(value) => {
this._isReadOnly = value;
this._element?.toggleAttribute('readonly', value);
},
null,
);
}

private _onPropertyEditorChange = (e: CustomEvent): void => {
Expand Down

0 comments on commit 82bac3f

Please sign in to comment.