@progress/kendo-vue-upload 11.0.0 → 11.1.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,82 +7,97 @@
7
7
  */
8
8
  import { PropType } from 'vue';
9
9
  /**
10
- * Represents the properties of the [ExternalDropZone](% slug api_upload_externaldropzone %) component.
10
+ * Represents the properties of the [ExternalDropZone](slug:external_drop_zone) component.
11
11
  */
12
12
  export interface ExternalDropZoneProps {
13
13
  /**
14
- * Sets the `id` property of the top div element of the ExternalDropZone.
14
+ * Sets the `id` of the root `div` element of the ExternalDropZone.
15
15
  */
16
16
  id?: string;
17
17
  /**
18
- * Sets the `style` of the inner div element of the ExternalDropZone.
18
+ * Sets the `style` of the inner `div` element of the ExternalDropZone.
19
19
  */
20
20
  innerStyle?: object;
21
21
  /**
22
- * Sets the `tabIndex` attribute.
22
+ * Sets the `tabIndex` attribute of the ExternalDropZone.
23
+ *
24
+ * @remarks
25
+ * This property is related to accessibility.
23
26
  */
24
27
  tabIndex?: number;
25
28
  /**
26
- * Represents the ref of the linked Upload.
29
+ * Sets the `ref` name of the Upload that receives the dropped files.
27
30
  */
28
31
  uploadRef: any;
29
32
  /**
30
- * Determines the disabled mode of the ExternalDropZone.
33
+ * Disables the ExternalDropZone.
31
34
  */
32
35
  disabled?: boolean;
33
36
  /**
34
- * Sets different hint node.
37
+ * Sets a custom template for the hint. Accepts a Vue component, a `render` function, or a slot name.
35
38
  */
36
39
  customHint?: any;
37
40
  /**
38
- * Sets different note node.
41
+ * Sets a custom template for the note. Accepts a Vue component, a `render` function, or a slot name.
39
42
  */
40
43
  customNote?: any;
41
44
  /**
42
- * Triggered after a file is dropped into the ExternalDropZone area.
45
+ * Fires after you drop a file in the ExternalDropZone area.
43
46
  */
44
47
  onDrop?: (event: any) => void;
45
48
  /**
46
- * Triggered after a file is dragged inside the ExternalDropZone area.
49
+ * Fires when you drag a file into the ExternalDropZone area.
47
50
  */
48
51
  onElementdragenter?: (event: any) => void;
49
52
  /**
50
- * Triggered after a file dragging is over.
53
+ * Fires while you drag a file over the ExternalDropZone area.
51
54
  */
52
55
  onElementdragover?: (event: any) => void;
53
56
  }
54
57
  /**
55
- * Represents the target(element and props) of the ExternalDropZoneEvent.
58
+ * Represents the target of the `ExternalDropZoneEvent`. It holds the element and the props of the ExternalDropZone.
56
59
  */
57
60
  export interface ExternalDropZoneHandle {
58
61
  /**
59
- * The current element or `null` if there is no one.
62
+ * The root element of the ExternalDropZone, or `null` when there is no element.
60
63
  */
61
64
  element: HTMLDivElement | null;
62
65
  /**
63
- * The props value of the ExternalDropZone.
66
+ * The props of the ExternalDropZone.
64
67
  */
65
68
  props: ExternalDropZoneProps;
66
69
  /**
67
- * The focus event callback.
70
+ * Focuses the ExternalDropZone.
68
71
  */
69
72
  focus: () => void;
70
73
  }
71
74
  /**
72
- * Represents the return type of the ExternalDropZone.
75
+ * Represents the event object of the ExternalDropZone.
73
76
  */
74
77
  export interface ExternalDropZoneEvent {
75
78
  /**
76
- * The target of the ExternalDropZoneEvent from ExternalDropZoneHandle.
79
+ * The target of the event. It is of type `ExternalDropZoneHandle`.
77
80
  */
78
81
  target: ExternalDropZoneHandle;
79
82
  /**
80
- * The event of the ExternalDropZoneEvent.
83
+ * The native event.
81
84
  */
82
85
  event: any;
83
86
  }
84
87
  /**
85
- * @hidden
88
+ * Represents the [Kendo UI for Vue ExternalDropZone component](slug:external_drop_zone).
89
+ * Accepts properties of type [ExternalDropZoneProps](slug:api_upload_externaldropzoneprops).
90
+ *
91
+ * @example
92
+ * ```vue
93
+ * <ExternalDropZone :upload-ref="'upload'" />
94
+ * <Upload
95
+ * ref="upload"
96
+ * :default-files="[]"
97
+ * :save-url="'https://demos.telerik.com/service/v2/odata/upload/save'"
98
+ * :remove-url="'https://demos.telerik.com/service/v2/odata/upload/remove'"
99
+ * />
100
+ * ```
86
101
  */
87
102
  declare const ExternalDropZone: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
88
103
  id: PropType<string>;
package/Upload.d.ts CHANGED
@@ -17,7 +17,20 @@ export interface UploadData {
17
17
  currentFiles: Array<UploadFileInfo>;
18
18
  }
19
19
  /**
20
- * @hidden
20
+ * Represents the [Kendo UI for Vue Upload component](slug:overview_upload).
21
+ * Accepts properties of type [UploadProps](slug:api_upload_uploadprops).
22
+ *
23
+ * @example
24
+ * ```vue
25
+ * <Upload
26
+ * :default-files="[]"
27
+ * :multiple="true"
28
+ * :auto-upload="false"
29
+ * :with-credentials="false"
30
+ * :save-url="'https://demos.telerik.com/service/v2/odata/upload/save'"
31
+ * :remove-url="'https://demos.telerik.com/service/v2/odata/upload/remove'"
32
+ * />
33
+ * ```
21
34
  */
22
35
  declare const Upload: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
