@usecsv/vuejs 1.1.11 → 1.1.13
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/CHANGELOG.md +14 -0
- package/dist/UseCSVButton.esm.js +11 -5
- package/dist/UseCSVButton.min.js +1 -1
- package/dist/UseCSVButton.ssr.js +14 -8
- package/package.json +1 -1
- package/src/UseCSVButton.vue +18 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.1.13](https://github.com/layercodedev/usecsv-vuejs-plugin/compare/v1.1.12...v1.1.13) (2022-10-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add missing onData prop ([de179a8](https://github.com/layercodedev/usecsv-vuejs-plugin/commit/de179a8fe868418063c6297c42ece3a3da9eae58))
|
|
7
|
+
|
|
8
|
+
## [1.1.12](https://github.com/layercodedev/usecsv-vuejs-plugin/compare/v1.1.11...v1.1.12) (2022-10-23)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add missing prop ([2fc5d16](https://github.com/layercodedev/usecsv-vuejs-plugin/commit/2fc5d168fdefae6d264e859a84debf29b7ec1922))
|
|
14
|
+
|
|
1
15
|
## [1.1.11](https://github.com/layercodedev/usecsv-vuejs-plugin/compare/v1.1.10...v1.1.11) (2022-10-23)
|
|
2
16
|
|
|
3
17
|
|
package/dist/UseCSVButton.esm.js
CHANGED
|
@@ -641,7 +641,10 @@ var script = /*#__PURE__*/Vue.extend({
|
|
|
641
641
|
importerKey: {},
|
|
642
642
|
user: {},
|
|
643
643
|
metadata: {},
|
|
644
|
-
onData: {}
|
|
644
|
+
onData: {},
|
|
645
|
+
importerDisplay: {},
|
|
646
|
+
onRecordsInitial: {},
|
|
647
|
+
onRecordEdit: {}
|
|
645
648
|
},
|
|
646
649
|
|
|
647
650
|
data() {
|
|
@@ -656,7 +659,10 @@ var script = /*#__PURE__*/Vue.extend({
|
|
|
656
659
|
importerKey: this.importerKey,
|
|
657
660
|
user: this.user,
|
|
658
661
|
metadata: this.metadata,
|
|
659
|
-
onData: this.onData
|
|
662
|
+
onData: this.onData,
|
|
663
|
+
importerDisplay: this.importerDisplay,
|
|
664
|
+
onRecordsInitial: this.onRecordsInitial,
|
|
665
|
+
onRecordEdit: this.onRecordEdit
|
|
660
666
|
});
|
|
661
667
|
},
|
|
662
668
|
|
|
@@ -828,8 +834,8 @@ var __vue_staticRenderFns__ = [];
|
|
|
828
834
|
|
|
829
835
|
const __vue_inject_styles__ = function (inject) {
|
|
830
836
|
if (!inject) return;
|
|
831
|
-
inject("data-v-
|
|
832
|
-
source: "#usecsv-button[data-v-
|
|
837
|
+
inject("data-v-d14d8d0c_0", {
|
|
838
|
+
source: "#usecsv-button[data-v-d14d8d0c]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",
|
|
833
839
|
map: undefined,
|
|
834
840
|
media: undefined
|
|
835
841
|
});
|
|
@@ -837,7 +843,7 @@ const __vue_inject_styles__ = function (inject) {
|
|
|
837
843
|
/* scoped */
|
|
838
844
|
|
|
839
845
|
|
|
840
|
-
const __vue_scope_id__ = "data-v-
|
|
846
|
+
const __vue_scope_id__ = "data-v-d14d8d0c";
|
|
841
847
|
/* module identifier */
|
|
842
848
|
|
|
843
849
|
const __vue_module_identifier__ = undefined;
|
package/dist/UseCSVButton.min.js
CHANGED
|
@@ -17,4 +17,4 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
17
17
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
18
18
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
19
|
PERFORMANCE OF THIS SOFTWARE.
|
|
20
|
-
***************************************************************************** */()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var i=function(){return i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},a=[],s=[];function c(e,t){if(t=t||{},void 0===e)throw new Error("insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).");var n,o=!0===t.prepend?"prepend":"append",r=void 0!==t.container?t.container:document.querySelector("head"),i=a.indexOf(r);return-1===i&&(i=a.push(r)-1,s[i]={}),void 0!==s[i]&&void 0!==s[i][o]?n=s[i][o]:(n=s[i][o]=function(){var e=document.createElement("style");return e.setAttribute("type","text/css"),e}(),"prepend"===o?r.insertBefore(n,r.childNodes[0]):r.appendChild(n)),65279===e.charCodeAt(0)&&(e=e.substr(1,e.length)),n.styleSheet?n.styleSheet.cssText+=e:n.textContent+=e,n}var d,l,u,m,f,p=c;c.insertCss=p,function(e){e.Call="call",e.Reply="reply",e.Syn="syn",e.SynAck="synAck",e.Ack="ack"}(d||(d={})),function(e){e.Fulfilled="fulfilled",e.Rejected="rejected"}(l||(l={})),function(e){e.ConnectionDestroyed="ConnectionDestroyed",e.ConnectionTimeout="ConnectionTimeout",e.NoIframeSrc="NoIframeSrc"}(u||(u={})),function(e){e.DataCloneError="DataCloneError"}(m||(m={})),function(e){e.Message="message"}(f||(f={}));const h={"http:":"80","https:":"443"},v=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,g=["file:","data:"];const y=({name:e,message:t,stack:n})=>({name:e,message:t,stack:n});let b=0;var C=()=>++b,S=(e,t,n,o,r)=>{const{localName:i,local:a,remote:s,originForSending:c,originForReceiving:m}=t;let p=!1;r(`${i}: Connecting call sender`);const h=e=>(...t)=>{let n;r(`${i}: Sending ${e}() call`);try{s.closed&&(n=!0)}catch(e){n=!0}if(n&&o(),p){const t=new Error(`Unable to send ${e}() call due to destroyed connection`);throw t.code=u.ConnectionDestroyed,t}return new Promise(((n,o)=>{const u=C(),p=t=>{if(t.source!==s||t.data.penpal!==d.Reply||t.data.id!==u)return;if(t.origin!==m)return void r(`${i} received message from origin ${t.origin} which did not match expected origin ${m}`);const c=t.data;r(`${i}: Received ${e}() reply`),a.removeEventListener(f.Message,p);let h=c.returnValue;c.returnValueIsError&&(h=(e=>{const t=new Error;return Object.keys(e).forEach((n=>t[n]=e[n])),t})(h)),(c.resolution===l.Fulfilled?n:o)(h)};a.addEventListener(f.Message,p);const h={penpal:d.Call,id:u,methodName:e,args:t};s.postMessage(h,c)}))};return n.reduce(((e,t)=>(e[t]=h(t),e)),e),()=>{p=!0}},w=(e,t,n,o,r)=>{const{destroy:i,onDestroy:a}=o;let s,c;const u={};return o=>{if(o.origin!==t)return void r(`Parent: Handshake - Received ACK message from origin ${o.origin} which did not match expected origin ${t}`);r("Parent: Handshake - Received ACK");const p={localName:"Parent",local:window,remote:o.source,originForSending:n,originForReceiving:t};s&&s(),s=((e,t,n)=>{const{localName:o,local:r,remote:i,originForSending:a,originForReceiving:s}=e;let c=!1;const u=e=>{if(e.source!==i||e.data.penpal!==d.Call)return;if(e.origin!==s)return void n(`${o} received message from origin ${e.origin} which did not match expected origin ${s}`);const r=e.data,{methodName:u,args:f,id:p}=r;n(`${o}: Received ${u}() call`);const h=e=>t=>{if(n(`${o}: Sending ${u}() reply`),c)return void n(`${o}: Unable to send ${u}() reply due to destroyed connection`);const r={penpal:d.Reply,id:p,resolution:e,returnValue:t};e===l.Rejected&&t instanceof Error&&(r.returnValue=y(t),r.returnValueIsError=!0);try{i.postMessage(r,a)}catch(e){if(e.name===m.DataCloneError){const t={penpal:d.Reply,id:p,resolution:l.Rejected,returnValue:y(e),returnValueIsError:!0};i.postMessage(t,a)}throw e}};new Promise((e=>e(t[u].apply(t,f)))).then(h(l.Fulfilled),h(l.Rejected))};return r.addEventListener(f.Message,u),()=>{c=!0,r.removeEventListener(f.Message,u)}})(p,e,r),a(s),c&&c.forEach((e=>{delete u[e]})),c=o.data.methodNames;const h=S(u,p,c,i,r);return a(h),u}};var E=e=>{let{iframe:t,methods:n={},childOrigin:o,timeout:r,debug:i=!1}=e;const a=(e=>(...t)=>{e&&console.log("[Penpal]",...t)})(i),s=((e,t)=>{const n=[];let o=!1;return{destroy(r){o||(o=!0,t(`${e}: Destroying connection`),n.forEach((e=>{e(r)})))},onDestroy(e){o?e():n.push(e)}}})("Parent",a),{onDestroy:c,destroy:l}=s;o||((e=>{if(!e.src&&!e.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=u.NoIframeSrc,e}})(t),o=(e=>{if(e&&g.find((t=>e.startsWith(t))))return"null";const t=document.location,n=v.exec(e);let o,r,i;return n?(o=n[1]?n[1]:t.protocol,r=n[2],i=n[4]):(o=t.protocol,r=t.hostname,i=t.port),`${o}//${r}${i&&i!==h[o]?`:${i}`:""}`})(t.src));const m="null"===o?"*":o,p=((e,t,n,o)=>r=>{if(r.origin!==n)return void e(`Parent: Handshake - Received SYN message from origin ${r.origin} which did not match expected origin ${n}`);e("Parent: Handshake - Received SYN, responding with SYN-ACK");const i={penpal:d.SynAck,methodNames:Object.keys(t)};r.source.postMessage(i,o)})(a,n,o,m),y=w(n,o,m,s,a),b=new Promise(((e,n)=>{const o=((e,t)=>{let n;return void 0!==e&&(n=window.setTimeout((()=>{const n=new Error(`Connection timed out after ${e}ms`);n.code=u.ConnectionTimeout,t(n)}),e)),()=>{clearTimeout(n)}})(r,l),i=n=>{if(n.source===t.contentWindow&&n.data)if(n.data.penpal!==d.Syn)if(n.data.penpal!==d.Ack);else{const t=y(n);t&&(o(),e(t))}else p(n)};window.addEventListener(f.Message,i),a("Parent: Awaiting handshake"),((e,t)=>{const{destroy:n,onDestroy:o}=t,r=setInterval((()=>{e.isConnected||(clearInterval(r),n())}),6e4);o((()=>{clearInterval(r)}))})(t,s),c((e=>{window.removeEventListener(f.Message,i),e&&n(e)}))}));return{promise:b,destroy(){l()}}},$=["interactive","complete"],R=function(e,t){return new Promise((function(n){e&&"function"!=typeof e&&(t=e,e=null),t=t||window.document;var o=function(){return n(void(e&&setTimeout(e)))};-1!==$.indexOf(t.readyState)?o():t.addEventListener("DOMContentLoaded",o)}))};R.resume=function(e){return function(t){return R(e).then((function(){return t}))}};var _=function(e){var t=e.importerKey,n=e.user,o=e.metadata,r=e.onData,a=e.onRecordsInitial,s=e.onRecordEdit,c=e.importerDisplay,d=void 0===c?"modal":c,l="usecsv-".concat(Math.round(1e8*Math.random()));return R().then((function(){var e=function(e,t){var n=document.getElementById("usecsv-importer-inline-wrapper");p("\n ".concat("modal"!==t&&n?"":".usecsv_container { position: fixed; top: 0px; bottom: 0; right: 0; left: 0; z-index: 100000; }","\n .usecsv_container iframe {\n width: 100%;\n height: 100%;\n position: absolute;\n border-width: 0;\n }\n .usecsv_container {\n overflow: hidden;\n overscroll-behavior-x: none;\n }\n")),document.body.insertAdjacentHTML("beforeend","<div id=".concat(e,' class="usecsv_container loading"></div>'));var o=document.createElement("iframe");o.setAttribute("src","https://app.usecsv.com/importer");var r=document.getElementById(e);return null==r||r.appendChild(o),"inline"===t&&n&&(null==n||n.appendChild(r)),o}(l,d),c=function(){var e;null===(e=document.getElementById(l))||void 0===e||e.remove()},u=E({iframe:e,methods:i(i(i({closeIframe:c},r?{onData:function(e){return r(e,c)}}:{}),a?{onRecordsInitial:a}:{}),s?{onRecordEdit:s}:{})});return u.promise.then((function(e){var r;null===(r=document.getElementById(l))||void 0===r||r.classList.remove("loading"),e.setParams&&e.setParams({importerKey:t,user:n,metadata:o})})),u}))},x=n.default.extend({name:"usecsv-button",props:{importerKey:{},user:{},metadata:{},onData:{}},data:function(){return{hasSlot:!!this.$slots.default}},methods:{openModal:function(){_({importerKey:this.importerKey,user:this.user,metadata:this.metadata,onData:this.onData})},hasScopedSlot:function(){return"normalized"===(this.$scopedSlots.default&&this.$scopedSlots.default.name)}}});function I(e,t,n,o,r,i,a,s,c,d){"boolean"!=typeof a&&(c=s,s=a,a=!1);const l="function"==typeof n?n.options:n;let u;if(e&&e.render&&(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,r&&(l.functional=!0)),o&&(l._scopeId=o),i?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,c(e)),e&&e._registeredComponents&&e._registeredComponents.add(i)},l._ssrRegister=u):t&&(u=a?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,s(e))}),u)if(l.functional){const e=l.render;l.render=function(t,n){return u.call(n),e(t,n)}}else{const e=l.beforeCreate;l.beforeCreate=e?[].concat(e,u):[u]}return n}const A="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function M(e){return(e,t)=>function(e,t){const n=A?t.media||"default":e,o=j[n]||(j[n]={ids:new Set,styles:[]});if(!o.ids.has(e)){o.ids.add(e);let n=t.source;if(t.map&&(n+="\n/*# sourceURL="+t.map.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),o.element||(o.element=document.createElement("style"),o.element.type="text/css",t.media&&o.element.setAttribute("media",t.media),void 0===N&&(N=document.head||document.getElementsByTagName("head")[0]),N.appendChild(o.element)),"styleSheet"in o.element)o.styles.push(n),o.element.styleSheet.cssText=o.styles.filter(Boolean).join("\n");else{const e=o.ids.size-1,t=document.createTextNode(n),r=o.element.childNodes;r[e]&&o.element.removeChild(r[e]),r.length?o.element.insertBefore(t,r[e]):o.element.appendChild(t)}}}(e,t)}let N;const j={};var D=I({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"usecsv"},[e.hasScopedSlot()?n("div",[e._t("default",null,{openModal:e.openModal})],2):n("div",[n("button",{attrs:{type:"button",id:"usecsv-button"},on:{click:e.openModal}},[e._t("default",(function(){return[e._v(" open usecsv ")]}))],2)])])},staticRenderFns:[]},(function(e){e&&e("data-v-4807283e_0",{source:"#usecsv-button[data-v-4807283e]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",map:void 0,media:void 0})}),x,"data-v-4807283e",false,undefined,!1,M,void 0,void 0),k=function(){var e=D;return e.install=function(t){t.component("usecsv-button",e)},e}(),O=Object.freeze({__proto__:null,default:k});return Object.entries(O).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];"default"!==n&&(k[n]=r)})),k}(Vue);
|
|
20
|
+
***************************************************************************** */()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var i=function(){return i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},a=[],s=[];function c(e,t){if(t=t||{},void 0===e)throw new Error("insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).");var n,o=!0===t.prepend?"prepend":"append",r=void 0!==t.container?t.container:document.querySelector("head"),i=a.indexOf(r);return-1===i&&(i=a.push(r)-1,s[i]={}),void 0!==s[i]&&void 0!==s[i][o]?n=s[i][o]:(n=s[i][o]=function(){var e=document.createElement("style");return e.setAttribute("type","text/css"),e}(),"prepend"===o?r.insertBefore(n,r.childNodes[0]):r.appendChild(n)),65279===e.charCodeAt(0)&&(e=e.substr(1,e.length)),n.styleSheet?n.styleSheet.cssText+=e:n.textContent+=e,n}var d,l,u,p,m,f=c;c.insertCss=f,function(e){e.Call="call",e.Reply="reply",e.Syn="syn",e.SynAck="synAck",e.Ack="ack"}(d||(d={})),function(e){e.Fulfilled="fulfilled",e.Rejected="rejected"}(l||(l={})),function(e){e.ConnectionDestroyed="ConnectionDestroyed",e.ConnectionTimeout="ConnectionTimeout",e.NoIframeSrc="NoIframeSrc"}(u||(u={})),function(e){e.DataCloneError="DataCloneError"}(p||(p={})),function(e){e.Message="message"}(m||(m={}));const h={"http:":"80","https:":"443"},v=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,g=["file:","data:"];const y=({name:e,message:t,stack:n})=>({name:e,message:t,stack:n});let b=0;var C=()=>++b,S=(e,t,n,o,r)=>{const{localName:i,local:a,remote:s,originForSending:c,originForReceiving:p}=t;let f=!1;r(`${i}: Connecting call sender`);const h=e=>(...t)=>{let n;r(`${i}: Sending ${e}() call`);try{s.closed&&(n=!0)}catch(e){n=!0}if(n&&o(),f){const t=new Error(`Unable to send ${e}() call due to destroyed connection`);throw t.code=u.ConnectionDestroyed,t}return new Promise(((n,o)=>{const u=C(),f=t=>{if(t.source!==s||t.data.penpal!==d.Reply||t.data.id!==u)return;if(t.origin!==p)return void r(`${i} received message from origin ${t.origin} which did not match expected origin ${p}`);const c=t.data;r(`${i}: Received ${e}() reply`),a.removeEventListener(m.Message,f);let h=c.returnValue;c.returnValueIsError&&(h=(e=>{const t=new Error;return Object.keys(e).forEach((n=>t[n]=e[n])),t})(h)),(c.resolution===l.Fulfilled?n:o)(h)};a.addEventListener(m.Message,f);const h={penpal:d.Call,id:u,methodName:e,args:t};s.postMessage(h,c)}))};return n.reduce(((e,t)=>(e[t]=h(t),e)),e),()=>{f=!0}},w=(e,t,n,o,r)=>{const{destroy:i,onDestroy:a}=o;let s,c;const u={};return o=>{if(o.origin!==t)return void r(`Parent: Handshake - Received ACK message from origin ${o.origin} which did not match expected origin ${t}`);r("Parent: Handshake - Received ACK");const f={localName:"Parent",local:window,remote:o.source,originForSending:n,originForReceiving:t};s&&s(),s=((e,t,n)=>{const{localName:o,local:r,remote:i,originForSending:a,originForReceiving:s}=e;let c=!1;const u=e=>{if(e.source!==i||e.data.penpal!==d.Call)return;if(e.origin!==s)return void n(`${o} received message from origin ${e.origin} which did not match expected origin ${s}`);const r=e.data,{methodName:u,args:m,id:f}=r;n(`${o}: Received ${u}() call`);const h=e=>t=>{if(n(`${o}: Sending ${u}() reply`),c)return void n(`${o}: Unable to send ${u}() reply due to destroyed connection`);const r={penpal:d.Reply,id:f,resolution:e,returnValue:t};e===l.Rejected&&t instanceof Error&&(r.returnValue=y(t),r.returnValueIsError=!0);try{i.postMessage(r,a)}catch(e){if(e.name===p.DataCloneError){const t={penpal:d.Reply,id:f,resolution:l.Rejected,returnValue:y(e),returnValueIsError:!0};i.postMessage(t,a)}throw e}};new Promise((e=>e(t[u].apply(t,m)))).then(h(l.Fulfilled),h(l.Rejected))};return r.addEventListener(m.Message,u),()=>{c=!0,r.removeEventListener(m.Message,u)}})(f,e,r),a(s),c&&c.forEach((e=>{delete u[e]})),c=o.data.methodNames;const h=S(u,f,c,i,r);return a(h),u}};var E=e=>{let{iframe:t,methods:n={},childOrigin:o,timeout:r,debug:i=!1}=e;const a=(e=>(...t)=>{e&&console.log("[Penpal]",...t)})(i),s=((e,t)=>{const n=[];let o=!1;return{destroy(r){o||(o=!0,t(`${e}: Destroying connection`),n.forEach((e=>{e(r)})))},onDestroy(e){o?e():n.push(e)}}})("Parent",a),{onDestroy:c,destroy:l}=s;o||((e=>{if(!e.src&&!e.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=u.NoIframeSrc,e}})(t),o=(e=>{if(e&&g.find((t=>e.startsWith(t))))return"null";const t=document.location,n=v.exec(e);let o,r,i;return n?(o=n[1]?n[1]:t.protocol,r=n[2],i=n[4]):(o=t.protocol,r=t.hostname,i=t.port),`${o}//${r}${i&&i!==h[o]?`:${i}`:""}`})(t.src));const p="null"===o?"*":o,f=((e,t,n,o)=>r=>{if(r.origin!==n)return void e(`Parent: Handshake - Received SYN message from origin ${r.origin} which did not match expected origin ${n}`);e("Parent: Handshake - Received SYN, responding with SYN-ACK");const i={penpal:d.SynAck,methodNames:Object.keys(t)};r.source.postMessage(i,o)})(a,n,o,p),y=w(n,o,p,s,a),b=new Promise(((e,n)=>{const o=((e,t)=>{let n;return void 0!==e&&(n=window.setTimeout((()=>{const n=new Error(`Connection timed out after ${e}ms`);n.code=u.ConnectionTimeout,t(n)}),e)),()=>{clearTimeout(n)}})(r,l),i=n=>{if(n.source===t.contentWindow&&n.data)if(n.data.penpal!==d.Syn)if(n.data.penpal!==d.Ack);else{const t=y(n);t&&(o(),e(t))}else f(n)};window.addEventListener(m.Message,i),a("Parent: Awaiting handshake"),((e,t)=>{const{destroy:n,onDestroy:o}=t,r=setInterval((()=>{e.isConnected||(clearInterval(r),n())}),6e4);o((()=>{clearInterval(r)}))})(t,s),c((e=>{window.removeEventListener(m.Message,i),e&&n(e)}))}));return{promise:b,destroy(){l()}}},$=["interactive","complete"],R=function(e,t){return new Promise((function(n){e&&"function"!=typeof e&&(t=e,e=null),t=t||window.document;var o=function(){return n(void(e&&setTimeout(e)))};-1!==$.indexOf(t.readyState)?o():t.addEventListener("DOMContentLoaded",o)}))};R.resume=function(e){return function(t){return R(e).then((function(){return t}))}};var _=function(e){var t=e.importerKey,n=e.user,o=e.metadata,r=e.onData,a=e.onRecordsInitial,s=e.onRecordEdit,c=e.importerDisplay,d=void 0===c?"modal":c,l="usecsv-".concat(Math.round(1e8*Math.random()));return R().then((function(){var e=function(e,t){var n=document.getElementById("usecsv-importer-inline-wrapper");f("\n ".concat("modal"!==t&&n?"":".usecsv_container { position: fixed; top: 0px; bottom: 0; right: 0; left: 0; z-index: 100000; }","\n .usecsv_container iframe {\n width: 100%;\n height: 100%;\n position: absolute;\n border-width: 0;\n }\n .usecsv_container {\n overflow: hidden;\n overscroll-behavior-x: none;\n }\n")),document.body.insertAdjacentHTML("beforeend","<div id=".concat(e,' class="usecsv_container loading"></div>'));var o=document.createElement("iframe");o.setAttribute("src","https://app.usecsv.com/importer");var r=document.getElementById(e);return null==r||r.appendChild(o),"inline"===t&&n&&(null==n||n.appendChild(r)),o}(l,d),c=function(){var e;null===(e=document.getElementById(l))||void 0===e||e.remove()},u=E({iframe:e,methods:i(i(i({closeIframe:c},r?{onData:function(e){return r(e,c)}}:{}),a?{onRecordsInitial:a}:{}),s?{onRecordEdit:s}:{})});return u.promise.then((function(e){var r;null===(r=document.getElementById(l))||void 0===r||r.classList.remove("loading"),e.setParams&&e.setParams({importerKey:t,user:n,metadata:o})})),u}))},x=n.default.extend({name:"usecsv-button",props:{importerKey:{},user:{},metadata:{},onData:{},importerDisplay:{},onRecordsInitial:{},onRecordEdit:{}},data:function(){return{hasSlot:!!this.$slots.default}},methods:{openModal:function(){_({importerKey:this.importerKey,user:this.user,metadata:this.metadata,onData:this.onData,importerDisplay:this.importerDisplay,onRecordsInitial:this.onRecordsInitial,onRecordEdit:this.onRecordEdit})},hasScopedSlot:function(){return"normalized"===(this.$scopedSlots.default&&this.$scopedSlots.default.name)}}});function I(e,t,n,o,r,i,a,s,c,d){"boolean"!=typeof a&&(c=s,s=a,a=!1);const l="function"==typeof n?n.options:n;let u;if(e&&e.render&&(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,r&&(l.functional=!0)),o&&(l._scopeId=o),i?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,c(e)),e&&e._registeredComponents&&e._registeredComponents.add(i)},l._ssrRegister=u):t&&(u=a?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,s(e))}),u)if(l.functional){const e=l.render;l.render=function(t,n){return u.call(n),e(t,n)}}else{const e=l.beforeCreate;l.beforeCreate=e?[].concat(e,u):[u]}return n}const A="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function D(e){return(e,t)=>function(e,t){const n=A?t.media||"default":e,o=N[n]||(N[n]={ids:new Set,styles:[]});if(!o.ids.has(e)){o.ids.add(e);let n=t.source;if(t.map&&(n+="\n/*# sourceURL="+t.map.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),o.element||(o.element=document.createElement("style"),o.element.type="text/css",t.media&&o.element.setAttribute("media",t.media),void 0===M&&(M=document.head||document.getElementsByTagName("head")[0]),M.appendChild(o.element)),"styleSheet"in o.element)o.styles.push(n),o.element.styleSheet.cssText=o.styles.filter(Boolean).join("\n");else{const e=o.ids.size-1,t=document.createTextNode(n),r=o.element.childNodes;r[e]&&o.element.removeChild(r[e]),r.length?o.element.insertBefore(t,r[e]):o.element.appendChild(t)}}}(e,t)}let M;const N={};var j=I({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"usecsv"},[e.hasScopedSlot()?n("div",[e._t("default",null,{openModal:e.openModal})],2):n("div",[n("button",{attrs:{type:"button",id:"usecsv-button"},on:{click:e.openModal}},[e._t("default",(function(){return[e._v(" open usecsv ")]}))],2)])])},staticRenderFns:[]},(function(e){e&&e("data-v-d14d8d0c_0",{source:"#usecsv-button[data-v-d14d8d0c]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",map:void 0,media:void 0})}),x,"data-v-d14d8d0c",false,undefined,!1,D,void 0,void 0),k=function(){var e=j;return e.install=function(t){t.component("usecsv-button",e)},e}(),O=Object.freeze({__proto__:null,default:k});return Object.entries(O).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];"default"!==n&&(k[n]=r)})),k}(Vue);
|
package/dist/UseCSVButton.ssr.js
CHANGED
|
@@ -695,7 +695,10 @@ var useCsvPlugin = function (_a) {
|
|
|
695
695
|
importerKey: {},
|
|
696
696
|
user: {},
|
|
697
697
|
metadata: {},
|
|
698
|
-
onData: {}
|
|
698
|
+
onData: {},
|
|
699
|
+
importerDisplay: {},
|
|
700
|
+
onRecordsInitial: {},
|
|
701
|
+
onRecordEdit: {}
|
|
699
702
|
},
|
|
700
703
|
data: function data() {
|
|
701
704
|
return {
|
|
@@ -708,7 +711,10 @@ var useCsvPlugin = function (_a) {
|
|
|
708
711
|
importerKey: this.importerKey,
|
|
709
712
|
user: this.user,
|
|
710
713
|
metadata: this.metadata,
|
|
711
|
-
onData: this.onData
|
|
714
|
+
onData: this.onData,
|
|
715
|
+
importerDisplay: this.importerDisplay,
|
|
716
|
+
onRecordsInitial: this.onRecordsInitial,
|
|
717
|
+
onRecordEdit: this.onRecordEdit
|
|
712
718
|
});
|
|
713
719
|
},
|
|
714
720
|
hasScopedSlot: function hasScopedSlot() {
|
|
@@ -841,9 +847,9 @@ var __vue_render__ = function __vue_render__() {
|
|
|
841
847
|
|
|
842
848
|
return _c('div', {
|
|
843
849
|
staticClass: "usecsv"
|
|
844
|
-
}, [_vm.hasScopedSlot() ? _vm._ssrNode("<div data-v-
|
|
850
|
+
}, [_vm.hasScopedSlot() ? _vm._ssrNode("<div data-v-d14d8d0c>", "</div>", [_vm._t("default", null, {
|
|
845
851
|
"openModal": _vm.openModal
|
|
846
|
-
})], 2) : _vm._ssrNode("<div data-v-
|
|
852
|
+
})], 2) : _vm._ssrNode("<div data-v-d14d8d0c>", "</div>", [_vm._ssrNode("<button type=\"button\" id=\"usecsv-button\" data-v-d14d8d0c>", "</button>", [_vm._t("default", function () {
|
|
847
853
|
return [_vm._v(" open usecsv ")];
|
|
848
854
|
})], 2)])]);
|
|
849
855
|
};
|
|
@@ -853,8 +859,8 @@ var __vue_staticRenderFns__ = [];
|
|
|
853
859
|
|
|
854
860
|
var __vue_inject_styles__ = function __vue_inject_styles__(inject) {
|
|
855
861
|
if (!inject) return;
|
|
856
|
-
inject("data-v-
|
|
857
|
-
source: "#usecsv-button[data-v-
|
|
862
|
+
inject("data-v-d14d8d0c_0", {
|
|
863
|
+
source: "#usecsv-button[data-v-d14d8d0c]{background-color:#fff;color:#000;border:2px solid #000;border-radius:6px;padding:10px 15px;text-align:center;font-size:16px;cursor:pointer}",
|
|
858
864
|
map: undefined,
|
|
859
865
|
media: undefined
|
|
860
866
|
});
|
|
@@ -862,10 +868,10 @@ var __vue_inject_styles__ = function __vue_inject_styles__(inject) {
|
|
|
862
868
|
/* scoped */
|
|
863
869
|
|
|
864
870
|
|
|
865
|
-
var __vue_scope_id__ = "data-v-
|
|
871
|
+
var __vue_scope_id__ = "data-v-d14d8d0c";
|
|
866
872
|
/* module identifier */
|
|
867
873
|
|
|
868
|
-
var __vue_module_identifier__ = "data-v-
|
|
874
|
+
var __vue_module_identifier__ = "data-v-d14d8d0c";
|
|
869
875
|
/* functional template */
|
|
870
876
|
|
|
871
877
|
var __vue_is_functional_template__ = false;
|
package/package.json
CHANGED
package/src/UseCSVButton.vue
CHANGED
|
@@ -2,17 +2,23 @@
|
|
|
2
2
|
import Vue from "vue";
|
|
3
3
|
import useCsvPlugin from "@usecsv/js";
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
type IUsecsv = Parameters<typeof useCsvPlugin>[0];
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export default /*#__PURE__*/ Vue.extend<
|
|
8
|
+
{ hasSlot: boolean },
|
|
9
|
+
{ openModal: () => void; hasScopedSlot: () => boolean },
|
|
10
|
+
any,
|
|
11
|
+
IUsecsv
|
|
12
|
+
>({
|
|
10
13
|
name: "usecsv-button", // vue component name
|
|
11
|
-
props:{
|
|
12
|
-
importerKey:{},
|
|
13
|
-
user:{},
|
|
14
|
-
metadata:{},
|
|
15
|
-
onData:{}
|
|
14
|
+
props: {
|
|
15
|
+
importerKey: {},
|
|
16
|
+
user: {},
|
|
17
|
+
metadata: {},
|
|
18
|
+
onData: {},
|
|
19
|
+
importerDisplay: {},
|
|
20
|
+
onRecordsInitial: {},
|
|
21
|
+
onRecordEdit: {},
|
|
16
22
|
},
|
|
17
23
|
data() {
|
|
18
24
|
return {
|
|
@@ -26,6 +32,9 @@ export default /*#__PURE__*/ Vue.extend<{hasSlot:boolean},{openModal:()=>void,ha
|
|
|
26
32
|
user: this.user,
|
|
27
33
|
metadata: this.metadata,
|
|
28
34
|
onData: this.onData,
|
|
35
|
+
importerDisplay: this.importerDisplay,
|
|
36
|
+
onRecordsInitial: this.onRecordsInitial,
|
|
37
|
+
onRecordEdit: this.onRecordEdit,
|
|
29
38
|
});
|
|
30
39
|
},
|
|
31
40
|
hasScopedSlot(): boolean {
|
|
@@ -41,7 +50,7 @@ export default /*#__PURE__*/ Vue.extend<{hasSlot:boolean},{openModal:()=>void,ha
|
|
|
41
50
|
<template>
|
|
42
51
|
<div class="usecsv">
|
|
43
52
|
<div v-if="hasScopedSlot()">
|
|
44
|
-
<slot :openModal="openModal"/>
|
|
53
|
+
<slot :openModal="openModal" />
|
|
45
54
|
</div>
|
|
46
55
|
<div v-else>
|
|
47
56
|
<button type="button" id="usecsv-button" @click="openModal">
|