@ibiz-template/core 0.0.1-beta.1 → 0.0.1-beta.30

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.
Files changed (36) hide show
  1. package/dist/system/index.system.js +1 -1
  2. package/out/context/index.d.ts +24 -0
  3. package/out/context/index.d.ts.map +1 -1
  4. package/out/context/index.js +24 -1
  5. package/out/error/http-error/http-error.d.ts.map +1 -1
  6. package/out/error/http-error/http-error.js +0 -4
  7. package/out/interface/click-outside/click-outside.d.ts +1 -1
  8. package/out/interface/click-outside/click-outside.d.ts.map +1 -1
  9. package/out/utils/download-file/download-file.d.ts +10 -0
  10. package/out/utils/download-file/download-file.d.ts.map +1 -1
  11. package/out/utils/download-file/download-file.js +20 -0
  12. package/out/utils/index.d.ts +3 -0
  13. package/out/utils/index.d.ts.map +1 -1
  14. package/out/utils/index.js +3 -0
  15. package/out/utils/sync/count-latch.d.ts +60 -0
  16. package/out/utils/sync/count-latch.d.ts.map +1 -0
  17. package/out/utils/sync/count-latch.js +93 -0
  18. package/out/utils/sync/index.d.ts +2 -0
  19. package/out/utils/sync/index.d.ts.map +1 -0
  20. package/out/utils/sync/index.js +1 -0
  21. package/out/utils/upload/select-file.d.ts +53 -0
  22. package/out/utils/upload/select-file.d.ts.map +1 -0
  23. package/out/utils/upload/select-file.js +47 -0
  24. package/out/utils/upload/upload-file.d.ts +46 -0
  25. package/out/utils/upload/upload-file.d.ts.map +1 -0
  26. package/out/utils/upload/upload-file.js +150 -0
  27. package/package.json +3 -4
  28. package/src/context/index.ts +45 -1
  29. package/src/error/http-error/http-error.ts +0 -4
  30. package/src/utils/download-file/download-file.ts +21 -0
  31. package/src/utils/index.ts +3 -0
  32. package/src/utils/sync/count-latch.ts +99 -0
  33. package/src/utils/sync/index.ts +1 -0
  34. package/src/utils/upload/select-file.ts +86 -0
  35. package/src/utils/upload/upload-file.ts +206 -0
  36. package/LICENSE +0 -21
