@ibiz-template/core 0.0.3-beta.5 → 0.0.4-beta.2

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 (38) hide show
  1. package/dist/index.esm.js +2207 -0
  2. package/dist/index.system.min.js +1 -0
  3. package/out/constant/core/core.js +2 -1
  4. package/out/context/index.d.ts.map +1 -1
  5. package/out/context/index.js +1 -1
  6. package/out/environment/environment.d.ts.map +1 -1
  7. package/out/environment/environment.js +1 -0
  8. package/out/error/index.d.ts +2 -0
  9. package/out/error/index.d.ts.map +1 -1
  10. package/out/error/index.js +2 -0
  11. package/out/error/model-error/model-error.d.ts +22 -0
  12. package/out/error/model-error/model-error.d.ts.map +1 -0
  13. package/out/error/model-error/model-error.js +24 -0
  14. package/out/error/runtime-model-error/runtime-model-error.d.ts +23 -0
  15. package/out/error/runtime-model-error/runtime-model-error.d.ts.map +1 -0
  16. package/out/error/runtime-model-error/runtime-model-error.js +25 -0
  17. package/out/interface/i-environment/i-environment.d.ts +7 -0
  18. package/out/interface/i-environment/i-environment.d.ts.map +1 -1
  19. package/out/types.d.ts +8 -0
  20. package/out/types.d.ts.map +1 -1
  21. package/out/utils/index.d.ts +1 -0
  22. package/out/utils/index.d.ts.map +1 -1
  23. package/out/utils/index.js +1 -0
  24. package/out/utils/string-util/string-util.js +2 -1
  25. package/out/utils/types/types.d.ts +11 -0
  26. package/out/utils/types/types.d.ts.map +1 -0
  27. package/out/utils/types/types.js +1 -0
  28. package/package.json +7 -6
  29. package/src/context/index.ts +4 -1
  30. package/src/environment/environment.ts +1 -0
  31. package/src/error/index.ts +2 -0
  32. package/src/error/model-error/model-error.ts +24 -0
  33. package/src/error/runtime-model-error/runtime-model-error.ts +25 -0
  34. package/src/interface/i-environment/i-environment.ts +8 -0
  35. package/src/types.ts +9 -0
  36. package/src/utils/index.ts +1 -0
  37. package/src/utils/types/types.ts +9 -0
  38. package/dist/system/index.system.js +0 -1
