disable sorter when readonly

This commit is contained in:
Mads Rasmussen
2024-08-21 14:37:05 +02:00
parent 3443b67b1c
commit c4a043274b

View File

@@ -117,15 +117,6 @@ export class UmbInputRichMediaElement extends UUIFormControlMixin(UmbLitElement,
@property({ type: Boolean })
multiple = 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;
@property()
public override get value() {
return this.items?.map((item) => item.mediaKey).join(',');
@@ -159,6 +150,27 @@ export class UmbInputRichMediaElement extends UUIFormControlMixin(UmbLitElement,
return this.#modalRouter.getUniquePathValue('variantId');
}
/**
* 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 })
public get readonly() {
return this.#readonly;
}
public set readonly(value) {
this.#readonly = value;
if (this.#readonly) {
this.#sorter.disable();
} else {
this.#sorter.enable();
}
}
#readonly = false;
@state()
private _cards: Array<UmbRichMediaCardModel> = [];