@nuralyui/file-upload 0.0.10 → 0.0.11
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.
- package/bundle.js +1 -433
- package/package.json +1 -1
package/bundle.js
CHANGED
|
@@ -1,433 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/
|
|
6
|
-
const t=window,i=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),e=new WeakMap;class o{constructor(t,i,e){if(this._$cssResult$=!0,e!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o;const s=this.t;if(i&&void 0===t){const i=void 0!==s&&1===s.length;i&&(t=e.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&e.set(s,t))}return t}toString(){return this.cssText}}const n=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let i="";for(const s of t.cssRules)i+=s.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,s))(i)})(t):t
|
|
7
|
-
/**
|
|
8
|
-
* @license
|
|
9
|
-
* Copyright 2017 Google LLC
|
|
10
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/;var r;const l=window,h=l.trustedTypes,d=h?h.emptyScript:"",a=l.reactiveElementPolyfillSupport,c={toAttribute(t,i){switch(i){case Boolean:t=t?d:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let s=t;switch(i){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},u=(t,i)=>i!==t&&(i==i||t==t),v={attribute:!0,type:String,converter:c,reflect:!1,hasChanged:u},p="finalized";class f extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var i;this.finalize(),(null!==(i=this.h)&&void 0!==i?i:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((i,s)=>{const e=this._$Ep(s,i);void 0!==e&&(this._$Ev.set(e,s),t.push(e))})),t}static createProperty(t,i=v){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const s="symbol"==typeof t?Symbol():"__"+t,e=this.getPropertyDescriptor(t,s,i);void 0!==e&&Object.defineProperty(this.prototype,t,e)}}static getPropertyDescriptor(t,i,s){return{get(){return this[i]},set(e){const o=this[t];this[i]=e,this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty(p))return!1;this[p]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of i)this.createProperty(s,t[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const i=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)i.unshift(n(t))}else void 0!==t&&i.push(n(t));return i}static _$Ep(t,i){const s=i.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var i,s;(null!==(i=this._$ES)&&void 0!==i?i:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.call(t))}removeController(t){var i;null===(i=this._$ES)||void 0===i||i.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])}))}createRenderRoot(){var s;const e=null!==(s=this.shadowRoot)&&void 0!==s?s:this.attachShadow(this.constructor.shadowRootOptions);return((s,e)=>{i?s.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((i=>{const e=document.createElement("style"),o=t.litNonce;void 0!==o&&e.setAttribute("nonce",o),e.textContent=i.cssText,s.appendChild(e)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostConnected)||void 0===i?void 0:i.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostDisconnected)||void 0===i?void 0:i.call(t)}))}attributeChangedCallback(t,i,s){this._$AK(t,s)}_$EO(t,i,s=v){var e;const o=this.constructor._$Ep(t,s);if(void 0!==o&&!0===s.reflect){const n=(void 0!==(null===(e=s.converter)||void 0===e?void 0:e.toAttribute)?s.converter:c).toAttribute(i,s.type);this._$El=t,null==n?this.removeAttribute(o):this.setAttribute(o,n),this._$El=null}}_$AK(t,i){var s;const e=this.constructor,o=e._$Ev.get(t);if(void 0!==o&&this._$El!==o){const t=e.getPropertyOptions(o),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(s=t.converter)||void 0===s?void 0:s.fromAttribute)?t.converter:c;this._$El=o,this[o]=n.fromAttribute(i,t.type),this._$El=null}}requestUpdate(t,i,s){let e=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||u)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===s.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,s))):e=!1),!this.isUpdatePending&&e&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,i)=>this[i]=t)),this._$Ei=void 0);let i=!1;const s=this._$AL;try{i=this.shouldUpdate(s),i?(this.willUpdate(s),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostUpdate)||void 0===i?void 0:i.call(t)})),this.update(s)):this._$Ek()}catch(t){throw i=!1,this._$Ek(),t}i&&this._$AE(s)}willUpdate(t){}_$AE(t){var i;null===(i=this._$ES)||void 0===i||i.forEach((t=>{var i;return null===(i=t.hostUpdated)||void 0===i?void 0:i.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,i)=>this._$EO(i,this[i],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}
|
|
12
|
-
/**
|
|
13
|
-
* @license
|
|
14
|
-
* Copyright 2017 Google LLC
|
|
15
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
-
*/
|
|
17
|
-
var g;f[p]=!0,f.elementProperties=new Map,f.elementStyles=[],f.shadowRootOptions={mode:"open"},null==a||a({ReactiveElement:f}),(null!==(r=l.reactiveElementVersions)&&void 0!==r?r:l.reactiveElementVersions=[]).push("1.6.3");const w=window,m=w.trustedTypes,b=m?m.createPolicy("lit-html",{createHTML:t=>t}):void 0,y="$lit$",x=`lit$${(Math.random()+"").slice(9)}$`,$="?"+x,k=`<${$}>`,S=document,_=()=>S.createComment(""),A=t=>null===t||"object"!=typeof t&&"function"!=typeof t,C=Array.isArray,z="[ \t\n\f\r]",E=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,M=/-->/g,j=/>/g,U=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),B=/'/g,T=/"/g,P=/^(?:script|style|textarea|title)$/i,N=Symbol.for("lit-noChange"),R=Symbol.for("lit-nothing"),I=new WeakMap,O=S.createTreeWalker(S,129,null,!1);function F(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==b?b.createHTML(i):i}class L{constructor({strings:t,_$litType$:i},s){let e;this.parts=[];let o=0,n=0;const r=t.length-1,l=this.parts,[h,d]=((t,i)=>{const s=t.length-1,e=[];let o,n=2===i?"<svg>":"",r=E;for(let i=0;i<s;i++){const s=t[i];let l,h,d=-1,a=0;for(;a<s.length&&(r.lastIndex=a,h=r.exec(s),null!==h);)a=r.lastIndex,r===E?"!--"===h[1]?r=M:void 0!==h[1]?r=j:void 0!==h[2]?(P.test(h[2])&&(o=RegExp("</"+h[2],"g")),r=U):void 0!==h[3]&&(r=U):r===U?">"===h[0]?(r=null!=o?o:E,d=-1):void 0===h[1]?d=-2:(d=r.lastIndex-h[2].length,l=h[1],r=void 0===h[3]?U:'"'===h[3]?T:B):r===T||r===B?r=U:r===M||r===j?r=E:(r=U,o=void 0);const c=r===U&&t[i+1].startsWith("/>")?" ":"";n+=r===E?s+k:d>=0?(e.push(l),s.slice(0,d)+y+s.slice(d)+x+c):s+x+(-2===d?(e.push(void 0),i):c)}return[F(t,n+(t[s]||"<?>")+(2===i?"</svg>":"")),e]})(t,i);if(this.el=L.createElement(h,s),O.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(e=O.nextNode())&&l.length<r;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith(y)||i.startsWith(x)){const s=d[n++];if(t.push(i),void 0!==s){const t=e.getAttribute(s.toLowerCase()+y).split(x),i=/([.?@])?(.*)/.exec(s);l.push({type:1,index:o,name:i[2],strings:t,ctor:"."===i[1]?W:"?"===i[1]?V:"@"===i[1]?q:K})}else l.push({type:6,index:o})}for(const i of t)e.removeAttribute(i)}if(P.test(e.tagName)){const t=e.textContent.split(x),i=t.length-1;if(i>0){e.textContent=m?m.emptyScript:"";for(let s=0;s<i;s++)e.append(t[s],_()),O.nextNode(),l.push({type:2,index:++o});e.append(t[i],_())}}}else if(8===e.nodeType)if(e.data===$)l.push({type:2,index:o});else{let t=-1;for(;-1!==(t=e.data.indexOf(x,t+1));)l.push({type:7,index:o}),t+=x.length-1}o++}}static createElement(t,i){const s=S.createElement("template");return s.innerHTML=t,s}}function D(t,i,s=t,e){var o,n,r,l;if(i===N)return i;let h=void 0!==e?null===(o=s._$Co)||void 0===o?void 0:o[e]:s._$Cl;const d=A(i)?void 0:i._$litDirective$;return(null==h?void 0:h.constructor)!==d&&(null===(n=null==h?void 0:h._$AO)||void 0===n||n.call(h,!1),void 0===d?h=void 0:(h=new d(t),h._$AT(t,s,e)),void 0!==e?(null!==(r=(l=s)._$Co)&&void 0!==r?r:l._$Co=[])[e]=h:s._$Cl=h),void 0!==h&&(i=D(t,h._$AS(t,i.values),h,e)),i}class H{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:S).importNode(s,!0);O.currentNode=o;let n=O.nextNode(),r=0,l=0,h=e[0];for(;void 0!==h;){if(r===h.index){let i;2===h.type?i=new Z(n,n.nextSibling,this,t):1===h.type?i=new h.ctor(n,h.name,h.strings,this,t):6===h.type&&(i=new G(n,this,t)),this._$AV.push(i),h=e[++l]}r!==(null==h?void 0:h.index)&&(n=O.nextNode(),r++)}return O.currentNode=S,o}v(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class Z{constructor(t,i,s,e){var o;this.type=2,this._$AH=R,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cp=null===(o=null==e?void 0:e.isConnected)||void 0===o||o}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===(null==t?void 0:t.nodeType)&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=D(this,t,i),A(t)?t===R||null==t||""===t?(this._$AH!==R&&this._$AR(),this._$AH=R):t!==this._$AH&&t!==N&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>C(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==R&&A(this._$AH)?this._$AA.nextSibling.data=t:this.$(S.createTextNode(t)),this._$AH=t}g(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=L.createElement(F(e.h,e.h[0]),this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.v(s);else{const t=new H(o,this),i=t.u(this.options);t.v(s),this.$(i),this._$AH=t}}_$AC(t){let i=I.get(t.strings);return void 0===i&&I.set(t.strings,i=new L(t)),i}T(t){C(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new Z(this.k(_()),this.k(_()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cp=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class K{constructor(t,i,s,e,o){this.type=1,this._$AH=R,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=R}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=D(this,t,i,0),n=!A(t)||t!==this._$AH&&t!==N,n&&(this._$AH=t);else{const e=t;let r,l;for(t=o[0],r=0;r<o.length-1;r++)l=D(this,e[s+r],i,r),l===N&&(l=this._$AH[r]),n||(n=!A(l)||l!==this._$AH[r]),l===R?t=R:t!==R&&(t+=(null!=l?l:"")+o[r+1]),this._$AH[r]=l}n&&!e&&this.j(t)}j(t){t===R?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class W extends K{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===R?void 0:t}}const J=m?m.emptyScript:"";class V extends K{constructor(){super(...arguments),this.type=4}j(t){t&&t!==R?this.element.setAttribute(this.name,J):this.element.removeAttribute(this.name)}}class q extends K{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=D(this,t,i,0))&&void 0!==s?s:R)===N)return;const e=this._$AH,o=t===R&&e!==R||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==R&&(e===R||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class G{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){D(this,t)}}const Q=w.litHtmlPolyfillSupport;
|
|
18
|
-
/**
|
|
19
|
-
* @license
|
|
20
|
-
* Copyright 2017 Google LLC
|
|
21
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/
|
|
23
|
-
var X;null==Q||Q(L,Z),(null!==(g=w.litHtmlVersions)&&void 0!==g?g:w.litHtmlVersions=[]).push("2.8.0");const Y=window,tt=Y.trustedTypes,it=tt?tt.createPolicy("lit-html",{createHTML:t=>t}):void 0,st="$lit$",et=`lit$${(Math.random()+"").slice(9)}$`,ot="?"+et,nt=`<${ot}>`,rt=document,lt=()=>rt.createComment(""),ht=t=>null===t||"object"!=typeof t&&"function"!=typeof t,dt=Array.isArray,at="[ \t\n\f\r]",ct=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ut=/-->/g,vt=/>/g,pt=RegExp(`>|${at}(?:([^\\s"'>=/]+)(${at}*=${at}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),ft=/'/g,gt=/"/g,wt=/^(?:script|style|textarea|title)$/i,mt=(t=>(i,...s)=>({_$litType$:t,strings:i,values:s}))(1),bt=Symbol.for("lit-noChange"),yt=Symbol.for("lit-nothing"),xt=new WeakMap,$t=rt.createTreeWalker(rt,129,null,!1);function kt(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==it?it.createHTML(i):i}const St=(t,i)=>{const s=t.length-1,e=[];let o,n=2===i?"<svg>":"",r=ct;for(let i=0;i<s;i++){const s=t[i];let l,h,d=-1,a=0;for(;a<s.length&&(r.lastIndex=a,h=r.exec(s),null!==h);)a=r.lastIndex,r===ct?"!--"===h[1]?r=ut:void 0!==h[1]?r=vt:void 0!==h[2]?(wt.test(h[2])&&(o=RegExp("</"+h[2],"g")),r=pt):void 0!==h[3]&&(r=pt):r===pt?">"===h[0]?(r=null!=o?o:ct,d=-1):void 0===h[1]?d=-2:(d=r.lastIndex-h[2].length,l=h[1],r=void 0===h[3]?pt:'"'===h[3]?gt:ft):r===gt||r===ft?r=pt:r===ut||r===vt?r=ct:(r=pt,o=void 0);const c=r===pt&&t[i+1].startsWith("/>")?" ":"";n+=r===ct?s+nt:d>=0?(e.push(l),s.slice(0,d)+st+s.slice(d)+et+c):s+et+(-2===d?(e.push(void 0),i):c)}return[kt(t,n+(t[s]||"<?>")+(2===i?"</svg>":"")),e]};class _t{constructor({strings:t,_$litType$:i},s){let e;this.parts=[];let o=0,n=0;const r=t.length-1,l=this.parts,[h,d]=St(t,i);if(this.el=_t.createElement(h,s),$t.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(e=$t.nextNode())&&l.length<r;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith(st)||i.startsWith(et)){const s=d[n++];if(t.push(i),void 0!==s){const t=e.getAttribute(s.toLowerCase()+st).split(et),i=/([.?@])?(.*)/.exec(s);l.push({type:1,index:o,name:i[2],strings:t,ctor:"."===i[1]?Mt:"?"===i[1]?Ut:"@"===i[1]?Bt:Et})}else l.push({type:6,index:o})}for(const i of t)e.removeAttribute(i)}if(wt.test(e.tagName)){const t=e.textContent.split(et),i=t.length-1;if(i>0){e.textContent=tt?tt.emptyScript:"";for(let s=0;s<i;s++)e.append(t[s],lt()),$t.nextNode(),l.push({type:2,index:++o});e.append(t[i],lt())}}}else if(8===e.nodeType)if(e.data===ot)l.push({type:2,index:o});else{let t=-1;for(;-1!==(t=e.data.indexOf(et,t+1));)l.push({type:7,index:o}),t+=et.length-1}o++}}static createElement(t,i){const s=rt.createElement("template");return s.innerHTML=t,s}}function At(t,i,s=t,e){var o,n,r,l;if(i===bt)return i;let h=void 0!==e?null===(o=s._$Co)||void 0===o?void 0:o[e]:s._$Cl;const d=ht(i)?void 0:i._$litDirective$;return(null==h?void 0:h.constructor)!==d&&(null===(n=null==h?void 0:h._$AO)||void 0===n||n.call(h,!1),void 0===d?h=void 0:(h=new d(t),h._$AT(t,s,e)),void 0!==e?(null!==(r=(l=s)._$Co)&&void 0!==r?r:l._$Co=[])[e]=h:s._$Cl=h),void 0!==h&&(i=At(t,h._$AS(t,i.values),h,e)),i}class Ct{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:rt).importNode(s,!0);$t.currentNode=o;let n=$t.nextNode(),r=0,l=0,h=e[0];for(;void 0!==h;){if(r===h.index){let i;2===h.type?i=new zt(n,n.nextSibling,this,t):1===h.type?i=new h.ctor(n,h.name,h.strings,this,t):6===h.type&&(i=new Tt(n,this,t)),this._$AV.push(i),h=e[++l]}r!==(null==h?void 0:h.index)&&(n=$t.nextNode(),r++)}return $t.currentNode=rt,o}v(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class zt{constructor(t,i,s,e){var o;this.type=2,this._$AH=yt,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cp=null===(o=null==e?void 0:e.isConnected)||void 0===o||o}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===(null==t?void 0:t.nodeType)&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=At(this,t,i),ht(t)?t===yt||null==t||""===t?(this._$AH!==yt&&this._$AR(),this._$AH=yt):t!==this._$AH&&t!==bt&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>dt(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==yt&&ht(this._$AH)?this._$AA.nextSibling.data=t:this.$(rt.createTextNode(t)),this._$AH=t}g(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=_t.createElement(kt(e.h,e.h[0]),this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.v(s);else{const t=new Ct(o,this),i=t.u(this.options);t.v(s),this.$(i),this._$AH=t}}_$AC(t){let i=xt.get(t.strings);return void 0===i&&xt.set(t.strings,i=new _t(t)),i}T(t){dt(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new zt(this.k(lt()),this.k(lt()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cp=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class Et{constructor(t,i,s,e,o){this.type=1,this._$AH=yt,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=yt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=At(this,t,i,0),n=!ht(t)||t!==this._$AH&&t!==bt,n&&(this._$AH=t);else{const e=t;let r,l;for(t=o[0],r=0;r<o.length-1;r++)l=At(this,e[s+r],i,r),l===bt&&(l=this._$AH[r]),n||(n=!ht(l)||l!==this._$AH[r]),l===yt?t=yt:t!==yt&&(t+=(null!=l?l:"")+o[r+1]),this._$AH[r]=l}n&&!e&&this.j(t)}j(t){t===yt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Mt extends Et{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===yt?void 0:t}}const jt=tt?tt.emptyScript:"";class Ut extends Et{constructor(){super(...arguments),this.type=4}j(t){t&&t!==yt?this.element.setAttribute(this.name,jt):this.element.removeAttribute(this.name)}}class Bt extends Et{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=At(this,t,i,0))&&void 0!==s?s:yt)===bt)return;const e=this._$AH,o=t===yt&&e!==yt||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==yt&&(e===yt||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class Tt{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){At(this,t)}}const Pt=Y.litHtmlPolyfillSupport;null==Pt||Pt(_t,zt),(null!==(X=Y.litHtmlVersions)&&void 0!==X?X:Y.litHtmlVersions=[]).push("2.8.0");
|
|
24
|
-
/**
|
|
25
|
-
* @license
|
|
26
|
-
* Copyright 2017 Google LLC
|
|
27
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
|
-
*/
|
|
29
|
-
var Nt,Rt;class It extends f{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,i;const s=super.createRenderRoot();return null!==(t=(i=this.renderOptions).renderBefore)&&void 0!==t||(i.renderBefore=s.firstChild),s}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let r=n._$litPart$;if(void 0===r){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=r=new zt(i.insertBefore(lt(),t),t,void 0,null!=s?s:{})}return r._$AI(t),r})(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return bt}}It.finalized=!0,It._$litElement$=!0,null===(Nt=globalThis.litElementHydrateSupport)||void 0===Nt||Nt.call(globalThis,{LitElement:It});const Ot=globalThis.litElementPolyfillSupport;null==Ot||Ot({LitElement:It}),(null!==(Rt=globalThis.litElementVersions)&&void 0!==Rt?Rt:globalThis.litElementVersions=[]).push("3.3.3");
|
|
30
|
-
/**
|
|
31
|
-
* @license
|
|
32
|
-
* Copyright 2017 Google LLC
|
|
33
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
-
*/
|
|
35
|
-
const Ft=(t,i)=>"method"===i.kind&&i.descriptor&&!("value"in i.descriptor)?{...i,finisher(s){s.createProperty(i.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:i.key,initializer(){"function"==typeof i.initializer&&(this[i.key]=i.initializer.call(this))},finisher(s){s.createProperty(i.key,t)}},Lt=(t,i,s)=>{i.constructor.createProperty(s,t)};
|
|
36
|
-
/**
|
|
37
|
-
* @license
|
|
38
|
-
* Copyright 2017 Google LLC
|
|
39
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
40
|
-
*/function Dt(t){return(i,s)=>void 0!==s?Lt(t,i,s):Ft(t,i)
|
|
41
|
-
/**
|
|
42
|
-
* @license
|
|
43
|
-
* Copyright 2017 Google LLC
|
|
44
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
45
|
-
*/}function Ht(t){return Dt({...t,state:!0})}
|
|
46
|
-
/**
|
|
47
|
-
* @license
|
|
48
|
-
* Copyright 2021 Google LLC
|
|
49
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
50
|
-
*/var Zt;null===(Zt=window.HTMLSlotElement)||void 0===Zt||Zt.prototype.assignedElements;const Kt=((t,...i)=>{const e=1===t.length?t[0]:i.reduce(((i,s,e)=>i+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[e+1]),t[0]);return new o(e,t,s)})`
|
|
51
|
-
:host {
|
|
52
|
-
display: block;
|
|
53
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
54
|
-
}
|
|
55
|
-
.upload {
|
|
56
|
-
width: 100%;
|
|
57
|
-
}
|
|
58
|
-
.upload-dragger {
|
|
59
|
-
background-color: #f8f9fa;
|
|
60
|
-
border: 1px dashed #d9d9d9;
|
|
61
|
-
border-radius: 6px;
|
|
62
|
-
box-sizing: border-box;
|
|
63
|
-
width: 100%;
|
|
64
|
-
height: 180px;
|
|
65
|
-
text-align: center;
|
|
66
|
-
cursor: pointer;
|
|
67
|
-
position: relative;
|
|
68
|
-
overflow: hidden;
|
|
69
|
-
transition: border-color 0.3s;
|
|
70
|
-
display: flex;
|
|
71
|
-
flex-direction: column;
|
|
72
|
-
justify-content: center;
|
|
73
|
-
align-items: center;
|
|
74
|
-
}
|
|
75
|
-
.upload-dragger:hover {
|
|
76
|
-
border-color: #409eff;
|
|
77
|
-
}
|
|
78
|
-
.upload-dragger.is-dragover {
|
|
79
|
-
background-color: rgba(64, 158, 255, 0.06);
|
|
80
|
-
border-color: #409eff;
|
|
81
|
-
}
|
|
82
|
-
.upload-icon {
|
|
83
|
-
font-size: 28px;
|
|
84
|
-
color: #c0c4cc;
|
|
85
|
-
margin-bottom: 8px;
|
|
86
|
-
}
|
|
87
|
-
.upload-text {
|
|
88
|
-
color: #606266;
|
|
89
|
-
font-size: 14px;
|
|
90
|
-
text-align: center;
|
|
91
|
-
padding: 0 12px;
|
|
92
|
-
}
|
|
93
|
-
.upload-tip {
|
|
94
|
-
font-size: 12px;
|
|
95
|
-
color: #909399;
|
|
96
|
-
margin-top: 7px;
|
|
97
|
-
padding: 0 12px;
|
|
98
|
-
}
|
|
99
|
-
.upload-button {
|
|
100
|
-
padding: 8px 16px;
|
|
101
|
-
background-color: #409eff;
|
|
102
|
-
color: white;
|
|
103
|
-
border: none;
|
|
104
|
-
border-radius: 4px;
|
|
105
|
-
cursor: pointer;
|
|
106
|
-
font-size: 14px;
|
|
107
|
-
transition: background-color 0.3s;
|
|
108
|
-
}
|
|
109
|
-
.upload-button:hover {
|
|
110
|
-
background-color: #66b1ff;
|
|
111
|
-
}
|
|
112
|
-
.file-list {
|
|
113
|
-
margin-top: 10px;
|
|
114
|
-
width: 100%;
|
|
115
|
-
}
|
|
116
|
-
.file-item {
|
|
117
|
-
display: flex;
|
|
118
|
-
align-items: center;
|
|
119
|
-
margin-bottom: 8px;
|
|
120
|
-
transition: all 0.3s;
|
|
121
|
-
padding: 8px;
|
|
122
|
-
border-radius: 4px;
|
|
123
|
-
gap: 8px;
|
|
124
|
-
width: 100%;
|
|
125
|
-
box-sizing: border-box;
|
|
126
|
-
min-width: 0;
|
|
127
|
-
flex-wrap: nowrap;
|
|
128
|
-
overflow: hidden;
|
|
129
|
-
max-width: 100%;
|
|
130
|
-
}
|
|
131
|
-
.file-item:hover {
|
|
132
|
-
background-color: #f8f9fa;
|
|
133
|
-
}
|
|
134
|
-
.file-name {
|
|
135
|
-
flex: 1;
|
|
136
|
-
white-space: nowrap;
|
|
137
|
-
overflow: hidden;
|
|
138
|
-
text-overflow: ellipsis;
|
|
139
|
-
color: #606266;
|
|
140
|
-
min-width: 0;
|
|
141
|
-
max-width: 100%;
|
|
142
|
-
word-break: break-all;
|
|
143
|
-
width: 0;
|
|
144
|
-
}
|
|
145
|
-
.file-size {
|
|
146
|
-
color: #909399;
|
|
147
|
-
font-size: 12px;
|
|
148
|
-
flex-shrink: 0;
|
|
149
|
-
margin-left: 8px;
|
|
150
|
-
white-space: nowrap;
|
|
151
|
-
}
|
|
152
|
-
.file-status {
|
|
153
|
-
display: flex;
|
|
154
|
-
align-items: center;
|
|
155
|
-
flex-shrink: 0;
|
|
156
|
-
}
|
|
157
|
-
.file-actions {
|
|
158
|
-
display: flex;
|
|
159
|
-
gap: 4px;
|
|
160
|
-
flex-shrink: 0; /* Prevent shrinking */
|
|
161
|
-
}
|
|
162
|
-
.file-actions button {
|
|
163
|
-
background: none;
|
|
164
|
-
border: none;
|
|
165
|
-
padding: 4px;
|
|
166
|
-
cursor: pointer;
|
|
167
|
-
color: #909399;
|
|
168
|
-
}
|
|
169
|
-
.file-actions button:hover {
|
|
170
|
-
color: #409eff;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/* Progress bar styles - fixed to ensure full width */
|
|
174
|
-
.progress-bar {
|
|
175
|
-
height: 2px;
|
|
176
|
-
width: 100%;
|
|
177
|
-
background-color: #e6e6e6;
|
|
178
|
-
margin-top: 4px;
|
|
179
|
-
position: relative;
|
|
180
|
-
border-radius: 2px;
|
|
181
|
-
overflow: hidden;
|
|
182
|
-
}
|
|
183
|
-
.progress-inner {
|
|
184
|
-
height: 100%;
|
|
185
|
-
background-color: #409eff;
|
|
186
|
-
position: absolute;
|
|
187
|
-
left: 0;
|
|
188
|
-
top: 0;
|
|
189
|
-
transition: width 0.3s ease;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/* Progress percentage indicator */
|
|
193
|
-
.progress-percentage {
|
|
194
|
-
position: absolute;
|
|
195
|
-
right: 0;
|
|
196
|
-
top: -18px;
|
|
197
|
-
font-size: 12px;
|
|
198
|
-
color: #409eff;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.hidden {
|
|
202
|
-
display: none;
|
|
203
|
-
}
|
|
204
|
-
.success {
|
|
205
|
-
color: #67c23a;
|
|
206
|
-
}
|
|
207
|
-
.error {
|
|
208
|
-
color: #f56c6c;
|
|
209
|
-
}
|
|
210
|
-
.icon-delete {
|
|
211
|
-
color: #f56c6c;
|
|
212
|
-
}
|
|
213
|
-
.file-preview {
|
|
214
|
-
width: 100%;
|
|
215
|
-
margin-top: 4px;
|
|
216
|
-
}
|
|
217
|
-
.image-preview {
|
|
218
|
-
display: block;
|
|
219
|
-
max-width: 100%;
|
|
220
|
-
max-height: 200px;
|
|
221
|
-
border-radius: 4px;
|
|
222
|
-
object-fit: contain;
|
|
223
|
-
cursor: zoom-in;
|
|
224
|
-
}
|
|
225
|
-
.preview-modal {
|
|
226
|
-
position: fixed;
|
|
227
|
-
top: 0;
|
|
228
|
-
left: 0;
|
|
229
|
-
width: 100%;
|
|
230
|
-
height: 100%;
|
|
231
|
-
background-color: rgba(0, 0, 0, 0.7);
|
|
232
|
-
display: flex;
|
|
233
|
-
justify-content: center;
|
|
234
|
-
align-items: center;
|
|
235
|
-
z-index: 1000;
|
|
236
|
-
}
|
|
237
|
-
.preview-modal img {
|
|
238
|
-
max-width: 90%;
|
|
239
|
-
max-height: 90%;
|
|
240
|
-
object-fit: contain;
|
|
241
|
-
}
|
|
242
|
-
.preview-close {
|
|
243
|
-
position: absolute;
|
|
244
|
-
top: 20px;
|
|
245
|
-
right: 20px;
|
|
246
|
-
color: white;
|
|
247
|
-
font-size: 30px;
|
|
248
|
-
background: none;
|
|
249
|
-
border: none;
|
|
250
|
-
cursor: pointer;
|
|
251
|
-
}
|
|
252
|
-
.preview-icon {
|
|
253
|
-
padding: 4px;
|
|
254
|
-
color: #409eff;
|
|
255
|
-
cursor: zoom-in;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/* File item container with progress bar */
|
|
259
|
-
.file-container {
|
|
260
|
-
width: 100%;
|
|
261
|
-
position: relative;
|
|
262
|
-
overflow: hidden; /* Prevent child overflow */
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/* Responsive styles */
|
|
266
|
-
@media (max-width: 600px) {
|
|
267
|
-
.upload-dragger {
|
|
268
|
-
height: 140px;
|
|
269
|
-
padding: 12px;
|
|
270
|
-
}
|
|
271
|
-
.upload-icon {
|
|
272
|
-
font-size: 24px;
|
|
273
|
-
}
|
|
274
|
-
.upload-text,
|
|
275
|
-
.upload-tip {
|
|
276
|
-
font-size: 13px;
|
|
277
|
-
}
|
|
278
|
-
.file-item {
|
|
279
|
-
display: grid;
|
|
280
|
-
grid-template-columns: auto 1fr;
|
|
281
|
-
grid-template-areas:
|
|
282
|
-
"icon filename"
|
|
283
|
-
"size status"
|
|
284
|
-
"progress progress"
|
|
285
|
-
"actions actions";
|
|
286
|
-
gap: 4px 8px;
|
|
287
|
-
align-items: center;
|
|
288
|
-
padding: 8px;
|
|
289
|
-
width: 100%;
|
|
290
|
-
box-sizing: border-box;
|
|
291
|
-
overflow: hidden; /* Hide content that overflows */
|
|
292
|
-
}
|
|
293
|
-
.file-item > svg:first-child {
|
|
294
|
-
grid-area: icon;
|
|
295
|
-
align-self: start;
|
|
296
|
-
}
|
|
297
|
-
.file-name {
|
|
298
|
-
grid-area: filename;
|
|
299
|
-
margin: 0;
|
|
300
|
-
padding: 2px 0;
|
|
301
|
-
white-space: nowrap;
|
|
302
|
-
overflow: hidden;
|
|
303
|
-
text-overflow: ellipsis;
|
|
304
|
-
width: 0; /* Force shrinking to minimum width */
|
|
305
|
-
max-width: 100%; /* Ensure it doesn't exceed its container */
|
|
306
|
-
word-break: break-all; /* Break extremely long words if necessary */
|
|
307
|
-
flex: 1; /* Take available space */
|
|
308
|
-
}
|
|
309
|
-
.file-size {
|
|
310
|
-
grid-area: size;
|
|
311
|
-
margin: 0;
|
|
312
|
-
}
|
|
313
|
-
.file-status {
|
|
314
|
-
grid-area: status;
|
|
315
|
-
justify-self: end;
|
|
316
|
-
}
|
|
317
|
-
.progress-bar {
|
|
318
|
-
grid-area: progress;
|
|
319
|
-
width: 100%;
|
|
320
|
-
}
|
|
321
|
-
.file-actions {
|
|
322
|
-
grid-area: actions;
|
|
323
|
-
margin: 4px 0 0 0;
|
|
324
|
-
justify-content: flex-end;
|
|
325
|
-
width: 100%;
|
|
326
|
-
}
|
|
327
|
-
.upload-button {
|
|
328
|
-
width: 100%;
|
|
329
|
-
font-size: 16px;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
`,Wt={isImageFile:t=>t.type.startsWith("image/"),formatFileSize(t){if(0===t)return"0 B";const i=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,i)).toFixed(2))+" "+["B","KB","MB","GB","TB"][i]},createFilePreview:t=>new Promise((i=>{const s=new FileReader;s.onload=t=>{var s;i(null===(s=t.target)||void 0===s?void 0:s.result)},s.readAsDataURL(t)}))};var Jt=function(t,i,s,e){for(var o,n=arguments.length,r=n<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,l=t.length-1;l>=0;l--)(o=t[l])&&(r=(n<3?o(r):n>3?o(i,s,r):o(i,s))||r);return n>3&&r&&Object.defineProperty(i,s,r),r},Vt=function(t,i,s,e){return new(s||(s=Promise))((function(o,n){function r(t){try{h(e.next(t))}catch(t){n(t)}}function l(t){try{h(e.throw(t))}catch(t){n(t)}}function h(t){var i;t.done?o(t.value):(i=t.value,i instanceof s?i:new s((function(t){t(i)}))).then(r,l)}h((e=e.apply(t,i||[])).next())}))};let qt=class extends It{constructor(){super(...arguments),this.accept="",this.multiple=!1,this.drag=!0,this.tip="",this.limit=0,this.preview=!0,this.generatePreviewOnUpload=!1,this.fileList=[],this.isDragOver=!1,this.showDragArea=!1,this.inputElement=null,this.dragCounter=0,this.previewImage=null,this._onDocumentDragEnter=t=>{t.preventDefault(),this.dragCounter++,1===this.dragCounter&&(this.showDragArea=!0)},this._onDocumentDragLeave=t=>{t.preventDefault(),this.dragCounter--,0===this.dragCounter&&(this.showDragArea=!1,this.isDragOver=!1)},this._onDocumentDrop=t=>{t.target===this||this.contains(t.target)||(t.preventDefault(),this.dragCounter=0,this.showDragArea=!1,this.isDragOver=!1)},this._onDocumentDragOver=t=>{t.preventDefault();const i=t.composedPath().includes(this);this.isDragOver=!!i},this._onDrop=t=>{var i;t.preventDefault(),t.stopPropagation(),this.dragCounter=0,this.isDragOver=!1,this.showDragArea=!1,(null===(i=t.dataTransfer)||void 0===i?void 0:i.files)&&(this.dispatchEvent(new CustomEvent("files-changed",{detail:t.dataTransfer.files,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("file-drop",{detail:{files:t.dataTransfer.files},bubbles:!0,composed:!0})),this._handleFiles(t.dataTransfer.files))},this._onClick=()=>{var t;null===(t=this.inputElement)||void 0===t||t.click()},this._onChange=t=>{const i=t.target;i.files&&(this.dispatchEvent(new CustomEvent("files-changed",{detail:i.files,bubbles:!0,composed:!0})),this._handleFiles(i.files),i.value="")}}connectedCallback(){super.connectedCallback(),this.drag&&(document.addEventListener("dragenter",this._onDocumentDragEnter),document.addEventListener("dragleave",this._onDocumentDragLeave),document.addEventListener("drop",this._onDocumentDrop),document.addEventListener("dragover",this._onDocumentDragOver))}disconnectedCallback(){super.disconnectedCallback(),this.drag&&(document.removeEventListener("dragenter",this._onDocumentDragEnter),document.removeEventListener("dragleave",this._onDocumentDragLeave),document.removeEventListener("drop",this._onDocumentDrop),document.removeEventListener("dragover",this._onDocumentDragOver))}firstUpdated(t){var i;super.firstUpdated(t),this.inputElement=(null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector('input[type="file"]'))||null}_handleFiles(t){return Vt(this,void 0,void 0,(function*(){if(this.multiple&&this.limit>0&&this.fileList.length+t.length>this.limit)return void this._dispatchEvent("exceed",{files:t});if(!this.multiple&&t.length>0){const i=t[t.length-1];this.previewImage&&this.fileList.some((t=>t.url===this.previewImage))&&(this.previewImage=null);const s=[...this.fileList];for(const t of s)this._dispatchEvent("remove",{file:t});this.fileList=[];const e=Wt.isImageFile(i),o={name:i.name,size:Wt.formatFileSize(i.size),raw:i,status:"ready",percentage:0,uid:Date.now()+Math.random().toString(36).substring(2),isImage:e};return this.preview&&this.generatePreviewOnUpload&&e&&(o.url=yield Wt.createFilePreview(i)),this.fileList=[o],this.requestUpdate(),void this._dispatchEvent("select",{files:[o],fileList:this.fileList})}const i=[];for(const s of Array.from(t)){const t=Wt.isImageFile(s),e={name:s.name,size:Wt.formatFileSize(s.size),raw:s,status:"ready",percentage:0,uid:Date.now()+Math.random().toString(36).substring(2),isImage:t};this.preview&&this.generatePreviewOnUpload&&t&&(e.url=yield Wt.createFilePreview(s)),this.fileList=[...this.fileList,e],i.push(e)}this.requestUpdate(),this._dispatchEvent("select",{files:i,fileList:this.fileList})}))}updateFileStatus(t,i,s){const e=this.fileList.find((i=>i.uid===t));e&&(e.status=i,void 0!==s&&(e.percentage=s),this._updateFile(e))}_updateFile(t){this.fileList=this.fileList.map((i=>i.uid===t.uid?t:i)),this.requestUpdate()}_removeFile(t){const i=this.fileList.find((i=>i.uid===t));this.fileList=this.fileList.filter((i=>i.uid!==t)),i&&this._dispatchEvent("remove",{file:i}),this.requestUpdate()}_dispatchEvent(t,i){this.dispatchEvent(new CustomEvent(`file-${t}`,{detail:i,bubbles:!0,composed:!0}))}_showPreview(t){this.previewImage=t}_closePreview(){this.previewImage=null}render(){return mt`
|
|
333
|
-
<div class="upload" @drop=${this._onDrop} @dragover=${t=>t.preventDefault()}>
|
|
334
|
-
<input
|
|
335
|
-
type="file"
|
|
336
|
-
class="hidden"
|
|
337
|
-
accept=${this.accept}
|
|
338
|
-
?multiple=${this.multiple}
|
|
339
|
-
@change=${this._onChange}
|
|
340
|
-
/>
|
|
341
|
-
|
|
342
|
-
${this.showDragArea?mt`
|
|
343
|
-
<div
|
|
344
|
-
class="upload-dragger ${this.isDragOver?"is-dragover":""}"
|
|
345
|
-
@click=${this._onClick}
|
|
346
|
-
>
|
|
347
|
-
<div class="upload-icon">
|
|
348
|
-
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
349
|
-
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
|
350
|
-
<polyline points="17 8 12 3 7 8"></polyline>
|
|
351
|
-
<line x1="12" y1="3" x2="12" y2="15"></line>
|
|
352
|
-
</svg>
|
|
353
|
-
</div>
|
|
354
|
-
<div class="upload-text">Drop file here or click to upload</div>
|
|
355
|
-
${this.tip?mt`<div class="upload-tip">${this.tip}</div>`:""}
|
|
356
|
-
</div>
|
|
357
|
-
`:mt`
|
|
358
|
-
<nr-button @click=${this._onClick}>Upload File</nr-button>
|
|
359
|
-
${this.tip?mt`<div class="upload-tip">${this.tip}</div>`:""}
|
|
360
|
-
`}
|
|
361
|
-
|
|
362
|
-
<div class="file-list">
|
|
363
|
-
${this.fileList.map((t=>mt`
|
|
364
|
-
<div class="file-item">
|
|
365
|
-
${t.isImage?mt`
|
|
366
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
367
|
-
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
|
368
|
-
<circle cx="8.5" cy="8.5" r="1.5"></circle>
|
|
369
|
-
<polyline points="21 15 16 10 5 21"></polyline>
|
|
370
|
-
</svg>
|
|
371
|
-
`:mt`
|
|
372
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
373
|
-
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
374
|
-
<polyline points="14 2 14 8 20 8"></polyline>
|
|
375
|
-
</svg>
|
|
376
|
-
`}
|
|
377
|
-
<div class="file-name">${t.name}</div>
|
|
378
|
-
<div class="file-size">${t.size}</div>
|
|
379
|
-
<div class="file-status">
|
|
380
|
-
${"success"===t.status?mt`
|
|
381
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#67c23a" stroke-width="2">
|
|
382
|
-
<polyline points="20 6 9 17 4 12"></polyline>
|
|
383
|
-
</svg>
|
|
384
|
-
`:"error"===t.status?mt`
|
|
385
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#f56c6c" stroke-width="2">
|
|
386
|
-
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
387
|
-
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
388
|
-
</svg>
|
|
389
|
-
`:"uploading"===t.status?mt`${t.percentage}%`:""}
|
|
390
|
-
</div>
|
|
391
|
-
<div class="file-actions">
|
|
392
|
-
${t.isImage&&t.url?mt`
|
|
393
|
-
<button class="preview-icon" @click=${()=>this._showPreview(t.url)}>
|
|
394
|
-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
395
|
-
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
|
|
396
|
-
<circle cx="12" cy="12" r="3"></circle>
|
|
397
|
-
</svg>
|
|
398
|
-
</button>
|
|
399
|
-
`:""}
|
|
400
|
-
<button @click=${()=>this._removeFile(t.uid)}>
|
|
401
|
-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
402
|
-
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
403
|
-
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
404
|
-
</svg>
|
|
405
|
-
</button>
|
|
406
|
-
</div>
|
|
407
|
-
${"uploading"===t.status?mt`
|
|
408
|
-
<div class="progress-bar">
|
|
409
|
-
<div class="progress-inner" style="width: ${t.percentage}%"></div>
|
|
410
|
-
</div>
|
|
411
|
-
`:""}
|
|
412
|
-
</div>
|
|
413
|
-
${this.preview&&t.isImage&&t.url?mt`
|
|
414
|
-
<div class="file-preview">
|
|
415
|
-
<img
|
|
416
|
-
class="image-preview"
|
|
417
|
-
src="${t.url}"
|
|
418
|
-
alt="${t.name}"
|
|
419
|
-
@click=${()=>this._showPreview(t.url)}
|
|
420
|
-
/>
|
|
421
|
-
</div>
|
|
422
|
-
`:""}
|
|
423
|
-
`))}
|
|
424
|
-
</div>
|
|
425
|
-
|
|
426
|
-
${this.previewImage?mt`
|
|
427
|
-
<div class="preview-modal" @click=${this._closePreview}>
|
|
428
|
-
<button class="preview-close">×</button>
|
|
429
|
-
<img src="${this.previewImage}" alt="Preview" />
|
|
430
|
-
</div>
|
|
431
|
-
`:""}
|
|
432
|
-
</div>
|
|
433
|
-
`}};qt.styles=Kt,Jt([Dt({type:String})],qt.prototype,"accept",void 0),Jt([Dt({type:Boolean})],qt.prototype,"multiple",void 0),Jt([Dt({type:Boolean})],qt.prototype,"drag",void 0),Jt([Dt({type:String})],qt.prototype,"tip",void 0),Jt([Dt({type:Number})],qt.prototype,"limit",void 0),Jt([Dt({type:Boolean})],qt.prototype,"preview",void 0),Jt([Dt({type:Boolean})],qt.prototype,"generatePreviewOnUpload",void 0),Jt([Ht()],qt.prototype,"fileList",void 0),Jt([Ht()],qt.prototype,"isDragOver",void 0),Jt([Ht()],qt.prototype,"showDragArea",void 0),Jt([Ht()],qt.prototype,"inputElement",void 0),Jt([Ht()],qt.prototype,"dragCounter",void 0),Jt([Ht()],qt.prototype,"previewImage",void 0),qt=Jt([(t=>i=>"function"==typeof i?((t,i)=>(customElements.define(t,i),i))(t,i):((t,i)=>{const{kind:s,elements:e}=i;return{kind:s,elements:e,finisher(i){customElements.define(t,i)}}})(t,i))("nr-file-upload")],qt);export{qt as FileUpload};
|
|
1
|
+
import{css as i,LitElement as e,html as t}from"lit";import{property as o,state as s,customElement as r}from"lit/decorators.js";const l=i`:host{display:block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif}.upload{width:100%}.upload-dragger{background-color:#f8f9fa;border:1px dashed #d9d9d9;border-radius:6px;box-sizing:border-box;width:100%;height:180px;text-align:center;cursor:pointer;position:relative;overflow:hidden;transition:border-color .3s;display:flex;flex-direction:column;justify-content:center;align-items:center}.upload-dragger:hover{border-color:#409eff}.upload-dragger.is-dragover{background-color:rgba(64,158,255,.06);border-color:#409eff}.upload-icon{font-size:28px;color:#c0c4cc;margin-bottom:8px}.upload-text{color:#606266;font-size:14px;text-align:center;padding:0 12px}.upload-tip{font-size:12px;color:#909399;margin-top:7px;padding:0 12px}.upload-button{padding:8px 16px;background-color:#409eff;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:14px;transition:background-color .3s}.upload-button:hover{background-color:#66b1ff}.file-list{margin-top:10px;width:100%}.file-item{display:flex;align-items:center;margin-bottom:8px;transition:all .3s;padding:8px;border-radius:4px;gap:8px;width:100%;box-sizing:border-box;min-width:0;flex-wrap:nowrap;overflow:hidden;max-width:100%}.file-item:hover{background-color:#f8f9fa}.file-name{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#606266;min-width:0;max-width:100%;word-break:break-all;width:0}.file-size{color:#909399;font-size:12px;flex-shrink:0;margin-left:8px;white-space:nowrap}.file-status{display:flex;align-items:center;flex-shrink:0}.file-actions{display:flex;gap:4px;flex-shrink:0}.file-actions button{background:0 0;border:none;padding:4px;cursor:pointer;color:#909399}.file-actions button:hover{color:#409eff}.progress-bar{height:2px;width:100%;background-color:#e6e6e6;margin-top:4px;position:relative;border-radius:2px;overflow:hidden}.progress-inner{height:100%;background-color:#409eff;position:absolute;left:0;top:0;transition:width .3s ease}.progress-percentage{position:absolute;right:0;top:-18px;font-size:12px;color:#409eff}.hidden{display:none}.success{color:#67c23a}.error{color:#f56c6c}.icon-delete{color:#f56c6c}.file-preview{width:100%;margin-top:4px}.image-preview{display:block;max-width:100%;max-height:200px;border-radius:4px;object-fit:contain;cursor:zoom-in}.preview-modal{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);display:flex;justify-content:center;align-items:center;z-index:1000}.preview-modal img{max-width:90%;max-height:90%;object-fit:contain}.preview-close{position:absolute;top:20px;right:20px;color:#fff;font-size:30px;background:0 0;border:none;cursor:pointer}.preview-icon{padding:4px;color:#409eff;cursor:zoom-in}.file-container{width:100%;position:relative;overflow:hidden}@media (max-width:600px){.upload-dragger{height:140px;padding:12px}.upload-icon{font-size:24px}.upload-text,.upload-tip{font-size:13px}.file-item{display:grid;grid-template-columns:auto 1fr;grid-template-areas:"icon filename" "size status" "progress progress" "actions actions";gap:4px 8px;align-items:center;padding:8px;width:100%;box-sizing:border-box;overflow:hidden}.file-item>svg:first-child{grid-area:icon;align-self:start}.file-name{grid-area:filename;margin:0;padding:2px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:0;max-width:100%;word-break:break-all;flex:1}.file-size{grid-area:size;margin:0}.file-status{grid-area:status;justify-self:end}.progress-bar{grid-area:progress;width:100%}.file-actions{grid-area:actions;margin:4px 0 0 0;justify-content:flex-end;width:100%}.upload-button{width:100%;font-size:16px}}`,n={isImageFile:i=>i.type.startsWith("image/"),formatFileSize(i){if(0===i)return"0 B";const e=Math.floor(Math.log(i)/Math.log(1024));return parseFloat((i/Math.pow(1024,e)).toFixed(2))+" "+["B","KB","MB","GB","TB"][e]},createFilePreview:i=>new Promise((e=>{const t=new FileReader;t.onload=i=>{var t;e(null===(t=i.target)||void 0===t?void 0:t.result)},t.readAsDataURL(i)}))};var a=function(i,e,t,o){for(var s,r=arguments.length,l=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,t):o,n=i.length-1;n>=0;n--)(s=i[n])&&(l=(r<3?s(l):r>3?s(e,t,l):s(e,t))||l);return r>3&&l&&Object.defineProperty(e,t,l),l},d=function(i,e,t,o){return new(t||(t=Promise))((function(s,r){function l(i){try{a(o.next(i))}catch(i){r(i)}}function n(i){try{a(o.throw(i))}catch(i){r(i)}}function a(i){var e;i.done?s(i.value):(e=i.value,e instanceof t?e:new t((function(i){i(e)}))).then(l,n)}a((o=o.apply(i,e||[])).next())}))};let h=class extends e{constructor(){super(...arguments),this.accept="",this.multiple=!1,this.drag=!0,this.tip="",this.limit=0,this.preview=!0,this.generatePreviewOnUpload=!1,this.fileList=[],this.isDragOver=!1,this.showDragArea=!1,this.inputElement=null,this.dragCounter=0,this.previewImage=null,this._onDocumentDragEnter=i=>{i.preventDefault(),this.dragCounter++,1===this.dragCounter&&(this.showDragArea=!0)},this._onDocumentDragLeave=i=>{i.preventDefault(),this.dragCounter--,0===this.dragCounter&&(this.showDragArea=!1,this.isDragOver=!1)},this._onDocumentDrop=i=>{i.target===this||this.contains(i.target)||(i.preventDefault(),this.dragCounter=0,this.showDragArea=!1,this.isDragOver=!1)},this._onDocumentDragOver=i=>{i.preventDefault();const e=i.composedPath().includes(this);this.isDragOver=!!e},this._onDrop=i=>{var e;i.preventDefault(),i.stopPropagation(),this.dragCounter=0,this.isDragOver=!1,this.showDragArea=!1,(null===(e=i.dataTransfer)||void 0===e?void 0:e.files)&&(this.dispatchEvent(new CustomEvent("files-changed",{detail:i.dataTransfer.files,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("file-drop",{detail:{files:i.dataTransfer.files},bubbles:!0,composed:!0})),this._handleFiles(i.dataTransfer.files))},this._onClick=()=>{var i;null===(i=this.inputElement)||void 0===i||i.click()},this._onChange=i=>{const e=i.target;e.files&&(this.dispatchEvent(new CustomEvent("files-changed",{detail:e.files,bubbles:!0,composed:!0})),this._handleFiles(e.files),e.value="")}}connectedCallback(){super.connectedCallback(),this.drag&&(document.addEventListener("dragenter",this._onDocumentDragEnter),document.addEventListener("dragleave",this._onDocumentDragLeave),document.addEventListener("drop",this._onDocumentDrop),document.addEventListener("dragover",this._onDocumentDragOver))}disconnectedCallback(){super.disconnectedCallback(),this.drag&&(document.removeEventListener("dragenter",this._onDocumentDragEnter),document.removeEventListener("dragleave",this._onDocumentDragLeave),document.removeEventListener("drop",this._onDocumentDrop),document.removeEventListener("dragover",this._onDocumentDragOver))}firstUpdated(i){var e;super.firstUpdated(i),this.inputElement=(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('input[type="file"]'))||null}_handleFiles(i){return d(this,void 0,void 0,(function*(){if(this.multiple&&this.limit>0&&this.fileList.length+i.length>this.limit)return void this._dispatchEvent("exceed",{files:i});if(!this.multiple&&i.length>0){const e=i[i.length-1];this.previewImage&&this.fileList.some((i=>i.url===this.previewImage))&&(this.previewImage=null);const t=[...this.fileList];for(const i of t)this._dispatchEvent("remove",{file:i});this.fileList=[];const o=n.isImageFile(e),s={name:e.name,size:n.formatFileSize(e.size),raw:e,status:"ready",percentage:0,uid:Date.now()+Math.random().toString(36).substring(2),isImage:o};return this.preview&&this.generatePreviewOnUpload&&o&&(s.url=yield n.createFilePreview(e)),this.fileList=[s],this.requestUpdate(),void this._dispatchEvent("select",{files:[s],fileList:this.fileList})}const e=[];for(const t of Array.from(i)){const i=n.isImageFile(t),o={name:t.name,size:n.formatFileSize(t.size),raw:t,status:"ready",percentage:0,uid:Date.now()+Math.random().toString(36).substring(2),isImage:i};this.preview&&this.generatePreviewOnUpload&&i&&(o.url=yield n.createFilePreview(t)),this.fileList=[...this.fileList,o],e.push(o)}this.requestUpdate(),this._dispatchEvent("select",{files:e,fileList:this.fileList})}))}updateFileStatus(i,e,t){const o=this.fileList.find((e=>e.uid===i));o&&(o.status=e,void 0!==t&&(o.percentage=t),this._updateFile(o))}_updateFile(i){this.fileList=this.fileList.map((e=>e.uid===i.uid?i:e)),this.requestUpdate()}_removeFile(i){const e=this.fileList.find((e=>e.uid===i));this.fileList=this.fileList.filter((e=>e.uid!==i)),e&&this._dispatchEvent("remove",{file:e}),this.requestUpdate()}_dispatchEvent(i,e){this.dispatchEvent(new CustomEvent(`file-${i}`,{detail:e,bubbles:!0,composed:!0}))}_showPreview(i){this.previewImage=i}_closePreview(){this.previewImage=null}render(){return t`<div class="upload" @drop="${this._onDrop}" @dragover="${i=>i.preventDefault()}"><input type="file" class="hidden" accept="${this.accept}" ?multiple="${this.multiple}" @change="${this._onChange}"> ${this.showDragArea?t`<div class="upload-dragger ${this.isDragOver?"is-dragover":""}" @click="${this._onClick}"><div class="upload-icon"><svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg></div><div class="upload-text">Drop file here or click to upload</div>${this.tip?t`<div class="upload-tip">${this.tip}</div>`:""}</div>`:t`<nr-button @click="${this._onClick}">Upload File</nr-button>${this.tip?t`<div class="upload-tip">${this.tip}</div>`:""}`}<div class="file-list">${this.fileList.map((i=>t`<div class="file-item">${i.isImage?t`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>`:t`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`}<div class="file-name">${i.name}</div><div class="file-size">${i.size}</div><div class="file-status">${"success"===i.status?t`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#67c23a" stroke-width="2"><polyline points="20 6 9 17 4 12"></polyline></svg>`:"error"===i.status?t`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#f56c6c" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>`:"uploading"===i.status?t`${i.percentage}%`:""}</div><div class="file-actions">${i.isImage&&i.url?t`<button class="preview-icon" @click="${()=>this._showPreview(i.url)}"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg></button>`:""} <button @click="${()=>this._removeFile(i.uid)}"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></button></div>${"uploading"===i.status?t`<div class="progress-bar"><div class="progress-inner" style="width:${i.percentage}"></div></div>`:""}</div>${this.preview&&i.isImage&&i.url?t`<div class="file-preview"><img class="image-preview" src="${i.url}" alt="${i.name}" @click="${()=>this._showPreview(i.url)}"></div>`:""}`))}</div>${this.previewImage?t`<div class="preview-modal" @click="${this._closePreview}"><button class="preview-close">×</button> <img src="${this.previewImage}" alt="Preview"></div>`:""}</div>`}};h.styles=l,a([o({type:String})],h.prototype,"accept",void 0),a([o({type:Boolean})],h.prototype,"multiple",void 0),a([o({type:Boolean})],h.prototype,"drag",void 0),a([o({type:String})],h.prototype,"tip",void 0),a([o({type:Number})],h.prototype,"limit",void 0),a([o({type:Boolean})],h.prototype,"preview",void 0),a([o({type:Boolean})],h.prototype,"generatePreviewOnUpload",void 0),a([s()],h.prototype,"fileList",void 0),a([s()],h.prototype,"isDragOver",void 0),a([s()],h.prototype,"showDragArea",void 0),a([s()],h.prototype,"inputElement",void 0),a([s()],h.prototype,"dragCounter",void 0),a([s()],h.prototype,"previewImage",void 0),h=a([r("nr-file-upload")],h);export{h as FileUpload};
|