Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Readonly mode for Slider Property Editor UI #2220

Merged
merged 3 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/packages/core/components/input-slider/input-slider.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export class UmbInputSliderElement extends UUIFormControlMixin(UmbLitElement, ''
@property({ type: Boolean, attribute: 'enable-range' })
enableRange = false;

/**
* Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
* @type {boolean}
* @attr
* @default false
*/
@property({ type: Boolean, reflect: true })
readonly = false;

protected override getFormElement() {
return undefined;
}
Expand All @@ -45,7 +54,8 @@ export class UmbInputSliderElement extends UUIFormControlMixin(UmbLitElement, ''
.max=${this.max}
.step=${this.step}
.value=${this.valueLow.toString()}
@change=${this.#onChange}>
@change=${this.#onChange}
?readonly=${this.readonly}>
</uui-slider>
`;
}
Expand All @@ -57,7 +67,8 @@ export class UmbInputSliderElement extends UUIFormControlMixin(UmbLitElement, ''
.max=${this.max}
.step=${this.step}
.value="${this.valueLow},${this.valueHigh}"
@change=${this.#onChange}>
@change=${this.#onChange}
?readonly=${this.readonly}>
</uui-range-slider>
`;
}
Expand Down
1 change: 1 addition & 0 deletions src/packages/property-editors/slider/manifests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const manifests: Array<ManifestTypes> = [
propertyEditorSchemaAlias: 'Umbraco.Slider',
icon: 'icon-navigation-horizontal',
group: 'common',
supportsReadOnly: true,
settings: {
properties: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ export class UmbPropertyEditorUISliderElement extends UmbLitElement implements U
@property({ type: Object })
value: UmbSliderValue | undefined;

/**
* Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
* @type {boolean}
* @attr
* @default false
*/
@property({ type: Boolean, reflect: true })
readonly = false;

@state()
_enableRange = false;

Expand Down Expand Up @@ -82,7 +91,8 @@ export class UmbPropertyEditorUISliderElement extends UmbLitElement implements U
.min=${this._min}
.max=${this._max}
?enable-range=${this._enableRange}
@change=${this.#onChange}>
@change=${this.#onChange}
?readonly=${this.readonly}>
</umb-input-slider>
`;
}
Expand Down
Loading