Bugfix: Allow/disallow multiple files for dropzone (#2429)

* Bugfix: Allow/disallow multiple files for dropzone

---------

Co-authored-by: Nikolaj Brask-Nielsen <nikolajgive@gmail.com>
This commit is contained in:
Lone Iversen
2024-10-09 08:31:33 +02:00
committed by GitHub
parent 5173ff4de9
commit 0e07decfd8
4 changed files with 6 additions and 5 deletions

View File

@@ -54,6 +54,7 @@ export class UmbMediaCollectionElement extends UmbCollectionDefaultElement {
<umb-media-collection-toolbar slot="header"></umb-media-collection-toolbar> <umb-media-collection-toolbar slot="header"></umb-media-collection-toolbar>
${when(this._progress >= 0, () => html`<uui-loader-bar progress=${this._progress}></uui-loader-bar>`)} ${when(this._progress >= 0, () => html`<uui-loader-bar progress=${this._progress}></uui-loader-bar>`)}
<umb-dropzone <umb-dropzone
multiple
.parentUnique=${this._unique} .parentUnique=${this._unique}
@complete=${this.#onComplete} @complete=${this.#onComplete}
@progress=${this.#onProgress}></umb-dropzone> @progress=${this.#onProgress}></umb-dropzone>

View File

@@ -346,7 +346,7 @@ export class UmbInputRichMediaElement extends UUIFormControlMixin(UmbLitElement,
#renderDropzone() { #renderDropzone() {
if (this.readonly) return nothing; if (this.readonly) return nothing;
if (this._cards && this._cards.length >= this.max) return; if (this._cards && this._cards.length >= this.max) return;
return html`<umb-dropzone @complete=${this.#onUploadCompleted}></umb-dropzone>`; return html`<umb-dropzone ?multiple=${this.max > 1} @complete=${this.#onUploadCompleted}></umb-dropzone>`;
} }
#renderItems() { #renderItems() {

View File

@@ -9,15 +9,15 @@ export class UmbDropzoneElement extends UmbLitElement {
@property({ attribute: false }) @property({ attribute: false })
parentUnique: string | null = null; parentUnique: string | null = null;
@property({ type: Boolean })
multiple: boolean = true;
@property({ type: Boolean }) @property({ type: Boolean })
createAsTemporary: boolean = false; createAsTemporary: boolean = false;
@property({ type: String }) @property({ type: String })
accept?: string; accept?: string;
@property({ type: Boolean, reflect: true })
multiple: boolean = false;
@property({ type: Boolean, reflect: true }) @property({ type: Boolean, reflect: true })
disabled = false; disabled = false;

View File

@@ -168,7 +168,7 @@ export class UmbMediaPickerModalElement extends UmbModalBaseElement<
#renderBody() { #renderBody() {
return html`${this.#renderToolbar()} return html`${this.#renderToolbar()}
<umb-dropzone id="dropzone" @complete=${() => this.#loadMediaFolder()} .parentUnique=${this._currentMediaEntity.unique}></umb-dropzone> <umb-dropzone id="dropzone" multiple @complete=${() => this.#loadMediaFolder()} .parentUnique=${this._currentMediaEntity.unique}></umb-dropzone>
${ ${
!this._mediaFilteredList.length !this._mediaFilteredList.length
? html`<div class="container"><p>${this.localize.term('content_listViewNoItems')}</p></div>` ? html`<div class="container"><p>${this.localize.term('content_listViewNoItems')}</p></div>`