UNPKG

@progress/kendo-react-upload

Version:

React Upload component helps users transfer files from their file systems to dedicated server handlers. KendoReact Upload package

55 lines (54 loc) 2.11 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as l from "react"; import { getActiveElement as v, classNames as U } from "@progress/kendo-react-common"; import { UploadFileStatus as i } from "./interfaces/UploadFileStatus.mjs"; import { UploadListSingleItem as g } from "./UploadListSingleItem.mjs"; import { UploadListMultiItem as C } from "./UploadListMultiItem.mjs"; import I from "./utils/utils.mjs"; class N extends l.Component { constructor() { super(...arguments), this._element = null, this.onClick = () => { this.props.onClick.call(void 0, this.props.index); }; } componentDidUpdate() { const { navigationIndex: e, index: s } = this.props, o = v(document); e === s && this._element && o !== this._element && this._element.focus(); } render() { const { files: e, async: s, disabled: o, navigationIndex: n, index: a, listItemUI: r, onCancel: m, onRemove: c, onRetry: p } = this.props, t = e[0], d = t.status === i.Uploaded || t.status === i.Initial, u = U( "k-file", I.filesHaveValidationErrors(e) ? "k-file-error k-file-invalid" : "", t.status === i.UploadFailed || t.status === i.RemoveFailed ? "k-file-error" : "", t.status === i.Uploading ? "k-file-progress" : "", d ? "k-file-success" : "", n === a ? "k-focus" : "" ), f = { async: s, disabled: o, onCancel: m, onRemove: c, onRetry: p }, h = r || (e.length === 1 ? g : C); return /* @__PURE__ */ l.createElement( "li", { ref: (k) => this._element = k, className: u, "data-uid": t.uid, onClick: this.onClick, role: "listitem" }, /* @__PURE__ */ l.createElement(h, { files: e, ...f }) ); } } export { N as UploadListGroup };