@ibiz-template/core 0.0.1-beta.1 → 0.0.2-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.
Files changed (95) hide show
  1. package/dist/system/index.system.js +1 -1
  2. package/out/command/command-register.d.ts +66 -0
  3. package/out/command/command-register.d.ts.map +1 -0
  4. package/out/command/command-register.js +113 -0
  5. package/out/command/command.d.ts +54 -0
  6. package/out/command/command.d.ts.map +1 -0
  7. package/out/command/command.js +71 -0
  8. package/out/command/index.d.ts +10 -0
  9. package/out/command/index.d.ts.map +1 -0
  10. package/out/command/index.js +9 -0
  11. package/out/command/interface/command/command-option.d.ts +23 -0
  12. package/out/command/interface/command/command-option.d.ts.map +1 -0
  13. package/out/command/interface/command/command-option.js +1 -0
  14. package/out/command/interface/command/command.d.ts +74 -0
  15. package/out/command/interface/command/command.d.ts.map +1 -0
  16. package/out/command/interface/command/command.js +1 -0
  17. package/out/command/interface/disposable/disposable.d.ts +4 -0
  18. package/out/command/interface/disposable/disposable.d.ts.map +1 -0
  19. package/out/command/interface/disposable/disposable.js +1 -0
  20. package/out/command/interface/index.d.ts +4 -0
  21. package/out/command/interface/index.d.ts.map +1 -0
  22. package/out/command/interface/index.js +1 -0
  23. package/out/command/utils/index.d.ts +3 -0
  24. package/out/command/utils/index.d.ts.map +1 -0
  25. package/out/command/utils/index.js +2 -0
  26. package/out/command/utils/linked-list.d.ts +16 -0
  27. package/out/command/utils/linked-list.d.ts.map +1 -0
  28. package/out/command/utils/linked-list.js +120 -0
  29. package/out/command/utils/util.d.ts +27 -0
  30. package/out/command/utils/util.d.ts.map +1 -0
  31. package/out/command/utils/util.js +77 -0
  32. package/out/context/index.d.ts +24 -0
  33. package/out/context/index.d.ts.map +1 -1
  34. package/out/context/index.js +24 -1
  35. package/out/environment/environment.d.ts.map +1 -1
  36. package/out/environment/environment.js +2 -1
  37. package/out/error/http-error/http-error.d.ts.map +1 -1
  38. package/out/error/http-error/http-error.js +0 -4
  39. package/out/ibizsys.d.ts +9 -0
  40. package/out/ibizsys.d.ts.map +1 -1
  41. package/out/ibizsys.js +9 -0
  42. package/out/index.d.ts +1 -0
  43. package/out/index.d.ts.map +1 -1
  44. package/out/index.js +1 -0
  45. package/out/install.d.ts.map +1 -1
  46. package/out/install.js +0 -2
  47. package/out/interface/click-outside/click-outside.d.ts +1 -1
  48. package/out/interface/click-outside/click-outside.d.ts.map +1 -1
  49. package/out/interface/i-environment/i-environment.d.ts +15 -8
  50. package/out/interface/i-environment/i-environment.d.ts.map +1 -1
  51. package/out/utils/download-file/download-file.d.ts +10 -0
  52. package/out/utils/download-file/download-file.d.ts.map +1 -1
  53. package/out/utils/download-file/download-file.js +20 -0
  54. package/out/utils/index.d.ts +3 -0
  55. package/out/utils/index.d.ts.map +1 -1
  56. package/out/utils/index.js +3 -0
  57. package/out/utils/net/net.d.ts.map +1 -1
  58. package/out/utils/net/net.js +4 -1
  59. package/out/utils/sync/count-latch.d.ts +60 -0
  60. package/out/utils/sync/count-latch.d.ts.map +1 -0
  61. package/out/utils/sync/count-latch.js +93 -0
  62. package/out/utils/sync/index.d.ts +2 -0
  63. package/out/utils/sync/index.d.ts.map +1 -0
  64. package/out/utils/sync/index.js +1 -0
  65. package/out/utils/upload/select-file.d.ts +53 -0
  66. package/out/utils/upload/select-file.d.ts.map +1 -0
  67. package/out/utils/upload/select-file.js +47 -0
  68. package/out/utils/upload/upload-file.d.ts +46 -0
  69. package/out/utils/upload/upload-file.d.ts.map +1 -0
  70. package/out/utils/upload/upload-file.js +151 -0
  71. package/package.json +3 -3
  72. package/src/command/command-register.ts +135 -0
  73. package/src/command/command.ts +79 -0
  74. package/src/command/index.ts +11 -0
  75. package/src/command/interface/command/command-option.ts +22 -0
  76. package/src/command/interface/command/command.ts +86 -0
  77. package/src/command/interface/disposable/disposable.ts +3 -0
  78. package/src/command/interface/index.ts +9 -0
  79. package/src/command/utils/index.ts +2 -0
  80. package/src/command/utils/linked-list.ts +136 -0
  81. package/src/command/utils/util.ts +95 -0
  82. package/src/context/index.ts +45 -1
  83. package/src/environment/environment.ts +2 -1
  84. package/src/error/http-error/http-error.ts +0 -4
  85. package/src/ibizsys.ts +10 -0
  86. package/src/index.ts +1 -0
  87. package/src/install.ts +0 -2
  88. package/src/interface/i-environment/i-environment.ts +16 -8
  89. package/src/utils/download-file/download-file.ts +21 -0
  90. package/src/utils/index.ts +3 -0
  91. package/src/utils/net/net.ts +5 -1
  92. package/src/utils/sync/count-latch.ts +99 -0
  93. package/src/utils/sync/index.ts +1 -0
  94. package/src/utils/upload/select-file.ts +86 -0
  95. package/src/utils/upload/upload-file.ts +207 -0