@@ -0,0 +1 @@
1
+ System.register(["ramda","lodash-es","qx-util","axios","qs","pluralize"],(function(e){"use strict";var t,n,s,r,o,i,a,c,l,u,d;return{setters:[function(e){t=e.clone},function(e){n=e.debounce,s=e.merge,r=e.uniqueId,e.round,e.cloneDeep,o=e.isFunction},function(e){i=e.getCookie,a=e.notNilEmpty},function(e){c=e.AxiosHeaders,l=e.default},function(e){u=e.stringify},function(e){d=e.default}],execute:function(){e({awaitTimeout:async function(e,t,n){if(await new Promise((t=>{setTimeout((()=>{t(!0)}),e)})),t)return t(...n||[])},calcMimeByFileName:G,colorBlend:function(e,t,n=.5,s="hex"){e=e.trim(),t=t.trim();const r=K(e),o=K(t),i=[Z((1-n)*r[0]+n*o[0]),Z((1-n)*r[1]+n*o[1]),Z((1-n)*r[2]+n*o[2]),(1-n)*r[3]+n*o[3]];if("hex"===s){const e=[i[0].toString(16),i[1].toString(16),i[2].toString(16),0===i[3]?"00":Z(255*i[3]).toString(16)];return`#${e[0]}${e[1]}${e[2]}${e[3]}`}return`rgb(${i[0]} ${i[1]} ${i[2]} / ${i[3]})`},debounce:function(e,t,n){let s;return function(...r){if(s&&clearTimeout(s),n){const n=!s;s=setTimeout((()=>{s=null}),t),n&&e.apply(this,r)}else s=setTimeout((()=>{e.apply(this,r)}),t)}},debounceAndAsyncMerge:function(e,t,s){let r,o=[];const i=n((async(...t)=>{r=void 0;try{const n=await e(...t);return o.forEach((e=>{e.resolve(n)})),o=[],n}catch(e){o.forEach((t=>{t.reject(e)})),o=[]}}),s);return async(...e)=>{let n=e;return r&&(n=t(r,n)),r=n,i(...n),new Promise(((e,t)=>{o.push({resolve:e,reject:t})}))}},debounceAndMerge:function(e,t,s){let r;const o=n(((...t)=>(r=void 0,e(...t))),s);return(...e)=>{let n=e;return r&&(n=t(r,n)),r=n,o(...n)}},downloadFileFromBlob:function(e,t){const n=G(t),s=new Blob([e],{type:n}),r=URL.createObjectURL(s),o=document.createElement("a");o.href=r,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)},eventPath:H,fileListToArr:J,getToken:A,install:function(){if(window.ibiz)throw new Error("ibiz 已经存在, 无需重复安装");window.ibiz=new Q,window.___fc=new ee},isEventInside:W,isImage:function(e){const t=e.split(".").pop();if(!t)return!1;return[".jpeg","jpg","gif","png","bmp","svg"].includes(t)},isOverlap:function(e,t){return Array.from(new Set([...e,...t])).length!==e.length+t.length},listenJSEvent:V,onClickOutside:function(e,t,n={}){const{window:s=X,ignore:r=[],capture:o=!0}=n;if(!e)throw new I("target元素不存在");if(!s)throw new I("找不到window");let i=!0;const a=t=>![e,...r].some((e=>W(t,e)));let c=!1;let l;const u=e=>{c||(s.clearTimeout(l),i&&a(e)&&t(e))},d=[V(s,"click",u,{passive:!0,capture:o}),V(s,"pointerdown",(e=>{c||(i=a(e))}),{passive:!0}),V(s,"pointerup",(e=>{if(!c&&0===e.button){const t=H(e);e.composedPath=()=>t,l=s.setTimeout((()=>u(e)),50)}}),{passive:!0})].filter(Boolean);return{stop:()=>d.forEach((e=>e())),pause:()=>{c=!0},proceed:()=>{c=!1}}},plural:B,pluralLower:function(e){return B(e).toLowerCase()},selectFile:Y,setRemoteStyle:async function(e){try{const t=await ibiz.net.get(e),n=document.createElement("style");n.setAttribute("title","app-style-css"),n.innerText=t.data,document.head.appendChild(n)}catch(t){N.debug("加载远程样式表失败",e)}},throttle:function(e,t){let n=null;return function(...s){n||(n=setTimeout((()=>{e.apply(this,s),n=null}),t))}},toDisposable:U,uploadFile:function(e){const t=s({multiple:!0,accept:"",separate:!0,beforeUpload:(e,t)=>!0,finish:e=>{},success:(e,t)=>{},error:(e,t)=>{},progress:e=>{}},e),n=async e=>{const n=e.map((e=>({status:"uploading",name:e.name,uid:r(),percentage:0})));if(!t.beforeUpload(e,n))return n.forEach((e=>{e.status="cancel"})),ibiz.log.debug("取消上传",n),n;try{const s=await(async(e,n)=>{if(t.request&&o(t.request))return t.request(e);const s=new FormData;throw e.forEach((e=>{s.append("file",e)})),new Error("多应用模式等待重新实现请求")})(e);n.forEach((e=>{e.status="finished"})),t.success(n,s),n.forEach((e=>{e.response=s}))}catch(s){n.forEach((e=>{e.status="fail"})),t.error(n,s),n.forEach((e=>{e.error=s})),ibiz.log.error(s),ibiz.log.error(`${e.map((e=>e.name)).join(",")}上传失败`)}return n};Y({accept:t.accept,multiple:t.multiple,onSelected:e=>{(async e=>{const s=t.separate?e.map((e=>[e])):[e],r=await Promise.allSettled(s.map((async e=>n(e)))),o=[];r.forEach((e=>{"fulfilled"===e.status&&o.push(...e.value)})),t.finish(o)})(e)}})}});var h,p,f=Object.create,m=Object.defineProperty,g=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,y=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty,b=(h={"../../node_modules/.pnpm/loglevel@1.8.1/node_modules/loglevel/lib/loglevel.js"(e,t){var n,s;n=e,s=function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),s=["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 o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function i(s){return"debug"===s&&(s="log"),typeof console!==t&&("trace"===s&&n?o:void 0!==console[s]?r(console,s):void 0!==console.log?r(console,"log"):e)}function a(t,n){for(var r=0;r<s.length;r++){var o=s[r];this[o]=r<t?e:this.methodFactory(o,t,n)}this.log=this.debug}function c(e,n,s){return function(){typeof console!==t&&(a.call(this,n,s),this[e].apply(this,arguments))}}function l(e,t,n){return i(e)||c.apply(this,arguments)}function u(e,n,r){var o,i=this;n=null==n?"WARN":n;var c="loglevel";function u(){var e;if(typeof window!==t&&c){try{e=window.localStorage[c]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,s=n.indexOf(encodeURIComponent(c)+"=");-1!==s&&(e=/^([^;]+)/.exec(n.slice(s))[1])}catch(e){}return void 0===i.levels[e]&&(e=void 0),e}}"string"==typeof e?c+=":"+e:"symbol"==typeof e&&(c=void 0),i.name=e,i.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},i.methodFactory=r||l,i.getLevel=function(){return o},i.setLevel=function(n,r){if("string"==typeof n&&void 0!==i.levels[n.toUpperCase()]&&(n=i.levels[n.toUpperCase()]),!("number"==typeof n&&n>=0&&n<=i.levels.SILENT))throw"log.setLevel() called with invalid level: "+n;if(o=n,!1!==r&&function(e){var n=(s[e]||"silent").toUpperCase();if(typeof window!==t&&c){try{return void(window.localStorage[c]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(c)+"="+n+";"}catch(e){}}}(n),a.call(i,n,e),typeof console===t&&n<i.levels.SILENT)return"No console available for logging"},i.setDefaultLevel=function(e){n=e,u()||i.setLevel(e,!1)},i.resetLevel=function(){i.setLevel(n,!1),function(){if(typeof window!==t&&c){try{return void window.localStorage.removeItem(c)}catch(e){}try{window.document.cookie=encodeURIComponent(c)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}()},i.enableAll=function(e){i.setLevel(i.levels.TRACE,e)},i.disableAll=function(e){i.setLevel(i.levels.SILENT,e)};var d=u();null==d&&(d=n),i.setLevel(d,!1)}var d=new u,h={};d.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=h[e];return t||(t=h[e]=new u(e,d.getLevel(),d.methodFactory)),t};var p=typeof window!==t?window.log:void 0;return d.noConflict=function(){return typeof window!==t&&window.log===d&&(window.log=p),d},d.getLoggers=function(){return h},d.default=d,d},"function"==typeof define&&define.amd?define(s):"object"==typeof t&&t.exports?t.exports=s():n.log=s()}},function(){return p||(0,h[w(h)[0]])((p={exports:{}}).exports,p),p.exports}),_=class{constructor(e){this.element=e,this.next=_.Undefined,this.prev=_.Undefined}},E=_;E.Undefined=new _(void 0);var R=e("LinkedList",class{constructor(){this._first=E.Undefined,this._last=E.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===E.Undefined}clear(){let e=this._first;for(;e!==E.Undefined;){const{next:t}=e;e.prev=E.Undefined,e.next=E.Undefined,e=t}this._first=E.Undefined,this._last=E.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){const n=new E(e);if(this._first===E.Undefined)this._first=n,this._last=n;else if(t){const e=this._last;this._last=n,n.prev=e,e.next=n}else{const e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(n))}}shift(){if(this._first===E.Undefined)return;const e=this._first.element;return this._remove(this._first),e}pop(){if(this._last===E.Undefined)return;const e=this._last.element;return this._remove(this._last),e}_remove(e){if(e.prev!==E.Undefined&&e.next!==E.Undefined){const t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===E.Undefined&&e.next===E.Undefined?(this._first=E.Undefined,this._last=E.Undefined):e.next===E.Undefined?(this._last=this._last.prev,this._last.next=E.Undefined):e.prev===E.Undefined&&(this._first=this._first.next,this._first.prev=E.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==E.Undefined;)yield e.element,e=e.next}});function x(e){const t=this;let n,s=!1;return function(){return s||(s=!0,n=e.apply(t,arguments)),n}}function U(e){return{dispose:x((()=>{e()}))}}var C=e("CommandsRegistry",class{constructor(){this.commands=new Map}registerCommand(e,t,n){if(!e)throw new Error("invalid command");if("string"==typeof e){if(!t)throw new Error("invalid command");return this.registerCommand({id:e,handler:t,opts:n})}const{id:s}=e;let r=this.commands.get(s);r||(r=new R,this.commands.set(s,r));const o=r.unshift(e);return U((()=>{o();const e=this.commands.get(s);(null==e?void 0:e.isEmpty())&&this.commands.delete(s)}))}hasCommand(e){return this.commands.has(e)}getCommand(e){const t=this.commands.get(e);if(t&&!t.isEmpty())return t[Symbol.iterator]().next().value}getCommands(){const e=new Map,t=this.commands.keys();for(const n of t){const t=this.getCommand(n);t&&e.set(n,t)}return e}getCommandOpt(e){const t=this.getCommand(e);return null==t?void 0:t.opts}}),$=e("CommandController",class{constructor(){this.commandRegister=new C}register(e,t,n){return this.commandRegister.registerCommand(e,t,n)}async execute(e,...t){const n=this.commandRegister.getCommand(e);if(n)return n.handler(...t);throw new Error(`未注册指令: ${e},请先注册指令`)}hasCommand(e,t){const n=!!this.commandRegister.hasCommand(e);if(!0===t&&!0===n)throw new Error(`未注册指令: ${e},请先注册指令`);return n}getCommandOpts(e){return this.commandRegister.getCommandOpt(e)}}),k=(e("commands",new $),e("CoreConst",class{}));k.DEFAULT_MODEL_SERVICE_TAG="default",k.TOKEN="access_token",k.TOKEN_EXPIRES="access_token_expires";var O=e("NOOP",(()=>{})),P=(e("HttpStatusMessageConst",{200:"服务器成功返回请求的数据。",201:"新建或修改数据成功。",202:"一个请求已经进入后台排队(异步任务)。",204:"删除数据成功。",400:"发出的请求有错误,服务器没有进行新建或修改数据的操作。",401:"用户没有权限(令牌、用户名、密码错误)。",403:"用户得到授权,但是访问是被禁止的。",404:"发出的请求针对的是不存在的记录,服务器没有进行操作。",406:"请求的格式不可得。",410:"请求的资源被永久删除,且不会再得到的。",422:"当创建一个对象时,发生一个验证错误。",500:"服务器发生错误,请检查服务器。",502:"网关错误。",503:"服务不可用,服务器暂时过载或维护。",504:"网关超时。"}),e("LoginMode",(e=>(e.DEFAULT="DEFAULT",e.CUSTOM="CUSTOM",e.CAS="CAS",e))(P||{}))),T=e("MenuPermissionMode",(e=>(e.MIXIN="MIXIN",e.RESOURCE="RESOURCE",e.RT="RT",e))(T||{})),L=e("IBizContext",class{constructor(e={},t){if(Object.defineProperty(this,"_associationContext",{enumerable:!1,value:[]}),t){const e=this;Object.defineProperty(this,"_parent",{enumerable:!1,writable:!0,value:t}),Object.defineProperty(this,"_context",{enumerable:!1,writable:!0,value:{}});const n={};Object.keys(t).forEach((s=>{n[s]={enumerable:!0,set(t){e._context[s]=null==t?null:t},get:()=>void 0!==e._context[s]?e._context[s]:t[s]}})),Object.defineProperties(this,n)}Object.assign(this,e)}getOwnContext(){const e={};return Object.keys(this).forEach((t=>{this._parent&&Object.prototype.hasOwnProperty.call(this._parent,t)&&!Object.prototype.hasOwnProperty.call(this._context,t)||(e[t]=this[t])})),e}destroy(){this._parent=void 0,this._context={},this._associationContext.forEach((e=>{e.destroy()}))}clone(){const e=new L(t(this.getOwnContext()),this._parent);return this._associationContext.push(e),e}static create(e,t){return new L(e,t)}}),j=e("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:"MIXIN",enablePermission:!0,routePlaceholder:"-",enableWfAllHistory:!1}),S=e("HttpError",class{constructor(e){this.name="HttpError";const t=e.response;this.response=e.response,t?(t.data?this.message=t.data.message:this.message=t.statusText,this.message||(this.message="网络异常,请稍后重试!"),this.status=t.status):(this.message=e.message,this.status=500)}}),I=(e("ModelError",class extends Error{constructor(e,t){super(`「${e.id}」模型${t?`: ${t}`:""}`),this.model=e,this.name="未支持的模型"}}),e("RuntimeError",class{constructor(e){this.message=e,this.name="Runtime Error"}}));e("RuntimeModelError",class extends Error{constructor(e,t){super(`「${e.id}」模型${t?`: ${t}`:""}`),this.model=e,this.name="模型配置缺失"}});function A(){return i(k.TOKEN)}var z=e("Interceptor",class{async onBeforeRequest(e){return e}onRequestError(e){return Promise.reject(e)}async onResponseSuccess(e){return e}onResponseError(e){return Promise.reject(e)}use(e){this.requestTag=e.interceptors.request.use(this.onBeforeRequest,this.onRequestError),this.responseTag=e.interceptors.response.use(this.onResponseSuccess,this.onResponseError)}eject(e){this.requestTag&&e.interceptors.request.eject(this.requestTag),this.responseTag&&e.interceptors.response.eject(this.responseTag)}}),M=e("CoreInterceptor",class extends z{async onBeforeRequest(e){await super.onBeforeRequest(e);const{headers:t}=e;t.set("Authorization",`Bearer ${A()}`);const{orgData:n}=ibiz;return n&&(n.systemid&&t.set("srfsystemid",n.systemid),n.orgid&&t.set("srforgid",n.orgid)),e}}),N=e("Logger",((e,t,n)=>(n=null!=e?f(y(e)):{},((e,t,n,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of w(t))v.call(e,r)||r===n||m(e,r,{get:()=>t[r],enumerable:!(s=g(t,r))||s.enumerable});return e})(!t&&e&&e.__esModule?n:m(n,"default",{value:e,enumerable:!0}),e)))(b(),1));function q(e,t,n,s,r){let o=`${e}-${t}`;return n&&(o+=`-${n}`),s&&(o+=`__${s}`),r&&(o+=`--${r}`),o}e("Namespace",class{constructor(e,t){this.block=e,this.namespace=t||"ibiz"}b(e=""){return q(this.namespace,this.block,e,"","")}e(e){return e?q(this.namespace,this.block,"",e,""):""}m(e){return e?q(this.namespace,this.block,"","",e):""}be(e,t){return e&&t?q(this.namespace,this.block,e,t,""):""}em(e,t){return e&&t?q(this.namespace,this.block,"",e,t):""}bm(e,t){return e&&t?q(this.namespace,this.block,e,"",t):""}bem(e,t,n){return e&&t&&n?q(this.namespace,this.block,e,t,n):""}is(e,t){return e&&t?`is-${e}`:""}cssVar(e){const t={};for(const n in e)e[n]&&(t[this.cssVarName(n)]=e[n]);return t}cssVarBlock(e){const t={};for(const n in e)e[n]&&(t[this.cssVarBlockName(n)]=e[n]);return t}cssVarName(e){return`--${this.namespace}-${e}`}cssVarBlockName(e){return`--${this.namespace}-${this.block}-${e}`}}),e("HttpResponse",class{constructor(e,t,n){this.local=!0,this.ok=!1,this.headers={},this.config={headers:new c},this.data=e,this.status=t||200,this.statusText=n||"",this.status>=200&&this.status<300&&(this.ok=!0)}});var F=e("Net",class{constructor(e){this.urlReg=/^http[s]?:\/\/[^\s]*/,this.interceptors=new Map,this.instance=l.create(e),this.addInterceptor("Default",new M)}addInterceptor(e,t){t.use(this.instance),this.interceptors.set(e,t)}removeInterceptor(e){const t=this.interceptors.get(e);t&&(t.eject(this.instance),this.interceptors.delete(e))}get presetConfig(){return{baseURL:this.instance.defaults.baseURL||`${ibiz.env.baseUrl}/${ibiz.env.appId}`,headers:{"Content-Type":"application/json;charset=UTF-8",Accept:"application/json"}}}mergeConfig(...e){const t=this.presetConfig;if(0===e.length)return t;const{url:n}=e[0];return n&&this.urlReg.test(n)&&delete t.baseURL,s(t,...e)}async post(e,t,n={},s={}){e=this.handleAppPresetParam(e,n);try{const n=await this.request(e,{method:"post",data:t,headers:s});return this.doResponseResult(n)}catch(e){throw new S(e)}}async get(e,t={},n={},r={}){e=this.attachUrlParam(e,t);try{const t=await this.request(e,s({method:"get",headers:n},r));return this.doResponseResult(t)}catch(e){throw new S(e)}}async delete(e,t,n={}){e=this.handleAppPresetParam(e,t);try{const t=await this.request(e,{method:"delete",headers:n});return this.doResponseResult(t)}catch(e){throw new S(e)}}async put(e,t,n={},s={}){e=this.handleAppPresetParam(e,n);try{const n=await this.request(e,{method:"put",data:t,headers:s});return this.doResponseResult(n)}catch(e){throw new S(e)}}async getModel(e,t={}){try{const n=await this.instance.get(e,{headers:t});return this.doResponseResult(n)}catch(e){throw new S(e)}}async request(e,t={}){try{const n=await this.instance.request(this.mergeConfig({url:e},t));return this.doResponseResult(n)}catch(e){throw new S(e)}}axios(e){return l(e)}doResponseResult(e){const t=e;return t.status>=200&&t.status<=299&&(t.ok=!0),t}handleAppPresetParam(e,t){if(t){return Object.keys(t).forEach((e=>{e.startsWith("srf")&&a(t[e])&&t[e]})),this.attachUrlParam(e,t)}return e}attachUrlParam(e,t){const n=u(t);return a(n)&&(e=e.endsWith("?")||-1!==e.indexOf("?")&&e.endsWith("&")?`${e}${n}`:-1===e.indexOf("?")||e.endsWith("&")?`${e}?${n}`:`${e}&${n}`),e}});function B(e){return d(e)}var D=e("StringUtil",class{static fill(e,t,n){if(a(e)){if(a(t)){const n=e.match(this.contextReg);null==n||n.forEach((n=>{const s=n.slice(10,n.length-1);e=e.replace(`\${context.${s}}`,t[s]||"")}))}if(a(n)){const t=e.match(this.dataReg);null==t||t.forEach((t=>{const s=t.slice(7,t.length-1);e=e.replace(`\${data.${s}}`,n[s]||"")}))}}return e}});D.contextReg=/\$\{context.[a-zA-Z_$][a-zA-Z0-9_$]{1,}\}/g,D.dataReg=/\$\{data.[a-zA-Z_$][a-zA-Z0-9_$]{1,}\}/g;e("UrlHelper",class{static get routeBase(){return`${this.appBase}/#`}static get appBase(){const{origin:e,pathname:t}=window.location;return`${e}${t}`.replace(/\/$/,"")}static get routePath(){return window.location.hash.replace("#","")}static get fullPath(){return window.location.href}});function H(e){const t=e.composedPath&&e.composedPath()||e.path;if(null!=t)return t;return[e.target].concat(function e(t,n=[]){const s=t.parentNode;return s?e(s,n.concat([s])):n}(e.target))}function V(e,t,n,s={}){e.addEventListener(t,n,s);let r=()=>{e.removeEventListener(t,n,s),r=O};return()=>{r()}}function W(e,t){return t&&(e.target===t||H(e).includes(t))}var X="undefined"!=typeof window?window:void 0;var Z=Math.round;function K(e){const t=e.length,n=[];if("rgb"===e.slice(0,3).toLowerCase()){const t=e.match(/([\d|.%]{1,3})/g);n[0]=parseInt(t[0],10),n[1]=parseInt(t[1],10),n[2]=parseInt(t[2],10),n[3]=t[3]?-1!==t[3].indexOf("%")?parseInt(t[3],10)/100:parseFloat(t[3]):1}else{let s;s=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]=s>>16&255,n[1]=s>>8&255,n[2]=255&s,n[3]=9===t||5===t?Z((s>>24&255)/255*1e4)/1e4:1}return n}function G(e){let t="";switch(e.split(".").pop()){case".wps":t="application/kswps";break;case".doc":t="application/msword";break;case".docx":t="application/vnd.openxmlformats-officedocument.wordprocessingml.document";break;case".txt":t="text/plain";break;case".zip":t="application/zip";break;case".png":t="image/png";break;case".gif":t="image/gif";break;case".jpeg":case".jpg":t="image/jpeg";break;case".rtf":t="application/rtf";break;case".avi":t="video/x-msvideo";break;case".gz":t="application/x-gzip";break;case".tar":t="application/x-tar";break;case".xlsx":t="application/vnd.ms-excel";break;default:t=""}return t}function J(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t}function Y(e){const t=s({multiple:!0,accept:""},e),n=document.createElement("input");n.setAttribute("type","file"),n.setAttribute("multiple",`${t.multiple}`),n.setAttribute("accept",t.accept),n.onchange=e=>{const n=e.target,s=n.files?J(n.files):[];0!==s.length&&(t.onSelected(s),n.value="")},document.body.appendChild(n),n.click(),document.body.removeChild(n)}e("CountLatch",class{constructor(){this.promise=null,this.resolve=null,this.count=0}startPromise(){this.promise=new Promise((e=>{this.resolve=e}))}endPromise(){this.resolve&&(this.resolve(),this.resolve=null,this.promise=null)}lock(){this.count+=1,this.promise||this.startPromise()}unlock(){if(this.count<1)throw new I("lock和unlock次数不匹配!");this.count-=1,0===this.count&&this.endPromise()}async await(){this.promise&&await this.promise}});var Q=e("IBizSys",class{constructor(){this.env=j,this.log=N,this.net=new F,this.commands=new $}}),ee=e("FactoryCenter",class{})}}}));
@@ -6,7 +6,7 @@
6
6
  * @export