@@ -1 +1 @@
1
- System.register(["lodash-es","qx-util","axios","qs","pluralize"],(function(e){"use strict";var t,n,o,r,i,s,c;return{setters:[function(e){t=e.debounce,n=e.merge},function(e){o=e.getCookie,r=e.notNilEmpty},function(e){i=e.default},function(e){s=e.stringify},function(e){c=e.default}],execute:function(){function a(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}e({calcMimeByFileName:F,colorBlend:function(e,t,n,o){void 0===n&&(n=.5);void 0===o&&(o="hex");e=e.trim(),t=t.trim();var r=q(e),i=q(t),s=[B((1-n)*r[0]+n*i[0]),B((1-n)*r[1]+n*i[1]),B((1-n)*r[2]+n*i[2]),(1-n)*r[3]+n*i[3]];if("hex"===o){var c=[s[0].toString(16),s[1].toString(16),s[2].toString(16),0===s[3]?"00":B(255*s[3]).toString(16)];return"#".concat(c[0]).concat(c[1]).concat(c[2]).concat(c[3])}return"rgb(".concat(s[0]," ").concat(s[1]," ").concat(s[2]," / ").concat(s[3],")")},debounceAndAsyncMerge:function(e,n,o){var r,i=this,s=[],c=t((function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return w(i,void 0,void 0,(function(){var n,o;return b(this,(function(i){switch(i.label){case 0:r=void 0,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,e.apply(void 0,R([],m(t),!1))];case 2:return n=i.sent(),s.forEach((function(e){e.resolve(n)})),s=[],[2,n];case 3:return o=i.sent(),s.forEach((function(e){e.reject(o)})),s=[],[3,4];case 4:return[2]}}))}))}),o);return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return w(i,void 0,void 0,(function(){var t;return b(this,(function(o){return t=e,r&&(t=n(r,t)),r=t,c.apply(void 0,R([],m(t),!1)),[2,new Promise((function(e,t){s.push({resolve:e,reject:t})}))]}))}))}},debounceAndMerge:function(e,n,o){var r,i=t((function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return r=void 0,e.apply(void 0,R([],m(t),!1))}),o);return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=e;return r&&(o=n(r,o)),r=o,i.apply(void 0,R([],m(o),!1))}},downloadFileFromBlob:function(e,t){var n=F(t),o=new Blob([e],{type:n}),r=URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},eventPath:A,getToken:E,install:function(){if(window.ibiz)throw new Error("ibiz 已经存在, 无需重复安装");window.ibiz=new z,window.___fc=new D,ibiz.net.addInterceptor("CoreInterceptor",new T)},isEventInside:M,isOverlap:function(e,t){return Array.from(new Set(R(R([],m(e),!1),m(t),!1))).length!==e.length+t.length},listenJSEvent:_,onClickOutside:function(e,t,n){void 0===n&&(n={});var o=n.window,r=void 0===o?N:o,i=n.ignore,s=void 0===i?[]:i,c=n.capture,a=void 0===c||c;if(!e)throw new y("target元素不存在");if(!r)throw new y("找不到window");var u,l=!0,p=function(t){return!R([e],m(s),!1).some((function(e){return M(t,e)}))},f=!1,d=function(e){f||(r.clearTimeout(u),l&&p(e)&&t(e))},h=[_(r,"click",d,{passive:!0,capture:a}),_(r,"pointerdown",(function(e){f||(l=p(e))}),{passive:!0}),_(r,"pointerup",(function(e){if(!f&&0===e.button){var t=A(e);e.composedPath=function(){return t},u=r.setTimeout((function(){return d(e)}),50)}}),{passive:!0})].filter(Boolean);return{stop:function(){return h.forEach((function(e){return e()}))},pause:function(){f=!0},proceed:function(){f=!1}}},plural:I,pluralLower:function(e){return I(e).toLowerCase()}});var u,l,p=e("CoreConst",function(){function e(){}return e.DEFAULT_MODEL_SERVICE_TAG="default",e.TOKEN="access_token",e}()),f=e("NOOP",(function(){})),d=e("HttpStatusMessageConst",{200:"服务器成功返回请求的数据。",201:"新建或修改数据成功。",202:"一个请求已经进入后台排队(异步任务)。",204:"删除数据成功。",400:"发出的请求有错误,服务器没有进行新建或修改数据的操作。",401:"用户没有权限(令牌、用户名、密码错误)。",403:"用户得到授权,但是访问是被禁止的。",404:"发出的请求针对的是不存在的记录,服务器没有进行操作。",406:"请求的格式不可得。",410:"请求的资源被永久删除,且不会再得到的。",422:"当创建一个对象时,发生一个验证错误。",500:"服务器发生错误,请检查服务器。",502:"网关错误。",503:"服务不可用,服务器暂时过载或维护。",504:"网关超时。"});e("LoginMode",u),function(e){e.DEFAULT="DEFAULT",e.CUSTOM="CUSTOM",e.CAS="CAS"}(u||e("LoginMode",u={})),e("MenuPermissionMode",l),function(e){e.MIXIN="MIXIN",e.RESOURCE="RESOURCE",e.RT="RT"}(l||e("MenuPermissionMode",l={}));e("IBizContext",(function(e,t){if(void 0===e&&(e={}),t){var n=this;Object.defineProperty(this,"_context",{enumerable:!1,value:{}});var o={};Object.keys(t).forEach((function(e){o[e]={enumerable:!0,set:function(t){n._context[e]=null==t?null:t},get:function(){return void 0!==n._context[e]?n._context[e]:t[e]}}})),Object.defineProperties(this,o)}Object.assign(this,e)}));var h=e("Environment",{dev:!1,logLevel:"ERROR",jsCdn:"https://cdn.jsdelivr.net",baseUrl:"",pluginBaseUrl:"./plugins",remoteModelUrl:"/remotemodel",assetsUrl:"./assets",dcSystem:"",downloadFileUrl:"/ibizutil/download",uploadFileUrl:"/ibizutil/upload",casLoginUrl:"",loginMode:u.DEFAULT,menuPermissionMode:l.MIXIN,enablePermission:!0}),v=e("HttpError",(function(e){this.name="HttpError";var t=e.response;this.response=e.response,t?(t.data?this.message=t.data.message:this.message=t.statusText,this.message||(this.message=d[t.status]),this.message||(this.message="网络异常,请稍后重试!"),this.status=t.status):(this.message=e.message,this.status=500)})),y=e("RuntimeError",(function(e){this.message=e,this.name="Runtime Error"})),g=function(e,t){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},g(e,t)};function w(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function c(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((o=o.apply(e,t||[])).next())}))}function b(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}function m(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s}function R(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function E(){return o(p.TOKEN)}var k,O,C,L=e("Interceptor",function(){function e(){}return e.prototype.onBeforeRequest=function(e){return w(this,void 0,void 0,(function(){return b(this,(function(t){return[2,e]}))}))},e.prototype.onRequestError=function(e){return Promise.reject(e)},e.prototype.onResponseSuccess=function(e){return w(this,void 0,void 0,(function(){return b(this,(function(t){return[2,e]}))}))},e.prototype.onResponseError=function(e){return Promise.reject(e)},e.prototype.use=function(e){this.requestTag=e.interceptors.request.use(this.onBeforeRequest,this.onRequestError),this.responseTag=e.interceptors.response.use(this.onResponseSuccess,this.onResponseError)},e.prototype.eject=function(e){this.requestTag&&e.interceptors.request.eject(this.requestTag),this.responseTag&&e.interceptors.response.eject(this.responseTag)},e}()),T=e("CoreInterceptor",function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}g(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onBeforeRequest=function(t){return w(this,void 0,void 0,(function(){var n;return b(this,(function(o){switch(o.label){case 0:return[4,e.prototype.onBeforeRequest.call(this,t)];case 1:return o.sent(),t.headers||(t.headers={}),t.headers.Authorization="Bearer ".concat(E()),(n=ibiz.orgData)&&(n.systemid&&(t.headers.srfsystemid=n.systemid),n.orgid&&(t.headers.srforgid=n.orgid)),[2,t]}}))}))},t}(L)),x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},P={exports:{}};O=x,C=function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"];function r(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function i(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function s(o){return"debug"===o&&(o="log"),typeof console!==t&&("trace"===o&&n?i:void 0!==console[o]?r(console,o):void 0!==console.log?r(console,"log"):e)}function c(t,n){for(var r=0;r<o.length;r++){var i=o[r];this[i]=r<t?e:this.methodFactory(i,t,n)}this.log=this.debug}function a(e,n,o){return function(){typeof console!==t&&(c.call(this,n,o),this[e].apply(this,arguments))}}function u(e,t,n){return s(e)||a.apply(this,arguments)}function l(e,n,r){var i,s=this;n=null==n?"WARN":n;var a="loglevel";function l(){var e;if(typeof window!==t&&a){try{e=window.localStorage[a]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,o=n.indexOf(encodeURIComponent(a)+"=");-1!==o&&(e=/^([^;]+)/.exec(n.slice(o))[1])}catch(e){}return void 0===s.levels[e]&&(e=void 0),e}}"string"==typeof e?a+=":"+e:"symbol"==typeof e&&(a=void 0),s.name=e,s.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},s.methodFactory=r||u,s.getLevel=function(){return i},s.setLevel=function(n,r){if("string"==typeof n&&void 0!==s.levels[n.toUpperCase()]&&(n=s.levels[n.toUpperCase()]),!("number"==typeof n&&n>=0&&n<=s.levels.SILENT))throw"log.setLevel() called with invalid level: "+n;if(i=n,!1!==r&&function(e){var n=(o[e]||"silent").toUpperCase();if(typeof window!==t&&a){try{return void(window.localStorage[a]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(a)+"="+n+";"}catch(e){}}}(n),c.call(s,n,e),typeof console===t&&n<s.levels.SILENT)return"No console available for logging"},s.setDefaultLevel=function(e){n=e,l()||s.setLevel(e,!1)},s.resetLevel=function(){s.setLevel(n,!1),function(){if(typeof window!==t&&a){try{return void window.localStorage.removeItem(a)}catch(e){}try{window.document.cookie=encodeURIComponent(a)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}()},s.enableAll=function(e){s.setLevel(s.levels.TRACE,e)},s.disableAll=function(e){s.setLevel(s.levels.SILENT,e)};var p=l();null==p&&(p=n),s.setLevel(p,!1)}var p=new l,f={};p.getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=f[e];return t||(t=f[e]=new l(e,p.getLevel(),p.methodFactory)),t};var d=typeof window!==t?window.log:void 0;return p.noConflict=function(){return typeof window!==t&&window.log===p&&(window.log=d),p},p.getLoggers=function(){return f},p.default=p,p},(k=P).exports?k.exports=C():O.log=C();var U=a({__proto__:null,default:P.exports},[P.exports]);e("Logger",U);function j(e,t,n,o,r){var i="".concat(e,"-").concat(t);return n&&(i+="-".concat(n)),o&&(i+="__".concat(o)),r&&(i+="--".concat(r)),i}e("Namespace",function(){function e(e,t){this.block=e,this.namespace=t||"ibiz"}return e.prototype.b=function(e){return void 0===e&&(e=""),j(this.namespace,this.block,e,"","")},e.prototype.e=function(e){return e?j(this.namespace,this.block,"",e,""):""},e.prototype.m=function(e){return e?j(this.namespace,this.block,"","",e):""},e.prototype.be=function(e,t){return e&&t?j(this.namespace,this.block,e,t,""):""},e.prototype.em=function(e,t){return e&&t?j(this.namespace,this.block,"",e,t):""},e.prototype.bm=function(e,t){return e&&t?j(this.namespace,this.block,e,"",t):""},e.prototype.bem=function(e,t,n){return e&&t&&n?j(this.namespace,this.block,e,t,n):""},e.prototype.is=function(e,t){return e&&t?"".concat("is-").concat(e):""},e.prototype.cssVar=function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarName(n)]=e[n]);return t},e.prototype.cssVarBlock=function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarBlockName(n)]=e[n]);return t},e.prototype.cssVarName=function(e){return"--".concat(this.namespace,"-").concat(e)},e.prototype.cssVarBlockName=function(e){return"--".concat(this.namespace,"-").concat(this.block,"-").concat(e)},e}()),e("HttpResponse",(function(e,t,n){this.local=!0,this.ok=!1,this.headers={},this.config={},this.data=e,this.status=t||200,this.statusText=n||"",this.status>=200&&this.status<300&&(this.ok=!0)}));var S=e("Net",function(){function e(e){this.interceptors=new Map,this.instance=i.create(e)}return e.prototype.addInterceptor=function(e,t){t.use(this.instance),this.interceptors.set(e,t)},e.prototype.removeInterceptor=function(e){var t=this.interceptors.get(e);t&&(t.eject(this.instance),this.interceptors.delete(e))},Object.defineProperty(e.prototype,"presetConfig",{get:function(){return{baseURL:this.instance.defaults.baseURL||ibiz.env.baseUrl,headers:{"Content-Type":"application/json;charset=UTF-8",Accept:"application/json"}}},enumerable:!1,configurable:!0}),e.prototype.mergeConfig=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this.presetConfig:n.apply(void 0,R([this.presetConfig],m(e),!1))},e.prototype.post=function(e,t,n,o){return void 0===n&&(n={}),void 0===o&&(o={}),w(this,void 0,void 0,(function(){var r,i;return b(this,(function(s){switch(s.label){case 0:e=this.handleAppPresetParam(e,n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.request(e,{method:"post",data:t,headers:o})];case 2:return r=s.sent(),[2,this.doResponseResult(r)];case 3:throw i=s.sent(),new v(i);case 4:return[2]}}))}))},e.prototype.get=function(e,t,o,r){return void 0===t&&(t={}),void 0===o&&(o={}),void 0===r&&(r={}),w(this,void 0,void 0,(function(){var i,s;return b(this,(function(c){switch(c.label){case 0:e=this.attachUrlParam(e,t),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.request(e,n({method:"get",headers:o},r))];case 2:return i=c.sent(),[2,this.doResponseResult(i)];case 3:throw s=c.sent(),new v(s);case 4:return[2]}}))}))},e.prototype.delete=function(e,t,n){return void 0===n&&(n={}),w(this,void 0,void 0,(function(){var o,r;return b(this,(function(i){switch(i.label){case 0:e=this.handleAppPresetParam(e,t),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.request(e,{method:"delete",headers:n})];case 2:return o=i.sent(),[2,this.doResponseResult(o)];case 3:throw r=i.sent(),new v(r);case 4:return[2]}}))}))},e.prototype.put=function(e,t,n,o){return void 0===n&&(n={}),void 0===o&&(o={}),w(this,void 0,void 0,(function(){var r,i;return b(this,(function(s){switch(s.label){case 0:e=this.handleAppPresetParam(e,n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.request(e,{method:"put",data:t,headers:o})];case 2:return r=s.sent(),[2,this.doResponseResult(r)];case 3:throw i=s.sent(),new v(i);case 4:return[2]}}))}))},e.prototype.getModel=function(e,t){return void 0===t&&(t={}),w(this,void 0,void 0,(function(){var n,o;return b(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.instance.get(e,{headers:t})];case 1:return n=r.sent(),[2,this.doResponseResult(n)];case 2:throw o=r.sent(),new v(o);case 3:return[2]}}))}))},e.prototype.request=function(e,t){return void 0===t&&(t={}),w(this,void 0,void 0,(function(){var n,o;return b(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.instance.request(this.mergeConfig({url:e},t))];case 1:return n=r.sent(),[2,this.doResponseResult(n)];case 2:throw o=r.sent(),new v(o);case 3:return[2]}}))}))},e.prototype.doResponseResult=function(e){var t=e;return t.status>=200&&t.status<=299&&(t.ok=!0),t},e.prototype.handleAppPresetParam=function(e,t){if(t){var n=Object.keys(t),o={};return n.forEach((function(e){e.startsWith("srf")&&r(t[e])&&(o[e]=t[e])})),this.attachUrlParam(e,t)}return e},e.prototype.attachUrlParam=function(e,t){var n=s(t);return r(n)&&(e=e.endsWith("?")||-1!==e.indexOf("?")&&e.endsWith("&")?"".concat(e).concat(n):-1===e.indexOf("?")||e.endsWith("&")?"".concat(e,"?").concat(n):"".concat(e,"&").concat(n)),e},e}());function I(e){return c(e)}e("UrlHelper",function(){function e(){}return Object.defineProperty(e,"routeBase",{get:function(){return"".concat(this.appBase,"/#")},enumerable:!1,configurable:!0}),Object.defineProperty(e,"appBase",{get:function(){var e=window.location,t=e.origin,n=e.pathname;return"".concat(t).concat(n).replace(/\/$/,"")},enumerable:!1,configurable:!0}),Object.defineProperty(e,"routePath",{get:function(){return window.location.hash.replace("#","")},enumerable:!1,configurable:!0}),Object.defineProperty(e,"fullPath",{get:function(){return window.location.href},enumerable:!1,configurable:!0}),e}());function A(e){var t=e.composedPath&&e.composedPath()||e.path;if(null!=t)return t;return[e.target].concat(function e(t,n){void 0===n&&(n=[]);var o=t.parentNode;return o?e(o,n.concat([o])):n}(e.target))}function _(e,t,n,o){void 0===o&&(o={}),e.addEventListener(t,n,o);var r=function(){e.removeEventListener(t,n,o),r=f};return function(){r()}}function M(e,t){return t&&(e.target===t||A(e).includes(t))}var N="undefined"!=typeof window?window:void 0;var B=Math.round;function q(e){var t=e.length,n=[];if("rgb"===e.slice(0,3).toLowerCase()){var o=e.match(/([\d|.%]{1,3})/g);n[0]=parseInt(o[0],10),n[1]=parseInt(o[1],10),n[2]=parseInt(o[2],10),n[3]=o[3]?-1!==o[3].indexOf("%")?parseInt(o[3],10)/100:parseFloat(o[3]):1}else{o=void 0;o=t<6?parseInt(String(e[1])+e[1]+e[2]+e[2]+e[3]+e[3]+(t>4?String(e[4])+e[4]:""),16):parseInt(e.slice(1),16),n[0]=o>>16&255,n[1]=o>>8&255,n[2]=255&o,n[3]=9===t||5===t?B((o>>24&255)/255*1e4)/1e4:1}return n}function F(e){var t="";switch(e.split(".").pop()){case".wps":t="application/kswps";break;case".doc":t="application/msword";break;case".docx":t="application/vnd.openxmlformats-officedocument.wordprocessingml.document";break;case".txt":t="text/plain";break;case".zip":t="application/zip";break;case".png":t="image/png";break;case".gif":t="image/gif";break;case".jpeg":case".jpg":t="image/jpeg";break;case".rtf":t="application/rtf";break;case".avi":t="video/x-msvideo";break;case".gz":t="application/x-gzip";break;case".tar":t="application/x-tar";break;default:t=""}return t}var z=e("IBizSys",(function(){this.env=h,this.log=U,this.net=new S})),D=e("FactoryCenter",(function(){}))}}}));
1
+ System.register(["lodash-es","qx-util","axios","qs","pluralize"],(function(e){"use strict";var t,n,o,r,i,s,c,a,u,l,p;return{setters:[function(e){t=e.debounce,n=e.merge,o=e.uniqueId,r=e.isFunction,i=e.round,s=e.cloneDeep},function(e){c=e.getCookie,a=e.notNilEmpty},function(e){u=e.default},function(e){l=e.stringify},function(e){p=e.default}],execute:function(){function f(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}e({calcMimeByFileName:V,colorBlend:function(e,t,n,o){void 0===n&&(n=.5);void 0===o&&(o="hex");e=e.trim(),t=t.trim();var r=D(e),i=D(t),s=[B((1-n)*r[0]+n*i[0]),B((1-n)*r[1]+n*i[1]),B((1-n)*r[2]+n*i[2]),(1-n)*r[3]+n*i[3]];if("hex"===o){var c=[s[0].toString(16),s[1].toString(16),s[2].toString(16),0===s[3]?"00":B(255*s[3]).toString(16)];return"#".concat(c[0]).concat(c[1]).concat(c[2]).concat(c[3])}return"rgb(".concat(s[0]," ").concat(s[1]," ").concat(s[2]," / ").concat(s[3],")")},debounceAndAsyncMerge:function(e,n,o){var r,i=this,s=[],c=t((function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return E(i,void 0,void 0,(function(){var n,o;return k(this,(function(i){switch(i.label){case 0:r=void 0,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,e.apply(void 0,P([],R(t),!1))];case 2:return n=i.sent(),s.forEach((function(e){e.resolve(n)})),s=[],[2,n];case 3:return o=i.sent(),s.forEach((function(e){e.reject(o)})),s=[],[3,4];case 4:return[2]}}))}))}),o);return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E(i,void 0,void 0,(function(){var t;return k(this,(function(o){return t=e,r&&(t=n(r,t)),r=t,c.apply(void 0,P([],R(t),!1)),[2,new Promise((function(e,t){s.push({resolve:e,reject:t})}))]}))}))}},debounceAndMerge:function(e,n,o){var r,i=t((function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return r=void 0,e.apply(void 0,P([],R(t),!1))}),o);return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=e;return r&&(o=n(r,o)),r=o,i.apply(void 0,P([],R(o),!1))}},downloadFileFromBlob:function(e,t){var n=V(t),o=new Blob([e],{type:n}),r=URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},eventPath:F,fileListToArr:W,getToken:O,install:function(){if(window.ibiz)throw new Error("ibiz 已经存在, 无需重复安装");window.ibiz=new G,window.___fc=new X,ibiz.net.addInterceptor("CoreInterceptor",new T)},isEventInside:N,isImage:function(e){var t=e.split(".").pop();if(!t)return!1;return[".jpeg","jpg","gif","png","bmp","svg"].includes(t)},isOverlap:function(e,t){return Array.from(new Set(P(P([],R(e),!1),R(t),!1))).length!==e.length+t.length},listenJSEvent:M,onClickOutside:function(e,t,n){void 0===n&&(n={});var o=n.window,r=void 0===o?z:o,i=n.ignore,s=void 0===i?[]:i,c=n.capture,a=void 0===c||c;if(!e)throw new b("target元素不存在");if(!r)throw new b("找不到window");var u,l=!0,p=function(t){return!P([e],R(s),!1).some((function(e){return N(t,e)}))},f=!1,h=function(e){f||(r.clearTimeout(u),l&&p(e)&&t(e))},d=[M(r,"click",h,{passive:!0,capture:a}),M(r,"pointerdown",(function(e){f||(l=p(e))}),{passive:!0}),M(r,"pointerup",(function(e){if(!f&&0===e.button){var t=F(e);e.composedPath=function(){return t},u=r.setTimeout((function(){return h(e)}),50)}}),{passive:!0})].filter(Boolean);return{stop:function(){return d.forEach((function(e){return e()}))},pause:function(){f=!0},proceed:function(){f=!1}}},plural:q,pluralLower:function(e){return q(e).toLowerCase()},selectFile:H,uploadFile:function(e){var t=this,c=n({multiple:!0,accept:"",separate:!0,beforeUpload:function(e,t){return!0},finish:function(e){},success:function(e,t){},error:function(e,t){},progress:function(e){}},e),a=function(e,n){return E(t,void 0,void 0,(function(){var t;return k(this,(function(o){switch(o.label){case 0:return c.request&&r(c.request)?[2,c.request(e)]:(t=new FormData,e.forEach((function(e){t.append("file",e)})),[4,ibiz.net.request(c.uploadUrl,{method:"post",baseURL:"",data:t,headers:{"Content-Type":"multipart/form-data"},onUploadProgress:n})]);case 1:return[2,o.sent()]}}))}))},u=function(e){return E(t,void 0,void 0,(function(){var t,n,r;return k(this,(function(u){switch(u.label){case 0:if(t=e.map((function(e){return{status:"uploading",name:e.name,uid:o(),percentage:0}})),!c.beforeUpload(e,t))return t.forEach((function(e){e.status="cancel"})),ibiz.log.debug("取消上传",t),[2,t];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,a(e,(function(e){!function(e,t){t.forEach((function(t){t.percentage=i(100*e.progress)})),c.progress(s(t))}(e,t)}))];case 2:return n=u.sent(),t.forEach((function(e){e.status="finished"})),c.success(t,n),t.forEach((function(e){e.response=n})),[3,4];case 3:return r=u.sent(),t.forEach((function(e){e.status="fail"})),c.error(t,r),t.forEach((function(e){e.error=r})),ibiz.log.error(r),ibiz.log.error("".concat(e.map((function(e){return e.name})).join(","),"上传失败")),[3,4];case 4:return[2,t]}}))}))};H({accept:c.accept,multiple:c.multiple,onSelected:function(e){!function(e){E(t,void 0,void 0,(function(){var t,n,o,r=this;return k(this,(function(i){switch(i.label){case 0:return t=c.separate?e.map((function(e){return[e]})):[e],[4,Promise.allSettled(t.map((function(e){return E(r,void 0,void 0,(function(){return k(this,(function(t){return[2,u(e)]}))}))})))];case 1:return n=i.sent(),o=[],n.forEach((function(e){"fulfilled"===e.status&&o.push.apply(o,P([],R(e.value),!1))})),c.finish(o),[2]}}))}))}(e)}})}});var h,d,v=e("CoreConst",function(){function e(){}return e.DEFAULT_MODEL_SERVICE_TAG="default",e.TOKEN="access_token",e}()),g=e("NOOP",(function(){}));e("HttpStatusMessageConst",{200:"服务器成功返回请求的数据。",201:"新建或修改数据成功。",202:"一个请求已经进入后台排队(异步任务)。",204:"删除数据成功。",400:"发出的请求有错误,服务器没有进行新建或修改数据的操作。",401:"用户没有权限(令牌、用户名、密码错误)。",403:"用户得到授权,但是访问是被禁止的。",404:"发出的请求针对的是不存在的记录,服务器没有进行操作。",406:"请求的格式不可得。",410:"请求的资源被永久删除,且不会再得到的。",422:"当创建一个对象时,发生一个验证错误。",500:"服务器发生错误,请检查服务器。",502:"网关错误。",503:"服务不可用,服务器暂时过载或维护。",504:"网关超时。"});e("LoginMode",h),function(e){e.DEFAULT="DEFAULT",e.CUSTOM="CUSTOM",e.CAS="CAS"}(h||e("LoginMode",h={})),e("MenuPermissionMode",d),function(e){e.MIXIN="MIXIN",e.RESOURCE="RESOURCE",e.RT="RT"}(d||e("MenuPermissionMode",d={}));e("IBizContext",function(){function e(e,t){if(void 0===e&&(e={}),t){var n=this;Object.defineProperty(this,"_parent",{enumerable:!1,value:t}),Object.defineProperty(this,"_context",{enumerable:!1,value:{}});var o={};Object.keys(t).forEach((function(e){o[e]={enumerable:!0,set:function(t){n._context[e]=null==t?null:t},get:function(){return void 0!==n._context[e]?n._context[e]:t[e]}}})),Object.defineProperties(this,o)}Object.assign(this,e)}return e.prototype.getOwnContext=function(){var e=this,t={};return Object.keys(this).forEach((function(n){Object.prototype.hasOwnProperty.call(e._parent,n)&&!Object.prototype.hasOwnProperty.call(e._context,n)||(t[n]=e[n])})),t},e}());var y=e("Environment",{dev:!1,logLevel:"ERROR",jsCdn:"https://cdn.jsdelivr.net",baseUrl:"",pluginBaseUrl:"./plugins",remoteModelUrl:"/remotemodel",assetsUrl:"./assets",dcSystem:"",downloadFileUrl:"/ibizutil/download",uploadFileUrl:"/ibizutil/upload",casLoginUrl:"",loginMode:h.DEFAULT,menuPermissionMode:d.MIXIN,enablePermission:!0}),m=e("HttpError",(function(e){this.name="HttpError";var t=e.response;this.response=e.response,t?(t.data?this.message=t.data.message:this.message=t.statusText,this.message||(this.message="网络异常,请稍后重试!"),this.status=t.status):(this.message=e.message,this.status=500)})),b=e("RuntimeError",(function(e){this.message=e,this.name="Runtime Error"})),w=function(e,t){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},w(e,t)};function E(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function c(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((o=o.apply(e,t||[])).next())}))}function k(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(s=0)),s;)try{if(n=1,o&&(r=2&c[0]?o.return:c[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,c[1])).done)return r;switch(o=0,r&&(c=[2&c[0],r.value]),c[0]){case 0:case 1:r=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,o=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==c[0]&&2!==c[0])){s=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1]<r[3])){s.label=c[1];break}if(6===c[0]&&s.label<r[1]){s.label=r[1],r=c;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(c);break}r[2]&&s.ops.pop(),s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e],o=0}finally{n=r=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}function R(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s}function P(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function O(){return c(v.TOKEN)}var C,j,x,L=e("Interceptor",function(){function e(){}return e.prototype.onBeforeRequest=function(e){return E(this,void 0,void 0,(function(){return k(this,(function(t){return[2,e]}))}))},e.prototype.onRequestError=function(e){return Promise.reject(e)},e.prototype.onResponseSuccess=function(e){return E(this,void 0,void 0,(function(){return k(this,(function(t){return[2,e]}))}))},e.prototype.onResponseError=function(e){return Promise.reject(e)},e.prototype.use=function(e){this.requestTag=e.interceptors.request.use(this.onBeforeRequest,this.onRequestError),this.responseTag=e.interceptors.response.use(this.onResponseSuccess,this.onResponseError)},e.prototype.eject=function(e){this.requestTag&&e.interceptors.request.eject(this.requestTag),this.responseTag&&e.interceptors.response.eject(this.responseTag)},e}()),T=e("CoreInterceptor",function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}w(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onBeforeRequest=function(t){return E(this,void 0,void 0,(function(){var n;return k(this,(function(o){switch(o.label){case 0:return[4,e.prototype.onBeforeRequest.call(this,t)];case 1:return o.sent(),t.headers||(t.headers={}),t.headers.Authorization="Bearer ".concat(O()),(n=ibiz.orgData)&&(n.systemid&&(t.headers.srfsystemid=n.systemid),n.orgid&&(t.headers.srforgid=n.orgid)),[2,t]}}))}))},t}(L)),U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},S={};j=U,x=function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"];function r(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function i(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function s(o){return"debug"===o&&(o="log"),typeof console!==t&&("trace"===o&&n?i:void 0!==console[o]?r(console,o):void 0!==console.log?r(console,"log"):e)}function c(t,n){for(var r=0;r<o.length;r++){var i=o[r];this[i]=r<t?e:this.methodFactory(i,t,n)}this.log=this.debug}function a(e,n,o){return function(){typeof console!==t&&(c.call(this,n,o),this[e].apply(this,arguments))}}function u(e,t,n){return s(e)||a.apply(this,arguments)}function l(e,n,r){var i,s=this;n=null==n?"WARN":n;var a="loglevel";function l(){var e;if(typeof window!==t&&a){try{e=window.localStorage[a]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,o=n.indexOf(encodeURIComponent(a)+"=");-1!==o&&(e=/^([^;]+)/.exec(n.slice(o))[1])}catch(e){}return void 0===s.levels[e]&&(e=void 0),e}}"string"==typeof e?a+=":"+e:"symbol"==typeof e&&(a=void 0),s.name=e,s.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},s.methodFactory=r||u,s.getLevel=function(){return i},s.setLevel=function(n,r){if("string"==typeof n&&void 0!==s.levels[n.toUpperCase()]&&(n=s.levels[n.toUpperCase()]),!("number"==typeof n&&n>=0&&n<=s.levels.SILENT))throw"log.setLevel() called with invalid level: "+n;if(i=n,!1!==r&&function(e){var n=(o[e]||"silent").toUpperCase();if(typeof window!==t&&a){try{return void(window.localStorage[a]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(a)+"="+n+";"}catch(e){}}}(n),c.call(s,n,e),typeof console===t&&n<s.levels.SILENT)return"No console available for logging"},s.setDefaultLevel=function(e){n=e,l()||s.setLevel(e,!1)},s.resetLevel=function(){s.setLevel(n,!1),function(){if(typeof window!==t&&a){try{return void window.localStorage.removeItem(a)}catch(e){}try{window.document.cookie=encodeURIComponent(a)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}()},s.enableAll=function(e){s.setLevel(s.levels.TRACE,e)},s.disableAll=function(e){s.setLevel(s.levels.SILENT,e)};var p=l();null==p&&(p=n),s.setLevel(p,!1)}var p=new l,f={};p.getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=f[e];return t||(t=f[e]=new l(e,p.getLevel(),p.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return p.noConflict=function(){return typeof window!==t&&window.log===p&&(window.log=h),p},p.getLoggers=function(){return f},p.default=p,p},(C={get exports(){return S},set exports(e){S=e}}).exports?C.exports=x():j.log=x();var I=f({__proto__:null,default:S},[S]);e("Logger",I);function A(e,t,n,o,r){var i="".concat(e,"-").concat(t);return n&&(i+="-".concat(n)),o&&(i+="__".concat(o)),r&&(i+="--".concat(r)),i}e("Namespace",function(){function e(e,t){this.block=e,this.namespace=t||"ibiz"}return e.prototype.b=function(e){return void 0===e&&(e=""),A(this.namespace,this.block,e,"","")},e.prototype.e=function(e){return e?A(this.namespace,this.block,"",e,""):""},e.prototype.m=function(e){return e?A(this.namespace,this.block,"","",e):""},e.prototype.be=function(e,t){return e&&t?A(this.namespace,this.block,e,t,""):""},e.prototype.em=function(e,t){return e&&t?A(this.namespace,this.block,"",e,t):""},e.prototype.bm=function(e,t){return e&&t?A(this.namespace,this.block,e,"",t):""},e.prototype.bem=function(e,t,n){return e&&t&&n?A(this.namespace,this.block,e,t,n):""},e.prototype.is=function(e,t){return e&&t?"".concat("is-").concat(e):""},e.prototype.cssVar=function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarName(n)]=e[n]);return t},e.prototype.cssVarBlock=function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarBlockName(n)]=e[n]);return t},e.prototype.cssVarName=function(e){return"--".concat(this.namespace,"-").concat(e)},e.prototype.cssVarBlockName=function(e){return"--".concat(this.namespace,"-").concat(this.block,"-").concat(e)},e}()),e("HttpResponse",(function(e,t,n){this.local=!0,this.ok=!1,this.headers={},this.config={},this.data=e,this.status=t||200,this.statusText=n||"",this.status>=200&&this.status<300&&(this.ok=!0)}));var _=e("Net",function(){function e(e){this.interceptors=new Map,this.instance=u.create(e)}return e.prototype.addInterceptor=function(e,t){t.use(this.instance),this.interceptors.set(e,t)},e.prototype.removeInterceptor=function(e){var t=this.interceptors.get(e);t&&(t.eject(this.instance),this.interceptors.delete(e))},Object.defineProperty(e.prototype,"presetConfig",{get:function(){return{baseURL:this.instance.defaults.baseURL||ibiz.env.baseUrl,headers:{"Content-Type":"application/json;charset=UTF-8",Accept:"application/json"}}},enumerable:!1,configurable:!0}),e.prototype.mergeConfig=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this.presetConfig:n.apply(void 0,P([this.presetConfig],R(e),!1))},e.prototype.post=function(e,t,n,o){return void 0===n&&(n={}),void 0===o&&(o={}),E(this,void 0,void 0,(function(){var r,i;return k(this,(function(s){switch(s.label){case 0:e=this.handleAppPresetParam(e,n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.request(e,{method:"post",data:t,headers:o})];case 2:return r=s.sent(),[2,this.doResponseResult(r)];case 3:throw i=s.sent(),new m(i);case 4:return[2]}}))}))},e.prototype.get=function(e,t,o,r){return void 0===t&&(t={}),void 0===o&&(o={}),void 0===r&&(r={}),E(this,void 0,void 0,(function(){var i,s;return k(this,(function(c){switch(c.label){case 0:e=this.attachUrlParam(e,t),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.request(e,n({method:"get",headers:o},r))];case 2:return i=c.sent(),[2,this.doResponseResult(i)];case 3:throw s=c.sent(),new m(s);case 4:return[2]}}))}))},e.prototype.delete=function(e,t,n){return void 0===n&&(n={}),E(this,void 0,void 0,(function(){var o,r;return k(this,(function(i){switch(i.label){case 0:e=this.handleAppPresetParam(e,t),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.request(e,{method:"delete",headers:n})];case 2:return o=i.sent(),[2,this.doResponseResult(o)];case 3:throw r=i.sent(),new m(r);case 4:return[2]}}))}))},e.prototype.put=function(e,t,n,o){return void 0===n&&(n={}),void 0===o&&(o={}),E(this,void 0,void 0,(function(){var r,i;return k(this,(function(s){switch(s.label){case 0:e=this.handleAppPresetParam(e,n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.request(e,{method:"put",data:t,headers:o})];case 2:return r=s.sent(),[2,this.doResponseResult(r)];case 3:throw i=s.sent(),new m(i);case 4:return[2]}}))}))},e.prototype.getModel=function(e,t){return void 0===t&&(t={}),E(this,void 0,void 0,(function(){var n,o;return k(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.instance.get(e,{headers:t})];case 1:return n=r.sent(),[2,this.doResponseResult(n)];case 2:throw o=r.sent(),new m(o);case 3:return[2]}}))}))},e.prototype.request=function(e,t){return void 0===t&&(t={}),E(this,void 0,void 0,(function(){var n,o;return k(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.instance.request(this.mergeConfig({url:e},t))];case 1:return n=r.sent(),[2,this.doResponseResult(n)];case 2:throw o=r.sent(),new m(o);case 3:return[2]}}))}))},e.prototype.doResponseResult=function(e){var t=e;return t.status>=200&&t.status<=299&&(t.ok=!0),t},e.prototype.handleAppPresetParam=function(e,t){if(t){var n=Object.keys(t),o={};return n.forEach((function(e){e.startsWith("srf")&&a(t[e])&&(o[e]=t[e])})),this.attachUrlParam(e,t)}return e},e.prototype.attachUrlParam=function(e,t){var n=l(t);return a(n)&&(e=e.endsWith("?")||-1!==e.indexOf("?")&&e.endsWith("&")?"".concat(e).concat(n):-1===e.indexOf("?")||e.endsWith("&")?"".concat(e,"?").concat(n):"".concat(e,"&").concat(n)),e},e}());function q(e){return p(e)}e("UrlHelper",function(){function e(){}return Object.defineProperty(e,"routeBase",{get:function(){return"".concat(this.appBase,"/#")},enumerable:!1,configurable:!0}),Object.defineProperty(e,"appBase",{get:function(){var e=window.location,t=e.origin,n=e.pathname;return"".concat(t).concat(n).replace(/\/$/,"")},enumerable:!1,configurable:!0}),Object.defineProperty(e,"routePath",{get:function(){return window.location.hash.replace("#","")},enumerable:!1,configurable:!0}),Object.defineProperty(e,"fullPath",{get:function(){return window.location.href},enumerable:!1,configurable:!0}),e}());function F(e){var t=e.composedPath&&e.composedPath()||e.path;if(null!=t)return t;return[e.target].concat(function e(t,n){void 0===n&&(n=[]);var o=t.parentNode;return o?e(o,n.concat([o])):n}(e.target))}function M(e,t,n,o){void 0===o&&(o={}),e.addEventListener(t,n,o);var r=function(){e.removeEventListener(t,n,o),r=g};return function(){r()}}function N(e,t){return t&&(e.target===t||F(e).includes(t))}var z="undefined"!=typeof window?window:void 0;var B=Math.round;function D(e){var t=e.length,n=[];if("rgb"===e.slice(0,3).toLowerCase()){var o=e.match(/([\d|.%]{1,3})/g);n[0]=parseInt(o[0],10),n[1]=parseInt(o[1],10),n[2]=parseInt(o[2],10),n[3]=o[3]?-1!==o[3].indexOf("%")?parseInt(o[3],10)/100:parseFloat(o[3]):1}else{o=void 0;o=t<6?parseInt(String(e[1])+e[1]+e[2]+e[2]+e[3]+e[3]+(t>4?String(e[4])+e[4]:""),16):parseInt(e.slice(1),16),n[0]=o>>16&255,n[1]=o>>8&255,n[2]=255&o,n[3]=9===t||5===t?B((o>>24&255)/255*1e4)/1e4:1}return n}function V(e){var t="";switch(e.split(".").pop()){case".wps":t="application/kswps";break;case".doc":t="application/msword";break;case".docx":t="application/vnd.openxmlformats-officedocument.wordprocessingml.document";break;case".txt":t="text/plain";break;case".zip":t="application/zip";break;case".png":t="image/png";break;case".gif":t="image/gif";break;case".jpeg":case".jpg":t="image/jpeg";break;case".rtf":t="application/rtf";break;case".avi":t="video/x-msvideo";break;case".gz":t="application/x-gzip";break;case".tar":t="application/x-tar";break;case".xlsx":t="application/vnd.ms-excel";break;default:t=""}return t}function W(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t}function H(e){var t=n({multiple:!0,accept:""},e),o=document.createElement("input");o.setAttribute("type","file"),o.setAttribute("multiple","".concat(t.multiple)),o.setAttribute("accept",t.accept),o.onchange=function(e){var n=e.target,o=n.files?W(n.files):[];0!==o.length&&(t.onSelected(o),n.value="")},document.body.appendChild(o),o.click(),document.body.removeChild(o)}e("CountLatch",function(){function e(){this.promise=null,this.resolve=null,this.count=0}return e.prototype.startPromise=function(){var e=this;this.promise=new Promise((function(t){e.resolve=t}))},e.prototype.endPromise=function(){this.resolve&&(this.resolve(),this.resolve=null,this.promise=null)},e.prototype.lock=function(){console.log("lock"),this.count+=1,this.promise||(console.log("startPromise"),this.startPromise())},e.prototype.unlock=function(){if(this.count<1)throw new b("lock和unlock次数不匹配!");console.log("unlock"),this.count-=1,0===this.count&&this.endPromise()},e.prototype.await=function(){return E(this,void 0,void 0,(function(){return k(this,(function(e){switch(e.label){case 0:return this.promise?[4,this.promise]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},e}());var G=e("IBizSys",(function(){this.env=y,this.log=I,this.net=new _})),X=e("FactoryCenter",(function(){}))}}}));
@@ -8,7 +8,23 @@
8
8
  */
