@ibiz-template/core 0.0.3-beta.3 → 0.0.3-beta.5

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.
@@ -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;return{setters:[function(t){e=t.debounce,n=t.merge,r=t.uniqueId,o=t.isFunction},function(t){i=t.getCookie,s=t.notNilEmpty},function(t){a=t.AxiosHeaders,c=t.default},function(t){u=t.stringify},function(t){l=t.default}],execute:function(){function f(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:Z,colorBlend:function(t,e,n,r){void 0===n&&(n=.5);void 0===r&&(r="hex");t=t.trim(),e=e.trim();var o=X(t),i=X(e),s=[W((1-n)*o[0]+n*i[0]),W((1-n)*o[1]+n*i[1]),W((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":W(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 d(i,void 0,void 0,(function(){var n,r;return h(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,m([],v(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 d(i,void 0,void 0,(function(){var e;return h(this,(function(r){return e=t,o&&(e=n(o,e)),o=e,a.apply(void 0,m([],v(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,m([],v(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,m([],v(r),!1))}},downloadFileFromBlob:function(t,e){var n=Z(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:D,fileListToArr:G,getToken:T,install:function(){if(window.ibiz)throw new Error("ibiz 已经存在, 无需重复安装");window.ibiz=new J,window.___fc=new Y},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(m(m([],v(t),!1),v(e),!1))).length!==t.length+e.length},listenJSEvent:$,onClickOutside:function(t,e,n){void 0===n&&(n={});var r=n.window,o=void 0===r?H:r,i=n.ignore,s=void 0===i?[]:i,a=n.capture,c=void 0===a||a;if(!t)throw new P("target元素不存在");if(!o)throw new P("找不到window");var u,l=!0,f=function(e){return!m([t],v(s),!1).some((function(t){return V(e,t)}))},p=!1,d=function(t){p||(o.clearTimeout(u),l&&f(t)&&e(t))},h=[$(o,"click",d,{passive:!0,capture:c}),$(o,"pointerdown",(function(t){p||(l=f(t))}),{passive:!0}),$(o,"pointerup",(function(t){if(!p&&0===t.button){var e=D(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:B,pluralLower:function(t){return B(t).toLowerCase()},selectFile:K,setRemoteStyle:function(t){return d(this,void 0,void 0,(function(){var e,n;return h(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,ibiz.net.get(t)];case 1:return e=r.sent(),(n=document.createElement("style")).setAttribute("title","app-style-css"),n.innerText=e.data,document.head.appendChild(n),[3,3];case 2:return r.sent(),M.debug("加载远程样式表失败",t),[3,3];case 3:return[2]}}))}))},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:w,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 d(e,void 0,void 0,(function(){var e;return h(this,(function(n){if(i.request&&o(i.request))return[2,i.request(t)];throw e=new FormData,t.forEach((function(t){e.append("file",t)})),new Error("多应用模式等待重新实现请求")}))}))},a=function(t){return d(e,void 0,void 0,(function(){var e,n,o;return h(this,(function(a){switch(a.label){case 0:if(e=t.map((function(t){return{status:"uploading",name:t.name,uid:r(),percentage:0}})),!i.beforeUpload(t,e))return e.forEach((function(t){t.status="cancel"})),ibiz.log.debug("取消上传",e),[2,e];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,s(t)];case 2:return n=a.sent(),e.forEach((function(t){t.status="finished"})),i.success(e,n),e.forEach((function(t){t.response=n})),[3,4];case 3:return o=a.sent(),e.forEach((function(t){t.status="fail"})),i.error(e,o),e.forEach((function(t){t.error=o})),ibiz.log.error(o),ibiz.log.error("".concat(t.map((function(t){return t.name})).join(","),"上传失败")),[3,4];case 4:return[2,e]}}))}))};K({accept:i.accept,multiple:i.multiple,onSelected:function(t){!function(t){d(e,void 0,void 0,(function(){var e,n,r,o=this;return h(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 d(o,void 0,void 0,(function(){return h(this,(function(e){return[2,a(t)]}))}))})))];case 1:return n=s.sent(),r=[],n.forEach((function(t){"fulfilled"===t.status&&r.push.apply(r,m([],v(t.value),!1))})),i.finish(r),[2]}}))}))}(t)}})}});var p=function(t,e){return p=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])},p(t,e)};function d(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 h(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 v(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 m(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 y=function(){function t(e){this.element=e,this.next=t.Undefined,this.prev=t.Undefined}return t.Undefined=new t(void 0),t}(),g=t("LinkedList",function(){function t(){this._first=y.Undefined,this._last=y.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===y.Undefined},t.prototype.clear=function(){for(var t=this._first;t!==y.Undefined;){var e=t.next;t.prev=y.Undefined,t.next=y.Undefined,t=e}this._first=y.Undefined,this._last=y.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 y(t);if(this._first===y.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!==y.Undefined){var t=this._first.element;return this._remove(this._first),t}},t.prototype.pop=function(){if(this._last!==y.Undefined){var t=this._last.element;return this._remove(this._last),t}},t.prototype._remove=function(t){if(t.prev!==y.Undefined&&t.next!==y.Undefined){var e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===y.Undefined&&t.next===y.Undefined?(this._first=y.Undefined,this._last=y.Undefined):t.next===y.Undefined?(this._last=this._last.prev,this._last.next=y.Undefined):t.prev===y.Undefined&&(this._first=this._first.next,this._first.prev=y.Undefined);this._size-=1},t.prototype[Symbol.iterator]=function(){var t;return h(this,(function(e){switch(e.label){case 0:t=this._first,e.label=1;case 1:return t===y.Undefined?[3,3]:[4,t.element];case 2:return e.sent(),t=t.next,[3,1];case 3:return[2]}}))},t}());function b(t){var e,n=this,r=!1;return function(){return r?e:(r=!0,e=t.apply(n,arguments))}}function w(t){return{dispose:b((function(){t()}))}}var _,E,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 g,this.commands.set(o,i));var s=i.unshift(t);return w((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}()),R=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 d(this,void 0,void 0,(function(){var n;return h(this,(function(r){if(n=this.commandRegister.getCommand(t))return[2,n.handler.apply(n,m([],v(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}()),U=(t("commands",new R),t("CoreConst",function(){function t(){}return t.DEFAULT_MODEL_SERVICE_TAG="default",t.TOKEN="access_token",t.TOKEN_EXPIRES="access_token_expires",t}())),C=t("NOOP",(function(){}));t("HttpStatusMessageConst",{200:"服务器成功返回请求的数据。",201:"新建或修改数据成功。",202:"一个请求已经进入后台排队(异步任务)。",204:"删除数据成功。",400:"发出的请求有错误,服务器没有进行新建或修改数据的操作。",401:"用户没有权限(令牌、用户名、密码错误)。",403:"用户得到授权,但是访问是被禁止的。",404:"发出的请求针对的是不存在的记录,服务器没有进行操作。",406:"请求的格式不可得。",410:"请求的资源被永久删除,且不会再得到的。",422:"当创建一个对象时,发生一个验证错误。",500:"服务器发生错误,请检查服务器。",502:"网关错误。",503:"服务不可用,服务器暂时过载或维护。",504:"网关超时。"});t("LoginMode",_),function(t){t.DEFAULT="DEFAULT",t.CUSTOM="CUSTOM",t.CAS="CAS"}(_||t("LoginMode",_={})),t("MenuPermissionMode",E),function(t){t.MIXIN="MIXIN",t.RESOURCE="RESOURCE",t.RT="RT"}(E||t("MenuPermissionMode",E={}));t("IBizContext",function(){function t(t,e){if(void 0===t&&(t={}),e){var n=this;Object.defineProperty(this,"_parent",{enumerable:!1,value:e}),Object.defineProperty(this,"_context",{enumerable:!1,value:{}});var r={};Object.keys(e).forEach((function(t){r[t]={enumerable:!0,set:function(e){n._context[t]=null==e?null:e},get:function(){return void 0!==n._context[t]?n._context[t]:e[t]}}})),Object.defineProperties(this,r)}Object.assign(this,t)}return t.prototype.getOwnContext=function(){var t=this,e={};return Object.keys(this).forEach((function(n){t._parent&&Object.prototype.hasOwnProperty.call(t._parent,n)&&!Object.prototype.hasOwnProperty.call(t._context,n)||(e[n]=t[n])})),e},t}());var k=t("Environment",{dev:!1,hub:!0,logLevel:"ERROR",baseUrl:"/api",appId:"",pluginBaseUrl:"./plugins",remoteModelUrl:"/remotemodel",assetsUrl:"./assets",dcSystem:"",downloadFileUrl:"/ibizutil/download",uploadFileUrl:"/ibizutil/upload",casLoginUrl:"",loginMode:_.DEFAULT,menuPermissionMode:E.MIXIN,enablePermission:!0,routePlaceholder:"-"}),O=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)})),P=t("RuntimeError",(function(t){this.message=t,this.name="Runtime Error"}));function T(){return i(U.TOKEN)}var S,L,j,A=t("Interceptor",function(){function t(){}return t.prototype.onBeforeRequest=function(t){return d(this,void 0,void 0,(function(){return h(this,(function(e){return[2,t]}))}))},t.prototype.onRequestError=function(t){return Promise.reject(t)},t.prototype.onResponseSuccess=function(t){return d(this,void 0,void 0,(function(){return h(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}p(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.onBeforeRequest=function(e){return d(this,void 0,void 0,(function(){var n,r;return h(this,(function(o){switch(o.label){case 0:return[4,t.prototype.onBeforeRequest.call(this,e)];case 1:return o.sent(),(n=e.headers).set("Authorization","Bearer ".concat(T())),(r=ibiz.orgData)&&(r.systemid&&n.set("srfsystemid",r.systemid),r.orgid&&n.set("srforgid",r.orgid)),[2,e]}}))}))},e}(A)),z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},M={};L=z,j=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},(S={get exports(){return M},set exports(t){M=t}}).exports?S.exports=j():L.log=j();var N=f({__proto__:null,default:M},[M]);t("Logger",N);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={headers:new a},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.urlReg=/^http[s]?:\/\/[^\s]*/,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];var r=this.presetConfig;if(0===t.length)return r;var o=t[0].url;return o&&this.urlReg.test(o)&&delete r.baseURL,n.apply(void 0,m([r],v(t),!1))},t.prototype.post=function(t,e,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),d(this,void 0,void 0,(function(){var o,i;return h(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 O(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={}),d(this,void 0,void 0,(function(){var i,s;return h(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 O(s);case 4:return[2]}}))}))},t.prototype.delete=function(t,e,n){return void 0===n&&(n={}),d(this,void 0,void 0,(function(){var r,o;return h(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 O(o);case 4:return[2]}}))}))},t.prototype.put=function(t,e,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),d(this,void 0,void 0,(function(){var o,i;return h(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 O(i);case 4:return[2]}}))}))},t.prototype.getModel=function(t,e){return void 0===e&&(e={}),d(this,void 0,void 0,(function(){var n,r;return h(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 O(r);case 3:return[2]}}))}))},t.prototype.request=function(t,e){return void 0===e&&(e={}),d(this,void 0,void 0,(function(){var n,r;return h(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 O(r);case 3:return[2]}}))}))},t.prototype.axios=function(t){return c(t)},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=u(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 B(t){return l(t)}t("StringUtil",function(){function t(){}return t.fill=function(t,e,n){if(s(t)){var r;if(s(e))null==(r=t.match(this.contextReg))||r.forEach((function(n){var r=n.slice(10,n.length-1);t=t.replace("${context.".concat(r,"}"),e[r]||"")}));if(s(n))null==(r=t.match(this.dataReg))||r.forEach((function(e){var r=e.slice(7,e.length-1);t=t.replace("${data.".concat(r,"}"),n[r]||"")}))}return t},t.contextReg=/\$\{context.[a-zA-Z_$][a-zA-Z0-9_$]{1,}\}/g,t.dataReg=/\$\{data.[a-zA-Z_$][a-zA-Z0-9_$]{1,}\}/g,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 D(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 $(t,e,n,r){void 0===r&&(r={}),t.addEventListener(e,n,r);var o=function(){t.removeEventListener(e,n,r),o=C};return function(){o()}}function V(t,e){return e&&(t.target===e||D(t).includes(e))}var H="undefined"!=typeof window?window:void 0;var W=Math.round;function X(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?W((r>>24&255)/255*1e4)/1e4:1}return n}function Z(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 G(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?G(n.files):[];0!==r.length&&(e.onSelected(r),n.value="")},document.body.appendChild(r),r.click(),document.body.removeChild(r)}t("CountLatch",function(){function t(){this.promise=null,this.resolve=null,this.count=0}return t.prototype.startPromise=function(){var t=this;this.promise=new Promise((function(e){t.resolve=e}))},t.prototype.endPromise=function(){this.resolve&&(this.resolve(),this.resolve=null,this.promise=null)},t.prototype.lock=function(){this.count+=1,this.promise||this.startPromise()},t.prototype.unlock=function(){if(this.count<1)throw new P("lock和unlock次数不匹配!");this.count-=1,0===this.count&&this.endPromise()},t.prototype.await=function(){return d(this,void 0,void 0,(function(){return h(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 J=t("IBizSys",(function(){this.env=k,this.log=N,this.net=new F,this.commands=new R})),Y=t("FactoryCenter",(function(){}))}}}));
1
+ System.register(["ramda","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.clone},function(t){n=t.debounce,r=t.merge,o=t.uniqueId,i=t.isFunction},function(t){s=t.getCookie,a=t.notNilEmpty},function(t){c=t.AxiosHeaders,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({awaitTimeout:function(t,e,n){return d(this,void 0,void 0,(function(){return v(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(e){setTimeout((function(){e(!0)}),t)}))];case 1:return r.sent(),e?[2,e.apply(void 0,y([],m(n||[]),!1))]:[2]}}))}))},calcMimeByFileName:G,colorBlend:function(t,e,n,r){void 0===n&&(n=.5);void 0===r&&(r="hex");t=t.trim(),e=e.trim();var o=Z(t),i=Z(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,e,r){var o,i=this,s=[],a=n((function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return d(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=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return d(i,void 0,void 0,(function(){var n;return v(this,(function(r){return n=t,o&&(n=e(o,n)),o=n,a.apply(void 0,y([],m(n),!1)),[2,new Promise((function(t,e){s.push({resolve:t,reject:e})}))]}))}))}},debounceAndMerge:function(t,e,r){var o,i=n((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=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t;return o&&(r=e(o,r)),o=r,i.apply(void 0,y([],m(r),!1))}},downloadFileFromBlob:function(t,e){var n=G(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:$,fileListToArr:K,getToken:S,install:function(){if(window.ibiz)throw new Error("ibiz 已经存在, 无需重复安装");window.ibiz=new Y,window.___fc=new Q},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:V,onClickOutside:function(t,e,n){void 0===n&&(n={});var r=n.window,o=void 0===r?W:r,i=n.ignore,s=void 0===i?[]:i,a=n.capture,c=void 0===a||a;if(!t)throw new 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,h=function(t){p||(o.clearTimeout(u),l&&f(t)&&e(t))},d=[V(o,"click",h,{passive:!0,capture:c}),V(o,"pointerdown",(function(t){p||(l=f(t))}),{passive:!0}),V(o,"pointerup",(function(t){if(!p&&0===t.button){var e=$(t);t.composedPath=function(){return e},u=o.setTimeout((function(){return h(t)}),50)}}),{passive:!0})].filter(Boolean);return{stop:function(){return d.forEach((function(t){return t()}))},pause:function(){p=!0},proceed:function(){p=!1}}},plural:D,pluralLower:function(t){return D(t).toLowerCase()},selectFile:J,setRemoteStyle:function(t){return d(this,void 0,void 0,(function(){var e,n;return v(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,ibiz.net.get(t)];case 1:return e=r.sent(),(n=document.createElement("style")).setAttribute("title","app-style-css"),n.innerText=e.data,document.head.appendChild(n),[3,3];case 2:return r.sent(),N.debug("加载远程样式表失败",t),[3,3];case 3:return[2]}}))}))},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,n=r({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,r){return d(e,void 0,void 0,(function(){var e;return v(this,(function(r){if(n.request&&i(n.request))return[2,n.request(t)];throw e=new FormData,t.forEach((function(t){e.append("file",t)})),new Error("多应用模式等待重新实现请求")}))}))},a=function(t){return d(e,void 0,void 0,(function(){var e,r,i;return v(this,(function(a){switch(a.label){case 0:if(e=t.map((function(t){return{status:"uploading",name:t.name,uid:o(),percentage:0}})),!n.beforeUpload(t,e))return e.forEach((function(t){t.status="cancel"})),ibiz.log.debug("取消上传",e),[2,e];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,s(t)];case 2:return r=a.sent(),e.forEach((function(t){t.status="finished"})),n.success(e,r),e.forEach((function(t){t.response=r})),[3,4];case 3:return i=a.sent(),e.forEach((function(t){t.status="fail"})),n.error(e,i),e.forEach((function(t){t.error=i})),ibiz.log.error(i),ibiz.log.error("".concat(t.map((function(t){return t.name})).join(","),"上传失败")),[3,4];case 4:return[2,e]}}))}))};J({accept:n.accept,multiple:n.multiple,onSelected:function(t){!function(t){d(e,void 0,void 0,(function(){var e,r,o,i=this;return v(this,(function(s){switch(s.label){case 0:return e=n.separate?t.map((function(t){return[t]})):[t],[4,Promise.allSettled(e.map((function(t){return d(i,void 0,void 0,(function(){return v(this,(function(e){return[2,a(t)]}))}))})))];case 1:return r=s.sent(),o=[],r.forEach((function(t){"fulfilled"===t.status&&o.push.apply(o,y([],m(t.value),!1))})),n.finish(o),[2]}}))}))}(t)}})}});var h=function(t,e){return h=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])},h(t,e)};function d(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,x,R=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}()),U=t("CommandController",function(){function t(){this.commandRegister=new R}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 d(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}()),C=(t("commands",new U),t("CoreConst",function(){function t(){}return t.DEFAULT_MODEL_SERVICE_TAG="default",t.TOKEN="access_token",t.TOKEN_EXPIRES="access_token_expires",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",x),function(t){t.MIXIN="MIXIN",t.RESOURCE="RESOURCE",t.RT="RT"}(x||t("MenuPermissionMode",x={}));t("IBizContext",function(){function t(t,e){if(void 0===t&&(t={}),Object.defineProperty(this,"_associationContext",{enumerable:!1,value:[]}),e){var n=this;Object.defineProperty(this,"_parent",{enumerable:!1,writable:!0,value:e}),Object.defineProperty(this,"_context",{enumerable:!1,writable:!0,value:{}});var r={};Object.keys(e).forEach((function(t){r[t]={enumerable:!0,set:function(e){n._context[t]=null==e?null:e},get:function(){return void 0!==n._context[t]?n._context[t]:e[t]}}})),Object.defineProperties(this,r)}Object.assign(this,t)}return t.prototype.getOwnContext=function(){var t=this,e={};return Object.keys(this).forEach((function(n){t._parent&&Object.prototype.hasOwnProperty.call(t._parent,n)&&!Object.prototype.hasOwnProperty.call(t._context,n)||(e[n]=t[n])})),e},t.prototype.destroy=function(){this._parent=void 0,this._context={},this._associationContext.forEach((function(t){t.destroy()}))},t.prototype.clone=function(){var n=new t(e(this._context),this._parent);return this._associationContext.push(n),n},t.create=function(e,n){return new t(e,n)},t}());var O=t("Environment",{dev:!1,hub:!0,logLevel:"ERROR",baseUrl:"/api",appId:"",pluginBaseUrl:"./plugins",remoteModelUrl:"/remotemodel",assetsUrl:"./assets",dcSystem:"",downloadFileUrl:"/ibizutil/download",uploadFileUrl:"/ibizutil/upload",casLoginUrl:"",loginMode:E.DEFAULT,menuPermissionMode:x.MIXIN,enablePermission:!0,routePlaceholder:"-"}),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 S(){return s(C.TOKEN)}var L,j,A,I=t("Interceptor",function(){function t(){}return t.prototype.onBeforeRequest=function(t){return d(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 d(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}h(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.onBeforeRequest=function(e){return d(this,void 0,void 0,(function(){var n,r;return v(this,(function(o){switch(o.label){case 0:return[4,t.prototype.onBeforeRequest.call(this,e)];case 1:return o.sent(),(n=e.headers).set("Authorization","Bearer ".concat(S())),(r=ibiz.orgData)&&(r.systemid&&n.set("srfsystemid",r.systemid),r.orgid&&n.set("srforgid",r.orgid)),[2,e]}}))}))},e}(I)),M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},N={};j=M,A=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 h=typeof window!==e?window.log:void 0;return f.noConflict=function(){return typeof window!==e&&window.log===f&&(window.log=h),f},f.getLoggers=function(){return p},f.default=f,f},(L={get exports(){return N},set exports(t){N=t}}).exports?L.exports=A():j.log=A();var q=p({__proto__:null,default:N},[N]);t("Logger",q);function F(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=""),F(this.namespace,this.block,t,"","")},t.prototype.e=function(t){return t?F(this.namespace,this.block,"",t,""):""},t.prototype.m=function(t){return t?F(this.namespace,this.block,"","",t):""},t.prototype.be=function(t,e){return t&&e?F(this.namespace,this.block,t,e,""):""},t.prototype.em=function(t,e){return t&&e?F(this.namespace,this.block,"",t,e):""},t.prototype.bm=function(t,e){return t&&e?F(this.namespace,this.block,t,"",e):""},t.prototype.bem=function(t,e,n){return t&&e&&n?F(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={headers:new c},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.urlReg=/^http[s]?:\/\/[^\s]*/,this.interceptors=new Map,this.instance=u.create(t),this.addInterceptor("Default",new z)}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];var n=this.presetConfig;if(0===t.length)return n;var o=t[0].url;return o&&this.urlReg.test(o)&&delete n.baseURL,r.apply(void 0,y([n],m(t),!1))},t.prototype.post=function(t,e,n,r){return void 0===n&&(n={}),void 0===r&&(r={}),d(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,n,o){return void 0===e&&(e={}),void 0===n&&(n={}),void 0===o&&(o={}),d(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,r({method:"get",headers:n},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={}),d(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={}),d(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={}),d(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={}),d(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.axios=function(t){return u(t)},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")&&a(e[t])&&(r[t]=e[t])})),this.attachUrlParam(t,e)}return t},t.prototype.attachUrlParam=function(t,e){var n=l(e);return a(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("StringUtil",function(){function t(){}return t.fill=function(t,e,n){if(a(t)){var r;if(a(e))null==(r=t.match(this.contextReg))||r.forEach((function(n){var r=n.slice(10,n.length-1);t=t.replace("${context.".concat(r,"}"),e[r]||"")}));if(a(n))null==(r=t.match(this.dataReg))||r.forEach((function(e){var r=e.slice(7,e.length-1);t=t.replace("${data.".concat(r,"}"),n[r]||"")}))}return t},t.contextReg=/\$\{context.[a-zA-Z_$][a-zA-Z0-9_$]{1,}\}/g,t.dataReg=/\$\{data.[a-zA-Z_$][a-zA-Z0-9_$]{1,}\}/g,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 $(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 V(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||$(t).includes(e))}var W="undefined"!=typeof window?window:void 0;var X=Math.round;function Z(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 G(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 K(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n]);return e}function J(t){var e=r({multiple:!0,accept:""},t),n=document.createElement("input");n.setAttribute("type","file"),n.setAttribute("multiple","".concat(e.multiple)),n.setAttribute("accept",e.accept),n.onchange=function(t){var n=t.target,r=n.files?K(n.files):[];0!==r.length&&(e.onSelected(r),n.value="")},document.body.appendChild(n),n.click(),document.body.removeChild(n)}t("CountLatch",function(){function t(){this.promise=null,this.resolve=null,this.count=0}return t.prototype.startPromise=function(){var t=this;this.promise=new Promise((function(e){t.resolve=e}))},t.prototype.endPromise=function(){this.resolve&&(this.resolve(),this.resolve=null,this.promise=null)},t.prototype.lock=function(){this.count+=1,this.promise||this.startPromise()},t.prototype.unlock=function(){if(this.count<1)throw new T("lock和unlock次数不匹配!");this.count-=1,0===this.count&&this.endPromise()},t.prototype.await=function(){return d(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 Y=t("IBizSys",(function(){this.env=O,this.log=q,this.net=new B,this.commands=new U})),Q=t("FactoryCenter",(function(){}))}}}));
@@ -8,39 +8,74 @@
8
8
  */
9
9
  export declare class IBizContext implements IContext {
10
10
  [key: string | symbol]: any;
11
+ /**
12
+ * clone 后引用的上下文实例,需要在实例销毁时,同时销毁
13
+ *
14
+ * @author chitanda
15
+ * @date 2023-03-13 16:03:31
16
+ * @protected
17
+ * @type {IBizContext[]}
18
+ */
19
+ protected _associationContext: IBizContext[];
11
20
  /**
12
21
  * 修改的父上下文
13
22
  *
14
23
  * @author lxm
15
24
  * @date 2022-12-08 18:12:16
16
25
  * @protected
17
- * @type {IContext}
26
+ * @type {IDatum}
18
27
  */
19
- protected _context: IContext;
28
+ protected _context: IDatum;
20
29
  /**
21
30
  * 父的上下文源对象
22
31
  *
23
32
  * @author lxm
24
33
  * @date 2022-12-08 18:12:31
25
- * @type {IBizContext}
34
+ * @type {IContext}
26
35
  */
27
- _parent?: IBizContext;
36
+ _parent?: IContext;
28
37
  /**
29
38
  * Creates an instance of IBizContext.
30
39
  *
31
40
  * @author chitanda
32
41
  * @date 2022-07-14 10:07:15
33
- * @param {IContext} [context={}] 自身的上下文
34
- * @param {IBizContext} [parent]
42
+ * @param {IDatum} [context={}] 自身的上下文
43
+ * @param {IContext} [parent]
35
44
  */
36
- constructor(context?: IContext, parent?: IBizContext);
45
+ private constructor();
37
46
  /**
38
47
  * 返回自身的上下文,独有的和与父有差异的。
39
48
  *
40
49
  * @author lxm
41
50
  * @date 2022-12-08 17:12:26
42
- * @returns {*} {IContext}
51
+ * @returns {*} {IDatum}
52
+ */
53
+ getOwnContext(): IDatum;
54
+ /**
55
+ * 销毁当前上下文对象
56
+ *
57
+ * @author chitanda
58
+ * @date 2023-03-13 15:03:04
59
+ */
60
+ destroy(): void;
61
+ /**
62
+ * 在非视图中,需要断开视图上下文联系时。只能使用 clone 创建新的局部上下文
63
+ *
64
+ * @author chitanda
65
+ * @date 2023-03-13 16:03:13
66
+ * @return {*} {IBizContext}
67
+ */
68
+ clone(): IBizContext;
69
+ /**
70
+ * 上下文只有在视图初始化时,调用 create 方法
71
+ *
72
+ * @author chitanda
73
+ * @date 2023-03-13 16:03:32
74
+ * @static
75
+ * @param {IDatum} [context]
76
+ * @param {IContext} [parent]
77
+ * @return {*} {IContext}
43
78
  */
44
- getOwnContext(): IContext;
79
+ static create(context?: IDatum, parent?: IContext): IBizContext;
45
80
  }
46
81
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,WAAY,YAAW,QAAQ;IAE1C,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAE5B;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,EAAG,QAAQ,CAAC;IAE9B;;;;;;OAMG;IACK,OAAO,CAAC,EAAE,WAAW,CAAC;IAE9B;;;;;;;OAOG;gBAES,OAAO,GAAE,QAAa,EAAE,MAAM,CAAC,EAAE,WAAW;IA0CxD;;;;;;OAMG;IACH,aAAa,IAAI,QAAQ;CAe1B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,qBAAa,WAAY,YAAW,QAAQ;IAE1C,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAE5B;;;;;;;OAOG;IACH,UAAkB,mBAAmB,EAAE,WAAW,EAAE,CAAC;IAErD;;;;;;;OAOG;IACH,UAAkB,QAAQ,EAAE,MAAM,CAAC;IAEnC;;;;;;OAMG;IACK,OAAO,CAAC,EAAE,QAAQ,CAAC;IAE3B;;;;;;;OAOG;IAEH,OAAO;IAkDP;;;;;;OAMG;IACH,aAAa,IAAI,MAAM;IAgBvB;;;;;OAKG;IACH,OAAO,IAAI,IAAI;IAQf;;;;;;OAMG;IACH,KAAK,IAAI,WAAW;IAMpB;;;;;;;;;OASG;IACH,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,WAAW;CAGhE"}
@@ -1,3 +1,4 @@
1
+ import { clone } from 'ramda';
1
2
  /**
2
3
  * 上下文处理类
3
4
  *
@@ -12,22 +13,28 @@ export class IBizContext {
12
13
  *
13
14
  * @author chitanda
14
15
  * @date 2022-07-14 10:07:15
15
- * @param {IContext} [context={}] 自身的上下文
16
- * @param {IBizContext} [parent]
16
+ * @param {IDatum} [context={}] 自身的上下文
17
+ * @param {IContext} [parent]
17
18
  */
18
19
  // eslint-disable-next-line default-param-last
19
20
  constructor(context = {}, parent) {
21
+ Object.defineProperty(this, '_associationContext', {
22
+ enumerable: false,
23
+ value: [],
24
+ });
20
25
  if (parent) {
21
26
  // eslint-disable-next-line @typescript-eslint/no-this-alias
22
27
  const self = this;
23
28
  // 定义私有变量,存放父上下文源对象
24
29
  Object.defineProperty(this, '_parent', {
25
30
  enumerable: false,
31
+ writable: true,
26
32
  value: parent,
27
33
  });
28
34
  // 定义私有变量,用于存储对父已有上下文的修改。
29
35
  Object.defineProperty(this, '_context', {
30
36
  enumerable: false,
37
+ writable: true,
31
38
  value: {},
32
39
  });
33
40
  // 监控父上下文参数,自身不存在时从父取
@@ -62,7 +69,7 @@ export class IBizContext {
62
69
  *
63
70
  * @author lxm
64
71
  * @date 2022-12-08 17:12:26
65
- * @returns {*} {IContext}
72
+ * @returns {*} {IDatum}
66
73
  */
67
74
  getOwnContext() {
68
75
  const result = {};
@@ -77,4 +84,42 @@ export class IBizContext {
77
84
  });
78
85
  return result;
79
86
  }
87
+ /**
88
+ * 销毁当前上下文对象
89
+ *
90
+ * @author chitanda
91
+ * @date 2023-03-13 15:03:04
92
+ */
93
+ destroy() {
94
+ this._parent = undefined;
95
+ this._context = {};
96
+ this._associationContext.forEach(item => {
97
+ item.destroy();
98
+ });
99
+ }
100
+ /**
101
+ * 在非视图中,需要断开视图上下文联系时。只能使用 clone 创建新的局部上下文
102
+ *
103
+ * @author chitanda
104
+ * @date 2023-03-13 16:03:13
105
+ * @return {*} {IBizContext}
106
+ */
107
+ clone() {
108
+ const newContext = new IBizContext(clone(this._context), this._parent);
109
+ this._associationContext.push(newContext);
110
+ return newContext;
111
+ }
112
+ /**
113
+ * 上下文只有在视图初始化时,调用 create 方法
114
+ *
115
+ * @author chitanda
116
+ * @date 2023-03-13 16:03:32
117
+ * @static
118
+ * @param {IDatum} [context]
119
+ * @param {IContext} [parent]
120
+ * @return {*} {IContext}
121
+ */
122
+ static create(context, parent) {
123
+ return new IBizContext(context, parent);
124
+ }
80
125
  }
package/out/types.d.ts CHANGED
@@ -23,6 +23,29 @@ declare global {
23
23
  */
24
24
  interface IContext {
25
25
  [key: string | symbol]: any;
26
+ /**
27
+ * 返回自身的上下文,独有的和与父有差异的
28
+ *
29
+ * @author chitanda
30
+ * @date 2023-03-13 17:03:10
31
+ * @return {*} {IDatum}
32
+ */
33
+ getOwnContext(): IDatum;
34
+ /**
35
+ * 销毁当前上下文
36
+ *
37
+ * @author chitanda
38
+ * @date 2023-03-13 17:03:37
39
+ */
40
+ destroy(): void;
41
+ /**
42
+ * 克隆当前上下文
43
+ *
44
+ * @author chitanda
45
+ * @date 2023-03-13 17:03:45
46
+ * @return {*} {IContext}
47
+ */
48
+ clone(): IContext;
26
49
  }
27
50
  /**
28
51
  * 参数
@@ -44,6 +67,16 @@ declare global {
44
67
  interface IData {
45
68
  [key: string | symbol]: any;
46
69
  }
70
+ /**
71
+ * 数据
72
+ *
73
+ * @author chitanda
74
+ * @date 2023-03-13 17:03:50
75
+ * @interface IDatum
76
+ */
77
+ interface IDatum {
78
+ [key: string | symbol]: any;
79
+ }
47
80
  /**
48
81
  * 任意对象结构
49
82
  *
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,CAAC,MAAM,CAAC;IACb,MAAM,IAAI,EAAE,OAAO,CAAC;IACpB,MAAM,KAAK,EAAE,aAAa,CAAC;IAE3B,UAAU,MAAM;QACd,IAAI,EAAE,OAAO,CAAC;QACd;;;;;;WAMG;QACH,KAAK,EAAE,aAAa,CAAC;KACtB;IAED;;;;;;OAMG;IACH,UAAU,QAAQ;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,OAAO;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,KAAK;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,OAAO;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;CACF"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,CAAC,MAAM,CAAC;IACb,MAAM,IAAI,EAAE,OAAO,CAAC;IACpB,MAAM,KAAK,EAAE,aAAa,CAAC;IAE3B,UAAU,MAAM;QACd,IAAI,EAAE,OAAO,CAAC;QACd;;;;;;WAMG;QACH,KAAK,EAAE,aAAa,CAAC;KACtB;IAED;;;;;;OAMG;IACH,UAAU,QAAQ;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;QAE5B;;;;;;WAMG;QACH,aAAa,IAAI,MAAM,CAAC;QAExB;;;;;WAKG;QACH,OAAO,IAAI,IAAI,CAAC;QAEhB;;;;;;WAMG;QACH,KAAK,IAAI,QAAQ,CAAC;KACnB;IAED;;;;;;OAMG;IACH,UAAU,OAAO;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,KAAK;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,MAAM;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,OAAO;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;CACF"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * 设置延迟wait毫米后执行fun方法,返回fun的返回值
3
+ *
4
+ * @author lxm
5
+ * @date 2023-03-06 08:20:57
6
+ * @export
7
+ * @template T
8
+ * @param {number} wait
9
+ * @param {T} fun
10
+ * @param {any[]} params
11
+ * @returns {*} {Promise<ReturnType<T>>}
12
+ */
13
+ export declare function awaitTimeout<T extends (...args: any) => any>(wait: number, fun?: T, params?: any[]): Promise<ReturnType<T> | undefined>;
14
+ //# sourceMappingURL=await-timeout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"await-timeout.d.ts","sourceRoot":"","sources":["../../../src/utils/sync/await-timeout.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,EAChE,IAAI,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,CAAC,EACP,MAAM,CAAC,EAAE,GAAG,EAAE,GACb,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CASpC"}
@@ -0,0 +1,23 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /**
3
+ * 设置延迟wait毫米后执行fun方法,返回fun的返回值
4
+ *
5
+ * @author lxm
6
+ * @date 2023-03-06 08:20:57
7
+ * @export
8
+ * @template T
9
+ * @param {number} wait
10
+ * @param {T} fun
11
+ * @param {any[]} params
12
+ * @returns {*} {Promise<ReturnType<T>>}
13
+ */
14
+ export async function awaitTimeout(wait, fun, params) {
15
+ await new Promise(resolve => {
16
+ setTimeout(() => {
17
+ resolve(true);
18
+ }, wait);
19
+ });
20
+ if (fun) {
21
+ return fun(...(params || []));
22
+ }
23
+ }
@@ -1,2 +1,3 @@
1
+ export { awaitTimeout } from './await-timeout';
1
2
  export { CountLatch } from './count-latch';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/sync/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/sync/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
@@ -1 +1,2 @@
1
+ export { awaitTimeout } from './await-timeout';
1
2
  export { CountLatch } from './count-latch';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/core",
3
- "version": "0.0.3-beta.3",
3
+ "version": "0.0.3-beta.5",
4
4
  "description": "核心包",
5
5
  "type": "module",
6
6
  "main": "out/index.js",
@@ -30,20 +30,24 @@
30
30
  "author": "chitanda",
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
- "axios": "^1.2.6",
33
+ "axios": "^1.3.4",
34
+ "lodash-es": "^4.17.21",
34
35
  "loglevel": "^1.8.1",
35
36
  "pluralize": "^8.0.0",
36
- "qs": "^6.11.0"
37
+ "qs": "^6.11.1",
38
+ "qx-util": "^0.4.8",
39
+ "ramda": "^0.28.0"
37
40
  },
38
41
  "devDependencies": {
39
42
  "@types/pluralize": "^0.0.29",
40
- "@types/qs": "^6.9.7",
41
- "lodash-es": "^4.17.21",
42
- "qx-util": "^0.4.4"
43
+ "@types/qs": "^6.9.7"
43
44
  },
44
45
  "peerDependencies": {
45
46
  "lodash-es": "^4.17.21",
46
- "qx-util": "^0.4.4"
47
+ "pluralize": "^8.0.0",
48
+ "qs": "^6.11.0",
49
+ "qx-util": "^0.4.8",
50
+ "ramda": "^0.28.0"
47
51
  },
48
- "gitHead": "5db494cb73fa734ceb7d8988d63d886ddec2afee"
52
+ "gitHead": "51751136cf908d383f2f1bf48afa590e7c8228f7"
49
53
  }
@@ -1,3 +1,5 @@
1
+ import { clone } from 'ramda';
2
+
1
3
  /**
2
4
  * 上下文处理类
3
5
  *
@@ -10,47 +12,65 @@ export class IBizContext implements IContext {
10
12
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
13
  [key: string | symbol]: any;
12
14
 
15
+ /**
16
+ * clone 后引用的上下文实例,需要在实例销毁时,同时销毁
17
+ *
18
+ * @author chitanda
19
+ * @date 2023-03-13 16:03:31
20
+ * @protected
21
+ * @type {IBizContext[]}
22
+ */
23
+ protected declare _associationContext: IBizContext[];
24
+
13
25
  /**
14
26
  * 修改的父上下文
15
27
  *
16
28
  * @author lxm
17
29
  * @date 2022-12-08 18:12:16
18
30
  * @protected
19
- * @type {IContext}
31
+ * @type {IDatum}
20
32
  */
21
- protected _context!: IContext;
33
+ protected declare _context: IDatum;
22
34
 
23
35
  /**
24
36
  * 父的上下文源对象
25
37
  *
26
38
  * @author lxm
27
39
  * @date 2022-12-08 18:12:31
28
- * @type {IBizContext}
40
+ * @type {IContext}
29
41
  */
30
- declare _parent?: IBizContext;
42
+ declare _parent?: IContext;
31
43
 
32
44
  /**
33
45
  * Creates an instance of IBizContext.
34
46
  *
35
47
  * @author chitanda
36
48
  * @date 2022-07-14 10:07:15
37
- * @param {IContext} [context={}] 自身的上下文
38
- * @param {IBizContext} [parent]
49
+ * @param {IDatum} [context={}] 自身的上下文
50
+ * @param {IContext} [parent]
39
51
  */
40
52
  // eslint-disable-next-line default-param-last
41
- constructor(context: IContext = {}, parent?: IBizContext) {
53
+ private constructor(context: IDatum = {}, parent?: IContext) {
54
+ Object.defineProperty(this, '_associationContext', {
55
+ enumerable: false,
56
+ value: [],
57
+ });
58
+
42
59
  if (parent) {
43
60
  // eslint-disable-next-line @typescript-eslint/no-this-alias
44
61
  const self = this;
62
+
45
63
  // 定义私有变量,存放父上下文源对象
46
64
  Object.defineProperty(this, '_parent', {
47
65
  enumerable: false,
66
+ writable: true,
48
67
  value: parent,
49
68
  });
50
69
 
51
70
  // 定义私有变量,用于存储对父已有上下文的修改。
52
71
  Object.defineProperty(this, '_context', {
53
72
  enumerable: false,
73
+ writable: true,
54
74
  value: {},
55
75
  });
56
76
  // 监控父上下文参数,自身不存在时从父取
@@ -85,10 +105,10 @@ export class IBizContext implements IContext {
85
105
  *
86
106
  * @author lxm
87
107
  * @date 2022-12-08 17:12:26
88
- * @returns {*} {IContext}
108
+ * @returns {*} {IDatum}
89
109
  */
90
- getOwnContext(): IContext {
91
- const result: IContext = {};
110
+ getOwnContext(): IDatum {
111
+ const result: IDatum = {};
92
112
  Object.keys(this).forEach(key => {
93
113
  // 父没有的,或者修改了父的上下文
94
114
  // 父不存在则返回所有自身的属性
@@ -102,4 +122,45 @@ export class IBizContext implements IContext {
102
122
  });
103
123
  return result;
104
124
  }
125
+
126
+ /**
127
+ * 销毁当前上下文对象
128
+ *
129
+ * @author chitanda
130
+ * @date 2023-03-13 15:03:04
131
+ */
132
+ destroy(): void {
133
+ this._parent = undefined;
134
+ this._context = {};
135
+ this._associationContext.forEach(item => {
136
+ item.destroy();
137
+ });
138
+ }
139
+
140
+ /**
141
+ * 在非视图中,需要断开视图上下文联系时。只能使用 clone 创建新的局部上下文
142
+ *
143
+ * @author chitanda
144
+ * @date 2023-03-13 16:03:13
145
+ * @return {*} {IBizContext}
146
+ */
147
+ clone(): IBizContext {
148
+ const newContext = new IBizContext(clone(this._context), this._parent);
149
+ this._associationContext.push(newContext);
150
+ return newContext;
151
+ }
152
+
153
+ /**
154
+ * 上下文只有在视图初始化时,调用 create 方法
155
+ *
156
+ * @author chitanda
157
+ * @date 2023-03-13 16:03:32
158
+ * @static
159
+ * @param {IDatum} [context]
160
+ * @param {IContext} [parent]
161
+ * @return {*} {IContext}
162
+ */
163
+ static create(context?: IDatum, parent?: IContext): IBizContext {
164
+ return new IBizContext(context, parent);
165
+ }
105
166
  }
package/src/types.ts CHANGED
@@ -27,6 +27,32 @@ declare global {
27
27
  */
28
28
  interface IContext {
29
29
  [key: string | symbol]: any;
30
+
31
+ /**
32
+ * 返回自身的上下文,独有的和与父有差异的
33
+ *
34
+ * @author chitanda
35
+ * @date 2023-03-13 17:03:10
36
+ * @return {*} {IDatum}
37
+ */
38
+ getOwnContext(): IDatum;
39
+
40
+ /**
41
+ * 销毁当前上下文
42
+ *
43
+ * @author chitanda
44
+ * @date 2023-03-13 17:03:37
45
+ */
46
+ destroy(): void;
47
+
48
+ /**
49
+ * 克隆当前上下文
50
+ *
51
+ * @author chitanda
52
+ * @date 2023-03-13 17:03:45
53
+ * @return {*} {IContext}
54
+ */
55
+ clone(): IContext;
30
56
  }
31
57
 
32
58
  /**
@@ -51,6 +77,17 @@ declare global {
51
77
  [key: string | symbol]: any;
52
78
  }
53
79
 
80
+ /**
81
+ * 数据
82
+ *
83
+ * @author chitanda
84
+ * @date 2023-03-13 17:03:50
85
+ * @interface IDatum
86
+ */
87
+ interface IDatum {
88
+ [key: string | symbol]: any;
89
+ }
90
+
54
91
  /**
55
92
  * 任意对象结构
56
93
  *
@@ -0,0 +1,27 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /**
3
+ * 设置延迟wait毫米后执行fun方法,返回fun的返回值
4
+ *
5
+ * @author lxm
6
+ * @date 2023-03-06 08:20:57
7
+ * @export
8
+ * @template T
9
+ * @param {number} wait
10
+ * @param {T} fun
11
+ * @param {any[]} params
12
+ * @returns {*} {Promise<ReturnType<T>>}
13
+ */
14
+ export async function awaitTimeout<T extends (...args: any) => any>(
15
+ wait: number,
16
+ fun?: T,
17
+ params?: any[],
18
+ ): Promise<ReturnType<T> | undefined> {
19
+ await new Promise(resolve => {
20
+ setTimeout(() => {
21
+ resolve(true);
22
+ }, wait);
23
+ });
24
+ if (fun) {
25
+ return fun(...(params || []));
26
+ }
27
+ }
@@ -1 +1,2 @@
1
+ export { awaitTimeout } from './await-timeout';
1
2
  export { CountLatch } from './count-latch';