@pb33f/cowboy-components 0.7.4 → 0.7.5
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.
|
@@ -51,7 +51,13 @@ let UploadArchiveComponent = class UploadArchiveComponent extends LitElement {
|
|
|
51
51
|
this.fileName = file.name;
|
|
52
52
|
this.fileType = file.type;
|
|
53
53
|
this.fileSize = file.size;
|
|
54
|
-
if (file.type === 'application/zip' ||
|
|
54
|
+
if (file.type === 'application/zip' ||
|
|
55
|
+
file.type === 'application/zip-compressed' ||
|
|
56
|
+
file.type === 'application/x-zip' ||
|
|
57
|
+
file.type === 'multipart/zip' ||
|
|
58
|
+
file.type === 'application/x-zip-compressed' ||
|
|
59
|
+
file.type === 'application/gzip' ||
|
|
60
|
+
file.type === 'application/x-gzip') {
|
|
55
61
|
this.file = file;
|
|
56
62
|
this.invalid = false;
|
|
57
63
|
const formData = new FormData();
|
|
@@ -11059,7 +11059,7 @@ ${jxt(h)}`}}))}render(){var L,A,I,N,O;let h=E.html``,c=E.html``,l=E.html``,d=E.h
|
|
|
11059
11059
|
margin-bottom: 20px;
|
|
11060
11060
|
margin-top: 10px;
|
|
11061
11061
|
}
|
|
11062
|
-
`;var lkt=Object.defineProperty,akt=Object.getOwnPropertyDescriptor,rm=(h,c,l,d)=>{for(var p=d>1?void 0:d?akt(c,l):c,m=h.length-1,v;m>=0;m--)(v=h[m])&&(p=(d?v(c,l,p):v(p))||p);return d&&p&&lkt(c,l,p),p};const ukt=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/;let O1=class extends E.LitElement{constructor(){super(),this.visible=!1,this.invalid=!1,this.file=null,this.files=[]}show(){var h;this.visible=!0,(h=this.dialog)==null||h.show()}hide(){var h;this.visible=!1,(h=this.dialog)==null||h.hide()}handleFileChange(h){const c=h.target.files[0];if(c){if(this.noSpecFilesFound=!1,c.size>5242880){this.invalid=!0,this.fileName=c.name,this.fileType=c.type,this.fileSize=c.size,this.fileTooBig=!0;return}if(this.fileName=c.name,this.fileType=c.type,this.fileSize=c.size,c.type==="application/zip"||c.type==="application/gzip"||c.type==="application/x-gzip"){this.file=c,this.invalid=!1;const l=new FormData;l.append("spec-archive",c),Vf.uploadArchive(l).then(d=>{this.files=d.files;let p=0,m=[];if(this.files.forEach(v=>{v.isOpenAPI&&(p++,m.push(v))}),p===0){console.error("No OpenAPI files found in the archive"),this.noSpecFilesFound=!0;return}if(p===1){this.selectFile(m[0].name);return}}).catch(d=>{console.error(d)});return}this.invalid=!0}}selectFile(h){this.noSpecFilesFound=!1,Vf.selectRootPath(h).then(c=>{this.dispatchEvent(new CustomEvent(oxe,{composed:!0,bubbles:!0,detail:{content:c.instance,path:h,nodeId:c.id}})),this.files=[],this.hide()}).catch(c=>{console.error(c)})}fetchUrl(){this.noSpecFilesFound=!1,this.dispatchEvent(new CustomEvent(gxe,{composed:!0,bubbles:!0,detail:{url:this.urlInput.value}})),this.hide()}validateUrl(h){h.key==="Enter"&&this.fetchUrl(),this.urlInput.value.match(ukt)?(this.urlInputButton.disabled=!1,this.urlInputButton.classList.remove("close-button")):(this.urlInputButton.disabled=!0,this.urlInputButton.classList.add("close-button"))}renderFilePath(h,c=!1){const l=h.lastIndexOf("/");if(l===-1){let v=E.html` <a href="#" @click="${()=>{this.selectFile(h)}}">${h}</a>`;return c||(v=E.html`<span class="not-spec">${h}</span>`),E.html`<span class="name">${v}</span>`}const d=h.substring(l+1),p=h.substring(0,l);let m=E.html` <a href="#" @click="${()=>{this.selectFile(p+"/"+d)}}">${d}</a>`;return c||(m=E.html`<span class="not-spec">${d}</span>`),E.html`
|
|
11062
|
+
`;var lkt=Object.defineProperty,akt=Object.getOwnPropertyDescriptor,rm=(h,c,l,d)=>{for(var p=d>1?void 0:d?akt(c,l):c,m=h.length-1,v;m>=0;m--)(v=h[m])&&(p=(d?v(c,l,p):v(p))||p);return d&&p&&lkt(c,l,p),p};const ukt=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/;let O1=class extends E.LitElement{constructor(){super(),this.visible=!1,this.invalid=!1,this.file=null,this.files=[]}show(){var h;this.visible=!0,(h=this.dialog)==null||h.show()}hide(){var h;this.visible=!1,(h=this.dialog)==null||h.hide()}handleFileChange(h){const c=h.target.files[0];if(c){if(this.noSpecFilesFound=!1,c.size>5242880){this.invalid=!0,this.fileName=c.name,this.fileType=c.type,this.fileSize=c.size,this.fileTooBig=!0;return}if(this.fileName=c.name,this.fileType=c.type,this.fileSize=c.size,c.type==="application/zip"||c.type==="application/zip-compressed"||c.type==="application/x-zip"||c.type==="multipart/zip"||c.type==="application/x-zip-compressed"||c.type==="application/gzip"||c.type==="application/x-gzip"){this.file=c,this.invalid=!1;const l=new FormData;l.append("spec-archive",c),Vf.uploadArchive(l).then(d=>{this.files=d.files;let p=0,m=[];if(this.files.forEach(v=>{v.isOpenAPI&&(p++,m.push(v))}),p===0){console.error("No OpenAPI files found in the archive"),this.noSpecFilesFound=!0;return}if(p===1){this.selectFile(m[0].name);return}}).catch(d=>{console.error(d)});return}this.invalid=!0}}selectFile(h){this.noSpecFilesFound=!1,Vf.selectRootPath(h).then(c=>{this.dispatchEvent(new CustomEvent(oxe,{composed:!0,bubbles:!0,detail:{content:c.instance,path:h,nodeId:c.id}})),this.files=[],this.hide()}).catch(c=>{console.error(c)})}fetchUrl(){this.noSpecFilesFound=!1,this.dispatchEvent(new CustomEvent(gxe,{composed:!0,bubbles:!0,detail:{url:this.urlInput.value}})),this.hide()}validateUrl(h){h.key==="Enter"&&this.fetchUrl(),this.urlInput.value.match(ukt)?(this.urlInputButton.disabled=!1,this.urlInputButton.classList.remove("close-button")):(this.urlInputButton.disabled=!0,this.urlInputButton.classList.add("close-button"))}renderFilePath(h,c=!1){const l=h.lastIndexOf("/");if(l===-1){let v=E.html` <a href="#" @click="${()=>{this.selectFile(h)}}">${h}</a>`;return c||(v=E.html`<span class="not-spec">${h}</span>`),E.html`<span class="name">${v}</span>`}const d=h.substring(l+1),p=h.substring(0,l);let m=E.html` <a href="#" @click="${()=>{this.selectFile(p+"/"+d)}}">${d}</a>`;return c||(m=E.html`<span class="not-spec">${d}</span>`),E.html`
|
|
11063
11063
|
<span class="path">${p}/</span><span class="name">
|
|
11064
11064
|
${m}
|
|
11065
11065
|
</span>
|
package/package.json
CHANGED