All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uploadpackage.src.vaadin-upload-file.js Maven / Gradle / Ivy

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 '@vaadin/progress-bar/src/vaadin-progress-bar.js';
import './vaadin-upload-icons.js';
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { UploadFileMixin } from './vaadin-upload-file-mixin.js';
import { uploadFileStyles } from './vaadin-upload-file-styles.js';

registerStyles('vaadin-upload-file', uploadFileStyles, { moduleId: 'vaadin-upload-file-styles' });

/**
 * `` element represents a file in the file list of ``.
 *
 * ### Styling
 *
 * The following shadow DOM parts are available for styling:
 *
 * Part name        | Description
 * -----------------|-------------
 * `row`            | File container
 * `info`           | Container for file status icon, file name, status and error messages
 * `done-icon`      | File done status icon
 * `warning-icon`   | File warning status icon
 * `meta`           | Container for file name, status and error messages
 * `name`           | File name
 * `error`          | Error message, shown when error happens
 * `status`         | Status message
 * `commands`       | Container for file command buttons
 * `start-button`   | Start file upload button
 * `retry-button`   | Retry file upload button
 * `remove-button`  | Remove file button
 *
 * The following state attributes are available for styling:
 *
 * Attribute        | Description
 * -----------------|-------------
 * `focus-ring`     | Set when the element is focused using the keyboard.
 * `focused`        | Set when the element is focused.
 * `error`          | An error has happened during uploading.
 * `indeterminate`  | Uploading is in progress, but the progress value is unknown.
 * `uploading`      | Uploading is in progress.
 * `complete`       | Uploading has finished successfully.
 *
 * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
 *
 * @customElement
 * @extends HTMLElement
 * @mixes ControllerMixin
 * @mixes UploadFileMixin
 * @mixes ThemableMixin
 */
class UploadFile extends UploadFileMixin(ThemableMixin(ControllerMixin(PolymerElement))) {
  static get template() {
    return html`
      
[[fileName]]
[[status]]
[[errorMessage]]
`; } static get is() { return 'vaadin-upload-file'; } /** * Fired when the retry button is pressed. It is listened by `vaadin-upload` * which will start a new upload process of this file. * * @event file-retry * @param {Object} detail * @param {Object} detail.file file to retry upload of */ /** * Fired when the start button is pressed. It is listened by `vaadin-upload` * which will start a new upload process of this file. * * @event file-start * @param {Object} detail * @param {Object} detail.file file to start upload of */ /** * Fired when abort button is pressed. It is listened by `vaadin-upload` which * will abort the upload in progress, and then remove the file from the list. * * @event file-abort * @param {Object} detail * @param {Object} detail.file file to abort upload of */ } defineCustomElement(UploadFile); export { UploadFile };




© 2015 - 2024 Weber Informatics LLC | Privacy Policy