@ibiz-template/core 0.0.1-beta.17 → 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.
- package/dist/system/index.system.js +1 -1
- package/out/ibizsys.d.ts +0 -9
- package/out/ibizsys.d.ts.map +1 -1
- package/out/ibizsys.js +0 -9
- package/out/index.d.ts +0 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +0 -1
- package/package.json +2 -3
- package/src/ibizsys.ts +0 -10
- package/src/index.ts +0 -1
- package/LICENSE +0 -21
- package/out/command/command-register.d.ts +0 -66
- package/out/command/command-register.d.ts.map +0 -1
- package/out/command/command-register.js +0 -113
- package/out/command/command.d.ts +0 -54
- package/out/command/command.d.ts.map +0 -1
- package/out/command/command.js +0 -71
- package/out/command/index.d.ts +0 -10
- package/out/command/index.d.ts.map +0 -1
- package/out/command/index.js +0 -9
- package/out/command/interface/command/command-option.d.ts +0 -23
- package/out/command/interface/command/command-option.d.ts.map +0 -1
- package/out/command/interface/command/command-option.js +0 -1
- package/out/command/interface/command/command.d.ts +0 -74
- package/out/command/interface/command/command.d.ts.map +0 -1
- package/out/command/interface/command/command.js +0 -1
- package/out/command/interface/disposable/disposable.d.ts +0 -4
- package/out/command/interface/disposable/disposable.d.ts.map +0 -1
- package/out/command/interface/disposable/disposable.js +0 -1
- package/out/command/interface/index.d.ts +0 -4
- package/out/command/interface/index.d.ts.map +0 -1
- package/out/command/interface/index.js +0 -1
- package/out/command/utils/index.d.ts +0 -3
- package/out/command/utils/index.d.ts.map +0 -1
- package/out/command/utils/index.js +0 -2
- package/out/command/utils/linked-list.d.ts +0 -16
- package/out/command/utils/linked-list.d.ts.map +0 -1
- package/out/command/utils/linked-list.js +0 -120
- package/out/command/utils/util.d.ts +0 -27
- package/out/command/utils/util.d.ts.map +0 -1
- package/out/command/utils/util.js +0 -77
- package/src/command/command-register.ts +0 -135
- package/src/command/command.ts +0 -79
- package/src/command/index.ts +0 -11
- package/src/command/interface/command/command-option.ts +0 -22
- package/src/command/interface/command/command.ts +0 -86
- package/src/command/interface/disposable/disposable.ts +0 -3
- package/src/command/interface/index.ts +0 -9
- package/src/command/utils/index.ts +0 -2
- package/src/command/utils/linked-list.ts +0 -136
- package/src/command/utils/util.ts +0 -95
|
@@ -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(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(){}))}}}));
|
package/out/ibizsys.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CommandController } from './command';
|
|
2
1
|
import { OrgData } from './interface';
|
|
3
2
|
import { Logger, Net } from './utils';
|
|
4
3
|
/**
|
|
@@ -32,14 +31,6 @@ export declare class IBizSys {
|
|
|
32
31
|
* @type {Net}
|
|
33
32
|
*/
|
|
34
33
|
net: Net;
|
|
35
|
-
/**
|
|
36
|
-
* 认证服务
|
|
37
|
-
*
|
|
38
|
-
* @author chitanda
|
|
39
|
-
* @date 2022-07-20 10:07:33
|
|
40
|
-
* @type {AuthService}
|
|
41
|
-
*/
|
|
42
|
-
commands: CommandController;
|
|
43
34
|
/**
|
|
44
35
|
* sass 模式下的中心系统标识
|
|
45
36
|
*
|
package/out/ibizsys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ibizsys.d.ts","sourceRoot":"","sources":["../src/ibizsys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ibizsys.d.ts","sourceRoot":"","sources":["../src/ibizsys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;;;GAOG;AACH,qBAAa,OAAO;IAClB;;;;;OAKG;IACH,GAAG,qCAAe;IAElB;;;;;OAKG;IACH,GAAG,oBAAU;IAEb;;;;;;OAMG;IACH,GAAG,EAAE,GAAG,CAAa;IAErB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB"}
|
package/out/ibizsys.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CommandController } from './command';
|
|
2
1
|
import { Environment } from './environment/environment';
|
|
3
2
|
import { Logger, Net } from './utils';
|
|
4
3
|
/**
|
|
@@ -33,13 +32,5 @@ export class IBizSys {
|
|
|
33
32
|
* @type {Net}
|
|
34
33
|
*/
|
|
35
34
|
this.net = new Net();
|
|
36
|
-
/**
|
|
37
|
-
* 认证服务
|
|
38
|
-
*
|
|
39
|
-
* @author chitanda
|
|
40
|
-
* @date 2022-07-20 10:07:33
|
|
41
|
-
* @type {AuthService}
|
|
42
|
-
*/
|
|
43
|
-
this.commands = new CommandController();
|
|
44
35
|
}
|
|
45
36
|
}
|
package/out/index.d.ts
CHANGED
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AAEjB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AAEjB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
package/out/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/core",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.30",
|
|
4
4
|
"description": "核心包",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/index.js",
|
|
@@ -44,6 +44,5 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"lodash-es": "^4.17.21",
|
|
46
46
|
"qx-util": "^0.4.4"
|
|
47
|
-
}
|
|
48
|
-
"gitHead": "ec02483ab23e246c852c28e4973fd7b086416657"
|
|
47
|
+
}
|
|
49
48
|
}
|
package/src/ibizsys.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CommandController } from './command';
|
|
2
1
|
import { Environment } from './environment/environment';
|
|
3
2
|
import { OrgData } from './interface';
|
|
4
3
|
import { Logger, Net } from './utils';
|
|
@@ -37,15 +36,6 @@ export class IBizSys {
|
|
|
37
36
|
*/
|
|
38
37
|
net: Net = new Net();
|
|
39
38
|
|
|
40
|
-
/**
|
|
41
|
-
* 认证服务
|
|
42
|
-
*
|
|
43
|
-
* @author chitanda
|
|
44
|
-
* @date 2022-07-20 10:07:33
|
|
45
|
-
* @type {AuthService}
|
|
46
|
-
*/
|
|
47
|
-
commands: CommandController = new CommandController();
|
|
48
|
-
|
|
49
39
|
/**
|
|
50
40
|
* sass 模式下的中心系统标识
|
|
51
41
|
*
|
package/src/index.ts
CHANGED
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 千反田丷
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { ICommand, ICommandHandler, ICommandOption, ICommandRegistry, ICommandsMap, IDisposable } from './interface';
|
|
2
|
-
/**
|
|
3
|
-
* 命令注册中心
|
|
4
|
-
*
|
|
5
|
-
* @author chitanda
|
|
6
|
-
* @date 2022-06-27 13:06:50
|
|
7
|
-
* @export
|
|
8
|
-
* @class CommandRegisterService
|
|
9
|
-
* @implements {ICommandRegistry}
|
|
10
|
-
*/
|
|
11
|
-
export declare class CommandsRegistry implements ICommandRegistry {
|
|
12
|
-
/**
|
|
13
|
-
* 已经注册的所有指令
|
|
14
|
-
*
|
|
15
|
-
* @author chitanda
|
|
16
|
-
* @date 2022-07-21 15:07:47
|
|
17
|
-
* @private
|
|
18
|
-
*/
|
|
19
|
-
private readonly commands;
|
|
20
|
-
/**
|
|
21
|
-
* 注册指令
|
|
22
|
-
*
|
|
23
|
-
* @author chitanda
|
|
24
|
-
* @date 2022-06-27 13:06:31
|
|
25
|
-
* @param {(string | ICommand)} idOrCommand
|
|
26
|
-
* @param {ICommandHandler} [handler]
|
|
27
|
-
* @return {*} {IDisposable}
|
|
28
|
-
*/
|
|
29
|
-
registerCommand(idOrCommand: string | ICommand, handler?: ICommandHandler, opts?: ICommandOption): IDisposable;
|
|
30
|
-
/**
|
|
31
|
-
* 指令是否已经注册
|
|
32
|
-
*
|
|
33
|
-
* @author chitanda
|
|
34
|
-
* @date 2022-07-21 15:07:58
|
|
35
|
-
* @param {string} id
|
|
36
|
-
* @return {*} {boolean}
|
|
37
|
-
*/
|
|
38
|
-
hasCommand(id: string): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* 查找指令
|
|
41
|
-
*
|
|
42
|
-
* @author chitanda
|
|
43
|
-
* @date 2022-07-21 16:07:12
|
|
44
|
-
* @param {string} id
|
|
45
|
-
* @return {*} {(ICommand | undefined)}
|
|
46
|
-
*/
|
|
47
|
-
getCommand(id: string): ICommand | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* 获取所有指令
|
|
50
|
-
*
|
|
51
|
-
* @author chitanda
|
|
52
|
-
* @date 2022-07-21 16:07:20
|
|
53
|
-
* @return {*} {ICommandsMap}
|
|
54
|
-
*/
|
|
55
|
-
getCommands(): ICommandsMap;
|
|
56
|
-
/**
|
|
57
|
-
* 获取指令配置参数
|
|
58
|
-
*
|
|
59
|
-
* @author chitanda
|
|
60
|
-
* @date 2022-07-21 16:07:27
|
|
61
|
-
* @param {string} id
|
|
62
|
-
* @return {*} {(ICommandOption | undefined)}
|
|
63
|
-
*/
|
|
64
|
-
getCommandOpt(id: string): ICommandOption | undefined;
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=command-register.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command-register.d.ts","sourceRoot":"","sources":["../../src/command/command-register.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACZ,MAAM,aAAa,CAAC;AAGrB;;;;;;;;GAQG;AACH,qBAAa,gBAAiB,YAAW,gBAAgB;IACvD;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2C;IAEpE;;;;;;;;OAQG;IACH,eAAe,CACb,WAAW,EAAE,MAAM,GAAG,QAAQ,EAC9B,OAAO,CAAC,EAAE,eAAe,EACzB,IAAI,CAAC,EAAE,cAAc,GACpB,WAAW;IAiCd;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI/B;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAQ5C;;;;;;OAMG;IACH,WAAW,IAAI,YAAY;IAY3B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;CAItD"}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { LinkedList, toDisposable } from './utils';
|
|
2
|
-
/**
|
|
3
|
-
* 命令注册中心
|
|
4
|
-
*
|
|
5
|
-
* @author chitanda
|
|
6
|
-
* @date 2022-06-27 13:06:50
|
|
7
|
-
* @export
|
|
8
|
-
* @class CommandRegisterService
|
|
9
|
-
* @implements {ICommandRegistry}
|
|
10
|
-
*/
|
|
11
|
-
export class CommandsRegistry {
|
|
12
|
-
constructor() {
|
|
13
|
-
/**
|
|
14
|
-
* 已经注册的所有指令
|
|
15
|
-
*
|
|
16
|
-
* @author chitanda
|
|
17
|
-
* @date 2022-07-21 15:07:47
|
|
18
|
-
* @private
|
|
19
|
-
*/
|
|
20
|
-
this.commands = new Map();
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* 注册指令
|
|
24
|
-
*
|
|
25
|
-
* @author chitanda
|
|
26
|
-
* @date 2022-06-27 13:06:31
|
|
27
|
-
* @param {(string | ICommand)} idOrCommand
|
|
28
|
-
* @param {ICommandHandler} [handler]
|
|
29
|
-
* @return {*} {IDisposable}
|
|
30
|
-
*/
|
|
31
|
-
registerCommand(idOrCommand, handler, opts) {
|
|
32
|
-
if (!idOrCommand) {
|
|
33
|
-
throw new Error(`invalid command`);
|
|
34
|
-
}
|
|
35
|
-
if (typeof idOrCommand === 'string') {
|
|
36
|
-
if (!handler) {
|
|
37
|
-
throw new Error(`invalid command`);
|
|
38
|
-
}
|
|
39
|
-
return this.registerCommand({ id: idOrCommand, handler, opts });
|
|
40
|
-
}
|
|
41
|
-
const { id } = idOrCommand;
|
|
42
|
-
let commands = this.commands.get(id);
|
|
43
|
-
if (!commands) {
|
|
44
|
-
commands = new LinkedList();
|
|
45
|
-
this.commands.set(id, commands);
|
|
46
|
-
}
|
|
47
|
-
const removeFn = commands.unshift(idOrCommand);
|
|
48
|
-
const ret = toDisposable(() => {
|
|
49
|
-
removeFn();
|
|
50
|
-
const command = this.commands.get(id);
|
|
51
|
-
if (command === null || command === void 0 ? void 0 : command.isEmpty()) {
|
|
52
|
-
this.commands.delete(id);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
return ret;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* 指令是否已经注册
|
|
59
|
-
*
|
|
60
|
-
* @author chitanda
|
|
61
|
-
* @date 2022-07-21 15:07:58
|
|
62
|
-
* @param {string} id
|
|
63
|
-
* @return {*} {boolean}
|
|
64
|
-
*/
|
|
65
|
-
hasCommand(id) {
|
|
66
|
-
return this.commands.has(id);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* 查找指令
|
|
70
|
-
*
|
|
71
|
-
* @author chitanda
|
|
72
|
-
* @date 2022-07-21 16:07:12
|
|
73
|
-
* @param {string} id
|
|
74
|
-
* @return {*} {(ICommand | undefined)}
|
|
75
|
-
*/
|
|
76
|
-
getCommand(id) {
|
|
77
|
-
const list = this.commands.get(id);
|
|
78
|
-
if (!list || list.isEmpty()) {
|
|
79
|
-
return undefined;
|
|
80
|
-
}
|
|
81
|
-
return list[Symbol.iterator]().next().value;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* 获取所有指令
|
|
85
|
-
*
|
|
86
|
-
* @author chitanda
|
|
87
|
-
* @date 2022-07-21 16:07:20
|
|
88
|
-
* @return {*} {ICommandsMap}
|
|
89
|
-
*/
|
|
90
|
-
getCommands() {
|
|
91
|
-
const result = new Map();
|
|
92
|
-
const keys = this.commands.keys();
|
|
93
|
-
for (const key of keys) {
|
|
94
|
-
const command = this.getCommand(key);
|
|
95
|
-
if (command) {
|
|
96
|
-
result.set(key, command);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return result;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* 获取指令配置参数
|
|
103
|
-
*
|
|
104
|
-
* @author chitanda
|
|
105
|
-
* @date 2022-07-21 16:07:27
|
|
106
|
-
* @param {string} id
|
|
107
|
-
* @return {*} {(ICommandOption | undefined)}
|
|
108
|
-
*/
|
|
109
|
-
getCommandOpt(id) {
|
|
110
|
-
const cmd = this.getCommand(id);
|
|
111
|
-
return cmd === null || cmd === void 0 ? void 0 : cmd.opts;
|
|
112
|
-
}
|
|
113
|
-
}
|
package/out/command/command.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { ICommandHandler, ICommandOption, IDisposable } from './interface';
|
|
2
|
-
/**
|
|
3
|
-
* 指令控制器
|
|
4
|
-
*
|
|
5
|
-
* @author chitanda
|
|
6
|
-
* @date 2022-06-28 19:06:51
|
|
7
|
-
* @export
|
|
8
|
-
* @class CommandController
|
|
9
|
-
*/
|
|
10
|
-
export declare class CommandController {
|
|
11
|
-
private commandRegister;
|
|
12
|
-
/**
|
|
13
|
-
* 注册指令
|
|
14
|
-
*
|
|
15
|
-
* @author chitanda
|
|
16
|
-
* @date 2022-06-28 19:06:45
|
|
17
|
-
* @param {string} id
|
|
18
|
-
* @param {ICommandHandler} handler
|
|
19
|
-
* @param {ICommandOption} [opts]
|
|
20
|
-
* @return {*} {IDisposable}
|
|
21
|
-
*/
|
|
22
|
-
register(id: string, handler: ICommandHandler, opts?: ICommandOption): IDisposable;
|
|
23
|
-
/**
|
|
24
|
-
* 执行指令
|
|
25
|
-
*
|
|
26
|
-
* @author chitanda
|
|
27
|
-
* @date 2022-06-28 19:06:38
|
|
28
|
-
* @template T
|
|
29
|
-
* @param {string} id
|
|
30
|
-
* @param {...unknown[]} args
|
|
31
|
-
* @return {*} {Promise<T>}
|
|
32
|
-
*/
|
|
33
|
-
execute<T = undefined>(id: string, ...args: unknown[]): Promise<T>;
|
|
34
|
-
/**
|
|
35
|
-
* 判断指令是否存在,可直接抛出异常
|
|
36
|
-
*
|
|
37
|
-
* @author chitanda
|
|
38
|
-
* @date 2022-06-28 19:06:11
|
|
39
|
-
* @param {string} id
|
|
40
|
-
* @param {boolean} [err]
|
|
41
|
-
* @return {*} {boolean}
|
|
42
|
-
*/
|
|
43
|
-
hasCommand(id: string, err?: boolean): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* 获取指令配置参数
|
|
46
|
-
*
|
|
47
|
-
* @author chitanda
|
|
48
|
-
* @date 2022-07-21 17:07:11
|
|
49
|
-
* @param {string} id
|
|
50
|
-
* @return {*} {(ICommandOption | undefined)}
|
|
51
|
-
*/
|
|
52
|
-
getCommandOpts(id: string): ICommandOption | undefined;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/command/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG3E;;;;;;;GAOG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,eAAe,CAA0B;IAEjD;;;;;;;;;OASG;IACH,QAAQ,CACN,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,eAAe,EACxB,IAAI,CAAC,EAAE,cAAc,GACpB,WAAW;IAId;;;;;;;;;OASG;IACG,OAAO,CAAC,CAAC,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAQxE;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO;IAQ9C;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;CAGvD"}
|
package/out/command/command.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { CommandsRegistry } from './command-register';
|
|
2
|
-
/**
|
|
3
|
-
* 指令控制器
|
|
4
|
-
*
|
|
5
|
-
* @author chitanda
|
|
6
|
-
* @date 2022-06-28 19:06:51
|
|
7
|
-
* @export
|
|
8
|
-
* @class CommandController
|
|
9
|
-
*/
|
|
10
|
-
export class CommandController {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.commandRegister = new CommandsRegistry();
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* 注册指令
|
|
16
|
-
*
|
|
17
|
-
* @author chitanda
|
|
18
|
-
* @date 2022-06-28 19:06:45
|
|
19
|
-
* @param {string} id
|
|
20
|
-
* @param {ICommandHandler} handler
|
|
21
|
-
* @param {ICommandOption} [opts]
|
|
22
|
-
* @return {*} {IDisposable}
|
|
23
|
-
*/
|
|
24
|
-
register(id, handler, opts) {
|
|
25
|
-
return this.commandRegister.registerCommand(id, handler, opts);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* 执行指令
|
|
29
|
-
*
|
|
30
|
-
* @author chitanda
|
|
31
|
-
* @date 2022-06-28 19:06:38
|
|
32
|
-
* @template T
|
|
33
|
-
* @param {string} id
|
|
34
|
-
* @param {...unknown[]} args
|
|
35
|
-
* @return {*} {Promise<T>}
|
|
36
|
-
*/
|
|
37
|
-
async execute(id, ...args) {
|
|
38
|
-
const command = this.commandRegister.getCommand(id);
|
|
39
|
-
if (command) {
|
|
40
|
-
return command.handler(...args);
|
|
41
|
-
}
|
|
42
|
-
throw new Error(`未注册指令: ${id},请先注册指令`);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* 判断指令是否存在,可直接抛出异常
|
|
46
|
-
*
|
|
47
|
-
* @author chitanda
|
|
48
|
-
* @date 2022-06-28 19:06:11
|
|
49
|
-
* @param {string} id
|
|
50
|
-
* @param {boolean} [err]
|
|
51
|
-
* @return {*} {boolean}
|
|
52
|
-
*/
|
|
53
|
-
hasCommand(id, err) {
|
|
54
|
-
const bol = !!this.commandRegister.hasCommand(id);
|
|
55
|
-
if (err === true && bol === true) {
|
|
56
|
-
throw new Error(`未注册指令: ${id},请先注册指令`);
|
|
57
|
-
}
|
|
58
|
-
return bol;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* 获取指令配置参数
|
|
62
|
-
*
|
|
63
|
-
* @author chitanda
|
|
64
|
-
* @date 2022-07-21 17:07:11
|
|
65
|
-
* @param {string} id
|
|
66
|
-
* @return {*} {(ICommandOption | undefined)}
|
|
67
|
-
*/
|
|
68
|
-
getCommandOpts(id) {
|
|
69
|
-
return this.commandRegister.getCommandOpt(id);
|
|
70
|
-
}
|
|
71
|
-
}
|
package/out/command/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CommandController } from './command';
|
|
2
|
-
export * from './interface';
|
|
3
|
-
export * from './utils';
|
|
4
|
-
export { CommandsRegistry } from './command-register';
|
|
5
|
-
export { CommandController } from './command';
|
|
6
|
-
/**
|
|
7
|
-
* 命令控制器
|
|
8
|
-
*/
|
|
9
|
-
export declare const commands: CommandController;
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,QAAQ,mBAA0B,CAAC"}
|
package/out/command/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CommandController } from './command';
|
|
2
|
-
export * from './interface';
|
|
3
|
-
export * from './utils';
|
|
4
|
-
export { CommandsRegistry } from './command-register';
|
|
5
|
-
export { CommandController } from './command';
|
|
6
|
-
/**
|
|
7
|
-
* 命令控制器
|
|
8
|
-
*/
|
|
9
|
-
export const commands = new CommandController();
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 指令参数, 主要用于在指令呈现时的展示参数
|
|
3
|
-
*
|
|
4
|
-
* @author chitanda
|
|
5
|
-
* @date 2022-06-28 17:06:47
|
|
6
|
-
* @export
|
|
7
|
-
* @interface ICommandOption
|
|
8
|
-
*/
|
|
9
|
-
export interface ICommandOption {
|
|
10
|
-
readonly id: string;
|
|
11
|
-
readonly title: string;
|
|
12
|
-
readonly tooltip?: string;
|
|
13
|
-
readonly description?: string;
|
|
14
|
-
/**
|
|
15
|
-
* 只支持 svg 图标
|
|
16
|
-
*
|
|
17
|
-
* @author chitanda
|
|
18
|
-
* @date 2022-06-29 14:06:42
|
|
19
|
-
* @type {string}
|
|
20
|
-
*/
|
|
21
|
-
readonly icon?: string;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=command-option.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command-option.d.ts","sourceRoot":"","sources":["../../../../src/command/interface/command/command-option.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|