@ibiz-template/core 0.0.1-beta.17 → 0.0.3-beta.0
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/dist/system/index.system.js +1 -1
- package/out/context/index.d.ts.map +1 -1
- package/out/context/index.js +3 -1
- package/out/environment/environment.d.ts.map +1 -1
- package/out/environment/environment.js +3 -2
- package/out/ibizsys.d.ts +1 -1
- package/out/ibizsys.js +1 -1
- package/out/install.d.ts.map +1 -1
- package/out/install.js +0 -2
- package/out/interface/i-environment/i-environment.d.ts +15 -8
- package/out/interface/i-environment/i-environment.d.ts.map +1 -1
- package/out/utils/net/net.d.ts.map +1 -1
- package/out/utils/net/net.js +4 -1
- package/out/utils/sync/count-latch.d.ts.map +1 -1
- package/out/utils/sync/count-latch.js +0 -3
- package/out/utils/upload/upload-file.d.ts.map +1 -1
- package/out/utils/upload/upload-file.js +10 -9
- package/package.json +2 -2
- package/src/context/index.ts +2 -0
- package/src/environment/environment.ts +3 -2
- package/src/ibizsys.ts +1 -1
- package/src/install.ts +0 -2
- package/src/interface/i-environment/i-environment.ts +16 -8
- package/src/utils/net/net.ts +5 -1
- package/src/utils/sync/count-latch.ts +0 -3
- package/src/utils/upload/upload-file.ts +10 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["lodash-es","qx-util","axios","qs","pluralize"],(function(t){"use strict";var e,n,r,o,i,s,a,c,u,l,f;return{setters:[function(t){e=t.debounce,n=t.merge,r=t.uniqueId,o=t.isFunction,i=t.round,s=t.cloneDeep},function(t){a=t.getCookie,c=t.notNilEmpty},function(t){u=t.default},function(t){l=t.stringify},function(t){f=t.default}],execute:function(){function p(t,e){return e.forEach((function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach((function(n){if("default"!==n&&!(n in t)){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}))})),Object.freeze(t)}t({calcMimeByFileName:K,colorBlend:function(t,e,n,r){void 0===n&&(n=.5);void 0===r&&(r="hex");t=t.trim(),e=e.trim();var o=J(t),i=J(e),s=[X((1-n)*o[0]+n*i[0]),X((1-n)*o[1]+n*i[1]),X((1-n)*o[2]+n*i[2]),(1-n)*o[3]+n*i[3]];if("hex"===r){var a=[s[0].toString(16),s[1].toString(16),s[2].toString(16),0===s[3]?"00":X(255*s[3]).toString(16)];return"#".concat(a[0]).concat(a[1]).concat(a[2]).concat(a[3])}return"rgb(".concat(s[0]," ").concat(s[1]," ").concat(s[2]," / ").concat(s[3],")")},debounce:function(t,e,n){var r;return function(){for(var o=this,i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(r&&clearTimeout(r),n){var a=!r;r=setTimeout((function(){r=null}),e),a&&t.apply(this,i)}else r=setTimeout((function(){t.apply(o,i)}),e)}},debounceAndAsyncMerge:function(t,n,r){var o,i=this,s=[],a=e((function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return h(i,void 0,void 0,(function(){var n,r;return v(this,(function(i){switch(i.label){case 0:o=void 0,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,t.apply(void 0,y([],m(e),!1))];case 2:return n=i.sent(),s.forEach((function(t){t.resolve(n)})),s=[],[2,n];case 3:return r=i.sent(),s.forEach((function(t){t.reject(r)})),s=[],[3,4];case 4:return[2]}}))}))}),r);return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return h(i,void 0,void 0,(function(){var e;return v(this,(function(r){return e=t,o&&(e=n(o,e)),o=e,a.apply(void 0,y([],m(e),!1)),[2,new Promise((function(t,e){s.push({resolve:t,reject:e})}))]}))}))}},debounceAndMerge:function(t,n,r){var o,i=e((function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return o=void 0,t.apply(void 0,y([],m(e),!1))}),r);return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t;return o&&(r=n(o,r)),o=r,i.apply(void 0,y([],m(r),!1))}},downloadFileFromBlob:function(t,e){var n=K(e),r=new Blob([t],{type:n}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)},eventPath:V,fileListToArr:Y,getToken:j,install:function(){if(window.ibiz)throw new Error("ibiz 已经存在, 无需重复安装");window.ibiz=new Q,window.___fc=new Z,ibiz.net.addInterceptor("CoreInterceptor",new z)},isEventInside:H,isImage:function(t){var e=t.split(".").pop();if(!e)return!1;return[".jpeg","jpg","gif","png","bmp","svg"].includes(e)},isOverlap:function(t,e){return Array.from(new Set(y(y([],m(t),!1),m(e),!1))).length!==t.length+e.length},listenJSEvent:W,onClickOutside:function(t,e,n){void 0===n&&(n={});var r=n.window,o=void 0===r?G:r,i=n.ignore,s=void 0===i?[]:i,a=n.capture,c=void 0===a||a;if(!t)throw new T("target元素不存在");if(!o)throw new T("找不到window");var u,l=!0,f=function(e){return!y([t],m(s),!1).some((function(t){return H(e,t)}))},p=!1,d=function(t){p||(o.clearTimeout(u),l&&f(t)&&e(t))},h=[W(o,"click",d,{passive:!0,capture:c}),W(o,"pointerdown",(function(t){p||(l=f(t))}),{passive:!0}),W(o,"pointerup",(function(t){if(!p&&0===t.button){var e=V(t);t.composedPath=function(){return e},u=o.setTimeout((function(){return d(t)}),50)}}),{passive:!0})].filter(Boolean);return{stop:function(){return h.forEach((function(t){return t()}))},pause:function(){p=!0},proceed:function(){p=!1}}},plural:D,pluralLower:function(t){return D(t).toLowerCase()},selectFile:$,throttle:function(t,e){var n=null;return function(){for(var r=this,o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];n||(n=setTimeout((function(){t.apply(r,o),n=null}),e))}},toDisposable:_,uploadFile:function(t){var e=this,a=n({multiple:!0,accept:"",separate:!0,beforeUpload:function(t,e){return!0},finish:function(t){},success:function(t,e){},error:function(t,e){},progress:function(t){}},t),c=function(t,n){return h(e,void 0,void 0,(function(){var e;return v(this,(function(r){switch(r.label){case 0:return a.request&&o(a.request)?[2,a.request(t)]:(e=new FormData,t.forEach((function(t){e.append("file",t)})),[4,ibiz.net.request(a.uploadUrl,{method:"post",baseURL:"",data:e,headers:{"Content-Type":"multipart/form-data"},onUploadProgress:n})]);case 1:return[2,r.sent()]}}))}))},u=function(t){return h(e,void 0,void 0,(function(){var e,n,o;return v(this,(function(u){switch(u.label){case 0:if(e=t.map((function(t){return{status:"uploading",name:t.name,uid:r(),percentage:0}})),!a.beforeUpload(t,e))return e.forEach((function(t){t.status="cancel"})),ibiz.log.debug("取消上传",e),[2,e];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,c(t,(function(t){!function(t,e){e.forEach((function(e){e.percentage=i(100*t.progress)})),a.progress(s(e))}(t,e)}))];case 2:return n=u.sent(),e.forEach((function(t){t.status="finished"})),a.success(e,n),e.forEach((function(t){t.response=n})),[3,4];case 3:return o=u.sent(),e.forEach((function(t){t.status="fail"})),a.error(e,o),e.forEach((function(t){t.error=o})),ibiz.log.error(o),ibiz.log.error("".concat(t.map((function(t){return t.name})).join(","),"上传失败")),[3,4];case 4:return[2,e]}}))}))};$({accept:a.accept,multiple:a.multiple,onSelected:function(t){!function(t){h(e,void 0,void 0,(function(){var e,n,r,o=this;return v(this,(function(i){switch(i.label){case 0:return e=a.separate?t.map((function(t){return[t]})):[t],[4,Promise.allSettled(e.map((function(t){return h(o,void 0,void 0,(function(){return v(this,(function(e){return[2,u(t)]}))}))})))];case 1:return n=i.sent(),r=[],n.forEach((function(t){"fulfilled"===t.status&&r.push.apply(r,y([],m(t.value),!1))})),a.finish(r),[2]}}))}))}(t)}})}});var d=function(t,e){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},d(t,e)};function h(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))}function v(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function m(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function y(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}var g=function(){function t(e){this.element=e,this.next=t.Undefined,this.prev=t.Undefined}return t.Undefined=new t(void 0),t}(),b=t("LinkedList",function(){function t(){this._first=g.Undefined,this._last=g.Undefined,this._size=0}return Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return this._first===g.Undefined},t.prototype.clear=function(){for(var t=this._first;t!==g.Undefined;){var e=t.next;t.prev=g.Undefined,t.next=g.Undefined,t=e}this._first=g.Undefined,this._last=g.Undefined,this._size=0},t.prototype.unshift=function(t){return this._insert(t,!1)},t.prototype.push=function(t){return this._insert(t,!0)},t.prototype._insert=function(t,e){var n=this,r=new g(t);if(this._first===g.Undefined)this._first=r,this._last=r;else if(e){var o=this._last;this._last=r,r.prev=o,o.next=r}else{var i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;var s=!1;return function(){s||(s=!0,n._remove(r))}},t.prototype.shift=function(){if(this._first!==g.Undefined){var t=this._first.element;return this._remove(this._first),t}},t.prototype.pop=function(){if(this._last!==g.Undefined){var t=this._last.element;return this._remove(this._last),t}},t.prototype._remove=function(t){if(t.prev!==g.Undefined&&t.next!==g.Undefined){var e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===g.Undefined&&t.next===g.Undefined?(this._first=g.Undefined,this._last=g.Undefined):t.next===g.Undefined?(this._last=this._last.prev,this._last.next=g.Undefined):t.prev===g.Undefined&&(this._first=this._first.next,this._first.prev=g.Undefined);this._size-=1},t.prototype[Symbol.iterator]=function(){var t;return v(this,(function(e){switch(e.label){case 0:t=this._first,e.label=1;case 1:return t===g.Undefined?[3,3]:[4,t.element];case 2:return e.sent(),t=t.next,[3,1];case 3:return[2]}}))},t}());function w(t){var e,n=this,r=!1;return function(){return r?e:(r=!0,e=t.apply(n,arguments))}}function _(t){return{dispose:w((function(){t()}))}}var E,U,x=t("CommandsRegistry",function(){function t(){this.commands=new Map}return t.prototype.registerCommand=function(t,e,n){var r=this;if(!t)throw new Error("invalid command");if("string"==typeof t){if(!e)throw new Error("invalid command");return this.registerCommand({id:t,handler:e,opts:n})}var o=t.id,i=this.commands.get(o);i||(i=new b,this.commands.set(o,i));var s=i.unshift(t);return _((function(){s();var t=r.commands.get(o);(null==t?void 0:t.isEmpty())&&r.commands.delete(o)}))},t.prototype.hasCommand=function(t){return this.commands.has(t)},t.prototype.getCommand=function(t){var e=this.commands.get(t);if(e&&!e.isEmpty())return e[Symbol.iterator]().next().value},t.prototype.getCommands=function(){var t,e,n=new Map,r=this.commands.keys();try{for(var o=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(r),i=o.next();!i.done;i=o.next()){var s=i.value,a=this.getCommand(s);a&&n.set(s,a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return n},t.prototype.getCommandOpt=function(t){var e=this.getCommand(t);return null==e?void 0:e.opts},t}()),C=t("CommandController",function(){function t(){this.commandRegister=new x}return t.prototype.register=function(t,e,n){return this.commandRegister.registerCommand(t,e,n)},t.prototype.execute=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return h(this,void 0,void 0,(function(){var n;return v(this,(function(r){if(n=this.commandRegister.getCommand(t))return[2,n.handler.apply(n,y([],m(e),!1))];throw new Error("未注册指令: ".concat(t,",请先注册指令"))}))}))},t.prototype.hasCommand=function(t,e){var n=!!this.commandRegister.hasCommand(t);if(!0===e&&!0===n)throw new Error("未注册指令: ".concat(t,",请先注册指令"));return n},t.prototype.getCommandOpts=function(t){return this.commandRegister.getCommandOpt(t)},t}()),R=(t("commands",new C),t("CoreConst",function(){function t(){}return t.DEFAULT_MODEL_SERVICE_TAG="default",t.TOKEN="access_token",t}())),k=t("NOOP",(function(){}));t("HttpStatusMessageConst",{200:"服务器成功返回请求的数据。",201:"新建或修改数据成功。",202:"一个请求已经进入后台排队(异步任务)。",204:"删除数据成功。",400:"发出的请求有错误,服务器没有进行新建或修改数据的操作。",401:"用户没有权限(令牌、用户名、密码错误)。",403:"用户得到授权,但是访问是被禁止的。",404:"发出的请求针对的是不存在的记录,服务器没有进行操作。",406:"请求的格式不可得。",410:"请求的资源被永久删除,且不会再得到的。",422:"当创建一个对象时,发生一个验证错误。",500:"服务器发生错误,请检查服务器。",502:"网关错误。",503:"服务不可用,服务器暂时过载或维护。",504:"网关超时。"});t("LoginMode",E),function(t){t.DEFAULT="DEFAULT",t.CUSTOM="CUSTOM",t.CAS="CAS"}(E||t("LoginMode",E={})),t("MenuPermissionMode",U),function(t){t.MIXIN="MIXIN",t.RESOURCE="RESOURCE",t.RT="RT"}(U||t("MenuPermissionMode",U={}));t("IBizContext",function(){function t(t,e){if(void 0===t&&(t={}),e){var n=this;Object.defineProperty(this,"_parent",{enumerable:!1,value:e}),Object.defineProperty(this,"_context",{enumerable:!1,value:{}});var r={};Object.keys(e).forEach((function(t){r[t]={enumerable:!0,set:function(e){n._context[t]=null==e?null:e},get:function(){return void 0!==n._context[t]?n._context[t]:e[t]}}})),Object.defineProperties(this,r)}Object.assign(this,t)}return t.prototype.getOwnContext=function(){var t=this,e={};return Object.keys(this).forEach((function(n){Object.prototype.hasOwnProperty.call(t._parent,n)&&!Object.prototype.hasOwnProperty.call(t._context,n)||(e[n]=t[n])})),e},t}());var O=t("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:E.DEFAULT,menuPermissionMode:U.MIXIN,enablePermission:!0}),P=t("HttpError",(function(t){this.name="HttpError";var e=t.response;this.response=t.response,e?(e.data?this.message=e.data.message:this.message=e.statusText,this.message||(this.message="网络异常,请稍后重试!"),this.status=e.status):(this.message=t.message,this.status=500)})),T=t("RuntimeError",(function(t){this.message=t,this.name="Runtime Error"}));function j(){return a(R.TOKEN)}var L,S,I,A=t("Interceptor",function(){function t(){}return t.prototype.onBeforeRequest=function(t){return h(this,void 0,void 0,(function(){return v(this,(function(e){return[2,t]}))}))},t.prototype.onRequestError=function(t){return Promise.reject(t)},t.prototype.onResponseSuccess=function(t){return h(this,void 0,void 0,(function(){return v(this,(function(e){return[2,t]}))}))},t.prototype.onResponseError=function(t){return Promise.reject(t)},t.prototype.use=function(t){this.requestTag=t.interceptors.request.use(this.onBeforeRequest,this.onRequestError),this.responseTag=t.interceptors.response.use(this.onResponseSuccess,this.onResponseError)},t.prototype.eject=function(t){this.requestTag&&t.interceptors.request.eject(this.requestTag),this.responseTag&&t.interceptors.response.eject(this.responseTag)},t}()),z=t("CoreInterceptor",function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.onBeforeRequest=function(e){return h(this,void 0,void 0,(function(){var n;return v(this,(function(r){switch(r.label){case 0:return[4,t.prototype.onBeforeRequest.call(this,e)];case 1:return r.sent(),e.headers||(e.headers={}),e.headers.Authorization="Bearer ".concat(j()),(n=ibiz.orgData)&&(n.systemid&&(e.headers.srfsystemid=n.systemid),n.orgid&&(e.headers.srforgid=n.orgid)),[2,e]}}))}))},e}(A)),M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},q={};S=M,I=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"];function o(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,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(r){return"debug"===r&&(r="log"),typeof console!==e&&("trace"===r&&n?i:void 0!==console[r]?o(console,r):void 0!==console.log?o(console,"log"):t)}function a(e,n){for(var o=0;o<r.length;o++){var i=r[o];this[i]=o<e?t:this.methodFactory(i,e,n)}this.log=this.debug}function c(t,n,r){return function(){typeof console!==e&&(a.call(this,n,r),this[t].apply(this,arguments))}}function u(t,e,n){return s(t)||c.apply(this,arguments)}function l(t,n,o){var i,s=this;n=null==n?"WARN":n;var c="loglevel";function l(){var t;if(typeof window!==e&&c){try{t=window.localStorage[c]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,r=n.indexOf(encodeURIComponent(c)+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r))[1])}catch(t){}return void 0===s.levels[t]&&(t=void 0),t}}"string"==typeof t?c+=":"+t:"symbol"==typeof t&&(c=void 0),s.name=t,s.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},s.methodFactory=o||u,s.getLevel=function(){return i},s.setLevel=function(n,o){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!==o&&function(t){var n=(r[t]||"silent").toUpperCase();if(typeof window!==e&&c){try{return void(window.localStorage[c]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(c)+"="+n+";"}catch(t){}}}(n),a.call(s,n,t),typeof console===e&&n<s.levels.SILENT)return"No console available for logging"},s.setDefaultLevel=function(t){n=t,l()||s.setLevel(t,!1)},s.resetLevel=function(){s.setLevel(n,!1),function(){if(typeof window!==e&&c){try{return void window.localStorage.removeItem(c)}catch(t){}try{window.document.cookie=encodeURIComponent(c)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}()},s.enableAll=function(t){s.setLevel(s.levels.TRACE,t)},s.disableAll=function(t){s.setLevel(s.levels.SILENT,t)};var f=l();null==f&&(f=n),s.setLevel(f,!1)}var f=new l,p={};f.getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=p[t];return e||(e=p[t]=new l(t,f.getLevel(),f.methodFactory)),e};var d=typeof window!==e?window.log:void 0;return f.noConflict=function(){return typeof window!==e&&window.log===f&&(window.log=d),f},f.getLoggers=function(){return p},f.default=f,f},(L={get exports(){return q},set exports(t){q=t}}).exports?L.exports=I():S.log=I();var F=p({__proto__:null,default:q},[q]);t("Logger",F);function N(t,e,n,r,o){var i="".concat(t,"-").concat(e);return n&&(i+="-".concat(n)),r&&(i+="__".concat(r)),o&&(i+="--".concat(o)),i}t("Namespace",function(){function t(t,e){this.block=t,this.namespace=e||"ibiz"}return t.prototype.b=function(t){return void 0===t&&(t=""),N(this.namespace,this.block,t,"","")},t.prototype.e=function(t){return t?N(this.namespace,this.block,"",t,""):""},t.prototype.m=function(t){return t?N(this.namespace,this.block,"","",t):""},t.prototype.be=function(t,e){return t&&e?N(this.namespace,this.block,t,e,""):""},t.prototype.em=function(t,e){return t&&e?N(this.namespace,this.block,"",t,e):""},t.prototype.bm=function(t,e){return t&&e?N(this.namespace,this.block,t,"",e):""},t.prototype.bem=function(t,e,n){return t&&e&&n?N(this.namespace,this.block,t,e,n):""},t.prototype.is=function(t,e){return t&&e?"".concat("is-").concat(t):""},t.prototype.cssVar=function(t){var e={};for(var n in t)t[n]&&(e[this.cssVarName(n)]=t[n]);return e},t.prototype.cssVarBlock=function(t){var e={};for(var n in t)t[n]&&(e[this.cssVarBlockName(n)]=t[n]);return e},t.prototype.cssVarName=function(t){return"--".concat(this.namespace,"-").concat(t)},t.prototype.cssVarBlockName=function(t){return"--".concat(this.namespace,"-").concat(this.block,"-").concat(t)},t}()),t("HttpResponse",(function(t,e,n){this.local=!0,this.ok=!1,this.headers={},this.config={},this.data=t,this.status=e||200,this.statusText=n||"",this.status>=200&&this.status<300&&(this.ok=!0)}));var B=t("Net",function(){function t(t){this.interceptors=new Map,this.instance=u.create(t)}return t.prototype.addInterceptor=function(t,e){e.use(this.instance),this.interceptors.set(t,e)},t.prototype.removeInterceptor=function(t){var e=this.interceptors.get(t);e&&(e.eject(this.instance),this.interceptors.delete(t))},Object.defineProperty(t.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}),t.prototype.mergeConfig=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this.presetConfig:n.apply(void 0,y([this.presetConfig],m(t),!1))},t.prototype.post=function(t,e,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),h(this,void 0,void 0,(function(){var o,i;return v(this,(function(s){switch(s.label){case 0:t=this.handleAppPresetParam(t,n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.request(t,{method:"post",data:e,headers:r})];case 2:return o=s.sent(),[2,this.doResponseResult(o)];case 3:throw i=s.sent(),new P(i);case 4:return[2]}}))}))},t.prototype.get=function(t,e,r,o){return void 0===e&&(e={}),void 0===r&&(r={}),void 0===o&&(o={}),h(this,void 0,void 0,(function(){var i,s;return v(this,(function(a){switch(a.label){case 0:t=this.attachUrlParam(t,e),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.request(t,n({method:"get",headers:r},o))];case 2:return i=a.sent(),[2,this.doResponseResult(i)];case 3:throw s=a.sent(),new P(s);case 4:return[2]}}))}))},t.prototype.delete=function(t,e,n){return void 0===n&&(n={}),h(this,void 0,void 0,(function(){var r,o;return v(this,(function(i){switch(i.label){case 0:t=this.handleAppPresetParam(t,e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.request(t,{method:"delete",headers:n})];case 2:return r=i.sent(),[2,this.doResponseResult(r)];case 3:throw o=i.sent(),new P(o);case 4:return[2]}}))}))},t.prototype.put=function(t,e,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),h(this,void 0,void 0,(function(){var o,i;return v(this,(function(s){switch(s.label){case 0:t=this.handleAppPresetParam(t,n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.request(t,{method:"put",data:e,headers:r})];case 2:return o=s.sent(),[2,this.doResponseResult(o)];case 3:throw i=s.sent(),new P(i);case 4:return[2]}}))}))},t.prototype.getModel=function(t,e){return void 0===e&&(e={}),h(this,void 0,void 0,(function(){var n,r;return v(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.instance.get(t,{headers:e})];case 1:return n=o.sent(),[2,this.doResponseResult(n)];case 2:throw r=o.sent(),new P(r);case 3:return[2]}}))}))},t.prototype.request=function(t,e){return void 0===e&&(e={}),h(this,void 0,void 0,(function(){var n,r;return v(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.instance.request(this.mergeConfig({url:t},e))];case 1:return n=o.sent(),[2,this.doResponseResult(n)];case 2:throw r=o.sent(),new P(r);case 3:return[2]}}))}))},t.prototype.doResponseResult=function(t){var e=t;return e.status>=200&&e.status<=299&&(e.ok=!0),e},t.prototype.handleAppPresetParam=function(t,e){if(e){var n=Object.keys(e),r={};return n.forEach((function(t){t.startsWith("srf")&&c(e[t])&&(r[t]=e[t])})),this.attachUrlParam(t,e)}return t},t.prototype.attachUrlParam=function(t,e){var n=l(e);return c(n)&&(t=t.endsWith("?")||-1!==t.indexOf("?")&&t.endsWith("&")?"".concat(t).concat(n):-1===t.indexOf("?")||t.endsWith("&")?"".concat(t,"?").concat(n):"".concat(t,"&").concat(n)),t},t}());function D(t){return f(t)}t("UrlHelper",function(){function t(){}return Object.defineProperty(t,"routeBase",{get:function(){return"".concat(this.appBase,"/#")},enumerable:!1,configurable:!0}),Object.defineProperty(t,"appBase",{get:function(){var t=window.location,e=t.origin,n=t.pathname;return"".concat(e).concat(n).replace(/\/$/,"")},enumerable:!1,configurable:!0}),Object.defineProperty(t,"routePath",{get:function(){return window.location.hash.replace("#","")},enumerable:!1,configurable:!0}),Object.defineProperty(t,"fullPath",{get:function(){return window.location.href},enumerable:!1,configurable:!0}),t}());function V(t){var e=t.composedPath&&t.composedPath()||t.path;if(null!=e)return e;return[t.target].concat(function t(e,n){void 0===n&&(n=[]);var r=e.parentNode;return r?t(r,n.concat([r])):n}(t.target))}function W(t,e,n,r){void 0===r&&(r={}),t.addEventListener(e,n,r);var o=function(){t.removeEventListener(e,n,r),o=k};return function(){o()}}function H(t,e){return e&&(t.target===e||V(t).includes(e))}var G="undefined"!=typeof window?window:void 0;var X=Math.round;function J(t){var e=t.length,n=[];if("rgb"===t.slice(0,3).toLowerCase()){var r=t.match(/([\d|.%]{1,3})/g);n[0]=parseInt(r[0],10),n[1]=parseInt(r[1],10),n[2]=parseInt(r[2],10),n[3]=r[3]?-1!==r[3].indexOf("%")?parseInt(r[3],10)/100:parseFloat(r[3]):1}else{r=void 0;r=e<6?parseInt(String(t[1])+t[1]+t[2]+t[2]+t[3]+t[3]+(e>4?String(t[4])+t[4]:""),16):parseInt(t.slice(1),16),n[0]=r>>16&255,n[1]=r>>8&255,n[2]=255&r,n[3]=9===e||5===e?X((r>>24&255)/255*1e4)/1e4:1}return n}function K(t){var e="";switch(t.split(".").pop()){case".wps":e="application/kswps";break;case".doc":e="application/msword";break;case".docx":e="application/vnd.openxmlformats-officedocument.wordprocessingml.document";break;case".txt":e="text/plain";break;case".zip":e="application/zip";break;case".png":e="image/png";break;case".gif":e="image/gif";break;case".jpeg":case".jpg":e="image/jpeg";break;case".rtf":e="application/rtf";break;case".avi":e="video/x-msvideo";break;case".gz":e="application/x-gzip";break;case".tar":e="application/x-tar";break;case".xlsx":e="application/vnd.ms-excel";break;default:e=""}return e}function Y(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n]);return e}function $(t){var e=n({multiple:!0,accept:""},t),r=document.createElement("input");r.setAttribute("type","file"),r.setAttribute("multiple","".concat(e.multiple)),r.setAttribute("accept",e.accept),r.onchange=function(t){var n=t.target,r=n.files?Y(n.files):[];0!==r.length&&(e.onSelected(r),n.value="")},document.body.appendChild(r),r.click(),document.body.removeChild(r)}t("CountLatch",function(){function t(){this.promise=null,this.resolve=null,this.count=0}return t.prototype.startPromise=function(){var t=this;this.promise=new Promise((function(e){t.resolve=e}))},t.prototype.endPromise=function(){this.resolve&&(this.resolve(),this.resolve=null,this.promise=null)},t.prototype.lock=function(){console.log("lock"),this.count+=1,this.promise||(console.log("startPromise"),this.startPromise())},t.prototype.unlock=function(){if(this.count<1)throw new T("lock和unlock次数不匹配!");console.log("unlock"),this.count-=1,0===this.count&&this.endPromise()},t.prototype.await=function(){return h(this,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return this.promise?[4,this.promise]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t}());var Q=t("IBizSys",(function(){this.env=O,this.log=F,this.net=new B,this.commands=new C})),Z=t("FactoryCenter",(function(){}))}}}));
|
|
1
|
+
System.register(["lodash-es","qx-util","axios","qs","pluralize"],(function(t){"use strict";var e,n,r,o,i,s,a,c,u;return{setters:[function(t){e=t.debounce,n=t.merge,r=t.uniqueId,o=t.isFunction},function(t){i=t.getCookie,s=t.notNilEmpty},function(t){a=t.default},function(t){c=t.stringify},function(t){u=t.default}],execute:function(){function l(t,e){return e.forEach((function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach((function(n){if("default"!==n&&!(n in t)){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}))})),Object.freeze(t)}t({calcMimeByFileName:X,colorBlend:function(t,e,n,r){void 0===n&&(n=.5);void 0===r&&(r="hex");t=t.trim(),e=e.trim();var o=G(t),i=G(e),s=[H((1-n)*o[0]+n*i[0]),H((1-n)*o[1]+n*i[1]),H((1-n)*o[2]+n*i[2]),(1-n)*o[3]+n*i[3]];if("hex"===r){var a=[s[0].toString(16),s[1].toString(16),s[2].toString(16),0===s[3]?"00":H(255*s[3]).toString(16)];return"#".concat(a[0]).concat(a[1]).concat(a[2]).concat(a[3])}return"rgb(".concat(s[0]," ").concat(s[1]," ").concat(s[2]," / ").concat(s[3],")")},debounce:function(t,e,n){var r;return function(){for(var o=this,i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(r&&clearTimeout(r),n){var a=!r;r=setTimeout((function(){r=null}),e),a&&t.apply(this,i)}else r=setTimeout((function(){t.apply(o,i)}),e)}},debounceAndAsyncMerge:function(t,n,r){var o,i=this,s=[],a=e((function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return p(i,void 0,void 0,(function(){var n,r;return d(this,(function(i){switch(i.label){case 0:o=void 0,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,t.apply(void 0,v([],h(e),!1))];case 2:return n=i.sent(),s.forEach((function(t){t.resolve(n)})),s=[],[2,n];case 3:return r=i.sent(),s.forEach((function(t){t.reject(r)})),s=[],[3,4];case 4:return[2]}}))}))}),r);return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return p(i,void 0,void 0,(function(){var e;return d(this,(function(r){return e=t,o&&(e=n(o,e)),o=e,a.apply(void 0,v([],h(e),!1)),[2,new Promise((function(t,e){s.push({resolve:t,reject:e})}))]}))}))}},debounceAndMerge:function(t,n,r){var o,i=e((function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return o=void 0,t.apply(void 0,v([],h(e),!1))}),r);return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t;return o&&(r=n(o,r)),o=r,i.apply(void 0,v([],h(r),!1))}},downloadFileFromBlob:function(t,e){var n=X(e),r=new Blob([t],{type:n}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)},eventPath:B,fileListToArr:J,getToken:P,install:function(){if(window.ibiz)throw new Error("ibiz 已经存在, 无需重复安装");window.ibiz=new Y,window.___fc=new $},isEventInside:V,isImage:function(t){var e=t.split(".").pop();if(!e)return!1;return[".jpeg","jpg","gif","png","bmp","svg"].includes(e)},isOverlap:function(t,e){return Array.from(new Set(v(v([],h(t),!1),h(e),!1))).length!==t.length+e.length},listenJSEvent:D,onClickOutside:function(t,e,n){void 0===n&&(n={});var r=n.window,o=void 0===r?W:r,i=n.ignore,s=void 0===i?[]:i,a=n.capture,c=void 0===a||a;if(!t)throw new O("target元素不存在");if(!o)throw new O("找不到window");var u,l=!0,f=function(e){return!v([t],h(s),!1).some((function(t){return V(e,t)}))},p=!1,d=function(t){p||(o.clearTimeout(u),l&&f(t)&&e(t))},m=[D(o,"click",d,{passive:!0,capture:c}),D(o,"pointerdown",(function(t){p||(l=f(t))}),{passive:!0}),D(o,"pointerup",(function(t){if(!p&&0===t.button){var e=B(t);t.composedPath=function(){return e},u=o.setTimeout((function(){return d(t)}),50)}}),{passive:!0})].filter(Boolean);return{stop:function(){return m.forEach((function(t){return t()}))},pause:function(){p=!0},proceed:function(){p=!1}}},plural:N,pluralLower:function(t){return N(t).toLowerCase()},selectFile:K,throttle:function(t,e){var n=null;return function(){for(var r=this,o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];n||(n=setTimeout((function(){t.apply(r,o),n=null}),e))}},toDisposable:b,uploadFile:function(t){var e=this,i=n({multiple:!0,accept:"",separate:!0,beforeUpload:function(t,e){return!0},finish:function(t){},success:function(t,e){},error:function(t,e){},progress:function(t){}},t),s=function(t,n){return p(e,void 0,void 0,(function(){var e;return d(this,(function(n){if(i.request&&o(i.request))return[2,i.request(t)];throw e=new FormData,t.forEach((function(t){e.append("file",t)})),new Error("多应用模式等待重新实现请求")}))}))},a=function(t){return p(e,void 0,void 0,(function(){var e,n,o;return d(this,(function(a){switch(a.label){case 0:if(e=t.map((function(t){return{status:"uploading",name:t.name,uid:r(),percentage:0}})),!i.beforeUpload(t,e))return e.forEach((function(t){t.status="cancel"})),ibiz.log.debug("取消上传",e),[2,e];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,s(t)];case 2:return n=a.sent(),e.forEach((function(t){t.status="finished"})),i.success(e,n),e.forEach((function(t){t.response=n})),[3,4];case 3:return o=a.sent(),e.forEach((function(t){t.status="fail"})),i.error(e,o),e.forEach((function(t){t.error=o})),ibiz.log.error(o),ibiz.log.error("".concat(t.map((function(t){return t.name})).join(","),"上传失败")),[3,4];case 4:return[2,e]}}))}))};K({accept:i.accept,multiple:i.multiple,onSelected:function(t){!function(t){p(e,void 0,void 0,(function(){var e,n,r,o=this;return d(this,(function(s){switch(s.label){case 0:return e=i.separate?t.map((function(t){return[t]})):[t],[4,Promise.allSettled(e.map((function(t){return p(o,void 0,void 0,(function(){return d(this,(function(e){return[2,a(t)]}))}))})))];case 1:return n=s.sent(),r=[],n.forEach((function(t){"fulfilled"===t.status&&r.push.apply(r,v([],h(t.value),!1))})),i.finish(r),[2]}}))}))}(t)}})}});var f=function(t,e){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},f(t,e)};function p(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))}function d(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function h(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function v(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}var m=function(){function t(e){this.element=e,this.next=t.Undefined,this.prev=t.Undefined}return t.Undefined=new t(void 0),t}(),y=t("LinkedList",function(){function t(){this._first=m.Undefined,this._last=m.Undefined,this._size=0}return Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return this._first===m.Undefined},t.prototype.clear=function(){for(var t=this._first;t!==m.Undefined;){var e=t.next;t.prev=m.Undefined,t.next=m.Undefined,t=e}this._first=m.Undefined,this._last=m.Undefined,this._size=0},t.prototype.unshift=function(t){return this._insert(t,!1)},t.prototype.push=function(t){return this._insert(t,!0)},t.prototype._insert=function(t,e){var n=this,r=new m(t);if(this._first===m.Undefined)this._first=r,this._last=r;else if(e){var o=this._last;this._last=r,r.prev=o,o.next=r}else{var i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;var s=!1;return function(){s||(s=!0,n._remove(r))}},t.prototype.shift=function(){if(this._first!==m.Undefined){var t=this._first.element;return this._remove(this._first),t}},t.prototype.pop=function(){if(this._last!==m.Undefined){var t=this._last.element;return this._remove(this._last),t}},t.prototype._remove=function(t){if(t.prev!==m.Undefined&&t.next!==m.Undefined){var e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===m.Undefined&&t.next===m.Undefined?(this._first=m.Undefined,this._last=m.Undefined):t.next===m.Undefined?(this._last=this._last.prev,this._last.next=m.Undefined):t.prev===m.Undefined&&(this._first=this._first.next,this._first.prev=m.Undefined);this._size-=1},t.prototype[Symbol.iterator]=function(){var t;return d(this,(function(e){switch(e.label){case 0:t=this._first,e.label=1;case 1:return t===m.Undefined?[3,3]:[4,t.element];case 2:return e.sent(),t=t.next,[3,1];case 3:return[2]}}))},t}());function g(t){var e,n=this,r=!1;return function(){return r?e:(r=!0,e=t.apply(n,arguments))}}function b(t){return{dispose:g((function(){t()}))}}var w,_,E=t("CommandsRegistry",function(){function t(){this.commands=new Map}return t.prototype.registerCommand=function(t,e,n){var r=this;if(!t)throw new Error("invalid command");if("string"==typeof t){if(!e)throw new Error("invalid command");return this.registerCommand({id:t,handler:e,opts:n})}var o=t.id,i=this.commands.get(o);i||(i=new y,this.commands.set(o,i));var s=i.unshift(t);return b((function(){s();var t=r.commands.get(o);(null==t?void 0:t.isEmpty())&&r.commands.delete(o)}))},t.prototype.hasCommand=function(t){return this.commands.has(t)},t.prototype.getCommand=function(t){var e=this.commands.get(t);if(e&&!e.isEmpty())return e[Symbol.iterator]().next().value},t.prototype.getCommands=function(){var t,e,n=new Map,r=this.commands.keys();try{for(var o=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(r),i=o.next();!i.done;i=o.next()){var s=i.value,a=this.getCommand(s);a&&n.set(s,a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return n},t.prototype.getCommandOpt=function(t){var e=this.getCommand(t);return null==e?void 0:e.opts},t}()),U=t("CommandController",function(){function t(){this.commandRegister=new E}return t.prototype.register=function(t,e,n){return this.commandRegister.registerCommand(t,e,n)},t.prototype.execute=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return p(this,void 0,void 0,(function(){var n;return d(this,(function(r){if(n=this.commandRegister.getCommand(t))return[2,n.handler.apply(n,v([],h(e),!1))];throw new Error("未注册指令: ".concat(t,",请先注册指令"))}))}))},t.prototype.hasCommand=function(t,e){var n=!!this.commandRegister.hasCommand(t);if(!0===e&&!0===n)throw new Error("未注册指令: ".concat(t,",请先注册指令"));return n},t.prototype.getCommandOpts=function(t){return this.commandRegister.getCommandOpt(t)},t}()),x=(t("commands",new U),t("CoreConst",function(){function t(){}return t.DEFAULT_MODEL_SERVICE_TAG="default",t.TOKEN="access_token",t}())),R=t("NOOP",(function(){}));t("HttpStatusMessageConst",{200:"服务器成功返回请求的数据。",201:"新建或修改数据成功。",202:"一个请求已经进入后台排队(异步任务)。",204:"删除数据成功。",400:"发出的请求有错误,服务器没有进行新建或修改数据的操作。",401:"用户没有权限(令牌、用户名、密码错误)。",403:"用户得到授权,但是访问是被禁止的。",404:"发出的请求针对的是不存在的记录,服务器没有进行操作。",406:"请求的格式不可得。",410:"请求的资源被永久删除,且不会再得到的。",422:"当创建一个对象时,发生一个验证错误。",500:"服务器发生错误,请检查服务器。",502:"网关错误。",503:"服务不可用,服务器暂时过载或维护。",504:"网关超时。"});t("LoginMode",w),function(t){t.DEFAULT="DEFAULT",t.CUSTOM="CUSTOM",t.CAS="CAS"}(w||t("LoginMode",w={})),t("MenuPermissionMode",_),function(t){t.MIXIN="MIXIN",t.RESOURCE="RESOURCE",t.RT="RT"}(_||t("MenuPermissionMode",_={}));t("IBizContext",function(){function t(t,e){if(void 0===t&&(t={}),e){var n=this;Object.defineProperty(this,"_parent",{enumerable:!1,value:e}),Object.defineProperty(this,"_context",{enumerable:!1,value:{}});var r={};Object.keys(e).forEach((function(t){r[t]={enumerable:!0,set:function(e){n._context[t]=null==e?null:e},get:function(){return void 0!==n._context[t]?n._context[t]:e[t]}}})),Object.defineProperties(this,r)}Object.assign(this,t)}return t.prototype.getOwnContext=function(){var t=this,e={};return Object.keys(this).forEach((function(n){t._parent&&Object.prototype.hasOwnProperty.call(t._parent,n)&&!Object.prototype.hasOwnProperty.call(t._context,n)||(e[n]=t[n])})),e},t}());var C=t("Environment",{dev:!1,hub:!0,logLevel:"ERROR",baseUrl:"/api",appId:"",pluginBaseUrl:"./plugins",remoteModelUrl:"/remotemodel",assetsUrl:"./assets",dcSystem:"",downloadFileUrl:"/ibizutil/download",uploadFileUrl:"/ibizutil/upload",casLoginUrl:"",loginMode:w.DEFAULT,menuPermissionMode:_.MIXIN,enablePermission:!0}),k=t("HttpError",(function(t){this.name="HttpError";var e=t.response;this.response=t.response,e?(e.data?this.message=e.data.message:this.message=e.statusText,this.message||(this.message="网络异常,请稍后重试!"),this.status=e.status):(this.message=t.message,this.status=500)})),O=t("RuntimeError",(function(t){this.message=t,this.name="Runtime Error"}));function P(){return i(x.TOKEN)}var T,L,S,j=t("Interceptor",function(){function t(){}return t.prototype.onBeforeRequest=function(t){return p(this,void 0,void 0,(function(){return d(this,(function(e){return[2,t]}))}))},t.prototype.onRequestError=function(t){return Promise.reject(t)},t.prototype.onResponseSuccess=function(t){return p(this,void 0,void 0,(function(){return d(this,(function(e){return[2,t]}))}))},t.prototype.onResponseError=function(t){return Promise.reject(t)},t.prototype.use=function(t){this.requestTag=t.interceptors.request.use(this.onBeforeRequest,this.onRequestError),this.responseTag=t.interceptors.response.use(this.onResponseSuccess,this.onResponseError)},t.prototype.eject=function(t){this.requestTag&&t.interceptors.request.eject(this.requestTag),this.responseTag&&t.interceptors.response.eject(this.responseTag)},t}()),I=t("CoreInterceptor",function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.onBeforeRequest=function(e){return p(this,void 0,void 0,(function(){var n;return d(this,(function(r){switch(r.label){case 0:return[4,t.prototype.onBeforeRequest.call(this,e)];case 1:return r.sent(),e.headers||(e.headers={}),e.headers.Authorization="Bearer ".concat(P()),(n=ibiz.orgData)&&(n.systemid&&(e.headers.srfsystemid=n.systemid),n.orgid&&(e.headers.srforgid=n.orgid)),[2,e]}}))}))},e}(j)),A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},z={};L=A,S=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"];function o(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,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(r){return"debug"===r&&(r="log"),typeof console!==e&&("trace"===r&&n?i:void 0!==console[r]?o(console,r):void 0!==console.log?o(console,"log"):t)}function a(e,n){for(var o=0;o<r.length;o++){var i=r[o];this[i]=o<e?t:this.methodFactory(i,e,n)}this.log=this.debug}function c(t,n,r){return function(){typeof console!==e&&(a.call(this,n,r),this[t].apply(this,arguments))}}function u(t,e,n){return s(t)||c.apply(this,arguments)}function l(t,n,o){var i,s=this;n=null==n?"WARN":n;var c="loglevel";function l(){var t;if(typeof window!==e&&c){try{t=window.localStorage[c]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,r=n.indexOf(encodeURIComponent(c)+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r))[1])}catch(t){}return void 0===s.levels[t]&&(t=void 0),t}}"string"==typeof t?c+=":"+t:"symbol"==typeof t&&(c=void 0),s.name=t,s.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},s.methodFactory=o||u,s.getLevel=function(){return i},s.setLevel=function(n,o){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!==o&&function(t){var n=(r[t]||"silent").toUpperCase();if(typeof window!==e&&c){try{return void(window.localStorage[c]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(c)+"="+n+";"}catch(t){}}}(n),a.call(s,n,t),typeof console===e&&n<s.levels.SILENT)return"No console available for logging"},s.setDefaultLevel=function(t){n=t,l()||s.setLevel(t,!1)},s.resetLevel=function(){s.setLevel(n,!1),function(){if(typeof window!==e&&c){try{return void window.localStorage.removeItem(c)}catch(t){}try{window.document.cookie=encodeURIComponent(c)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}()},s.enableAll=function(t){s.setLevel(s.levels.TRACE,t)},s.disableAll=function(t){s.setLevel(s.levels.SILENT,t)};var f=l();null==f&&(f=n),s.setLevel(f,!1)}var f=new l,p={};f.getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=p[t];return e||(e=p[t]=new l(t,f.getLevel(),f.methodFactory)),e};var d=typeof window!==e?window.log:void 0;return f.noConflict=function(){return typeof window!==e&&window.log===f&&(window.log=d),f},f.getLoggers=function(){return p},f.default=f,f},(T={get exports(){return z},set exports(t){z=t}}).exports?T.exports=S():L.log=S();var M=l({__proto__:null,default:z},[z]);t("Logger",M);function q(t,e,n,r,o){var i="".concat(t,"-").concat(e);return n&&(i+="-".concat(n)),r&&(i+="__".concat(r)),o&&(i+="--".concat(o)),i}t("Namespace",function(){function t(t,e){this.block=t,this.namespace=e||"ibiz"}return t.prototype.b=function(t){return void 0===t&&(t=""),q(this.namespace,this.block,t,"","")},t.prototype.e=function(t){return t?q(this.namespace,this.block,"",t,""):""},t.prototype.m=function(t){return t?q(this.namespace,this.block,"","",t):""},t.prototype.be=function(t,e){return t&&e?q(this.namespace,this.block,t,e,""):""},t.prototype.em=function(t,e){return t&&e?q(this.namespace,this.block,"",t,e):""},t.prototype.bm=function(t,e){return t&&e?q(this.namespace,this.block,t,"",e):""},t.prototype.bem=function(t,e,n){return t&&e&&n?q(this.namespace,this.block,t,e,n):""},t.prototype.is=function(t,e){return t&&e?"".concat("is-").concat(t):""},t.prototype.cssVar=function(t){var e={};for(var n in t)t[n]&&(e[this.cssVarName(n)]=t[n]);return e},t.prototype.cssVarBlock=function(t){var e={};for(var n in t)t[n]&&(e[this.cssVarBlockName(n)]=t[n]);return e},t.prototype.cssVarName=function(t){return"--".concat(this.namespace,"-").concat(t)},t.prototype.cssVarBlockName=function(t){return"--".concat(this.namespace,"-").concat(this.block,"-").concat(t)},t}()),t("HttpResponse",(function(t,e,n){this.local=!0,this.ok=!1,this.headers={},this.config={},this.data=t,this.status=e||200,this.statusText=n||"",this.status>=200&&this.status<300&&(this.ok=!0)}));var F=t("Net",function(){function t(t){this.interceptors=new Map,this.instance=a.create(t),this.addInterceptor("Default",new I)}return t.prototype.addInterceptor=function(t,e){e.use(this.instance),this.interceptors.set(t,e)},t.prototype.removeInterceptor=function(t){var e=this.interceptors.get(t);e&&(e.eject(this.instance),this.interceptors.delete(t))},Object.defineProperty(t.prototype,"presetConfig",{get:function(){return{baseURL:this.instance.defaults.baseURL||"".concat(ibiz.env.baseUrl,"/").concat(ibiz.env.appId),headers:{"Content-Type":"application/json;charset=UTF-8",Accept:"application/json"}}},enumerable:!1,configurable:!0}),t.prototype.mergeConfig=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this.presetConfig:n.apply(void 0,v([this.presetConfig],h(t),!1))},t.prototype.post=function(t,e,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),p(this,void 0,void 0,(function(){var o,i;return d(this,(function(s){switch(s.label){case 0:t=this.handleAppPresetParam(t,n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.request(t,{method:"post",data:e,headers:r})];case 2:return o=s.sent(),[2,this.doResponseResult(o)];case 3:throw i=s.sent(),new k(i);case 4:return[2]}}))}))},t.prototype.get=function(t,e,r,o){return void 0===e&&(e={}),void 0===r&&(r={}),void 0===o&&(o={}),p(this,void 0,void 0,(function(){var i,s;return d(this,(function(a){switch(a.label){case 0:t=this.attachUrlParam(t,e),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.request(t,n({method:"get",headers:r},o))];case 2:return i=a.sent(),[2,this.doResponseResult(i)];case 3:throw s=a.sent(),new k(s);case 4:return[2]}}))}))},t.prototype.delete=function(t,e,n){return void 0===n&&(n={}),p(this,void 0,void 0,(function(){var r,o;return d(this,(function(i){switch(i.label){case 0:t=this.handleAppPresetParam(t,e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.request(t,{method:"delete",headers:n})];case 2:return r=i.sent(),[2,this.doResponseResult(r)];case 3:throw o=i.sent(),new k(o);case 4:return[2]}}))}))},t.prototype.put=function(t,e,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),p(this,void 0,void 0,(function(){var o,i;return d(this,(function(s){switch(s.label){case 0:t=this.handleAppPresetParam(t,n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.request(t,{method:"put",data:e,headers:r})];case 2:return o=s.sent(),[2,this.doResponseResult(o)];case 3:throw i=s.sent(),new k(i);case 4:return[2]}}))}))},t.prototype.getModel=function(t,e){return void 0===e&&(e={}),p(this,void 0,void 0,(function(){var n,r;return d(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.instance.get(t,{headers:e})];case 1:return n=o.sent(),[2,this.doResponseResult(n)];case 2:throw r=o.sent(),new k(r);case 3:return[2]}}))}))},t.prototype.request=function(t,e){return void 0===e&&(e={}),p(this,void 0,void 0,(function(){var n,r;return d(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.instance.request(this.mergeConfig({url:t},e))];case 1:return n=o.sent(),[2,this.doResponseResult(n)];case 2:throw r=o.sent(),new k(r);case 3:return[2]}}))}))},t.prototype.doResponseResult=function(t){var e=t;return e.status>=200&&e.status<=299&&(e.ok=!0),e},t.prototype.handleAppPresetParam=function(t,e){if(e){var n=Object.keys(e),r={};return n.forEach((function(t){t.startsWith("srf")&&s(e[t])&&(r[t]=e[t])})),this.attachUrlParam(t,e)}return t},t.prototype.attachUrlParam=function(t,e){var n=c(e);return s(n)&&(t=t.endsWith("?")||-1!==t.indexOf("?")&&t.endsWith("&")?"".concat(t).concat(n):-1===t.indexOf("?")||t.endsWith("&")?"".concat(t,"?").concat(n):"".concat(t,"&").concat(n)),t},t}());function N(t){return u(t)}t("UrlHelper",function(){function t(){}return Object.defineProperty(t,"routeBase",{get:function(){return"".concat(this.appBase,"/#")},enumerable:!1,configurable:!0}),Object.defineProperty(t,"appBase",{get:function(){var t=window.location,e=t.origin,n=t.pathname;return"".concat(e).concat(n).replace(/\/$/,"")},enumerable:!1,configurable:!0}),Object.defineProperty(t,"routePath",{get:function(){return window.location.hash.replace("#","")},enumerable:!1,configurable:!0}),Object.defineProperty(t,"fullPath",{get:function(){return window.location.href},enumerable:!1,configurable:!0}),t}());function B(t){var e=t.composedPath&&t.composedPath()||t.path;if(null!=e)return e;return[t.target].concat(function t(e,n){void 0===n&&(n=[]);var r=e.parentNode;return r?t(r,n.concat([r])):n}(t.target))}function D(t,e,n,r){void 0===r&&(r={}),t.addEventListener(e,n,r);var o=function(){t.removeEventListener(e,n,r),o=R};return function(){o()}}function V(t,e){return e&&(t.target===e||B(t).includes(e))}var W="undefined"!=typeof window?window:void 0;var H=Math.round;function G(t){var e=t.length,n=[];if("rgb"===t.slice(0,3).toLowerCase()){var r=t.match(/([\d|.%]{1,3})/g);n[0]=parseInt(r[0],10),n[1]=parseInt(r[1],10),n[2]=parseInt(r[2],10),n[3]=r[3]?-1!==r[3].indexOf("%")?parseInt(r[3],10)/100:parseFloat(r[3]):1}else{r=void 0;r=e<6?parseInt(String(t[1])+t[1]+t[2]+t[2]+t[3]+t[3]+(e>4?String(t[4])+t[4]:""),16):parseInt(t.slice(1),16),n[0]=r>>16&255,n[1]=r>>8&255,n[2]=255&r,n[3]=9===e||5===e?H((r>>24&255)/255*1e4)/1e4:1}return n}function X(t){var e="";switch(t.split(".").pop()){case".wps":e="application/kswps";break;case".doc":e="application/msword";break;case".docx":e="application/vnd.openxmlformats-officedocument.wordprocessingml.document";break;case".txt":e="text/plain";break;case".zip":e="application/zip";break;case".png":e="image/png";break;case".gif":e="image/gif";break;case".jpeg":case".jpg":e="image/jpeg";break;case".rtf":e="application/rtf";break;case".avi":e="video/x-msvideo";break;case".gz":e="application/x-gzip";break;case".tar":e="application/x-tar";break;case".xlsx":e="application/vnd.ms-excel";break;default:e=""}return e}function J(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n]);return e}function K(t){var e=n({multiple:!0,accept:""},t),r=document.createElement("input");r.setAttribute("type","file"),r.setAttribute("multiple","".concat(e.multiple)),r.setAttribute("accept",e.accept),r.onchange=function(t){var n=t.target,r=n.files?J(n.files):[];0!==r.length&&(e.onSelected(r),n.value="")},document.body.appendChild(r),r.click(),document.body.removeChild(r)}t("CountLatch",function(){function t(){this.promise=null,this.resolve=null,this.count=0}return t.prototype.startPromise=function(){var t=this;this.promise=new Promise((function(e){t.resolve=e}))},t.prototype.endPromise=function(){this.resolve&&(this.resolve(),this.resolve=null,this.promise=null)},t.prototype.lock=function(){this.count+=1,this.promise||this.startPromise()},t.prototype.unlock=function(){if(this.count<1)throw new O("lock和unlock次数不匹配!");this.count-=1,0===this.count&&this.endPromise()},t.prototype.await=function(){return p(this,void 0,void 0,(function(){return d(this,(function(t){switch(t.label){case 0:return this.promise?[4,this.promise]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t}());var Y=t("IBizSys",(function(){this.env=C,this.log=M,this.net=new F,this.commands=new U})),$=t("FactoryCenter",(function(){}))}}}));
|
|
@@ -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;;;;;;;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;
|
|
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;CAe1B"}
|
package/out/context/index.js
CHANGED
|
@@ -68,7 +68,9 @@ export class IBizContext {
|
|
|
68
68
|
const result = {};
|
|
69
69
|
Object.keys(this).forEach(key => {
|
|
70
70
|
// 父没有的,或者修改了父的上下文
|
|
71
|
-
|
|
71
|
+
// 父不存在则返回所有自身的属性
|
|
72
|
+
if (!this._parent ||
|
|
73
|
+
!Object.prototype.hasOwnProperty.call(this._parent, key) ||
|
|
72
74
|
Object.prototype.hasOwnProperty.call(this._context, key)) {
|
|
73
75
|
result[key] = this[key];
|
|
74
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/environment/environment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/environment/environment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,YAgBzB,CAAC"}
|
|
@@ -4,9 +4,10 @@ import { LoginMode, MenuPermissionMode } from '../constant';
|
|
|
4
4
|
*/
|
|
5
5
|
export const Environment = {
|
|
6
6
|
dev: false,
|
|
7
|
+
hub: true,
|
|
7
8
|
logLevel: 'ERROR',
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
baseUrl: '/api',
|
|
10
|
+
appId: '',
|
|
10
11
|
pluginBaseUrl: './plugins',
|
|
11
12
|
remoteModelUrl: '/remotemodel',
|
|
12
13
|
assetsUrl: './assets',
|
package/out/ibizsys.d.ts
CHANGED
package/out/ibizsys.js
CHANGED
package/out/install.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAM9B"}
|
package/out/install.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FactoryCenter } from './factory-center';
|
|
2
2
|
import { IBizSys } from './ibizsys';
|
|
3
|
-
import { CoreInterceptor } from './utils';
|
|
4
3
|
/**
|
|
5
4
|
* 初始化全局对象
|
|
6
5
|
*
|
|
@@ -14,5 +13,4 @@ export function install() {
|
|
|
14
13
|
}
|
|
15
14
|
window.ibiz = new IBizSys();
|
|
16
15
|
window.___fc = new FactoryCenter();
|
|
17
|
-
ibiz.net.addInterceptor('CoreInterceptor', new CoreInterceptor());
|
|
18
16
|
}
|
|
@@ -27,22 +27,29 @@ export interface IEnvironment {
|
|
|
27
27
|
*/
|
|
28
28
|
dev: boolean;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* 是否为多应用 hub 基座模式
|
|
31
31
|
*
|
|
32
32
|
* @author chitanda
|
|
33
|
-
* @date 2022-
|
|
34
|
-
* @type {
|
|
33
|
+
* @date 2022-12-20 10:12:45
|
|
34
|
+
* @type {boolean}
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
hub: boolean;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* 默认应用的应用标识
|
|
39
39
|
*
|
|
40
|
-
* @default https://cdn.jsdelivr.net/
|
|
41
40
|
* @author chitanda
|
|
42
|
-
* @date 2022-
|
|
41
|
+
* @date 2022-12-22 15:12:35
|
|
43
42
|
* @type {string}
|
|
44
43
|
*/
|
|
45
|
-
|
|
44
|
+
appId: string;
|
|
45
|
+
/**
|
|
46
|
+
* 日志级别
|
|
47
|
+
*
|
|
48
|
+
* @author chitanda
|
|
49
|
+
* @date 2022-10-25 20:10:55
|
|
50
|
+
* @type {LogLevelDesc}
|
|
51
|
+
*/
|
|
52
|
+
logLevel: LogLevelDesc;
|
|
46
53
|
/**
|
|
47
54
|
* 请求根路径
|
|
48
55
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i-environment.d.ts","sourceRoot":"","sources":["../../../src/interface/i-environment/i-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;;;;;OAMG;IACH,
|
|
1
|
+
{"version":3,"file":"i-environment.d.ts","sourceRoot":"","sources":["../../../src/interface/i-environment/i-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;;;;;OAMG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;OAMG;IACH,QAAQ,EAAE,YAAY,CAAC;IAEvB;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,SAAS,EAAE,SAAS,CAAC;IAErB;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;OAMG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;OAMG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAE1B;;;;;;OAMG;IACH,kBAAkB,EAAE,kBAAkB,CAAC;CACxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"net.d.ts","sourceRoot":"","sources":["../../../src/utils/net/net.ts"],"names":[],"mappings":"AAAA,OAAc,EAEZ,sBAAsB,EAEtB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACpB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"net.d.ts","sourceRoot":"","sources":["../../../src/utils/net/net.ts"],"names":[],"mappings":"AAAA,OAAc,EAEZ,sBAAsB,EAEtB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;GAOG;AACH,qBAAa,GAAG;IACd;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAC;IAElC;;;;;OAKG;gBACS,MAAM,CAAC,EAAE,mBAAmB;IAKxC;;;;;;OAMG;IACH,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAa;IAEnD;;;;;;;OAOG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW;IAKrD;;;;;;OAMG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM;IAQ9B;;;;;;;;OAQG;IACH,SAAS,KAAK,YAAY,IAAI,kBAAkB,CAW/C;IAED;;;;;;;;OAQG;IACH,SAAS,CAAC,WAAW,CAAC,GAAG,OAAO,EAAE,kBAAkB,EAAE;IAOtD;;;;;;;;;;OAUG;IACG,IAAI,CACR,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,KAAK,EACX,MAAM,GAAE,OAAY,EACpB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,aAAa,CAAC;IAczB;;;;;;;;;;OAUG;IACG,GAAG,CACP,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,OAAY,EACpB,OAAO,GAAE,sBAA2B,EACpC,MAAM,GAAE,kBAAuB,GAC9B,OAAO,CAAC,aAAa,CAAC;IAiBzB;;;;;;;;;OASG;IACG,MAAM,CACV,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,OAAO,EAChB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,aAAa,CAAC;IAUzB;;;;;;;;;;OAUG;IACG,GAAG,CACP,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,KAAK,EACX,MAAM,GAAE,OAAY,EACpB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,aAAa,CAAC;IAczB;;;;;;;;OAQG;IACG,QAAQ,CACZ,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,aAAa,CAAC;IAWzB;;;;;;;;OAQG;IACG,OAAO,CACX,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,kBAAuB,GAC9B,OAAO,CAAC,aAAa,CAAC;IAWzB;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;;;;;;;;OASG;IACH,OAAO,CAAC,oBAAoB;IAc5B;;;;;;;;;OASG;IACH,OAAO,CAAC,cAAc;CAevB"}
|
package/out/utils/net/net.js
CHANGED
|
@@ -3,6 +3,7 @@ import { merge } from 'lodash-es';
|
|
|
3
3
|
import { stringify } from 'qs';
|
|
4
4
|
import { notNilEmpty } from 'qx-util';
|
|
5
5
|
import { HttpError } from '../../error';
|
|
6
|
+
import { CoreInterceptor } from '../interceptor';
|
|
6
7
|
/**
|
|
7
8
|
* 全局请求工具类
|
|
8
9
|
*
|
|
@@ -28,6 +29,7 @@ export class Net {
|
|
|
28
29
|
*/
|
|
29
30
|
this.interceptors = new Map();
|
|
30
31
|
this.instance = axios.create(config);
|
|
32
|
+
this.addInterceptor('Default', new CoreInterceptor());
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
35
|
* 添加拦截器
|
|
@@ -67,7 +69,8 @@ export class Net {
|
|
|
67
69
|
get presetConfig() {
|
|
68
70
|
return {
|
|
69
71
|
// 请求前缀路径
|
|
70
|
-
baseURL: this.instance.defaults.baseURL ||
|
|
72
|
+
baseURL: this.instance.defaults.baseURL ||
|
|
73
|
+
`${ibiz.env.baseUrl}/${ibiz.env.appId}`,
|
|
71
74
|
headers: {
|
|
72
75
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
73
76
|
Accept: 'application/json',
|
|
@@ -1 +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;
|
|
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;IAOJ;;;;;;OAMG;IACH,MAAM;IAWN;;;;;OAKG;IACG,KAAK;CAKZ"}
|
|
@@ -54,10 +54,8 @@ export class CountLatch {
|
|
|
54
54
|
* @date 2022-11-24 19:11:27
|
|
55
55
|
*/
|
|
56
56
|
lock() {
|
|
57
|
-
console.log('lock');
|
|
58
57
|
this.count += 1;
|
|
59
58
|
if (!this.promise) {
|
|
60
|
-
console.log('startPromise');
|
|
61
59
|
this.startPromise();
|
|
62
60
|
}
|
|
63
61
|
}
|
|
@@ -72,7 +70,6 @@ export class CountLatch {
|
|
|
72
70
|
if (this.count < 1) {
|
|
73
71
|
throw new RuntimeError('lock和unlock次数不匹配!');
|
|
74
72
|
}
|
|
75
|
-
console.log('unlock');
|
|
76
73
|
this.count -= 1;
|
|
77
74
|
if (this.count === 0) {
|
|
78
75
|
debugger;
|
|
@@ -1 +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,
|
|
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,QA2JhD"}
|
|
@@ -44,7 +44,7 @@ export function uploadFile(_opts) {
|
|
|
44
44
|
* @param {File[]} files
|
|
45
45
|
* @returns {*} {Promise<HttpResponse>}
|
|
46
46
|
*/
|
|
47
|
-
const uploadRequest = async (files,
|
|
47
|
+
const uploadRequest = async (files, _onProgress) => {
|
|
48
48
|
// 自定义上传请求
|
|
49
49
|
if (opts.request && isFunction(opts.request)) {
|
|
50
50
|
return opts.request(files);
|
|
@@ -54,14 +54,15 @@ export function uploadFile(_opts) {
|
|
|
54
54
|
files.forEach(file => {
|
|
55
55
|
data.append('file', file);
|
|
56
56
|
});
|
|
57
|
-
const res = await ibiz.net.request(opts.uploadUrl, {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
64
|
-
return res;
|
|
57
|
+
// const res = await ibiz.net.request(opts.uploadUrl, {
|
|
58
|
+
// method: 'post',
|
|
59
|
+
// baseURL: '',
|
|
60
|
+
// data,
|
|
61
|
+
// headers: { 'Content-Type': 'multipart/form-data' },
|
|
62
|
+
// onUploadProgress: onProgress,
|
|
63
|
+
// });
|
|
64
|
+
// return res;
|
|
65
|
+
throw new Error(`多应用模式等待重新实现请求`);
|
|
65
66
|
};
|
|
66
67
|
/**
|
|
67
68
|
* 执行一次上传,可能是一个文件也可能是多个文件
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-beta.0",
|
|
4
4
|
"description": "核心包",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/index.js",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"lodash-es": "^4.17.21",
|
|
46
46
|
"qx-util": "^0.4.4"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "3e5f138e9991626bef2a20ed354a5439e9f993ca"
|
|
49
49
|
}
|
package/src/context/index.ts
CHANGED
|
@@ -91,7 +91,9 @@ export class IBizContext implements IContext {
|
|
|
91
91
|
const result: IContext = {};
|
|
92
92
|
Object.keys(this).forEach(key => {
|
|
93
93
|
// 父没有的,或者修改了父的上下文
|
|
94
|
+
// 父不存在则返回所有自身的属性
|
|
94
95
|
if (
|
|
96
|
+
!this._parent ||
|
|
95
97
|
!Object.prototype.hasOwnProperty.call(this._parent, key) ||
|
|
96
98
|
Object.prototype.hasOwnProperty.call(this._context, key)
|
|
97
99
|
) {
|
|
@@ -6,9 +6,10 @@ import { IEnvironment } from '../interface';
|
|
|
6
6
|
*/
|
|
7
7
|
export const Environment: IEnvironment = {
|
|
8
8
|
dev: false,
|
|
9
|
+
hub: true,
|
|
9
10
|
logLevel: 'ERROR',
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
baseUrl: '/api',
|
|
12
|
+
appId: '',
|
|
12
13
|
pluginBaseUrl: './plugins',
|
|
13
14
|
remoteModelUrl: '/remotemodel',
|
|
14
15
|
assetsUrl: './assets',
|
package/src/ibizsys.ts
CHANGED
package/src/install.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FactoryCenter } from './factory-center';
|
|
2
2
|
import { IBizSys } from './ibizsys';
|
|
3
|
-
import { CoreInterceptor } from './utils';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* 初始化全局对象
|
|
@@ -15,5 +14,4 @@ export function install(): void {
|
|
|
15
14
|
}
|
|
16
15
|
window.ibiz = new IBizSys();
|
|
17
16
|
window.___fc = new FactoryCenter();
|
|
18
|
-
ibiz.net.addInterceptor('CoreInterceptor', new CoreInterceptor());
|
|
19
17
|
}
|
|
@@ -30,23 +30,31 @@ export interface IEnvironment {
|
|
|
30
30
|
dev: boolean;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* 是否为多应用 hub 基座模式
|
|
34
34
|
*
|
|
35
35
|
* @author chitanda
|
|
36
|
-
* @date 2022-
|
|
37
|
-
* @type {
|
|
36
|
+
* @date 2022-12-20 10:12:45
|
|
37
|
+
* @type {boolean}
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
hub: boolean;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* 默认应用的应用标识
|
|
43
43
|
*
|
|
44
|
-
* @default https://cdn.jsdelivr.net/
|
|
45
44
|
* @author chitanda
|
|
46
|
-
* @date 2022-
|
|
45
|
+
* @date 2022-12-22 15:12:35
|
|
47
46
|
* @type {string}
|
|
48
47
|
*/
|
|
49
|
-
|
|
48
|
+
appId: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 日志级别
|
|
52
|
+
*
|
|
53
|
+
* @author chitanda
|
|
54
|
+
* @date 2022-10-25 20:10:55
|
|
55
|
+
* @type {LogLevelDesc}
|
|
56
|
+
*/
|
|
57
|
+
logLevel: LogLevelDesc;
|
|
50
58
|
|
|
51
59
|
/**
|
|
52
60
|
* 请求根路径
|
package/src/utils/net/net.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { merge } from 'lodash-es';
|
|
|
10
10
|
import { stringify } from 'qs';
|
|
11
11
|
import { notNilEmpty } from 'qx-util';
|
|
12
12
|
import { HttpError } from '../../error';
|
|
13
|
+
import { CoreInterceptor } from '../interceptor';
|
|
13
14
|
import { Interceptor } from '../interceptor/interceptor';
|
|
14
15
|
import { IHttpResponse } from './http-response';
|
|
15
16
|
|
|
@@ -40,6 +41,7 @@ export class Net {
|
|
|
40
41
|
*/
|
|
41
42
|
constructor(config?: CreateAxiosDefaults) {
|
|
42
43
|
this.instance = axios.create(config);
|
|
44
|
+
this.addInterceptor('Default', new CoreInterceptor());
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
/**
|
|
@@ -91,7 +93,9 @@ export class Net {
|
|
|
91
93
|
protected get presetConfig(): AxiosRequestConfig {
|
|
92
94
|
return {
|
|
93
95
|
// 请求前缀路径
|
|
94
|
-
baseURL:
|
|
96
|
+
baseURL:
|
|
97
|
+
this.instance.defaults.baseURL ||
|
|
98
|
+
`${ibiz.env.baseUrl}/${ibiz.env.appId}`,
|
|
95
99
|
headers: {
|
|
96
100
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
97
101
|
Accept: 'application/json',
|
|
@@ -58,10 +58,8 @@ export class CountLatch {
|
|
|
58
58
|
* @date 2022-11-24 19:11:27
|
|
59
59
|
*/
|
|
60
60
|
lock() {
|
|
61
|
-
console.log('lock');
|
|
62
61
|
this.count += 1;
|
|
63
62
|
if (!this.promise) {
|
|
64
|
-
console.log('startPromise');
|
|
65
63
|
this.startPromise();
|
|
66
64
|
}
|
|
67
65
|
}
|
|
@@ -77,7 +75,6 @@ export class CountLatch {
|
|
|
77
75
|
if (this.count < 1) {
|
|
78
76
|
throw new RuntimeError('lock和unlock次数不匹配!');
|
|
79
77
|
}
|
|
80
|
-
console.log('unlock');
|
|
81
78
|
this.count -= 1;
|
|
82
79
|
if (this.count === 0) {
|
|
83
80
|
debugger;
|
|
@@ -89,7 +89,7 @@ export function uploadFile(_opts: IUploadFileOpts) {
|
|
|
89
89
|
*/
|
|
90
90
|
const uploadRequest = async (
|
|
91
91
|
files: File[],
|
|
92
|
-
|
|
92
|
+
_onProgress: (_event: IParams) => void,
|
|
93
93
|
): Promise<HttpResponse> => {
|
|
94
94
|
// 自定义上传请求
|
|
95
95
|
if (opts.request && isFunction(opts.request)) {
|
|
@@ -101,14 +101,15 @@ export function uploadFile(_opts: IUploadFileOpts) {
|
|
|
101
101
|
files.forEach(file => {
|
|
102
102
|
data.append('file', file);
|
|
103
103
|
});
|
|
104
|
-
const res = await ibiz.net.request(opts.uploadUrl, {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
});
|
|
111
|
-
return res;
|
|
104
|
+
// const res = await ibiz.net.request(opts.uploadUrl, {
|
|
105
|
+
// method: 'post',
|
|
106
|
+
// baseURL: '',
|
|
107
|
+
// data,
|
|
108
|
+
// headers: { 'Content-Type': 'multipart/form-data' },
|
|
109
|
+
// onUploadProgress: onProgress,
|
|
110
|
+
// });
|
|
111
|
+
// return res;
|
|
112
|
+
throw new Error(`多应用模式等待重新实现请求`);
|
|
112
113
|
};
|
|
113
114
|
|
|
114
115
|
/**
|