Skip to content

Commit

Permalink
Merge pull request #2030 from umbraco/v14/feature/umb-property-editor…
Browse files Browse the repository at this point in the history
…-ui-number-readonly-mode

Feature: Readonly mode for Number Property Editor UI
  • Loading branch information
loivsen authored Jun 24, 2024
2 parents f7cc880 + 82a8e7d commit 5fe32ba
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ export class UmbPropertyEditorUINumberElement extends UmbLitElement implements U
@property({ type: Number })
value?: number;

/**
* 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()
private _max?: number;

Expand Down Expand Up @@ -48,7 +57,8 @@ export class UmbPropertyEditorUINumberElement extends UmbLitElement implements U
step=${ifDefined(this._step)}
placeholder=${ifDefined(this._placeholder)}
.value=${this.value ?? (this._placeholder ? undefined : 0)}
@input=${this.#onInput}>
@input=${this.#onInput}
?readonly=${this.readonly}>
</uui-input>
`;
}
Expand Down

0 comments on commit 5fe32ba

Please sign in to comment.