-
Notifications
You must be signed in to change notification settings - Fork 58
Adds read-only mode to Color Picker Property Editor #2451
Changes from all commits
7388e45
fcbe11a
22cc787
87628b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,14 @@ export class UmbInputColorElement extends UUIFormControlMixin(UmbLitElement, '') | |
| return undefined; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content. | ||
| * @attr | ||
| * @default false | ||
| */ | ||
| @property({ type: Boolean, reflect: true }) | ||
| readonly = false; | ||
|
|
||
| @property({ type: Boolean }) | ||
| showLabels = false; | ||
|
|
||
|
|
@@ -28,7 +36,11 @@ export class UmbInputColorElement extends UUIFormControlMixin(UmbLitElement, '') | |
|
|
||
| override render() { | ||
| return html` | ||
| <uui-color-swatches label="Color picker" value=${this.value ?? ''} @change=${this.#onChange}> | ||
| <uui-color-swatches | ||
| ?readonly=${this.readonly} | ||
| label="Color picker" | ||
| value=${this.value ?? ''} | ||
| @change=${this.#onChange}> | ||
| ${this.#renderColors()} | ||
| </uui-color-swatches> | ||
| `; | ||
|
|
@@ -39,7 +51,11 @@ export class UmbInputColorElement extends UUIFormControlMixin(UmbLitElement, '') | |
| return map( | ||
| this.swatches, | ||
| (swatch) => html` | ||
| <uui-color-swatch label=${swatch.label} value=${swatch.value} .showLabel=${this.showLabels}></uui-color-swatch> | ||
| <uui-color-swatch | ||
| ?readonly=${this.readonly} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @iOvergaard does it need to set this as
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't set
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bjarnef Good point, but it doesn't look like it's hurting anything setting disabled explicitly. Would you like to make a PR with the disabled attribute?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess I guess we may need an |
||
| label=${swatch.label} | ||
| value=${swatch.value} | ||
| .showLabel=${this.showLabels}></uui-color-swatch> | ||
| `, | ||
| ); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.