@@ -1 +1 @@
1
- System.register(["lodash-es","qx-util","axios","qs","pluralize"],(function(e){"use strict";var t,n,o,r,i,s,c;return{setters:[function(e){t=e.debounce,n=e.merge},function(e){o=e.getCookie,r=e.notNilEmpty},function(e){i=e.default},function(e){s=e.stringify},function(e){c=e.default}],execute:function(){function a(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}e({calcMimeByFileName:F,colorBlend:function(e,t,n,o){void 0===n&&(n=.5);void 0===o&&(o="hex");e=e.trim(),t=t.trim();var r=q(e),i=q(t),s=[B((1-n)*r[0]+n*i[0]),B((1-n)*r[1]+n*i[1]),B((1-n)*r[2]+n*i[2]),(1-n)*r[3]+n*i[3]];if("hex"===o){var c=[s[0].toString(16),s[1].toString(16),s[2].toString(16),0===s[3]?"00":B(255*s[3]).toString(16)];return"#".concat(c[0]).concat(c[1]).concat(c[2]).concat(c[3])}return"rgb(".concat(s[0]," ").concat(s[1]," ").concat(s[2]," / ").concat(s[3],")")},debounceAndAsyncMerge:function(e,n,o){var r,i=this,s=[],c=t((function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return w(i,void 0,void 0,(function(){var n,o;return b(this,(function(i){switch(i.label){case 0:r=void 0,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,e.apply(void 0,R([],m(t),!1))];case 2:return n=i.sent(),s.forEach((function(e){e.resolve(n)})),s=[],[2,n];case 3:return o=i.sent(),s.forEach((function(e){e.reject(o)})),s=[],[3,4];case 4:return[2]}}))}))}),o);return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return w(i,void 0,void 0,(function(){var t;return b(this,(function(o){return t=e,r&&(t=n(r,t)),r=t,c.apply(void 0,R([],m(t),!1)),[2,new Promise((function(e,t){s.push({resolve:e,reject:t})}))]}))}))}},debounceAndMerge:function(e,n,o){var r,i=t((function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return r=void 0,e.apply(void 0,R([],m(t),!1))}),o);return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=e;return r&&(o=n(r,o)),r=o,i.apply(void 0,R([],m(o),!1))}},downloadFileFromBlob:function(e,t){var n=F(t),o=new Blob([e],{type:n}),r=URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},eventPath:A,getToken:E,install:function(){if(window.ibiz)throw new Error("ibiz 已经存在, 无需重复安装");window.ibiz=new z,window.___fc=new D,ibiz.net.addInterceptor("CoreInterceptor",new T)},isEventInside:M,isOverlap:function(e,t){return Array.from(new Set(R(R([],m(e),!1),m(t),!1))).length!==e.length+t.length},listenJSEvent:_,onClickOutside:function(e,t,n){void 0===n&&(n={});var o=n.window,r=void 0===o?N:o,i=n.ignore,s=void 0===i?[]:i,c=n.capture,a=void 0===c||c;if(!e)throw new y("target元素不存在");if(!r)throw new y("找不到window");var u,l=!0,p=function(t){return!R([e],m(s),!1).some((function(e){return M(t,e)}))},f=!1,d=function(e){f||(r.clearTimeout(u),l&&p(e)&&t(e))},h=[_(r,"click",d,{passive:!0,capture:a}),_(r,"pointerdown",(function(e){f||(l=p(e))}),{passive:!0}),_(r,"pointerup",(function(e){if(!f&&0===e.button){var t=A(e);e.composedPath=function(){return t},u=r.setTimeout((function(){return d(e)}),50)}}),{passive:!0})].filter(Boolean);return{stop:function(){return h.forEach((function(e){return e()}))},pause:function(){f=!0},proceed:function(){f=!1}}},plural:I,pluralLower:function(e){return I(e).toLowerCase()}});var u,l,p=e("CoreConst",function(){function e(){}return e.DEFAULT_MODEL_SERVICE_TAG="default",e.TOKEN="access_token",e}()),f=e("NOOP",(function(){})),d=e("HttpStatusMessageConst",{200:"服务器成功返回请求的数据。",201:"新建或修改数据成功。",202:"一个请求已经进入后台排队(异步任务)。",204:"删除数据成功。",400:"发出的请求有错误,服务器没有进行新建或修改数据的操作。",401:"用户没有权限(令牌、用户名、密码错误)。",403:"用户得到授权,但是访问是被禁止的。",404:"发出的请求针对的是不存在的记录,服务器没有进行操作。",406:"请求的格式不可得。",410:"请求的资源被永久删除,且不会再得到的。",422:"当创建一个对象时,发生一个验证错误。",500:"服务器发生错误,请检查服务器。",502:"网关错误。",503:"服务不可用,服务器暂时过载或维护。",504:"网关超时。"});e("LoginMode",u),function(e){e.DEFAULT="DEFAULT",e.CUSTOM="CUSTOM",e.CAS="CAS"}(u||e("LoginMode",u={})),e("MenuPermissionMode",l),function(e){e.MIXIN="MIXIN",e.RESOURCE="RESOURCE",e.RT="RT"}(l||e("MenuPermissionMode",l={}));e("IBizContext",(function(e,t){if(void 0===e&&(e={}),t){var n=this;Object.defineProperty(this,"_context",{enumerable:!1,value:{}});var o={};Object.keys(t).forEach((function(e){o[e]={enumerable:!0,set:function(t){n._context[e]=null==t?null:t},get:function(){return void 0!==n._context[e]?n._context[e]:t[e]}}})),Object.defineProperties(this,o)}Object.assign(this,e)}));var h=e("Environment",{dev:!1,logLevel:"ERROR",jsCdn:"https://cdn.jsdelivr.net",baseUrl:"",pluginBaseUrl:"./plugins",remoteModelUrl:"/remotemodel",assetsUrl:"./assets",dcSystem:"",downloadFileUrl:"/ibizutil/download",uploadFileUrl:"/ibizutil/upload",casLoginUrl:"",loginMode:u.DEFAULT,menuPermissionMode:l.MIXIN,enablePermission:!0}),v=e("HttpError",(function(e){this.name="HttpError";var t=e.response;this.response=e.response,t?(t.data?this.message=t.data.message:this.message=t.statusText,this.message||(this.message=d[t.status]),this.message||(this.message="网络异常,请稍后重试!"),this.status=t.status):(this.message=e.message,this.status=500)})),y=e("RuntimeError",(function(e){this.message=e,this.name="Runtime Error"})),g=function(e,t){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},g(e,t)};function w(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function c(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((o=o.apply(e,t||[])).next())}))}function b(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}function m(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s}function R(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function E(){return o(p.TOKEN)}var k,O,C,L=e("Interceptor",function(){function e(){}return e.prototype.onBeforeRequest=function(e){return w(this,void 0,void 0,(function(){return b(this,(function(t){return[2,e]}))}))},e.prototype.onRequestError=function(e){return Promise.reject(e)},e.prototype.onResponseSuccess=function(e){return w(this,void 0,void 0,(function(){return b(this,(function(t){return[2,e]}))}))},e.prototype.onResponseError=function(e){return Promise.reject(e)},e.prototype.use=function(e){this.requestTag=e.interceptors.request.use(this.onBeforeRequest,this.onRequestError),this.responseTag=e.interceptors.response.use(this.onResponseSuccess,this.onResponseError)},e.prototype.eject=function(e){this.requestTag&&e.interceptors.request.eject(this.requestTag),this.responseTag&&e.interceptors.response.eject(this.responseTag)},e}()),T=e("CoreInterceptor",function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}g(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onBeforeRequest=function(t){return w(this,void 0,void 0,(function(){var n;return b(this,(function(o){switch(o.label){case 0:return[4,e.prototype.onBeforeRequest.call(this,t)];case 1:return o.sent(),t.headers||(t.headers={}),t.headers.Authorization="Bearer ".concat(E()),(n=ibiz.orgData)&&(n.systemid&&(t.headers.srfsystemid=n.systemid),n.orgid&&(t.headers.srforgid=n.orgid)),[2,t]}}))}))},t}(L)),x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},P={exports:{}};O=x,C=function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"];function r(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function i(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function s(o){return"debug"===o&&(o="log"),typeof console!==t&&("trace"===o&&n?i:void 0!==console[o]?r(console,o):void 0!==console.log?r(console,"log"):e)}function c(t,n){for(var r=0;r<o.length;r++){var i=o[r];this[i]=r<t?e:this.methodFactory(i,t,n)}this.log=this.debug}function a(e,n,o){return function(){typeof console!==t&&(c.call(this,n,o),this[e].apply(this,arguments))}}function u(e,t,n){return s(e)||a.apply(this,arguments)}function l(e,n,r){var i,s=this;n=null==n?"WARN":n;var a="loglevel";function l(){var e;if(typeof window!==t&&a){try{e=window.localStorage[a]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,o=n.indexOf(encodeURIComponent(a)+"=");-1!==o&&(e=/^([^;]+)/.exec(n.slice(o))[1])}catch(e){}return void 0===s.levels[e]&&(e=void 0),e}}"string"==typeof e?a+=":"+e:"symbol"==typeof e&&(a=void 0),s.name=e,s.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},s.methodFactory=r||u,s.getLevel=function(){return i},s.setLevel=function(n,r){if("string"==typeof n&&void 0!==s.levels[n.toUpperCase()]&&(n=s.levels[n.toUpperCase()]),!("number"==typeof n&&n>=0&&n<=s.levels.SILENT))throw"log.setLevel() called with invalid level: "+n;if(i=n,!1!==r&&function(e){var n=(o[e]||"silent").toUpperCase();if(typeof window!==t&&a){try{return void(window.localStorage[a]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(a)+"="+n+";"}catch(e){}}}(n),c.call(s,n,e),typeof console===t&&n<s.levels.SILENT)return"No console available for logging"},s.setDefaultLevel=function(e){n=e,l()||s.setLevel(e,!1)},s.resetLevel=function(){s.setLevel(n,!1),function(){if(typeof window!==t&&a){try{return void window.localStorage.removeItem(a)}catch(e){}try{window.document.cookie=encodeURIComponent(a)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}()},s.enableAll=function(e){s.setLevel(s.levels.TRACE,e)},s.disableAll=function(e){s.setLevel(s.levels.SILENT,e)};var p=l();null==p&&(p=n),s.setLevel(p,!1)}var p=new l,f={};p.getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=f[e];return t||(t=f[e]=new l(e,p.getLevel(),p.methodFactory)),t};var d=typeof window!==t?window.log:void 0;return p.noConflict=function(){return typeof window!==t&&window.log===p&&(window.log=d),p},p.getLoggers=function(){return f},p.default=p,p},(k=P).exports?k.exports=C():O.log=C();var U=a({__proto__:null,default:P.exports},[P.exports]);e("Logger",U);function j(e,t,n,o,r){var i="".concat(e,"-").concat(t);return n&&(i+="-".concat(n)),o&&(i+="__".concat(o)),r&&(i+="--".concat(r)),i}e("Namespace",function(){function e(e,t){this.block=e,this.namespace=t||"ibiz"}return e.prototype.b=function(e){return void 0===e&&(e=""),j(this.namespace,this.block,e,"","")},e.prototype.e=function(e){return e?j(this.namespace,this.block,"",e,""):""},e.prototype.m=function(e){return e?j(this.namespace,this.block,"","",e):""},e.prototype.be=function(e,t){return e&&t?j(this.namespace,this.block,e,t,""):""},e.prototype.em=function(e,t){return e&&t?j(this.namespace,this.block,"",e,t):""},e.prototype.bm=function(e,t){return e&&t?j(this.namespace,this.block,e,"",t):""},e.prototype.bem=function(e,t,n){return e&&t&&n?j(this.namespace,this.block,e,t,n):""},e.prototype.is=function(e,t){return e&&t?"".concat("is-").concat(e):""},e.prototype.cssVar=function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarName(n)]=e[n]);return t},e.prototype.cssVarBlock=function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarBlockName(n)]=e[n]);return t},e.prototype.cssVarName=function(e){return"--".concat(this.namespace,"-").concat(e)},e.prototype.cssVarBlockName=function(e){return"--".concat(this.namespace,"-").concat(this.block,"-").concat(e)},e}()),e("HttpResponse",(function(e,t,n){this.local=!0,this.ok=!1,this.headers={},this.config={},this.data=e,this.status=t||200,this.statusText=n||"",this.status>=200&&this.status<300&&(this.ok=!0)}));var S=e("Net",function(){function e(e){this.interceptors=new Map,this.instance=i.create(e)}return e.prototype.addInterceptor=function(e,t){t.use(this.instance),this.interceptors.set(e,t)},e.prototype.removeInterceptor=function(e){var t=this.interceptors.get(e);t&&(t.eject(this.instance),this.interceptors.delete(e))},Object.defineProperty(e.prototype,"presetConfig",{get:function(){return{baseURL:this.instance.defaults.baseURL||ibiz.env.baseUrl,headers:{"Content-Type":"application/json;charset=UTF-8",Accept:"application/json"}}},enumerable:!1,configurable:!0}),e.prototype.mergeConfig=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this.presetConfig:n.apply(void 0,R([this.presetConfig],m(e),!1))},e.prototype.post=function(e,t,n,o){return void 0===n&&(n={}),void 0===o&&(o={}),w(this,void 0,void 0,(function(){var r,i;return b(this,(function(s){switch(s.label){case 0:e=this.handleAppPresetParam(e,n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.request(e,{method:"post",data:t,headers:o})];case 2:return r=s.sent(),[2,this.doResponseResult(r)];case 3:throw i=s.sent(),new v(i);case 4:return[2]}}))}))},e.prototype.get=function(e,t,o,r){return void 0===t&&(t={}),void 0===o&&(o={}),void 0===r&&(r={}),w(this,void 0,void 0,(function(){var i,s;return b(this,(function(c){switch(c.label){case 0:e=this.attachUrlParam(e,t),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.request(e,n({method:"get",headers:o},r))];case 2:return i=c.sent(),[2,this.doResponseResult(i)];case 3:throw s=c.sent(),new v(s);case 4:return[2]}}))}))},e.prototype.delete=function(e,t,n){return void 0===n&&(n={}),w(this,void 0,void 0,(function(){var o,r;return b(this,(function(i){switch(i.label){case 0:e=this.handleAppPresetParam(e,t),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.request(e,{method:"delete",headers:n})];case 2:return o=i.sent(),[2,this.doResponseResult(o)];case 3:throw r=i.sent(),new v(r);case 4:return[2]}}))}))},e.prototype.put=function(e,t,n,o){return void 0===n&&(n={}),void 0===o&&(o={}),w(this,void 0,void 0,(function(){var r,i;return b(this,(function(s){switch(s.label){case 0:e=this.handleAppPresetParam(e,n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.request(e,{method:"put",data:t,headers:o})];case 2:return r=s.sent(),[2,this.doResponseResult(r)];case 3:throw i=s.sent(),new v(i);case 4:return[2]}}))}))},e.prototype.getModel=function(e,t){return void 0===t&&(t={}),w(this,void 0,void 0,(function(){var n,o;return b(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.instance.get(e,{headers:t})];case 1:return n=r.sent(),[2,this.doResponseResult(n)];case 2:throw o=r.sent(),new v(o);case 3:return[2]}}))}))},e.prototype.request=function(e,t){return void 0===t&&(t={}),w(this,void 0,void 0,(function(){var n,o;return b(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.instance.request(this.mergeConfig({url:e},t))];case 1:return n=r.sent(),[2,this.doResponseResult(n)];case 2:throw o=r.sent(),new v(o);case 3:return[2]}}))}))},e.prototype.doResponseResult=function(e){var t=e;return t.status>=200&&t.status<=299&&(t.ok=!0),t},e.prototype.handleAppPresetParam=function(e,t){if(t){var n=Object.keys(t),o={};return n.forEach((function(e){e.startsWith("srf")&&r(t[e])&&(o[e]=t[e])})),this.attachUrlParam(e,t)}return e},e.prototype.attachUrlParam=function(e,t){var n=s(t);return r(n)&&(e=e.endsWith("?")||-1!==e.indexOf("?")&&e.endsWith("&")?"".concat(e).concat(n):-1===e.indexOf("?")||e.endsWith("&")?"".concat(e,"?").concat(n):"".concat(e,"&").concat(n)),e},e}());function I(e){return c(e)}e("UrlHelper",function(){function e(){}return Object.defineProperty(e,"routeBase",{get:function(){return"".concat(this.appBase,"/#")},enumerable:!1,configurable:!0}),Object.defineProperty(e,"appBase",{get:function(){var e=window.location,t=e.origin,n=e.pathname;return"".concat(t).concat(n).replace(/\/$/,"")},enumerable:!1,configurable:!0}),Object.defineProperty(e,"routePath",{get:function(){return window.location.hash.replace("#","")},enumerable:!1,configurable:!0}),Object.defineProperty(e,"fullPath",{get:function(){return window.location.href},enumerable:!1,configurable:!0}),e}());function A(e){var t=e.composedPath&&e.composedPath()||e.path;if(null!=t)return t;return[e.target].concat(function e(t,n){void 0===n&&(n=[]);var o=t.parentNode;return o?e(o,n.concat([o])):n}(e.target))}function _(e,t,n,o){void 0===o&&(o={}),e.addEventListener(t,n,o);var r=function(){e.removeEventListener(t,n,o),r=f};return function(){r()}}function M(e,t){return t&&(e.target===t||A(e).includes(t))}var N="undefined"!=typeof window?window:void 0;var B=Math.round;function q(e){var t=e.length,n=[];if("rgb"===e.slice(0,3).toLowerCase()){var o=e.match(/([\d|.%]{1,3})/g);n[0]=parseInt(o[0],10),n[1]=parseInt(o[1],10),n[2]=parseInt(o[2],10),n[3]=o[3]?-1!==o[3].indexOf("%")?parseInt(o[3],10)/100:parseFloat(o[3]):1}else{o=void 0;o=t<6?parseInt(String(e[1])+e[1]+e[2]+e[2]+e[3]+e[3]+(t>4?String(e[4])+e[4]:""),16):parseInt(e.slice(1),16),n[0]=o>>16&255,n[1]=o>>8&255,n[2]=255&o,n[3]=9===t||5===t?B((o>>24&255)/255*1e4)/1e4:1}return n}function F(e){var t="";switch(e.split(".").pop()){case".wps":t="application/kswps";break;case".doc":t="application/msword";break;case".docx":t="application/vnd.openxmlformats-officedocument.wordprocessingml.document";break;case".txt":t="text/plain";break;case".zip":t="application/zip";break;case".png":t="image/png";break;case".gif":t="image/gif";break;case".jpeg":case".jpg":t="image/jpeg";break;case".rtf":t="application/rtf";break;case".avi":t="video/x-msvideo";break;case".gz":t="application/x-gzip";break;case".tar":t="application/x-tar";break;default:t=""}return t}var z=e("IBizSys",(function(){this.env=h,this.log=U,this.net=new S})),D=e("FactoryCenter",(function(){}))}}}));
1
+ System.register(["lodash-es","qx-util","axios","qs","pluralize"],(function(t){"use strict";var e,n,r,o,i,s,c,a,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){c=t.default},function(t){a=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 c=[s[0].toString(16),s[1].toString(16),s[2].toString(16),0===s[3]?"00":H(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],")")},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 c=!r;r=setTimeout((function(){r=null}),e),c&&t.apply(this,i)}else r=setTimeout((function(){t.apply(o,i)}),e)}},debounceAndAsyncMerge:function(t,n,r){var o,i=this,s=[],c=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,c.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,c=n.capture,a=void 0===c||c;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:a}),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("多应用模式等待重新实现请求")}))}))},c=function(t){return p(e,void 0,void 0,(function(){var e,n,o;return d(this,(function(c){switch(c.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];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,s(t)];case 2:return n=c.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=c.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,c(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{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,c)}a((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: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,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){s=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){s.label=c[1];break}if(6===c[0]&&s.label<o[1]){s.label=o[1],o=c;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(c);break}o[2]&&s.ops.pop(),s.trys.pop();continue}c=e.call(t,s)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}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,c=this.getCommand(s);c&&n.set(s,c)}}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){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:!1,logLevel:"ERROR",baseUrl:"",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 c(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 a(t,n,r){return function(){typeof console!==e&&(c.call(this,n,r),this[t].apply(this,arguments))}}function u(t,e,n){return s(t)||a.apply(this,arguments)}function l(t,n,o){var i,s=this;n=null==n?"WARN":n;var a="loglevel";function l(){var t;if(typeof window!==e&&a){try{t=window.localStorage[a]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,r=n.indexOf(encodeURIComponent(a)+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r))[1])}catch(t){}return void 0===s.levels[t]&&(t=void 0),t}}"string"==typeof t?a+=":"+t:"symbol"==typeof t&&(a=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&&a){try{return void(window.localStorage[a]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(a)+"="+n+";"}catch(t){}}}(n),c.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&&a){try{return void window.localStorage.removeItem(a)}catch(t){}try{window.document.cookie=encodeURIComponent(a)+"=; 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=c.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(c){switch(c.label){case 0:t=this.attachUrlParam(t,e),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.request(t,n({method:"get",headers:r},o))];case 2:return i=c.sent(),[2,this.doResponseResult(i)];case 3:throw s=c.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=a(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(){console.log("lock"),this.count+=1,this.promise||(console.log("startPromise"),this.startPromise())},t.prototype.unlock=function(){if(this.count<1)throw new O("lock和unlock次数不匹配!");console.log("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(){}))}}}));
@@ -0,0 +1,66 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,113 @@
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
+ }
@@ -0,0 +1,54 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,71 @@
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
+ }
@@ -0,0 +1,10 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,9 @@
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();
@@ -0,0 +1,23 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,74 @@
1
+ import { IDisposable } from '../disposable/disposable';
2
+ import { ICommandOption } from './command-option';
3
+ /**
4
+ * 注册指令
5
+ *
6
+ * @author chitanda
7
+ * @date 2022-06-27 13:06:25
8
+ * @export
9
+ * @interface ICommand
10
+ */
11
+ export interface ICommand {
12
+ id: string;
13
+ handler: ICommandHandler;
14
+ opts?: ICommandOption;
15
+ }
16
+ /**
17
+ * 触发指令声明
18
+ *
19
+ * @author chitanda
20
+ * @date 2022-06-28 17:06:10
21
+ * @export
22
+ * @interface Command
23
+ */
24
+ export interface Command {
25
+ /**
26
+ * Title of the command, like `save`.
27
+ */
28
+ title: string;
29
+ /**
30
+ * The identifier of the actual command handler.
31
+ * @see {@link commands.registerCommand}
32
+ */
33
+ command: string;
34
+ /**
35
+ * A tooltip for the command, when represented in the UI.
36
+ */
37
+ tooltip?: string;
38
+ /**
39
+ * Arguments that the command handler should be
40
+ * invoked with.
41
+ */
42
+ arguments?: any[];
43
+ }
44
+ /**
45
+ * 指令处理回调
46
+ *
47
+ * @author chitanda
48
+ * @date 2022-06-27 13:06:33
49
+ * @export
50
+ * @interface ICommandHandler
51
+ */
52
+ export interface ICommandHandler {
53
+ (...args: any[]): unknown | Promise<unknown>;
54
+ }
55
+ /**
56
+ * 指令控制器集
57
+ */
58
+ export type ICommandsMap = Map<string, ICommand>;
59
+ /**
60
+ * 注册服务
61
+ *
62
+ * @author chitanda
63
+ * @date 2022-06-27 13:06:16
64
+ * @export
65
+ * @interface ICommandRegistry
66
+ */
67
+ export interface ICommandRegistry {
68
+ registerCommand(id: string, command: ICommandHandler, opts: ICommandOption): IDisposable;
69
+ registerCommand(id: string, command: ICommandHandler): IDisposable;
70
+ registerCommand(command: ICommand): IDisposable;
71
+ getCommand(id: string): ICommand | undefined;
72
+ getCommands(): ICommandsMap;
73
+ }
74
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/command/interface/command/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,eAAe,CAAC;IACzB,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CACb,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,cAAc,GACnB,WAAW,CAAC;IACf,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,WAAW,CAAC;IACnE,eAAe,CAAC,OAAO,EAAE,QAAQ,GAAG,WAAW,CAAC;IAChD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC7C,WAAW,IAAI,YAAY,CAAC;CAC7B"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface IDisposable {
2
+ dispose(): void;
3
+ }
4
+ //# sourceMappingURL=disposable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disposable.d.ts","sourceRoot":"","sources":["../../../../src/command/interface/disposable/disposable.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export { ICommand, Command, ICommandHandler, ICommandsMap, ICommandRegistry, } from './command/command';
2
+ export { ICommandOption } from './command/command-option';
3
+ export { IDisposable } from './disposable/disposable';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/command/interface/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,OAAO,EACP,eAAe,EACf,YAAY,EACZ,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export { LinkedList } from './linked-list';
2
+ export { toDisposable, debounce, throttle } from './util';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/command/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { LinkedList } from './linked-list';
2
+ export { toDisposable, debounce, throttle } from './util';
@@ -0,0 +1,16 @@
1
+ export declare class LinkedList<E> {
2
+ private _first;
3
+ private _last;
4
+ private _size;
5
+ get size(): number;
6
+ isEmpty(): boolean;
7
+ clear(): void;
8
+ unshift(element: E): () => void;
9
+ push(element: E): () => void;
10
+ private _insert;
11
+ shift(): E | undefined;
12
+ pop(): E | undefined;
13
+ private _remove;
14
+ [Symbol.iterator](): Iterator<E>;
15
+ }
16
+ //# sourceMappingURL=linked-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linked-list.d.ts","sourceRoot":"","sources":["../../../src/command/utils/linked-list.ts"],"names":[],"mappings":"AAoBA,qBAAa,UAAU,CAAC,CAAC;IACvB,OAAO,CAAC,MAAM,CAA2B;IAEzC,OAAO,CAAC,KAAK,CAA2B;IAExC,OAAO,CAAC,KAAK,CAAa;IAE1B,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,OAAO,IAAI,OAAO;IAIlB,KAAK,IAAI,IAAI;IAcb,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,MAAM,IAAI;IAI/B,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,MAAM,IAAI;IAI5B,OAAO,CAAC,OAAO;IA6Bf,KAAK,IAAI,CAAC,GAAG,SAAS;IAStB,GAAG,IAAI,CAAC,GAAG,SAAS;IASpB,OAAO,CAAC,OAAO;IAwBd,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC;CAOlC"}