9
9
  export declare class IBizContext implements IContext {
10
10
  [key: string | symbol]: any;
11
+ /**
12
+ * 修改的父上下文
13
+ *
14
+ * @author lxm
15
+ * @date 2022-12-08 18:12:16
16
+ * @protected
17
+ * @type {IContext}
18
+ */
11
19
  protected _context: IContext;
20
+ /**
21
+ * 父的上下文源对象
22
+ *
23
+ * @author lxm
24
+ * @date 2022-12-08 18:12:31
25
+ * @type {IBizContext}
26
+ */
27
+ _parent?: IBizContext;
12
28
  /**
13
29
  * Creates an instance of IBizContext.
14
30
  *
@@ -18,5 +34,13 @@ export declare class IBizContext implements IContext {
18
34
  * @param {IBizContext} [parent]
19
35
  */
20
36
  constructor(context?: IContext, parent?: IBizContext);
37
+ /**
38
+ * 返回自身的上下文,独有的和与父有差异的。
39
+ *
40
+ * @author lxm
41
+ * @date 2022-12-08 17:12:26
42
+ * @returns {*} {IContext}
43
+ */
44
+ getOwnContext(): IContext;
21
45
  }
22
46
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,WAAY,YAAW,QAAQ;IAE1C,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAE5B,SAAS,CAAC,QAAQ,EAAG,QAAQ,CAAC;IAE9B;;;;;;;OAOG;gBAES,OAAO,GAAE,QAAa,EAAE,MAAM,CAAC,EAAE,WAAW;CAmCzD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,WAAY,YAAW,QAAQ;IAE1C,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAE5B;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,EAAG,QAAQ,CAAC;IAE9B;;;;;;OAMG;IACK,OAAO,CAAC,EAAE,WAAW,CAAC;IAE9B;;;;;;;OAOG;gBAES,OAAO,GAAE,QAAa,EAAE,MAAM,CAAC,EAAE,WAAW;IA0CxD;;;;;;OAMG;IACH,aAAa,IAAI,QAAQ;CAa1B"}
@@ -20,7 +20,12 @@ export class IBizContext {
20
20
  if (parent) {
21
21
  // eslint-disable-next-line @typescript-eslint/no-this-alias
22
22
  const self = this;
23
- // 定义私有变量,用于存储父已有上下文,方便覆盖
23
+ // 定义私有变量,存放父上下文源对象
24
+ Object.defineProperty(this, '_parent', {
25
+ enumerable: false,
26
+ value: parent,
27
+ });
28
+ // 定义私有变量,用于存储对父已有上下文的修改。
24
29
  Object.defineProperty(this, '_context', {
25
30
  enumerable: false,
26
31
  value: {},
@@ -52,4 +57,22 @@ export class IBizContext {
52
57
  // 合并给入上下文
53
58
  Object.assign(this, context);
54
59
  }
60
+ /**
61
+ * 返回自身的上下文,独有的和与父有差异的。
62
+ *
63
+ * @author lxm
64
+ * @date 2022-12-08 17:12:26
65
+ * @returns {*} {IContext}
66
+ */
67
+ getOwnContext() {
68
+ const result = {};
69
+ Object.keys(this).forEach(key => {
70
+ // 父没有的,或者修改了父的上下文
71
+ if (!Object.prototype.hasOwnProperty.call(this._parent, key) ||
72
+ Object.prototype.hasOwnProperty.call(this._context, key)) {
73
+ result[key] = this[key];
74
+ }
75
+ });
76
+ return result;
77
+ }
55
78
  }
@@ -1 +1 @@
1
- {"version":3,"file":"http-error.d.ts","sourceRoot":"","sources":["../../../src/error/http-error/http-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGlD;;;;;;;;GAQG;AACH,qBAAa,SAAU,YAAW,KAAK;IACrC,IAAI,EAAE,MAAM,CAAe;IAE3B,OAAO,EAAE,MAAM,CAAC;IAEhB,MAAM,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,aAAa,CAAC;gBAEb,GAAG,EAAE,UAAU;CAqB5B"}
1
+ {"version":3,"file":"http-error.d.ts","sourceRoot":"","sources":["../../../src/error/http-error/http-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAElD;;;;;;;;GAQG;AACH,qBAAa,SAAU,YAAW,KAAK;IACrC,IAAI,EAAE,MAAM,CAAe;IAE3B,OAAO,EAAE,MAAM,CAAC;IAEhB,MAAM,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,aAAa,CAAC;gBAEb,GAAG,EAAE,UAAU;CAkB5B"}
@@ -1,4 +1,3 @@
1
- import { HttpStatusMessageConst } from '../../constant';
2
1
  /**
3
2
  * 请求异常
4
3
  *
@@ -20,9 +19,6 @@ export class HttpError {
20
19
  else {
21
20
  this.message = res.statusText;
22
21
  }
23
- if (!this.message) {
24
- this.message = HttpStatusMessageConst[res.status];
25
- }
26
22
  if (!this.message) {
27
23
  this.message = '网络异常,请稍后重试!';
28
24
  }
@@ -35,7 +35,7 @@ export interface OnClickOutsideOptions {
35
35
  /**
36
36
  * 回调处理函数类型
37
37
  */
38
- export declare type OnClickOutsideHandler = (_evt: PointerEvent | MouseEvent) => void;
38
+ export type OnClickOutsideHandler = (_evt: PointerEvent | MouseEvent) => void;
39
39
  /**
40
40
  * OnClickOutside返回对象类型
41
41
  *
@@ -1 +1 @@
1
- {"version":3,"file":"click-outside.d.ts","sourceRoot":"","sources":["../../../src/interface/click-outside/click-outside.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,oBAAY,qBAAqB,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU,KAAK,IAAI,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;;;;OAKG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB"}
1
+ {"version":3,"file":"click-outside.d.ts","sourceRoot":"","sources":["../../../src/interface/click-outside/click-outside.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU,KAAK,IAAI,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;;;;OAKG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB"}
@@ -8,6 +8,16 @@
8
8
  * @returns {*}
9
9
  */
10
10
  export declare function calcMimeByFileName(fileName: string): string;
11
+ /**
12
+ * 判断是否是图片格式
13
+ *
14
+ * @author lxm
15
+ * @date 2022-11-21 13:11:23
16
+ * @export
17
+ * @param {string} fileName
18
+ * @returns {*} {boolean}
19
+ */
20
+ export declare function isImage(fileName: string): boolean;
11
21
  /**
12
22
  * 纯JS触发下载文件
13
23
  *
@@ -1 +1 @@
1
- {"version":3,"file":"download-file.d.ts","sourceRoot":"","sources":["../../../src/utils/download-file/download-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,UAgDlD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAmBhE"}
1
+ {"version":3,"file":"download-file.d.ts","sourceRoot":"","sources":["../../../src/utils/download-file/download-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,UAmDlD;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAOjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAmBhE"}
@@ -51,11 +51,31 @@ export function calcMimeByFileName(fileName) {
51
51
  case '.tar':
52
52
  mime = 'application/x-tar';
53
53
  break;
54
+ case '.xlsx':
55
+ mime = 'application/vnd.ms-excel';
56
+ break;
54
57
  default:
55
58
  mime = '';
56
59
  }
57
60
  return mime;
58
61
  }
62
+ /**
63
+ * 判断是否是图片格式
64
+ *
65
+ * @author lxm
66
+ * @date 2022-11-21 13:11:23
67
+ * @export
68
+ * @param {string} fileName
69
+ * @returns {*} {boolean}
70
+ */
71
+ export function isImage(fileName) {
72
+ const ext = fileName.split('.').pop();
73
+ if (!ext) {
74
+ return false;
75
+ }
76
+ const imageTypes = ['.jpeg', 'jpg', 'gif', 'png', 'bmp', 'svg'];
77
+ return imageTypes.includes(ext);
78
+ }
59
79
  /**
60
80
  * 纯JS触发下载文件
61
81
  *
@@ -10,4 +10,7 @@ export * from './event/event';
10
10
  export * from './click-outside/click-outside';
11
11
  export * from './color/color';
12
12
  export * from './download-file/download-file';
13
+ export * from './upload/select-file';
14
+ export * from './upload/upload-file';
15
+ export * from './sync';
13
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtD,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtD,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC"}
@@ -10,3 +10,6 @@ export * from './event/event';
10
10
  export * from './click-outside/click-outside';
11
11
  export * from './color/color';
12
12
  export * from './download-file/download-file';
13
+ export * from './upload/select-file';
14
+ export * from './upload/upload-file';
15
+ export * from './sync';
@@ -0,0 +1,60 @@
1
+ /**
2
+ * 计数插销工具类
3
+ *
4
+ * @author lxm
5
+ * @date 2022-11-24 19:11:49
6
+ * @export
7
+ * @class CountLatch
8
+ */
9
+ export declare class CountLatch {
10
+ private promise;
11
+ private resolve;
12
+ /**
13
+ * 计数,当前等待的异步逻辑个数
14
+ *
15
+ * @author lxm
16
+ * @date 2022-11-24 19:11:59
17
+ * @type {number}
18
+ */
19
+ count: number;
20
+ /**
21
+ * 开启promise
22
+ *
23
+ * @author lxm
24
+ * @date 2022-11-24 19:11:32
25
+ * @private
26
+ */
27
+ private startPromise;
28
+ /**
29
+ * 结束promise
30
+ *
31
+ * @author lxm
32
+ * @date 2022-11-24 19:11:44
33
+ * @private
34
+ */
35
+ private endPromise;
36
+ /**
37
+ * 上锁,计数加一
38
+ * 第一次计数,开启异步
39
+ *
40
+ * @author lxm
41
+ * @date 2022-11-24 19:11:27
42
+ */
43
+ lock(): void;
44
+ /**
45
+ * 解锁,计数减一
46
+ * 归零时结束异步
47
+ *
48
+ * @author lxm
49
+ * @date 2022-11-24 19:11:47
50
+ */
51
+ unlock(): void;
52
+ /**
53
+ * 等待,计数归零异步结束
54
+ *
55
+ * @author lxm
56
+ * @date 2022-11-24 19:11:20
57
+ */
58
+ await(): Promise<void>;
59
+ }
60
+ //# sourceMappingURL=count-latch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"count-latch.d.ts","sourceRoot":"","sources":["../../../src/utils/sync/count-latch.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAA8B;IAE7C,OAAO,CAAC,OAAO,CAAwC;IAEvD;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAK;IAElB;;;;;;OAMG;IACH,OAAO,CAAC,YAAY;IAMpB;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;IAQlB;;;;;;OAMG;IACH,IAAI;IASJ;;;;;;OAMG;IACH,MAAM;IAYN;;;;;OAKG;IACG,KAAK;CAKZ"}
@@ -0,0 +1,93 @@
1
+ import { RuntimeError } from '../../error';
2
+ /**
3
+ * 计数插销工具类
4
+ *
5
+ * @author lxm
6
+ * @date 2022-11-24 19:11:49
7
+ * @export
8
+ * @class CountLatch
9
+ */
10
+ export class CountLatch {
11
+ constructor() {
12
+ this.promise = null;
13
+ this.resolve = null;
14
+ /**
15
+ * 计数,当前等待的异步逻辑个数
16
+ *
17
+ * @author lxm
18
+ * @date 2022-11-24 19:11:59
19
+ * @type {number}
20
+ */
21
+ this.count = 0;
22
+ }
23
+ /**
24
+ * 开启promise
25
+ *
26
+ * @author lxm
27
+ * @date 2022-11-24 19:11:32
28
+ * @private
29
+ */
30
+ startPromise() {
31
+ this.promise = new Promise(resolve => {
32
+ this.resolve = resolve;
33
+ });
34
+ }
35
+ /**
36
+ * 结束promise
37
+ *
38
+ * @author lxm
39
+ * @date 2022-11-24 19:11:44
40
+ * @private
41
+ */
42
+ endPromise() {
43
+ if (this.resolve) {
44
+ this.resolve();
45
+ this.resolve = null;
46
+ this.promise = null;
47
+ }
48
+ }
49
+ /**
50
+ * 上锁,计数加一
51
+ * 第一次计数,开启异步
52
+ *
53
+ * @author lxm
54
+ * @date 2022-11-24 19:11:27
55
+ */
56
+ lock() {
57
+ console.log('lock');
58
+ this.count += 1;
59
+ if (!this.promise) {
60
+ console.log('startPromise');
61
+ this.startPromise();
62
+ }
63
+ }
64
+ /**
65
+ * 解锁,计数减一
66
+ * 归零时结束异步
67
+ *
68
+ * @author lxm
69
+ * @date 2022-11-24 19:11:47
70
+ */
71
+ unlock() {
72
+ if (this.count < 1) {
73
+ throw new RuntimeError('lock和unlock次数不匹配!');
74
+ }
75
+ console.log('unlock');
76
+ this.count -= 1;
77
+ if (this.count === 0) {
78
+ debugger;
79
+ this.endPromise();
80
+ }
81
+ }
82
+ /**
83
+ * 等待,计数归零异步结束
84
+ *
85
+ * @author lxm
86
+ * @date 2022-11-24 19:11:20
87
+ */
88
+ async await() {
89
+ if (this.promise) {
90
+ await this.promise;
91
+ }
92
+ }
93
+ }
@@ -0,0 +1,2 @@
1
+ export { CountLatch } from './count-latch';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/sync/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ export { CountLatch } from './count-latch';
@@ -0,0 +1,53 @@
1
+ /**
2
+ * 文件List转数组
3
+ *
4
+ * @author lxm
5
+ * @date 2022-11-18 13:11:03
6
+ * @export
7
+ * @param {FileList} fileList
8
+ * @returns {*}
9
+ */
10
+ export declare function fileListToArr(fileList: FileList): File[];
11
+ /**
12
+ * JS打开文件上传操作配置参数
13
+ *
14
+ * @author lxm
15
+ * @date 2022-11-20 21:11:47
16
+ * @export
17
+ * @interface SelectFileOpts
18
+ */
19
+ export interface SelectFileOpts {
20
+ /**
21
+ * 接受的文件类型
22
+ *
23
+ * @author lxm
24
+ * @date 2022-11-20 21:11:52
25
+ * @type {string}
26
+ */
27
+ accept?: string;
28
+ /**
29
+ * 是否支持多选
30
+ *
31
+ * @author lxm
32
+ * @date 2022-11-20 21:11:52
33
+ * @type {boolean}
34
+ */
35
+ multiple?: boolean;
36
+ /**
37
+ * 选中文件后回调
38
+ *
39
+ * @author lxm
40
+ * @date 2022-11-20 21:11:50
41
+ */
42
+ onSelected: (_fileList: File[]) => void;
43
+ }
44
+ /**
45
+ * JS打开文件上传操作
46
+ *
47
+ * @author lxm
48
+ * @date 2022-11-20 21:11:31
49
+ * @export
50
+ * @param {SelectFileOpts} _opts 配置参数
51
+ */
52
+ export declare function selectFile(_opts: SelectFileOpts): void;
53
+ //# sourceMappingURL=select-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-file.d.ts","sourceRoot":"","sources":["../../../src/utils/upload/select-file.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,EAAE,CAMxD;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,UAAU,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,QAwB/C"}
@@ -0,0 +1,47 @@
1
+ import { merge } from 'lodash-es';
2
+ /**
3
+ * 文件List转数组
4
+ *
5
+ * @author lxm
6
+ * @date 2022-11-18 13:11:03
7
+ * @export
8
+ * @param {FileList} fileList
9
+ * @returns {*}
10
+ */
11
+ export function fileListToArr(fileList) {
12
+ const files = [];
13
+ for (let i = 0; i < fileList.length; i++) {
14
+ files.push(fileList[i]);
15
+ }
16
+ return files;
17
+ }
18
+ /**
19
+ * JS打开文件上传操作
20
+ *
21
+ * @author lxm
22
+ * @date 2022-11-20 21:11:31
23
+ * @export
24
+ * @param {SelectFileOpts} _opts 配置参数
25
+ */
26
+ export function selectFile(_opts) {
27
+ const opts = merge({
28
+ multiple: true,
29
+ accept: '',
30
+ }, _opts);
31
+ const input = document.createElement('input');
32
+ input.setAttribute('type', 'file');
33
+ input.setAttribute('multiple', `${opts.multiple}`);
34
+ input.setAttribute('accept', opts.accept);
35
+ input.onchange = e => {
36
+ const inputEl = e.target;
37
+ const files = inputEl.files ? fileListToArr(inputEl.files) : [];
38
+ if (files.length === 0) {
39
+ return;
40
+ }
41
+ opts.onSelected(files);
42
+ inputEl.value = ''; // 如果不置空,相同的文件不会触发change事件
43
+ };
44
+ document.body.appendChild(input);
45
+ input.click();
46
+ document.body.removeChild(input);
47
+ }
@@ -0,0 +1,46 @@
1
+ import { HttpResponse } from '../net/http-response';
2
+ export interface IUploadFile {
3
+ name: string;
4
+ uid: string;
5
+ status: 'uploading' | 'finished' | 'fail' | 'cancel';
6
+ percentage: number;
7
+ response?: HttpResponse;
8
+ error?: unknown;
9
+ }
10
+ export interface IUploadFileOpts {
11
+ uploadUrl: string;
12
+ /**
13
+ * 接受的文件类型
14
+ *
15
+ * @author lxm
16
+ * @date 2022-11-20 21:11:52
17
+ * @type {string}
18
+ */
19
+ accept?: string;
20
+ /**
21
+ * 是否支持多选
22
+ *
23
+ * @author lxm
24
+ * @date 2022-11-20 21:11:52
25
+ * @type {Boolean}
26
+ */
27
+ multiple?: boolean;
28
+ separate?: string;
29
+ request?: (_files: File[]) => Promise<HttpResponse>;
30
+ beforeUpload?: (_fileData: File[], _files: IUploadFile[]) => boolean;
31
+ finish?: (_resultFiles: IUploadFile[]) => void;
32
+ success?: (_resultFiles: IUploadFile[], _res: HttpResponse) => void;
33
+ error?: (_resultFiles: IUploadFile[], _error: unknown) => void;
34
+ progress?: (_files: IUploadFile[]) => void;
35
+ }
36
+ /**
37
+ * 使用上传文件逻辑
38
+ *
39
+ * @author lxm
40
+ * @date 2022-11-20 21:11:52
41
+ * @export
42
+ * @param {IUploadFileOpts} _opts
43
+ * @returns {*}
44
+ */
45
+ export declare function uploadFile(_opts: IUploadFileOpts): void;
46
+ //# sourceMappingURL=upload-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-file.d.ts","sourceRoot":"","sources":["../../../src/utils/upload/upload-file.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IACpD,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,OAAO,CAAC;IACrE,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IAC/C,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IACpE,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/D,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;CAC5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,QA0JhD"}