23
36
  autoUpload: {
@@ -8,7 +8,24 @@
8
8
  import { UploadFileInfo } from './interfaces/UploadFileInfo';
9
9
  import { PropType } from 'vue';
10
10
  /**
11
- * @hidden
11
+ * Represents the UploadListMultiItem component. It renders the default markup of a file list item with more than one file,
12
+ * for example, when you set `batch` to `true`.
13
+ * Use it inside a custom `list` template of the Upload when you want to keep the default item and add your own content
14
+ * ([see example](slug:rendering_upload)).
15
+ * Accepts properties of type [UploadListItemProps](slug:api_upload_uploadlistitemprops).
16
+ * The component emits the `retry`, `remove`, and `cancel` events with the `uid` of the files.
17
+ *
18
+ * @example
19
+ * ```vue
20
+ * <UploadListMultiItem
21
+ * :files="files"
22
+ * :async="async"
23
+ * :disabled="disabled"
24
+ * @retry="onRetry"
25
+ * @remove="onRemove"
26
+ * @cancel="onCancel"
27
+ * />
28
+ * ```
12
29
  */
13
30
  declare const UploadListMultiItem: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
14
31
  files: PropType<UploadFileInfo[]>;
@@ -9,7 +9,23 @@ import { UploadFileInfo } from './interfaces/UploadFileInfo';
9
9
  import { SVGIcon } from '@progress/kendo-svg-icons';
10
10
  import { PropType } from 'vue';
11
11
  /**
12
- * @hidden
12
+ * Represents the UploadListSingleItem component. It renders the default markup of a file list item with one file.
13
+ * Use it inside a custom `list` template of the Upload when you want to keep the default item and add your own content
14
+ * ([see example](slug:rendering_upload)).
15
+ * Accepts properties of type [UploadListItemProps](slug:api_upload_uploadlistitemprops).
16
+ * The component emits the `retry`, `remove`, and `cancel` events with the `uid` of the file.
17
+ *
18
+ * @example
19
+ * ```vue
20
+ * <UploadListSingleItem
21
+ * :files="files"
22
+ * :async="async"
23
+ * :disabled="disabled"
24
+ * @retry="onRetry"
25
+ * @remove="onRemove"
26
+ * @cancel="onCancel"
27
+ * />
28
+ * ```
13
29
  */
14
30
  declare const UploadListSingleItem: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
15
31
  files: PropType<UploadFileInfo[]>;
@@ -12,4 +12,4 @@
12
12
  * Licensed under commercial license. See LICENSE.md in the package root for more information
13
13
  *-------------------------------------------------------------------------------------------
14
14
  */
15
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("@progress/kendo-vue-common"),require("@progress/kendo-vue-intl"),require("@progress/kendo-vue-progressbars"),require("@progress/kendo-vue-buttons"),require("@progress/kendo-svg-icons")):"function"==typeof define&&define.amd?define(["exports","vue","@progress/kendo-vue-common","@progress/kendo-vue-intl","@progress/kendo-vue-progressbars","@progress/kendo-vue-buttons","@progress/kendo-svg-icons"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoVueUpload={},e.Vue,e.KendoVueCommon,e.KendoVueIntl,e.KendoVueProgressbars,e.KendoVueButtons,e.KendoSVGIcons)}(this,function(e,t,n,i,o,s,a){"use strict";var l=(e=>(e[e.UploadFailed=0]="UploadFailed",e[e.Initial=1]="Initial",e[e.Selected=2]="Selected",e[e.Uploading=3]="Uploading",e[e.Uploaded=4]="Uploaded",e[e.RemoveFailed=5]="RemoveFailed",e[e.Removing=6]="Removing",e))(l||{});const r="upload.cancel",d="upload.clearSelectedFiles",c="upload.dropFileHere",u="upload.dropFilesHere",p="upload.headerStatusUploaded",h="upload.headerStatusUploading",m="upload.invalidFileExtension",f="upload.invalidFiles",g="upload.invalidMaxFileSize",v="upload.invalidMinFileSize",y="upload.remove",b="upload.retry",F="upload.select",x="upload.selectSingle",S="upload.selectTitle",k="upload.selectNoFilesTitle",I="upload.uploadSelectedFiles",C="upload.total",N="upload.files",B="upload.statusUploaded",E="upload.statusUploadFailed",R="upload.dropZoneHint",D="upload.dropZoneNote",U={[r]:"Cancel",[d]:"Clear",[c]:"Drop a file here to upload",[u]:"Drop files here to upload",[p]:"Done",[h]:"Uploading...",[m]:"File type not allowed.",[f]:"Invalid file(s). Please check file upload requirements.",[g]:"File size too large.",[v]:"File size too small.",[y]:"Remove",[b]:"Retry",[F]:"Select files...",[x]:"Select file...",[S]:"Press to select more files",[k]:"No files selected",[I]:"Upload",[C]:"Total",[N]:"files",[B]:"File(s) successfully uploaded.",[E]:"File(s) failed to upload.",[R]:"Drag and drop files here to upload.",[D]:"Only JPEG and PNG files are allowed."},$=/&/g,L=/</g,w=/"/g,V=/'/g,O=/>/g,A=e=>(""+e).replace($,"&amp;").replace(L,"&lt;").replace(O,"&gt;").replace(w,"&quot;").replace(V,"&#39;"),j=e=>{const t=e.match(/\.([^\.]+)$/);return t?t[0]:""},z=e=>{const t=e.name,n=e.size;return{extension:j(t),name:A(t),getRawFile:()=>e,size:n,status:l.Selected,progress:0,uid:""}},T=e=>!!(e.validationErrors&&e.validationErrors.length>0),_={fileHasValidationErrors:T,filesHaveValidationErrors:e=>{for(const t of e)if(T(t))return!0;return!1},getTotalFilesSizeMessage:e=>{let t,n=0;if("number"!=typeof e[0].size)return"";for(t=0;t<e.length;t++)e[t].size&&(n+=e[t].size||0);return n/=1024,n<1024?n.toFixed(2)+" KB":(n/1024).toFixed(2)+" MB"},getAllFileInfo:e=>{const t=new Array;let n;for(n=0;n<e.length;n++)t.push(z(e[n]));return t},getFileInfo:z,getFileExtension:j,htmlEncode:A,assignGuidToFiles:(e,t)=>{const i=n.guid();return e.map(e=>(e.uid=t?i:n.guid(),e))},getFileStatus:e=>{let t=!1,n=!1,i=!1,o=!1;const s=e=>{e.forEach(e=>{e.status===l.Uploading&&(t=!0),e.status===l.Uploaded&&(n=!0),e.status===l.UploadFailed&&(i=!0),T(e)&&(o=!0)})};return Array.isArray(e)?s(e):Object.keys(e).forEach(t=>{s(e[t])}),[t,n,i,o]}},M=t.defineComponent({name:"KendoVueUploadListActionButton",props:{progress:Number,uid:String,status:Number,async:Object,disabled:Boolean,files:Array},emits:{cancel:null,retry:null,remove:null},inject:{kendoLocalizationService:{default:null}},data:()=>({retryFocused:!1,actionFocused:!1}),methods:{actionButtonTitle:(e,t)=>e===l.Uploading?t.toLanguageString(r,U[r]):t.toLanguageString(y,U[y]),retryButtonTitle:e=>e.toLanguageString(b,U[b]),buttonClassNames(e){return n.classNames(this.actionFocused&&"action"===e||this.retryFocused&&"retry"===e?"k-focus":"")},onRetryFocus(){this.retryFocused=!0},onRetryBlur(){this.retryFocused=!1},onActionFocus(){this.actionFocused=!0},onActionBlur(){this.actionFocused=!1},onActionClick(){const{status:e,uid:t,disabled:n}=this.$props;n||e===l.Removing||(e===l.Uploading?this.$emit("cancel",t):this.$emit("remove",t))},onRetryClick(){const{uid:e,disabled:t}=this.$props;t||this.$emit("retry",e)}},setup:()=>({kendoLocalizationService:t.inject("kendoLocalizationService",{})}),render(){const{status:e,progress:n}=this.$props,o=e===l.UploadFailed,r=e===l.Uploading,d=(e===l.Uploaded||e===l.Initial)&&!this.$props.async.removeUrl,c=i.provideLocalizationService(this);return t.createVNode("div",{class:"k-upload-actions"},[r?t.createVNode("span",{class:"k-upload-pct"},[n,"%"]):void 0,o?t.createVNode(s.Button,{type:"button",fillMode:"flat",tabIndex:-1,disabled:this.disabled,class:this.buttonClassNames("retry"),icon:"arrow-rotate-cw",svgIcon:a.arrowRotateCwIcon,iconClass:"k-retry",ariaLabel:this.retryButtonTitle(c),title:this.retryButtonTitle(c),onFocus:this.onRetryFocus,onBlur:this.onRetryBlur,onClick:this.onRetryClick},null):void 0,d?void 0:t.createVNode(s.Button,{type:"button",fillMode:"flat",tabIndex:-1,disabled:this.disabled,class:this.buttonClassNames("action"),onFocus:this.onActionFocus,onBlur:this.onActionBlur,onClick:this.onActionClick,icon:e===l.Uploading?"cancel":"x",svgIcon:r?a.cancelIcon:a.xIcon,ariaLabel:this.actionButtonTitle(e,c),title:this.actionButtonTitle(e,c)},null)])}}),K=t.defineComponent({name:"KendoVueUploadListSingleItem",props:{files:Array,disabled:Boolean,async:Object},emits:{cancel:null,retry:null,remove:null},inject:{kendoLocalizationService:{default:null}},methods:{onRetry(e){this.$emit("retry",e)},onRemove(e){this.$emit("remove",e)},onCancel(e){this.$emit("cancel",e)},getFileExtension:e=>e.extension?e.extension.substring(1):"",getFileValidationMessage(e,t){const n=i.provideLocalizationService(this);let o="";if(t)o=n.toLanguageString(E,U[E]);else if(e.validationErrors&&e.validationErrors.length>0){const t=`upload.${e.validationErrors[0]}`;o=n.toLanguageString(t,U[t])}return o},getFileExtensionName(e){switch(e.extension){case".png":case".jpg":case".jpeg":case".tiff":case".bmp":case".gif":return"file-image";case".mp3":case".mp4":case".wav":return"file-audio";case".mkv":case".webm":case".flv":case".gifv":case".avi":case".wmv":return"file-video";case".txt":return"file-txt";case".pdf":return"file-pdf";case".ppt":case".pptx":return"file-presentation";case".csv":case".xls":case".xlsx":return"file-data";case".html":case".css":case".js":case".ts":return"file-programming";case".exe":return"file-config";case".zip":case".rar":return"file-zip";default:return"file"}},getFileExtensionSVG(e){switch(e.extension){case".png":case".jpg":case".jpeg":case".tiff":case".bmp":case".gif":return a.fileImageIcon;case".mp3":case".mp4":case".wav":return a.fileAudioIcon;case".mkv":case".webm":case".flv":case".gifv":case".avi":case".wmv":return a.fileVideoIcon;case".txt":return a.fileTxtIcon;case".pdf":return a.filePdfIcon;case".ppt":case".pptx":return a.filePresentationIcon;case".csv":case".xls":case".xlsx":return a.fileDataIcon;case".html":case".css":case".js":case".ts":return a.fileProgrammingIcon;case".exe":return a.fileConfigIcon;case".zip":case".rar":return a.fileZipIcon;default:return a.fileIcon}}},setup:()=>({kendoLocalizationService:t.inject("kendoLocalizationService",{})}),render(){const{files:e,disabled:s,async:a}=this.$props,l=e[0],r=n.classNames("k-file-single"),[,d,c,u]=_.getFileStatus([l]),p=!u&&!d&&!c;return t.createVNode("div",{class:r},[p&&t.createVNode(o.ProgressBar,{value:l.progress||0,labelVisible:!1},null),t.createVNode("span",{class:"k-file-icon-wrapper",key:"1"},[t.createVNode(n.Icon,{name:this.getFileExtensionName(l),icon:this.getFileExtensionSVG(l),size:"xxxlarge",class:"k-file-icon"},null),t.createVNode("span",{class:"k-file-state"},null)]),u||c?function(e,n){return t.createVNode("span",{class:"k-file-info",key:"2"},[t.createVNode("span",{class:"k-file-name",title:e.name},[e.name]),t.createVNode("span",{class:"k-file-validation-message"},[this.getFileValidationMessage(e,n)])])}.call(this,l,c):function(e){const n=i.provideLocalizationService(this).toLanguageString(B,U[B]);return t.createVNode("span",{class:"k-file-info",key:"2"},[t.createVNode("span",{class:"k-file-name",title:e.name},[e.name]),100!==e.progress?t.createVNode("span",{class:"k-file-size"},[_.getTotalFilesSizeMessage([e])]):t.createVNode("span",{class:"k-file-validation-message"},[n])])}.call(this,l),t.createVNode(M,{uid:l.uid,status:l.status,progress:l.progress,files:e,disabled:s,async:a,onCancel:this.onCancel,onRemove:this.onRemove,onRetry:this.onRetry},null)])}}),Z=t.defineComponent({name:"KendoVueUploadListMultiItem",props:{files:Array,disabled:Boolean,async:Object},emits:{cancel:null,retry:null,remove:null},inject:{kendoLocalizationService:{default:null}},methods:{onRetry(e){this.$emit("retry",e)},onRemove(e){this.$emit("remove",e)},onCancel(e){this.$emit("cancel",e)},getFileValidationMessage(e){const t=i.provideLocalizationService(this);let n="";if(e.validationErrors&&e.validationErrors.length>0){const i=`upload.${e.validationErrors[0]}`;n=t.toLanguageString(i,U[i])}return n},progress(){const{files:e}=this.$props;let t=0;return e.forEach(e=>{t+=e.progress||0}),t/e.length}},setup:()=>({kendoLocalizationService:t.inject("kendoLocalizationService",{})}),render(){const{files:e,disabled:s,async:l}=this.$props,r=n.classNames("k-file-multiple"),[,d,c,u]=_.getFileStatus(e),p=i.provideLocalizationService(this),h=p.toLanguageString(C,U[C]),m=p.toLanguageString(N,U[N]),f=p.toLanguageString(E,U[E]),g=p.toLanguageString(B,U[B]),v=this.progress(),y=!u&&!d&&!c;return t.createVNode("div",{class:r},[y&&t.createVNode(o.ProgressBar,{value:v||0,labelVisible:!1},null),t.createVNode("span",{class:"k-file-icon-wrapper"},[t.createVNode(n.Icon,{name:"copy",icon:a.copyIcon,size:"xxxlarge",class:"k-file-icon"},null)]),t.createVNode("span",{class:"k-multiple-files-wrapper"},[function(){return e.map(function(e){return t.createVNode("span",{key:e.name,class:"k-file-info"},[t.createVNode("span",{class:"k-file-name",title:e.name},[e.name]),_.fileHasValidationErrors(e)?t.createVNode("span",{class:"k-file-validation-message"},[this.getFileValidationMessage(e)]):t.createVNode("span",{key:`${e.name}-size`,class:"k-file-size"},[_.getTotalFilesSizeMessage([e])])])},this)}.call(this),c?t.createVNode("span",{class:"k-file-validation-message"},[`${e.length} ${f}`]):100!==v?t.createVNode("span",{class:"k-file-summary"},[`${h}: ${e.length} ${m}, ${_.getTotalFilesSizeMessage(e)}`]):t.createVNode("span",{class:"k-file-summary k-text-success"},[`${e.length} ${g}`])]),t.createVNode(M,{uid:e[0].uid,status:e[0].status,progress:v,files:e,disabled:s,async:l,onCancel:this.onCancel,onRemove:this.onRemove,onRetry:this.onRetry},null)])}}),q=t.defineComponent({name:"KendoVueUploadListGroup",props:{files:Array,async:Object,disabled:Boolean,navigationIndex:Number,list:[String,Function,Object],index:Number},emits:{cancel:null,click:null,retry:null,remove:null},mounted(){this._element=this.elementRef},updated(){const{navigationIndex:e,index:t}=this.$props;e===t&&this._element&&n.canUseDOM&&document.activeElement!==this._element&&this._element.focus()},methods:{onClick(){this.$emit("click",this.$props.index)},onRetry(e){this.$emit("retry",e)},onRemove(e){this.$emit("remove",e)},onCancel(e){this.$emit("cancel",e)}},setup:()=>({elementRef:t.ref(null)}),render(){const{files:e,async:i,disabled:o,navigationIndex:s,index:a}=this.$props,r=e[0],d=r.status===l.Uploaded||r.status===l.Initial,c=_.filesHaveValidationErrors(e),u=r.status===l.UploadFailed||r.status===l.RemoveFailed,p=n.classNames("k-file",{"k-file-invalid":c,"k-file-error":u||c,"k-file-progress":r.status===l.Uploading,"k-file-success":d,"k-focus":s===a});let h;const m=1===e.length?t.createVNode(K,{files:e,async:i,disabled:o,onCancel:this.onCancel,onRemove:this.onRemove,onRetry:this.onRetry},null):t.createVNode(Z,{files:e,async:i,disabled:o,onCancel:this.onCancel,onRemove:this.onRemove,onRetry:this.onRetry},null);return h=n.getTemplate.call(this,{h:t.h,template:this.$props.list,defaultRendering:m,additionalProps:this.$props,additionalListeners:{retry:this.onRetry,remove:this.onRemove,cancel:this.onCancel}}),t.createVNode("li",{ref:n.setRef(this,"element"),class:p,"data-uid":r.uid,tabindex:-1,onClick:this.onClick},[h])}}),H=t.defineComponent({name:"KendoVueUploadList",props:{groupedFiles:Object,async:Object,disabled:Boolean,navigationIndex:{type:Number,default:void 0},list:[String,Function,Object]},emits:{cancel:null,click:null,retry:null,remove:null},methods:{onClick(e){this.$emit("click",e)},onRetry(e){this.$emit("retry",e)},onRemove(e){this.$emit("remove",e)},onCancel(e){this.$emit("cancel",e)}},render(){const{groupedFiles:e,navigationIndex:i,async:o,disabled:s,list:a}=this.$props,l=n.classNames("k-upload-files","k-reset");return t.createVNode("ul",{class:l},[Object.keys(e).map(function(n,l){const r=e[n];return t.createVNode(q,{key:n,files:r,index:l,navigationIndex:i,async:o,disabled:s,list:a,onCancel:this.onCancel,onClick:this.onClick,onRemove:this.onRemove,onRetry:this.onRetry},null)},this)])}});function P(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const G=t.defineComponent({name:"KendoVueUploadActionButtons",props:{disabled:Boolean,navigationIndex:Number,clearButtonIndex:Number,uploadButtonIndex:Number,actionsLayout:String},inject:{kendoLocalizationService:{default:null}},emits:{clear:null,click:null,upload:null},created(){this._prevNavigationIndex=void 0},setup:()=>({uploadElementRef:t.ref(null),clearElementRef:t.ref(null),kendoLocalizationService:t.inject("kendoLocalizationService",{})}),mounted(){this._clearElement=this.clearElementRef,this._uploadElement=this.uploadElementRef},watch:{navigationIndex:function(e,t){this._prevNavigationIndex=t}},updated(){const{navigationIndex:e,clearButtonIndex:t,uploadButtonIndex:n}=this.$props;e!==this._prevNavigationIndex&&(e===t&&this._clearElement&&this._clearElement.focus(),e===n&&this._uploadElement&&this._uploadElement.focus())},methods:{onClearClick(){this.$props.disabled||this.$emit("clear")},onUploadClick(){this.$props.disabled||(this.$emit("click",this.$props.uploadButtonIndex),this.$emit("upload"))}},render(){let e,o;const{disabled:a,navigationIndex:l,clearButtonIndex:r,uploadButtonIndex:c,actionsLayout:u}=this.$props,p=i.provideLocalizationService(this),h=n.classNames("k-actions",{"k-actions-start":"start"===u,"k-actions-center":"center"===u,"k-actions-end":"end"===u,"k-actions-stretched":"stretched"===u}),m=n.classNames("k-clear-selected",l===r?"k-focus":""),f=n.classNames("k-upload-selected",l===c?"k-focus":"");return t.createVNode("div",{class:h},[t.createVNode(s.Button,{type:"button",ref:e=>{this.clearElementRef=e},disabled:a,class:m,tabIndex:-1,onClick:this.onClearClick},P(e=p.toLanguageString(d,U[d]))?e:{default:()=>[e]}),t.createVNode(s.Button,{type:"button",ref:e=>{this.uploadElementRef=e},disabled:a,themeColor:"primary",class:f,tabIndex:-1,onClick:this.onUploadClick},P(o=p.toLanguageString(I,U[I]))?o:{default:()=>[o]})])}}),X=/(chrome)[ \/]([\w.]+)/i,J=/(webkit)[ \/]([\w.]+)/i,Q=t.defineComponent({name:"KendoVueUploadInput",props:{async:Object,id:String,multiple:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},accept:{type:String,default:void 0},hasFiles:{type:Boolean,default:!1},ariaLabelledBy:{type:String,default:void 0},ariaDescribedBy:{type:String,default:void 0}},emits:{mousedown:null,add:null},inject:{kendoLocalizationService:{default:null}},mounted(){this._input=this.inputRef},methods:{onMouseDown(e){this.$emit("mousedown",e)},onAdd(){const e=navigator.userAgent,t=this._input;t&&(t.files&&this.$emit("add",t.files),!e.match(X)&&e.match(J)||(t.type="",t.type="file"))},actionElement(){return this._input}},setup:()=>({inputRef:t.ref(null)}),render(){const{multiple:e,async:o,disabled:s,accept:a,hasFiles:l,ariaLabelledBy:r,ariaDescribedBy:d}=this.$props,c=i.provideLocalizationService(this),u=l?S:k,p=c.toLanguageString(u,U[u]);return c.toLanguageString(F,U[F]),t.createVNode("input",{ref:n.setRef(this,"input"),id:this.id,class:"k-hidden",autocomplete:"off",name:o.saveField,accept:a,type:"file",tabindex:-1,multiple:e,disabled:s,onChange:this.onAdd,onMousedown:this.onMouseDown,title:p,"aria-hidden":!0,"aria-labelledby":r,"aria-describedby":d},null)}});function W(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const Y=t.defineComponent({name:"KendoVueUploadAddButton",props:{addButtonIndex:Number,navigationIndex:Number,notFocusedIndex:Number,tabIndex:Number,async:Object,multiple:Boolean,disabled:Boolean,accept:String,id:String,ariaLabelledBy:String,ariaDescribedBy:String},inject:{kendoLocalizationService:{default:null}},emits:{add:null,click:null},setup:()=>({elementRef:t.ref(null),uploadInputRef:t.ref(null),kendoLocalizationService:t.inject("kendoLocalizationService",{})}),created(){this.uploadInputId=n.guid()},mounted(){this.element=this.elementRef,this.uploadInput=this.uploadInputRef},watch:{navigationIndex:function(e,t){this._prevNavigationIndex=t}},updated(){const{navigationIndex:e,addButtonIndex:t,notFocusedIndex:n}=this.$props;e!==this._prevNavigationIndex&&this._prevNavigationIndex!==n&&e===t&&this.element&&this.element.focus()},methods:{focus(){this.element&&this.element.focus()},onClick(){this.actionElement()&&this.actionElement().click(),this.$emit("click",this.$props.addButtonIndex)},onAdd(e){this.$emit("add",e)},onInputMouseDown(e){this.element&&(e.preventDefault(),this.element.focus())},actionElement(){if(this.uploadInput)return this.uploadInput.actionElement()}},render(){const{navigationIndex:e,addButtonIndex:o,tabIndex:a,id:l,async:r,multiple:d,disabled:c,accept:u,ariaLabelledBy:p,ariaDescribedBy:h}=this.$props,m=i.provideLocalizationService(this),f=d?m.toLanguageString(F,U[F]):m.toLanguageString(x,U[x]),g=n.classNames("k-upload-button",e===o?"k-focus":"");return t.createVNode("div",{class:"k-upload-button-wrap"},[t.createVNode(s.Button,{id:l,ref:n.setRef(this,"element"),type:"button",disabled:c,class:g,tabIndex:a,"aria-labelledby":p,"aria-describedby":h,onClick:this.onClick},W(f)?f:{default:()=>[f]}),t.createVNode(Q,{id:this.uploadInputId,async:r,multiple:d,disabled:c,accept:u,onMousedown:this.onInputMouseDown,onAdd:this.onAdd,ref:e=>{this.uploadInputRef=e}},null)])}}),ee=t.defineComponent({props:{isUploading:Boolean,isUploaded:Boolean,isUploadFailed:Boolean},inject:{kendoLocalizationService:{default:null}},setup:()=>({kendoLocalizationService:t.inject("kendoLocalizationService",{})}),render(){const{isUploading:e,isUploaded:o,isUploadFailed:s}=this.$props;let l="";const r=i.provideLocalizationService(this);return e?l=r.toLanguageString(h,U[h]):(o||s)&&(l=r.toLanguageString(p,U[p])),t.createVNode("div",{class:n.classNames("k-upload-status")},[t.createVNode(n.Icon,{name:e||s||!o?!e&&s?"exclamation-circle":e?"upload":"":"check",icon:e||s||!o?!e&&s?a.exclamationCircleIcon:e?a.uploadIcon:{}:a.checkIcon},null),l])}}),te=t.defineComponent({name:"KendoVueUploadDropZone",props:{addButtonIndex:Number,async:Object,multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},showFileList:Boolean,showActionButtons:Boolean,actionsLayout:{type:String,default:function(){return"end"}},tabIndex:Number,accept:String,groupedFiles:{type:Object,default:function(){return{}}},navigationIndex:Number,notFocusedIndex:Number,list:[String,Function,Object],id:String,ariaLabelledBy:String,ariaDescribedBy:String,fileGroup:Object},emits:{add:null,click:null},inject:{kendoLocalizationService:{default:null}},data:()=>({currentDocumentActive:!1,currentElementActive:!1}),created(){this.currentElementActive=!1},mounted(){this.uploadAddButton=this.uploadAddButtonRef,document.addEventListener("dragenter",this.onDocumentDragEnter),document.addEventListener("dragover",this.onDocumentDragOver)},unmounted(){document.removeEventListener("dragenter",this.onDocumentDragEnter),document.removeEventListener("dragover",this.onDocumentDragOver)},setup:()=>({uploadAddButtonRef:t.ref(null),kendoLocalizationService:t.inject("kendoLocalizationService",{})}),computed:{dropZoneClasses(){return{"k-dropzone":!0,"k-upload-dropzone":!0,"k-active":this.currentDocumentActive,"k-hover":this.currentElementActive}}},methods:{actionElement(){if(this.uploadAddButton)return this.uploadAddButton.uploadInput},focus(){if(this.uploadAddButton)return this.uploadAddButton.focus()},onDocumentDragEnter(){if(!this.currentDocumentActive){this.currentDocumentActive=!0;const e=()=>{this.isDragOver(this._lastDocumentDragOver)&&(this.currentDocumentActive=!1,clearInterval(this._documentInterval),this._documentInterval=null,this._lastDocumentDragOver=null)};this._documentInterval=setInterval(e,100)}},onDocumentDragOver(){this._lastDocumentDragOver=new Date},onElementDragEnter(){if(!this.currentElementActive){this.currentElementActive=!0;const e=()=>{this.isDragOver(this._lastElementDragOver)&&(this.currentElementActive=!1,clearInterval(this._elementInterval),this._elementInterval=null,this._lastElementDragOver=null)};this._elementInterval=setInterval(e,100)}},onElementDragOver(e){e.preventDefault(),this._lastElementDragOver=new Date},onDrop(e){e.preventDefault();let t=e.dataTransfer.files;t.length>0&&!this.$props.disabled&&this.$emit("add",t)},isDragOver:e=>(new Date).getTime()-(e||new Date).getTime()>100,onClick(e){this.$emit("click",e)},onAdd(e){this.$emit("add",e)}},render(){const{multiple:e,disabled:o,tabIndex:s,fileGroup:a,accept:l,navigationIndex:r,notFocusedIndex:d,id:p,ariaLabelledBy:h,ariaDescribedBy:m}=this.$props,f=i.provideLocalizationService(this),g=e?f.toLanguageString(u,U[u]):f.toLanguageString(c,U[c]),[v,y,b,F]=_.getFileStatus(a),x=n.classNames("k-dropzone-hint",{"k-hidden":!this.currentElementActive}),S=v||y||b||F;return t.createVNode("div",{class:this.dropZoneClasses,onDrop:this.onDrop,onDragenter:this.onElementDragEnter,onDragover:this.onElementDragOver},[function(){return t.createVNode(Y,{id:p,ariaLabelledBy:h,ariaDescribedBy:m,ref:e=>{this.uploadAddButtonRef=e},accept:l,async:this.async,addButtonIndex:this.addButtonIndex,navigationIndex:r,notFocusedIndex:d,tabIndex:s,multiple:e,disabled:o,onClick:this.onClick,onAdd:this.onAdd},null)}.call(this),t.createVNode("div",{class:x},[g]),S?t.createVNode(ee,{isUploading:v,isUploaded:y,isUploadFailed:b},null):t.createVNode("span",{class:"k-upload-status"},null)])}}),ne=t.defineComponent({name:"KendoVueUploadUI",props:{async:Object,className:String,multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},showFileList:Boolean,showActionButtons:Boolean,actionsLayout:{type:String,default:function(){return"end"}},tabIndex:Number,accept:String,groupedFiles:{type:Object,default:function(){return{}}},navigationIndex:Number,notFocusedIndex:Number,list:[String,Function,Object],id:String,ariaLabelledBy:String,ariaDescribedBy:String},computed:{groupsCount(){return Object.keys(this.$props.groupedFiles).length},lastGroupIndex(){return this.groupsCount-1},addButtonIndex:()=>-1,clearButtonIndex(){return this.lastGroupIndex+1},uploadButtonIndex(){return this.lastGroupIndex+2},isRtl(){return this._container&&"rtl"===getComputedStyle(this._container).direction||!1}},methods:{actionElement(){if(this.uploadDropZone)return this.uploadDropZone.actionElement()},focus(){if(this.uploadDropZone)return this.uploadDropZone.focus()},onAdd(e){this.$emit("add",e)},onRetry(e){this.$emit("retry",e)},onCancel(e){this.$emit("cancel",e)},onClear(){this.$emit("clear")},onUpload(){this.$emit("upload")},onRemove(e){this.$emit("remove",e)},onKeyDown(e){this.$emit("keydown",e,this.isRtl)},onFocus(e){this.$emit("focus",e)},onBlur(e){this.$emit("blur",e)},onClick(e){this.$emit("click",e)}},emits:{add:null,retry:null,cancel:null,clear:null,upload:null,remove:null,keydown:null,click:null,focus:null,blur:null},mounted(){this._container=this.containerRef,this.uploadDropZone=this.uploadDropZoneRef},setup:()=>({containerRef:t.ref(null),uploadDropZoneRef:t.ref(null)}),render(){const{multiple:e,disabled:i,tabIndex:o,accept:s,showFileList:a,groupedFiles:l,navigationIndex:r,showActionButtons:d,actionsLayout:c,notFocusedIndex:u,list:p,id:h,ariaLabelledBy:m,ariaDescribedBy:f,async:g}=this.$props,v=n.classNames("k-upload","k-upload-async",{"k-upload-empty":0===Object.keys(l).length},this.$props.className,i?"k-disabled":"");return t.createVNode("div",{ref:n.setRef(this,"container"),class:v,onKeydown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur},[t.createVNode(te,{id:h,ariaLabelledBy:m,ariaDescribedBy:f,ref:e=>{this.uploadDropZoneRef=e},accept:s,async:g,addButtonIndex:this.addButtonIndex,navigationIndex:r,notFocusedIndex:u,tabIndex:o,multiple:e,onClick:this.onClick,onAdd:this.onAdd,fileGroup:l,disabled:i},null),a?t.createVNode(H,{groupedFiles:l,disabled:i,async:g,navigationIndex:r,list:p,onCancel:this.onCancel,onRemove:this.onRemove,onRetry:this.onRetry,onClick:this.onClick},null):void 0,d?t.createVNode(G,{disabled:i,navigationIndex:r,clearButtonIndex:this.clearButtonIndex,uploadButtonIndex:this.uploadButtonIndex,actionsLayout:c,onUpload:this.onUpload,onClear:this.onClear,onClick:this.onClick},null):void 0])}}),ie=-2,oe=-1,se=t.defineComponent({name:"KendoVueUploadNavigation",props:{async:Object,className:String,multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},showFileList:Boolean,showActionButtons:Boolean,actionsLayout:{type:String,default:function(){return"end"}},tabIndex:Number,accept:String,groupedFiles:{type:Object,default:function(){return{}}},notFocusedIndex:Number,list:[String,Function,Object],id:String,ariaLabelledBy:String,ariaDescribedBy:String,restrictions:Object,files:Array,defaultFiles:Array},emits:{add:null,cancel:null,clear:null,upload:null,retry:null,remove:null},data:()=>({currentNavIndex:ie}),updated(){},methods:{actionElement(){if(this._uploadUI)return this._uploadUI.actionElement()},navIndex(e){if(void 0===e)return this.currentNavIndex;const t=this.navIndex;this.currentNavIndex=e,e!==t&&this.$forceUpdate()},focus(){this._uploadUI&&this._uploadUI.focus()},onKeyDown(e,t){var i;const o=this.navIndex(),s=Object.keys(this.$props.groupedFiles),a=s.length-1,l=this.$props.autoUpload||0===s.length?a:a+1,r=a+1,d=r+1,c=o===ie?oe:o;let u=o;switch(e.keyCode){case n.Keys.up:e.preventDefault(),o>-1&&(u=c-1);break;case n.Keys.down:e.preventDefault(),o<l&&(u=c+1);break;case n.Keys.left:e.preventDefault(),t?o===r&&(u=c+1):o===d&&(u=c-1);break;case n.Keys.right:e.preventDefault(),t?o===d&&(u=c-1):o===r&&(u=c+1);break;case n.Keys.enter:(o===oe||o===ie)&&this.actionElement()&&n.canUseDOM&&-1===(null==(i=document.activeElement)?void 0:i.className.indexOf("k-upload-button"))&&this.actionElement().$el.click(),o>=0&&o<=a&&this.onRetry(s[o]);break;case n.Keys.space:e.preventDefault(),(o===oe||o===ie)&&this.actionElement()&&this.actionElement().$el.click();break;case n.Keys.tab:u=ie;break;case n.Keys.delete:o>=0&&o<=a&&(u=c-1,this.onRemove(s[o]));break;case n.Keys.esc:o>=0&&o<=a&&(u=c-1,this.onCancel(s[o]))}this.navIndex(u)},onCancel(e){this.$emit("cancel",e)},onClear(){this.navIndex(oe),this.$emit("clear")},onUpload(){this.navIndex(oe),this.$emit("upload")},onRetry(e){this.$emit("retry",e)},onRemove(e){this.navIndex(this.navIndex()>oe?this.navIndex()-1:oe),this.$emit("remove",e)},onAdd(e){this.navIndex(oe),this.$emit("add",e)},onClick(e){this.navIndex(e)},onFocus(){this._blurTimeout&&(clearTimeout(this._blurTimeout),this._blurTimeout=void 0)},onBlurTimeout(){this.navIndex(ie),this._blurTimeout=void 0},onBlur(){clearTimeout(this._blurTimeout),this._blurTimeout=window.setTimeout(this.onBlurTimeout)}},mounted(){this._uploadUI=this.uploadUIRef},setup:()=>({uploadUIRef:t.ref(null)}),render(){const{multiple:e,disabled:n,showFileList:i,showActionButtons:o,actionsLayout:s,tabIndex:a,accept:l,groupedFiles:r,list:d,id:c,ariaLabelledBy:u,ariaDescribedBy:p,async:h}=this.$props;return t.createVNode(ne,{ref:e=>{this.uploadUIRef=e},class:this.$props.className,onKeydown:this.onKeyDown,navigationIndex:this.currentNavIndex,notFocusedIndex:ie,onAdd:this.onAdd,onClear:this.onClear,onUpload:this.onUpload,onRemove:this.onRemove,onRetry:this.onRetry,onCancel:this.onCancel,onClick:this.onClick,onFocus:this.onFocus,onBlur:this.onBlur,multiple:e,disabled:n,showFileList:i,showActionButtons:o,actionsLayout:s,tabIndex:a,accept:l,groupedFiles:r,list:d,id:c,ariaLabelledBy:u,ariaDescribedBy:p,async:h},null)}}),ae=(e,t)=>{t.push(e)},le=(e,t)=>{Object.keys(e).forEach(n=>{t(e[n],n)})},re={copyState:e=>(e||[]).map(e=>({...e})),addMany:(e,t)=>{e.forEach(e=>ae(e,t))},add:ae,groupFilesByUid:e=>{const t={};return e.forEach(e=>{t[e.uid]?t[e.uid].push(e):t[e.uid]=[e]}),t},filesForUpload:e=>{const t={};return le(e,(e,n)=>{let i=!0;e.forEach(e=>{(e.status!==l.Selected||e.validationErrors&&e.validationErrors.length>0)&&(i=!1)}),i&&(t[n]=e)}),t},setFilesStatus:(e,t)=>{le(e,e=>{e.forEach(e=>{e.status=t})})},flatFileGroup:e=>{const t=[];return le(e,e=>{t.push.apply(t,e)}),t},groupForEach:le},de=(e,t)=>{Object.keys(t).forEach(n=>{e.append(n,t[n])})},ce=e=>{const t=e.getAllResponseHeaders(),n={};return t&&t.trim().split(/[\r\n]+/).forEach(e=>{const t=e.indexOf(":");t>0&&(n[e.substring(0,t).trim().toLowerCase()]=e.substring(t+1).trim())}),n},ue=(e,t,n)=>{const i=new FormData;return de(i,n),e.forEach(e=>{const n=e.getRawFile?e.getRawFile():"";n?i.append(t,n,e.name):i.append(t,n)}),i},pe=(e,t,n)=>{const i=new FormData;return de(i,n),e.forEach(e=>{i.append(t,e)}),i},he=(e,t)=>({headers:e,responseType:t.responseType,withCredentials:t.withCredentials}),me=(e,t)=>{var n;if(void 0!==e)return e;if(!t||void 0===globalThis.location)return!0;const i=(null==(n=globalThis.document)?void 0:n.baseURI)||globalThis.location.href;try{return new URL(t,i).origin===globalThis.location.origin}catch{return!0}},fe=e=>{const t={};return Object.keys(e).forEach(n=>{t[n]=e[n]}),t},ge=e=>({response:e.response,status:e.status,statusText:e.statusText,headers:e.request?ce(e.request):e.headers||{},request:e.request}),ve="invalidMaxFileSize",ye="invalidMinFileSize",be="invalidFileExtension",Fe=(e,t)=>{t.length>0&&t.indexOf((e.extension||"").toLowerCase())<0&&(e.validationErrors=e.validationErrors||[],e.validationErrors.indexOf(be)<0&&e.validationErrors.push(be))},xe=(e,t,n)=>{0!==t&&(e.size||0)<t&&(e.validationErrors=e.validationErrors||[],e.validationErrors.indexOf(ye)<0&&e.validationErrors.push(ye)),0!==n&&(e.size||0)>n&&(e.validationErrors=e.validationErrors||[],e.validationErrors.indexOf(ve)<0&&e.validationErrors.push(ve))},Se=(e,t,n)=>{const i=(e=>e.map(e=>("."===e.substring(0,1)?e:"."+e).toLowerCase()))(t.allowedExtensions||[]),o=t.maxFileSize||0,s=t.minFileSize||0;let a;for(a=0;a<e.length;a++)Fe(e[a],i),xe(e[a],s,o),n&&n(e[a])},ke={name:"@progress/kendo-vue-upload",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:1619764257,version:"11.0.0",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning"},Ie=t.defineComponent({name:"KendoVueUpload",props:{autoUpload:{type:Boolean,default:!0},batch:{type:Boolean,default:!1},withCredentials:{type:Boolean,default:void 0},saveField:{type:String,default:function(){return"files"}},saveHeaders:{type:[String,Function,Object],default:function(){return{}}},saveMethod:{type:String,default:function(){return"POST"}},saveUrl:{type:[String,Function],default:function(){return""}},responseType:{type:String,default:function(){return"json"}},removeField:{type:String,default:function(){return"fileNames"}},removeHeaders:{type:[String,Function,Object],default:function(){return{}}},removeMethod:{type:String,default:function(){return"POST"}},removeUrl:{type:[String,Function],default:function(){return""}},multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},showFileList:{type:Boolean,default:!0},showActionButtons:{type:Boolean,default:!0},actionsLayout:{type:String,default:function(){return"end"}},tabIndex:Number,accept:String,list:[String,Function,Object],restrictions:{type:Object,default:function(){return{allowedExtensions:[],maxFileSize:0,minFileSize:0}}},validateFile:Function,files:Array,defaultFiles:Array},emits:{add:null,beforeremove:null,beforeupload:null,cancel:null,statuschange:null,progress:null,remove:null},created(){this._httpSubscriptions={},n.validatePackage(ke),this.$props.defaultFiles&&(this.currentFiles=this.$props.defaultFiles)},data:()=>({currentFiles:[]}),computed:{computedAsync(){const{autoUpload:e,batch:t,removeField:n,removeHeaders:i,removeMethod:o,removeUrl:s,responseType:a,saveField:l,saveHeaders:r,saveMethod:d,saveUrl:c,withCredentials:u}=this.$props;return{autoUpload:e,batch:t,removeField:n,removeHeaders:i,removeMethod:o,removeUrl:s,responseType:a,saveField:l,saveHeaders:r,saveMethod:d,saveUrl:c,withCredentials:u}},computedFiles(){return(this.isControlled?this.$props.files:this.currentFiles)||[]},isControlled(){return!this.$props.defaultFiles},isCustomSave(){return this.$props.saveUrl&&"function"==typeof this.$props.saveUrl},isCustomRemove(){return this.$props.removeUrl&&"function"==typeof this.$props.removeUrl},fileStateCopy(){return re.copyState(this.computedFiles)},actionElement(){if(this._uploadNavigation)return this._uploadNavigation.actionElement}},mounted(){this._uploadNavigation=this.uploadNavigationRef},methods:{focus(){this._uploadNavigation&&this._uploadNavigation.focus()},uploadFiles(e){const t=this.computedAsync;re.setFilesStatus(e,l.Uploading),re.groupForEach(e,(e,n)=>{const i={target:this,files:e,headers:fe(t.saveHeaders||{}),additionalData:{}};this.$emit("beforeupload",i);const o=he(i.headers,this.computedAsync),s=ue(e,t.saveField,i.additionalData);if(this.isCustomSave)this.$props.saveUrl(e,{formData:s,requestOptions:o},this.onUploadProgress).then(e=>this.onUploadSuccess(e.uid)).catch(e=>this.onUploadError(e.uid));else{const e=new XMLHttpRequest;this._httpSubscriptions[n]=()=>e.abort(),e.open(t.saveMethod,t.saveUrl,!0),e.withCredentials=me(o.withCredentials,t.saveUrl),e.responseType=o.responseType||"json",Object.entries(o.headers||{}).forEach(([t,n])=>{e.setRequestHeader(t,n)}),e.upload.onprogress=e=>this.onUploadProgress(n,e),e.onload=()=>{e.status>=200&&e.status<300?this.onUploadSuccess(n,{response:e.response,status:e.status,statusText:e.statusText,request:e}):this.onUploadError(n,{response:e.response,status:e.status,statusText:e.statusText,request:e})},e.onerror=()=>this.onUploadError(n,{response:e.response,status:e.status,statusText:e.statusText,request:e}),e.onabort=()=>{},e.send(s)}})},removeFiles(e){const t=this.computedAsync;re.groupForEach(e,(e,n)=>{const i={target:this,files:e,headers:fe(t.removeHeaders||{}),additionalData:{}};this.$emit("beforeremove",i);const o=e.map(e=>e.name),s=he(i.headers,this.computedAsync),a=pe(o,t.removeField,i.additionalData);if(this.isCustomRemove)this.$props.removeUrl(e,{formData:a,requestOptions:s}).then(e=>this.onRemoveSuccess(e.uid)).catch(e=>this.onRemoveError(e.uid));else{const e=new XMLHttpRequest;e.open(t.removeMethod,t.removeUrl,!0),e.withCredentials=me(s.withCredentials,t.removeUrl),e.responseType=s.responseType||"json",Object.entries(s.headers||{}).forEach(([t,n])=>{e.setRequestHeader(t,n)}),e.onload=()=>{e.status>=200&&e.status<300?this.onRemoveSuccess(n,{response:e.response,status:e.status,statusText:e.statusText,request:e}):this.onRemoveError(n,{response:e.response,status:e.status,statusText:e.statusText,request:e})},e.onerror=()=>this.onRemoveError(n,{response:e.response,status:e.status,statusText:e.statusText,request:e}),e.send(a)}})},onUpload(){const e=this.fileStateCopy,t=re.groupFilesByUid(e),n=re.filesForUpload(t);this.uploadFiles(n);this.isControlled||(this.currentFiles=e),(()=>{const t={target:this,newState:e,affectedFiles:re.flatFileGroup(n)};this.$emit("statuschange",t)})()},onAdd(e){let t,n=_.getAllFileInfo(e);if(n=_.assignGuidToFiles(n,this.computedAsync.batch),Se(n,this.$props.restrictions,this.validateFile),t=this.$props.multiple?this.fileStateCopy:[],re.addMany(n,t),this.computedAsync.autoUpload){const e=re.groupFilesByUid(t);this.uploadFiles(re.filesForUpload(e))}this.isControlled||(this.currentFiles=t),(()=>{const e={target:this,newState:t,affectedFiles:n};this.$emit("add",e)})()},onUploadProgress(e,t){const n=t.total?Math.round(100*t.loaded/t.total):0,i=this.fileStateCopy,o=i.filter(t=>t.uid===e);if(!o.length)return;o.forEach(e=>{e.progress=n});this.isControlled||(this.currentFiles=i),(()=>{const e={target:this,newState:i,affectedFiles:o};this.$emit("progress",e)})()},onUploadSuccess(e,t){const n=this.fileStateCopy,i=n.filter(t=>t.uid===e);i.forEach(e=>{e.status=l.Uploaded,e.progress=100}),delete this._httpSubscriptions[e];this.isControlled||(this.currentFiles=n),(()=>{const e={target:this,newState:n,affectedFiles:i,response:t?ge(t):void 0};this.$emit("statuschange",e)})()},onUploadError(e,t){const n=this.fileStateCopy,i=n.filter(t=>t.uid===e);if(i.forEach(e=>{e.status=l.UploadFailed}),delete this._httpSubscriptions[e],!i.length)return;this.isControlled||(this.currentFiles=n),(()=>{const e={target:this,newState:n,affectedFiles:i,response:t?ge(t):void 0};this.$emit("statuschange",e)})()},onRemove(e){const t=this.fileStateCopy,n=t.filter(t=>t.uid===e),i=t.filter(t=>t.uid!==e),o=[l.Uploaded,l.Initial,l.RemoveFailed];if(n[0]&&o.indexOf(n[0].status)>-1){const i={[e]:n};re.setFilesStatus(i,l.Removing),this.removeFiles(i);const o=()=>{const e={target:this,newState:t,affectedFiles:n};this.$emit("statuschange",e)};this.isControlled||(this.currentFiles=t),o()}else{const e=()=>{const e={target:this,newState:i,affectedFiles:n};this.$emit("remove",e)};this.isControlled||(this.currentFiles=i),e()}},onRemoveSuccess(e,t){const n=this.fileStateCopy,i=n.filter(t=>t.uid===e),o=n.filter(t=>t.uid!==e);this.isControlled||(this.currentFiles=o),(()=>{const e={target:this,newState:o,affectedFiles:i,response:t?ge(t):void 0};this.$emit("remove",e)})()},onRemoveError(e,t){const n=this.fileStateCopy,i=n.filter(t=>t.uid===e);i.forEach(e=>{e.status=l.RemoveFailed});this.isControlled||(this.currentFiles=n),(()=>{const e={target:this,newState:n,affectedFiles:i,response:t?ge(t):void 0};this.$emit("statuschange",e)})()},onRetry(e){const t=this.fileStateCopy,n=re.groupFilesByUid(t.filter(t=>t.uid===e));re.setFilesStatus(n,l.Uploading),this.uploadFiles(n);this.isControlled||(this.currentFiles=t),(()=>{const e={target:this,newState:t,affectedFiles:re.flatFileGroup(n)};this.$emit("statuschange",e)})()},onCancel(e){const t=this.fileStateCopy,n=t.filter(t=>t.uid!==e),i=t.filter(t=>t.uid===e);this._httpSubscriptions[e]&&(this._httpSubscriptions[e](),delete this._httpSubscriptions[e]);const o={target:this,uid:e};this.$emit("cancel",o);this.isControlled||(this.currentFiles=t),(()=>{const e={target:this,newState:n,affectedFiles:i};this.$emit("remove",e)})()},onClear(){if(!this.computedFiles.length)return;Object.keys(this._httpSubscriptions).forEach(e=>{this._httpSubscriptions[e]()}),this._httpSubscriptions={};this.isControlled||(this.currentFiles=[]),(()=>{const e={target:this,newState:[],affectedFiles:this.fileStateCopy};this.$emit("remove",e)})()}},render(){const{showFileList:e,autoUpload:i,showActionButtons:o,actionsLayout:s,tabIndex:a,disabled:l,batch:r,withCredentials:d,saveField:c,saveHeaders:u,saveMethod:p,saveUrl:h,responseType:m,removeField:f,removeHeaders:g,removeMethod:v,removeUrl:y,multiple:b,accept:F,restrictions:x,files:S,defaultFiles:k}=this.$props,I=n.templateRendering.call(this,this.$props.list,n.getListeners.call(this)),C=re.groupFilesByUid(this.computedFiles),N=re.filesForUpload(C);return t.createVNode(se,{groupedFiles:C,className:this.$props.className,showFileList:e&&!!Object.keys(C).length,showActionButtons:o&&!i&&!!Object.keys(N).length,actionsLayout:s,disabled:l,onAdd:this.onAdd,onRemove:this.onRemove,onClear:this.onClear,onUpload:this.onUpload,onRetry:this.onRetry,onCancel:this.onCancel,tabIndex:n.getTabIndex(a,l),ref:e=>{this.uploadNavigationRef=e},multiple:b,accept:F,list:I,restrictions:x,files:S,defaultFiles:k,async:this.computedAsync},null)}}),Ce=t.defineComponent({name:"KendoVueExternalDropZone",props:{id:String,tabIndex:Number,innerStyle:Object,uploadRef:[String,Function,Object],disabled:Boolean,customHint:[String,Function,Object],customNote:[String,Function,Object]},inject:{kendoLocalizationService:{default:null}},created(){n.validatePackage(ke),this.elementInterval=null,this.elementActive=!1,this.lastElementDragOverRef=null},data:()=>({overDropZone:!1}),mounted(){this.externalDropZone=this.externalDropZoneRef},methods:{focus(){this.externalDropZone&&this.externalDropZone.focus&&this.externalDropZone.focus()},isDragOver:e=>(new Date).getTime()-(e||new Date).getTime()>100,handleOnDrop(e){e.preventDefault();let t=e.dataTransfer.files,n=this.$parent.$refs[this.$props.uploadRef];t.length>0&&!this.$props.disabled&&n&&n.onAdd&&(e.preventDefault(),n.onAdd(t))},handleOnElementDragEnter(){this.elementActive=!0;this.elementInterval=setInterval(()=>{this.isDragOver(this.lastElementDragOver)&&(this.overDropZone=!1,this.elementActive=!1,clearInterval(this.elementInterval),this.elementInterval=null,this.lastElementDragOver=null)},100)},handleOnElementDragOver(e){e.preventDefault(),this.lastElementDragOver=new Date,this.overDropZone=!0}},setup:()=>({externalDropZoneRef:t.ref(null),kendoLocalizationService:t.inject("kendoLocalizationService",{})}),render(){const{customNote:e,customHint:o}=this.$props,s=i.provideLocalizationService(this),l=s.toLanguageString(R,U[R]),r=s.toLanguageString(D,U[D]),d=n.templateRendering.call(this,o,n.getListeners.call(this)),c=n.templateRendering.call(this,e,n.getListeners.call(this));let u;const p=t.createVNode("span",null,[l]);let h;u=n.getTemplate.call(this,{h:t.h,template:d,defaultRendering:p});const m=t.createVNode("span",null,[r]);return h=n.getTemplate.call(this,{h:t.h,template:c,defaultRendering:m}),t.createVNode("div",{ref:n.setRef(this,"externalDropZone"),id:this.$props.id,class:n.classNames("k-external-dropzone",{"k-external-dropzone-hover":this.overDropZone,"k-disabled":this.$props.disabled},this.$props.className),tabindex:n.getTabIndex(this.$props.tabIndex,this.$props.disabled,void 0),onDrop:this.handleOnDrop,onDragenter:this.handleOnElementDragEnter,onDragover:this.handleOnElementDragOver},[t.createVNode("div",{style:this.$props.innerStyle,class:"k-dropzone-inner"},[t.createVNode(n.Icon,{name:"upload",icon:a.uploadIcon,class:"k-dropzone-icon",size:"xxxlarge"},null),t.createVNode("span",{class:"k-dropzone-hint"},[u]),t.createVNode("span",{class:"k-dropzone-note"},[h])]),t.createVNode("div",{class:"k-upload"},null)])}});e.ExternalDropZone=Ce,e.Upload=Ie,e.UploadFileStatus=l,e.UploadListActionButton=M,e.UploadListMultiItem=Z,e.UploadListSingleItem=K,e.UploadUI=ne,e.messages=U,e.utils=_});
15
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("@progress/kendo-vue-common"),require("@progress/kendo-vue-intl"),require("@progress/kendo-vue-progressbars"),require("@progress/kendo-vue-buttons"),require("@progress/kendo-svg-icons")):"function"==typeof define&&define.amd?define(["exports","vue","@progress/kendo-vue-common","@progress/kendo-vue-intl","@progress/kendo-vue-progressbars","@progress/kendo-vue-buttons","@progress/kendo-svg-icons"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoVueUpload={},e.Vue,e.KendoVueCommon,e.KendoVueIntl,e.KendoVueProgressbars,e.KendoVueButtons,e.KendoSVGIcons)}(this,function(e,t,n,i,o,s,a){"use strict";var l=(e=>(e[e.UploadFailed=0]="UploadFailed",e[e.Initial=1]="Initial",e[e.Selected=2]="Selected",e[e.Uploading=3]="Uploading",e[e.Uploaded=4]="Uploaded",e[e.RemoveFailed=5]="RemoveFailed",e[e.Removing=6]="Removing",e))(l||{});const r="upload.cancel",d="upload.clearSelectedFiles",c="upload.dropFileHere",u="upload.dropFilesHere",p="upload.headerStatusUploaded",h="upload.headerStatusUploading",m="upload.invalidFileExtension",f="upload.invalidFiles",g="upload.invalidMaxFileSize",v="upload.invalidMinFileSize",y="upload.remove",b="upload.retry",F="upload.select",x="upload.selectSingle",S="upload.selectTitle",k="upload.selectNoFilesTitle",I="upload.uploadSelectedFiles",C="upload.total",N="upload.files",B="upload.statusUploaded",E="upload.statusUploadFailed",R="upload.dropZoneHint",D="upload.dropZoneNote",U={[r]:"Cancel",[d]:"Clear",[c]:"Drop a file here to upload",[u]:"Drop files here to upload",[p]:"Done",[h]:"Uploading...",[m]:"File type not allowed.",[f]:"Invalid file(s). Please check file upload requirements.",[g]:"File size too large.",[v]:"File size too small.",[y]:"Remove",[b]:"Retry",[F]:"Select files...",[x]:"Select file...",[S]:"Press to select more files",[k]:"No files selected",[I]:"Upload",[C]:"Total",[N]:"files",[B]:"File(s) successfully uploaded.",[E]:"File(s) failed to upload.",[R]:"Drag and drop files here to upload.",[D]:"Only JPEG and PNG files are allowed."},$=/&/g,L=/</g,w=/"/g,V=/'/g,O=/>/g,A=e=>(""+e).replace($,"&amp;").replace(L,"&lt;").replace(O,"&gt;").replace(w,"&quot;").replace(V,"&#39;"),j=e=>{const t=e.match(/\.([^\.]+)$/);return t?t[0]:""},z=e=>{const t=e.name,n=e.size;return{extension:j(t),name:A(t),getRawFile:()=>e,size:n,status:l.Selected,progress:0,uid:""}},T=e=>!!(e.validationErrors&&e.validationErrors.length>0),_={fileHasValidationErrors:T,filesHaveValidationErrors:e=>{for(const t of e)if(T(t))return!0;return!1},getTotalFilesSizeMessage:e=>{let t,n=0;if("number"!=typeof e[0].size)return"";for(t=0;t<e.length;t++)e[t].size&&(n+=e[t].size||0);return n/=1024,n<1024?n.toFixed(2)+" KB":(n/1024).toFixed(2)+" MB"},getAllFileInfo:e=>{const t=new Array;let n;for(n=0;n<e.length;n++)t.push(z(e[n]));return t},getFileInfo:z,getFileExtension:j,htmlEncode:A,assignGuidToFiles:(e,t)=>{const i=n.guid();return e.map(e=>(e.uid=t?i:n.guid(),e))},getFileStatus:e=>{let t=!1,n=!1,i=!1,o=!1;const s=e=>{e.forEach(e=>{e.status===l.Uploading&&(t=!0),e.status===l.Uploaded&&(n=!0),e.status===l.UploadFailed&&(i=!0),T(e)&&(o=!0)})};return Array.isArray(e)?s(e):Object.keys(e).forEach(t=>{s(e[t])}),[t,n,i,o]}},M=t.defineComponent({name:"KendoVueUploadListActionButton",props:{progress:Number,uid:String,status:Number,async:Object,disabled:Boolean,files:Array},emits:{cancel:null,retry:null,remove:null},inject:{kendoLocalizationService:{default:null}},data:()=>({retryFocused:!1,actionFocused:!1}),methods:{actionButtonTitle:(e,t)=>e===l.Uploading?t.toLanguageString(r,U[r]):t.toLanguageString(y,U[y]),retryButtonTitle:e=>e.toLanguageString(b,U[b]),buttonClassNames(e){return n.classNames(this.actionFocused&&"action"===e||this.retryFocused&&"retry"===e?"k-focus":"")},onRetryFocus(){this.retryFocused=!0},onRetryBlur(){this.retryFocused=!1},onActionFocus(){this.actionFocused=!0},onActionBlur(){this.actionFocused=!1},onActionClick(){const{status:e,uid:t,disabled:n}=this.$props;n||e===l.Removing||(e===l.Uploading?this.$emit("cancel",t):this.$emit("remove",t))},onRetryClick(){const{uid:e,disabled:t}=this.$props;t||this.$emit("retry",e)}},setup:()=>({kendoLocalizationService:t.inject("kendoLocalizationService",{})}),render(){const{status:e,progress:n}=this.$props,o=e===l.UploadFailed,r=e===l.Uploading,d=(e===l.Uploaded||e===l.Initial)&&!this.$props.async.removeUrl,c=i.provideLocalizationService(this);return t.createVNode("div",{class:"k-upload-actions"},[r?t.createVNode("span",{class:"k-upload-pct"},[n,"%"]):void 0,o?t.createVNode(s.Button,{type:"button",fillMode:"flat",tabIndex:-1,disabled:this.disabled,class:this.buttonClassNames("retry"),icon:"arrow-rotate-cw",svgIcon:a.arrowRotateCwIcon,iconClass:"k-retry",ariaLabel:this.retryButtonTitle(c),title:this.retryButtonTitle(c),onFocus:this.onRetryFocus,onBlur:this.onRetryBlur,onClick:this.onRetryClick},null):void 0,d?void 0:t.createVNode(s.Button,{type:"button",fillMode:"flat",tabIndex:-1,disabled:this.disabled,class:this.buttonClassNames("action"),onFocus:this.onActionFocus,onBlur:this.onActionBlur,onClick:this.onActionClick,icon:e===l.Uploading?"cancel":"x",svgIcon:r?a.cancelIcon:a.xIcon,ariaLabel:this.actionButtonTitle(e,c),title:this.actionButtonTitle(e,c)},null)])}}),K=t.defineComponent({name:"KendoVueUploadListSingleItem",props:{files:Array,disabled:Boolean,async:Object},emits:{cancel:null,retry:null,remove:null},inject:{kendoLocalizationService:{default:null}},methods:{onRetry(e){this.$emit("retry",e)},onRemove(e){this.$emit("remove",e)},onCancel(e){this.$emit("cancel",e)},getFileExtension:e=>e.extension?e.extension.substring(1):"",getFileValidationMessage(e,t){const n=i.provideLocalizationService(this);let o="";if(t)o=n.toLanguageString(E,U[E]);else if(e.validationErrors&&e.validationErrors.length>0){const t=`upload.${e.validationErrors[0]}`;o=n.toLanguageString(t,U[t])}return o},getFileExtensionName(e){switch(e.extension){case".png":case".jpg":case".jpeg":case".tiff":case".bmp":case".gif":return"file-image";case".mp3":case".mp4":case".wav":return"file-audio";case".mkv":case".webm":case".flv":case".gifv":case".avi":case".wmv":return"file-video";case".txt":return"file-txt";case".pdf":return"file-pdf";case".ppt":case".pptx":return"file-presentation";case".csv":case".xls":case".xlsx":return"file-data";case".html":case".css":case".js":case".ts":return"file-programming";case".exe":return"file-config";case".zip":case".rar":return"file-zip";default:return"file"}},getFileExtensionSVG(e){switch(e.extension){case".png":case".jpg":case".jpeg":case".tiff":case".bmp":case".gif":return a.fileImageIcon;case".mp3":case".mp4":case".wav":return a.fileAudioIcon;case".mkv":case".webm":case".flv":case".gifv":case".avi":case".wmv":return a.fileVideoIcon;case".txt":return a.fileTxtIcon;case".pdf":return a.filePdfIcon;case".ppt":case".pptx":return a.filePresentationIcon;case".csv":case".xls":case".xlsx":return a.fileDataIcon;case".html":case".css":case".js":case".ts":return a.fileProgrammingIcon;case".exe":return a.fileConfigIcon;case".zip":case".rar":return a.fileZipIcon;default:return a.fileIcon}}},setup:()=>({kendoLocalizationService:t.inject("kendoLocalizationService",{})}),render(){const{files:e,disabled:s,async:a}=this.$props,l=e[0],r=n.classNames("k-file-single"),[,d,c,u]=_.getFileStatus([l]),p=!u&&!d&&!c;return t.createVNode("div",{class:r},[p&&t.createVNode(o.ProgressBar,{value:l.progress||0,labelVisible:!1},null),t.createVNode("span",{class:"k-file-icon-wrapper",key:"1"},[t.createVNode(n.Icon,{name:this.getFileExtensionName(l),icon:this.getFileExtensionSVG(l),size:"xxxlarge",class:"k-file-icon"},null),t.createVNode("span",{class:"k-file-state"},null)]),u||c?function(e,n){return t.createVNode("span",{class:"k-file-info",key:"2"},[t.createVNode("span",{class:"k-file-name",title:e.name},[e.name]),t.createVNode("span",{class:"k-file-validation-message"},[this.getFileValidationMessage(e,n)])])}.call(this,l,c):function(e){const n=i.provideLocalizationService(this).toLanguageString(B,U[B]);return t.createVNode("span",{class:"k-file-info",key:"2"},[t.createVNode("span",{class:"k-file-name",title:e.name},[e.name]),100!==e.progress?t.createVNode("span",{class:"k-file-size"},[_.getTotalFilesSizeMessage([e])]):t.createVNode("span",{class:"k-file-validation-message"},[n])])}.call(this,l),t.createVNode(M,{uid:l.uid,status:l.status,progress:l.progress,files:e,disabled:s,async:a,onCancel:this.onCancel,onRemove:this.onRemove,onRetry:this.onRetry},null)])}}),Z=t.defineComponent({name:"KendoVueUploadListMultiItem",props:{files:Array,disabled:Boolean,async:Object},emits:{cancel:null,retry:null,remove:null},inject:{kendoLocalizationService:{default:null}},methods:{onRetry(e){this.$emit("retry",e)},onRemove(e){this.$emit("remove",e)},onCancel(e){this.$emit("cancel",e)},getFileValidationMessage(e){const t=i.provideLocalizationService(this);let n="";if(e.validationErrors&&e.validationErrors.length>0){const i=`upload.${e.validationErrors[0]}`;n=t.toLanguageString(i,U[i])}return n},progress(){const{files:e}=this.$props;let t=0;return e.forEach(e=>{t+=e.progress||0}),t/e.length}},setup:()=>({kendoLocalizationService:t.inject("kendoLocalizationService",{})}),render(){const{files:e,disabled:s,async:l}=this.$props,r=n.classNames("k-file-multiple"),[,d,c,u]=_.getFileStatus(e),p=i.provideLocalizationService(this),h=p.toLanguageString(C,U[C]),m=p.toLanguageString(N,U[N]),f=p.toLanguageString(E,U[E]),g=p.toLanguageString(B,U[B]),v=this.progress(),y=!u&&!d&&!c;return t.createVNode("div",{class:r},[y&&t.createVNode(o.ProgressBar,{value:v||0,labelVisible:!1},null),t.createVNode("span",{class:"k-file-icon-wrapper"},[t.createVNode(n.Icon,{name:"copy",icon:a.copyIcon,size:"xxxlarge",class:"k-file-icon"},null)]),t.createVNode("span",{class:"k-multiple-files-wrapper"},[function(){return e.map(function(e){return t.createVNode("span",{key:e.name,class:"k-file-info"},[t.createVNode("span",{class:"k-file-name",title:e.name},[e.name]),_.fileHasValidationErrors(e)?t.createVNode("span",{class:"k-file-validation-message"},[this.getFileValidationMessage(e)]):t.createVNode("span",{key:`${e.name}-size`,class:"k-file-size"},[_.getTotalFilesSizeMessage([e])])])},this)}.call(this),c?t.createVNode("span",{class:"k-file-validation-message"},[`${e.length} ${f}`]):100!==v?t.createVNode("span",{class:"k-file-summary"},[`${h}: ${e.length} ${m}, ${_.getTotalFilesSizeMessage(e)}`]):t.createVNode("span",{class:"k-file-summary k-text-success"},[`${e.length} ${g}`])]),t.createVNode(M,{uid:e[0].uid,status:e[0].status,progress:v,files:e,disabled:s,async:l,onCancel:this.onCancel,onRemove:this.onRemove,onRetry:this.onRetry},null)])}}),q=t.defineComponent({name:"KendoVueUploadListGroup",props:{files:Array,async:Object,disabled:Boolean,navigationIndex:Number,list:[String,Function,Object],index:Number},emits:{cancel:null,click:null,retry:null,remove:null},mounted(){this._element=this.elementRef},updated(){const{navigationIndex:e,index:t}=this.$props;e===t&&this._element&&n.canUseDOM&&document.activeElement!==this._element&&this._element.focus()},methods:{onClick(){this.$emit("click",this.$props.index)},onRetry(e){this.$emit("retry",e)},onRemove(e){this.$emit("remove",e)},onCancel(e){this.$emit("cancel",e)}},setup:()=>({elementRef:t.ref(null)}),render(){const{files:e,async:i,disabled:o,navigationIndex:s,index:a}=this.$props,r=e[0],d=r.status===l.Uploaded||r.status===l.Initial,c=_.filesHaveValidationErrors(e),u=r.status===l.UploadFailed||r.status===l.RemoveFailed,p=n.classNames("k-file",{"k-file-invalid":c,"k-file-error":u||c,"k-file-progress":r.status===l.Uploading,"k-file-success":d,"k-focus":s===a});let h;const m=1===e.length?t.createVNode(K,{files:e,async:i,disabled:o,onCancel:this.onCancel,onRemove:this.onRemove,onRetry:this.onRetry},null):t.createVNode(Z,{files:e,async:i,disabled:o,onCancel:this.onCancel,onRemove:this.onRemove,onRetry:this.onRetry},null);return h=n.getTemplate.call(this,{h:t.h,template:this.$props.list,defaultRendering:m,additionalProps:this.$props,additionalListeners:{retry:this.onRetry,remove:this.onRemove,cancel:this.onCancel}}),t.createVNode("li",{ref:n.setRef(this,"element"),class:p,"data-uid":r.uid,tabindex:-1,onClick:this.onClick},[h])}}),H=t.defineComponent({name:"KendoVueUploadList",props:{groupedFiles:Object,async:Object,disabled:Boolean,navigationIndex:{type:Number,default:void 0},list:[String,Function,Object]},emits:{cancel:null,click:null,retry:null,remove:null},methods:{onClick(e){this.$emit("click",e)},onRetry(e){this.$emit("retry",e)},onRemove(e){this.$emit("remove",e)},onCancel(e){this.$emit("cancel",e)}},render(){const{groupedFiles:e,navigationIndex:i,async:o,disabled:s,list:a}=this.$props,l=n.classNames("k-upload-files","k-reset");return t.createVNode("ul",{class:l},[Object.keys(e).map(function(n,l){const r=e[n];return t.createVNode(q,{key:n,files:r,index:l,navigationIndex:i,async:o,disabled:s,list:a,onCancel:this.onCancel,onClick:this.onClick,onRemove:this.onRemove,onRetry:this.onRetry},null)},this)])}});function P(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const G=t.defineComponent({name:"KendoVueUploadActionButtons",props:{disabled:Boolean,navigationIndex:Number,clearButtonIndex:Number,uploadButtonIndex:Number,actionsLayout:String},inject:{kendoLocalizationService:{default:null}},emits:{clear:null,click:null,upload:null},created(){this._prevNavigationIndex=void 0},setup:()=>({uploadElementRef:t.ref(null),clearElementRef:t.ref(null),kendoLocalizationService:t.inject("kendoLocalizationService",{})}),mounted(){this._clearElement=this.clearElementRef,this._uploadElement=this.uploadElementRef},watch:{navigationIndex:function(e,t){this._prevNavigationIndex=t}},updated(){const{navigationIndex:e,clearButtonIndex:t,uploadButtonIndex:n}=this.$props;e!==this._prevNavigationIndex&&(e===t&&this._clearElement&&this._clearElement.focus(),e===n&&this._uploadElement&&this._uploadElement.focus())},methods:{onClearClick(){this.$props.disabled||this.$emit("clear")},onUploadClick(){this.$props.disabled||(this.$emit("click",this.$props.uploadButtonIndex),this.$emit("upload"))}},render(){let e,o;const{disabled:a,navigationIndex:l,clearButtonIndex:r,uploadButtonIndex:c,actionsLayout:u}=this.$props,p=i.provideLocalizationService(this),h=n.classNames("k-actions",{"k-actions-start":"start"===u,"k-actions-center":"center"===u,"k-actions-end":"end"===u,"k-actions-stretched":"stretched"===u}),m=n.classNames("k-clear-selected",l===r?"k-focus":""),f=n.classNames("k-upload-selected",l===c?"k-focus":"");return t.createVNode("div",{class:h},[t.createVNode(s.Button,{type:"button",ref:e=>{this.clearElementRef=e},disabled:a,class:m,tabIndex:-1,onClick:this.onClearClick},P(e=p.toLanguageString(d,U[d]))?e:{default:()=>[e]}),t.createVNode(s.Button,{type:"button",ref:e=>{this.uploadElementRef=e},disabled:a,themeColor:"primary",class:f,tabIndex:-1,onClick:this.onUploadClick},P(o=p.toLanguageString(I,U[I]))?o:{default:()=>[o]})])}}),X=/(chrome)[ \/]([\w.]+)/i,J=/(webkit)[ \/]([\w.]+)/i,Q=t.defineComponent({name:"KendoVueUploadInput",props:{async:Object,id:String,multiple:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},accept:{type:String,default:void 0},hasFiles:{type:Boolean,default:!1},ariaLabelledBy:{type:String,default:void 0},ariaDescribedBy:{type:String,default:void 0}},emits:{mousedown:null,add:null},inject:{kendoLocalizationService:{default:null}},mounted(){this._input=this.inputRef},methods:{onMouseDown(e){this.$emit("mousedown",e)},onAdd(){const e=navigator.userAgent,t=this._input;t&&(t.files&&this.$emit("add",t.files),!e.match(X)&&e.match(J)||(t.type="",t.type="file"))},actionElement(){return this._input}},setup:()=>({inputRef:t.ref(null)}),render(){const{multiple:e,async:o,disabled:s,accept:a,hasFiles:l,ariaLabelledBy:r,ariaDescribedBy:d}=this.$props,c=i.provideLocalizationService(this),u=l?S:k,p=c.toLanguageString(u,U[u]);return c.toLanguageString(F,U[F]),t.createVNode("input",{ref:n.setRef(this,"input"),id:this.id,class:"k-hidden",autocomplete:"off",name:o.saveField,accept:a,type:"file",tabindex:-1,multiple:e,disabled:s,onChange:this.onAdd,onMousedown:this.onMouseDown,title:p,"aria-hidden":!0,"aria-labelledby":r,"aria-describedby":d},null)}});function W(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const Y=t.defineComponent({name:"KendoVueUploadAddButton",props:{addButtonIndex:Number,navigationIndex:Number,notFocusedIndex:Number,tabIndex:Number,async:Object,multiple:Boolean,disabled:Boolean,accept:String,id:String,ariaLabelledBy:String,ariaDescribedBy:String},inject:{kendoLocalizationService:{default:null}},emits:{add:null,click:null},setup:()=>({elementRef:t.ref(null),uploadInputRef:t.ref(null),kendoLocalizationService:t.inject("kendoLocalizationService",{})}),created(){this.uploadInputId=n.guid()},mounted(){this.element=this.elementRef,this.uploadInput=this.uploadInputRef},watch:{navigationIndex:function(e,t){this._prevNavigationIndex=t}},updated(){const{navigationIndex:e,addButtonIndex:t,notFocusedIndex:n}=this.$props;e!==this._prevNavigationIndex&&this._prevNavigationIndex!==n&&e===t&&this.element&&this.element.focus()},methods:{focus(){this.element&&this.element.focus()},onClick(){this.actionElement()&&this.actionElement().click(),this.$emit("click",this.$props.addButtonIndex)},onAdd(e){this.$emit("add",e)},onInputMouseDown(e){this.element&&(e.preventDefault(),this.element.focus())},actionElement(){if(this.uploadInput)return this.uploadInput.actionElement()}},render(){const{navigationIndex:e,addButtonIndex:o,tabIndex:a,id:l,async:r,multiple:d,disabled:c,accept:u,ariaLabelledBy:p,ariaDescribedBy:h}=this.$props,m=i.provideLocalizationService(this),f=d?m.toLanguageString(F,U[F]):m.toLanguageString(x,U[x]),g=n.classNames("k-upload-button",e===o?"k-focus":"");return t.createVNode("div",{class:"k-upload-button-wrap"},[t.createVNode(s.Button,{id:l,ref:n.setRef(this,"element"),type:"button",disabled:c,class:g,tabIndex:a,"aria-labelledby":p,"aria-describedby":h,onClick:this.onClick},W(f)?f:{default:()=>[f]}),t.createVNode(Q,{id:this.uploadInputId,async:r,multiple:d,disabled:c,accept:u,onMousedown:this.onInputMouseDown,onAdd:this.onAdd,ref:e=>{this.uploadInputRef=e}},null)])}}),ee=t.defineComponent({props:{isUploading:Boolean,isUploaded:Boolean,isUploadFailed:Boolean},inject:{kendoLocalizationService:{default:null}},setup:()=>({kendoLocalizationService:t.inject("kendoLocalizationService",{})}),render(){const{isUploading:e,isUploaded:o,isUploadFailed:s}=this.$props;let l="";const r=i.provideLocalizationService(this);return e?l=r.toLanguageString(h,U[h]):(o||s)&&(l=r.toLanguageString(p,U[p])),t.createVNode("div",{class:n.classNames("k-upload-status")},[t.createVNode(n.Icon,{name:e||s||!o?!e&&s?"exclamation-circle":e?"upload":"":"check",icon:e||s||!o?!e&&s?a.exclamationCircleIcon:e?a.uploadIcon:{}:a.checkIcon},null),l])}}),te=t.defineComponent({name:"KendoVueUploadDropZone",props:{addButtonIndex:Number,async:Object,multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},showFileList:Boolean,showActionButtons:Boolean,actionsLayout:{type:String,default:function(){return"end"}},tabIndex:Number,accept:String,groupedFiles:{type:Object,default:function(){return{}}},navigationIndex:Number,notFocusedIndex:Number,list:[String,Function,Object],id:String,ariaLabelledBy:String,ariaDescribedBy:String,fileGroup:Object},emits:{add:null,click:null},inject:{kendoLocalizationService:{default:null}},data:()=>({currentDocumentActive:!1,currentElementActive:!1}),created(){this.currentElementActive=!1},mounted(){this.uploadAddButton=this.uploadAddButtonRef,document.addEventListener("dragenter",this.onDocumentDragEnter),document.addEventListener("dragover",this.onDocumentDragOver)},unmounted(){document.removeEventListener("dragenter",this.onDocumentDragEnter),document.removeEventListener("dragover",this.onDocumentDragOver)},setup:()=>({uploadAddButtonRef:t.ref(null),kendoLocalizationService:t.inject("kendoLocalizationService",{})}),computed:{dropZoneClasses(){return{"k-dropzone":!0,"k-upload-dropzone":!0,"k-active":this.currentDocumentActive,"k-hover":this.currentElementActive}}},methods:{actionElement(){if(this.uploadAddButton)return this.uploadAddButton.uploadInput},focus(){if(this.uploadAddButton)return this.uploadAddButton.focus()},onDocumentDragEnter(){if(!this.currentDocumentActive){this.currentDocumentActive=!0;const e=()=>{this.isDragOver(this._lastDocumentDragOver)&&(this.currentDocumentActive=!1,clearInterval(this._documentInterval),this._documentInterval=null,this._lastDocumentDragOver=null)};this._documentInterval=setInterval(e,100)}},onDocumentDragOver(){this._lastDocumentDragOver=new Date},onElementDragEnter(){if(!this.currentElementActive){this.currentElementActive=!0;const e=()=>{this.isDragOver(this._lastElementDragOver)&&(this.currentElementActive=!1,clearInterval(this._elementInterval),this._elementInterval=null,this._lastElementDragOver=null)};this._elementInterval=setInterval(e,100)}},onElementDragOver(e){e.preventDefault(),this._lastElementDragOver=new Date},onDrop(e){e.preventDefault();let t=e.dataTransfer.files;t.length>0&&!this.$props.disabled&&this.$emit("add",t)},isDragOver:e=>(new Date).getTime()-(e||new Date).getTime()>100,onClick(e){this.$emit("click",e)},onAdd(e){this.$emit("add",e)}},render(){const{multiple:e,disabled:o,tabIndex:s,fileGroup:a,accept:l,navigationIndex:r,notFocusedIndex:d,id:p,ariaLabelledBy:h,ariaDescribedBy:m}=this.$props,f=i.provideLocalizationService(this),g=e?f.toLanguageString(u,U[u]):f.toLanguageString(c,U[c]),[v,y,b,F]=_.getFileStatus(a),x=n.classNames("k-dropzone-hint",{"k-hidden":!this.currentElementActive}),S=v||y||b||F;return t.createVNode("div",{class:this.dropZoneClasses,onDrop:this.onDrop,onDragenter:this.onElementDragEnter,onDragover:this.onElementDragOver},[function(){return t.createVNode(Y,{id:p,ariaLabelledBy:h,ariaDescribedBy:m,ref:e=>{this.uploadAddButtonRef=e},accept:l,async:this.async,addButtonIndex:this.addButtonIndex,navigationIndex:r,notFocusedIndex:d,tabIndex:s,multiple:e,disabled:o,onClick:this.onClick,onAdd:this.onAdd},null)}.call(this),t.createVNode("div",{class:x},[g]),S?t.createVNode(ee,{isUploading:v,isUploaded:y,isUploadFailed:b},null):t.createVNode("span",{class:"k-upload-status"},null)])}}),ne=t.defineComponent({name:"KendoVueUploadUI",props:{async:Object,className:String,multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},showFileList:Boolean,showActionButtons:Boolean,actionsLayout:{type:String,default:function(){return"end"}},tabIndex:Number,accept:String,groupedFiles:{type:Object,default:function(){return{}}},navigationIndex:Number,notFocusedIndex:Number,list:[String,Function,Object],id:String,ariaLabelledBy:String,ariaDescribedBy:String},computed:{groupsCount(){return Object.keys(this.$props.groupedFiles).length},lastGroupIndex(){return this.groupsCount-1},addButtonIndex:()=>-1,clearButtonIndex(){return this.lastGroupIndex+1},uploadButtonIndex(){return this.lastGroupIndex+2},isRtl(){return this._container&&"rtl"===getComputedStyle(this._container).direction||!1}},methods:{actionElement(){if(this.uploadDropZone)return this.uploadDropZone.actionElement()},focus(){if(this.uploadDropZone)return this.uploadDropZone.focus()},onAdd(e){this.$emit("add",e)},onRetry(e){this.$emit("retry",e)},onCancel(e){this.$emit("cancel",e)},onClear(){this.$emit("clear")},onUpload(){this.$emit("upload")},onRemove(e){this.$emit("remove",e)},onKeyDown(e){this.$emit("keydown",e,this.isRtl)},onFocus(e){this.$emit("focus",e)},onBlur(e){this.$emit("blur",e)},onClick(e){this.$emit("click",e)}},emits:{add:null,retry:null,cancel:null,clear:null,upload:null,remove:null,keydown:null,click:null,focus:null,blur:null},mounted(){this._container=this.containerRef,this.uploadDropZone=this.uploadDropZoneRef},setup:()=>({containerRef:t.ref(null),uploadDropZoneRef:t.ref(null)}),render(){const{multiple:e,disabled:i,tabIndex:o,accept:s,showFileList:a,groupedFiles:l,navigationIndex:r,showActionButtons:d,actionsLayout:c,notFocusedIndex:u,list:p,id:h,ariaLabelledBy:m,ariaDescribedBy:f,async:g}=this.$props,v=n.classNames("k-upload","k-upload-async",{"k-upload-empty":0===Object.keys(l).length},this.$props.className,i?"k-disabled":"");return t.createVNode("div",{ref:n.setRef(this,"container"),class:v,onKeydown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur},[t.createVNode(te,{id:h,ariaLabelledBy:m,ariaDescribedBy:f,ref:e=>{this.uploadDropZoneRef=e},accept:s,async:g,addButtonIndex:this.addButtonIndex,navigationIndex:r,notFocusedIndex:u,tabIndex:o,multiple:e,onClick:this.onClick,onAdd:this.onAdd,fileGroup:l,disabled:i},null),a?t.createVNode(H,{groupedFiles:l,disabled:i,async:g,navigationIndex:r,list:p,onCancel:this.onCancel,onRemove:this.onRemove,onRetry:this.onRetry,onClick:this.onClick},null):void 0,d?t.createVNode(G,{disabled:i,navigationIndex:r,clearButtonIndex:this.clearButtonIndex,uploadButtonIndex:this.uploadButtonIndex,actionsLayout:c,onUpload:this.onUpload,onClear:this.onClear,onClick:this.onClick},null):void 0])}}),ie=-2,oe=-1,se=t.defineComponent({name:"KendoVueUploadNavigation",props:{async:Object,className:String,multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},showFileList:Boolean,showActionButtons:Boolean,actionsLayout:{type:String,default:function(){return"end"}},tabIndex:Number,accept:String,groupedFiles:{type:Object,default:function(){return{}}},notFocusedIndex:Number,list:[String,Function,Object],id:String,ariaLabelledBy:String,ariaDescribedBy:String,restrictions:Object,files:Array,defaultFiles:Array},emits:{add:null,cancel:null,clear:null,upload:null,retry:null,remove:null},data:()=>({currentNavIndex:ie}),updated(){},methods:{actionElement(){if(this._uploadUI)return this._uploadUI.actionElement()},navIndex(e){if(void 0===e)return this.currentNavIndex;const t=this.navIndex;this.currentNavIndex=e,e!==t&&this.$forceUpdate()},focus(){this._uploadUI&&this._uploadUI.focus()},onKeyDown(e,t){var i;const o=this.navIndex(),s=Object.keys(this.$props.groupedFiles),a=s.length-1,l=this.$props.autoUpload||0===s.length?a:a+1,r=a+1,d=r+1,c=o===ie?oe:o;let u=o;switch(e.keyCode){case n.Keys.up:e.preventDefault(),o>-1&&(u=c-1);break;case n.Keys.down:e.preventDefault(),o<l&&(u=c+1);break;case n.Keys.left:e.preventDefault(),t?o===r&&(u=c+1):o===d&&(u=c-1);break;case n.Keys.right:e.preventDefault(),t?o===d&&(u=c-1):o===r&&(u=c+1);break;case n.Keys.enter:(o===oe||o===ie)&&this.actionElement()&&n.canUseDOM&&-1===(null==(i=document.activeElement)?void 0:i.className.indexOf("k-upload-button"))&&this.actionElement().$el.click(),o>=0&&o<=a&&this.onRetry(s[o]);break;case n.Keys.space:e.preventDefault(),(o===oe||o===ie)&&this.actionElement()&&this.actionElement().$el.click();break;case n.Keys.tab:u=ie;break;case n.Keys.delete:o>=0&&o<=a&&(u=c-1,this.onRemove(s[o]));break;case n.Keys.esc:o>=0&&o<=a&&(u=c-1,this.onCancel(s[o]))}this.navIndex(u)},onCancel(e){this.$emit("cancel",e)},onClear(){this.navIndex(oe),this.$emit("clear")},onUpload(){this.navIndex(oe),this.$emit("upload")},onRetry(e){this.$emit("retry",e)},onRemove(e){this.navIndex(this.navIndex()>oe?this.navIndex()-1:oe),this.$emit("remove",e)},onAdd(e){this.navIndex(oe),this.$emit("add",e)},onClick(e){this.navIndex(e)},onFocus(){this._blurTimeout&&(clearTimeout(this._blurTimeout),this._blurTimeout=void 0)},onBlurTimeout(){this.navIndex(ie),this._blurTimeout=void 0},onBlur(){clearTimeout(this._blurTimeout),this._blurTimeout=window.setTimeout(this.onBlurTimeout)}},mounted(){this._uploadUI=this.uploadUIRef},setup:()=>({uploadUIRef:t.ref(null)}),render(){const{multiple:e,disabled:n,showFileList:i,showActionButtons:o,actionsLayout:s,tabIndex:a,accept:l,groupedFiles:r,list:d,id:c,ariaLabelledBy:u,ariaDescribedBy:p,async:h}=this.$props;return t.createVNode(ne,{ref:e=>{this.uploadUIRef=e},class:this.$props.className,onKeydown:this.onKeyDown,navigationIndex:this.currentNavIndex,notFocusedIndex:ie,onAdd:this.onAdd,onClear:this.onClear,onUpload:this.onUpload,onRemove:this.onRemove,onRetry:this.onRetry,onCancel:this.onCancel,onClick:this.onClick,onFocus:this.onFocus,onBlur:this.onBlur,multiple:e,disabled:n,showFileList:i,showActionButtons:o,actionsLayout:s,tabIndex:a,accept:l,groupedFiles:r,list:d,id:c,ariaLabelledBy:u,ariaDescribedBy:p,async:h},null)}}),ae=(e,t)=>{t.push(e)},le=(e,t)=>{Object.keys(e).forEach(n=>{t(e[n],n)})},re={copyState:e=>(e||[]).map(e=>({...e})),addMany:(e,t)=>{e.forEach(e=>ae(e,t))},add:ae,groupFilesByUid:e=>{const t={};return e.forEach(e=>{t[e.uid]?t[e.uid].push(e):t[e.uid]=[e]}),t},filesForUpload:e=>{const t={};return le(e,(e,n)=>{let i=!0;e.forEach(e=>{(e.status!==l.Selected||e.validationErrors&&e.validationErrors.length>0)&&(i=!1)}),i&&(t[n]=e)}),t},setFilesStatus:(e,t)=>{le(e,e=>{e.forEach(e=>{e.status=t})})},flatFileGroup:e=>{const t=[];return le(e,e=>{t.push.apply(t,e)}),t},groupForEach:le},de=(e,t)=>{Object.keys(t).forEach(n=>{e.append(n,t[n])})},ce=e=>{const t=e.getAllResponseHeaders(),n={};return t&&t.trim().split(/[\r\n]+/).forEach(e=>{const t=e.indexOf(":");t>0&&(n[e.substring(0,t).trim().toLowerCase()]=e.substring(t+1).trim())}),n},ue=(e,t,n)=>{const i=new FormData;return de(i,n),e.forEach(e=>{const n=e.getRawFile?e.getRawFile():"";n?i.append(t,n,e.name):i.append(t,n)}),i},pe=(e,t,n)=>{const i=new FormData;return de(i,n),e.forEach(e=>{i.append(t,e)}),i},he=(e,t)=>({headers:e,responseType:t.responseType,withCredentials:t.withCredentials}),me=(e,t)=>{var n;if(void 0!==e)return e;if(!t||void 0===globalThis.location)return!0;const i=(null==(n=globalThis.document)?void 0:n.baseURI)||globalThis.location.href;try{return new URL(t,i).origin===globalThis.location.origin}catch{return!0}},fe=e=>{const t={};return Object.keys(e).forEach(n=>{t[n]=e[n]}),t},ge=e=>({response:e.response,status:e.status,statusText:e.statusText,headers:e.request?ce(e.request):e.headers||{},request:e.request}),ve="invalidMaxFileSize",ye="invalidMinFileSize",be="invalidFileExtension",Fe=(e,t)=>{t.length>0&&t.indexOf((e.extension||"").toLowerCase())<0&&(e.validationErrors=e.validationErrors||[],e.validationErrors.indexOf(be)<0&&e.validationErrors.push(be))},xe=(e,t,n)=>{0!==t&&(e.size||0)<t&&(e.validationErrors=e.validationErrors||[],e.validationErrors.indexOf(ye)<0&&e.validationErrors.push(ye)),0!==n&&(e.size||0)>n&&(e.validationErrors=e.validationErrors||[],e.validationErrors.indexOf(ve)<0&&e.validationErrors.push(ve))},Se=(e,t,n)=>{const i=(e=>e.map(e=>("."===e.substring(0,1)?e:"."+e).toLowerCase()))(t.allowedExtensions||[]),o=t.maxFileSize||0,s=t.minFileSize||0;let a;for(a=0;a<e.length;a++)Fe(e[a],i),xe(e[a],s,o),n&&n(e[a])},ke={name:"@progress/kendo-vue-upload",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:1619764257,version:"11.1.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning"},Ie=t.defineComponent({name:"KendoVueUpload",props:{autoUpload:{type:Boolean,default:!0},batch:{type:Boolean,default:!1},withCredentials:{type:Boolean,default:void 0},saveField:{type:String,default:function(){return"files"}},saveHeaders:{type:[String,Function,Object],default:function(){return{}}},saveMethod:{type:String,default:function(){return"POST"}},saveUrl:{type:[String,Function],default:function(){return""}},responseType:{type:String,default:function(){return"json"}},removeField:{type:String,default:function(){return"fileNames"}},removeHeaders:{type:[String,Function,Object],default:function(){return{}}},removeMethod:{type:String,default:function(){return"POST"}},removeUrl:{type:[String,Function],default:function(){return""}},multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},showFileList:{type:Boolean,default:!0},showActionButtons:{type:Boolean,default:!0},actionsLayout:{type:String,default:function(){return"end"}},tabIndex:Number,accept:String,list:[String,Function,Object],restrictions:{type:Object,default:function(){return{allowedExtensions:[],maxFileSize:0,minFileSize:0}}},validateFile:Function,files:Array,defaultFiles:Array},emits:{add:null,beforeremove:null,beforeupload:null,cancel:null,statuschange:null,progress:null,remove:null},created(){this._httpSubscriptions={},n.validatePackage(ke),this.$props.defaultFiles&&(this.currentFiles=this.$props.defaultFiles)},data:()=>({currentFiles:[]}),computed:{computedAsync(){const{autoUpload:e,batch:t,removeField:n,removeHeaders:i,removeMethod:o,removeUrl:s,responseType:a,saveField:l,saveHeaders:r,saveMethod:d,saveUrl:c,withCredentials:u}=this.$props;return{autoUpload:e,batch:t,removeField:n,removeHeaders:i,removeMethod:o,removeUrl:s,responseType:a,saveField:l,saveHeaders:r,saveMethod:d,saveUrl:c,withCredentials:u}},computedFiles(){return(this.isControlled?this.$props.files:this.currentFiles)||[]},isControlled(){return!this.$props.defaultFiles},isCustomSave(){return this.$props.saveUrl&&"function"==typeof this.$props.saveUrl},isCustomRemove(){return this.$props.removeUrl&&"function"==typeof this.$props.removeUrl},fileStateCopy(){return re.copyState(this.computedFiles)},actionElement(){if(this._uploadNavigation)return this._uploadNavigation.actionElement}},mounted(){this._uploadNavigation=this.uploadNavigationRef},methods:{focus(){this._uploadNavigation&&this._uploadNavigation.focus()},uploadFiles(e){const t=this.computedAsync;re.setFilesStatus(e,l.Uploading),re.groupForEach(e,(e,n)=>{const i={target:this,files:e,headers:fe(t.saveHeaders||{}),additionalData:{}};this.$emit("beforeupload",i);const o=he(i.headers,this.computedAsync),s=ue(e,t.saveField,i.additionalData);if(this.isCustomSave)this.$props.saveUrl(e,{formData:s,requestOptions:o},this.onUploadProgress).then(e=>this.onUploadSuccess(e.uid)).catch(e=>this.onUploadError(e.uid));else{const e=new XMLHttpRequest;this._httpSubscriptions[n]=()=>e.abort(),e.open(t.saveMethod,t.saveUrl,!0),e.withCredentials=me(o.withCredentials,t.saveUrl),e.responseType=o.responseType||"json",Object.entries(o.headers||{}).forEach(([t,n])=>{e.setRequestHeader(t,n)}),e.upload.onprogress=e=>this.onUploadProgress(n,e),e.onload=()=>{e.status>=200&&e.status<300?this.onUploadSuccess(n,{response:e.response,status:e.status,statusText:e.statusText,request:e}):this.onUploadError(n,{response:e.response,status:e.status,statusText:e.statusText,request:e})},e.onerror=()=>this.onUploadError(n,{response:e.response,status:e.status,statusText:e.statusText,request:e}),e.onabort=()=>{},e.send(s)}})},removeFiles(e){const t=this.computedAsync;re.groupForEach(e,(e,n)=>{const i={target:this,files:e,headers:fe(t.removeHeaders||{}),additionalData:{}};this.$emit("beforeremove",i);const o=e.map(e=>e.name),s=he(i.headers,this.computedAsync),a=pe(o,t.removeField,i.additionalData);if(this.isCustomRemove)this.$props.removeUrl(e,{formData:a,requestOptions:s}).then(e=>this.onRemoveSuccess(e.uid)).catch(e=>this.onRemoveError(e.uid));else{const e=new XMLHttpRequest;e.open(t.removeMethod,t.removeUrl,!0),e.withCredentials=me(s.withCredentials,t.removeUrl),e.responseType=s.responseType||"json",Object.entries(s.headers||{}).forEach(([t,n])=>{e.setRequestHeader(t,n)}),e.onload=()=>{e.status>=200&&e.status<300?this.onRemoveSuccess(n,{response:e.response,status:e.status,statusText:e.statusText,request:e}):this.onRemoveError(n,{response:e.response,status:e.status,statusText:e.statusText,request:e})},e.onerror=()=>this.onRemoveError(n,{response:e.response,status:e.status,statusText:e.statusText,request:e}),e.send(a)}})},onUpload(){const e=this.fileStateCopy,t=re.groupFilesByUid(e),n=re.filesForUpload(t);this.uploadFiles(n);this.isControlled||(this.currentFiles=e),(()=>{const t={target:this,newState:e,affectedFiles:re.flatFileGroup(n)};this.$emit("statuschange",t)})()},onAdd(e){let t,n=_.getAllFileInfo(e);if(n=_.assignGuidToFiles(n,this.computedAsync.batch),Se(n,this.$props.restrictions,this.validateFile),t=this.$props.multiple?this.fileStateCopy:[],re.addMany(n,t),this.computedAsync.autoUpload){const e=re.groupFilesByUid(t);this.uploadFiles(re.filesForUpload(e))}this.isControlled||(this.currentFiles=t),(()=>{const e={target:this,newState:t,affectedFiles:n};this.$emit("add",e)})()},onUploadProgress(e,t){const n=t.total?Math.round(100*t.loaded/t.total):0,i=this.fileStateCopy,o=i.filter(t=>t.uid===e);if(!o.length)return;o.forEach(e=>{e.progress=n});this.isControlled||(this.currentFiles=i),(()=>{const e={target:this,newState:i,affectedFiles:o};this.$emit("progress",e)})()},onUploadSuccess(e,t){const n=this.fileStateCopy,i=n.filter(t=>t.uid===e);i.forEach(e=>{e.status=l.Uploaded,e.progress=100}),delete this._httpSubscriptions[e];this.isControlled||(this.currentFiles=n),(()=>{const e={target:this,newState:n,affectedFiles:i,response:t?ge(t):void 0};this.$emit("statuschange",e)})()},onUploadError(e,t){const n=this.fileStateCopy,i=n.filter(t=>t.uid===e);if(i.forEach(e=>{e.status=l.UploadFailed}),delete this._httpSubscriptions[e],!i.length)return;this.isControlled||(this.currentFiles=n),(()=>{const e={target:this,newState:n,affectedFiles:i,response:t?ge(t):void 0};this.$emit("statuschange",e)})()},onRemove(e){const t=this.fileStateCopy,n=t.filter(t=>t.uid===e),i=t.filter(t=>t.uid!==e),o=[l.Uploaded,l.Initial,l.RemoveFailed];if(n[0]&&o.indexOf(n[0].status)>-1){const i={[e]:n};re.setFilesStatus(i,l.Removing),this.removeFiles(i);const o=()=>{const e={target:this,newState:t,affectedFiles:n};this.$emit("statuschange",e)};this.isControlled||(this.currentFiles=t),o()}else{const e=()=>{const e={target:this,newState:i,affectedFiles:n};this.$emit("remove",e)};this.isControlled||(this.currentFiles=i),e()}},onRemoveSuccess(e,t){const n=this.fileStateCopy,i=n.filter(t=>t.uid===e),o=n.filter(t=>t.uid!==e);this.isControlled||(this.currentFiles=o),(()=>{const e={target:this,newState:o,affectedFiles:i,response:t?ge(t):void 0};this.$emit("remove",e)})()},onRemoveError(e,t){const n=this.fileStateCopy,i=n.filter(t=>t.uid===e);i.forEach(e=>{e.status=l.RemoveFailed});this.isControlled||(this.currentFiles=n),(()=>{const e={target:this,newState:n,affectedFiles:i,response:t?ge(t):void 0};this.$emit("statuschange",e)})()},onRetry(e){const t=this.fileStateCopy,n=re.groupFilesByUid(t.filter(t=>t.uid===e));re.setFilesStatus(n,l.Uploading),this.uploadFiles(n);this.isControlled||(this.currentFiles=t),(()=>{const e={target:this,newState:t,affectedFiles:re.flatFileGroup(n)};this.$emit("statuschange",e)})()},onCancel(e){const t=this.fileStateCopy,n=t.filter(t=>t.uid!==e),i=t.filter(t=>t.uid===e);this._httpSubscriptions[e]&&(this._httpSubscriptions[e](),delete this._httpSubscriptions[e]);const o={target:this,uid:e};this.$emit("cancel",o);this.isControlled||(this.currentFiles=t),(()=>{const e={target:this,newState:n,affectedFiles:i};this.$emit("remove",e)})()},onClear(){if(!this.computedFiles.length)return;Object.keys(this._httpSubscriptions).forEach(e=>{this._httpSubscriptions[e]()}),this._httpSubscriptions={};this.isControlled||(this.currentFiles=[]),(()=>{const e={target:this,newState:[],affectedFiles:this.fileStateCopy};this.$emit("remove",e)})()}},render(){const{showFileList:e,autoUpload:i,showActionButtons:o,actionsLayout:s,tabIndex:a,disabled:l,batch:r,withCredentials:d,saveField:c,saveHeaders:u,saveMethod:p,saveUrl:h,responseType:m,removeField:f,removeHeaders:g,removeMethod:v,removeUrl:y,multiple:b,accept:F,restrictions:x,files:S,defaultFiles:k}=this.$props,I=n.templateRendering.call(this,this.$props.list,n.getListeners.call(this)),C=re.groupFilesByUid(this.computedFiles),N=re.filesForUpload(C);return t.createVNode(se,{groupedFiles:C,className:this.$props.className,showFileList:e&&!!Object.keys(C).length,showActionButtons:o&&!i&&!!Object.keys(N).length,actionsLayout:s,disabled:l,onAdd:this.onAdd,onRemove:this.onRemove,onClear:this.onClear,onUpload:this.onUpload,onRetry:this.onRetry,onCancel:this.onCancel,tabIndex:n.getTabIndex(a,l),ref:e=>{this.uploadNavigationRef=e},multiple:b,accept:F,list:I,restrictions:x,files:S,defaultFiles:k,async:this.computedAsync},null)}}),Ce=t.defineComponent({name:"KendoVueExternalDropZone",props:{id:String,tabIndex:Number,innerStyle:Object,uploadRef:[String,Function,Object],disabled:Boolean,customHint:[String,Function,Object],customNote:[String,Function,Object]},inject:{kendoLocalizationService:{default:null}},created(){n.validatePackage(ke),this.elementInterval=null,this.elementActive=!1,this.lastElementDragOverRef=null},data:()=>({overDropZone:!1}),mounted(){this.externalDropZone=this.externalDropZoneRef},methods:{focus(){this.externalDropZone&&this.externalDropZone.focus&&this.externalDropZone.focus()},isDragOver:e=>(new Date).getTime()-(e||new Date).getTime()>100,handleOnDrop(e){e.preventDefault();let t=e.dataTransfer.files,n=this.$parent.$refs[this.$props.uploadRef];t.length>0&&!this.$props.disabled&&n&&n.onAdd&&(e.preventDefault(),n.onAdd(t))},handleOnElementDragEnter(){this.elementActive=!0;this.elementInterval=setInterval(()=>{this.isDragOver(this.lastElementDragOver)&&(this.overDropZone=!1,this.elementActive=!1,clearInterval(this.elementInterval),this.elementInterval=null,this.lastElementDragOver=null)},100)},handleOnElementDragOver(e){e.preventDefault(),this.lastElementDragOver=new Date,this.overDropZone=!0}},setup:()=>({externalDropZoneRef:t.ref(null),kendoLocalizationService:t.inject("kendoLocalizationService",{})}),render(){const{customNote:e,customHint:o}=this.$props,s=i.provideLocalizationService(this),l=s.toLanguageString(R,U[R]),r=s.toLanguageString(D,U[D]),d=n.templateRendering.call(this,o,n.getListeners.call(this)),c=n.templateRendering.call(this,e,n.getListeners.call(this));let u;const p=t.createVNode("span",null,[l]);let h;u=n.getTemplate.call(this,{h:t.h,template:d,defaultRendering:p});const m=t.createVNode("span",null,[r]);return h=n.getTemplate.call(this,{h:t.h,template:c,defaultRendering:m}),t.createVNode("div",{ref:n.setRef(this,"externalDropZone"),id:this.$props.id,class:n.classNames("k-external-dropzone",{"k-external-dropzone-hover":this.overDropZone,"k-disabled":this.$props.disabled},this.$props.className),tabindex:n.getTabIndex(this.$props.tabIndex,this.$props.disabled,void 0),onDrop:this.handleOnDrop,onDragenter:this.handleOnElementDragEnter,onDragover:this.handleOnElementDragOver},[t.createVNode("div",{style:this.$props.innerStyle,class:"k-dropzone-inner"},[t.createVNode(n.Icon,{name:"upload",icon:a.uploadIcon,class:"k-dropzone-icon",size:"xxxlarge"},null),t.createVNode("span",{class:"k-dropzone-hint"},[u]),t.createVNode("span",{class:"k-dropzone-note"},[h])]),t.createVNode("div",{class:"k-upload"},null)])}});e.ExternalDropZone=Ce,e.Upload=Ie,e.UploadFileStatus=l,e.UploadListActionButton=M,e.UploadListMultiItem=Z,e.UploadListSingleItem=K,e.UploadUI=ne,e.messages=U,e.utils=_});
@@ -6,6 +6,6 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  /**
9
- * Lists the possible layout of the Upload action buttons.
9
+ * Lists the possible layouts of the Upload action buttons.
10
10
  */
11
11
  export type UploadActionsLayout = 'start' | 'center' | 'end' | 'stretched';
@@ -6,7 +6,7 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  /**
9
- * Represents the additional data that is sent as a key-value pair.
9
+ * Represents the extra data that the Upload sends with a request as key-value pairs.
10
10
  */
11
11
  export interface UploadAdditionalData {
12
12
  [name: string]: any;
@@ -8,44 +8,56 @@
8
8
  import { UploadHttpHeaders } from './UploadHttpHeaders';
9
9
  import { UploadFileInfo } from '..';
10
10
  /**
11
- * Represents the async properties of the Upload component.
11
+ * Represents the async properties of the Upload.
12
12
  */
13
13
  export interface UploadAsyncProps {
14
14
  /**
15
- * By default, the selected files are immediately uploaded.
16
- * To change this behavior, set `autoUpload` to `false`.
15
+ * Uploads the selected files right away.
16
+ * To upload the files later, set `autoUpload` to `false`.
17
+ *
18
+ * @default `true`
17
19
  */
18
20
  autoUpload?: boolean;
19
21
  /**
20
- * When enabled, all files in the selection are uploaded in one request.
21
- * Any files that are selected one after the other are uploaded in separate requests.
22
+ * Uploads all files from one selection in a single request.
23
+ * Files that you select one after the other upload in separate requests.
24
+ *
25
+ * @default `false`
22
26
  */
23
27
  batch?: boolean;
24
28
  /**
25
- * Configures whether browser-managed credentials, such as cookies, are sent with cross-origin requests.
26
- * When not set, cross-origin requests are sent without credentials. Same-origin requests include
27
- * browser-managed credentials, such as cookies, by default; `withCredentials` does not affect them.
28
- * To add custom request headers, use the `saveHeaders` or `removeHeaders` property.
29
+ * Sets whether the Upload sends credentials, such as cookies and headers, with cross-site requests.
30
+ * This property has no effect on same-site requests.
31
+ * To add credentials to the request, use the `saveHeaders` or `removeHeaders` property.
32
+ *
33
+ * @default `true`
29
34
  */
30
35
  withCredentials?: boolean;
31
36
  /**
32
- * Sets the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key which
33
- * contains the files submitted to `saveUrl`. Defaults to `files`.
37
+ * Sets the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key that
38
+ * holds the files that the Upload sends to `saveUrl`.
39
+ *
40
+ * @default `'files'`
34
41
  */
35
42
  saveField?: string;
36
43
  /**
37
- * Configures the `HttpHeaders` that are attached to each upload request.
44
+ * Sets the `HttpHeaders` that the Upload attaches to each upload request.
45
+ *
46
+ * @default `{}`
38
47
  */
39
48
  saveHeaders?: UploadHttpHeaders;
40
49
  /**
41
50
  * Sets the [`request`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) method of the upload request.
42
- * Defaults to `POST`.
51
+ *
52
+ * @default `'POST'`
43
53
  */
44
54
  saveMethod?: string;
45
55
  /**
46
56
  * Sets the URL of the endpoint for the upload request.
47
- * The requested [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key is named after
48
- * the `saveField` property and contains the list of files that will be uploaded.
57
+ * The [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key takes its name from
58
+ * the `saveField` property and holds the list of files to upload.
59
+ *
60
+ * @default `''`
49
61
  */
50
62
  saveUrl?: string | ((files: UploadFileInfo[], options: {
51
63
  formData: FormData;
@@ -56,30 +68,37 @@ export interface UploadAsyncProps {
56
68
  /**
57
69
  * Sets the expected [response type](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType)
58
70
  * of the server.
59
- * Used to parse the response appropriately.
60
- * Defaults to `json`.
71
+ * The Upload uses it to parse the response.
72
+ *
73
+ * @default `'json'`
61
74
  */
62
75
  responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
63
76
  /**
64
77
  * Sets the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key
65
- * which contains the list of file names that are submitted to `removeUrl`.
66
- * Defaults to `fileNames`.
78
+ * that holds the list of file names that the Upload sends to `removeUrl`.
79
+ *
80
+ * @default `'fileNames'`
67
81
  */
68
82
  removeField?: string;
69
83
  /**
70
- * Configures the `HttpHeaders` that are attached to each `remove` request.
84
+ * Sets the `HttpHeaders` that the Upload attaches to each `remove` request.
85
+ *
86
+ * @default `{}`
71
87
  */
72
88
  removeHeaders?: UploadHttpHeaders;
73
89
  /**
74
90
  * Sets the [request method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) of the `remove` request.
75
- * Defaults to `POST`.
91
+ *
92
+ * @default `'POST'`
76
93
  */
77
94
  removeMethod?: string;
78
95
  /**
79
96
  * Sets the URL of the endpoint for the `remove` request.
80
97
  * The [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) request
81
- * key is named after the `removeField` property.
82
- * It contains the list of file names which will be removed.
98
+ * key takes its name from the `removeField` property.
99
+ * It holds the list of file names to remove.
100
+ *
101
+ * @default `''`
83
102
  */
84
103
  removeUrl?: string | ((files: UploadFileInfo[], options: {
85
104
  formData: FormData;
@@ -7,42 +7,42 @@
7
7
  */
8
8
  import { UploadFileStatus } from './UploadFileStatus';
9
9
  /**
10
- * Contains information which is related to the selected file.
10
+ * Contains information about a selected file.
11
11
  */
12
12
  export interface UploadFileInfo {
13
13
  /**
14
- * The unique identifier of the group (batch) with one or more files.
15
- * Has to be set for the initial list of files.
14
+ * Sets the unique identifier of the group (batch) that holds one or more files.
15
+ * You must set it for the initial list of files.
16
16
  */
17
17
  uid: string;
18
18
  /**
19
- * The file name.
19
+ * Sets the name of the file.
20
20
  */
21
21
  name: string;
22
22
  /**
23
- * The file extension including the leading dot&mdash;for example, `.jpg`, `.png`, or other.
23
+ * Sets the file extension with the leading dot&mdash;for example, `.jpg` or `.png`.
24
24
  */
25
25
  extension?: string;
26
26
  /**
27
- * The file size in bytes.
27
+ * Sets the size of the file in bytes.
28
28
  */
29
29
  size?: number;
30
30
  /**
31
- * A list which contains the validation errors (if any).
31
+ * Holds the list of validation errors for the file, if there are any.
32
32
  */
33
33
  validationErrors?: Array<string>;
34
34
  /**
35
- * The current state of the file&mdash;`Failed`, `Selected`, `Uploaded`, or `Uploading`.
36
- * `Initial` is a special value for `FileState` and is
37
- * automatically applied to initial files without you having to explicitly set their state.
35
+ * Sets the current status of the file&mdash;for example, `Selected`, `Uploading`, `Uploaded`, or `UploadFailed`.
36
+ * `Initial` is a special `UploadFileStatus` value. The Upload applies it
37
+ * to initial files automatically, so you do not have to set their status.
38
38
  */
39
39
  status: UploadFileStatus;
40
40
  /**
41
- * The current upload progress.
41
+ * Sets the current upload progress of the file.
42
42
  */
43
43
  progress: number;
44
44
  /**
45
- * Gets the raw file instance.
45
+ * Returns the raw `File` instance.
46
46
  */
47
47
  getRawFile?: () => File;
48
48
  }
@@ -6,21 +6,21 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  /**
9
- * Configures the restrictions for the files that can be uploaded.
9
+ * Sets the restrictions for the files that you can upload.
10
10
  */
11
11
  export interface UploadFileRestrictions {
12
12
  /**
13
- * The list of the allowed file extensions.
14
- * Recognizes entries of both `.type` (for example, `.docx`, `.png`, `.svg`, `.xls`, and others)
15
- * and `type` (for example, `docx`, `png`, `svg`, `xls`, and others) values.
13
+ * Sets the list of allowed file extensions.
14
+ * Accepts values with a leading dot (for example, `.docx`, `.png`, `.svg`, or `.xls`)
15
+ * and values without one (for example, `docx`, `png`, `svg`, or `xls`).
16
16
  */
17
17
  allowedExtensions?: Array<string>;
18
18
  /**
19
- * Defines the maximum file size in bytes.
19
+ * Sets the maximum file size in bytes.
20
20
  */
21
21
  maxFileSize?: number;
22
22
  /**
23
- * Defines the minimum file size in bytes.
23
+ * Sets the minimum file size in bytes.
24
24
  */
25
25
  minFileSize?: number;
26
26
  }
@@ -10,11 +10,11 @@
10
10
  */
11
11
  export declare enum UploadFileStatus {
12
12
  /**
13
- * Indicates that the file upload process has failed.
13
+ * The file upload failed.
14
14
  */
15
15
  UploadFailed = 0,
16
16
  /**
17
- * An initially selected fake file without a set state.
17
+ * The file is part of the initial list of files and has no set status.
18
18
  */
19
19
  Initial = 1,
20
20
  /**
@@ -22,19 +22,19 @@ export declare enum UploadFileStatus {
22
22
  */
23
23
  Selected = 2,
24
24
  /**
25
- * The file is in the process of uploading.
25
+ * The file is uploading.
26
26
  */
27
27
  Uploading = 3,
28
28
  /**
29
- * The file is successfully uploaded.
29
+ * The file upload succeeded.
30
30
  */
31
31
  Uploaded = 4,
32
32
  /**
33
- * The remove process has failed.
33
+ * The file removal failed.
34
34
  */
35
35
  RemoveFailed = 5,
36
36
  /**
37
- * The file is in the process of removing.
37
+ * The file is being removed.
38
38
  */
39
39
  Removing = 6
40
40
  }
@@ -6,7 +6,7 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  /**
9
- * Represents the HttpHeaders as a key-value pair.
9
+ * Represents the HTTP headers that the Upload sends with a request as key-value pairs.
10
10
  */
11
11
  export interface UploadHttpHeaders {
12
12
  [name: string]: string | string[];
@@ -8,19 +8,20 @@
8
8
  import { UploadAsyncProps } from './UploadAsyncProps';
9
9
  import { UploadFileInfo } from './UploadFileInfo';
10
10
  /**
11
- * Represents the properties of the Kendo Ui for Vue UploadList Item component.
11
+ * Represents the props that the custom `list` template of the Upload receives.
12
+ * The UploadListSingleItem and UploadListMultiItem components accept the same props.
12
13
  */
13
14
  export interface UploadListItemProps {
14
15
  /**
15
- * One or more files for the current item.
16
+ * Holds the files of the current list item.
16
17
  */
17
18
  files: Array<UploadFileInfo>;
18
19
  /**
19
- * The `disabled` property of the Upload.
20
+ * Holds the `disabled` state of the Upload.
20
21
  */
21
22
  disabled: boolean;
22
23
  /**
23
- * The asynchronous properties of the Upload.
24
+ * Holds the async settings of the Upload, such as `saveUrl` and `removeUrl`.
24
25
  */
25
26
  async: UploadAsyncProps;
26
27
  }
@@ -8,15 +8,15 @@
8
8
  import { BaseUploadEvent } from './BaseUploadEvent';
9
9
  import { UploadFileInfo } from './UploadFileInfo';
10
10
  /**
11
- * The `onAdd` event.
11
+ * Represents the object of the `add` event that the Upload emits when you select new files.
12
12
  */
13
13
  export interface UploadOnAddEvent extends BaseUploadEvent<any> {
14
14
  /**
15
- * The new updated state candidate.
15
+ * Holds the new list of files after the change.
16
16
  */
17
17
  newState: Array<UploadFileInfo>;
18
18
  /**
19
- * The list of affected files.
19
+ * Holds the files that the event affects.
20
20
  */
21
21
  affectedFiles: Array<UploadFileInfo>;
22
22
  }
@@ -10,19 +10,19 @@ import { UploadFileInfo } from './UploadFileInfo';
10
10
  import { UploadHttpHeaders } from './UploadHttpHeaders';
11
11
  import { UploadAdditionalData } from './UploadAdditionalData';
12
12
  /**
13
- * The `onBeforeRemove` event.
13
+ * Represents the object of the `beforeremove` event that the Upload emits before it sends a remove request.
14
14
  */
15
15
  export interface UploadOnBeforeRemoveEvent extends BaseUploadEvent<any> {
16
16
  /**
17
- * The files that will be sent with the request.
17
+ * Holds the files that the Upload sends with the request.
18
18
  */
19
19
  files: Array<UploadFileInfo>;
20
20
  /**
21
- * The headers that will be sent with the request. Can be modified.
21
+ * Holds the headers that the Upload sends with the request. You can change them.
22
22
  */
23
23
  headers: UploadHttpHeaders;
24
24
  /**
25
- * The additional data that will be sent with the request. Can be modified.
25
+ * Holds the extra data that the Upload sends with the request. You can change it.
26
26
  */
27
27
  additionalData: UploadAdditionalData;
28
28
  }
@@ -10,19 +10,19 @@ import { UploadFileInfo } from './UploadFileInfo';
10
10
  import { UploadHttpHeaders } from './UploadHttpHeaders';
11
11
  import { UploadAdditionalData } from './UploadAdditionalData';
12
12
  /**
13
- * The `onBeforeUpload` event.
13
+ * Represents the object of the `beforeupload` event that the Upload emits before it sends an upload request.
14
14
  */
15
15
  export interface UploadOnBeforeUploadEvent extends BaseUploadEvent<any> {
16
16
  /**
17
- * The files that will be sent with the request.
17
+ * Holds the files that the Upload sends with the request.
18
18
  */
19
19
  files: Array<UploadFileInfo>;
20
20
  /**
21
- * The headers that will be sent with the request. Can be modified.
21
+ * Holds the headers that the Upload sends with the request. You can change them.
22
22
  */
23
23
  headers: UploadHttpHeaders;
24
24
  /**
25
- * The additional data that will be sent with the request. Can be modified.
25
+ * Holds the extra data that the Upload sends with the request. You can change it.
26
26
  */
27
27
  additionalData: UploadAdditionalData;
28
28
  }
@@ -7,11 +7,11 @@
7
7
  */
8
8
  import { BaseUploadEvent } from './BaseUploadEvent';
9
9
  /**
10
- * The `onCancel` event.
10
+ * Represents the object of the `cancel` event that the Upload emits when you cancel a file upload.
11
11
  */
12
12
  export interface UploadOnCancelEvent extends BaseUploadEvent<any> {
13
13
  /**
14
- * The unique identifier of the group (batch) of one or more files that is cancelled.
14
+ * Holds the unique identifier of the canceled group (batch) of one or more files.
15
15
  */
16
16
  uid: string;
17
17
  }
@@ -8,15 +8,15 @@
8
8
  import { BaseUploadEvent } from './BaseUploadEvent';
9
9
  import { UploadFileInfo } from './UploadFileInfo';
10
10
  /**
11
- * The `onProgress` event.
11
+ * Represents the object of the `progress` event that the Upload emits when the upload progress of a file changes.
12
12
  */
13
13
  export interface UploadOnProgressEvent extends BaseUploadEvent<any> {
14
14
  /**
15
- * The new updated state candidate.
15
+ * Holds the new list of files after the change.
16
16
  */
17
17
  newState: Array<UploadFileInfo>;
18
18
  /**
19
- * The list of the affected files.
19
+ * Holds the files that the event affects.
20
20
  */
21
21
  affectedFiles: Array<UploadFileInfo>;
22
22
  }
@@ -9,19 +9,19 @@ import { BaseUploadEvent } from './BaseUploadEvent';
9
9
  import { UploadFileInfo } from './UploadFileInfo';
10
10
  import { UploadResponse } from './UploadResponse';
11
11
  /**
12
- * The `onRemove` event.
12
+ * Represents the object of the `remove` event that the Upload emits when you remove files.
13
13
  */
14
14
  export interface UploadOnRemoveEvent extends BaseUploadEvent<any> {
15
15
  /**
16
- * The new updated state candidate.
16
+ * Holds the new list of files after the change.
17
17
  */
18
18
  newState: Array<UploadFileInfo>;
19
19
  /**
20
- * The list of the affected files.
20
+ * Holds the files that the event affects.
21
21
  */
22
22
  affectedFiles: Array<UploadFileInfo>;
23
23
  /**
24
- * The server response (if available).
24
+ * Holds the server response, if there is one.
25
25
  */
26
26
  response?: UploadResponse;
27
27
  }
@@ -9,19 +9,19 @@ import { BaseUploadEvent } from './BaseUploadEvent';
9
9
  import { UploadFileInfo } from './UploadFileInfo';
10
10
  import { UploadResponse } from './UploadResponse';
11
11
  /**
12
- * The `onStatusChange` event.
12
+ * Represents the object of the `statuschange` event that the Upload emits when the status of the files changes.
13
13
  */
14
14
  export interface UploadOnStatusChangeEvent extends BaseUploadEvent<any> {
15
15
  /**
16
- * The new updated state candidate.
16
+ * Holds the new list of files after the change.
17
17
  */
18
18
  newState: Array<UploadFileInfo>;
19
19
  /**
20
- * The list of the affected files.
20
+ * Holds the files that the event affects.
21
21
  */
22
22
  affectedFiles: Array<UploadFileInfo>;
23
23
  /**
24
- * The server response (if available).
24
+ * Holds the server response, if there is one.
25
25
  */
26
26
  response?: UploadResponse;
27
27
  }
@@ -17,54 +17,73 @@ import { UploadOnBeforeRemoveEvent } from './UploadOnBeforeRemoveEvent';
17
17
  import { UploadOnCancelEvent } from './UploadOnCancelEvent';
18
18
  import { UploadActionsLayout } from './UploadActionsLayout';
19
19
  /**
20
- * Represents the props of the [Kendo Ui for Vue Upload component]({% slug overview_upload %}).
20
+ * Represents the props of the [Kendo UI for Vue Upload component](slug:overview_upload).
21
21
  */
22
22
  export interface UploadProps extends UploadAsyncProps {
23
23
  /**
24
- * Sets a class of the Upload DOM element.
24
+ * Sets a CSS class on the root element of the Upload.
25
25
  */
26
26
  className?: string;
27
27
  /**
28
- * Enables the selection of multiple files
29
- * ([see example]({% slug fileprocessing_upload %}#toc-upload-of-single-or-multiple-files)).
30
- * If set to `false`, only one file can be selected at a time.
28
+ * Lets you select more than one file at a time
29
+ * ([see example](slug:fileprocessing_upload#toc-upload-of-single-or-multiple-files)).
30
+ * When you set it to `false`, you can select only one file at a time.
31
+ *
32
+ * @default `true`
31
33
  */
32
34
  multiple?: boolean;
33
35
  /**
34
- * Disables the Upload ([see example]({% slug disabledstate_upload %})). Defaults to `false`.
36
+ * Disables the Upload ([see example](slug:disabledstate_upload)).
37
+ *
38
+ * @default `false`
35
39
  */
36
40
  disabled?: boolean;
37
41
  /**
38
- * Toggles the visibility of the file list.
42
+ * Shows or hides the list of files.
43
+ *
44
+ * @default `true`
39
45
  */
40
46
  showFileList?: boolean;
41
47
  /**
42
- * When the `autoUpload` option is set to `false`,
43
- * `showActionButtons` toggles the visibility of the action buttons which are rendered.
48
+ * Shows or hides the action buttons.
49
+ * This property works only when you set `autoUpload` to `false`.
50
+ *
51
+ * @default `true`
44
52
  */
45
53
  showActionButtons?: boolean;
46
54
  /**
47
- * Specifies the possible layouts of the action buttons
48
- * ([see example]({% slug actionbuttons_upload %})). Defaults to `end`.
55
+ * Sets the layout of the action buttons
56
+ * ([see example](slug:actionbuttons_upload)).
57
+ *
58
+ * @default `'end'`
49
59
  */
50
60
  actionsLayout?: UploadActionsLayout;
51
61
  /**
52
- * Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex)
62
+ * Sets the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex)
53
63
  * of the Upload.
64
+ *
65
+ * @remarks
66
+ * This property is related to accessibility.
54
67
  */
55
68
  tabIndex?: number | string;
56
69
  /**
57
- * Specifies the id of the component.
70
+ * Sets the `id` of the Upload.
58
71
  */
59
72
  id?: string;
60
73
  /**
61
- * Identifies the element(s) which will describe the component, similar
62
- * to HTML aria-describedby attribute For example these elements
63
- * could contain error or hint message.
74
+ * Sets the `id` of one or more elements that describe the Upload, similar
75
+ * to the HTML `aria-describedby` attribute. For example, these elements
76
+ * can hold an error or a hint message.
77
+ *
78
+ * @remarks
79
+ * This property is related to accessibility.
64
80
  */
65
81
  ariaDescribedBy?: string;
66
82
  /**
67
- * Identifies the element(s) which will label the component.
83
+ * Sets the `id` of one or more elements that label the Upload.
84
+ *
85
+ * @remarks
86
+ * This property is related to accessibility.
68
87
  */
69
88
  ariaLabelledBy?: string;
70
89
  /**
@@ -72,54 +91,58 @@ export interface UploadProps extends UploadAsyncProps {
72
91
  */
73
92
  accept?: string;
74
93
  /**
75
- * Sets the restrictions for the selected files ([see example]({% slug filerestrictions_upload %})).
94
+ * Sets the restrictions for the selected files ([see example](slug:filerestrictions_upload)).
95
+ *
96
+ * @default `{ allowedExtensions: [], maxFileSize: 0, minFileSize: 0 }`
76
97
  */
77
98
  restrictions?: UploadFileRestrictions;
78
99
  /**
79
- * Sets the custom restrictions for the selected files ([see example]({% slug filerestrictions_upload %})).
100
+ * Sets a function that applies custom restrictions to the selected files ([see example](slug:filerestrictions_upload)).
80
101
  */
81
102
  validateFile?: (file: UploadFileInfo) => void;
82
103
  /**
83
- * The list of files which are displayed when the Upload is in controlled mode
84
- * ([see example]({% slug controleduncontroled_upload %})).
104
+ * Sets the list of files that the Upload shows in controlled mode
105
+ * ([see example](slug:controleduncontroled_upload)).
85
106
  */
86
107
  files?: Array<UploadFileInfo>;
87
108
  /**
88
- * The initial list of files which are displayed when the Upload is in
89
- * uncontrolled mode ([see example]({% slug controleduncontroled_upload %})).
109
+ * Sets the initial list of files that the Upload shows in
110
+ * uncontrolled mode ([see example](slug:controleduncontroled_upload)).
90
111
  */
91
112
  defaultFiles?: Array<UploadFileInfo>;
92
113
  /**
93
- * The component that will be rendered as a list item inside the Upload.
114
+ * Sets a custom template for each item in the file list ([see example](slug:rendering_upload)).
115
+ * Accepts a Vue component, a `render` function, or a slot name.
116
+ * The template receives the [`UploadListItemProps`](slug:api_upload_uploadlistitemprops).
94
117
  */
95
118
  list?: any;
96
119
  /**
97
- * Fires when new files are selected for upload.
120
+ * Fires when you select new files for upload.
98
121
  */
99
122
  onAdd?: (event: UploadOnAddEvent) => void;
100
123
  /**
101
- * Fires when files are removed. Optionally, if a request is made, can contain a server response.
124
+ * Fires when you remove files. When the Upload sends a request, the event can contain the server response.
102
125
  */
103
126
  onRemove?: (event: UploadOnRemoveEvent) => void;
104
127
  /**
105
- * Fires when the status of the files is changed. Optionally, if a request is made, can contain a server response.
128
+ * Fires when the status of the files changes. When the Upload sends a request, the event can contain the server response.
106
129
  */
107
130
  onStatuschange?: (event: UploadOnStatusChangeEvent) => void;
108
131
  /**
109
- * Fires when the progress of the file upload is changed.
132
+ * Fires when the upload progress of a file changes.
110
133
  */
111
134
  onProgress?: (event: UploadOnProgressEvent) => void;
112
135
  /**
113
- * Fires before a request for a file upload is made. Can be used to add extra data to the request.
136
+ * Fires before the Upload sends an upload request. Use it to add extra data to the request.
114
137
  */
115
138
  onBeforeupload?: (event: UploadOnBeforeUploadEvent) => void;
116
139
  /**
117
- * Fires before a request for a file removal is made. Can be used to add extra data to the request.
140
+ * Fires before the Upload sends a remove request. Use it to add extra data to the request.
118
141
  */
119
142
  onBeforeremove?: (event: UploadOnBeforeRemoveEvent) => void;
120
143
  /**
121
- * Fires when user clicks on the **Remove** button while the file upload is in progress.
122
- * Can be used when the `saveUrl` option is set to a function that cancels custom requests.
144
+ * Fires when you click the **Remove** button while a file is still uploading.
145
+ * Use it when you set `saveUrl` to a function, so you can cancel your custom requests.
123
146
  */
124
147
  onCancel?: (event: UploadOnCancelEvent) => void;
125
148
  }
@@ -10,23 +10,23 @@
10
10
  */
11
11
  export interface UploadResponse {
12
12
  /**
13
- * The response that was provided by the server.
13
+ * Holds the response body that the server returns.
14
14
  */
15
15
  response: any;
16
16
  /**
17
- * The HTTP status code from the server response.
17
+ * Holds the HTTP status code of the server response.
18
18
  */
19
19
  status: number;
20
20
  /**
21
- * The HTTP status message from the server response.
21
+ * Holds the HTTP status message of the server response.
22
22
  */
23
23
  statusText: string;
24
24
  /**
25
- * The headers with which the server responded.
25
+ * Holds the headers of the server response.
26
26
  */
27
27
  headers: any;
28
28
  /**
29
- * The XMLHttpRequest instance of the browser.
29
+ * Holds the `XMLHttpRequest` instance of the browser.
30
30
  */
31
31
  request?: XMLHttpRequest;
32
32
  }
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-vue-upload",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate: 1794385782,version:"11.0.0",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning"};exports.packageMetadata=e;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-vue-upload",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate: 1795100402,version:"11.1.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning"};exports.packageMetadata=e;
@@ -10,8 +10,8 @@ const e = {
10
10
  productName: "Kendo UI for Vue",
11
11
  productCode: "KENDOUIVUE",
12
12
  productCodes: ["KENDOUIVUE"],
13
- publishDate: 1794385782,
14
- version: "11.0.0",
13
+ publishDate: 1795100402,
14
+ version: "11.1.0-develop.1",
15
15
  licensingDocsUrl: "https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning"
16
16
  };
17
17
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-vue-upload",
3
- "version": "11.0.0",
3
+ "version": "11.1.0-develop.1",
4
4
  "description": "TODO",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -24,11 +24,11 @@
24
24
  },
25
25
  "sideEffects": false,
26
26
  "peerDependencies": {
27
- "@progress/kendo-licensing": "^1.13.0",
28
- "@progress/kendo-vue-buttons": "11.0.0",
29
- "@progress/kendo-vue-common": "11.0.0",
30
- "@progress/kendo-vue-intl": "11.0.0",
31
- "@progress/kendo-vue-progressbars": "11.0.0",
27
+ "@progress/kendo-licensing": "^1.13.1",
28
+ "@progress/kendo-vue-buttons": "11.1.0-develop.1",
29
+ "@progress/kendo-vue-common": "11.1.0-develop.1",
30
+ "@progress/kendo-vue-intl": "11.1.0-develop.1",
31
+ "@progress/kendo-vue-progressbars": "11.1.0-develop.1",
32
32
  "@progress/kendo-svg-icons": "^4.9.0 || ^5.0.0",
33
33
  "vue": "^3.0.2"
34
34
  },
@@ -49,7 +49,7 @@
49
49
  "package": {
50
50
  "productName": "Kendo UI for Vue",
51
51
  "productCode": "KENDOUIVUE",
52
- "publishDate": 1794385782,
52
+ "publishDate": 1795100402,
53
53
  "licensingDocsUrl": "https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning"
54
54
  }
55
55
  },
@@ -9,11 +9,29 @@ import { UploadFileInfo } from '../interfaces/UploadFileInfo';
9
9
  import { UploadAsyncProps } from '../interfaces/UploadAsyncProps';
10
10
  import { UploadHttpHeaders } from '../interfaces/UploadHttpHeaders';
11
11
  import { UploadResponse } from '../interfaces/UploadResponse';
12
+ /**
13
+ * Represents the raw response data of an Upload request.
14
+ */
12
15
  export interface XHRResponseData {
16
+ /**
17
+ * Holds the response body that the server returns.
18
+ */
13
19
  response: any;
20
+ /**
21
+ * Holds the HTTP status code of the server response.
22
+ */
14
23
  status: number;
24
+ /**
25
+ * Holds the HTTP status message of the server response.
26
+ */
15
27
  statusText: string;
28
+ /**
29
+ * Holds the headers of the server response.
30
+ */
16
31
  headers?: any;
32
+ /**
33
+ * Holds the `XMLHttpRequest` instance of the browser.
34
+ */
17
35
  request?: XMLHttpRequest;
18
36
  }
19
37
  /**