uploadpackage.src.vaadin-upload-file-list-mixin.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vaadin-webcomponents Show documentation
Show all versions of vaadin-webcomponents Show documentation
Mvnpm composite: Vaadin webcomponents
The newest version!
/**
* @license
* Copyright (c) 2016 - 2024 Vaadin Ltd.
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
*/
import { html, render } from 'lit';
/**
* @polymerMixin
*/
export const UploadFileListMixin = (superClass) =>
class UploadFileListMixin extends superClass {
static get properties() {
return {
/**
* The array of files being processed, or already uploaded.
*/
items: {
type: Array,
},
/**
* The object used to localize upload files.
*/
i18n: {
type: Object,
},
};
}
static get observers() {
return ['__updateItems(items, i18n)'];
}
/** @private */
__updateItems(items, i18n) {
if (items && i18n) {
this.requestContentUpdate();
}
}
/**
* Requests an update for the `vaadin-upload-file` elements.
*
* It is not guaranteed that the update happens immediately (synchronously) after it is requested.
*/
requestContentUpdate() {
const { items, i18n } = this;
render(
html`
${items.map(
(file) => html`
`,
)}
`,
this,
);
}
};