devfab 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +512 -290
- package/dist/common/models.esm.js +2 -2
- package/dist/common/models.js +2 -2
- package/dist/common/require.esm.js +5 -0
- package/dist/common/require.js +5 -0
- package/dist/common/utils.esm.js +3 -1
- package/dist/common/utils.js +3 -1
- package/dist/index.esm.js +6 -2
- package/dist/index.js +6 -2
- package/dist/index.umd.js +6 -2
- package/dist/react/index.js +1 -1
- package/dist/vue/vue3-adapter.esm.js +1 -1
- package/dist/vue/vue3-adapter.js +1 -1
- package/lib/devfab.js +4475 -2339
- package/lib/devfab.min.js +6 -2
- package/lib/devfab.require.js +3285 -0
- package/lib/devfab.require.min.js +5 -0
- package/package.json +83 -78
- package/dist/react/_virtual/_rollupPluginBabelHelpers.js +0 -3
- package/dist/react/adapter/common/dataSourceAdapter.js +0 -1
- package/dist/react/adapter/common/labelAdapter.js +0 -1
- package/dist/react/adapter/common/loadMetaAdapter.js +0 -1
- package/dist/react/adapter/common/refAdapter.js +0 -1
- package/dist/react/adapter/index.js +0 -1
- package/dist/react/adapter/model/dataSourceAdapter.js +0 -1
- package/dist/react/adapter/model/filterAdapter.js +0 -1
- package/dist/react/adapter/model/modelAdapter.js +0 -1
- package/dist/react/adapter/model/pageAdapter.js +0 -1
- package/lib/requirejs.js +0 -2473
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var
|
|
1
|
+
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function n(e){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=e.apply(n,r);function s(e){t(o,i,a,s,u,"next",e)}function u(e){t(o,i,a,s,u,"throw",e)}s(void 0)})}}function r(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_(r.key),r)}}function o(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(){
|
|
2
2
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3
|
-
var e,t,a="function"==typeof Symbol?Symbol:{},n=a.iterator||"@@iterator",r=a.toStringTag||"@@toStringTag";function i(a,n,r,i){var u=n&&n.prototype instanceof s?n:s,l=Object.create(u.prototype);return g(l,"_invoke",function(a,n,r){var i,s,u,l=0,c=r||[],d=!1,f={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,a){return i=t,s=0,u=e,f.n=a,o}};function h(a,n){for(s=a,u=n,t=0;!d&&l&&!r&&t<c.length;t++){var r,i=c[t],h=f.p,v=i[2];a>3?(r=v===n)&&(u=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=h&&((r=a<2&&h<i[1])?(s=0,f.v=n,f.n=i[1]):h<v&&(r=a<3||i[0]>n||n>v)&&(i[4]=a,i[5]=n,f.n=v,s=0))}if(r||a>1)return o;throw d=!0,n}return function(r,c,v){if(l>1)throw TypeError("Generator is already running");for(d&&1===c&&h(c,v),s=c,u=v;(t=s<2?e:u)||!d;){i||(s?s<3?(s>1&&(f.n=-1),h(s,u)):f.n=u:f.v=u);try{if(l=2,i){if(s||(r="next"),t=i[r]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(u=TypeError("The iterator does not provide a '"+r+"' method"),s=1);i=e}else if((t=(d=f.n<0)?u:a.call(n,f))!==o)break}catch(t){i=e,s=1,u=t}finally{l=1}}return{value:t,done:d}}}(a,r,i),!0),l}var o={};function s(){}function u(){}function l(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(g(t={},n,function(){return this}),t),d=l.prototype=s.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,g(e,r,"GeneratorFunction")),e.prototype=Object.create(d),e}return u.prototype=l,g(d,"constructor",l),g(l,"constructor",u),u.displayName="GeneratorFunction",g(l,r,"GeneratorFunction"),g(d),g(d,r,"Generator"),g(d,n,function(){return this}),g(d,"toString",function(){return"[object Generator]"}),(v=function(){return{w:i,m:f}})()}function g(e,t,a,n){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}g=function(e,t,a,n){function i(t,a){g(e,t,function(e){return this._invoke(t,a,e)})}t?r?r(e,t,{value:a,enumerable:!n,configurable:!n,writable:!n}):e[t]=a:(i("next",0),i("throw",1),i("return",2))},g(e,t,a,n)}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var n,r,i,o,s=[],u=!0,l=!1;try{if(i=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;u=!1}else for(;!(u=(n=i.call(a)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,r=e}finally{try{if(!u&&null!=a.return&&(o=a.return(),Object(o)!==o))return}finally{if(l)throw r}}return s}}(e,t)||k(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||k(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var n=a.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}function k(t,a){if(t){if("string"==typeof t)return e(t,a);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,a):void 0}}var x=function(){return o(function e(t){r(this,e),this._init(t)},[{key:"_init",value:function(e){this.cache=Object.assign({},e)}},{key:"set",value:function(e,t){this.cache[e]=t}},{key:"get",value:function(e){var t;return null===(t=this.cache)||void 0===t?void 0:t[e]}},{key:"clear",value:function(e){delete this.cache[e]}}])}(),b=function(){return o(function e(t){r(this,e),this._init(t)},[{key:"_init",value:function(e){var t;this.__ASYNC_EXECUTE__=null===(t=null==e?void 0:e.__ASYNC_EXECUTE__)||void 0===t||t,this.events=new Map,this.firstevents=new Map}},{key:"on",value:function(e,t,a){var n=this.events.get(e);Array.isArray(n)||(n=[]),n.push({callback:t,context:a}),this.events.set(e,n)}},{key:"onFirst",value:function(e,t,a){var n=this.firstevents.get(e);Array.isArray(n)||(n=[]),n.splice(0,0,{callback:t,context:a}),this.firstevents.set(e,n)}},{key:"execute",value:function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),n=1;n<t;n++)a[n-1]=arguments[n];var r=this.events.get(e),i=this.firstevents.get(e);if(!r&&!i)return!0;var o=!0;return[].concat(w(i||[]),w(r||[])).forEach(function(e){if(!1!==o){var t=e.callback.apply(e.context||void 0,a);o=!1!==t&&o}}),o}},{key:"un",value:function(e,t){this._unEvents(e,t,this.events),this._unEvents(e,t,this.firstevents)}},{key:"_unEvents",value:function(e,t,a){if(e&&a.has(e))if(t){var n=a.get(e),r=null==n?void 0:n.findIndex(function(e){return e.callback===t});-1!==r&&(null==n||n.splice(r,1))}else a.delete(e)}},{key:"hasEvent",value:function(e){var t,a;return e?((null===(t=this.events.get(e))||void 0===t?void 0:t.length)||0)+((null===(a=this.firstevents.get(e))||void 0===a?void 0:a.length)||0):0}},{key:"fireEvent",value:function(e,t){this.execute("before".concat(e),t)&&(this.execute(e,t),this.execute("after".concat(e),t))}},{key:"_asyncExecute",value:function(e,t,a){for(var n,r=this,i=a.resolve,o=a.reject,s=a.args,u=!0,l=t||[],c=!1,d=function(t){var a,n=l[t];if(!1===u)return 0;if(c)return{v:void 0};if("development"===process.env.nodeEnv)a=n.callback.apply(n.context||r,s);else try{a=n.callback.apply(n.context||r,s)}catch(e){throw e.isAddedMsg||(e.message="(领域扩展事件执行失败,请打开控制台查看详细错误信息并修复):".concat(e.message)),e.isAddedMsg=!0,e}a instanceof Promise?(c=!0,(u=a).callbacks&&u.callbacks.push({reject:function(){u.reject(),t===l.length-1&&(null==o||o())},resolve:function(a){t===l.length-1?(s.length>1&&(s[0]=a),null==i||i(s)):r._asyncExecute(e,l.slice(t+1),{resolve:i,reject:o,args:s})}})):(u=!1!==a&&u,t===l.length-1&&(u?null==i||i(s):null==o||o()))},f=0;f<l.length&&0!==(n=d(f));f++)if(n)return n.v;return u}},{key:"_asyncPromiseExecute",value:function(e,t,a,n){var r=this.events.get(e),i=this.firstevents.get(e);if(!((Array.isArray(r)?r.length:r)||(Array.isArray(i)?i.length:i)))return null==t?void 0:t();var o=[].concat(w(i||[]),w(r||[]));return this._asyncExecute(e,o,{resolve:t,reject:a,args:n})}},{key:"promiseExecute",value:function(e,t){var a=this,n=e,r=1;if("boolean"==typeof e&&(n=t,r=2),n){for(var i=arguments.length,o=new Array(i>2?i-2:0),s=2;s<i;s++)o[s-2]=arguments[s];var u=2===r?o:[t].concat(o);if(u.length){var l,c=u.length-1,d=u[c];if("function"!=typeof d){if("object"!==S(d)||!d[0]||"function"!=typeof d[0]||!d[1]||"function"!=typeof d[1])return;l=d[1],d=d[0]}if(this.__ASYNC_EXECUTE__)return this._asyncPromiseExecute(n,function(e){d.apply(a,e)},function(){l&&"function"==typeof l&&l()},u);u.splice(c,1),u.unshift(n);var f=this.execute.apply(this,u);if(f instanceof Promise){var h=this;f.then(function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];d.apply(h,t)},function(){l&&"function"==typeof l&&l()})}else if(!f)return void(l&&"function"==typeof l&&l())}}}},{key:"clearEvents",value:function(){this.events.clear(),this.firstevents.clear()}}])}();function R(e){this.pathname="",this.query={};var t=e;this.init=function(){t||(t=location.search);var e=t.indexOf("?"),a=t.indexOf("#");if(e>=0){if(this.pathname=t.substr(0,e),(t=a<0?t.substr(e+1):t.substring(e+1,a)).length>0)for(var n=(t=t.replace(/\+/g," ")).split("&"),r=0,i=n.length;r<i;r++){var o=n[r]||"";if(o){var s=o.indexOf("="),u="",l="";s<0?l=u=window.decode(o):(u=window.decode(o.substr(0,s)),l=window.decode(o.substr(s+1))),this.query[u]=l}}}else this.pathname=t},this.set=function(e,t){this.query[e]=t},this.get=function(e){return this.query[e]},this.del=function(e){delete this.query[e]},this.has=function(e){return null!=this.query[e]},this.toStr=function(){var e=["?"];for(var t in this.query)e.push(encodeURIComponent(t)),e.push("="),e.push(encodeURIComponent(this.query[t])),e.push("&");return 1===e.length?"":(e.splice(e.length-1,1),e.join(""))},this.init()}function C(e,t){if(!t)return e;var a=[],n=new R(e);for(var r in t)n.get(r)||a.push("".concat(r,"=").concat(t[r]));if(!a.length)return e;var i=a.join("&");return e.indexOf("?")>=0?"".concat(e,"&").concat(i):"".concat(e,"?").concat(i)}String.prototype.equalsIgnoreCase=function(e){return null!=e&&this.toLowerCase()===e.toLowerCase()};var I=["onBeforeRequest","_onAfterRequest"],P=["_onBeforeRequest","onAfterRequest"];var D={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t=e||{},a=t.onBeforeRequest;t._onAfterRequest;var n,r=h(t,I),i=r.method||"GET",o=r.url;try{null!=r&&r.requestHeaders&&(n=r.requestHeaders,r.requestHeaders=void 0,delete r.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options["requestHeaders"] ERR : ',e)}try{r.params&&r.params.requestHeaders&&(n=r.params.requestHeaders,r.params.requestHeaders=void 0,delete r.params.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var s=null;if(i.equalsIgnoreCase("get")||i.equalsIgnoreCase("delete")?o=C(o,r.params):(i.equalsIgnoreCase("post")||i.equalsIgnoreCase("put"))&&(s=JSON.stringify(r.params)),r.jsonp)return this.getJsonp(o,r.callback);var u=this.getXMLHttpRequest();if(u){var l;if(u.open(i,o,!1!==r.async),r.timeout&&(u.timeout=r.timeout,u.setRequestHeader("timeout",r.timeout),u.ontimeout=function(){D.onerror(this,r,"timeout")}),r.contentType){if(u.setRequestHeader("Content-Type",r.contentType),r.contentType.indexOf("x-www-form-urlencoded")>=0)s=null===(l=new URLSearchParams(r.params))||void 0===l?void 0:l.toString()}else r.dateType?s=r.params:u.setRequestHeader("Content-Type","application/json;charset=utf-8");r.domainKey&&u.setRequestHeader("Domain-Key",r.domainKey);try{if(n&&"[object Object]"===Object.prototype.toString.call(n))for(var c in n)u.setRequestHeader(c,n[c])}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}u.withCredentials=null==r||!r.hasOwnProperty("withCredentials")||r.withCredentials;try{u.send(s)}catch(e){return{error:"NetWorkError",options:r}}if(!1===r.async)return null==a||a(r),this.onreadystatechange(u,r);u.onreadystatechange=function(){D.onreadystatechange(this,r)},null==a||a(r)}},beforeReadystatechange:function(e,t,a){null==a||a()},onreadystatechange:function(e,t){var a=t||{};a._onBeforeRequest;var n=a.onAfterRequest,r=h(a,P);if(4===e.readyState){if(null==n||n(),200===e.status){var i;try{if("blob"===r.responseType){var o=function(e){var t=e.xhr.getAllResponseHeaders(),a={};return t.split("\r\n").map(function(e){var t=p(e.split(": "),2),n=t[0],r=t[1];a[n]=r}),a}({xhr:e});i={code:e.status,data:{data:e.response,headers:o}}}else i=JSON.parse(e.responseText)}catch(t){D.onerror(e,r,e.responseText)}if(!1===r.async)return e.isBusy=!1,r.precallback&&r.precallback(i),D.processAjaxResult(i,!1,null,null,r,e);D.processAjaxResult(i,r.async,r.callback,r.context,r,e),r.precallback&&r.precallback(i)}else if(0===e.status)D.onerror(e,r,"网络连接已断开,请检查设备网络状态后重试");else if(502===e.status||504===e.status)D.onerror(e,r,"服务出错了,请稍后再试");else{if(401!==e.status){var s={};try{s=JSON.parse(e.responseText)}catch(t){s={code:e.status,message:e.responseText}}return D.onerror(e,r,s)}D.onerror(e,r,"登录信息失效,请重新登录或联系技术人员")}e.isBusy=!1}},onerror:function(e,t,a){var n="[ajax]: [onerror]: 接口返回错误 \n [状态码]: ".concat(e.status," \n [错误信息]: ").concat(("object"===S(a)?JSON.stringify(a):a)||"空"," \n [请求地址]: ").concat(t.url," \n [浏览器Token]: ").concat(document.cookie);console.log("Error.E01000",n);var r="object"===S(a)?a:{code:500,message:a};t.precallback&&t.precallback(r)},getXMLHttpRequest:function(){return this.createXMLHttpRequest()},createXMLHttpRequest:function(){return window.XMLHttpRequest?new XMLHttpRequest:window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):null},getJsonp:function(e,t){var a=e,n="callback"+this._jsonps.index++,r=document.createElement("script");this._jsonps[n]=function(e){try{t(e)}finally{document.body.removeChild(r)}},a+=-1===a.indexOf("?")?"?":"&callback=cb.rest.AjaxRequestManager._jsonps."+n,r.src=a,document.body.appendChild(r)},processAjaxResult:function(e,t,a,n,r,i){if(e){if(!e.code)return!1===t?e:void(a&&a.call(n,null,e));if(200==e.code){if(!1===t)return{result:e.data};a&&a.call(n,null,e.data,e.message,e.errorDetail,e.code,e.displayCode&&e)}else{if(!1===t)return{error:e};a&&a.call(n,e)}}}};function j(e,t){this.init&&this.init(e),this.queryParams=t}j.create=function(e,t){return new j(e,t)},j.prototype.init=function(e){if(e)for(var t in this.config=e,this.config)this[t]=function(e){return function(t,a,n){return this.Do(e,t,a,null,n)}}(t),this["".concat(t,"Sync")]=function(e){return function(t){return this.Do(e,t,null,!1)}}(t)},j.prototype.Do=function(e,t,a,n,r){var i,o,s;if(this.config&&this.config[e]&&this.config[e].url){var u=this.config[e],l=u.url;this.queryParams||(this.queryParams={}),null!==(i=u.options)&&void 0!==i&&i.proxyServiceCode&&(this.queryParams.serviceCode=u.options.proxyServiceCode),null!==(o=u.options)&&void 0!==o&&o.billnum&&(this.queryParams.billnum=u.options.billnum),null!==(s=this.queryParams)&&void 0!==s&&s.serviceCode&&(l=C(l,this.queryParams));var c=l,d=Object.assign({},u.options);return d.method=u.method||"GET","function"==typeof t?(d.callback=t,d.context=r||d.context||this):d.params=t,a&&(d.callback=a,d.context=r||d.context||this),!1===n&&(d.async=!1),this.ajax(c,d)}},j.prototype.ajax=function(e,t){return function(e,t){return t.url=e,D.doRequest(t)}(e,t)};var E=function(){return o(function e(t){r(this,e),this._init(t)},[{key:"_init",value:function(e){this._data={};var t=[];if(e)for(var a in e)t.push(a);Object.assign(this._data,{components:[],propertyNames:t},e),this._data.cache=new x,this._data.events=new b}},{key:"_del_data",value:function(e){e&&delete this._data[e]}},{key:"_cls_data",value:function(){this._data.cache.clear(),this._data.events.clear(),this._data={components:[],propertyNames:[],cache:new x,events:new b}}},{key:"_set_data",value:function(e,t,a){if(e){if(a){var n=this._data.propertyNames||[];n.indexOf(e)<0&&n.push(e)}this._data[e]=t}}},{key:"_get_data",value:function(e){if(e)return this._data[e]}},{key:"getData",value:function(){return this._get_data("value")}},{key:"getState",value:function(e,t){var a;if(!t)return this._get_data(e);var n=(this._get_data("components")||[]).find(function(e){return e.ctrlName===t});return n?null===(a=n.getState)||void 0===a?void 0:a.call(n,e):this._get_data(e)}},{key:"setState",value:function(e,t,a){a||this._set_data(e,t,!0);var n={};n[e]=t,this.doPropertyChange("setState",n,a)}},{key:"doPropertyChange",value:function(e,t,a){var n=this,r=this._get_data("components")||[];if(!r.length)return r;var i=[];if(a){var o=r.find(function(e){return e.ctrlName===a});o&&!this.notifyComponent(o,e,t)&&i.push(o)}else r.forEach(function(a){n.notifyComponent(a,e,t)||i.push(a)});return i.length?i:void 0}},{key:"notifyComponent",value:function(e,t,a){return"function"==typeof e[t]&&(this.viewUpdater(e,t,a),!0)}},{key:"viewUpdater",value:function(e,t,a){if("setState"===t)e[t](a);else{var n=this.getCache("name");e[t](a,n)}}},{key:"get",value:function(e){return this._get_data(e)}},{key:"addComponent",value:function(e,t){if(e){t&&!e.ctrlName&&(e.ctrlName=t);var a=this._get_data("components")||[];a.indexOf(e)>=0||a.push(e)}}},{key:"removeComponent",value:function(e){var t=this._get_data("components")||[],a=t.indexOf(e);a<0||t.splice(a,1)}},{key:"_applyState",value:function(e,t,a){var n=this;a||this._set_data(e,t,!0);var r="set".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),i=this.doPropertyChange(r,t,a);if(i){var o={};o[e]=t,i.forEach(function(e){n.notifyComponent(e,"setState",o)})}}},{key:"getVisible",value:function(e){return this.getState("visible",e)}},{key:"setVisible",value:function(e,t){this._applyState("visible",e,t)}},{key:"getValue",value:function(){return this.getData()}},{key:"setValue",value:function(e,t,a){var n=this,r=this.getValue();if(e!==r){var i={value:e,oldValue:r},o=this._get_data("forceFireEvent");t||o?this.promiseExecute("beforeValueChange",i,[function(){n._set_data("value",e,!0),n._applyState("value",e,a),n.execute("afterValueChange",i)},function(){n._set_data("value",r,!0),n._applyState("value",r,a)}]):(this._set_data("value",e,!0),this._applyState("value",e,a))}}},{key:"getDisabled",value:function(e){return this.getState("disabled",e)}},{key:"setDisabled",value:function(e,t){this._applyState("disabled",e,t)}},{key:"setParent",value:function(e){this.setCache("parent",e)}},{key:"getParent",value:function(){return this.getCache("parent")}},{key:"getRootParent",value:function(){for(var e=this.getParent();null!==(t=e)&&void 0!==t&&t.getParent();){var t;e=e.getParent()}return e}},{key:"setName",value:function(e){this.setCache("name",e)}},{key:"getName",value:function(){return this.getCache("name")}},{key:"setDirty",value:function(e){e?this._set_data("isDirty",!0):(this._del_data("isDirty"),this._set_data("originalData",this.getData()))}},{key:"getDirtyData",value:function(e){var t=this.getData();return!1!==e&&this._get_data("isDirty")||t!==this._get_data("originalData")?t:void 0}},{key:"clear",value:function(e){void 0===e?this._set_data("value",this._get_data("cDefaultValue")):e||this._set_data("value",void 0),this._del_data("isDirty"),this._del_data("checking"),this._del_data("checkMsg")}},{key:"on",value:function(e,t,a){this._get_data("events").on(e,t,a)}},{key:"onFirst",value:function(e,t,a){this._get_data("events").onFirst(e,t,a)}},{key:"execute",value:function(e){for(var t,a=arguments.length,n=new Array(a>1?a-1:0),r=1;r<a;r++)n[r-1]=arguments[r];return(t=this._get_data("events")).execute.apply(t,[e].concat(n))}},{key:"un",value:function(e,t){this._get_data("events").un(e,t)}},{key:"hasEvent",value:function(e){return this._get_data("events").hasEvent(e)}},{key:"fireEvent",value:function(e,t){this._get_data("events").fireEvent(e,t)}},{key:"promiseExecute",value:function(e,t){for(var a,n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];(a=this._get_data("events")).promiseExecute.apply(a,[e,t].concat(r))}},{key:"setCache",value:function(e,t){this._get_data("cache").set(e,t)}},{key:"getCache",value:function(e){return this._get_data("cache").get(e)}},{key:"clearCache",value:function(e){this._get_data("cache").clear(e)}},{key:"setProxy",value:function(e){if(!(e instanceof j)){var t,a=this._get_data("__requestHeaders__");for(var n in e){var r,i,o;if(a&&(null===(r=e[n])||void 0===r||null===(r=r.options)||void 0===r||!r.requestHeaders))null!==(o=e[n])&&void 0!==o&&o.options||(e[n].options={}),e[n].options.requestHeaders=a;null!==(i=this.getProxy())&&void 0!==i&&i[n]&&console.warn("[baseModel.prototype.setProxy]: Proxy ".concat(n," already exists on the model. Please change the name of ").concat(n," and try again"))}return this._set_data("proxy",j.create(f(f({},(null===(t=this.getProxy())||void 0===t?void 0:t.config)||{}),e))),this.getProxy()}this._set_data("proxy",e)}},{key:"getProxy",value:function(){return this._get_data("proxy")}}])}(),O=function(){function e(){return r(this,e),n(this,e,arguments)}return l(e,E),o(e,[{key:"mounted",value:function(){var e=this,t=this.get("conditions"),a={};t.forEach(function(t){e.get(t.name),a[t.name]=t.defaultValue}),this._set_data("params",a)}},{key:"unmounted",value:function(){this._set_data("params",{}),this._set_data("conditions",[])}},{key:"getParams",value:function(){var e=this,t={};return this.get("conditions").forEach(function(a){var n=e.get(a.name);t[a.name]=null==n?void 0:n.getValue()}),this._set_data("params",t),t}},{key:"search",value:function(){var e=this.getParams();this.execute("search",e)}}])}(),q=function(){function e(t){return r(this,e),n(this,e,[t])}return l(e,E),o(e,[{key:"getDisabled",value:function(){return this.getState("disabled")}},{key:"setDisabled",value:function(e){return this.setState("disabled",!!e)}},{key:"getReadonly",value:function(){return this.getState("readonly")}},{key:"setReadonly",value:function(e){this.setState("readonly",!!e)}}])}(),M="",A="Insert",F="Update",N="Delete",T=Array.isArray,K=function(e){return null==e||""===e},V=function(e){return!e||0===Object.keys(e).length};function H(e){if(T(e))return e.map(H);if(e instanceof Date)return new Date(e.getTime());if(e&&"object"===S(e)){var t={};for(var a in e)t[a]=H(e[a]);return t}return e}function U(e){var t={};return(T(e)?e:Object.keys(e||{}).map(function(t){var a;return f(f({},e[t]||{}),{},{field:(null===(a=e[t])||void 0===a?void 0:a.field)||t})})).forEach(function(e,a){if(e){var n=e.field||e.cCaption||e.cFieldName||"col_".concat(a);t[n]=f(f({},e),{},{field:n,fieldName:e.fieldName||n,cCaption:e.cCaption||n,index:void 0===e.index?a:e.index})}}),t}function B(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=this.getIdFlag(),a=this.getRowKeyField(),n=this._get_data("rowIdSeq")||0;return e.forEach(function(e){if(e&&void 0===e[t]){var r=e[a];null!=r&&""!==r?e[t]=String(r):(n+=1,e[t]="rowId_".concat(n))}}),this._set_data("rowIdSeq",n),e}function L(e,t,a){var n=this;this.promiseExecute("beforeQuery",{proxyConfig:e,queryParams:t},function(){var r=n,i=n.setProxy({queryData:e}),o={page:{pageSize:n.getPageSize(),pageIndex:n.getPageIndex()}},s=Object.assign(o,t);n.setCache("proxyCache",{proxyConfig:e,params:s}),n.getRootParent();if(!1!==n.execute("beforeQueryData",s)){var u=_.cloneDeep(s);i.queryData(u,function(e,t,n,r){if(!e){this._set_data("dataSourceMode","remote");var i=function(e){if(!e)return[];if(T(e))return e;if(T(e.data))return e.data;if(T(e.records))return e.records;if(T(e.list))return e.list;if(T(e.rows))return e.rows;var t=e.data&&"object"===S(e.data)?e.data:e.result;return T(t)?t:t&&"object"===S(t)&&(t.records||t.list||t.rows||t.data)||[]}(t=Object.assign({},t));null==a||a.call(this,i)}},r)}})}function z(e){if(this.execute("beforeSetDataSource",e)){var t=this._get_data("rowKeyField"),a={};e.forEach(function(e){a[e[t]]=e}),this._set_data("keyMap",a),this._set_data("dataSource",e,!0),this.doPropertyChange("setDataSource"),this.execute("afterSetDataSource",e)}}var G=function(){function e(){var t,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e);var i=f(f({},{columns:{},dataSource:[],rows:[],readOnly:!0,dataSourceMode:"local",columnMode:"local",editMode:"cell",cellState:{},rowState:{},showCheckBox:!0,multiple:!0,showRowNo:!0,pagination:!0,pageInfo:{pageIndex:1,pageSize:20,pageCount:0},innerUsedAttrs:{id:"_id",selected:"_selected",status:"_status"},multiRowModel:!1,editRowModels:{},loading:!1,params:{},originalKeyMap:{},defaultRowDatas:new Map}),a);T(i.dataSource)||(i.dataSource=[]),T(i.rows)||(i.rows=[]);var o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=f({},e.proxyConfig||{});return"function"==typeof e.dataSource&&(t.load=t.load||e.dataSource),"string"==typeof e.cUrl&&(t.load=t.load||e.cUrl),t.load||"string"!=typeof e.url||(t.load=e.url),t}(a);i.proxyConfig=o,i.dataSourceMode=a.dataSourceMode||(o.load?"remote":"local");var u=a.cData||(T(a.data)?a.data:null);return s(t=n(this,e,[i]),"modelType","GridModel"),t.initPageInfo(a.cPage||a.page),t.initColumns(i.columns),t.initRowState(),t.afterInit(),u&&t.setDataSource(u),t}return l(e,E),o(e,[{key:"afterInit",value:function(){"single"===this._get_data("parentRelation")&&this._set_data("defaultSelectedRowIndexes",!0)}},{key:"initColumns",value:function(e){var t=U(e);return this._set_data("columns",t,!0),t}},{key:"initPageInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=f({},this.getPageInfo());t.pageIndex=e.pageNo||e.pageIndex||t.pageIndex||1,t.pageSize=e.pageSize||t.pageSize||20,!1===this.get("pagination")&&(t.pageSize=-1),this.applyPageInfo(t)}},{key:"initRowState",value:function(){var e=this,t=this._get_data("dataSource");this._set_data("rowsDataState",(T(t)?t:[]).map(function(t){return(null==t?void 0:t[e.getStatusFlag()])||M}),!0)}},{key:"getInnerUsedAttrs",value:function(){return this._get_data("innerUsedAttrs")}},{key:"getIdFlag",value:function(){return this.getInnerUsedAttrs().id}},{key:"getSelectedFlag",value:function(){return this.getInnerUsedAttrs().selected}},{key:"getStatusFlag",value:function(){return this.getInnerUsedAttrs().status}},{key:"getRowKeyField",value:function(){return this._get_data("rowKeyField")||"id"}},{key:"getProxyConfig",value:function(){return this._get_data("proxyConfig")||{}}},{key:"isRemote",value:function(){return"remote"===this._get_data("dataSourceMode")}},{key:"isPagination",value:function(){return!!this.get("pagination")&&-1!==this.getPageSize()}},{key:"getReadOnly",value:function(){return!!this._get_data("readOnly")}},{key:"setReadOnly",value:function(e){this._applyState("readOnly",!!e)}},{key:"getParams",value:function(){return f(f({},this.get("cParams")||{}),this._get_data("params")||{})}},{key:"setParams",value:function(e){this._set_data("params",e||{})}},{key:"setMeta",value:function(e){this._set_data("meta",e)}},{key:"getColumns",value:function(e){var t=this._get_data("columns")||{},a={};return(e?T(e)?e:[e]:Object.getOwnPropertyNames(t)).forEach(function(e){t[e]&&(a[e]=f(f({},t[e]),{},{fieldName:t[e].fieldName||e}))}),a}},{key:"getColumn",value:function(e){var t,a=null===(t=this._get_data("columns"))||void 0===t?void 0:t[e];return a?f(f({},a),{},{fieldName:a.fieldName||e}):void 0}},{key:"hasColumn",value:function(e){return!!(this._get_data("columns")||{})[e]}},{key:"getColumnList",value:function(e){var t=this.getColumns(e);return Object.keys(t).sort(function(e,a){return(t[e].index||0)-(t[a].index||0)}).map(function(e){return t[e]})}},{key:"getVisibleColumns",value:function(e){return this.getColumnList(e).filter(function(e){return!0!==e.bHidden&&!1!==e.bShowIt})}},{key:"setColumns",value:function(e){e&&this._applyState("columns",U(e))}},{key:"setColumnMode",value:function(e){this._set_data("columnMode","remote"===e?"remote":"local",!0)}},{key:"addColumns",value:function(e){var t=U(e);this._applyState("columns",f(f({},this._get_data("columns")||{}),t))}},{key:"resetColumns",value:function(e){this.setColumns(e||this.get("cColumns"))}},{key:"getColumnState",value:function(e,t,a){var n,r=this.getRowKey(e);return r?((null===(n=this._get_data("cellState"))||void 0===n||null===(n=n[r])||void 0===n?void 0:n[t])||{})[a]:void 0}},{key:"setColumnState",value:function(e,t,a,n){this.setCellState(e,t,a,n)}},{key:"setColumnStates",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.setCellStates(e.map(function(e){return f(f({},e),{},{cellName:e.cellName||e.columnName})}))}},{key:"setColumnValue",value:function(e,t,a){var n=this._get_data("columns")||{};n[e]&&this._applyState("columns",f(f({},n),{},s({},e,f(f({},n[e]),{},s({},t,a)))))}},{key:"setDataSource",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if("local"===this._get_data("dataSourceMode")){z(cb.utils.isArray(e)?e:[])}else{if(!this.execute("beforeProxyLoad",a))return;this._get_data("pageInfo").pageIndex=1,this._set_data("proxyConfig",e),this._set_data("queryParams",a),this._set_data("loadDataCallback",n),L.call(this,e,a,function(e){z.call(t,e),null==n||n.call(t)})}}},{key:"reload",value:function(){var e=this;this.getProxy();var t=this._get_data("proxyConfig"),a=this._get_data("queryParams"),n=this._get_data("loadDataCallback");L.call(this,t,a,function(t){z.call(e,t),null==n||n.call(e)})}},{key:"getDataSource",value:function(){return this._get_data("dataSource")||[]}},{key:"getData",value:function(e,t){var a=e||t?this._get_data("rows"):this._get_data("dataSource");return this.collectRows(a,e)}},{key:"getAllData",value:function(){return this.getData(!0)}},{key:"getPageData",value:function(){return this.getData(!0)}},{key:"getEffeData",value:function(){var e=this._get_data("dataSource")||[],t=this._get_data("rowsDataState")||[];return this.collectRows(e.filter(function(e,a){return t[a]!==N}),!1)}},{key:"getRows",value:function(e){var t=this._get_data("rows")||[];return!1===e?t:t.map(function(e){return H(e)})}},{key:"collectRows",value:function(e,t){var a=this._get_data("columns")||{},n=this.getStatusFlag(),r=this.getSelectedFlag();return(e||[]).map(function(e){var i={};for(var o in e){var s;t&&o===n||(t||o!==r)&&!1!==(null===(s=a[o])||void 0===s?void 0:s.needCollect)&&(i[o]=e[o])}return i})}},{key:"getShowRows",value:function(e){return(e||this._get_data("rows")||[]).map(function(e){return f({},e)})}},{key:"getRow",value:function(e,t){var a,n=null===(a=this._get_data("rows"))||void 0===a?void 0:a[e];if(n)return!1===t?n:H(n)}},{key:"getRowIndex",value:function(e){if(!e)return-1;var t=this._get_data("rows")||[],a=this.getRowKeyField();return void 0!==e[a]?t.findIndex(function(t){return t[a]===e[a]}):t.indexOf(e)}},{key:"getRowIndexByRowId",value:function(e){var t=this;return(this._get_data("rows")||[]).findIndex(function(a){return(null==a?void 0:a[t.getIdFlag()])===e})}},{key:"getDataSourceIndexByRowId",value:function(e){var t=this;return(this._get_data("dataSource")||[]).findIndex(function(a){return(null==a?void 0:a[t.getIdFlag()])===e})}},{key:"getRowKey",value:function(e){var t,a;return null!==(t=null===(a=this._get_data("rows"))||void 0===a||null===(a=a[e])||void 0===a?void 0:a[this.getIdFlag()])&&void 0!==t?t:e}},{key:"getRowKeys",value:function(e){var t=void 0===e?this.getRows():T(e)?e:[e],a=this.getRowKeyField();return t.filter(function(e){return e&&void 0!==e[a]}).map(function(e){return e[a]})}},{key:"getRowsByIndexes",value:function(e){var t=this._get_data("rows")||[];return(T(e)?e:[e]).map(function(e){return t[e]}).filter(Boolean)}},{key:"getCellValue",value:function(e,t){var a,n=e>=0?null===(a=this._get_data("rows"))||void 0===a?void 0:a[e]:null;if(n&&t)return n[t]}},{key:"setCellValue",value:function(e,t,a){var n=(this._get_data("rows")||[])[e];if(n&&t){var r=n[t];if(r!==a){var i={rowIndex:e,rowId:n[this.getIdFlag()],cellName:t,value:a,oldValue:r};this.execute("beforeCellValueChange",i)&&(n[t]=i.value,this.markRowState(e,F),this.execute("afterCellValueChange",i),this.doPropertyChange("setCellValue",i))}}}},{key:"setCellValues",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];T(t)&&t.forEach(function(t){return e.setCellValue(t.rowIndex,t.cellName||t.field,t.value)})}},{key:"getCellState",value:function(e,t,a){var n,r=this.getRowKey(e),i=r?null===(n=this._get_data("cellState"))||void 0===n||null===(n=n[r])||void 0===n?void 0:n[t]:null;if(i)return i[a]}},{key:"setCellState",value:function(e,t,a,n){var r,i=null===(r=this._get_data("rows"))||void 0===r||null===(r=r[e])||void 0===r?void 0:r[this.getIdFlag()],o=i||e;if(!K(o)){var u=this.getCellState(e,t,a);if(u!==n){var l={rowIndex:e,rowId:i,cellName:t,propertyName:a,value:n,oldValue:u};if(this.execute("beforeCellStateChange",l)){var c=f({},this._get_data("cellState")||{});c[o]=f({},c[o]||{}),c[o][t]=f(f({},c[o][t]||{}),{},s({},a,n)),this._applyState("cellState",c),this.execute("afterCellStateChange",l)}}}}},{key:"setCellStates",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];T(t)&&t.forEach(function(t){return e.setCellState(t.rowIndex,t.cellName,t.propertyName||t.name,t.value)})}},{key:"getRowDataState",value:function(e){var t,a=this.getDataSourceIndexByRow(e);return null===(t=this._get_data("rowsDataState"))||void 0===t?void 0:t[a]}},{key:"getDataSourceIndexByRow",value:function(e){var t=this,a=(this._get_data("rows")||[])[e];if(!a)return-1;var n=this._get_data("dataSource")||[],r=n.indexOf(a);return r>-1?r:n.findIndex(function(e){return(null==e?void 0:e[t.getIdFlag()])===(null==a?void 0:a[t.getIdFlag()])})}},{key:"setRowDataState",value:function(e,t){var a=this.getDataSourceIndexByRow(e);if(!(a<0)){var n=w(this._get_data("rowsDataState")||[]);n[a]=t,this._set_data("rowsDataState",n,!0)}}},{key:"markRowState",value:function(e,t){var a=this.getRowDataState(e);a!==A&&a!==t&&this.setRowDataState(e,t)}},{key:"markRowUpdate",value:function(e){var t="number"==typeof e?e:this.getRowIndex(e);t<0||this.markRowState(t,F)}},{key:"getRowState",value:function(e,t){var a,n=this.getRowKey(e),r=n?null===(a=this._get_data("rowState"))||void 0===a?void 0:a[n]:null;if(r&&t)return r[t]}},{key:"setRowState",value:function(e,t,a){var n,r=null===(n=this._get_data("rows"))||void 0===n?void 0:n[e];if(r&&t){var i=this.getRowKey(e),o=this.getRowState(e,t);if(o!==a){var u={rowIndex:e,rowId:r[this.getIdFlag()],propertyName:t,value:a,oldValue:o};if(this.execute("beforeRowStateChange",u)){var l=f({},this._get_data("rowState")||{});l[i]=f(f({},l[i]||{}),{},s({},t,a)),this._applyState("rowState",l),this.execute("afterRowStateChange",u)}}}}},{key:"setRowStates",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];T(t)&&t.forEach(function(t){return e.setRowState(t.rowIndex,t.propertyName||t.name,t.value)})}},{key:"getDirtyData",value:function(e){var t=this,a=this._get_data("dataSource")||[],n=this._get_data("rowsDataState")||[],r=[];return a.forEach(function(e,a){var i=n[a];if(i){var o=H(e);o[t.getStatusFlag()]=i,r.push(o)}}),r.length?r:void 0}},{key:"getDirtyRowIndexes",value:function(){var e=this;return(this._get_data("rows")||[]).map(function(e,t){return t}).filter(function(t){return!!e.getRowDataState(t)})}},{key:"isDirty",value:function(){return!!this.getDirtyData()}},{key:"backupState",value:function(){this._set_data("backupData",{dataSource:H(this._get_data("dataSource")||[]),rowsDataState:w(this._get_data("rowsDataState")||[])})}},{key:"restoreState",value:function(){var e=this._get_data("backupData");e&&(this._set_data("dataSource",e.dataSource,!0),this._set_data("rowsDataState",w(e.rowsDataState),!0),this.showPage())}},{key:"insertRow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>3?arguments[3]:void 0,n=this._get_data("rows")||[],r=Math.min(n.length,Math.max(0,void 0===e?n.length:e)),i={index:r,row:f({},t),isCopy:a};if(this.execute("beforeInsertRow",i)){var o=i.row;delete o[this.getIdFlag()],B.call(this,[o]);var s=this._get_data("dataSource")||[],u=r<n.length?this.getDataSourceIndexByRow(r):s.length;s.splice(u<0?s.length:u,0,o);var l=w(this._get_data("rowsDataState")||[]);return l.splice(u<0?l.length:u,0,A),n.splice(r,0,o),this._set_data("rowsDataState",l,!0),this.setRows(n),this.execute("afterInsertRow",f(f({},i),{},{rowIndex:r})),o}}},{key:"insertRows",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[];return(T(a)?a:[a]).forEach(function(a,r){n.push(t.insertRow(e+r,a))}),n}},{key:"appendRow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.insertRow(this.getRowsCount(),e)}},{key:"updateRow",value:function(e){var t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null===(t=this._get_data("rows"))||void 0===t?void 0:t[e];n&&this.execute("beforeUpdateRow",{index:e,row:a})&&(Object.assign(n,a),this.markRowState(e,F),this.setRows(this._get_data("rows")),this.execute("afterUpdateRow",{index:e,row:n}))}},{key:"updateRows",value:function(){var e=this;(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(function(t){var a;return e.updateRow(null!==(a=t.rowIndex)&&void 0!==a?a:t.index,t.rowData||t.row)})}},{key:"deleteRows",value:function(e){var t=this,a=(T(e)?e:[e]).filter(function(e){return e>=0&&e<t.getRowsCount()}).sort(function(e,t){return e-t});if(a.length){var n=this.getRowsByIndexes(a);if(this.execute("beforeDeleteRows",n,a)){var r=this._get_data("dataSource")||[],i=w(this._get_data("rowsDataState")||[]),o=new Set,s=new Set;n.forEach(function(e){var a=r.indexOf(e);if(!(a<0)){var n=e[t.getIdFlag()];o.add(n),i[a]===A&&s.add(n)}});var u=[],l=[];r.forEach(function(e,a){var n=e[t.getIdFlag()];if(!o.has(n))return u.push(e),void l.push(i[a]);s.has(n)||(u.push(e),l.push(N))}),this._set_data("dataSource",u,!0),this._set_data("rowsDataState",l,!0),this.showPage(),this.execute("afterDeleteRows",{rowIndexes:a,rows:n})}}}},{key:"deleteAllRows",value:function(){this.deleteRows(this.getRows().map(function(e,t){return t}))}},{key:"clear",value:function(){this._set_data("dataSource",[],!0),this._set_data("rows",[],!0),this._set_data("rowsDataState",[],!0),this.clearSelection(),this.applyPageInfo(f(f({},this.getPageInfo()),{},{recordCount:0,pageIndex:1})),this.setDataSourceView()}},{key:"select",value:function(e,t){var a=this;if(null!=e||!0===t){!0===t&&this.unselectAll({silent:!0});var n=!0===t?this.getRows().map(function(e,t){return t}):T(e)?e:[e];n=n.filter(function(e){return e>=0&&e<a.getRowsCount()});var r=this._get_data("rows")||[],i=this.getSelectedFlag(),o=n.filter(function(e){return!r[e][i]});if(o.length){var s={rowIndexes:o,rows:o.map(function(e){return r[e]})};this.execute("beforeSelect",s)&&(o.forEach(function(e){r[e][i]=!0,a.cacheSelectedRow(r[e],!0)}),this.flushSelection())}else!0===t&&this.flushSelection()}}},{key:"unselect",value:function(e){var t=this;if(null!=e){var a=T(e)?e:[e],n=this._get_data("rows")||[],r=this.getSelectedFlag(),i=a.filter(function(e){var t;return null===(t=n[e])||void 0===t?void 0:t[r]});i.length&&this.execute("beforeUnselect",i)&&(i.forEach(function(e){n[e][r]=!1,t.cacheSelectedRow(n[e],!1)}),this.flushSelection())}}},{key:"selectAll",value:function(){var e=this,t=this._get_data("rows")||[],a=this.getSelectedFlag();t.forEach(function(t){t[a]=!0,e.cacheSelectedRow(t,!0)}),this.flushSelection()}},{key:"unselectAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=this.getSelectedFlag();((t.onlyPage?this._get_data("rows"):this._get_data("dataSource"))||[]).forEach(function(e){e[a]=!1}),t.onlyPage?(this._get_data("rows")||[]).forEach(function(t){return e.cacheSelectedRow(t,!1)}):(this._set_data("selectedKeys",[],!0),this._set_data("selectedRowsMap",{},!0),this._set_data("selectedKeysSet",new Set,!0)),t.silent||this.flushSelection()}},{key:"clearSelection",value:function(){this.unselectAll()}},{key:"setSelectedRows",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],a=T(t)?t:[],n=this.getRowKeyField(),r=new Set(a.map(function(e){var t;return String(null!==(t=null==e?void 0:e[n])&&void 0!==t?t:e)})),i=this._get_data("rows")||[],o=this.getSelectedFlag();i.forEach(function(t){var a=r.has(String(t[n]));a!==!!t[o]&&(t[o]=a,e.cacheSelectedRow(t,a))}),this.flushSelection()}},{key:"setSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.unselectAll({silent:!0}),this.setSelectedRows(e)}},{key:"getSelectedRows",value:function(e){var t=this._get_data("rows")||[],a=this.getSelectedFlag(),n=e&&new Set(T(e)?e:[e]);return t.filter(function(e,t){return e[a]&&(!n||n.has(t))})}},{key:"getSelectedRowIndexes",value:function(){var e=this._get_data("rows")||[],t=this.getSelectedFlag(),a=[];return e.forEach(function(e,n){e[t]&&a.push(n)}),a}},{key:"getSelectedKeys",value:function(){return this._get_data("selectedKeys")||[]}},{key:"getAllCacheSelectedRows",value:function(){var e=this._get_data("selectedKeys")||[],t=this._get_data("selectedRowsMap")||{};return e.map(function(e){return t[e]}).filter(Boolean)}},{key:"selectByKeys",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=this.getRowKeyField(),n=T(e)?e:[e],r=this._get_data("rows")||[],i=[];n.forEach(function(e){var t=r.findIndex(function(t){return String(t[a])===String(e)});t>-1&&i.push(t)}),i.length&&(t?this.select(i):this.unselect(i))}},{key:"getSelectedNodes",value:function(){return this.getAllCacheSelectedRows()}},{key:"cacheSelectedRow",value:function(e,t){var a=String(null==e?void 0:e[this.getRowKeyField()]),n=(this._get_data("selectedKeys")||[]).filter(function(e){return e!==a}),r=f({},this._get_data("selectedRowsMap")||{});t&&n.push(a),t?r[a]=e:delete r[a],this._set_data("selectedKeys",n,!0),this._set_data("selectedRowsMap",r,!0),this._set_data("selectedKeysSet",new Set(n),!0)}},{key:"flushSelection",value:function(){this._applyState("selectedRows",this.getSelectedRows()),this.execute("selectionChange",{value:this.getSelectedRows(),keys:this.getSelectedKeys(),indexes:this.getSelectedRowIndexes()})}},{key:"restoreSelectedFlags",value:function(){if(this.get("cacheSelectedRows")){var e=this._get_data("selectedKeysSet")||new Set;if(e.size){var t=this.getRowKeyField(),a=this.getSelectedFlag();(this.getRows()||[]).forEach(function(n){n[a]=e.has(String(n[t]))})}}}},{key:"setPagination",value:function(e){this._applyState("pagination",!!e),this.showPage()}},{key:"getPageInfo",value:function(){return this._get_data("pageInfo")||createDefaults().pageInfo}},{key:"getPageIndex",value:function(){return this.getPageInfo().pageIndex}},{key:"getPageSize",value:function(){return this.getPageInfo().pageSize}},{key:"getTotalCount",value:function(){return this.getPageInfo().recordCount}},{key:"setPageInfo",value:function(e){this.applyPageInfo(f(f({},this.getPageInfo()),e),{refresh:!0})}},{key:"setPageIndex",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"number"==typeof e&&this.applyPageInfo(f(f({},this.getPageInfo()),{},{pageIndex:Math.max(1,e)}),{refresh:t})}},{key:"setPageSize",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"number"==typeof e&&this.applyPageInfo(f(f({},this.getPageInfo()),{},{pageSize:Math.max(-1,e),pageIndex:1}),{refresh:t})}},{key:"setRecordCount",value:function(e){this.applyPageInfo(f(f({},this.getPageInfo()),{},{recordCount:e||0}))}},{key:"applyPageInfo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=f({},e||{}),n=-1===a.pageSize?-1:a.pageSize||20,r=a.recordCount||0,i=r>0;return a.pageSize=n,a.recordCount=r,a.pageCount=n>0?Math.max(1,Math.ceil(r/n)):1,a.pageIndex=n>0?Math.max(1,i?Math.min(a.pageIndex||1,a.pageCount):a.pageIndex||1):1,a.beginPageIndex=n>0?(a.pageIndex-1)*n+1:1,a.endPageIndex=n>0?Math.min(a.pageIndex*n,r):r,this._set_data("pageInfo",a,!0),t.silent||(this._applyState("pageInfo",a),this.isRemote()||this.showPage(),t.refresh&&this.isRemote()&&this.refresh()),a}},{key:"showPage",value:function(){var e=this._get_data("dataSource")||[];if(!this.isRemote()&&this.isPagination()){var t=this.getPageInfo(),a=t.pageIndex,n=t.pageSize,r=(a-1)*n;this.setRows(e.slice(r,r+n))}else this.setRows(e)}},{key:"setRows",value:function(e){var t=T(e)?e:[];this._set_data("rows",t,!0),this.setRowsIdMap(),this._applyState("data",t)}},{key:"setDataSourceView",value:function(){this._applyState("data",this._get_data("rows")||[])}},{key:"setRowsIdMap",value:function(){var e=this,t={};(this._get_data("rows")||[]).forEach(function(a){void 0!==(null==a?void 0:a[e.getIdFlag()])&&(t[a[e.getIdFlag()]]=a)}),this._set_data("rowsIdMap",t)}},{key:"getRowIdMap",value:function(){return this._get_data("rowsIdMap")||{}}},{key:"validate",value:function(e,t){var a=this;if(e)return this.doPropertyChange("validate",{type:"",message:"",errors:[]}),this._set_data("validateErrors",[]),!1;this.deleteNotModifiedRows();var n=this._get_data("columns")||{},r=t?this.getRowsByIndexes(t):this.getRows(),i=[];r.forEach(function(e,t){for(var r in n){var o=n[r];if(a.isRequiredColumn(o)){var s=e[r];if(K(s)||T(s)&&!s.length||V(s)){var u=o.cShowCaption||o.cCaption||o.cCaption||o.title||r;i.push({rowIndex:t,rowId:e[a.getIdFlag()],cellName:r,message:"".concat(u,"不能为空")}),a.setCellState(t,r,"msg","不能为空")}}}}),this._set_data("validateErrors",i);var o=i.length?i[0].message:"";return this.doPropertyChange("validate",{type:i.length?"error":"",message:o,errors:i}),this.execute("afterValidate",{valid:!i.length,errors:i}),!i.length}}])}(),X=function(){function e(){return r(this,e),n(this,e,arguments)}return l(e,E),o(e,[{key:"getParams",value:function(){return this._get_data("params")}},{key:"setParams",value:function(e){this._set_data("params",e,!0)}},{key:"set",value:function(e,t){t instanceof E&&(t.setParent(this),t.setName(e)),this._set_data(e,t,!0)}},{key:"setData",value:function(e){for(var t in e)this.addProperty(t,e[t])}},{key:"addProperty",value:function(e,t){var a=this.get(e);null!=a&&a.setData?a.setData(t):this.set(e,t)}},{key:"getData",value:function(){var e=this,t=this._get_data("propertyNames")||[],a={};return t.forEach(function(t){var n,r=e.get(t);r instanceof E&&!1!==r._get_data("needCollect")&&(a[t]=null===(n=r.getData)||void 0===n?void 0:n.call(r))}),a}},{key:"getAllData",value:function(e){var t=this,a=this._get_data("propertyNames")||[],n={};return a.forEach(function(a){var r,i=t.get(a);if(i instanceof E&&!1!==i._get_data("needCollect")&&(!e||!i._get_data("isGrid"))){var o=null===(r=i.getData)||void 0===r?void 0:r.call(i);void 0!==o&&(n[a]=o)}}),n}},{key:"removeProperty",value:function(e){var t=this._get_data("propertyNames")||[],a=t.indexOf(e);-1!==a&&t.splice(a,1),this._del_data(e)}},{key:"loadData",value:function(e){this.setCache("isLoadData",!0),this.clear(),this.setData(e),this.setDirty(!1),this.setCache("isLoadData",!1)}},{key:"clear",value:function(e){var t=this;(this._get_data("propertyNames")||[]).forEach(function(a){var n,r=t.get(a);r instanceof E&&!1!==r._get_data("needClear")&&(null===(n=r.clear)||void 0===n||n.call(r,e))})}},{key:"setDirty",value:function(e){e?this._set_data("isDirty",!0):(this._del_data("isDirty"),this._set_data("originalData",this.getData()))}},{key:"getGridModel",value:function(e){var t;if(e)return this.get(e);var a=this._get_data("gridModel");if(a)return a;var n=null===(t=this.getParams())||void 0===t?void 0:t.masterGridModelName;if(n)return this.get(n);for(var r=this._get_data("propertyNames"),i=0,o=r.length;i<o;i++){if((a=this.get(r[i]))instanceof G||"GridModel"==a.modelType)return this._set_data("gridModel",a),a}}},{key:"getGridModels",value:function(){for(var e=this._get_data("propertyNames"),t=[],a=0,n=e.length;a<n;a++){var r=this.get(e[a]);(r instanceof G||"GridModel"==r.modelType)&&t.push(r)}return t}}])}();function J(e){var t=this;window&&window.__debugger_initExtendJs;var a=e.requirejs,n=e.extendFilePath,r=e.pageKey,i=e.enableExtendJs,o=void 0===i||i,s=e.extendJsPath,u=void 0===s?"_VM.Extend.js":s;if(o){var l="".concat(r).concat(u),c=[l];if("function"!=typeof a.require)return console.warn("requirejs.js 未加载,跳过扩展脚本:".concat(l)),void t.execute("extendReady",t);a.require(n,c,function(e,a){if(e&&e.doAction)try{e.doAction("init",t),a&&a.doAction("init",t)}catch(e){console.error("扩展脚本异常:",e)}else console.error("".concat(l,"扩展文件extend.*.min.js文件加载失败 或 未注册扩展脚本"));t.execute("extendReady",t)},function(e){console.warn("未找到扩展脚本:".concat(l,"错误信息:"),e),t.execute("extendReady",t)})}else t.execute("extendReady",t)}var Y=function(){var e=a(v().m(function e(t,n,r){var i,o,s,u;return v().w(function(e){for(;;)switch(e.n){case 0:if(s=t.extscripturls,u=void 0===s?[]:s,u=(u=(n.getCache("localDynamicScripts")||[]).concat(u)).concat(window.__devfab__EXT_BILL_SCRIPTS__||[]),null!==(i=n.getParams())&&void 0!==i&&i.initVMExtUrls&&(u=u.concat([n.getParams().initVMExtUrls])),null===(o=u)||void 0===o||!o.length){e.n=2;break}return u=w(new Set(u)),e.n=1,Promise.all(u.map(function(){var e=a(v().m(function e(t){return v().w(function(e){for(;;)if(0===e.n)return e.a(2,t)},e)}));return function(t){return e.apply(this,arguments)}}()));case 1:u=e.v;case 2:return t.extscripturls=u,e.a(2,new Promise(function(e,a){Q(t,n,r,function(){e(!0)})}))}},e)}));return function(t,a,n){return e.apply(this,arguments)}}();function Q(e,t,a,n){var r=e.extscripturls,i=void 0===r?[]:r;if(null!=i&&i.length)try{var o,s=null==a||null===(o=a.requirejs)||void 0===o?void 0:o.requireInner;if("function"!=typeof s)return console.warn("requirejs.js 未加载,跳过客开扩展脚本"),void(null==n||n(e,t));s(i,function(){var a=!0;if(arguments.length){for(var r=0,i=arguments.length;r<i;r++){var o=r<0||arguments.length<=r?void 0:arguments[r];o?o.doAction("init",t):a=!1}a&&(null==n||n(e,t))}else a=!1;a||console.log("[error] [extendjs] 租户级扩展脚本有语法错误,请修改正确后刷新浏览器重试!")},function(a){null==n||n(e,t)})}catch(a){null==n||n(e,t)}else null==n||n(e,t)}function W(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.extendFilePathField,i=void 0===a?"domainKey":a,s=t.pageKeyField,u=void 0===s?"billNo":s,c=t.modelNameField,d=void 0===c?"cName":c,h=e[i]||"",v=e[u]||"",g=function(){function e(){return r(this,e),n(this,e,arguments)}return l(e,X),o(e,[{key:"init",value:function(e,t){var a=this.createModels(e,t);this.setData(a),this.setDirty(!1)}},{key:"createModels",value:function(e,a){var n={};return(Array.isArray(e)?e:[]).forEach(function(e){var r,i,o=null==t||null===(r=t.createModelFactory)||void 0===r?void 0:r.call(t,e);o||(o=function(e){var t;"input"===e.cControlType.toLowerCase()&&(t=new q(e));return t}(e));var s={model:o,field:e,meta:a};null==t||null===(i=t.onBeforeCreateModel)||void 0===i||i.call(t,s),n[e[d]]=s.model}),n}},{key:"initData",value:function(){J.call(this,f(f({},t),{},{extendFilePath:h,pageKey:v}))}}])}();return g.prototype.modelType="ViewModel",g}function $(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;null!=t&&t.requirejs||(t.requirejs=window.__devfab);var r=function(e,t){var a=new(W(e,t));return a.init(e.models,e),a}(e,t);return r.on("destroyVM",function(){var e,t;null===(e=r)||void 0===e||null===(t=e.destroyVM)||void 0===t||t.call(e),r=null}),r.on("extendReady",a(v().m(function a(){var i;return v().w(function(a){for(;;)switch(a.n){case 0:return(i=[]).push(Y(e,r,t)),a.n=1,Promise.all(i);case 1:null==n||n(r,e);case 2:return a.a(2)}},a)}))),r.initData(),r}var Z={BaseModel:E,FilterModel:O,SimpleModel:q,GridModel:G,ViewModel:X,initViewModel:$};export{E as BaseModel,O as FilterModel,G as GridModel,q as SimpleModel,X as ViewModel,Z as default,$ as initViewModel};
|
|
3
|
+
var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function a(n,r,i,a){var u=r&&r.prototype instanceof s?r:s,c=Object.create(u.prototype);return v(c,"_invoke",function(n,r,i){var a,s,u,c=0,l=i||[],f=!1,d={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return a=t,s=0,u=e,d.n=n,o}};function h(n,r){for(s=n,u=r,t=0;!f&&c&&!i&&t<l.length;t++){var i,a=l[t],h=d.p,v=a[2];n>3?(i=v===r)&&(u=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=h&&((i=n<2&&h<a[1])?(s=0,d.v=r,d.n=a[1]):h<v&&(i=n<3||a[0]>r||r>v)&&(a[4]=n,a[5]=r,d.n=v,s=0))}if(i||n>1)return o;throw f=!0,r}return function(i,l,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,v),s=l,u=v;(t=s<2?e:u)||!f;){a||(s?s<3?(s>1&&(d.n=-1),h(s,u)):d.n=u:d.v=u);try{if(c=2,a){if(s||(i="next"),t=a[i]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==o)break}catch(t){a=e,s=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,i,a),!0),c}var o={};function s(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(v(t={},r,function(){return this}),t),f=c.prototype=s.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,v(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,v(f,"constructor",c),v(c,"constructor",u),u.displayName="GeneratorFunction",v(c,i,"GeneratorFunction"),v(f),v(f,i,"Generator"),v(f,r,function(){return this}),v(f,"toString",function(){return"[object Generator]"}),(h=function(){return{w:a,m:d}})()}function v(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}v=function(e,t,n,r){function a(t,n){v(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},v(e,t,n,r)}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],u=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||b(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function b(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}var k=function(){return o(function e(t){i(this,e),this._init(t)},[{key:"_init",value:function(e){this._data=Object.assign({},e)}},{key:"set",value:function(e,t){this._data[e]=t}},{key:"get",value:function(e){var t;return null===(t=this._data)||void 0===t?void 0:t[e]}},{key:"delete",value:function(e){delete this._data[e]}},{key:"clear",value:function(){this._data={}}}])}();k.create=function(e){return new k};var w=function(){return o(function e(t){i(this,e),this._init(t)},[{key:"_init",value:function(e){var t;this.__ASYNC_EXECUTE__=null===(t=null==e?void 0:e.__ASYNC_EXECUTE__)||void 0===t||t,this._events=new Map,this._firstevents=new Map}},{key:"on",value:function(e,t,n){var r=this._events.get(e);Array.isArray(r)||(r=[]),r.push({callback:t,context:n}),this._events.set(e,r)}},{key:"onFirst",value:function(e,t,n){var r=this._firstevents.get(e);Array.isArray(r)||(r=[]),r.splice(0,0,{callback:t,context:n}),this._firstevents.set(e,r)}},{key:"execute",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=this._events.get(e),a=this._firstevents.get(e);if(!i&&!a)return!0;var o=!0;return[].concat(g(a||[]),g(i||[])).forEach(function(e){if(!1!==o){var t=e.callback.apply(e.context||void 0,n);o=!1!==t&&o}}),o}},{key:"un",value:function(e,t){this._unEvents(e,t,this._events),this._unEvents(e,t,this._firstevents)}},{key:"_unEvents",value:function(e,t,n){if(e&&n.has(e))if(t){var r=n.get(e),i=null==r?void 0:r.findIndex(function(e){return e.callback===t});-1!==i&&(null==r||r.splice(i,1))}else n.delete(e)}},{key:"hasEvent",value:function(e){var t,n;return e?((null===(t=this._events.get(e))||void 0===t?void 0:t.length)||0)+((null===(n=this._firstevents.get(e))||void 0===n?void 0:n.length)||0):0}},{key:"fireEvent",value:function(e,t){this.execute("before".concat(e),t)&&(this.execute(e,t),this.execute("after".concat(e),t))}},{key:"_asyncExecute",value:function(e,t,n){for(var r,i=this,a=n.resolve,o=n.reject,s=n.args,u=!0,c=t||[],l=!1,f=function(t){var n,r=c[t];if(!1===u)return 0;if(l)return{v:void 0};if("development"===process.env.nodeEnv)n=r.callback.apply(r.context||i,s);else try{n=r.callback.apply(r.context||i,s)}catch(e){throw e.isAddedMsg||(e.message="(领域扩展事件执行失败,请打开控制台查看详细错误信息并修复):".concat(e.message)),e.isAddedMsg=!0,e}n instanceof Promise?(l=!0,(u=n).callbacks&&u.callbacks.push({reject:function(){u.reject(),t===c.length-1&&(null==o||o())},resolve:function(n){t===c.length-1?(s.length>1&&(s[0]=n),null==a||a(s)):i._asyncExecute(e,c.slice(t+1),{resolve:a,reject:o,args:s})}})):(u=!1!==n&&u,t===c.length-1&&(u?null==a||a(s):null==o||o()))},d=0;d<c.length&&0!==(r=f(d));d++)if(r)return r.v;return u}},{key:"_asyncPromiseExecute",value:function(e,t,n,r){var i=this._events.get(e),a=this._firstevents.get(e);if(!((Array.isArray(i)?i.length:i)||(Array.isArray(a)?a.length:a)))return null==t?void 0:t();var o=[].concat(g(a||[]),g(i||[]));return this._asyncExecute(e,o,{resolve:t,reject:n,args:r})}},{key:"promiseExecute",value:function(e,t){var n=this,r=e,i=1;if("boolean"==typeof e&&(r=t,i=2),r){for(var a=arguments.length,o=new Array(a>2?a-2:0),s=2;s<a;s++)o[s-2]=arguments[s];var u=2===i?o:[t].concat(o);if(u.length){var c,l=u.length-1,f=u[l];if("function"!=typeof f){if("object"!==m(f)||!f[0]||"function"!=typeof f[0]||!f[1]||"function"!=typeof f[1])return;c=f[1],f=f[0]}if(this.__ASYNC_EXECUTE__)return this._asyncPromiseExecute(r,function(e){f.apply(n,e)},function(){c&&"function"==typeof c&&c()},u);u.splice(l,1),u.unshift(r);var d=this.execute.apply(this,u);if(d instanceof Promise){var h=this;d.then(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];f.apply(h,t)},function(){c&&"function"==typeof c&&c()})}else if(!d)return void(c&&"function"==typeof c&&c())}}}},{key:"clear",value:function(){this._events.clear(),this._firstevents.clear()}}])}();function x(e){return e||window.devfab&&window.devfab.debug}function P(e){this.pathname="",this.query={};var t=e;this.init=function(){t||(t=location.search);var e=t.indexOf("?"),n=t.indexOf("#");if(e>=0){if(this.pathname=t.substr(0,e),(t=n<0?t.substr(e+1):t.substring(e+1,n)).length>0)for(var r=(t=t.replace(/\+/g," ")).split("&"),i=0,a=r.length;i<a;i++){var o=r[i]||"";if(o){var s=o.indexOf("="),u="",c="";s<0?c=u=window.decode(o):(u=window.decode(o.substr(0,s)),c=window.decode(o.substr(s+1))),this.query[u]=c}}}else this.pathname=t},this.set=function(e,t){this.query[e]=t},this.get=function(e){return this.query[e]},this.del=function(e){delete this.query[e]},this.has=function(e){return null!=this.query[e]},this.toStr=function(){var e=["?"];for(var t in this.query)e.push(encodeURIComponent(t)),e.push("="),e.push(encodeURIComponent(this.query[t])),e.push("&");return 1===e.length?"":(e.splice(e.length-1,1),e.join(""))},this.init()}function S(e,t){if(!t)return e;var n=[],r=new P(e);for(var i in t)r.get(i)||n.push("".concat(i,"=").concat(t[i]));if(!n.length)return e;var a=n.join("&");return e.indexOf("?")>=0?"".concat(e,"&").concat(a):"".concat(e,"?").concat(a)}w.create=function(e){return new w(e)},String.prototype.equalsIgnoreCase=function(e){return null!=e&&this.toLowerCase()===e.toLowerCase()};var j={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t,n=e.method||"GET",r=e.url;try{null!=e&&e.requestHeaders&&(t=e.requestHeaders,e.requestHeaders=void 0,delete e.requestHeaders)}catch(e){x()&&console.log('[devfab][ajax]: [doRequest]: options["requestHeaders"] ERR : ',e)}try{e.params&&e.params.requestHeaders&&(t=e.params.requestHeaders,e.params.requestHeaders=void 0,delete e.params.requestHeaders)}catch(e){x()&&console.log('[devfab][ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var i=null;if(n.equalsIgnoreCase("get")||n.equalsIgnoreCase("delete")?r=S(r,e.params):(n.equalsIgnoreCase("post")||n.equalsIgnoreCase("put"))&&(i=JSON.stringify(e.params)),e.jsonp)return this.getJsonp(r,e.callback);var a=this.getXMLHttpRequest();if(a){var o;if(a.open(n,r,!1!==e.async),e.timeout&&(a.timeout=e.timeout,a.setRequestHeader("timeout",e.timeout),a.ontimeout=function(){j.onerror(this,e,"timeout")}),e.contentType){if(a.setRequestHeader("Content-Type",e.contentType),e.contentType.indexOf("x-www-form-urlencoded")>=0)i=null===(o=new URLSearchParams(e.params))||void 0===o?void 0:o.toString()}else e.dateType?i=e.params:a.setRequestHeader("Content-Type","application/json;charset=utf-8");try{if(t&&"[object Object]"===Object.prototype.toString.call(t))for(var s in t)a.setRequestHeader(s,t[s])}catch(e){x()&&console.log('[devfab][ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}a.withCredentials=null==e||!e.hasOwnProperty("withCredentials")||e.withCredentials,e.onBeforeRequest&&e.onBeforeRequest(a,i);try{a.send(i)}catch(t){return{error:"NetWorkError",options:e}}if(!1===e.async)return this.onreadystatechange(a,e);a.onreadystatechange=function(){j.onreadystatechange(this,e)}}},onreadystatechange:function(e,t){if(4===e.readyState){if(200===e.status){var n;try{if("blob"===t.responseType){var r=function(e){var t=e.xhr.getAllResponseHeaders(),n={};return t.split("\r\n").map(function(e){var t=p(e.split(": "),2),r=t[0],i=t[1];n[r]=i}),n}({xhr:e});n={code:e.status,data:{data:e.response,headers:r}}}else n=JSON.parse(e.responseText)}catch(n){j.onerror(e,t,e.responseText)}if(!1===t.async)return e.isBusy=!1,t.onAfterRequest&&t.onAfterRequest(n),j.parseAjaxResult(n,!1,null,null,t,e);j.parseAjaxResult(n,t.async,t.callback,t.context,t,e),t.onAfterRequest&&t.onAfterRequest(n)}else if(0===e.status)j.onerror(e,t,"The network connection has been disconnected. Please check the network status of the device and try.");else if(502===e.status||504===e.status)j.onerror(e,t,"An error has occurred with the service. Please try again later.");else{if(401!==e.status){var i={};try{i=JSON.parse(e.responseText)}catch(t){i={code:e.status,message:e.responseText}}return j.onerror(e,t,i)}j.onerror(e,t,"Login information has expired. Please log in again or contact technical staff.")}e.isBusy=!1}},onerror:function(e,t,n){var r="[devfab][ajax]: [onerror]: api error \n [code]: ".concat(e.status," \n [error]: ").concat(("object"===m(n)?JSON.stringify(n):n)||"空"," \n [url]: ").concat(t.url," \n [token]: ").concat(document.cookie);x()&&console.log(r);var i="object"===m(n)?n:{code:500,message:n};t.onAfterRequest&&t.onAfterRequest(i)},getXMLHttpRequest:function(){return this.createXMLHttpRequest()},createXMLHttpRequest:function(){return window.XMLHttpRequest?new XMLHttpRequest:window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):null},getJsonp:function(e,t){var n=e,r="callback"+this._jsonps.index++,i=document.createElement("script");this._jsonps[r]=function(e){try{t(e)}finally{document.body.removeChild(i)}},n+=-1===n.indexOf("?")?"?":"&callback=cb.rest.AjaxUtil._jsonps."+r,i.src=n,document.body.appendChild(i)},parseAjaxResult:function(e,t,n,r,i,a){if(e){if(!e.code)return!1===t?e:void(n&&n.call(r,null,e));if(200==e.code){if(!1===t)return{result:e.data};n&&n.call(r,null,e.data,e.message,e.errorDetail,e.code,e.displayCode&&e)}else{if(!1===t)return{error:e};n&&n.call(r,e)}}}};function A(e,t){this.init&&this.init(e),this.queryParams=t}A.create=function(e,t){return new A(e,t)},A.prototype.init=function(e){if(e)for(var t in this.config=e,this.config)this[t]=function(e){return function(t,n,r){return this.Do(e,t,n,null,r)}}(t),this["".concat(t,"Sync")]=function(e){return function(t){return this.Do(e,t,null,!1)}}(t)},A.prototype.Do=function(e,t,n,r,i){var a,o,s;if(this.config&&this.config[e]&&this.config[e].url){var u=this.config[e],c=u.url;this.queryParams||(this.queryParams={}),null!==(a=u.options)&&void 0!==a&&a.proxyServiceCode&&(this.queryParams.serviceCode=u.options.proxyServiceCode),null!==(o=u.options)&&void 0!==o&&o.billnum&&(this.queryParams.billnum=u.options.billnum),null!==(s=this.queryParams)&&void 0!==s&&s.serviceCode&&(c=S(c,this.queryParams));var l=c,f=Object.assign({},u.options);return f.method=u.method||"GET","function"==typeof t?(f.callback=t,f.context=i||f.context||this):f.params=t,n&&(f.callback=n,f.context=i||f.context||this),!1===r&&(f.async=!1),this.ajax(l,f)}},A.prototype.ajax=function(e,t){return function(e,t){return t.url=e,j.doRequest(t)}(e,t)};var q=function(){return o(function e(t){i(this,e),this._init(t)},[{key:"_init",value:function(e){this._data={};var t=[];if(e)for(var n in e)t.push(n);Object.assign(this._data,{components:[],propertyNames:t},e),this._data.cache=new k,this._data.events=new w}},{key:"_del_data",value:function(e){e&&delete this._data[e]}},{key:"_cls_data",value:function(){this._data.cache.clear(),this._data.events.clear(),this._data={components:[],propertyNames:[],cache:new k,events:new w}}},{key:"_set_data",value:function(e,t,n){if(e){if(n){var r=this._data.propertyNames||[];r.indexOf(e)<0&&r.push(e)}this._data[e]=t}}},{key:"_get_data",value:function(e){if(e)return this._data[e]}},{key:"getData",value:function(){return this._get_data("value")}},{key:"getState",value:function(e,t){var n;if(!t)return this._get_data(e);var r=(this._get_data("components")||[]).find(function(e){return e.ctrlName===t});return r?null===(n=r.getState)||void 0===n?void 0:n.call(r,e):this._get_data(e)}},{key:"setState",value:function(e,t,n){n||this._set_data(e,t,!0);var r={};r[e]=t,this.doPropertyChange("setState",r,n)}},{key:"doPropertyChange",value:function(e,t,n){var r=this,i=this._get_data("components")||[];if(!i.length)return i;var a=[];if(n){var o=i.find(function(e){return e.ctrlName===n});o&&!this.notifyComponent(o,e,t)&&a.push(o)}else i.forEach(function(n){r.notifyComponent(n,e,t)||a.push(n)});return a.length?a:void 0}},{key:"notifyComponent",value:function(e,t,n){return"function"==typeof e[t]&&(this.viewUpdater(e,t,n),!0)}},{key:"viewUpdater",value:function(e,t,n){if("setState"===t)e[t](n);else{var r=this.getCache("name");e[t](n,r)}}},{key:"get",value:function(e){return this._get_data(e)}},{key:"addComponent",value:function(e,t){if(e){t&&!e.ctrlName&&(e.ctrlName=t);var n=this._get_data("components")||[];n.indexOf(e)>=0||n.push(e)}}},{key:"removeComponent",value:function(e){var t=this._get_data("components")||[],n=t.indexOf(e);n<0||t.splice(n,1)}},{key:"_applyState",value:function(e,t,n){var r=this;n||this._set_data(e,t,!0);var i="set".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),a=this.doPropertyChange(i,t,n);if(a){var o={};o[e]=t,a.forEach(function(e){r.notifyComponent(e,"setState",o)})}}},{key:"getVisible",value:function(e){return this.getState("visible",e)}},{key:"setVisible",value:function(e,t){this._applyState("visible",e,t)}},{key:"getValue",value:function(){return this.getData()}},{key:"setValue",value:function(e,t,n){var r=this,i=this.getValue();if(e!==i){var a={value:e,oldValue:i},o=this._get_data("forceFireEvent");t||o?this.promiseExecute("beforeValueChange",a,[function(){r._set_data("value",e,!0),r._applyState("value",e,n),r.execute("afterValueChange",a)},function(){r._set_data("value",i,!0),r._applyState("value",i,n)}]):(this._set_data("value",e,!0),this._applyState("value",e,n))}}},{key:"getDisabled",value:function(e){return this.getState("disabled",e)}},{key:"setDisabled",value:function(e,t){this._applyState("disabled",e,t)}},{key:"setParent",value:function(e){this.setCache("parent",e)}},{key:"getParent",value:function(){return this.getCache("parent")}},{key:"getRootParent",value:function(){for(var e=this.getParent();null!==(t=e)&&void 0!==t&&t.getParent();){var t;e=e.getParent()}return e}},{key:"setName",value:function(e){this.setCache("name",e)}},{key:"getName",value:function(){return this.getCache("name")}},{key:"setDirty",value:function(e){e?this._set_data("isDirty",!0):(this._del_data("isDirty"),this._set_data("originalData",this.getData()))}},{key:"getDirtyData",value:function(e){var t=this.getData();return!1!==e&&this._get_data("isDirty")||t!==this._get_data("originalData")?t:void 0}},{key:"clear",value:function(e){void 0===e?this._set_data("value",this._get_data("cDefaultValue")):e||this._set_data("value",void 0),this._del_data("isDirty"),this._del_data("checking"),this._del_data("checkMsg")}},{key:"on",value:function(e,t,n){this._get_data("events").on(e,t,n)}},{key:"onFirst",value:function(e,t,n){this._get_data("events").onFirst(e,t,n)}},{key:"execute",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return(t=this._get_data("events")).execute.apply(t,[e].concat(r))}},{key:"un",value:function(e,t){this._get_data("events").un(e,t)}},{key:"hasEvent",value:function(e){return this._get_data("events").hasEvent(e)}},{key:"fireEvent",value:function(e,t){this._get_data("events").fireEvent(e,t)}},{key:"promiseExecute",value:function(e,t){for(var n,r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a];(n=this._get_data("events")).promiseExecute.apply(n,[e,t].concat(i))}},{key:"setCache",value:function(e,t){this._get_data("cache").set(e,t)}},{key:"getCache",value:function(e){return this._get_data("cache").get(e)}},{key:"clearCache",value:function(e){this._get_data("cache").delete(e)}},{key:"setProxy",value:function(e){if(!(e instanceof A)){var t,n=this._get_data("__requestHeaders__");for(var r in e){var i,a,o;if(n&&(null===(i=e[r])||void 0===i||null===(i=i.options)||void 0===i||!i.requestHeaders))null!==(o=e[r])&&void 0!==o&&o.options||(e[r].options={}),e[r].options.requestHeaders=n;null!==(a=this.getProxy())&&void 0!==a&&a[r]&&window.devfab.debug&&console.warn("[devfab][baseModel.prototype.setProxy]: Proxy ".concat(r," already exists on the model. Please change the name of ").concat(r," and try again"))}return this._set_data("proxy",A.create(d(d({},(null===(t=this.getProxy())||void 0===t?void 0:t.config)||{}),e))),this.getProxy()}this._set_data("proxy",e)}},{key:"getProxy",value:function(){return this._get_data("proxy")}}])}(),C=function(){function e(){var t;i(this,e);for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return s(t=r(this,e,[].concat(a)),"modelType","SimpleModel"),t}return c(e,q),o(e,[{key:"getDisabled",value:function(){return this.getState("disabled")}},{key:"setDisabled",value:function(e,t){this._applyState("disabled",e,t)}},{key:"getReadonly",value:function(){return this.getState("readonly")}},{key:"setReadonly",value:function(e,t){this._applyState("readonly",e,t)}}])}(),O=Array.isArray;function E(e){if(O(e))return e.map(E);if(e instanceof Date)return new Date(e.getTime());if(e&&"object"===m(e)){var t={};for(var n in e)t[n]=E(e[n]);return t}return e}function M(e,t,n){var r=this;this.promiseExecute("beforeQuery",{proxyConfig:e,queryParams:t},function(){var i=r,a=r.setProxy({queryData:e}),o=r._get_data("innerUsedAttrs").pageIndex,u={page:s(s({},r._get_data("innerUsedAttrs").pageSize,r.getPageSize()),o,r.getPageIndex())},c=Object.assign(t,u);r.setCache("proxyCache",{proxyConfig:e,params:c,callback:n});if(!1!==r.execute("beforeQueryData",c)){var l=E(c);a.queryData(l,function(e,t,r,i){if(!e){var a=t;this._set_data("dataSourceMode","remote");var o=function(e){if(!e)return[];if(O(e))return e;if(O(e.data))return e.data;if(O(e.records))return e.records;if(O(e.list))return e.list;if(O(e.rows))return e.rows;var t=e.data&&"object"===m(e.data)?e.data:e.result;return O(t)?t:t&&"object"===m(t)&&(t.records||t.list||t.rows||t.data)||[]}(a=Object.assign({},a));this.execute("afterQueryData",a),null==n||n.call(this,o)}},i)}})}function D(e){if(this.execute("beforeSetDataSource",e)){var t=this.getRowKeyField(),n={};e.forEach(function(e){n[e[t]]=e}),this._set_data("keyMap",n),this._set_data("dataSource",e,!0),this.doPropertyChange("setDataSource"),this.execute("afterSetDataSource",e)}}var R=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var a,o=d(d({},{columns:{},dataSource:[],rows:[],readOnly:!0,dataSourceMode:"local",columnMode:"local",editMode:"cell",rowKeyField:"id",cellState:{},rowState:{},showCheckBox:!1,multiple:!0,showRowNo:!0,pagination:!0,pageInfo:s(s(s({},(a={id:"_id",selected:"_selected",status:"_status",pageIndex:"pageNo",pageSize:"pageSize",pageCount:"total"}).pageIndex,1),a.pageSize,20),a.pageCount,0),innerUsedAttrs:a,multiRowModel:!1,editRowModels:{},loading:!1,params:{},originalKeyMap:{},defaultRowDatas:new Map}),n);O(o.dataSource)||(o.dataSource=[]),O(o.rows)||(o.rows=[]);var u=function(){return d({},(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).proxyConfig||{})}(n);return o.proxyConfig=u,o.dataSourceMode=n.dataSourceMode||o.dataSourceMode,s(t=r(this,e,[o]),"modelType","GridModel"),t.initColumns(o.columns),t.initPageInfo(n.cPage||n.page),t.afterInit(),t}return c(e,q),o(e,[{key:"afterInit",value:function(){this.execute("afterInit")}},{key:"initColumns",value:function(e){var t=function(e){var t={};return(O(e)?e:Object.keys(e||{}).map(function(t){var n;return d(d({},e[t]||{}),{},{field:(null===(n=e[t])||void 0===n?void 0:n.field)||t})})).forEach(function(e,n){if(e){var r=e.field||e.cFieldName||e.cName||"col_".concat(n);t[r]=d(d({},e),{},{field:r,label:e.label||e.title||e.cCaption||r,index:void 0===e.index?n:e.index})}}),t}(e);return this._set_data("columns",t,!0),t}},{key:"initPageInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=d({},this.getPageInfo()),n=this._get_data("innerUsedAttrs").pageIndex,r=this._get_data("innerUsedAttrs").pageSize;t[n]=e.pageNo||e.pageIndex||t.pageIndex||1,t[r]=e.pageSize||t.pageSize||20,!1===this.get("pagination")&&(t[n]=-1),this._set_data("pageInfo",t)}},{key:"getRowKeyField",value:function(){return this._get_data("rowKeyField")}},{key:"isRemote",value:function(){return"remote"===this._get_data("dataSourceMode")}},{key:"getReadOnly",value:function(){return!!this._get_data("readOnly")}},{key:"setReadOnly",value:function(e){this._applyState("readOnly",!!e)}},{key:"setShowCheckbox",value:function(e){this._applyState("showCheckBox",!!e)}},{key:"setShowRowNo",value:function(e){this._applyState("showRowNo",!!e)}},{key:"getParams",value:function(){return d(d({},this.get("cParams")||{}),this._get_data("params")||{})}},{key:"setParams",value:function(e){this._set_data("params",e||{})}},{key:"getInnerUsedAttrs",value:function(e){var t=this._get_data("innerUsedAttrs");return e?t[e]:t}},{key:"getId",value:function(){return this.getInnerUsedAttrs("id")}},{key:"setDataSource",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if("local"===this._get_data("dataSourceMode")){D(O(e)?e:[])}else{if(!this.execute("beforeProxyLoad",n))return;this.setPageIndex(1),M.call(this,e,n,function(e){D.call(t,e),null==r||r.call(t)})}}},{key:"reloadData",value:function(){var e=this,t=this.getCache("proxyCache");if(t){var n=t.proxyConfig,r=t.params,i=t.callback;M.call(this,n,r,function(t){null==i||i.call(e,t)})}else x()&&console.log("[devfab][GridModel] proxyConfig is null")}},{key:"getDataSource",value:function(){return this._get_data("dataSource")||[]}},{key:"getData",value:function(e){return e?this._get_data("rows"):this._get_data("dataSource")}},{key:"getAllData",value:function(){return this.getData(!0)}},{key:"clear",value:function(){this._set_data("dataSource",[],!0),this._set_data("rows",[],!0)}},{key:"getPageInfo",value:function(){return this._get_data("pageInfo")}},{key:"getPageIndex",value:function(){var e=this._get_data("innerUsedAttrs").pageIndex;return this.getPageInfo()[e]}},{key:"getPageSize",value:function(){var e=this._get_data("innerUsedAttrs").pageSize;return this.getPageInfo()[e]}},{key:"getTotalCount",value:function(){var e=this._get_data("innerUsedAttrs").pageCount;return this.getPageInfo()[e]}},{key:"setPageInfo",value:function(e){var t=this.getPageInfo();this._set_data("pageInfo",d(d({},t),e)),this.reloadData()}},{key:"setPageIndex",value:function(e){if("number"==typeof e){var t=this._get_data("innerUsedAttrs").pageIndex;this._set_data("pageInfo",d(d({},this.getPageInfo()),{},s({},t,Math.max(1,e))))}}},{key:"setPageSize",value:function(e){if("number"==typeof e){var t=this._get_data("innerUsedAttrs").pageIndex,n=this._get_data("innerUsedAttrs").pageSize;this._set_data("pageInfo",d(d({},this.getPageInfo()),{},s(s({},n,Math.max(-1,e)),t,1)))}}},{key:"setTotalCount",value:function(e){var t=this._get_data("innerUsedAttrs").pageCount;this.getPageInfo()[t]=e}}])}(),I=function(){function e(){var t;i(this,e);for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return s(t=r(this,e,[].concat(a)),"modelType","ViewModel"),t}return c(e,q),o(e,[{key:"getParams",value:function(){return this._get_data("params")}},{key:"setParams",value:function(e){this._set_data("params",e,!0)}},{key:"set",value:function(e,t){t instanceof q&&(t.setParent(this),t.setName(e)),this._set_data(e,t,!0)}},{key:"setData",value:function(e){for(var t in e)this.addProperty(t,e[t])}},{key:"addProperty",value:function(e,t){var n=this.get(e);null!=n&&n.setData?n.setData(t):this.set(e,t)}},{key:"getData",value:function(){var e=this,t=this._get_data("propertyNames")||[],n={};return t.forEach(function(t){var r,i=e.get(t);i instanceof q&&!1!==i._get_data("needCollect")&&(n[t]=null===(r=i.getData)||void 0===r?void 0:r.call(i))}),n}},{key:"getAllData",value:function(e){var t=this,n=this._get_data("propertyNames")||[],r={};return n.forEach(function(n){var i,a=t.get(n);if(a instanceof q&&!1!==a._get_data("needCollect")&&(!e||!a._get_data("isGrid"))){var o=null===(i=a.getData)||void 0===i?void 0:i.call(a);void 0!==o&&(r[n]=o)}}),r}},{key:"removeProperty",value:function(e){var t=this._get_data("propertyNames")||[],n=t.indexOf(e);-1!==n&&t.splice(n,1),this._del_data(e)}},{key:"loadData",value:function(e){this.setCache("isLoadData",!0),this.clear(),this.setData(e),this.setDirty(!1),this.setCache("isLoadData",!1)}},{key:"clear",value:function(e){var t=this;(this._get_data("propertyNames")||[]).forEach(function(n){var r,i=t.get(n);i instanceof q&&!1!==i._get_data("needClear")&&(null===(r=i.clear)||void 0===r||r.call(i,e))})}},{key:"setDirty",value:function(e){e?this._set_data("isDirty",!0):(this._del_data("isDirty"),this._set_data("originalData",this.getData()))}},{key:"getGridModel",value:function(e){var t;if(e)return this.get(e);var n=this._get_data("gridModel");if(n)return n;var r=null===(t=this.getParams())||void 0===t?void 0:t.masterGridModelName;if(r)return this.get(r);for(var i=this._get_data("propertyNames"),a=0,o=i.length;a<o;a++){if((n=this.get(i[a]))instanceof R||"GridModel"==n.modelType)return this._set_data("gridModel",n),n}}},{key:"getGridModels",value:function(){for(var e=this._get_data("propertyNames"),t=[],n=0,r=e.length;n<r;n++){var i=this.get(e[n]);(i instanceof R||"GridModel"==i.modelType)&&t.push(i)}return t}},{key:"getGridFilterModel",value:function(e){return this.getGridModel(e).getCache("FilterViewModel")}}])}(),T=403;function U(e){return String(null==e?"":e).replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}var N=function(){return o(function e(t){i(this,e),this.manifest=null,this.origins=null,this.lockVersion=null,this.verifyHash=!0,this.fetch=null,this._index=null,this.configure(t)},[{key:"configure",value:function(e){var t=e||{};return void 0!==t.manifest&&(this.manifest=t.manifest||null),void 0!==t.origins&&(this.origins=t.origins?[].concat(t.origins).map(function(e){return String(e).trim().replace(/\/+$/,"")}):null),void 0!==t.lockVersion&&(this.lockVersion=t.lockVersion||null),void 0!==t.verifyHash&&(this.verifyHash=!!t.verifyHash),void 0!==t.fetch?this.fetch=t.fetch||null:this.fetch||"function"!=typeof fetch||(this.fetch=function(){return fetch.apply(void 0,arguments)}),this._index=null,this}},{key:"enabled",get:function(){return!!this.manifest}},{key:"_moduleIndex",value:function(){if(this._index)return this._index;var e={},t=this.manifest&&this.manifest.modules;return Array.isArray(t)?t.forEach(function(t){t&&t.path&&(e[U(t.path)]=t)}):t&&"object"===m(t)&&Object.keys(t).forEach(function(n){e[U(n)]=t[n]||{}}),this._index=e,e}},{key:"entryOf",value:function(e){return this.manifest&&this._moduleIndex()[U(e)]||null}},{key:"checkVersion",value:function(){if(!this.lockVersion||!this.manifest)return null;var e=String(this.manifest.version||"");return e===String(this.lockVersion)?null:{code:T,message:"清单版本 ".concat(e||"(未声明)"," 与锁定版本 ").concat(this.lockVersion," 不一致,拒绝加载")}}},{key:"checkModules",value:function(e){var t=this.checkVersion();if(t)return t;if(!this.manifest)return null;for(var n=0;n<e.length;n++){var r=U(e[n]);if(!this._moduleIndex()[r])return{code:T,message:"Module ".concat(r," not registered in the list, loading denied.")}}return null}},{key:"checkOrigin",value:function(e){if(!this.origins)return null;if(!function(e){return/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(e)||/^(?:blob|data):/i.test(e)}(e))return null;var t;try{t=new URL(e).origin}catch(t){return{code:T,message:"无法解析的地址:".concat(e)}}return-1===this.origins.indexOf(t)?{code:T,message:"来源 ".concat(t," 不在白名单内(允许:").concat(this.origins.join(", "),")")}:null}},{key:"verify",value:function(e,t){var n=this;if(!this.verifyHash)return Promise.resolve({ok:!0,skipped:"disabled"});if(!t)return Promise.resolve({ok:!0});var r="undefined"!=typeof globalThis&&globalThis.crypto&&globalThis.crypto.subtle;return r?this.fetch?Promise.resolve().then(function(){return n.fetch(e)}).then(function(e){return e&&e.ok?e.arrayBuffer().then(function(e){return r.digest("SHA-256",e)}):{ok:!1,message:"完整性预检请求失败:HTTP ".concat(e&&e.status||"unknown")}}).then(function(e){if(!e||!1===e.ok)return e;var n=function(e){for(var t=new Uint8Array(e),n="",r=0;r<t.length;r++)n+=t[r].toString(16).padStart(2,"0");return n}(e),r=String(t).toLowerCase();return n!==r?{ok:!1,message:"sha256 不匹配:期望 ".concat(r,",实际 ").concat(n)}:{ok:!0}}).catch(function(e){return{ok:!1,message:"完整性预检异常:".concat(e&&e.message||e),error:e}}):Promise.resolve({ok:!0,skipped:"fetch unavailable"}):Promise.resolve({ok:!0,skipped:"crypto.subtle unavailable(需要 https / localhost)"})}},{key:"describe",value:function(){return{manifest:this.enabled?this.manifest.name||"(unnamed)":null,version:this.manifest&&this.manifest.version||null,lockVersion:this.lockVersion,modules:this.enabled?Object.keys(this._moduleIndex()).length:0,origins:this.origins?this.origins.slice():null,verifyHash:this.verifyHash}}}])}(),H=["$","jQuery","define","require","requirejs","devfab","__devfab","__devfab_requirejs"],V=function(){return o(function e(t){i(this,e);var n=t||{};this.maxPollution=void 0===n.maxPollution?3:Number(n.maxPollution),this.watch=[].concat(n.watch||H),this.target=n.target||("undefined"!=typeof window?window:null),this.enabled=void 0===n.enabled||!!n.enabled,this._pending=0,this._before=null,this.lastWarnings=[]},[{key:"_snapshot",value:function(){var e=new Map,t=this.target;return t?(Object.keys(t).forEach(function(n){e.set(n,t[n])}),e):e}},{key:"_diff",value:function(){var e=this,t=this._before,n=this._snapshot(),r=[];if(!t)return r;n.forEach(function(n,i){var a=-1!==e.watch.indexOf(i);t.has(i)?t.get(i)!==n&&r.push({type:"overwritten",key:i,watched:a}):r.push({type:"added",key:i,watched:a})});var i=r.filter(function(e){return e.watched}).length,a=r.filter(function(e){return"added"===e.type}).length;return!i&&a<=this.maxPollution?[]:r}},{key:"begin",value:function(){var e=this;if(!this.enabled||!this.target)return{end:function(){return[]}};this._pending++,1===this._pending&&(this._before=this._snapshot());var t=!1;return{end:function(){if(t)return[];if(t=!0,e._pending--,e._pending>0)return[];var n=e._diff();return e._before=null,e.lastWarnings=n,n}}}},{key:"configure",value:function(e){var t=e||{};return void 0!==t.enabled&&(this.enabled=!!t.enabled),void 0!==t.maxPollution&&(this.maxPollution=Number(t.maxPollution)),void 0!==t.watch&&(this.watch=[].concat(t.watch||[])),void 0!==t.target&&(this.target=t.target||null),this}}])}(),F=null;try{F=new Function("s","return import(s)")}catch(e){F=null}function G(e,t,n,r){var i=e,a=t,o=n;Array.isArray(e)&&!Array.isArray(t)&&(i=null==r?void 0:r.path,a=e,o="function"==typeof t?t:n);var s=(a=Array.isArray(a)?a:[]).join(","),u={code:0,message:"",data:[],warnings:[]};return("require"===r.type&&"function"!=typeof r.require||"define"===r.type&&"function"!=typeof r.define)&&(u.code=404,u.message="requirejs is undefined, the fiels: ".concat(s)),{path:i,files:a,callback:o,filesStr:s,result:u}}function L(e,t){var n="";return Array.isArray(e)?n=e.filter(Boolean).join("/"):"string"==typeof e&&(n=e.replace(/\/+$/,"")),t.map(function(e){var t=String(e).replace(/^\/+/,"");return n?"".concat(n,"/").concat(t):t})}function z(e,t){var n=Number(e);return Number.isFinite(n)?n:t}var B="",X=15e3,J=0,K="",W=function(){return o(function e(t){var n,r,a,o;i(this,e);var s=t||{};this.__debug=null!==(n=s.__debug)&&void 0!==n&&n,this.__rootPath=void 0,this.__define=s.define||(null===(r=window.__devfab_requirejs)||void 0===r?void 0:r.define),this.__require=s.require||(null===(a=window.__devfab_requirejs)||void 0===a?void 0:a.require),this.__undef=s.undef||("function"==typeof(null===(o=this.__require)||void 0===o?void 0:o.undef)?this.__require.undef:null),this.__requireConfig=s.requireConfig||this._pickRequireConfig(this.__require),this.__import=s.importer||null,this._setTimer=s.setTimeout||function(e,t){return setTimeout(e,t)},this._clearTimer=s.clearTimeout||function(e){return clearTimeout(e)},this.options={version:s.version?String(s.version):B,timeout:void 0===s.timeout?X:Math.max(0,z(s.timeout,0)),retry:void 0===s.retry?J:Math.max(0,z(s.retry,0)),strict:!!s.strict,baseUrl:s.baseUrl||K},this.policy=new N(s),this.guard=new V(this._guardOptions(s)),this.options.version&&this._applyUrlArgs()},[{key:"_pickRequireConfig",value:function(e){var t,n=e&&"function"==typeof e.config?e:null===(t=window.__devfab_requirejs)||void 0===t?void 0:t.require;return n&&"function"==typeof n.config?n.config.bind(n):null}},{key:"_guardOptions",value:function(e){return!1===e.pollution?{enabled:!1,target:e.target}:e.pollution&&"object"===m(e.pollution)?Object.assign({target:e.target},e.pollution):{target:e.target,watch:e.watch,maxPollution:e.maxPollution,enabled:void 0===e.pollution||!!e.pollution}}},{key:"configure",value:function(e){var t=e||{};return void 0!==t.debug&&(this.__debug=!!t.debug),void 0!==t.version&&this.setVersion(t.version),void 0!==t.timeout&&(this.options.timeout=Math.max(0,z(t.timeout,this.options.timeout))),void 0!==t.retry&&(this.options.retry=Math.max(0,z(t.retry,this.options.retry))),void 0!==t.strict&&(this.options.strict=!!t.strict),void 0!==t.baseUrl&&(this.options.baseUrl=t.baseUrl||""),void 0===t.manifest&&void 0===t.origins&&void 0===t.lockVersion&&void 0===t.verifyHash&&void 0===t.fetch||this.policy.configure(t),void 0!==t.pollution?this.guard.configure(this._guardOptions(t)):void 0===t.watch&&void 0===t.maxPollution&&void 0===t.target||this.guard.configure(t),this}},{key:"setVersion",value:function(e){return this.options.version=e?String(e):"",this._applyUrlArgs(),this}},{key:"_applyUrlArgs",value:function(){if("function"!=typeof this.__requireConfig)return!1;try{return this.__requireConfig({urlArgs:this.options.version?"v=".concat(encodeURIComponent(this.options.version)):""}),!0}catch(e){return!1}}},{key:"getVersion",value:function(){return this.options.version}},{key:"_snapshotConfig",value:function(){return{__debug:this.__debug,version:this.options.version,timeout:this.options.timeout,retry:this.options.retry,strict:this.options.strict,baseUrl:this.options.baseUrl,manifest:this.policy.manifest,origins:this.policy.origins,lockVersion:this.policy.lockVersion,verifyHash:this.policy.verifyHash,fetch:this.policy.fetch,pollution:this.guard.enabled,watch:this.guard.watch,maxPollution:this.guard.maxPollution,target:this.guard.target}}},{key:"describe",value:function(){return Object.assign({},this.options,{debug:this.__debug,policy:this.policy.describe(),pollutionGuard:this.guard.enabled,canUndef:"function"==typeof this.__undef,canNativeImport:"function"==typeof(this.__import||F)})}},{key:"_define",value:function(e,t,n){var r=G(e,t,n,{path:this.__rootPath,define:this.__define,type:"define"}),i=r.path,a=r.files,o=r.callback,s=r.result;404!==s.code?this.__define(i,a,o):null==o||o(s)}},{key:"_mergeWarnings",value:function(e,t){var n=(e||[]).slice();return(t||[]).forEach(function(e){n.some(function(t){return t.type===e.type&&t.key===e.key})||n.push(e)}),n}},{key:"_undefModules",value:function(e){var t=this;"function"==typeof this.__undef&&e.forEach(function(e){try{t.__undef(e)}catch(e){}})}},{key:"_load",value:function(e,t,n){var r=this,i=this.options,a=G(e,t,n,{path:this.__rootPath,require:this.__require,type:"require"}),o=a.path,s=a.files,u=a.callback,c=a.result,l=a.filesStr;if(404!==c.code){var f=L(o,s),d=this.policy.checkModules(f);if(d)return c.code=d.code,c.message=d.message,void(null==u||u(c));var h=!1,v=0,y=null,p=null,g=function(){p&&(c.warnings=r._mergeWarnings(c.warnings,p.end()),p=null)},_=function(){h||(h=!0,null!==y&&(r._clearTimer(y),y=null),g(),i.strict&&c.warnings.length&&(c.code=500,c.message="Global pollution detection failed:".concat(c.warnings.map(function(e){return"".concat(e.type,":").concat(e.key)}).join(", "))),null==u||u(c))},m=function(){v++,p=r.guard.begin(),i.timeout>0&&(y=r._setTimer(function(){if(!h){var e=new Error("load timeout after ".concat(i.timeout,"ms: ").concat(l));e.__devfabTimeout=!0,b(e,"files load timeout after ".concat(i.timeout,"ms, the files: ").concat(l))}},i.timeout)),r.__require(o,s,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];c.data=t,_()},function(e){b(e)})},b=function(e,t){if(!h){if(null!==y&&(r._clearTimer(y),y=null),v<=i.retry)return g(),r._undefModules(f),void m();c.code=e&&e.__devfabTimeout?504:500,c.message=t||"files load error, the files: ".concat(l),c.error=e,_()}};m()}else null==u||u(c)}},{key:"load",value:function(e,t,n){this._load(e,t,n)}},{key:"resolveUrl",value:function(e){var t=String(null==e?"":e);if(/^[a-z][a-z0-9+.-]*:/i.test(t)||/^\/\//.test(t))return t;var n=this.options.baseUrl||("undefined"!=typeof document&&document.baseURI?document.baseURI:"");if(!n)return t;try{return new URL(t,n).href}catch(e){return t}}},{key:"_importOne",value:function(e){var t=this,n=this.resolveUrl(e),r=this.policy.checkOrigin(n);if(r)return Promise.resolve({ok:!1,code:r.code,message:r.message});var i=this.policy.entryOf(e),a=i&&i.sha256,o=function(){var e=t.__import||F;return"function"!=typeof e?Promise.resolve({ok:!1,code:500,message:"native import() is unavailable(CSP 是否禁用了 unsafe-eval?)"}):Promise.resolve().then(function(){return e(n)}).then(function(e){return{ok:!0,module:e}},function(e){return{ok:!1,code:500,message:"module load error: ".concat(n),error:e}})};return a?this.policy.verify(n,a).then(function(e){return e.ok?o():{ok:!1,code:T,message:"".concat(e.message,"(").concat(n,")")}}):o()}},{key:"loadModules",value:function(e,t,n){var r=this,i=G(e,t,n,{path:this.__rootPath,type:"module"}),a=i.path,o=i.files,s=i.callback,u=i.result,c=i.filesStr,l=L(a,o),f=function(e){return null==s||s(e),e},d=this.policy.checkModules(l);if(d)return u.code=d.code,u.message=d.message,Promise.resolve(f(u));if(!o.length)return Promise.resolve(f(u));var h=this.guard.begin();return Promise.all(l.map(function(e){return r._importOne(e)})).then(function(e){u.warnings=h.end();var t=e.filter(function(e){return!e.ok});return t.length?(u.code=t[0].code||500,u.message="".concat(t.map(function(e){return e.message}).join("; "),"(the files: ").concat(c,")"),u.error=t[0].error):u.data=e.map(function(e){return e.module}),f(u)})}},{key:"loadModule",value:function(e,t){return this.loadModules([e],t)}}])}(),Q=function(){function e(){return i(this,e),r(this,e,arguments)}return c(e,W),o(e,[{key:"define",value:function(e,t,n){this._define(e,t,n)}},{key:"defineScript",value:function(e){this.provideScript(e)}},{key:"provideScript",value:function(e){var t=e;"function"!=typeof e&&(t=function(){return e}),this.define([],t)}},{key:"require",value:function(e,t,n){this._load(e,t,n)}},{key:"injectScript",value:function(e,t,n,r){var i=this,a=e,o=t,s=n,u=r;Array.isArray(e)&&"function"==typeof t&&(a=void 0,o=e,s=t,u=n),this._load(a,o,function(e){if(0==e.code&&Array.isArray(e.data))for(var t=0,n=e.data.length;t<n;t++){var r,a=e.data[t];null===(r=s)||void 0===r||r(a,t)}else"function"==typeof u?u(e):i.__debug&&console.error("[devfab][FileRequire][injectScript] error: ",e)})}},{key:"requireScript",value:function(e,t,n){this.injectScript(e,t,n)}}])}(),$=new Q;function Y(e,t,n,r,i){var a,o=t,s=n,u=r,c=i;Array.isArray(t)&&"function"==typeof n&&(o=void 0,s=t,u=n,c=r);var l=(null===(a=c)||void 0===a?void 0:a.viewModel)||this,f=(s=Array.isArray(s)?s:[]).join(",");return $.create({require:e}).require(o,s,function(e){var t;if(0==e.code&&Array.isArray(e.data))for(var n=0,r=e.data.length;n<r;n++){var i=e.data[n];if(i&&i.doAction)try{i.doAction("init",l)}catch(t){e.code=500,e.message="".concat(f," script execute error"),e.error=t;break}else try{var a;"function"==typeof(null===(a=c)||void 0===a?void 0:a.onFileBack)&&c.onFileBack(i,n)}catch(t){e.code=500,e.message="".concat(f," script customize execute error");break}}0!=e.code&&window.__devfab.debug&&console.info("[devfab][models][extend][loadScripts] ".concat(f," \n [message]: ").concat(e.message," \n").concat(e.error?" \n [error]: ":""),e.error),null===(t=u)||void 0===t||t(e)})}function Z(e){var t=this;window.__devfab&&window.__devfab.__debugger_initExtendJs;var n=e.requirejs,r=e.extendScriptParams,i=e.readyEventName,a=void 0===i?"extendReady":i,o=r||{},s=o.enableJs,u=void 0!==s&&s,c=o.filepath,l=o.scriptUrl;if(!u)return window.__devfab.debug&&console.info("[devfab][extend][js] not enable extend script"),void t.execute(a,t);if(!l)return window.__devfab.debug&&console.info("[devfab][extend][js] extend script is not defined"),void t.execute(a,t);var f=c,d=[l];t.getEnv&&t.getEnv("everyCommonExtend")&&d.push(t.getEnv("everyCommonExtend")),Y.call(t,null==n?void 0:n.require,f,d,function(e){t.execute(a,t,e)})}$.create=function(e){return new Q(d(d({},this._snapshotConfig()),e))};var ee=function(){var e=n(h().m(function e(t,r,i){var a,o,s,u,c,l,f,d,v,y,p;return h().w(function(e){for(;;)switch(e.n){case 0:if(window.__devfab&&window.__devfab.__debugger_initExtJs,s=i.requirejs,u=i.extendScriptParams,l=(c=u||{}).enableExtJs,f=void 0!==l&&l,d=c.exturlsField,v=void 0===d?"extscripturls":d,f){e.n=1;break}return window.__devfab.debug&&console.info("[devfab][extend][exturls] ext script is not enable"),e.a(2,Promise.resolve(!0));case 1:if(t){e.n=2;break}return window.__devfab.debug&&console.info("[devfab][extend][exturls] script data is null"),e.a(2,Promise.resolve(!0));case 2:if(y=null==t?void 0:t[v],p=Array.isArray(y)?y:[],p=(p=(r.getCache("localScripts")||[]).concat(p)).concat(window.__devfab__GLOBAL_EXT_SCRIPTS__||[]),null!==(a=r.getParams())&&void 0!==a&&a.selfExtUrls&&(p=p.concat([r.getParams().selfExtUrls])),null===(o=p)||void 0===o||!o.length){e.n=4;break}return p=g(new Set(p)),e.n=3,Promise.all(p.map(function(){var e=n(h().m(function e(t){return h().w(function(e){for(;;)if(0===e.n)return e.a(2,t)},e)}));return function(t){return e.apply(this,arguments)}}()));case 3:p=e.v;case 4:return t[v]=p,e.a(2,new Promise(function(e,t){Y.call(r,null==s?void 0:s.require,p,function(t){e(t)})}))}},e)}));return function(t,n,r){return e.apply(this,arguments)}}(),te=q,ne=C,re=I,ie=R;function ae(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.modelNameField,s=void 0===a?"cName":a,u=function(e){function t(){return i(this,t),r(this,t,arguments)}return c(t,e),o(t,[{key:"init",value:function(e,t){var n=this.createModels(e,t);this.setData(n),this.setDirty(!1)}},{key:"createModels",value:function(e,t){var r={};return(Array.isArray(e)?e:[]).forEach(function(e){var t,i,a=function(e,t){var n=(null==t?void 0:t.SimpleModel)||C,r=e.cControlType||e.component||e.controlType||e.ctrlType;return r=r.toLowerCase(),new n(e)}(e,n),o={model:a,meta:e,childModel:!0,modelName:e[s]};null==n||null===(t=n.onBeforeInitModel)||void 0===t||t.call(n,o),r[o.modelName]=o.model,null==n||null===(i=n.onAfterInitModel)||void 0===i||i.call(n,o)}),r}},{key:"initData",value:function(){Z.call(this,n)}}])}((null==n||null===(t=n.models)||void 0===t?void 0:t.ViewModel)||I);return u.prototype.modelType="ViewModel",u}function oe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=function(e,t){var n,r,i,a=new(ae(e,t)),o={model:a,meta:e};return null==t||null===(n=t.onBeforeInitModel)||void 0===n||n.call(t,o),o.model=a,null==a||null===(r=a.init)||void 0===r||r.call(a,e.models,e),null==t||null===(i=t.onAfterInitModel)||void 0===i||i.call(t,o),a}(e,t);return i.on("destroyVM",function(){var e,t;null===(e=i)||void 0===e||null===(t=e.destroyVM)||void 0===t||t.call(e),i=null,window.devfab.debug&&console.info("[devfab][models][initVM]: destory vm ".concat((new Date).toString()))}),i.on("extendReady",n(h().m(function n(){var a;return h().w(function(n){for(;;)switch(n.n){case 0:return(a=[]).push(ee(e,i,t)),n.n=1,Promise.all(a);case 1:window.devfab.debug&&console.info("[devfab][models][initVM]: after vm init ".concat((new Date).toString())),null==r||r(i,e);case 2:return n.a(2)}},n)}))),i.initData(),i}export{te as BaseModel,ie as GridModel,ne as SimpleModel,re as ViewModel,oe as initViewModel,Y as loadScripts};
|
package/dist/common/models.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var
|
|
1
|
+
"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function n(e){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=e.apply(n,r);function s(e){t(o,i,a,s,u,"next",e)}function u(e){t(o,i,a,s,u,"throw",e)}s(void 0)})}}function r(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_(r.key),r)}}function o(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(){
|
|
2
2
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3
|
-
var e,t,a="function"==typeof Symbol?Symbol:{},n=a.iterator||"@@iterator",r=a.toStringTag||"@@toStringTag";function i(a,n,r,i){var u=n&&n.prototype instanceof s?n:s,l=Object.create(u.prototype);return g(l,"_invoke",function(a,n,r){var i,s,u,l=0,c=r||[],d=!1,f={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,a){return i=t,s=0,u=e,f.n=a,o}};function h(a,n){for(s=a,u=n,t=0;!d&&l&&!r&&t<c.length;t++){var r,i=c[t],h=f.p,v=i[2];a>3?(r=v===n)&&(u=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=h&&((r=a<2&&h<i[1])?(s=0,f.v=n,f.n=i[1]):h<v&&(r=a<3||i[0]>n||n>v)&&(i[4]=a,i[5]=n,f.n=v,s=0))}if(r||a>1)return o;throw d=!0,n}return function(r,c,v){if(l>1)throw TypeError("Generator is already running");for(d&&1===c&&h(c,v),s=c,u=v;(t=s<2?e:u)||!d;){i||(s?s<3?(s>1&&(f.n=-1),h(s,u)):f.n=u:f.v=u);try{if(l=2,i){if(s||(r="next"),t=i[r]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(u=TypeError("The iterator does not provide a '"+r+"' method"),s=1);i=e}else if((t=(d=f.n<0)?u:a.call(n,f))!==o)break}catch(t){i=e,s=1,u=t}finally{l=1}}return{value:t,done:d}}}(a,r,i),!0),l}var o={};function s(){}function u(){}function l(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(g(t={},n,function(){return this}),t),d=l.prototype=s.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,g(e,r,"GeneratorFunction")),e.prototype=Object.create(d),e}return u.prototype=l,g(d,"constructor",l),g(l,"constructor",u),u.displayName="GeneratorFunction",g(l,r,"GeneratorFunction"),g(d),g(d,r,"Generator"),g(d,n,function(){return this}),g(d,"toString",function(){return"[object Generator]"}),(v=function(){return{w:i,m:f}})()}function g(e,t,a,n){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}g=function(e,t,a,n){function i(t,a){g(e,t,function(e){return this._invoke(t,a,e)})}t?r?r(e,t,{value:a,enumerable:!n,configurable:!n,writable:!n}):e[t]=a:(i("next",0),i("throw",1),i("return",2))},g(e,t,a,n)}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var n,r,i,o,s=[],u=!0,l=!1;try{if(i=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;u=!1}else for(;!(u=(n=i.call(a)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,r=e}finally{try{if(!u&&null!=a.return&&(o=a.return(),Object(o)!==o))return}finally{if(l)throw r}}return s}}(e,t)||k(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||k(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var n=a.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}function k(t,a){if(t){if("string"==typeof t)return e(t,a);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,a):void 0}}Object.defineProperty(exports,"__esModule",{value:!0});var x=function(){return o(function e(t){r(this,e),this._init(t)},[{key:"_init",value:function(e){this.cache=Object.assign({},e)}},{key:"set",value:function(e,t){this.cache[e]=t}},{key:"get",value:function(e){var t;return null===(t=this.cache)||void 0===t?void 0:t[e]}},{key:"clear",value:function(e){delete this.cache[e]}}])}(),b=function(){return o(function e(t){r(this,e),this._init(t)},[{key:"_init",value:function(e){var t;this.__ASYNC_EXECUTE__=null===(t=null==e?void 0:e.__ASYNC_EXECUTE__)||void 0===t||t,this.events=new Map,this.firstevents=new Map}},{key:"on",value:function(e,t,a){var n=this.events.get(e);Array.isArray(n)||(n=[]),n.push({callback:t,context:a}),this.events.set(e,n)}},{key:"onFirst",value:function(e,t,a){var n=this.firstevents.get(e);Array.isArray(n)||(n=[]),n.splice(0,0,{callback:t,context:a}),this.firstevents.set(e,n)}},{key:"execute",value:function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),n=1;n<t;n++)a[n-1]=arguments[n];var r=this.events.get(e),i=this.firstevents.get(e);if(!r&&!i)return!0;var o=!0;return[].concat(w(i||[]),w(r||[])).forEach(function(e){if(!1!==o){var t=e.callback.apply(e.context||void 0,a);o=!1!==t&&o}}),o}},{key:"un",value:function(e,t){this._unEvents(e,t,this.events),this._unEvents(e,t,this.firstevents)}},{key:"_unEvents",value:function(e,t,a){if(e&&a.has(e))if(t){var n=a.get(e),r=null==n?void 0:n.findIndex(function(e){return e.callback===t});-1!==r&&(null==n||n.splice(r,1))}else a.delete(e)}},{key:"hasEvent",value:function(e){var t,a;return e?((null===(t=this.events.get(e))||void 0===t?void 0:t.length)||0)+((null===(a=this.firstevents.get(e))||void 0===a?void 0:a.length)||0):0}},{key:"fireEvent",value:function(e,t){this.execute("before".concat(e),t)&&(this.execute(e,t),this.execute("after".concat(e),t))}},{key:"_asyncExecute",value:function(e,t,a){for(var n,r=this,i=a.resolve,o=a.reject,s=a.args,u=!0,l=t||[],c=!1,d=function(t){var a,n=l[t];if(!1===u)return 0;if(c)return{v:void 0};if("development"===process.env.nodeEnv)a=n.callback.apply(n.context||r,s);else try{a=n.callback.apply(n.context||r,s)}catch(e){throw e.isAddedMsg||(e.message="(领域扩展事件执行失败,请打开控制台查看详细错误信息并修复):".concat(e.message)),e.isAddedMsg=!0,e}a instanceof Promise?(c=!0,(u=a).callbacks&&u.callbacks.push({reject:function(){u.reject(),t===l.length-1&&(null==o||o())},resolve:function(a){t===l.length-1?(s.length>1&&(s[0]=a),null==i||i(s)):r._asyncExecute(e,l.slice(t+1),{resolve:i,reject:o,args:s})}})):(u=!1!==a&&u,t===l.length-1&&(u?null==i||i(s):null==o||o()))},f=0;f<l.length&&0!==(n=d(f));f++)if(n)return n.v;return u}},{key:"_asyncPromiseExecute",value:function(e,t,a,n){var r=this.events.get(e),i=this.firstevents.get(e);if(!((Array.isArray(r)?r.length:r)||(Array.isArray(i)?i.length:i)))return null==t?void 0:t();var o=[].concat(w(i||[]),w(r||[]));return this._asyncExecute(e,o,{resolve:t,reject:a,args:n})}},{key:"promiseExecute",value:function(e,t){var a=this,n=e,r=1;if("boolean"==typeof e&&(n=t,r=2),n){for(var i=arguments.length,o=new Array(i>2?i-2:0),s=2;s<i;s++)o[s-2]=arguments[s];var u=2===r?o:[t].concat(o);if(u.length){var l,c=u.length-1,d=u[c];if("function"!=typeof d){if("object"!==S(d)||!d[0]||"function"!=typeof d[0]||!d[1]||"function"!=typeof d[1])return;l=d[1],d=d[0]}if(this.__ASYNC_EXECUTE__)return this._asyncPromiseExecute(n,function(e){d.apply(a,e)},function(){l&&"function"==typeof l&&l()},u);u.splice(c,1),u.unshift(n);var f=this.execute.apply(this,u);if(f instanceof Promise){var h=this;f.then(function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];d.apply(h,t)},function(){l&&"function"==typeof l&&l()})}else if(!f)return void(l&&"function"==typeof l&&l())}}}},{key:"clearEvents",value:function(){this.events.clear(),this.firstevents.clear()}}])}();function R(e){this.pathname="",this.query={};var t=e;this.init=function(){t||(t=location.search);var e=t.indexOf("?"),a=t.indexOf("#");if(e>=0){if(this.pathname=t.substr(0,e),(t=a<0?t.substr(e+1):t.substring(e+1,a)).length>0)for(var n=(t=t.replace(/\+/g," ")).split("&"),r=0,i=n.length;r<i;r++){var o=n[r]||"";if(o){var s=o.indexOf("="),u="",l="";s<0?l=u=window.decode(o):(u=window.decode(o.substr(0,s)),l=window.decode(o.substr(s+1))),this.query[u]=l}}}else this.pathname=t},this.set=function(e,t){this.query[e]=t},this.get=function(e){return this.query[e]},this.del=function(e){delete this.query[e]},this.has=function(e){return null!=this.query[e]},this.toStr=function(){var e=["?"];for(var t in this.query)e.push(encodeURIComponent(t)),e.push("="),e.push(encodeURIComponent(this.query[t])),e.push("&");return 1===e.length?"":(e.splice(e.length-1,1),e.join(""))},this.init()}function C(e,t){if(!t)return e;var a=[],n=new R(e);for(var r in t)n.get(r)||a.push("".concat(r,"=").concat(t[r]));if(!a.length)return e;var i=a.join("&");return e.indexOf("?")>=0?"".concat(e,"&").concat(i):"".concat(e,"?").concat(i)}String.prototype.equalsIgnoreCase=function(e){return null!=e&&this.toLowerCase()===e.toLowerCase()};var P=["onBeforeRequest","_onAfterRequest"],I=["_onBeforeRequest","onAfterRequest"];var D={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t=e||{},a=t.onBeforeRequest;t._onAfterRequest;var n,r=h(t,P),i=r.method||"GET",o=r.url;try{null!=r&&r.requestHeaders&&(n=r.requestHeaders,r.requestHeaders=void 0,delete r.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options["requestHeaders"] ERR : ',e)}try{r.params&&r.params.requestHeaders&&(n=r.params.requestHeaders,r.params.requestHeaders=void 0,delete r.params.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var s=null;if(i.equalsIgnoreCase("get")||i.equalsIgnoreCase("delete")?o=C(o,r.params):(i.equalsIgnoreCase("post")||i.equalsIgnoreCase("put"))&&(s=JSON.stringify(r.params)),r.jsonp)return this.getJsonp(o,r.callback);var u=this.getXMLHttpRequest();if(u){var l;if(u.open(i,o,!1!==r.async),r.timeout&&(u.timeout=r.timeout,u.setRequestHeader("timeout",r.timeout),u.ontimeout=function(){D.onerror(this,r,"timeout")}),r.contentType){if(u.setRequestHeader("Content-Type",r.contentType),r.contentType.indexOf("x-www-form-urlencoded")>=0)s=null===(l=new URLSearchParams(r.params))||void 0===l?void 0:l.toString()}else r.dateType?s=r.params:u.setRequestHeader("Content-Type","application/json;charset=utf-8");r.domainKey&&u.setRequestHeader("Domain-Key",r.domainKey);try{if(n&&"[object Object]"===Object.prototype.toString.call(n))for(var c in n)u.setRequestHeader(c,n[c])}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}u.withCredentials=null==r||!r.hasOwnProperty("withCredentials")||r.withCredentials;try{u.send(s)}catch(e){return{error:"NetWorkError",options:r}}if(!1===r.async)return null==a||a(r),this.onreadystatechange(u,r);u.onreadystatechange=function(){D.onreadystatechange(this,r)},null==a||a(r)}},beforeReadystatechange:function(e,t,a){null==a||a()},onreadystatechange:function(e,t){var a=t||{};a._onBeforeRequest;var n=a.onAfterRequest,r=h(a,I);if(4===e.readyState){if(null==n||n(),200===e.status){var i;try{if("blob"===r.responseType){var o=function(e){var t=e.xhr.getAllResponseHeaders(),a={};return t.split("\r\n").map(function(e){var t=p(e.split(": "),2),n=t[0],r=t[1];a[n]=r}),a}({xhr:e});i={code:e.status,data:{data:e.response,headers:o}}}else i=JSON.parse(e.responseText)}catch(t){D.onerror(e,r,e.responseText)}if(!1===r.async)return e.isBusy=!1,r.precallback&&r.precallback(i),D.processAjaxResult(i,!1,null,null,r,e);D.processAjaxResult(i,r.async,r.callback,r.context,r,e),r.precallback&&r.precallback(i)}else if(0===e.status)D.onerror(e,r,"网络连接已断开,请检查设备网络状态后重试");else if(502===e.status||504===e.status)D.onerror(e,r,"服务出错了,请稍后再试");else{if(401!==e.status){var s={};try{s=JSON.parse(e.responseText)}catch(t){s={code:e.status,message:e.responseText}}return D.onerror(e,r,s)}D.onerror(e,r,"登录信息失效,请重新登录或联系技术人员")}e.isBusy=!1}},onerror:function(e,t,a){var n="[ajax]: [onerror]: 接口返回错误 \n [状态码]: ".concat(e.status," \n [错误信息]: ").concat(("object"===S(a)?JSON.stringify(a):a)||"空"," \n [请求地址]: ").concat(t.url," \n [浏览器Token]: ").concat(document.cookie);console.log("Error.E01000",n);var r="object"===S(a)?a:{code:500,message:a};t.precallback&&t.precallback(r)},getXMLHttpRequest:function(){return this.createXMLHttpRequest()},createXMLHttpRequest:function(){return window.XMLHttpRequest?new XMLHttpRequest:window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):null},getJsonp:function(e,t){var a=e,n="callback"+this._jsonps.index++,r=document.createElement("script");this._jsonps[n]=function(e){try{t(e)}finally{document.body.removeChild(r)}},a+=-1===a.indexOf("?")?"?":"&callback=cb.rest.AjaxRequestManager._jsonps."+n,r.src=a,document.body.appendChild(r)},processAjaxResult:function(e,t,a,n,r,i){if(e){if(!e.code)return!1===t?e:void(a&&a.call(n,null,e));if(200==e.code){if(!1===t)return{result:e.data};a&&a.call(n,null,e.data,e.message,e.errorDetail,e.code,e.displayCode&&e)}else{if(!1===t)return{error:e};a&&a.call(n,e)}}}};function j(e,t){this.init&&this.init(e),this.queryParams=t}j.create=function(e,t){return new j(e,t)},j.prototype.init=function(e){if(e)for(var t in this.config=e,this.config)this[t]=function(e){return function(t,a,n){return this.Do(e,t,a,null,n)}}(t),this["".concat(t,"Sync")]=function(e){return function(t){return this.Do(e,t,null,!1)}}(t)},j.prototype.Do=function(e,t,a,n,r){var i,o,s;if(this.config&&this.config[e]&&this.config[e].url){var u=this.config[e],l=u.url;this.queryParams||(this.queryParams={}),null!==(i=u.options)&&void 0!==i&&i.proxyServiceCode&&(this.queryParams.serviceCode=u.options.proxyServiceCode),null!==(o=u.options)&&void 0!==o&&o.billnum&&(this.queryParams.billnum=u.options.billnum),null!==(s=this.queryParams)&&void 0!==s&&s.serviceCode&&(l=C(l,this.queryParams));var c=l,d=Object.assign({},u.options);return d.method=u.method||"GET","function"==typeof t?(d.callback=t,d.context=r||d.context||this):d.params=t,a&&(d.callback=a,d.context=r||d.context||this),!1===n&&(d.async=!1),this.ajax(c,d)}},j.prototype.ajax=function(e,t){return function(e,t){return t.url=e,D.doRequest(t)}(e,t)};var E=function(){return o(function e(t){r(this,e),this._init(t)},[{key:"_init",value:function(e){this._data={};var t=[];if(e)for(var a in e)t.push(a);Object.assign(this._data,{components:[],propertyNames:t},e),this._data.cache=new x,this._data.events=new b}},{key:"_del_data",value:function(e){e&&delete this._data[e]}},{key:"_cls_data",value:function(){this._data.cache.clear(),this._data.events.clear(),this._data={components:[],propertyNames:[],cache:new x,events:new b}}},{key:"_set_data",value:function(e,t,a){if(e){if(a){var n=this._data.propertyNames||[];n.indexOf(e)<0&&n.push(e)}this._data[e]=t}}},{key:"_get_data",value:function(e){if(e)return this._data[e]}},{key:"getData",value:function(){return this._get_data("value")}},{key:"getState",value:function(e,t){var a;if(!t)return this._get_data(e);var n=(this._get_data("components")||[]).find(function(e){return e.ctrlName===t});return n?null===(a=n.getState)||void 0===a?void 0:a.call(n,e):this._get_data(e)}},{key:"setState",value:function(e,t,a){a||this._set_data(e,t,!0);var n={};n[e]=t,this.doPropertyChange("setState",n,a)}},{key:"doPropertyChange",value:function(e,t,a){var n=this,r=this._get_data("components")||[];if(!r.length)return r;var i=[];if(a){var o=r.find(function(e){return e.ctrlName===a});o&&!this.notifyComponent(o,e,t)&&i.push(o)}else r.forEach(function(a){n.notifyComponent(a,e,t)||i.push(a)});return i.length?i:void 0}},{key:"notifyComponent",value:function(e,t,a){return"function"==typeof e[t]&&(this.viewUpdater(e,t,a),!0)}},{key:"viewUpdater",value:function(e,t,a){if("setState"===t)e[t](a);else{var n=this.getCache("name");e[t](a,n)}}},{key:"get",value:function(e){return this._get_data(e)}},{key:"addComponent",value:function(e,t){if(e){t&&!e.ctrlName&&(e.ctrlName=t);var a=this._get_data("components")||[];a.indexOf(e)>=0||a.push(e)}}},{key:"removeComponent",value:function(e){var t=this._get_data("components")||[],a=t.indexOf(e);a<0||t.splice(a,1)}},{key:"_applyState",value:function(e,t,a){var n=this;a||this._set_data(e,t,!0);var r="set".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),i=this.doPropertyChange(r,t,a);if(i){var o={};o[e]=t,i.forEach(function(e){n.notifyComponent(e,"setState",o)})}}},{key:"getVisible",value:function(e){return this.getState("visible",e)}},{key:"setVisible",value:function(e,t){this._applyState("visible",e,t)}},{key:"getValue",value:function(){return this.getData()}},{key:"setValue",value:function(e,t,a){var n=this,r=this.getValue();if(e!==r){var i={value:e,oldValue:r},o=this._get_data("forceFireEvent");t||o?this.promiseExecute("beforeValueChange",i,[function(){n._set_data("value",e,!0),n._applyState("value",e,a),n.execute("afterValueChange",i)},function(){n._set_data("value",r,!0),n._applyState("value",r,a)}]):(this._set_data("value",e,!0),this._applyState("value",e,a))}}},{key:"getDisabled",value:function(e){return this.getState("disabled",e)}},{key:"setDisabled",value:function(e,t){this._applyState("disabled",e,t)}},{key:"setParent",value:function(e){this.setCache("parent",e)}},{key:"getParent",value:function(){return this.getCache("parent")}},{key:"getRootParent",value:function(){for(var e=this.getParent();null!==(t=e)&&void 0!==t&&t.getParent();){var t;e=e.getParent()}return e}},{key:"setName",value:function(e){this.setCache("name",e)}},{key:"getName",value:function(){return this.getCache("name")}},{key:"setDirty",value:function(e){e?this._set_data("isDirty",!0):(this._del_data("isDirty"),this._set_data("originalData",this.getData()))}},{key:"getDirtyData",value:function(e){var t=this.getData();return!1!==e&&this._get_data("isDirty")||t!==this._get_data("originalData")?t:void 0}},{key:"clear",value:function(e){void 0===e?this._set_data("value",this._get_data("cDefaultValue")):e||this._set_data("value",void 0),this._del_data("isDirty"),this._del_data("checking"),this._del_data("checkMsg")}},{key:"on",value:function(e,t,a){this._get_data("events").on(e,t,a)}},{key:"onFirst",value:function(e,t,a){this._get_data("events").onFirst(e,t,a)}},{key:"execute",value:function(e){for(var t,a=arguments.length,n=new Array(a>1?a-1:0),r=1;r<a;r++)n[r-1]=arguments[r];return(t=this._get_data("events")).execute.apply(t,[e].concat(n))}},{key:"un",value:function(e,t){this._get_data("events").un(e,t)}},{key:"hasEvent",value:function(e){return this._get_data("events").hasEvent(e)}},{key:"fireEvent",value:function(e,t){this._get_data("events").fireEvent(e,t)}},{key:"promiseExecute",value:function(e,t){for(var a,n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];(a=this._get_data("events")).promiseExecute.apply(a,[e,t].concat(r))}},{key:"setCache",value:function(e,t){this._get_data("cache").set(e,t)}},{key:"getCache",value:function(e){return this._get_data("cache").get(e)}},{key:"clearCache",value:function(e){this._get_data("cache").clear(e)}},{key:"setProxy",value:function(e){if(!(e instanceof j)){var t,a=this._get_data("__requestHeaders__");for(var n in e){var r,i,o;if(a&&(null===(r=e[n])||void 0===r||null===(r=r.options)||void 0===r||!r.requestHeaders))null!==(o=e[n])&&void 0!==o&&o.options||(e[n].options={}),e[n].options.requestHeaders=a;null!==(i=this.getProxy())&&void 0!==i&&i[n]&&console.warn("[baseModel.prototype.setProxy]: Proxy ".concat(n," already exists on the model. Please change the name of ").concat(n," and try again"))}return this._set_data("proxy",j.create(f(f({},(null===(t=this.getProxy())||void 0===t?void 0:t.config)||{}),e))),this.getProxy()}this._set_data("proxy",e)}},{key:"getProxy",value:function(){return this._get_data("proxy")}}])}(),O=function(){function e(){return r(this,e),n(this,e,arguments)}return l(e,E),o(e,[{key:"mounted",value:function(){var e=this,t=this.get("conditions"),a={};t.forEach(function(t){e.get(t.name),a[t.name]=t.defaultValue}),this._set_data("params",a)}},{key:"unmounted",value:function(){this._set_data("params",{}),this._set_data("conditions",[])}},{key:"getParams",value:function(){var e=this,t={};return this.get("conditions").forEach(function(a){var n=e.get(a.name);t[a.name]=null==n?void 0:n.getValue()}),this._set_data("params",t),t}},{key:"search",value:function(){var e=this.getParams();this.execute("search",e)}}])}(),M=function(){function e(t){return r(this,e),n(this,e,[t])}return l(e,E),o(e,[{key:"getDisabled",value:function(){return this.getState("disabled")}},{key:"setDisabled",value:function(e){return this.setState("disabled",!!e)}},{key:"getReadonly",value:function(){return this.getState("readonly")}},{key:"setReadonly",value:function(e){this.setState("readonly",!!e)}}])}(),q="",A="Insert",F="Update",N="Delete",T=Array.isArray,V=function(e){return null==e||""===e},K=function(e){return!e||0===Object.keys(e).length};function H(e){if(T(e))return e.map(H);if(e instanceof Date)return new Date(e.getTime());if(e&&"object"===S(e)){var t={};for(var a in e)t[a]=H(e[a]);return t}return e}function B(e){var t={};return(T(e)?e:Object.keys(e||{}).map(function(t){var a;return f(f({},e[t]||{}),{},{field:(null===(a=e[t])||void 0===a?void 0:a.field)||t})})).forEach(function(e,a){if(e){var n=e.field||e.cCaption||e.cFieldName||"col_".concat(a);t[n]=f(f({},e),{},{field:n,fieldName:e.fieldName||n,cCaption:e.cCaption||n,index:void 0===e.index?a:e.index})}}),t}function U(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=this.getIdFlag(),a=this.getRowKeyField(),n=this._get_data("rowIdSeq")||0;return e.forEach(function(e){if(e&&void 0===e[t]){var r=e[a];null!=r&&""!==r?e[t]=String(r):(n+=1,e[t]="rowId_".concat(n))}}),this._set_data("rowIdSeq",n),e}function L(e,t,a){var n=this;this.promiseExecute("beforeQuery",{proxyConfig:e,queryParams:t},function(){var r=n,i=n.setProxy({queryData:e}),o={page:{pageSize:n.getPageSize(),pageIndex:n.getPageIndex()}},s=Object.assign(o,t);n.setCache("proxyCache",{proxyConfig:e,params:s}),n.getRootParent();if(!1!==n.execute("beforeQueryData",s)){var u=_.cloneDeep(s);i.queryData(u,function(e,t,n,r){if(!e){this._set_data("dataSourceMode","remote");var i=function(e){if(!e)return[];if(T(e))return e;if(T(e.data))return e.data;if(T(e.records))return e.records;if(T(e.list))return e.list;if(T(e.rows))return e.rows;var t=e.data&&"object"===S(e.data)?e.data:e.result;return T(t)?t:t&&"object"===S(t)&&(t.records||t.list||t.rows||t.data)||[]}(t=Object.assign({},t));null==a||a.call(this,i)}},r)}})}function z(e){if(this.execute("beforeSetDataSource",e)){var t=this._get_data("rowKeyField"),a={};e.forEach(function(e){a[e[t]]=e}),this._set_data("keyMap",a),this._set_data("dataSource",e,!0),this.doPropertyChange("setDataSource"),this.execute("afterSetDataSource",e)}}var G=function(){function e(){var t,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e);var i=f(f({},{columns:{},dataSource:[],rows:[],readOnly:!0,dataSourceMode:"local",columnMode:"local",editMode:"cell",cellState:{},rowState:{},showCheckBox:!0,multiple:!0,showRowNo:!0,pagination:!0,pageInfo:{pageIndex:1,pageSize:20,pageCount:0},innerUsedAttrs:{id:"_id",selected:"_selected",status:"_status"},multiRowModel:!1,editRowModels:{},loading:!1,params:{},originalKeyMap:{},defaultRowDatas:new Map}),a);T(i.dataSource)||(i.dataSource=[]),T(i.rows)||(i.rows=[]);var o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=f({},e.proxyConfig||{});return"function"==typeof e.dataSource&&(t.load=t.load||e.dataSource),"string"==typeof e.cUrl&&(t.load=t.load||e.cUrl),t.load||"string"!=typeof e.url||(t.load=e.url),t}(a);i.proxyConfig=o,i.dataSourceMode=a.dataSourceMode||(o.load?"remote":"local");var u=a.cData||(T(a.data)?a.data:null);return s(t=n(this,e,[i]),"modelType","GridModel"),t.initPageInfo(a.cPage||a.page),t.initColumns(i.columns),t.initRowState(),t.afterInit(),u&&t.setDataSource(u),t}return l(e,E),o(e,[{key:"afterInit",value:function(){"single"===this._get_data("parentRelation")&&this._set_data("defaultSelectedRowIndexes",!0)}},{key:"initColumns",value:function(e){var t=B(e);return this._set_data("columns",t,!0),t}},{key:"initPageInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=f({},this.getPageInfo());t.pageIndex=e.pageNo||e.pageIndex||t.pageIndex||1,t.pageSize=e.pageSize||t.pageSize||20,!1===this.get("pagination")&&(t.pageSize=-1),this.applyPageInfo(t)}},{key:"initRowState",value:function(){var e=this,t=this._get_data("dataSource");this._set_data("rowsDataState",(T(t)?t:[]).map(function(t){return(null==t?void 0:t[e.getStatusFlag()])||q}),!0)}},{key:"getInnerUsedAttrs",value:function(){return this._get_data("innerUsedAttrs")}},{key:"getIdFlag",value:function(){return this.getInnerUsedAttrs().id}},{key:"getSelectedFlag",value:function(){return this.getInnerUsedAttrs().selected}},{key:"getStatusFlag",value:function(){return this.getInnerUsedAttrs().status}},{key:"getRowKeyField",value:function(){return this._get_data("rowKeyField")||"id"}},{key:"getProxyConfig",value:function(){return this._get_data("proxyConfig")||{}}},{key:"isRemote",value:function(){return"remote"===this._get_data("dataSourceMode")}},{key:"isPagination",value:function(){return!!this.get("pagination")&&-1!==this.getPageSize()}},{key:"getReadOnly",value:function(){return!!this._get_data("readOnly")}},{key:"setReadOnly",value:function(e){this._applyState("readOnly",!!e)}},{key:"getParams",value:function(){return f(f({},this.get("cParams")||{}),this._get_data("params")||{})}},{key:"setParams",value:function(e){this._set_data("params",e||{})}},{key:"setMeta",value:function(e){this._set_data("meta",e)}},{key:"getColumns",value:function(e){var t=this._get_data("columns")||{},a={};return(e?T(e)?e:[e]:Object.getOwnPropertyNames(t)).forEach(function(e){t[e]&&(a[e]=f(f({},t[e]),{},{fieldName:t[e].fieldName||e}))}),a}},{key:"getColumn",value:function(e){var t,a=null===(t=this._get_data("columns"))||void 0===t?void 0:t[e];return a?f(f({},a),{},{fieldName:a.fieldName||e}):void 0}},{key:"hasColumn",value:function(e){return!!(this._get_data("columns")||{})[e]}},{key:"getColumnList",value:function(e){var t=this.getColumns(e);return Object.keys(t).sort(function(e,a){return(t[e].index||0)-(t[a].index||0)}).map(function(e){return t[e]})}},{key:"getVisibleColumns",value:function(e){return this.getColumnList(e).filter(function(e){return!0!==e.bHidden&&!1!==e.bShowIt})}},{key:"setColumns",value:function(e){e&&this._applyState("columns",B(e))}},{key:"setColumnMode",value:function(e){this._set_data("columnMode","remote"===e?"remote":"local",!0)}},{key:"addColumns",value:function(e){var t=B(e);this._applyState("columns",f(f({},this._get_data("columns")||{}),t))}},{key:"resetColumns",value:function(e){this.setColumns(e||this.get("cColumns"))}},{key:"getColumnState",value:function(e,t,a){var n,r=this.getRowKey(e);return r?((null===(n=this._get_data("cellState"))||void 0===n||null===(n=n[r])||void 0===n?void 0:n[t])||{})[a]:void 0}},{key:"setColumnState",value:function(e,t,a,n){this.setCellState(e,t,a,n)}},{key:"setColumnStates",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.setCellStates(e.map(function(e){return f(f({},e),{},{cellName:e.cellName||e.columnName})}))}},{key:"setColumnValue",value:function(e,t,a){var n=this._get_data("columns")||{};n[e]&&this._applyState("columns",f(f({},n),{},s({},e,f(f({},n[e]),{},s({},t,a)))))}},{key:"setDataSource",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if("local"===this._get_data("dataSourceMode")){z(cb.utils.isArray(e)?e:[])}else{if(!this.execute("beforeProxyLoad",a))return;this._get_data("pageInfo").pageIndex=1,this._set_data("proxyConfig",e),this._set_data("queryParams",a),this._set_data("loadDataCallback",n),L.call(this,e,a,function(e){z.call(t,e),null==n||n.call(t)})}}},{key:"reload",value:function(){var e=this;this.getProxy();var t=this._get_data("proxyConfig"),a=this._get_data("queryParams"),n=this._get_data("loadDataCallback");L.call(this,t,a,function(t){z.call(e,t),null==n||n.call(e)})}},{key:"getDataSource",value:function(){return this._get_data("dataSource")||[]}},{key:"getData",value:function(e,t){var a=e||t?this._get_data("rows"):this._get_data("dataSource");return this.collectRows(a,e)}},{key:"getAllData",value:function(){return this.getData(!0)}},{key:"getPageData",value:function(){return this.getData(!0)}},{key:"getEffeData",value:function(){var e=this._get_data("dataSource")||[],t=this._get_data("rowsDataState")||[];return this.collectRows(e.filter(function(e,a){return t[a]!==N}),!1)}},{key:"getRows",value:function(e){var t=this._get_data("rows")||[];return!1===e?t:t.map(function(e){return H(e)})}},{key:"collectRows",value:function(e,t){var a=this._get_data("columns")||{},n=this.getStatusFlag(),r=this.getSelectedFlag();return(e||[]).map(function(e){var i={};for(var o in e){var s;t&&o===n||(t||o!==r)&&!1!==(null===(s=a[o])||void 0===s?void 0:s.needCollect)&&(i[o]=e[o])}return i})}},{key:"getShowRows",value:function(e){return(e||this._get_data("rows")||[]).map(function(e){return f({},e)})}},{key:"getRow",value:function(e,t){var a,n=null===(a=this._get_data("rows"))||void 0===a?void 0:a[e];if(n)return!1===t?n:H(n)}},{key:"getRowIndex",value:function(e){if(!e)return-1;var t=this._get_data("rows")||[],a=this.getRowKeyField();return void 0!==e[a]?t.findIndex(function(t){return t[a]===e[a]}):t.indexOf(e)}},{key:"getRowIndexByRowId",value:function(e){var t=this;return(this._get_data("rows")||[]).findIndex(function(a){return(null==a?void 0:a[t.getIdFlag()])===e})}},{key:"getDataSourceIndexByRowId",value:function(e){var t=this;return(this._get_data("dataSource")||[]).findIndex(function(a){return(null==a?void 0:a[t.getIdFlag()])===e})}},{key:"getRowKey",value:function(e){var t,a;return null!==(t=null===(a=this._get_data("rows"))||void 0===a||null===(a=a[e])||void 0===a?void 0:a[this.getIdFlag()])&&void 0!==t?t:e}},{key:"getRowKeys",value:function(e){var t=void 0===e?this.getRows():T(e)?e:[e],a=this.getRowKeyField();return t.filter(function(e){return e&&void 0!==e[a]}).map(function(e){return e[a]})}},{key:"getRowsByIndexes",value:function(e){var t=this._get_data("rows")||[];return(T(e)?e:[e]).map(function(e){return t[e]}).filter(Boolean)}},{key:"getCellValue",value:function(e,t){var a,n=e>=0?null===(a=this._get_data("rows"))||void 0===a?void 0:a[e]:null;if(n&&t)return n[t]}},{key:"setCellValue",value:function(e,t,a){var n=(this._get_data("rows")||[])[e];if(n&&t){var r=n[t];if(r!==a){var i={rowIndex:e,rowId:n[this.getIdFlag()],cellName:t,value:a,oldValue:r};this.execute("beforeCellValueChange",i)&&(n[t]=i.value,this.markRowState(e,F),this.execute("afterCellValueChange",i),this.doPropertyChange("setCellValue",i))}}}},{key:"setCellValues",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];T(t)&&t.forEach(function(t){return e.setCellValue(t.rowIndex,t.cellName||t.field,t.value)})}},{key:"getCellState",value:function(e,t,a){var n,r=this.getRowKey(e),i=r?null===(n=this._get_data("cellState"))||void 0===n||null===(n=n[r])||void 0===n?void 0:n[t]:null;if(i)return i[a]}},{key:"setCellState",value:function(e,t,a,n){var r,i=null===(r=this._get_data("rows"))||void 0===r||null===(r=r[e])||void 0===r?void 0:r[this.getIdFlag()],o=i||e;if(!V(o)){var u=this.getCellState(e,t,a);if(u!==n){var l={rowIndex:e,rowId:i,cellName:t,propertyName:a,value:n,oldValue:u};if(this.execute("beforeCellStateChange",l)){var c=f({},this._get_data("cellState")||{});c[o]=f({},c[o]||{}),c[o][t]=f(f({},c[o][t]||{}),{},s({},a,n)),this._applyState("cellState",c),this.execute("afterCellStateChange",l)}}}}},{key:"setCellStates",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];T(t)&&t.forEach(function(t){return e.setCellState(t.rowIndex,t.cellName,t.propertyName||t.name,t.value)})}},{key:"getRowDataState",value:function(e){var t,a=this.getDataSourceIndexByRow(e);return null===(t=this._get_data("rowsDataState"))||void 0===t?void 0:t[a]}},{key:"getDataSourceIndexByRow",value:function(e){var t=this,a=(this._get_data("rows")||[])[e];if(!a)return-1;var n=this._get_data("dataSource")||[],r=n.indexOf(a);return r>-1?r:n.findIndex(function(e){return(null==e?void 0:e[t.getIdFlag()])===(null==a?void 0:a[t.getIdFlag()])})}},{key:"setRowDataState",value:function(e,t){var a=this.getDataSourceIndexByRow(e);if(!(a<0)){var n=w(this._get_data("rowsDataState")||[]);n[a]=t,this._set_data("rowsDataState",n,!0)}}},{key:"markRowState",value:function(e,t){var a=this.getRowDataState(e);a!==A&&a!==t&&this.setRowDataState(e,t)}},{key:"markRowUpdate",value:function(e){var t="number"==typeof e?e:this.getRowIndex(e);t<0||this.markRowState(t,F)}},{key:"getRowState",value:function(e,t){var a,n=this.getRowKey(e),r=n?null===(a=this._get_data("rowState"))||void 0===a?void 0:a[n]:null;if(r&&t)return r[t]}},{key:"setRowState",value:function(e,t,a){var n,r=null===(n=this._get_data("rows"))||void 0===n?void 0:n[e];if(r&&t){var i=this.getRowKey(e),o=this.getRowState(e,t);if(o!==a){var u={rowIndex:e,rowId:r[this.getIdFlag()],propertyName:t,value:a,oldValue:o};if(this.execute("beforeRowStateChange",u)){var l=f({},this._get_data("rowState")||{});l[i]=f(f({},l[i]||{}),{},s({},t,a)),this._applyState("rowState",l),this.execute("afterRowStateChange",u)}}}}},{key:"setRowStates",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];T(t)&&t.forEach(function(t){return e.setRowState(t.rowIndex,t.propertyName||t.name,t.value)})}},{key:"getDirtyData",value:function(e){var t=this,a=this._get_data("dataSource")||[],n=this._get_data("rowsDataState")||[],r=[];return a.forEach(function(e,a){var i=n[a];if(i){var o=H(e);o[t.getStatusFlag()]=i,r.push(o)}}),r.length?r:void 0}},{key:"getDirtyRowIndexes",value:function(){var e=this;return(this._get_data("rows")||[]).map(function(e,t){return t}).filter(function(t){return!!e.getRowDataState(t)})}},{key:"isDirty",value:function(){return!!this.getDirtyData()}},{key:"backupState",value:function(){this._set_data("backupData",{dataSource:H(this._get_data("dataSource")||[]),rowsDataState:w(this._get_data("rowsDataState")||[])})}},{key:"restoreState",value:function(){var e=this._get_data("backupData");e&&(this._set_data("dataSource",e.dataSource,!0),this._set_data("rowsDataState",w(e.rowsDataState),!0),this.showPage())}},{key:"insertRow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>3?arguments[3]:void 0,n=this._get_data("rows")||[],r=Math.min(n.length,Math.max(0,void 0===e?n.length:e)),i={index:r,row:f({},t),isCopy:a};if(this.execute("beforeInsertRow",i)){var o=i.row;delete o[this.getIdFlag()],U.call(this,[o]);var s=this._get_data("dataSource")||[],u=r<n.length?this.getDataSourceIndexByRow(r):s.length;s.splice(u<0?s.length:u,0,o);var l=w(this._get_data("rowsDataState")||[]);return l.splice(u<0?l.length:u,0,A),n.splice(r,0,o),this._set_data("rowsDataState",l,!0),this.setRows(n),this.execute("afterInsertRow",f(f({},i),{},{rowIndex:r})),o}}},{key:"insertRows",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[];return(T(a)?a:[a]).forEach(function(a,r){n.push(t.insertRow(e+r,a))}),n}},{key:"appendRow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.insertRow(this.getRowsCount(),e)}},{key:"updateRow",value:function(e){var t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null===(t=this._get_data("rows"))||void 0===t?void 0:t[e];n&&this.execute("beforeUpdateRow",{index:e,row:a})&&(Object.assign(n,a),this.markRowState(e,F),this.setRows(this._get_data("rows")),this.execute("afterUpdateRow",{index:e,row:n}))}},{key:"updateRows",value:function(){var e=this;(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(function(t){var a;return e.updateRow(null!==(a=t.rowIndex)&&void 0!==a?a:t.index,t.rowData||t.row)})}},{key:"deleteRows",value:function(e){var t=this,a=(T(e)?e:[e]).filter(function(e){return e>=0&&e<t.getRowsCount()}).sort(function(e,t){return e-t});if(a.length){var n=this.getRowsByIndexes(a);if(this.execute("beforeDeleteRows",n,a)){var r=this._get_data("dataSource")||[],i=w(this._get_data("rowsDataState")||[]),o=new Set,s=new Set;n.forEach(function(e){var a=r.indexOf(e);if(!(a<0)){var n=e[t.getIdFlag()];o.add(n),i[a]===A&&s.add(n)}});var u=[],l=[];r.forEach(function(e,a){var n=e[t.getIdFlag()];if(!o.has(n))return u.push(e),void l.push(i[a]);s.has(n)||(u.push(e),l.push(N))}),this._set_data("dataSource",u,!0),this._set_data("rowsDataState",l,!0),this.showPage(),this.execute("afterDeleteRows",{rowIndexes:a,rows:n})}}}},{key:"deleteAllRows",value:function(){this.deleteRows(this.getRows().map(function(e,t){return t}))}},{key:"clear",value:function(){this._set_data("dataSource",[],!0),this._set_data("rows",[],!0),this._set_data("rowsDataState",[],!0),this.clearSelection(),this.applyPageInfo(f(f({},this.getPageInfo()),{},{recordCount:0,pageIndex:1})),this.setDataSourceView()}},{key:"select",value:function(e,t){var a=this;if(null!=e||!0===t){!0===t&&this.unselectAll({silent:!0});var n=!0===t?this.getRows().map(function(e,t){return t}):T(e)?e:[e];n=n.filter(function(e){return e>=0&&e<a.getRowsCount()});var r=this._get_data("rows")||[],i=this.getSelectedFlag(),o=n.filter(function(e){return!r[e][i]});if(o.length){var s={rowIndexes:o,rows:o.map(function(e){return r[e]})};this.execute("beforeSelect",s)&&(o.forEach(function(e){r[e][i]=!0,a.cacheSelectedRow(r[e],!0)}),this.flushSelection())}else!0===t&&this.flushSelection()}}},{key:"unselect",value:function(e){var t=this;if(null!=e){var a=T(e)?e:[e],n=this._get_data("rows")||[],r=this.getSelectedFlag(),i=a.filter(function(e){var t;return null===(t=n[e])||void 0===t?void 0:t[r]});i.length&&this.execute("beforeUnselect",i)&&(i.forEach(function(e){n[e][r]=!1,t.cacheSelectedRow(n[e],!1)}),this.flushSelection())}}},{key:"selectAll",value:function(){var e=this,t=this._get_data("rows")||[],a=this.getSelectedFlag();t.forEach(function(t){t[a]=!0,e.cacheSelectedRow(t,!0)}),this.flushSelection()}},{key:"unselectAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=this.getSelectedFlag();((t.onlyPage?this._get_data("rows"):this._get_data("dataSource"))||[]).forEach(function(e){e[a]=!1}),t.onlyPage?(this._get_data("rows")||[]).forEach(function(t){return e.cacheSelectedRow(t,!1)}):(this._set_data("selectedKeys",[],!0),this._set_data("selectedRowsMap",{},!0),this._set_data("selectedKeysSet",new Set,!0)),t.silent||this.flushSelection()}},{key:"clearSelection",value:function(){this.unselectAll()}},{key:"setSelectedRows",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],a=T(t)?t:[],n=this.getRowKeyField(),r=new Set(a.map(function(e){var t;return String(null!==(t=null==e?void 0:e[n])&&void 0!==t?t:e)})),i=this._get_data("rows")||[],o=this.getSelectedFlag();i.forEach(function(t){var a=r.has(String(t[n]));a!==!!t[o]&&(t[o]=a,e.cacheSelectedRow(t,a))}),this.flushSelection()}},{key:"setSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.unselectAll({silent:!0}),this.setSelectedRows(e)}},{key:"getSelectedRows",value:function(e){var t=this._get_data("rows")||[],a=this.getSelectedFlag(),n=e&&new Set(T(e)?e:[e]);return t.filter(function(e,t){return e[a]&&(!n||n.has(t))})}},{key:"getSelectedRowIndexes",value:function(){var e=this._get_data("rows")||[],t=this.getSelectedFlag(),a=[];return e.forEach(function(e,n){e[t]&&a.push(n)}),a}},{key:"getSelectedKeys",value:function(){return this._get_data("selectedKeys")||[]}},{key:"getAllCacheSelectedRows",value:function(){var e=this._get_data("selectedKeys")||[],t=this._get_data("selectedRowsMap")||{};return e.map(function(e){return t[e]}).filter(Boolean)}},{key:"selectByKeys",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=this.getRowKeyField(),n=T(e)?e:[e],r=this._get_data("rows")||[],i=[];n.forEach(function(e){var t=r.findIndex(function(t){return String(t[a])===String(e)});t>-1&&i.push(t)}),i.length&&(t?this.select(i):this.unselect(i))}},{key:"getSelectedNodes",value:function(){return this.getAllCacheSelectedRows()}},{key:"cacheSelectedRow",value:function(e,t){var a=String(null==e?void 0:e[this.getRowKeyField()]),n=(this._get_data("selectedKeys")||[]).filter(function(e){return e!==a}),r=f({},this._get_data("selectedRowsMap")||{});t&&n.push(a),t?r[a]=e:delete r[a],this._set_data("selectedKeys",n,!0),this._set_data("selectedRowsMap",r,!0),this._set_data("selectedKeysSet",new Set(n),!0)}},{key:"flushSelection",value:function(){this._applyState("selectedRows",this.getSelectedRows()),this.execute("selectionChange",{value:this.getSelectedRows(),keys:this.getSelectedKeys(),indexes:this.getSelectedRowIndexes()})}},{key:"restoreSelectedFlags",value:function(){if(this.get("cacheSelectedRows")){var e=this._get_data("selectedKeysSet")||new Set;if(e.size){var t=this.getRowKeyField(),a=this.getSelectedFlag();(this.getRows()||[]).forEach(function(n){n[a]=e.has(String(n[t]))})}}}},{key:"setPagination",value:function(e){this._applyState("pagination",!!e),this.showPage()}},{key:"getPageInfo",value:function(){return this._get_data("pageInfo")||createDefaults().pageInfo}},{key:"getPageIndex",value:function(){return this.getPageInfo().pageIndex}},{key:"getPageSize",value:function(){return this.getPageInfo().pageSize}},{key:"getTotalCount",value:function(){return this.getPageInfo().recordCount}},{key:"setPageInfo",value:function(e){this.applyPageInfo(f(f({},this.getPageInfo()),e),{refresh:!0})}},{key:"setPageIndex",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"number"==typeof e&&this.applyPageInfo(f(f({},this.getPageInfo()),{},{pageIndex:Math.max(1,e)}),{refresh:t})}},{key:"setPageSize",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"number"==typeof e&&this.applyPageInfo(f(f({},this.getPageInfo()),{},{pageSize:Math.max(-1,e),pageIndex:1}),{refresh:t})}},{key:"setRecordCount",value:function(e){this.applyPageInfo(f(f({},this.getPageInfo()),{},{recordCount:e||0}))}},{key:"applyPageInfo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=f({},e||{}),n=-1===a.pageSize?-1:a.pageSize||20,r=a.recordCount||0,i=r>0;return a.pageSize=n,a.recordCount=r,a.pageCount=n>0?Math.max(1,Math.ceil(r/n)):1,a.pageIndex=n>0?Math.max(1,i?Math.min(a.pageIndex||1,a.pageCount):a.pageIndex||1):1,a.beginPageIndex=n>0?(a.pageIndex-1)*n+1:1,a.endPageIndex=n>0?Math.min(a.pageIndex*n,r):r,this._set_data("pageInfo",a,!0),t.silent||(this._applyState("pageInfo",a),this.isRemote()||this.showPage(),t.refresh&&this.isRemote()&&this.refresh()),a}},{key:"showPage",value:function(){var e=this._get_data("dataSource")||[];if(!this.isRemote()&&this.isPagination()){var t=this.getPageInfo(),a=t.pageIndex,n=t.pageSize,r=(a-1)*n;this.setRows(e.slice(r,r+n))}else this.setRows(e)}},{key:"setRows",value:function(e){var t=T(e)?e:[];this._set_data("rows",t,!0),this.setRowsIdMap(),this._applyState("data",t)}},{key:"setDataSourceView",value:function(){this._applyState("data",this._get_data("rows")||[])}},{key:"setRowsIdMap",value:function(){var e=this,t={};(this._get_data("rows")||[]).forEach(function(a){void 0!==(null==a?void 0:a[e.getIdFlag()])&&(t[a[e.getIdFlag()]]=a)}),this._set_data("rowsIdMap",t)}},{key:"getRowIdMap",value:function(){return this._get_data("rowsIdMap")||{}}},{key:"validate",value:function(e,t){var a=this;if(e)return this.doPropertyChange("validate",{type:"",message:"",errors:[]}),this._set_data("validateErrors",[]),!1;this.deleteNotModifiedRows();var n=this._get_data("columns")||{},r=t?this.getRowsByIndexes(t):this.getRows(),i=[];r.forEach(function(e,t){for(var r in n){var o=n[r];if(a.isRequiredColumn(o)){var s=e[r];if(V(s)||T(s)&&!s.length||K(s)){var u=o.cShowCaption||o.cCaption||o.cCaption||o.title||r;i.push({rowIndex:t,rowId:e[a.getIdFlag()],cellName:r,message:"".concat(u,"不能为空")}),a.setCellState(t,r,"msg","不能为空")}}}}),this._set_data("validateErrors",i);var o=i.length?i[0].message:"";return this.doPropertyChange("validate",{type:i.length?"error":"",message:o,errors:i}),this.execute("afterValidate",{valid:!i.length,errors:i}),!i.length}}])}(),X=function(){function e(){return r(this,e),n(this,e,arguments)}return l(e,E),o(e,[{key:"getParams",value:function(){return this._get_data("params")}},{key:"setParams",value:function(e){this._set_data("params",e,!0)}},{key:"set",value:function(e,t){t instanceof E&&(t.setParent(this),t.setName(e)),this._set_data(e,t,!0)}},{key:"setData",value:function(e){for(var t in e)this.addProperty(t,e[t])}},{key:"addProperty",value:function(e,t){var a=this.get(e);null!=a&&a.setData?a.setData(t):this.set(e,t)}},{key:"getData",value:function(){var e=this,t=this._get_data("propertyNames")||[],a={};return t.forEach(function(t){var n,r=e.get(t);r instanceof E&&!1!==r._get_data("needCollect")&&(a[t]=null===(n=r.getData)||void 0===n?void 0:n.call(r))}),a}},{key:"getAllData",value:function(e){var t=this,a=this._get_data("propertyNames")||[],n={};return a.forEach(function(a){var r,i=t.get(a);if(i instanceof E&&!1!==i._get_data("needCollect")&&(!e||!i._get_data("isGrid"))){var o=null===(r=i.getData)||void 0===r?void 0:r.call(i);void 0!==o&&(n[a]=o)}}),n}},{key:"removeProperty",value:function(e){var t=this._get_data("propertyNames")||[],a=t.indexOf(e);-1!==a&&t.splice(a,1),this._del_data(e)}},{key:"loadData",value:function(e){this.setCache("isLoadData",!0),this.clear(),this.setData(e),this.setDirty(!1),this.setCache("isLoadData",!1)}},{key:"clear",value:function(e){var t=this;(this._get_data("propertyNames")||[]).forEach(function(a){var n,r=t.get(a);r instanceof E&&!1!==r._get_data("needClear")&&(null===(n=r.clear)||void 0===n||n.call(r,e))})}},{key:"setDirty",value:function(e){e?this._set_data("isDirty",!0):(this._del_data("isDirty"),this._set_data("originalData",this.getData()))}},{key:"getGridModel",value:function(e){var t;if(e)return this.get(e);var a=this._get_data("gridModel");if(a)return a;var n=null===(t=this.getParams())||void 0===t?void 0:t.masterGridModelName;if(n)return this.get(n);for(var r=this._get_data("propertyNames"),i=0,o=r.length;i<o;i++){if((a=this.get(r[i]))instanceof G||"GridModel"==a.modelType)return this._set_data("gridModel",a),a}}},{key:"getGridModels",value:function(){for(var e=this._get_data("propertyNames"),t=[],a=0,n=e.length;a<n;a++){var r=this.get(e[a]);(r instanceof G||"GridModel"==r.modelType)&&t.push(r)}return t}}])}();function J(e){var t=this;window&&window.__debugger_initExtendJs;var a=e.requirejs,n=e.extendFilePath,r=e.pageKey,i=e.enableExtendJs,o=void 0===i||i,s=e.extendJsPath,u=void 0===s?"_VM.Extend.js":s;if(o){var l="".concat(r).concat(u),c=[l];if("function"!=typeof a.require)return console.warn("requirejs.js 未加载,跳过扩展脚本:".concat(l)),void t.execute("extendReady",t);a.require(n,c,function(e,a){if(e&&e.doAction)try{e.doAction("init",t),a&&a.doAction("init",t)}catch(e){console.error("扩展脚本异常:",e)}else console.error("".concat(l,"扩展文件extend.*.min.js文件加载失败 或 未注册扩展脚本"));t.execute("extendReady",t)},function(e){console.warn("未找到扩展脚本:".concat(l,"错误信息:"),e),t.execute("extendReady",t)})}else t.execute("extendReady",t)}var Y=function(){var e=a(v().m(function e(t,n,r){var i,o,s,u;return v().w(function(e){for(;;)switch(e.n){case 0:if(s=t.extscripturls,u=void 0===s?[]:s,u=(u=(n.getCache("localDynamicScripts")||[]).concat(u)).concat(window.__devfab__EXT_BILL_SCRIPTS__||[]),null!==(i=n.getParams())&&void 0!==i&&i.initVMExtUrls&&(u=u.concat([n.getParams().initVMExtUrls])),null===(o=u)||void 0===o||!o.length){e.n=2;break}return u=w(new Set(u)),e.n=1,Promise.all(u.map(function(){var e=a(v().m(function e(t){return v().w(function(e){for(;;)if(0===e.n)return e.a(2,t)},e)}));return function(t){return e.apply(this,arguments)}}()));case 1:u=e.v;case 2:return t.extscripturls=u,e.a(2,new Promise(function(e,a){Q(t,n,r,function(){e(!0)})}))}},e)}));return function(t,a,n){return e.apply(this,arguments)}}();function Q(e,t,a,n){var r=e.extscripturls,i=void 0===r?[]:r;if(null!=i&&i.length)try{var o,s=null==a||null===(o=a.requirejs)||void 0===o?void 0:o.requireInner;if("function"!=typeof s)return console.warn("requirejs.js 未加载,跳过客开扩展脚本"),void(null==n||n(e,t));s(i,function(){var a=!0;if(arguments.length){for(var r=0,i=arguments.length;r<i;r++){var o=r<0||arguments.length<=r?void 0:arguments[r];o?o.doAction("init",t):a=!1}a&&(null==n||n(e,t))}else a=!1;a||console.log("[error] [extendjs] 租户级扩展脚本有语法错误,请修改正确后刷新浏览器重试!")},function(a){null==n||n(e,t)})}catch(a){null==n||n(e,t)}else null==n||n(e,t)}function W(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.extendFilePathField,i=void 0===a?"domainKey":a,s=t.pageKeyField,u=void 0===s?"billNo":s,c=t.modelNameField,d=void 0===c?"cName":c,h=e[i]||"",v=e[u]||"",g=function(){function e(){return r(this,e),n(this,e,arguments)}return l(e,X),o(e,[{key:"init",value:function(e,t){var a=this.createModels(e,t);this.setData(a),this.setDirty(!1)}},{key:"createModels",value:function(e,a){var n={};return(Array.isArray(e)?e:[]).forEach(function(e){var r,i,o=null==t||null===(r=t.createModelFactory)||void 0===r?void 0:r.call(t,e);o||(o=function(e){var t;"input"===e.cControlType.toLowerCase()&&(t=new M(e));return t}(e));var s={model:o,field:e,meta:a};null==t||null===(i=t.onBeforeCreateModel)||void 0===i||i.call(t,s),n[e[d]]=s.model}),n}},{key:"initData",value:function(){J.call(this,f(f({},t),{},{extendFilePath:h,pageKey:v}))}}])}();return g.prototype.modelType="ViewModel",g}function $(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;null!=t&&t.requirejs||(t.requirejs=window.__devfab);var r=function(e,t){var a=new(W(e,t));return a.init(e.models,e),a}(e,t);return r.on("destroyVM",function(){var e,t;null===(e=r)||void 0===e||null===(t=e.destroyVM)||void 0===t||t.call(e),r=null}),r.on("extendReady",a(v().m(function a(){var i;return v().w(function(a){for(;;)switch(a.n){case 0:return(i=[]).push(Y(e,r,t)),a.n=1,Promise.all(i);case 1:null==n||n(r,e);case 2:return a.a(2)}},a)}))),r.initData(),r}var Z={BaseModel:E,FilterModel:O,SimpleModel:M,GridModel:G,ViewModel:X,initViewModel:$};exports.BaseModel=E,exports.FilterModel=O,exports.GridModel=G,exports.SimpleModel=M,exports.ViewModel=X,exports.default=Z,exports.initViewModel=$;
|
|
3
|
+
var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function a(n,r,i,a){var u=r&&r.prototype instanceof s?r:s,c=Object.create(u.prototype);return v(c,"_invoke",function(n,r,i){var a,s,u,c=0,l=i||[],f=!1,d={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return a=t,s=0,u=e,d.n=n,o}};function h(n,r){for(s=n,u=r,t=0;!f&&c&&!i&&t<l.length;t++){var i,a=l[t],h=d.p,v=a[2];n>3?(i=v===r)&&(u=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=h&&((i=n<2&&h<a[1])?(s=0,d.v=r,d.n=a[1]):h<v&&(i=n<3||a[0]>r||r>v)&&(a[4]=n,a[5]=r,d.n=v,s=0))}if(i||n>1)return o;throw f=!0,r}return function(i,l,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,v),s=l,u=v;(t=s<2?e:u)||!f;){a||(s?s<3?(s>1&&(d.n=-1),h(s,u)):d.n=u:d.v=u);try{if(c=2,a){if(s||(i="next"),t=a[i]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==o)break}catch(t){a=e,s=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,i,a),!0),c}var o={};function s(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(v(t={},r,function(){return this}),t),f=c.prototype=s.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,v(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,v(f,"constructor",c),v(c,"constructor",u),u.displayName="GeneratorFunction",v(c,i,"GeneratorFunction"),v(f),v(f,i,"Generator"),v(f,r,function(){return this}),v(f,"toString",function(){return"[object Generator]"}),(h=function(){return{w:a,m:d}})()}function v(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}v=function(e,t,n,r){function a(t,n){v(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},v(e,t,n,r)}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],u=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||b(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function b(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}Object.defineProperty(exports,"__esModule",{value:!0});var k=function(){return o(function e(t){i(this,e),this._init(t)},[{key:"_init",value:function(e){this._data=Object.assign({},e)}},{key:"set",value:function(e,t){this._data[e]=t}},{key:"get",value:function(e){var t;return null===(t=this._data)||void 0===t?void 0:t[e]}},{key:"delete",value:function(e){delete this._data[e]}},{key:"clear",value:function(){this._data={}}}])}();k.create=function(e){return new k};var w=function(){return o(function e(t){i(this,e),this._init(t)},[{key:"_init",value:function(e){var t;this.__ASYNC_EXECUTE__=null===(t=null==e?void 0:e.__ASYNC_EXECUTE__)||void 0===t||t,this._events=new Map,this._firstevents=new Map}},{key:"on",value:function(e,t,n){var r=this._events.get(e);Array.isArray(r)||(r=[]),r.push({callback:t,context:n}),this._events.set(e,r)}},{key:"onFirst",value:function(e,t,n){var r=this._firstevents.get(e);Array.isArray(r)||(r=[]),r.splice(0,0,{callback:t,context:n}),this._firstevents.set(e,r)}},{key:"execute",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=this._events.get(e),a=this._firstevents.get(e);if(!i&&!a)return!0;var o=!0;return[].concat(g(a||[]),g(i||[])).forEach(function(e){if(!1!==o){var t=e.callback.apply(e.context||void 0,n);o=!1!==t&&o}}),o}},{key:"un",value:function(e,t){this._unEvents(e,t,this._events),this._unEvents(e,t,this._firstevents)}},{key:"_unEvents",value:function(e,t,n){if(e&&n.has(e))if(t){var r=n.get(e),i=null==r?void 0:r.findIndex(function(e){return e.callback===t});-1!==i&&(null==r||r.splice(i,1))}else n.delete(e)}},{key:"hasEvent",value:function(e){var t,n;return e?((null===(t=this._events.get(e))||void 0===t?void 0:t.length)||0)+((null===(n=this._firstevents.get(e))||void 0===n?void 0:n.length)||0):0}},{key:"fireEvent",value:function(e,t){this.execute("before".concat(e),t)&&(this.execute(e,t),this.execute("after".concat(e),t))}},{key:"_asyncExecute",value:function(e,t,n){for(var r,i=this,a=n.resolve,o=n.reject,s=n.args,u=!0,c=t||[],l=!1,f=function(t){var n,r=c[t];if(!1===u)return 0;if(l)return{v:void 0};if("development"===process.env.nodeEnv)n=r.callback.apply(r.context||i,s);else try{n=r.callback.apply(r.context||i,s)}catch(e){throw e.isAddedMsg||(e.message="(领域扩展事件执行失败,请打开控制台查看详细错误信息并修复):".concat(e.message)),e.isAddedMsg=!0,e}n instanceof Promise?(l=!0,(u=n).callbacks&&u.callbacks.push({reject:function(){u.reject(),t===c.length-1&&(null==o||o())},resolve:function(n){t===c.length-1?(s.length>1&&(s[0]=n),null==a||a(s)):i._asyncExecute(e,c.slice(t+1),{resolve:a,reject:o,args:s})}})):(u=!1!==n&&u,t===c.length-1&&(u?null==a||a(s):null==o||o()))},d=0;d<c.length&&0!==(r=f(d));d++)if(r)return r.v;return u}},{key:"_asyncPromiseExecute",value:function(e,t,n,r){var i=this._events.get(e),a=this._firstevents.get(e);if(!((Array.isArray(i)?i.length:i)||(Array.isArray(a)?a.length:a)))return null==t?void 0:t();var o=[].concat(g(a||[]),g(i||[]));return this._asyncExecute(e,o,{resolve:t,reject:n,args:r})}},{key:"promiseExecute",value:function(e,t){var n=this,r=e,i=1;if("boolean"==typeof e&&(r=t,i=2),r){for(var a=arguments.length,o=new Array(a>2?a-2:0),s=2;s<a;s++)o[s-2]=arguments[s];var u=2===i?o:[t].concat(o);if(u.length){var c,l=u.length-1,f=u[l];if("function"!=typeof f){if("object"!==m(f)||!f[0]||"function"!=typeof f[0]||!f[1]||"function"!=typeof f[1])return;c=f[1],f=f[0]}if(this.__ASYNC_EXECUTE__)return this._asyncPromiseExecute(r,function(e){f.apply(n,e)},function(){c&&"function"==typeof c&&c()},u);u.splice(l,1),u.unshift(r);var d=this.execute.apply(this,u);if(d instanceof Promise){var h=this;d.then(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];f.apply(h,t)},function(){c&&"function"==typeof c&&c()})}else if(!d)return void(c&&"function"==typeof c&&c())}}}},{key:"clear",value:function(){this._events.clear(),this._firstevents.clear()}}])}();function x(e){return e||window.devfab&&window.devfab.debug}function P(e){this.pathname="",this.query={};var t=e;this.init=function(){t||(t=location.search);var e=t.indexOf("?"),n=t.indexOf("#");if(e>=0){if(this.pathname=t.substr(0,e),(t=n<0?t.substr(e+1):t.substring(e+1,n)).length>0)for(var r=(t=t.replace(/\+/g," ")).split("&"),i=0,a=r.length;i<a;i++){var o=r[i]||"";if(o){var s=o.indexOf("="),u="",c="";s<0?c=u=window.decode(o):(u=window.decode(o.substr(0,s)),c=window.decode(o.substr(s+1))),this.query[u]=c}}}else this.pathname=t},this.set=function(e,t){this.query[e]=t},this.get=function(e){return this.query[e]},this.del=function(e){delete this.query[e]},this.has=function(e){return null!=this.query[e]},this.toStr=function(){var e=["?"];for(var t in this.query)e.push(encodeURIComponent(t)),e.push("="),e.push(encodeURIComponent(this.query[t])),e.push("&");return 1===e.length?"":(e.splice(e.length-1,1),e.join(""))},this.init()}function S(e,t){if(!t)return e;var n=[],r=new P(e);for(var i in t)r.get(i)||n.push("".concat(i,"=").concat(t[i]));if(!n.length)return e;var a=n.join("&");return e.indexOf("?")>=0?"".concat(e,"&").concat(a):"".concat(e,"?").concat(a)}w.create=function(e){return new w(e)},String.prototype.equalsIgnoreCase=function(e){return null!=e&&this.toLowerCase()===e.toLowerCase()};var j={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t,n=e.method||"GET",r=e.url;try{null!=e&&e.requestHeaders&&(t=e.requestHeaders,e.requestHeaders=void 0,delete e.requestHeaders)}catch(e){x()&&console.log('[devfab][ajax]: [doRequest]: options["requestHeaders"] ERR : ',e)}try{e.params&&e.params.requestHeaders&&(t=e.params.requestHeaders,e.params.requestHeaders=void 0,delete e.params.requestHeaders)}catch(e){x()&&console.log('[devfab][ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var i=null;if(n.equalsIgnoreCase("get")||n.equalsIgnoreCase("delete")?r=S(r,e.params):(n.equalsIgnoreCase("post")||n.equalsIgnoreCase("put"))&&(i=JSON.stringify(e.params)),e.jsonp)return this.getJsonp(r,e.callback);var a=this.getXMLHttpRequest();if(a){var o;if(a.open(n,r,!1!==e.async),e.timeout&&(a.timeout=e.timeout,a.setRequestHeader("timeout",e.timeout),a.ontimeout=function(){j.onerror(this,e,"timeout")}),e.contentType){if(a.setRequestHeader("Content-Type",e.contentType),e.contentType.indexOf("x-www-form-urlencoded")>=0)i=null===(o=new URLSearchParams(e.params))||void 0===o?void 0:o.toString()}else e.dateType?i=e.params:a.setRequestHeader("Content-Type","application/json;charset=utf-8");try{if(t&&"[object Object]"===Object.prototype.toString.call(t))for(var s in t)a.setRequestHeader(s,t[s])}catch(e){x()&&console.log('[devfab][ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}a.withCredentials=null==e||!e.hasOwnProperty("withCredentials")||e.withCredentials,e.onBeforeRequest&&e.onBeforeRequest(a,i);try{a.send(i)}catch(t){return{error:"NetWorkError",options:e}}if(!1===e.async)return this.onreadystatechange(a,e);a.onreadystatechange=function(){j.onreadystatechange(this,e)}}},onreadystatechange:function(e,t){if(4===e.readyState){if(200===e.status){var n;try{if("blob"===t.responseType){var r=function(e){var t=e.xhr.getAllResponseHeaders(),n={};return t.split("\r\n").map(function(e){var t=p(e.split(": "),2),r=t[0],i=t[1];n[r]=i}),n}({xhr:e});n={code:e.status,data:{data:e.response,headers:r}}}else n=JSON.parse(e.responseText)}catch(n){j.onerror(e,t,e.responseText)}if(!1===t.async)return e.isBusy=!1,t.onAfterRequest&&t.onAfterRequest(n),j.parseAjaxResult(n,!1,null,null,t,e);j.parseAjaxResult(n,t.async,t.callback,t.context,t,e),t.onAfterRequest&&t.onAfterRequest(n)}else if(0===e.status)j.onerror(e,t,"The network connection has been disconnected. Please check the network status of the device and try.");else if(502===e.status||504===e.status)j.onerror(e,t,"An error has occurred with the service. Please try again later.");else{if(401!==e.status){var i={};try{i=JSON.parse(e.responseText)}catch(t){i={code:e.status,message:e.responseText}}return j.onerror(e,t,i)}j.onerror(e,t,"Login information has expired. Please log in again or contact technical staff.")}e.isBusy=!1}},onerror:function(e,t,n){var r="[devfab][ajax]: [onerror]: api error \n [code]: ".concat(e.status," \n [error]: ").concat(("object"===m(n)?JSON.stringify(n):n)||"空"," \n [url]: ").concat(t.url," \n [token]: ").concat(document.cookie);x()&&console.log(r);var i="object"===m(n)?n:{code:500,message:n};t.onAfterRequest&&t.onAfterRequest(i)},getXMLHttpRequest:function(){return this.createXMLHttpRequest()},createXMLHttpRequest:function(){return window.XMLHttpRequest?new XMLHttpRequest:window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):null},getJsonp:function(e,t){var n=e,r="callback"+this._jsonps.index++,i=document.createElement("script");this._jsonps[r]=function(e){try{t(e)}finally{document.body.removeChild(i)}},n+=-1===n.indexOf("?")?"?":"&callback=cb.rest.AjaxUtil._jsonps."+r,i.src=n,document.body.appendChild(i)},parseAjaxResult:function(e,t,n,r,i,a){if(e){if(!e.code)return!1===t?e:void(n&&n.call(r,null,e));if(200==e.code){if(!1===t)return{result:e.data};n&&n.call(r,null,e.data,e.message,e.errorDetail,e.code,e.displayCode&&e)}else{if(!1===t)return{error:e};n&&n.call(r,e)}}}};function A(e,t){this.init&&this.init(e),this.queryParams=t}A.create=function(e,t){return new A(e,t)},A.prototype.init=function(e){if(e)for(var t in this.config=e,this.config)this[t]=function(e){return function(t,n,r){return this.Do(e,t,n,null,r)}}(t),this["".concat(t,"Sync")]=function(e){return function(t){return this.Do(e,t,null,!1)}}(t)},A.prototype.Do=function(e,t,n,r,i){var a,o,s;if(this.config&&this.config[e]&&this.config[e].url){var u=this.config[e],c=u.url;this.queryParams||(this.queryParams={}),null!==(a=u.options)&&void 0!==a&&a.proxyServiceCode&&(this.queryParams.serviceCode=u.options.proxyServiceCode),null!==(o=u.options)&&void 0!==o&&o.billnum&&(this.queryParams.billnum=u.options.billnum),null!==(s=this.queryParams)&&void 0!==s&&s.serviceCode&&(c=S(c,this.queryParams));var l=c,f=Object.assign({},u.options);return f.method=u.method||"GET","function"==typeof t?(f.callback=t,f.context=i||f.context||this):f.params=t,n&&(f.callback=n,f.context=i||f.context||this),!1===r&&(f.async=!1),this.ajax(l,f)}},A.prototype.ajax=function(e,t){return function(e,t){return t.url=e,j.doRequest(t)}(e,t)};var q=function(){return o(function e(t){i(this,e),this._init(t)},[{key:"_init",value:function(e){this._data={};var t=[];if(e)for(var n in e)t.push(n);Object.assign(this._data,{components:[],propertyNames:t},e),this._data.cache=new k,this._data.events=new w}},{key:"_del_data",value:function(e){e&&delete this._data[e]}},{key:"_cls_data",value:function(){this._data.cache.clear(),this._data.events.clear(),this._data={components:[],propertyNames:[],cache:new k,events:new w}}},{key:"_set_data",value:function(e,t,n){if(e){if(n){var r=this._data.propertyNames||[];r.indexOf(e)<0&&r.push(e)}this._data[e]=t}}},{key:"_get_data",value:function(e){if(e)return this._data[e]}},{key:"getData",value:function(){return this._get_data("value")}},{key:"getState",value:function(e,t){var n;if(!t)return this._get_data(e);var r=(this._get_data("components")||[]).find(function(e){return e.ctrlName===t});return r?null===(n=r.getState)||void 0===n?void 0:n.call(r,e):this._get_data(e)}},{key:"setState",value:function(e,t,n){n||this._set_data(e,t,!0);var r={};r[e]=t,this.doPropertyChange("setState",r,n)}},{key:"doPropertyChange",value:function(e,t,n){var r=this,i=this._get_data("components")||[];if(!i.length)return i;var a=[];if(n){var o=i.find(function(e){return e.ctrlName===n});o&&!this.notifyComponent(o,e,t)&&a.push(o)}else i.forEach(function(n){r.notifyComponent(n,e,t)||a.push(n)});return a.length?a:void 0}},{key:"notifyComponent",value:function(e,t,n){return"function"==typeof e[t]&&(this.viewUpdater(e,t,n),!0)}},{key:"viewUpdater",value:function(e,t,n){if("setState"===t)e[t](n);else{var r=this.getCache("name");e[t](n,r)}}},{key:"get",value:function(e){return this._get_data(e)}},{key:"addComponent",value:function(e,t){if(e){t&&!e.ctrlName&&(e.ctrlName=t);var n=this._get_data("components")||[];n.indexOf(e)>=0||n.push(e)}}},{key:"removeComponent",value:function(e){var t=this._get_data("components")||[],n=t.indexOf(e);n<0||t.splice(n,1)}},{key:"_applyState",value:function(e,t,n){var r=this;n||this._set_data(e,t,!0);var i="set".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),a=this.doPropertyChange(i,t,n);if(a){var o={};o[e]=t,a.forEach(function(e){r.notifyComponent(e,"setState",o)})}}},{key:"getVisible",value:function(e){return this.getState("visible",e)}},{key:"setVisible",value:function(e,t){this._applyState("visible",e,t)}},{key:"getValue",value:function(){return this.getData()}},{key:"setValue",value:function(e,t,n){var r=this,i=this.getValue();if(e!==i){var a={value:e,oldValue:i},o=this._get_data("forceFireEvent");t||o?this.promiseExecute("beforeValueChange",a,[function(){r._set_data("value",e,!0),r._applyState("value",e,n),r.execute("afterValueChange",a)},function(){r._set_data("value",i,!0),r._applyState("value",i,n)}]):(this._set_data("value",e,!0),this._applyState("value",e,n))}}},{key:"getDisabled",value:function(e){return this.getState("disabled",e)}},{key:"setDisabled",value:function(e,t){this._applyState("disabled",e,t)}},{key:"setParent",value:function(e){this.setCache("parent",e)}},{key:"getParent",value:function(){return this.getCache("parent")}},{key:"getRootParent",value:function(){for(var e=this.getParent();null!==(t=e)&&void 0!==t&&t.getParent();){var t;e=e.getParent()}return e}},{key:"setName",value:function(e){this.setCache("name",e)}},{key:"getName",value:function(){return this.getCache("name")}},{key:"setDirty",value:function(e){e?this._set_data("isDirty",!0):(this._del_data("isDirty"),this._set_data("originalData",this.getData()))}},{key:"getDirtyData",value:function(e){var t=this.getData();return!1!==e&&this._get_data("isDirty")||t!==this._get_data("originalData")?t:void 0}},{key:"clear",value:function(e){void 0===e?this._set_data("value",this._get_data("cDefaultValue")):e||this._set_data("value",void 0),this._del_data("isDirty"),this._del_data("checking"),this._del_data("checkMsg")}},{key:"on",value:function(e,t,n){this._get_data("events").on(e,t,n)}},{key:"onFirst",value:function(e,t,n){this._get_data("events").onFirst(e,t,n)}},{key:"execute",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return(t=this._get_data("events")).execute.apply(t,[e].concat(r))}},{key:"un",value:function(e,t){this._get_data("events").un(e,t)}},{key:"hasEvent",value:function(e){return this._get_data("events").hasEvent(e)}},{key:"fireEvent",value:function(e,t){this._get_data("events").fireEvent(e,t)}},{key:"promiseExecute",value:function(e,t){for(var n,r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a];(n=this._get_data("events")).promiseExecute.apply(n,[e,t].concat(i))}},{key:"setCache",value:function(e,t){this._get_data("cache").set(e,t)}},{key:"getCache",value:function(e){return this._get_data("cache").get(e)}},{key:"clearCache",value:function(e){this._get_data("cache").delete(e)}},{key:"setProxy",value:function(e){if(!(e instanceof A)){var t,n=this._get_data("__requestHeaders__");for(var r in e){var i,a,o;if(n&&(null===(i=e[r])||void 0===i||null===(i=i.options)||void 0===i||!i.requestHeaders))null!==(o=e[r])&&void 0!==o&&o.options||(e[r].options={}),e[r].options.requestHeaders=n;null!==(a=this.getProxy())&&void 0!==a&&a[r]&&window.devfab.debug&&console.warn("[devfab][baseModel.prototype.setProxy]: Proxy ".concat(r," already exists on the model. Please change the name of ").concat(r," and try again"))}return this._set_data("proxy",A.create(d(d({},(null===(t=this.getProxy())||void 0===t?void 0:t.config)||{}),e))),this.getProxy()}this._set_data("proxy",e)}},{key:"getProxy",value:function(){return this._get_data("proxy")}}])}(),C=function(){function e(){var t;i(this,e);for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return s(t=r(this,e,[].concat(a)),"modelType","SimpleModel"),t}return c(e,q),o(e,[{key:"getDisabled",value:function(){return this.getState("disabled")}},{key:"setDisabled",value:function(e,t){this._applyState("disabled",e,t)}},{key:"getReadonly",value:function(){return this.getState("readonly")}},{key:"setReadonly",value:function(e,t){this._applyState("readonly",e,t)}}])}(),O=Array.isArray;function M(e){if(O(e))return e.map(M);if(e instanceof Date)return new Date(e.getTime());if(e&&"object"===m(e)){var t={};for(var n in e)t[n]=M(e[n]);return t}return e}function E(e,t,n){var r=this;this.promiseExecute("beforeQuery",{proxyConfig:e,queryParams:t},function(){var i=r,a=r.setProxy({queryData:e}),o=r._get_data("innerUsedAttrs").pageIndex,u={page:s(s({},r._get_data("innerUsedAttrs").pageSize,r.getPageSize()),o,r.getPageIndex())},c=Object.assign(t,u);r.setCache("proxyCache",{proxyConfig:e,params:c,callback:n});if(!1!==r.execute("beforeQueryData",c)){var l=M(c);a.queryData(l,function(e,t,r,i){if(!e){var a=t;this._set_data("dataSourceMode","remote");var o=function(e){if(!e)return[];if(O(e))return e;if(O(e.data))return e.data;if(O(e.records))return e.records;if(O(e.list))return e.list;if(O(e.rows))return e.rows;var t=e.data&&"object"===m(e.data)?e.data:e.result;return O(t)?t:t&&"object"===m(t)&&(t.records||t.list||t.rows||t.data)||[]}(a=Object.assign({},a));this.execute("afterQueryData",a),null==n||n.call(this,o)}},i)}})}function D(e){if(this.execute("beforeSetDataSource",e)){var t=this.getRowKeyField(),n={};e.forEach(function(e){n[e[t]]=e}),this._set_data("keyMap",n),this._set_data("dataSource",e,!0),this.doPropertyChange("setDataSource"),this.execute("afterSetDataSource",e)}}var R=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var a,o=d(d({},{columns:{},dataSource:[],rows:[],readOnly:!0,dataSourceMode:"local",columnMode:"local",editMode:"cell",rowKeyField:"id",cellState:{},rowState:{},showCheckBox:!1,multiple:!0,showRowNo:!0,pagination:!0,pageInfo:s(s(s({},(a={id:"_id",selected:"_selected",status:"_status",pageIndex:"pageNo",pageSize:"pageSize",pageCount:"total"}).pageIndex,1),a.pageSize,20),a.pageCount,0),innerUsedAttrs:a,multiRowModel:!1,editRowModels:{},loading:!1,params:{},originalKeyMap:{},defaultRowDatas:new Map}),n);O(o.dataSource)||(o.dataSource=[]),O(o.rows)||(o.rows=[]);var u=function(){return d({},(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).proxyConfig||{})}(n);return o.proxyConfig=u,o.dataSourceMode=n.dataSourceMode||o.dataSourceMode,s(t=r(this,e,[o]),"modelType","GridModel"),t.initColumns(o.columns),t.initPageInfo(n.cPage||n.page),t.afterInit(),t}return c(e,q),o(e,[{key:"afterInit",value:function(){this.execute("afterInit")}},{key:"initColumns",value:function(e){var t=function(e){var t={};return(O(e)?e:Object.keys(e||{}).map(function(t){var n;return d(d({},e[t]||{}),{},{field:(null===(n=e[t])||void 0===n?void 0:n.field)||t})})).forEach(function(e,n){if(e){var r=e.field||e.cFieldName||e.cName||"col_".concat(n);t[r]=d(d({},e),{},{field:r,label:e.label||e.title||e.cCaption||r,index:void 0===e.index?n:e.index})}}),t}(e);return this._set_data("columns",t,!0),t}},{key:"initPageInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=d({},this.getPageInfo()),n=this._get_data("innerUsedAttrs").pageIndex,r=this._get_data("innerUsedAttrs").pageSize;t[n]=e.pageNo||e.pageIndex||t.pageIndex||1,t[r]=e.pageSize||t.pageSize||20,!1===this.get("pagination")&&(t[n]=-1),this._set_data("pageInfo",t)}},{key:"getRowKeyField",value:function(){return this._get_data("rowKeyField")}},{key:"isRemote",value:function(){return"remote"===this._get_data("dataSourceMode")}},{key:"getReadOnly",value:function(){return!!this._get_data("readOnly")}},{key:"setReadOnly",value:function(e){this._applyState("readOnly",!!e)}},{key:"setShowCheckbox",value:function(e){this._applyState("showCheckBox",!!e)}},{key:"setShowRowNo",value:function(e){this._applyState("showRowNo",!!e)}},{key:"getParams",value:function(){return d(d({},this.get("cParams")||{}),this._get_data("params")||{})}},{key:"setParams",value:function(e){this._set_data("params",e||{})}},{key:"getInnerUsedAttrs",value:function(e){var t=this._get_data("innerUsedAttrs");return e?t[e]:t}},{key:"getId",value:function(){return this.getInnerUsedAttrs("id")}},{key:"setDataSource",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if("local"===this._get_data("dataSourceMode")){D(O(e)?e:[])}else{if(!this.execute("beforeProxyLoad",n))return;this.setPageIndex(1),E.call(this,e,n,function(e){D.call(t,e),null==r||r.call(t)})}}},{key:"reloadData",value:function(){var e=this,t=this.getCache("proxyCache");if(t){var n=t.proxyConfig,r=t.params,i=t.callback;E.call(this,n,r,function(t){null==i||i.call(e,t)})}else x()&&console.log("[devfab][GridModel] proxyConfig is null")}},{key:"getDataSource",value:function(){return this._get_data("dataSource")||[]}},{key:"getData",value:function(e){return e?this._get_data("rows"):this._get_data("dataSource")}},{key:"getAllData",value:function(){return this.getData(!0)}},{key:"clear",value:function(){this._set_data("dataSource",[],!0),this._set_data("rows",[],!0)}},{key:"getPageInfo",value:function(){return this._get_data("pageInfo")}},{key:"getPageIndex",value:function(){var e=this._get_data("innerUsedAttrs").pageIndex;return this.getPageInfo()[e]}},{key:"getPageSize",value:function(){var e=this._get_data("innerUsedAttrs").pageSize;return this.getPageInfo()[e]}},{key:"getTotalCount",value:function(){var e=this._get_data("innerUsedAttrs").pageCount;return this.getPageInfo()[e]}},{key:"setPageInfo",value:function(e){var t=this.getPageInfo();this._set_data("pageInfo",d(d({},t),e)),this.reloadData()}},{key:"setPageIndex",value:function(e){if("number"==typeof e){var t=this._get_data("innerUsedAttrs").pageIndex;this._set_data("pageInfo",d(d({},this.getPageInfo()),{},s({},t,Math.max(1,e))))}}},{key:"setPageSize",value:function(e){if("number"==typeof e){var t=this._get_data("innerUsedAttrs").pageIndex,n=this._get_data("innerUsedAttrs").pageSize;this._set_data("pageInfo",d(d({},this.getPageInfo()),{},s(s({},n,Math.max(-1,e)),t,1)))}}},{key:"setTotalCount",value:function(e){var t=this._get_data("innerUsedAttrs").pageCount;this.getPageInfo()[t]=e}}])}(),I=function(){function e(){var t;i(this,e);for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return s(t=r(this,e,[].concat(a)),"modelType","ViewModel"),t}return c(e,q),o(e,[{key:"getParams",value:function(){return this._get_data("params")}},{key:"setParams",value:function(e){this._set_data("params",e,!0)}},{key:"set",value:function(e,t){t instanceof q&&(t.setParent(this),t.setName(e)),this._set_data(e,t,!0)}},{key:"setData",value:function(e){for(var t in e)this.addProperty(t,e[t])}},{key:"addProperty",value:function(e,t){var n=this.get(e);null!=n&&n.setData?n.setData(t):this.set(e,t)}},{key:"getData",value:function(){var e=this,t=this._get_data("propertyNames")||[],n={};return t.forEach(function(t){var r,i=e.get(t);i instanceof q&&!1!==i._get_data("needCollect")&&(n[t]=null===(r=i.getData)||void 0===r?void 0:r.call(i))}),n}},{key:"getAllData",value:function(e){var t=this,n=this._get_data("propertyNames")||[],r={};return n.forEach(function(n){var i,a=t.get(n);if(a instanceof q&&!1!==a._get_data("needCollect")&&(!e||!a._get_data("isGrid"))){var o=null===(i=a.getData)||void 0===i?void 0:i.call(a);void 0!==o&&(r[n]=o)}}),r}},{key:"removeProperty",value:function(e){var t=this._get_data("propertyNames")||[],n=t.indexOf(e);-1!==n&&t.splice(n,1),this._del_data(e)}},{key:"loadData",value:function(e){this.setCache("isLoadData",!0),this.clear(),this.setData(e),this.setDirty(!1),this.setCache("isLoadData",!1)}},{key:"clear",value:function(e){var t=this;(this._get_data("propertyNames")||[]).forEach(function(n){var r,i=t.get(n);i instanceof q&&!1!==i._get_data("needClear")&&(null===(r=i.clear)||void 0===r||r.call(i,e))})}},{key:"setDirty",value:function(e){e?this._set_data("isDirty",!0):(this._del_data("isDirty"),this._set_data("originalData",this.getData()))}},{key:"getGridModel",value:function(e){var t;if(e)return this.get(e);var n=this._get_data("gridModel");if(n)return n;var r=null===(t=this.getParams())||void 0===t?void 0:t.masterGridModelName;if(r)return this.get(r);for(var i=this._get_data("propertyNames"),a=0,o=i.length;a<o;a++){if((n=this.get(i[a]))instanceof R||"GridModel"==n.modelType)return this._set_data("gridModel",n),n}}},{key:"getGridModels",value:function(){for(var e=this._get_data("propertyNames"),t=[],n=0,r=e.length;n<r;n++){var i=this.get(e[n]);(i instanceof R||"GridModel"==i.modelType)&&t.push(i)}return t}},{key:"getGridFilterModel",value:function(e){return this.getGridModel(e).getCache("FilterViewModel")}}])}(),T=403;function U(e){return String(null==e?"":e).replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}var N=function(){return o(function e(t){i(this,e),this.manifest=null,this.origins=null,this.lockVersion=null,this.verifyHash=!0,this.fetch=null,this._index=null,this.configure(t)},[{key:"configure",value:function(e){var t=e||{};return void 0!==t.manifest&&(this.manifest=t.manifest||null),void 0!==t.origins&&(this.origins=t.origins?[].concat(t.origins).map(function(e){return String(e).trim().replace(/\/+$/,"")}):null),void 0!==t.lockVersion&&(this.lockVersion=t.lockVersion||null),void 0!==t.verifyHash&&(this.verifyHash=!!t.verifyHash),void 0!==t.fetch?this.fetch=t.fetch||null:this.fetch||"function"!=typeof fetch||(this.fetch=function(){return fetch.apply(void 0,arguments)}),this._index=null,this}},{key:"enabled",get:function(){return!!this.manifest}},{key:"_moduleIndex",value:function(){if(this._index)return this._index;var e={},t=this.manifest&&this.manifest.modules;return Array.isArray(t)?t.forEach(function(t){t&&t.path&&(e[U(t.path)]=t)}):t&&"object"===m(t)&&Object.keys(t).forEach(function(n){e[U(n)]=t[n]||{}}),this._index=e,e}},{key:"entryOf",value:function(e){return this.manifest&&this._moduleIndex()[U(e)]||null}},{key:"checkVersion",value:function(){if(!this.lockVersion||!this.manifest)return null;var e=String(this.manifest.version||"");return e===String(this.lockVersion)?null:{code:T,message:"清单版本 ".concat(e||"(未声明)"," 与锁定版本 ").concat(this.lockVersion," 不一致,拒绝加载")}}},{key:"checkModules",value:function(e){var t=this.checkVersion();if(t)return t;if(!this.manifest)return null;for(var n=0;n<e.length;n++){var r=U(e[n]);if(!this._moduleIndex()[r])return{code:T,message:"Module ".concat(r," not registered in the list, loading denied.")}}return null}},{key:"checkOrigin",value:function(e){if(!this.origins)return null;if(!function(e){return/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(e)||/^(?:blob|data):/i.test(e)}(e))return null;var t;try{t=new URL(e).origin}catch(t){return{code:T,message:"无法解析的地址:".concat(e)}}return-1===this.origins.indexOf(t)?{code:T,message:"来源 ".concat(t," 不在白名单内(允许:").concat(this.origins.join(", "),")")}:null}},{key:"verify",value:function(e,t){var n=this;if(!this.verifyHash)return Promise.resolve({ok:!0,skipped:"disabled"});if(!t)return Promise.resolve({ok:!0});var r="undefined"!=typeof globalThis&&globalThis.crypto&&globalThis.crypto.subtle;return r?this.fetch?Promise.resolve().then(function(){return n.fetch(e)}).then(function(e){return e&&e.ok?e.arrayBuffer().then(function(e){return r.digest("SHA-256",e)}):{ok:!1,message:"完整性预检请求失败:HTTP ".concat(e&&e.status||"unknown")}}).then(function(e){if(!e||!1===e.ok)return e;var n=function(e){for(var t=new Uint8Array(e),n="",r=0;r<t.length;r++)n+=t[r].toString(16).padStart(2,"0");return n}(e),r=String(t).toLowerCase();return n!==r?{ok:!1,message:"sha256 不匹配:期望 ".concat(r,",实际 ").concat(n)}:{ok:!0}}).catch(function(e){return{ok:!1,message:"完整性预检异常:".concat(e&&e.message||e),error:e}}):Promise.resolve({ok:!0,skipped:"fetch unavailable"}):Promise.resolve({ok:!0,skipped:"crypto.subtle unavailable(需要 https / localhost)"})}},{key:"describe",value:function(){return{manifest:this.enabled?this.manifest.name||"(unnamed)":null,version:this.manifest&&this.manifest.version||null,lockVersion:this.lockVersion,modules:this.enabled?Object.keys(this._moduleIndex()).length:0,origins:this.origins?this.origins.slice():null,verifyHash:this.verifyHash}}}])}(),H=["$","jQuery","define","require","requirejs","devfab","__devfab","__devfab_requirejs"],V=function(){return o(function e(t){i(this,e);var n=t||{};this.maxPollution=void 0===n.maxPollution?3:Number(n.maxPollution),this.watch=[].concat(n.watch||H),this.target=n.target||("undefined"!=typeof window?window:null),this.enabled=void 0===n.enabled||!!n.enabled,this._pending=0,this._before=null,this.lastWarnings=[]},[{key:"_snapshot",value:function(){var e=new Map,t=this.target;return t?(Object.keys(t).forEach(function(n){e.set(n,t[n])}),e):e}},{key:"_diff",value:function(){var e=this,t=this._before,n=this._snapshot(),r=[];if(!t)return r;n.forEach(function(n,i){var a=-1!==e.watch.indexOf(i);t.has(i)?t.get(i)!==n&&r.push({type:"overwritten",key:i,watched:a}):r.push({type:"added",key:i,watched:a})});var i=r.filter(function(e){return e.watched}).length,a=r.filter(function(e){return"added"===e.type}).length;return!i&&a<=this.maxPollution?[]:r}},{key:"begin",value:function(){var e=this;if(!this.enabled||!this.target)return{end:function(){return[]}};this._pending++,1===this._pending&&(this._before=this._snapshot());var t=!1;return{end:function(){if(t)return[];if(t=!0,e._pending--,e._pending>0)return[];var n=e._diff();return e._before=null,e.lastWarnings=n,n}}}},{key:"configure",value:function(e){var t=e||{};return void 0!==t.enabled&&(this.enabled=!!t.enabled),void 0!==t.maxPollution&&(this.maxPollution=Number(t.maxPollution)),void 0!==t.watch&&(this.watch=[].concat(t.watch||[])),void 0!==t.target&&(this.target=t.target||null),this}}])}(),G=null;try{G=new Function("s","return import(s)")}catch(e){G=null}function F(e,t,n,r){var i=e,a=t,o=n;Array.isArray(e)&&!Array.isArray(t)&&(i=null==r?void 0:r.path,a=e,o="function"==typeof t?t:n);var s=(a=Array.isArray(a)?a:[]).join(","),u={code:0,message:"",data:[],warnings:[]};return("require"===r.type&&"function"!=typeof r.require||"define"===r.type&&"function"!=typeof r.define)&&(u.code=404,u.message="requirejs is undefined, the fiels: ".concat(s)),{path:i,files:a,callback:o,filesStr:s,result:u}}function L(e,t){var n="";return Array.isArray(e)?n=e.filter(Boolean).join("/"):"string"==typeof e&&(n=e.replace(/\/+$/,"")),t.map(function(e){var t=String(e).replace(/^\/+/,"");return n?"".concat(n,"/").concat(t):t})}function z(e,t){var n=Number(e);return Number.isFinite(n)?n:t}var B="",X=15e3,J=0,K="",W=function(){return o(function e(t){var n,r,a,o;i(this,e);var s=t||{};this.__debug=null!==(n=s.__debug)&&void 0!==n&&n,this.__rootPath=void 0,this.__define=s.define||(null===(r=window.__devfab_requirejs)||void 0===r?void 0:r.define),this.__require=s.require||(null===(a=window.__devfab_requirejs)||void 0===a?void 0:a.require),this.__undef=s.undef||("function"==typeof(null===(o=this.__require)||void 0===o?void 0:o.undef)?this.__require.undef:null),this.__requireConfig=s.requireConfig||this._pickRequireConfig(this.__require),this.__import=s.importer||null,this._setTimer=s.setTimeout||function(e,t){return setTimeout(e,t)},this._clearTimer=s.clearTimeout||function(e){return clearTimeout(e)},this.options={version:s.version?String(s.version):B,timeout:void 0===s.timeout?X:Math.max(0,z(s.timeout,0)),retry:void 0===s.retry?J:Math.max(0,z(s.retry,0)),strict:!!s.strict,baseUrl:s.baseUrl||K},this.policy=new N(s),this.guard=new V(this._guardOptions(s)),this.options.version&&this._applyUrlArgs()},[{key:"_pickRequireConfig",value:function(e){var t,n=e&&"function"==typeof e.config?e:null===(t=window.__devfab_requirejs)||void 0===t?void 0:t.require;return n&&"function"==typeof n.config?n.config.bind(n):null}},{key:"_guardOptions",value:function(e){return!1===e.pollution?{enabled:!1,target:e.target}:e.pollution&&"object"===m(e.pollution)?Object.assign({target:e.target},e.pollution):{target:e.target,watch:e.watch,maxPollution:e.maxPollution,enabled:void 0===e.pollution||!!e.pollution}}},{key:"configure",value:function(e){var t=e||{};return void 0!==t.debug&&(this.__debug=!!t.debug),void 0!==t.version&&this.setVersion(t.version),void 0!==t.timeout&&(this.options.timeout=Math.max(0,z(t.timeout,this.options.timeout))),void 0!==t.retry&&(this.options.retry=Math.max(0,z(t.retry,this.options.retry))),void 0!==t.strict&&(this.options.strict=!!t.strict),void 0!==t.baseUrl&&(this.options.baseUrl=t.baseUrl||""),void 0===t.manifest&&void 0===t.origins&&void 0===t.lockVersion&&void 0===t.verifyHash&&void 0===t.fetch||this.policy.configure(t),void 0!==t.pollution?this.guard.configure(this._guardOptions(t)):void 0===t.watch&&void 0===t.maxPollution&&void 0===t.target||this.guard.configure(t),this}},{key:"setVersion",value:function(e){return this.options.version=e?String(e):"",this._applyUrlArgs(),this}},{key:"_applyUrlArgs",value:function(){if("function"!=typeof this.__requireConfig)return!1;try{return this.__requireConfig({urlArgs:this.options.version?"v=".concat(encodeURIComponent(this.options.version)):""}),!0}catch(e){return!1}}},{key:"getVersion",value:function(){return this.options.version}},{key:"_snapshotConfig",value:function(){return{__debug:this.__debug,version:this.options.version,timeout:this.options.timeout,retry:this.options.retry,strict:this.options.strict,baseUrl:this.options.baseUrl,manifest:this.policy.manifest,origins:this.policy.origins,lockVersion:this.policy.lockVersion,verifyHash:this.policy.verifyHash,fetch:this.policy.fetch,pollution:this.guard.enabled,watch:this.guard.watch,maxPollution:this.guard.maxPollution,target:this.guard.target}}},{key:"describe",value:function(){return Object.assign({},this.options,{debug:this.__debug,policy:this.policy.describe(),pollutionGuard:this.guard.enabled,canUndef:"function"==typeof this.__undef,canNativeImport:"function"==typeof(this.__import||G)})}},{key:"_define",value:function(e,t,n){var r=F(e,t,n,{path:this.__rootPath,define:this.__define,type:"define"}),i=r.path,a=r.files,o=r.callback,s=r.result;404!==s.code?this.__define(i,a,o):null==o||o(s)}},{key:"_mergeWarnings",value:function(e,t){var n=(e||[]).slice();return(t||[]).forEach(function(e){n.some(function(t){return t.type===e.type&&t.key===e.key})||n.push(e)}),n}},{key:"_undefModules",value:function(e){var t=this;"function"==typeof this.__undef&&e.forEach(function(e){try{t.__undef(e)}catch(e){}})}},{key:"_load",value:function(e,t,n){var r=this,i=this.options,a=F(e,t,n,{path:this.__rootPath,require:this.__require,type:"require"}),o=a.path,s=a.files,u=a.callback,c=a.result,l=a.filesStr;if(404!==c.code){var f=L(o,s),d=this.policy.checkModules(f);if(d)return c.code=d.code,c.message=d.message,void(null==u||u(c));var h=!1,v=0,y=null,p=null,g=function(){p&&(c.warnings=r._mergeWarnings(c.warnings,p.end()),p=null)},_=function(){h||(h=!0,null!==y&&(r._clearTimer(y),y=null),g(),i.strict&&c.warnings.length&&(c.code=500,c.message="Global pollution detection failed:".concat(c.warnings.map(function(e){return"".concat(e.type,":").concat(e.key)}).join(", "))),null==u||u(c))},m=function(){v++,p=r.guard.begin(),i.timeout>0&&(y=r._setTimer(function(){if(!h){var e=new Error("load timeout after ".concat(i.timeout,"ms: ").concat(l));e.__devfabTimeout=!0,b(e,"files load timeout after ".concat(i.timeout,"ms, the files: ").concat(l))}},i.timeout)),r.__require(o,s,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];c.data=t,_()},function(e){b(e)})},b=function(e,t){if(!h){if(null!==y&&(r._clearTimer(y),y=null),v<=i.retry)return g(),r._undefModules(f),void m();c.code=e&&e.__devfabTimeout?504:500,c.message=t||"files load error, the files: ".concat(l),c.error=e,_()}};m()}else null==u||u(c)}},{key:"load",value:function(e,t,n){this._load(e,t,n)}},{key:"resolveUrl",value:function(e){var t=String(null==e?"":e);if(/^[a-z][a-z0-9+.-]*:/i.test(t)||/^\/\//.test(t))return t;var n=this.options.baseUrl||("undefined"!=typeof document&&document.baseURI?document.baseURI:"");if(!n)return t;try{return new URL(t,n).href}catch(e){return t}}},{key:"_importOne",value:function(e){var t=this,n=this.resolveUrl(e),r=this.policy.checkOrigin(n);if(r)return Promise.resolve({ok:!1,code:r.code,message:r.message});var i=this.policy.entryOf(e),a=i&&i.sha256,o=function(){var e=t.__import||G;return"function"!=typeof e?Promise.resolve({ok:!1,code:500,message:"native import() is unavailable(CSP 是否禁用了 unsafe-eval?)"}):Promise.resolve().then(function(){return e(n)}).then(function(e){return{ok:!0,module:e}},function(e){return{ok:!1,code:500,message:"module load error: ".concat(n),error:e}})};return a?this.policy.verify(n,a).then(function(e){return e.ok?o():{ok:!1,code:T,message:"".concat(e.message,"(").concat(n,")")}}):o()}},{key:"loadModules",value:function(e,t,n){var r=this,i=F(e,t,n,{path:this.__rootPath,type:"module"}),a=i.path,o=i.files,s=i.callback,u=i.result,c=i.filesStr,l=L(a,o),f=function(e){return null==s||s(e),e},d=this.policy.checkModules(l);if(d)return u.code=d.code,u.message=d.message,Promise.resolve(f(u));if(!o.length)return Promise.resolve(f(u));var h=this.guard.begin();return Promise.all(l.map(function(e){return r._importOne(e)})).then(function(e){u.warnings=h.end();var t=e.filter(function(e){return!e.ok});return t.length?(u.code=t[0].code||500,u.message="".concat(t.map(function(e){return e.message}).join("; "),"(the files: ").concat(c,")"),u.error=t[0].error):u.data=e.map(function(e){return e.module}),f(u)})}},{key:"loadModule",value:function(e,t){return this.loadModules([e],t)}}])}(),Q=function(){function e(){return i(this,e),r(this,e,arguments)}return c(e,W),o(e,[{key:"define",value:function(e,t,n){this._define(e,t,n)}},{key:"defineScript",value:function(e){this.provideScript(e)}},{key:"provideScript",value:function(e){var t=e;"function"!=typeof e&&(t=function(){return e}),this.define([],t)}},{key:"require",value:function(e,t,n){this._load(e,t,n)}},{key:"injectScript",value:function(e,t,n,r){var i=this,a=e,o=t,s=n,u=r;Array.isArray(e)&&"function"==typeof t&&(a=void 0,o=e,s=t,u=n),this._load(a,o,function(e){if(0==e.code&&Array.isArray(e.data))for(var t=0,n=e.data.length;t<n;t++){var r,a=e.data[t];null===(r=s)||void 0===r||r(a,t)}else"function"==typeof u?u(e):i.__debug&&console.error("[devfab][FileRequire][injectScript] error: ",e)})}},{key:"requireScript",value:function(e,t,n){this.injectScript(e,t,n)}}])}(),$=new Q;function Y(e,t,n,r,i){var a,o=t,s=n,u=r,c=i;Array.isArray(t)&&"function"==typeof n&&(o=void 0,s=t,u=n,c=r);var l=(null===(a=c)||void 0===a?void 0:a.viewModel)||this,f=(s=Array.isArray(s)?s:[]).join(",");return $.create({require:e}).require(o,s,function(e){var t;if(0==e.code&&Array.isArray(e.data))for(var n=0,r=e.data.length;n<r;n++){var i=e.data[n];if(i&&i.doAction)try{i.doAction("init",l)}catch(t){e.code=500,e.message="".concat(f," script execute error"),e.error=t;break}else try{var a;"function"==typeof(null===(a=c)||void 0===a?void 0:a.onFileBack)&&c.onFileBack(i,n)}catch(t){e.code=500,e.message="".concat(f," script customize execute error");break}}0!=e.code&&window.__devfab.debug&&console.info("[devfab][models][extend][loadScripts] ".concat(f," \n [message]: ").concat(e.message," \n").concat(e.error?" \n [error]: ":""),e.error),null===(t=u)||void 0===t||t(e)})}function Z(e){var t=this;window.__devfab&&window.__devfab.__debugger_initExtendJs;var n=e.requirejs,r=e.extendScriptParams,i=e.readyEventName,a=void 0===i?"extendReady":i,o=r||{},s=o.enableJs,u=void 0!==s&&s,c=o.filepath,l=o.scriptUrl;if(!u)return window.__devfab.debug&&console.info("[devfab][extend][js] not enable extend script"),void t.execute(a,t);if(!l)return window.__devfab.debug&&console.info("[devfab][extend][js] extend script is not defined"),void t.execute(a,t);var f=c,d=[l];t.getEnv&&t.getEnv("everyCommonExtend")&&d.push(t.getEnv("everyCommonExtend")),Y.call(t,null==n?void 0:n.require,f,d,function(e){t.execute(a,t,e)})}$.create=function(e){return new Q(d(d({},this._snapshotConfig()),e))};var ee=function(){var e=n(h().m(function e(t,r,i){var a,o,s,u,c,l,f,d,v,y,p;return h().w(function(e){for(;;)switch(e.n){case 0:if(window.__devfab&&window.__devfab.__debugger_initExtJs,s=i.requirejs,u=i.extendScriptParams,l=(c=u||{}).enableExtJs,f=void 0!==l&&l,d=c.exturlsField,v=void 0===d?"extscripturls":d,f){e.n=1;break}return window.__devfab.debug&&console.info("[devfab][extend][exturls] ext script is not enable"),e.a(2,Promise.resolve(!0));case 1:if(t){e.n=2;break}return window.__devfab.debug&&console.info("[devfab][extend][exturls] script data is null"),e.a(2,Promise.resolve(!0));case 2:if(y=null==t?void 0:t[v],p=Array.isArray(y)?y:[],p=(p=(r.getCache("localScripts")||[]).concat(p)).concat(window.__devfab__GLOBAL_EXT_SCRIPTS__||[]),null!==(a=r.getParams())&&void 0!==a&&a.selfExtUrls&&(p=p.concat([r.getParams().selfExtUrls])),null===(o=p)||void 0===o||!o.length){e.n=4;break}return p=g(new Set(p)),e.n=3,Promise.all(p.map(function(){var e=n(h().m(function e(t){return h().w(function(e){for(;;)if(0===e.n)return e.a(2,t)},e)}));return function(t){return e.apply(this,arguments)}}()));case 3:p=e.v;case 4:return t[v]=p,e.a(2,new Promise(function(e,t){Y.call(r,null==s?void 0:s.require,p,function(t){e(t)})}))}},e)}));return function(t,n,r){return e.apply(this,arguments)}}(),te=q,ne=C,re=I,ie=R;function ae(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.modelNameField,s=void 0===a?"cName":a,u=function(e){function t(){return i(this,t),r(this,t,arguments)}return c(t,e),o(t,[{key:"init",value:function(e,t){var n=this.createModels(e,t);this.setData(n),this.setDirty(!1)}},{key:"createModels",value:function(e,t){var r={};return(Array.isArray(e)?e:[]).forEach(function(e){var t,i,a=function(e,t){var n=(null==t?void 0:t.SimpleModel)||C,r=e.cControlType||e.component||e.controlType||e.ctrlType;return r=r.toLowerCase(),new n(e)}(e,n),o={model:a,meta:e,childModel:!0,modelName:e[s]};null==n||null===(t=n.onBeforeInitModel)||void 0===t||t.call(n,o),r[o.modelName]=o.model,null==n||null===(i=n.onAfterInitModel)||void 0===i||i.call(n,o)}),r}},{key:"initData",value:function(){Z.call(this,n)}}])}((null==n||null===(t=n.models)||void 0===t?void 0:t.ViewModel)||I);return u.prototype.modelType="ViewModel",u}exports.BaseModel=te,exports.GridModel=ie,exports.SimpleModel=ne,exports.ViewModel=re,exports.initViewModel=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=function(e,t){var n,r,i,a=new(ae(e,t)),o={model:a,meta:e};return null==t||null===(n=t.onBeforeInitModel)||void 0===n||n.call(t,o),o.model=a,null==a||null===(r=a.init)||void 0===r||r.call(a,e.models,e),null==t||null===(i=t.onAfterInitModel)||void 0===i||i.call(t,o),a}(e,t);return i.on("destroyVM",function(){var e,t;null===(e=i)||void 0===e||null===(t=e.destroyVM)||void 0===t||t.call(e),i=null,window.devfab.debug&&console.info("[devfab][models][initVM]: destory vm ".concat((new Date).toString()))}),i.on("extendReady",n(h().m(function n(){var a;return h().w(function(n){for(;;)switch(n.n){case 0:return(a=[]).push(ee(e,i,t)),n.n=1,Promise.all(a);case 1:window.devfab.debug&&console.info("[devfab][models][initVM]: after vm init ".concat((new Date).toString())),null==r||r(i,e);case 2:return n.a(2)}},n)}))),i.initData(),i},exports.loadScripts=Y;
|