7
7
  * @enum {number}
8
8
  */
9
- export class CoreConst {
9
+ class CoreConst {
10
10
  }
11
11
  /**
12
12
  * 默认模型服务标识
@@ -29,3 +29,4 @@ CoreConst.TOKEN = 'access_token';
29
29
  * @memberof CoreConst
30
30
  */
31
31
  CoreConst.TOKEN_EXPIRES = 'access_token_expires';
32
+ export { CoreConst };
@@ -1 +1 @@
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
+ {"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;IASpB;;;;;;;;;OASG;IACH,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,WAAW;CAGhE"}
@@ -105,7 +105,7 @@ export class IBizContext {
105
105
  * @return {*} {IBizContext}
106
106
  */
107
107
  clone() {
108
- const newContext = new IBizContext(clone(this._context), this._parent);
108
+ const newContext = new IBizContext(clone(this.getOwnContext()), this._parent);
109
109
  this._associationContext.push(newContext);
110
110
  return newContext;
111
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/environment/environment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,YAiBzB,CAAC"}
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/environment/environment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,YAkBzB,CAAC"}
@@ -19,4 +19,5 @@ export const Environment = {
19
19
  menuPermissionMode: MenuPermissionMode.MIXIN,
20
20
  enablePermission: true,
21
21
  routePlaceholder: '-',
22
+ enableWfAllHistory: false,
22
23
  };
@@ -1,3 +1,5 @@
1
1
  export { HttpError } from './http-error/http-error';
2
+ export { ModelError } from './model-error/model-error';
2
3
  export { RuntimeError } from './runtime-error/runtime-error';
4
+ export { RuntimeModelError } from './runtime-model-error/runtime-model-error';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export { HttpError } from './http-error/http-error';
2
+ export { ModelError } from './model-error/model-error';
2
3
  export { RuntimeError } from './runtime-error/runtime-error';
4
+ export { RuntimeModelError } from './runtime-model-error/runtime-model-error';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 未支持的模型
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-08-30 16:08:03
6
+ * @export
7
+ * @class ModelError
8
+ */
9
+ export declare class ModelError extends Error {
10
+ model: any;
11
+ name: string;
12
+ /**
13
+ * Creates an instance of ModelError.
14
+ *
15
+ * @author chitanda
16
+ * @date 2022-08-30 16:08:38
17
+ * @param {IModelObject} model 模板未支持的模型
18
+ * @param {string} [msg]
19
+ */
20
+ constructor(model: any, msg?: string);
21
+ }
22
+ //# sourceMappingURL=model-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-error.d.ts","sourceRoot":"","sources":["../../../src/error/model-error/model-error.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,UAAW,SAAQ,KAAK;IAYhB,KAAK,EAAE,GAAG;IAX7B,IAAI,EAAE,MAAM,CAAY;IAExB;;;;;;;OAOG;gBAEgB,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM;CAG5C"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 未支持的模型
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-08-30 16:08:03
6
+ * @export
7
+ * @class ModelError
8
+ */
9
+ export class ModelError extends Error {
10
+ /**
11
+ * Creates an instance of ModelError.
12
+ *
13
+ * @author chitanda
14
+ * @date 2022-08-30 16:08:38
15
+ * @param {IModelObject} model 模板未支持的模型
16
+ * @param {string} [msg]
17
+ */
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ constructor(model, msg) {
20
+ super(`「${model.id}」模型${msg ? `: ${msg}` : ''}`);
21
+ this.model = model;
22
+ this.name = '未支持的模型';
23
+ }
24
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * 模型配置缺失
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-08-30 16:08:15
6
+ * @export
7
+ * @class DefectModelError
8
+ * @extends {Error}
9
+ */
10
+ export declare class RuntimeModelError extends Error {
11
+ model: any;
12
+ name: string;
13
+ /**
14
+ * Creates an instance of DefectModelError.
15
+ *
16
+ * @author chitanda
17
+ * @date 2022-08-30 16:08:58
18
+ * @param {IModelObject} model 丢失配置的模型
19
+ * @param {string} [msg] 缺失配置描述
20
+ */
21
+ constructor(model: any, msg?: string);
22
+ }
23
+ //# sourceMappingURL=runtime-model-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-model-error.d.ts","sourceRoot":"","sources":["../../../src/error/runtime-model-error/runtime-model-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAYvB,KAAK,EAAE,GAAG;IAX7B,IAAI,EAAE,MAAM,CAAY;IAExB;;;;;;;OAOG;gBAEgB,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM;CAG5C"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * 模型配置缺失
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-08-30 16:08:15
6
+ * @export
7
+ * @class DefectModelError
8
+ * @extends {Error}
9
+ */
10
+ export class RuntimeModelError extends Error {
11
+ /**
12
+ * Creates an instance of DefectModelError.
13
+ *
14
+ * @author chitanda
15
+ * @date 2022-08-30 16:08:58
16
+ * @param {IModelObject} model 丢失配置的模型
17
+ * @param {string} [msg] 缺失配置描述
18
+ */
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ constructor(model, msg) {
21
+ super(`「${model.id}」模型${msg ? `: ${msg}` : ''}`);
22
+ this.model = model;
23
+ this.name = '模型配置缺失';
24
+ }
25
+ }
@@ -145,5 +145,12 @@ export interface IEnvironment {
145
145
  * @memberof IEnvironment
146
146
  */
147
147
  routePlaceholder: string;
148
+ /**
149
+ * 是否让所有工作流history接口走all
150
+ *
151
+ * @type {boolean}
152
+ * @memberof IEnvironment
153
+ */
154
+ enableWfAllHistory: boolean;
148
155
  }
149
156
  //# sourceMappingURL=i-environment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i-environment.d.ts","sourceRoot":"","sources":["../../../src/interface/i-environment/i-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;;;;;OAMG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;OAMG;IACH,QAAQ,EAAE,YAAY,CAAC;IAEvB;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,SAAS,EAAE,SAAS,CAAC;IAErB;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;OAMG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;OAMG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAE1B;;;;;;OAMG;IACH,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
1
+ {"version":3,"file":"i-environment.d.ts","sourceRoot":"","sources":["../../../src/interface/i-environment/i-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;;;;;OAMG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;OAMG;IACH,QAAQ,EAAE,YAAY,CAAC;IAEvB;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,SAAS,EAAE,SAAS,CAAC;IAErB;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;OAMG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;OAMG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAE1B;;;;;;OAMG;IACH,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,kBAAkB,EAAE,OAAO,CAAC;CAC7B"}
package/out/types.d.ts CHANGED
@@ -23,6 +23,14 @@ declare global {
23
23
  */
24
24
  interface IContext {
25
25
  [key: string | symbol]: any;
26
+ /**
27
+ * 沙箱标识
28
+ *
29
+ * @author chitanda
30
+ * @date 2022-07-22 15:07:23
31
+ * @type {string}
32
+ */
33
+ srfsandbox?: string;
26
34
  /**
27
35
  * 返回自身的上下文,独有的和与父有差异的
28
36
  *
@@ -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;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"}
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,UAAU,CAAC,EAAE,MAAM,CAAC;QAEpB;;;;;;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"}
@@ -6,6 +6,7 @@ export { Net } from './net/net';
6
6
  export { plural, pluralLower } from './plural/plural';
7
7
  export { StringUtil } from './string-util/string-util';
8
8
  export * from './util/util';
9
+ export * from './types/types';
9
10
  export * from './url-helper/url-helper';
10
11
  export * from './event/event';
11
12
  export * from './click-outside/click-outside';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC"}
@@ -6,6 +6,7 @@ export { Net } from './net/net';
6
6
  export { plural, pluralLower } from './plural/plural';
7
7
  export { StringUtil } from './string-util/string-util';
8
8
  export * from './util/util';
9
+ export * from './types/types';
9
10
  export * from './url-helper/url-helper';
10
11
  export * from './event/event';
11
12
  export * from './click-outside/click-outside';
@@ -7,7 +7,7 @@ import { notNilEmpty } from 'qx-util';
7
7
  * @export
8
8
  * @class StringUtil
9
9
  */
10
- export class StringUtil {
10
+ class StringUtil {
11
11
  /**
12
12
  * 填充字符串中的数据
13
13
  *
@@ -55,3 +55,4 @@ StringUtil.contextReg = /\$\{context.[a-zA-Z_$][a-zA-Z0-9_$]{1,}\}/g;
55
55
  * @static
56
56
  */
57
57
  StringUtil.dataReg = /\$\{data.[a-zA-Z_$][a-zA-Z0-9_$]{1,}\}/g;
58
+ export { StringUtil };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 从T里面排除U里相同的属性后剩下的属性组成的类型
3
+ */
4
+ export type OmitObject<T, U> = {
5
+ [K in keyof Omit<T, keyof U>]: T[K];
6
+ };
7
+ /**
8
+ * 从T里面只获取索引类型为string的键
9
+ */
10
+ export type StrKeyOf<T> = Extract<keyof T, string>;
11
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/types/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/core",
3
- "version": "0.0.3-beta.5",
3
+ "version": "0.0.4-beta.2",
4
4
  "description": "核心包",
5
5
  "type": "module",
6
6
  "main": "out/index.js",
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "scripts": {
19
19
  "dev": "tsc --watch",
20
- "build": "npm run lint && npm run clean && npm run build:rollup && tsc --build",
20
+ "build": "npm run lint && node ./scripts/build.js && npm run build:rollup && tsc --build",
21
21
  "build:rollup": "rollup -c",
22
22
  "lint": "eslint 'src/**/*.ts'",
23
23
  "lint:fix": "eslint --fix 'src/**/*.ts'",
@@ -30,24 +30,25 @@
30
30
  "author": "chitanda",
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
- "axios": "^1.3.4",
33
+ "axios": "^1.3.5",
34
34
  "lodash-es": "^4.17.21",
35
35
  "loglevel": "^1.8.1",
36
36
  "pluralize": "^8.0.0",
37
37
  "qs": "^6.11.1",
38
38
  "qx-util": "^0.4.8",
39
- "ramda": "^0.28.0"
39
+ "ramda": "^0.29.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/pluralize": "^0.0.29",
43
43
  "@types/qs": "^6.9.7"
44
44
  },
45
45
  "peerDependencies": {
46
+ "axios": "^1.3.5",
46
47
  "lodash-es": "^4.17.21",
47
48
  "pluralize": "^8.0.0",
48
49
  "qs": "^6.11.0",
49
50
  "qx-util": "^0.4.8",
50
- "ramda": "^0.28.0"
51
+ "ramda": "^0.29.0"
51
52
  },
52
- "gitHead": "51751136cf908d383f2f1bf48afa590e7c8228f7"
53
+ "gitHead": "a73f681e207d0807797308452cf2e1946e973457"
53
54
  }
@@ -145,7 +145,10 @@ export class IBizContext implements IContext {
145
145
  * @return {*} {IBizContext}
146
146
  */
147
147
  clone(): IBizContext {
148
- const newContext = new IBizContext(clone(this._context), this._parent);
148
+ const newContext = new IBizContext(
149
+ clone(this.getOwnContext()),
150
+ this._parent,
151
+ );
149
152
  this._associationContext.push(newContext);
150
153
  return newContext;
151
154
  }
@@ -21,4 +21,5 @@ export const Environment: IEnvironment = {
21
21
  menuPermissionMode: MenuPermissionMode.MIXIN,
22
22
  enablePermission: true,
23
23
  routePlaceholder: '-',
24
+ enableWfAllHistory: false,
24
25
  };
@@ -1,2 +1,4 @@
1
1
  export { HttpError } from './http-error/http-error';
2
+ export { ModelError } from './model-error/model-error';
2
3
  export { RuntimeError } from './runtime-error/runtime-error';
4
+ export { RuntimeModelError } from './runtime-model-error/runtime-model-error';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 未支持的模型
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-08-30 16:08:03
6
+ * @export
7
+ * @class ModelError
8
+ */
9
+ export class ModelError extends Error {
10
+ name: string = '未支持的模型';
11
+
12
+ /**
13
+ * Creates an instance of ModelError.
14
+ *
15
+ * @author chitanda
16
+ * @date 2022-08-30 16:08:38
17
+ * @param {IModelObject} model 模板未支持的模型
18
+ * @param {string} [msg]
19
+ */
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ constructor(public model: any, msg?: string) {
22
+ super(`「${model.id}」模型${msg ? `: ${msg}` : ''}`);
23
+ }
24
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * 模型配置缺失
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-08-30 16:08:15
6
+ * @export
7
+ * @class DefectModelError
8
+ * @extends {Error}
9
+ */
10
+ export class RuntimeModelError extends Error {
11
+ name: string = '模型配置缺失';
12
+
13
+ /**
14
+ * Creates an instance of DefectModelError.
15
+ *
16
+ * @author chitanda
17
+ * @date 2022-08-30 16:08:58
18
+ * @param {IModelObject} model 丢失配置的模型
19
+ * @param {string} [msg] 缺失配置描述
20
+ */
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ constructor(public model: any, msg?: string) {
23
+ super(`「${model.id}」模型${msg ? `: ${msg}` : ''}`);
24
+ }
25
+ }
@@ -162,4 +162,12 @@ export interface IEnvironment {
162
162
  * @memberof IEnvironment
163
163
  */
164
164
  routePlaceholder: string;
165
+
166
+ /**
167
+ * 是否让所有工作流history接口走all
168
+ *
169
+ * @type {boolean}
170
+ * @memberof IEnvironment
171
+ */
172
+ enableWfAllHistory: boolean;
165
173
  }
package/src/types.ts CHANGED
@@ -28,6 +28,15 @@ declare global {
28
28
  interface IContext {
29
29
  [key: string | symbol]: any;
30
30
 
31
+ /**
32
+ * 沙箱标识
33
+ *
34
+ * @author chitanda
35
+ * @date 2022-07-22 15:07:23
36
+ * @type {string}
37
+ */
38
+ srfsandbox?: string;
39
+
31
40
  /**
32
41
  * 返回自身的上下文,独有的和与父有差异的
33
42
  *
@@ -6,6 +6,7 @@ export { Net } from './net/net';
6
6
  export { plural, pluralLower } from './plural/plural';
7
7
  export { StringUtil } from './string-util/string-util';
8
8
  export * from './util/util';
9
+ export * from './types/types';
9
10
  export * from './url-helper/url-helper';
10
11
  export * from './event/event';
11
12
  export * from './click-outside/click-outside';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 从T里面排除U里相同的属性后剩下的属性组成的类型
3
+ */
4
+ export type OmitObject<T, U> = { [K in keyof Omit<T, keyof U>]: T[K] };
5
+
6
+ /**
7
+ * 从T里面只获取索引类型为string的键
8
+ */
9
+ export type StrKeyOf<T> = Extract<keyof T, string>;
@@ -1 +0,0 @@
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(){}))}}}));