a few more corrections

This commit is contained in:
Niels Lyngsø
2024-03-18 22:12:25 +01:00
parent 6372fa7e52
commit 25996a407e
3 changed files with 14 additions and 12 deletions

View File

@@ -26,7 +26,6 @@ export class UmbPropertyEditorUIDatePickerElement extends UmbLitElement implemen
this._valueString = undefined;
}
}
get value() {
return this._valueString;
}

View File

@@ -14,12 +14,12 @@ export class UmbInputStaticFileElement extends FormControlMixin(UmbLitElement) {
* @default 0
*/
@property({ type: Number })
public get min(): number {
return this.#pickerContext.min;
}
public set min(value: number) {
this.#pickerContext.min = value;
}
public get min(): number {
return this.#pickerContext.min;
}
/**
* Min validation message.
@@ -37,12 +37,12 @@ export class UmbInputStaticFileElement extends FormControlMixin(UmbLitElement) {
* @default Infinity
*/
@property({ type: Number })
public get max(): number {
return this.#pickerContext.max;
}
public set max(value: number) {
this.#pickerContext.max = value;
}
public get max(): number {
return this.#pickerContext.max;
}
/**
* Max validation message.
@@ -53,12 +53,12 @@ export class UmbInputStaticFileElement extends FormControlMixin(UmbLitElement) {
@property({ type: String, attribute: 'min-message' })
maxMessage = 'This field exceeds the allowed amount of files';
public get selection(): Array<string> {
return this.#pickerContext.getSelection();
}
public set selection(paths: Array<string>) {
this.#pickerContext.setSelection(paths);
}
public get selection(): Array<string> {
return this.#pickerContext.getSelection();
}
@property()
// get value is handled by super class.
@@ -66,6 +66,9 @@ export class UmbInputStaticFileElement extends FormControlMixin(UmbLitElement) {
// Its with full purpose we don't call super.value, as thats being handled by the observation of the context selection.
this.selection = splitStringToArray(pathsString);
}
public get value(): string {
return this.selection.join(',');
}
@state()
private _items?: Array<UmbStaticFileItemModel>;

View File

@@ -20,8 +20,8 @@ describe('UmbInputStaticFileElement', () => {
describe('Public API', () => {
describe('properties', () => {
it('has a selectedPaths property', () => {
expect(element).to.have.property('selectedPaths').to.be.an.instanceOf(Array);
it('has a selection property', () => {
expect(element).to.have.property('selection').to.be.an.instanceOf(Array);
});
it('has a value property', () => {