amis-rpc-design/dist/1233.d864fe1e.bundle.js

2 lines
1.1 MiB
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
/*! For license information please see 1233.d864fe1e.bundle.js.LICENSE.txt */
(self.webpackChunkamis_rpc_design=self.webpackChunkamis_rpc_design||[]).push([[1233],{31233:(t,e,r)=>{t.exports=function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[a]={exports:{}};e[a][0].call(c.exports,(function(t){return i(e[a][1][t]||t)}),c,c.exports,t,e,r,n)}return r[a].exports}for(var o=void 0,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function s(t){i(a,n,o,s,u,"next",t)}function u(t){i(a,n,o,s,u,"throw",t)}s(void 0)}))}}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var s=t("fs"),u=t("fast-csv"),c=t("dayjs/plugin/customParseFormat"),f=t("dayjs/plugin/utc"),l=t("dayjs").extend(c).extend(f),h=t("../utils/stream-buf"),d=t("../utils/utils").fs.exists,p={true:!0,false:!1,"#N/A":{error:"#N/A"},"#REF!":{error:"#REF!"},"#NAME?":{error:"#NAME?"},"#DIV/0!":{error:"#DIV/0!"},"#NULL!":{error:"#NULL!"},"#VALUE!":{error:"#VALUE!"},"#NUM!":{error:"#NUM!"}},m=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.workbook=e,this.worksheet=null}var e,r,i,c;return e=t,(r=[{key:"readFile",value:(c=o(regeneratorRuntime.mark((function t(e,r){var n,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=r||{},t.next=3,d(e);case 3:if(t.sent){t.next=5;break}throw new Error("File not found: ".concat(e));case 5:return n=s.createReadStream(e),t.next=8,this.read(n,r);case 8:return i=t.sent,n.close(),t.abrupt("return",i);case 11:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"read",value:function(t,e){var r=this;return e=e||{},new Promise((function(n,i){var o=r.workbook.addWorksheet(e.sheetName),a=e.dateFormats||["YYYY-MM-DD[T]HH:mm:ssZ","YYYY-MM-DD[T]HH:mm:ss","MM-DD-YYYY","YYYY-MM-DD"],s=e.map||function(t){if(""===t)return null;var e=Number(t);if(!Number.isNaN(e)&&e!==1/0)return e;var r=a.reduce((function(e,r){if(e)return e;var n=l(t,r,!0);return n.isValid()?n:null}),null);if(r)return new Date(r.valueOf());var n=p[t];return void 0!==n?n:t},c=u.parse(e.parserOptions).on("data",(function(t){o.addRow(t.map(s))})).on("end",(function(){c.emit("worksheet",o)}));c.on("worksheet",n).on("error",i),t.pipe(c)}))}},{key:"createInputStream",value:function(){throw new Error("`CSV#createInputStream` is deprecated. You should use `CSV#read` instead. This method will be removed in version 5.0. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md")}},{key:"write",value:function(t,e){var r=this;return new Promise((function(i,o){e=e||{};var a=r.workbook.getWorksheet(e.sheetName||e.sheetId),s=u.format(e.formatterOptions);t.on("finish",(function(){i()})),s.on("error",o),s.pipe(t);var c=e,f=c.dateFormat,h=c.dateUTC,d=e.map||function(t){if(t){if(t.text||t.hyperlink)return t.hyperlink||t.text||"";if(t.formula||t.result)return t.result||"";if(t instanceof Date)return f?h?l.utc(t).format(f):l(t).format(f):h?l.utc(t).format():l(t).format();if(t.error)return t.error;if("object"===n(t))return JSON.stringify(t)}return t},p=void 0===e.includeEmptyRows||e.includeEmptyRows,m=1;a&&a.eachRow((function(t,e){if(p)for(;m++<e-1;)s.write([]);var r=t.values;r.shift(),s.write(r.map(d)),m=e})),s.end()}))}},{key:"writeFile",value:function(t,e){var r={encoding:(e=e||{}).encoding||"utf8"},n=s.createWriteStream(t,r);return this.write(n,e)}},{key:"writeBuffer",value:(i=o(regeneratorRuntime