devfab 1.1.0 → 1.5.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.
@@ -1 +1,3 @@
1
- function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);a<t;a++)n[a]=e[a];return n}function t(e,t,a){return t=o(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,u()?Reflect.construct(t,a||[],o(e).constructor):t.apply(e,a))}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,v(n.key),n)}}function i(e,t,a){return t&&n(e.prototype,t),a&&n(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(e,t,a){return(t=v(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function s(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&&h(e,t)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,n)}return a}function c(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?l(Object(a),!0).forEach(function(t){r(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function d(e,t){if(null==e)return{};var a,n,i=function(e,t){if(null==e)return{};var a={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;a[n]=e[n]}return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)a=r[n],-1===t.indexOf(a)&&{}.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function f(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,i,r,o,s=[],u=!0,l=!1;try{if(r=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;u=!1}else for(;!(u=(n=r.call(a)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,i=e}finally{try{if(!u&&null!=a.return&&(o=a.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}(e,t)||p(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)||p(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 v(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 y(e){return y="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},y(e)}function p(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 w=function(){return i(function e(t){a(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]}}])}(),m=function(){return i(function e(t){a(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 i=this.events.get(e),r=this.firstevents.get(e);if(!i&&!r)return!0;var o=!0;return[].concat(g(r||[]),g(i||[])).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),i=null==n?void 0:n.findIndex(function(e){return e.callback===t});-1!==i&&(null==n||n.splice(i,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,i=this,r=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||i,s);else try{a=n.callback.apply(n.context||i,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==r||r(s)):i._asyncExecute(e,l.slice(t+1),{resolve:r,reject:o,args:s})}})):(u=!1!==a&&u,t===l.length-1&&(u?null==r||r(s):null==o||o()))},h=0;h<l.length&&0!==(n=d(h));h++)if(n)return n.v;return u}},{key:"_asyncPromiseExecute",value:function(e,t,a,n){var i=this.events.get(e),r=this.firstevents.get(e);if(!((Array.isArray(i)?i.length:i)||(Array.isArray(r)?r.length:r)))return null==t?void 0:t();var o=[].concat(g(r||[]),g(i||[]));return this._asyncExecute(e,o,{resolve:t,reject:a,args:n})}},{key:"promiseExecute",value:function(e,t){var a=this,n=e,i=1;if("boolean"==typeof e&&(n=t,i=2),n){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];var u=2===i?o:[t].concat(o);if(u.length){var l,c=u.length-1,d=u[c];if("function"!=typeof d){if("object"!==y(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 h=this.execute.apply(this,u);if(h instanceof Promise){var f=this;h.then(function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];d.apply(f,t)},function(){l&&"function"==typeof l&&l()})}else if(!h)return void(l&&"function"==typeof l&&l())}}}},{key:"clearEvents",value:function(){this.events.clear(),this.firstevents.clear()}}])}();function S(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("&"),i=0,r=n.length;i<r;i++){var o=n[i]||"";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 k(e,t){if(!t)return e;var a=[],n=new S(e);for(var i in t)n.get(i)||a.push("".concat(i,"=").concat(t[i]));if(!a.length)return e;var r=a.join("&");return e.indexOf("?")>=0?"".concat(e,"&").concat(r):"".concat(e,"?").concat(r)}String.prototype.equalsIgnoreCase=function(e){return null!=e&&this.toLowerCase()===e.toLowerCase()};var x=["onBeforeRequest","_onAfterRequest"],R=["_onBeforeRequest","onAfterRequest"];var b={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t=e||{},a=t.onBeforeRequest;t._onAfterRequest;var n,i=d(t,x),r=i.method||"GET",o=i.url;try{null!=i&&i.requestHeaders&&(n=i.requestHeaders,i.requestHeaders=void 0,delete i.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options["requestHeaders"] ERR : ',e)}try{i.params&&i.params.requestHeaders&&(n=i.params.requestHeaders,i.params.requestHeaders=void 0,delete i.params.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var s=null;if(r.equalsIgnoreCase("get")||r.equalsIgnoreCase("delete")?o=k(o,i.params):(r.equalsIgnoreCase("post")||r.equalsIgnoreCase("put"))&&(s=JSON.stringify(i.params)),i.jsonp)return this.getJsonp(o,i.callback);var u=this.getXMLHttpRequest();if(u){var l;if(u.open(r,o,!1!==i.async),i.timeout&&(u.timeout=i.timeout,u.setRequestHeader("timeout",i.timeout),u.ontimeout=function(){b.onerror(this,i,"timeout")}),i.contentType){if(u.setRequestHeader("Content-Type",i.contentType),i.contentType.indexOf("x-www-form-urlencoded")>=0)s=null===(l=new URLSearchParams(i.params))||void 0===l?void 0:l.toString()}else i.dateType?s=i.params:u.setRequestHeader("Content-Type","application/json;charset=utf-8");i.domainKey&&u.setRequestHeader("Domain-Key",i.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==i||!i.hasOwnProperty("withCredentials")||i.withCredentials;try{u.send(s)}catch(e){return{error:"NetWorkError",options:i}}if(!1===i.async)return null==a||a(i),this.onreadystatechange(u,i);u.onreadystatechange=function(){b.onreadystatechange(this,i)},null==a||a(i)}},beforeReadystatechange:function(e,t,a){null==a||a()},onreadystatechange:function(e,t){var a=t||{};a._onBeforeRequest;var n=a.onAfterRequest,i=d(a,R);if(4===e.readyState){if(null==n||n(),200===e.status){var r;try{if("blob"===i.responseType){var o=function(e){var t=e.xhr.getAllResponseHeaders(),a={};return t.split("\r\n").map(function(e){var t=f(e.split(": "),2),n=t[0],i=t[1];a[n]=i}),a}({xhr:e});r={code:e.status,data:{data:e.response,headers:o}}}else r=JSON.parse(e.responseText)}catch(t){b.onerror(e,i,e.responseText)}if(!1===i.async)return e.isBusy=!1,i.precallback&&i.precallback(r),b.processAjaxResult(r,!1,null,null,i,e);b.processAjaxResult(r,i.async,i.callback,i.context,i,e),i.precallback&&i.precallback(r)}else if(0===e.status)b.onerror(e,i,"网络连接已断开,请检查设备网络状态后重试");else if(502===e.status||504===e.status)b.onerror(e,i,"服务出错了,请稍后再试");else{if(401!==e.status){var s={};try{s=JSON.parse(e.responseText)}catch(t){s={code:e.status,message:e.responseText}}return b.onerror(e,i,s)}b.onerror(e,i,"登录信息失效,请重新登录或联系技术人员")}e.isBusy=!1}},onerror:function(e,t,a){var n="[ajax]: [onerror]: 接口返回错误 \n [状态码]: ".concat(e.status," \n [错误信息]: ").concat(("object"===y(a)?JSON.stringify(a):a)||"空"," \n [请求地址]: ").concat(t.url," \n [浏览器Token]: ").concat(document.cookie);console.log("Error.E01000",n);var i="object"===y(a)?a:{code:500,message:a};t.precallback&&t.precallback(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 a=e,n="callback"+this._jsonps.index++,i=document.createElement("script");this._jsonps[n]=function(e){try{t(e)}finally{document.body.removeChild(i)}},a+=-1===a.indexOf("?")?"?":"&callback=cb.rest.AjaxRequestManager._jsonps."+n,i.src=a,document.body.appendChild(i)},processAjaxResult:function(e,t,a,n,i,r){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 C(e,t){this.init&&this.init(e),this.queryParams=t}C.create=function(e,t){return new C(e,t)},C.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)},C.prototype.Do=function(e,t,a,n,i){var r,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!==(r=u.options)&&void 0!==r&&r.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=k(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=i||d.context||this):d.params=t,a&&(d.callback=a,d.context=i||d.context||this),!1===n&&(d.async=!1),this.ajax(c,d)}},C.prototype.ajax=function(e,t){return function(e,t){return t.url=e,b.doRequest(t)}(e,t)};var I=function(){return i(function e(t){a(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 w,this._data.events=new m}},{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 w,events:new m}}},{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,i=this._get_data("components")||[];if(!i.length)return i;var r=[];if(a){var o=i.find(function(e){return e.ctrlName===a});o&&!this.notifyComponent(o,e,t)&&r.push(o)}else i.forEach(function(a){n.notifyComponent(a,e,t)||r.push(a)});return r.length?r: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 i="set".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),r=this.doPropertyChange(i,t,a);if(r){var o={};o[e]=t,r.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,i=this.getValue();if(e!==i){var r={value:e,oldValue:i},o=this._get_data("forceFireEvent");t||o?this.promiseExecute("beforeValueChange",r,[function(){n._set_data("value",e,!0),n._applyState("value",e,a),n.execute("afterValueChange",r)},function(){n._set_data("value",i,!0),n._applyState("value",i,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),i=1;i<a;i++)n[i-1]=arguments[i];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,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];(a=this._get_data("events")).promiseExecute.apply(a,[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").clear(e)}},{key:"setProxy",value:function(e){if(!(e instanceof C)){var t,a=this._get_data("__requestHeaders__");for(var n in e){var i,r,o;if(a&&(null===(i=e[n])||void 0===i||null===(i=i.options)||void 0===i||!i.requestHeaders))null!==(o=e[n])&&void 0!==o&&o.options||(e[n].options={}),e[n].options.requestHeaders=a;null!==(r=this.getProxy())&&void 0!==r&&r[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",C.create(c(c({},(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")}}])}(),P=function(){function e(){return a(this,e),t(this,e,arguments)}return s(e,I),i(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)}}])}(),D=function(){function e(n){return a(this,e),t(this,e,[n])}return s(e,I),i(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)}}])}(),E="",O="Insert",q="Update",j="Delete",M=Array.isArray,A=function(e){return null==e||""===e},F=function(e){return!e||0===Object.keys(e).length};function N(e){if(M(e))return e.map(N);if(e instanceof Date)return new Date(e.getTime());if(e&&"object"===y(e)){var t={};for(var a in e)t[a]=N(e[a]);return t}return e}function K(e){var t={};return(M(e)?e:Object.keys(e||{}).map(function(t){var a;return c(c({},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]=c(c({},e),{},{field:n,fieldName:e.fieldName||n,cCaption:e.cCaption||n,index:void 0===e.index?a:e.index})}}),t}function T(){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 i=e[a];null!=i&&""!==i?e[t]=String(i):(n+=1,e[t]="rowId_".concat(n))}}),this._set_data("rowIdSeq",n),e}var V=function(e,t,a,n,i,r,o){var s=this;this.promiseExecute("beforeBatchModifyPull",function(){var r=s.setProxy({queryData:e}),o={page:{pageSize:s.getPageSize(),pageIndex:s.getPageIndex()}};o.page.pageSize||(s.setPageSize(10),o.page.pageSize=10);var u=s._get_data("bLoadPagination");u||i||(o.page.totalCount=1);var l=s._get_data("delayLoadPageInfo");u&&l&&(n&&s.setState("showDelayPagination",!0),o.page.totalCount=1);var c=Object.assign(o,t);s.setCache("proxyCache",{proxyConfig:e,params:c});var d=0,h={},f=s.getRootParent(),g=s,v=(new Date).valueOf();c.queryId=v;if(!1!==f.execute("beforeQueryData",c)){g.setCache("lastGridFilterCondition",JSON.stringify(null==c?void 0:c.condition));var y=_.cloneDeep(c);if(r.queryData(y,function(e,t,r,o){var s,c;if(setTimeout(function(){g.clearCache("isGridInLoading")},0),null==f||f.clearCache("lazySearch"),e)return this.setState("showDelayPagination",!1),void this.clearCache("setPageIndexFromBack");t=t||{},this._set_data("dataSourceMode","remote"),n&&u&&l&&(d++,t=Object.assign(h,t));var v=Array.isArray(t.recordList)?t.recordList:[];if(u&&l&&2!==d||!a||a.call(this,t,r,o),this.getCache("setPageIndexFromBack"),this.clearCache("setPageIndexFromBack"),this.execute("beforeSetDataSource",v)){var y=this._get_data("rowKeyField"),_={};v.forEach(function(e){_[e[y]]=e}),this._set_data("keyMap",_),n||!1!==this._get_data("override")?(this._set_data("dataSource",v,!0),this.doPropertyChange("resetCellStatus"),this._set_data("cellState",{},!0),this._set_data("rowState",{},!0)):this._set_data("dataSource",this._get_data("dataSource").concat(v),!0),this.setCache("currentGridData",v),v.length&&T.call(this,v),this.initRowState(),setCachePaginationRowData.call(this,v),this._get_data("sortParams");var p=this._get_data("colFilterParams");this.showRows(null,!cb.utils.isEmptyObject(p));var w=this._get_data("pageInfo");u&&!l&&(this._get_data("bLoadPagination")||i)?(w={pageSize:t.pageSize,pageIndex:t.pageIndex,pageCount:t.pageCount,recordCount:t.recordCount},this.setPageInfo(w)):(w.pageIndex=t.pageIndex,w.from="showPageInner",this.setPageInfo(w)),resetSelected.call(this),"splitview"!==(null===(s=this.getParent)||void 0===s||null===(s=s.call(this))||void 0===s||null===(c=s.getParams)||void 0===c||null===(c=c.call(s))||void 0===c?void 0:c.templateType)&&this._set_data("focusedRowIndex",-1);for(var m=arguments.length,S=new Array(m>4?m-4:0),k=4;k<m;k++)S[k-4]=arguments[k];this.execute("afterSetDataSource",v,t.viewmodel,null==S?void 0:S[1])}},s),n&&u&&l){var p=JSON.parse(JSON.stringify(e));p.options||(p.options={}),p.options.mask=!1;H.call(s,p,c,function(e){!function(e){d++,Object.assign(h,e),2===d&&a&&a.call(s,h)}(e)})}}})};function H(e,t,a){this.setCache("queryPageCountLoading",!0);var n=this.setProxy({queryPageCount:c({},e)}),i=Object.assign(!0,t,{page:{totalCount:-1}});this.__queryPageCountRequestId||(this.__queryPageCountRequestId=0),this.__queryPageCountRequestId++;n.queryPageCount(i,function(e,t,n){if(this.__queryPageCountRequestId===e)if(this.setCache("queryPageCountLoading",!1),this.setState("showDelayPagination",!1),t){var i=this._get_data("pageInfo");i&&this.setPageInfo(i)}else{var r={beginPageIndex:(n=n||{}).beginPageIndex,endPageIndex:n.endPageIndex,pageSize:n.pageSize,pageIndex:n.pageIndex,pageCount:n.pageCount,recordCount:n.recordCount};a&&a.call(this,r),this.setPageInfo(r),this.execute("afterQueryPageInfo",n)}}.bind(this,this.__queryPageCountRequestId),this)}var B=function(){function e(){var n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var r=c(c({},{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}),i);M(r.dataSource)||(r.dataSource=[]),M(r.rows)||(r.rows=[]);var o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=c({},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}(i);r.proxyConfig=o,r.dataSourceMode=i.dataSourceMode||(o.load?"remote":"local");var s=i.cData||(M(i.data)?i.data:null);return(n=t(this,e,[r])).initPageInfo(i.cPage||i.page),n.initColumns(r.columns),n.initRowState(),n.afterInit(),s&&n.setDataSource(s),n}return s(e,I),i(e,[{key:"afterInit",value:function(){"single"===this._get_data("parentRelation")&&this._set_data("defaultSelectedRowIndexes",!0)}},{key:"initColumns",value:function(e){var t=K(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=c({},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",(M(t)?t:[]).map(function(t){return(null==t?void 0:t[e.getStatusFlag()])||E}),!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 c(c({},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?M(e)?e:[e]:Object.getOwnPropertyNames(t)).forEach(function(e){t[e]&&(a[e]=c(c({},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?c(c({},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",K(e))}},{key:"setColumnMode",value:function(e){this._set_data("columnMode","remote"===e?"remote":"local",!0)}},{key:"addColumns",value:function(e){var t=K(e);this._applyState("columns",c(c({},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,i=this.getRowKey(e);return i?((null===(n=this._get_data("cellState"))||void 0===n||null===(n=n[i])||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 c(c({},e),{},{cellName:e.cellName||e.columnName})}))}},{key:"setColumnValue",value:function(e,t,a){var n=this._get_data("columns")||{};n[e]&&this._applyState("columns",c(c({},n),{},r({},e,c(c({},n[e]),{},r({},t,a)))))}},{key:"load",value:function(e,t,a){this.setProxy({load:e}).load(t,function(e,t){e?cb.utils.alert(e,"error"):(t.schema&&(this._set_data("columnMode","remote"),this.setColumns(t.schema)),this.setDataSource(t.data),a&&a.call(this))},this)}},{key:"refresh",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.hasEvent("refresh")?this.execute("refresh",e):this.fetch({body:e})}},{key:"loadData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.refresh(e)}},{key:"queryData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.refresh(e)}},{key:"getDataSource",value:function(){var e=this._get_data("dataSource")||[];if(!this.hasDeletedRow())return e;var t=this._get_data("rowsDataState")||[];return e.filter(function(e,a){return t[a]!==j})}},{key:"getRealData",value:function(){return this.getDataSource()}},{key:"getRealRows",value:function(){return this._get_data("rows")||[]}},{key:"getRowsCount",value:function(){return(this._get_data("rows")||[]).length}},{key:"getDataSourceCount",value:function(){return(this._get_data("dataSource")||[]).length}},{key:"hasDeletedRow",value:function(){return(this._get_data("rowsDataState")||[]).some(function(e){return e===j})}},{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]!==j}),!1)}},{key:"getRows",value:function(e){var t=this._get_data("rows")||[];return!1===e?t:t.map(function(e){return N(e)})}},{key:"collectRows",value:function(e,t){var a=this._get_data("columns")||{},n=this.getStatusFlag(),i=this.getSelectedFlag();return(e||[]).map(function(e){var r={};for(var o in e){var s;t&&o===n||(t||o!==i)&&!1!==(null===(s=a[o])||void 0===s?void 0:s.needCollect)&&(r[o]=e[o])}return r})}},{key:"getShowRows",value:function(e){return(e||this._get_data("rows")||[]).map(function(e){return c({},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:N(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():M(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(M(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 i=n[t];if(i!==a){var r={rowIndex:e,rowId:n[this.getIdFlag()],cellName:t,value:a,oldValue:i};this.execute("beforeCellValueChange",r)&&(n[t]=r.value,this.markRowState(e,q),this.execute("afterCellValueChange",r),this.doPropertyChange("setCellValue",r))}}}},{key:"setCellValues",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];M(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,i=this.getRowKey(e),r=i?null===(n=this._get_data("cellState"))||void 0===n||null===(n=n[i])||void 0===n?void 0:n[t]:null;if(r)return r[a]}},{key:"setCellState",value:function(e,t,a,n){var i,o=null===(i=this._get_data("rows"))||void 0===i||null===(i=i[e])||void 0===i?void 0:i[this.getIdFlag()],s=o||e;if(!A(s)){var u=this.getCellState(e,t,a);if(u!==n){var l={rowIndex:e,rowId:o,cellName:t,propertyName:a,value:n,oldValue:u};if(this.execute("beforeCellStateChange",l)){var d=c({},this._get_data("cellState")||{});d[s]=c({},d[s]||{}),d[s][t]=c(c({},d[s][t]||{}),{},r({},a,n)),this._applyState("cellState",d),this.execute("afterCellStateChange",l)}}}}},{key:"setCellStates",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];M(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")||[],i=n.indexOf(a);return i>-1?i: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=g(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!==O&&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,q)}},{key:"getRowState",value:function(e,t){var a,n=this.getRowKey(e),i=n?null===(a=this._get_data("rowState"))||void 0===a?void 0:a[n]:null;if(i&&t)return i[t]}},{key:"setRowState",value:function(e,t,a){var n,i=null===(n=this._get_data("rows"))||void 0===n?void 0:n[e];if(i&&t){var o=this.getRowKey(e),s=this.getRowState(e,t);if(s!==a){var u={rowIndex:e,rowId:i[this.getIdFlag()],propertyName:t,value:a,oldValue:s};if(this.execute("beforeRowStateChange",u)){var l=c({},this._get_data("rowState")||{});l[o]=c(c({},l[o]||{}),{},r({},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]:[];M(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")||[],i=[];return a.forEach(function(e,a){var r=n[a];if(r){var o=N(e);o[t.getStatusFlag()]=r,i.push(o)}}),i.length?i: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:N(this._get_data("dataSource")||[]),rowsDataState:g(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",g(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")||[],i=Math.min(n.length,Math.max(0,void 0===e?n.length:e)),r={index:i,row:c({},t),isCopy:a};if(this.execute("beforeInsertRow",r)){var o=r.row;delete o[this.getIdFlag()],T.call(this,[o]);var s=this._get_data("dataSource")||[],u=i<n.length?this.getDataSourceIndexByRow(i):s.length;s.splice(u<0?s.length:u,0,o);var l=g(this._get_data("rowsDataState")||[]);return l.splice(u<0?l.length:u,0,O),n.splice(i,0,o),this._set_data("rowsDataState",l,!0),this.setRows(n),this.execute("afterInsertRow",c(c({},r),{},{rowIndex:i})),o}}},{key:"insertRows",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[];return(M(a)?a:[a]).forEach(function(a,i){n.push(t.insertRow(e+i,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,q),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=(M(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 i=this._get_data("dataSource")||[],r=g(this._get_data("rowsDataState")||[]),o=new Set,s=new Set;n.forEach(function(e){var a=i.indexOf(e);if(!(a<0)){var n=e[t.getIdFlag()];o.add(n),r[a]===O&&s.add(n)}});var u=[],l=[];i.forEach(function(e,a){var n=e[t.getIdFlag()];if(!o.has(n))return u.push(e),void l.push(r[a]);s.has(n)||(u.push(e),l.push(j))}),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(c(c({},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}):M(e)?e:[e];n=n.filter(function(e){return e>=0&&e<a.getRowsCount()});var i=this._get_data("rows")||[],r=this.getSelectedFlag(),o=n.filter(function(e){return!i[e][r]});if(o.length){var s={rowIndexes:o,rows:o.map(function(e){return i[e]})};this.execute("beforeSelect",s)&&(o.forEach(function(e){i[e][r]=!0,a.cacheSelectedRow(i[e],!0)}),this.flushSelection())}else!0===t&&this.flushSelection()}}},{key:"unselect",value:function(e){var t=this;if(null!=e){var a=M(e)?e:[e],n=this._get_data("rows")||[],i=this.getSelectedFlag(),r=a.filter(function(e){var t;return null===(t=n[e])||void 0===t?void 0:t[i]});r.length&&this.execute("beforeUnselect",r)&&(r.forEach(function(e){n[e][i]=!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=M(t)?t:[],n=this.getRowKeyField(),i=new Set(a.map(function(e){var t;return String(null!==(t=null==e?void 0:e[n])&&void 0!==t?t:e)})),r=this._get_data("rows")||[],o=this.getSelectedFlag();r.forEach(function(t){var a=i.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(M(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=M(e)?e:[e],i=this._get_data("rows")||[],r=[];n.forEach(function(e){var t=i.findIndex(function(t){return String(t[a])===String(e)});t>-1&&r.push(t)}),r.length&&(t?this.select(r):this.unselect(r))}},{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}),i=c({},this._get_data("selectedRowsMap")||{});t&&n.push(a),t?i[a]=e:delete i[a],this._set_data("selectedKeys",n,!0),this._set_data("selectedRowsMap",i,!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(c(c({},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(c(c({},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(c(c({},this.getPageInfo()),{},{pageSize:Math.max(-1,e),pageIndex:1}),{refresh:t})}},{key:"setRecordCount",value:function(e){this.applyPageInfo(c(c({},this.getPageInfo()),{},{recordCount:e||0}))}},{key:"applyPageInfo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=c({},e||{}),n=-1===a.pageSize?-1:a.pageSize||20,i=a.recordCount||0,r=i>0;return a.pageSize=n,a.recordCount=i,a.pageCount=n>0?Math.max(1,Math.ceil(i/n)):1,a.pageIndex=n>0?Math.max(1,r?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,i):i,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,i=(a-1)*n;this.setRows(e.slice(i,i+n))}else this.setRows(e)}},{key:"setDataSource",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;if("local"===this._get_data("dataSourceMode")){var n=cb.utils.isArray(e)?e:[];if(!this.execute("beforeSetDataSource",n))return;var i=this._get_data("rowKeyField"),r={};n.forEach(function(e){r[e[i]]=e}),this._set_data("keyMap",r),this._set_data("dataSource",n,!0),this.getCache("grandson"),n.length&&T.call(this,n),this.initRowState(),setCachePaginationRowData.call(this,n),this.doPropertyChange("resetCellStatus"),this._set_data("rowState",{},!0),this.doPropertyChange("setDataSource",this.getShowRows()),this._set_data("delayInsertRows",[]),this._get_data("isSorting")&&this._set_data("isSorting",!1),this.execute("afterSetDataSource",n)}else{if(!this.execute("beforeProxyLoad",t))return;this._get_data("pageInfo").pageIndex=1;this._set_data("proxyConfig",e),this._set_data("queryParams",t),this._set_data("callback",a),V.call(this,e,t,a,!0,!0)}}},{key:"setRows",value:function(e){var t=M(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")||{},i=t?this.getRowsByIndexes(t):this.getRows(),r=[];i.forEach(function(e,t){for(var i in n){var o=n[i];if(a.isRequiredColumn(o)){var s=e[i];if(A(s)||M(s)&&!s.length||F(s)){var u=o.cShowCaption||o.cCaption||o.cCaption||o.title||i;r.push({rowIndex:t,rowId:e[a.getIdFlag()],cellName:i,message:"".concat(u,"不能为空")}),a.setCellState(t,i,"msg","不能为空")}}}}),this._set_data("validateErrors",r);var o=r.length?r[0].message:"";return this.doPropertyChange("validate",{type:r.length?"error":"",message:o,errors:r}),this.execute("afterValidate",{valid:!r.length,errors:r}),!r.length}}])}(),z=function(){function e(){return a(this,e),t(this,e,arguments)}return s(e,I),i(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 I&&(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,i=e.get(t);i instanceof I&&!1!==i._get_data("needCollect")&&(a[t]=null===(n=i.getData)||void 0===n?void 0:n.call(i))}),a}},{key:"getAllData",value:function(e){var t=this,a=this._get_data("propertyNames")||[],n={};return a.forEach(function(a){var i,r=t.get(a);if(r instanceof I&&!1!==r._get_data("needCollect")&&(!e||!r._get_data("isGrid"))){var o=null===(i=r.getData)||void 0===i?void 0:i.call(r);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,i=t.get(a);i instanceof I&&!1!==i._get_data("needClear")&&(null===(n=i.clear)||void 0===n||n.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 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 i=this._get_data("propertyNames"),r=0,o=i.length;r<o;r++){if((a=this.get(i[r]))instanceof B)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 i=this.get(e[a]);i instanceof B&&t.push(i)}return t}}])}();function L(e,n){var r,o=null===(r=window.__devfab)||void 0===r?void 0:r.require,u=n||{},l=u.domainKeyField,c=void 0===l?"domainKey":l,d=u.billNoField,h=void 0===d?"billNo":d,f=u.modelNameField,g=void 0===f?"modelName":f,v=u.enableExtendjs,y=void 0===v||v;null!=n&&n.require&&(o=null==n?void 0:n.require);var _=e[c]||"",p=e[h],w=function(){function e(){return a(this,e),t(this,e,arguments)}return s(e,z),i(e,[{key:"init",value:function(e,t){var a=this.createModels(e,t);this.setData(a),this.setDirty(!1)}},{key:"createModels",value:function(e,t){var a={};return(Array.isArray(e)?e:[]).forEach(function(e){var i,r,o=null==n||null===(i=n.createModelFactory)||void 0===i?void 0:i.call(n,e);o||(o=function(e){var t;"input"===e.cControlType.toLowerCase()&&(t=new D(e));return t}(e));var s={model:o,field:e,meta:t};null==n||null===(r=n.onBeforeCreateModel)||void 0===r||r.call(n,s),a[e[g]]=s.model}),a}},{key:"initData",value:function(){this.initExtendJs()}},{key:"initExtendJs",value:function(){window&&window.__debugger_initExtendJs;var e=this;if(y){var t="".concat(p,"_VM.Extend.js"),a=[t];if("function"!=typeof o)return console.warn("requirejs.js 未加载,跳过扩展脚本:".concat(t)),void e.execute("extendReady",e);o(_,a,function(a,n){if(a&&a.doAction)try{a.doAction("init",e),n&&n.doAction("init",e)}catch(e){console.error("扩展脚本异常:",e)}else console.error("".concat(t,"扩展文件extend.*.min.js文件加载失败 或 未注册扩展脚本"));e.execute("extendReady",e)},function(a){console.warn("未找到扩展脚本:".concat(t,"错误信息:"),a),e.execute("extendReady",e)})}else e.execute("extendReady",e)}}])}();return w.prototype.modelType="ViewModel",w}function U(e,t){var a=new(L(e,t));return a.init(e.models,e),a}var J={BaseModel:I,FilterModel:P,SimpleModel:D,GridModel:B,ViewModel:z,createViewModel:L,initViewModel:U};export{I as BaseModel,P as FilterModel,B as GridModel,D as SimpleModel,z as ViewModel,L as createViewModel,J as default,U as initViewModel};
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,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,a)}function n(e){return function(){var n=this,r=arguments;return new Promise(function(a,o){var i=e.apply(n,r);function s(e){t(i,a,o,s,u,"next",e)}function u(e){t(i,a,o,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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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,b(r.key),r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,n){return(t=b(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&&p(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 v(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function h(){
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,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var u=r&&r.prototype instanceof s?r:s,c=Object.create(u.prototype);return y(c,"_invoke",function(n,r,a){var o,s,u,c=0,l=a||[],f=!1,d={p:0,n:0,v:e,a:v,f:v.bind(e,4),d:function(t,n){return o=t,s=0,u=e,d.n=n,i}};function v(n,r){for(s=n,u=r,t=0;!f&&c&&!a&&t<l.length;t++){var a,o=l[t],v=d.p,h=o[2];n>3?(a=h===r)&&(u=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=v&&((a=n<2&&v<o[1])?(s=0,d.v=r,d.n=o[1]):v<h&&(a=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,d.n=h,s=0))}if(a||n>1)return i;throw f=!0,r}return function(a,l,h){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&v(l,h),s=l,u=h;(t=s<2?e:u)||!f;){o||(s?s<3?(s>1&&(d.n=-1),v(s,u)):d.n=u:d.v=u);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,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=o.return)&&t.call(o),s<2&&(u=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==i)break}catch(t){o=e,s=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,a,o),!0),c}var i={};function s(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(y(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,y(e,a,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,y(f,"constructor",c),y(c,"constructor",u),u.displayName="GeneratorFunction",y(c,a,"GeneratorFunction"),y(f),y(f,a,"Generator"),y(f,r,function(){return this}),y(f,"toString",function(){return"[object Generator]"}),(h=function(){return{w:o,m:d}})()}function y(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}y=function(e,t,n,r){function o(t,n){y(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},y(e,t,n,r)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function g(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,a,o,i,s=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}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 m(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 b(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 w(e){return w="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},w(e)}function k(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 x=function(){return i(function e(t){a(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:"clear",value:function(e){delete this._data[e]}}])}(),S=function(){return i(function e(t){a(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 a=this._events.get(e),o=this._firstevents.get(e);if(!a&&!o)return!0;var i=!0;return[].concat(m(o||[]),m(a||[])).forEach(function(e){if(!1!==i){var t=e.callback.apply(e.context||void 0,n);i=!1!==t&&i}}),i}},{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),a=null==r?void 0:r.findIndex(function(e){return e.callback===t});-1!==a&&(null==r||r.splice(a,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,a=this,o=n.resolve,i=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||a,s);else try{n=r.callback.apply(r.context||a,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==i||i())},resolve:function(n){t===c.length-1?(s.length>1&&(s[0]=n),null==o||o(s)):a._asyncExecute(e,c.slice(t+1),{resolve:o,reject:i,args:s})}})):(u=!1!==n&&u,t===c.length-1&&(u?null==o||o(s):null==i||i()))},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 a=this._events.get(e),o=this._firstevents.get(e);if(!((Array.isArray(a)?a.length:a)||(Array.isArray(o)?o.length:o)))return null==t?void 0:t();var i=[].concat(m(o||[]),m(a||[]));return this._asyncExecute(e,i,{resolve:t,reject:n,args:r})}},{key:"promiseExecute",value:function(e,t){var n=this,r=e,a=1;if("boolean"==typeof e&&(r=t,a=2),r){for(var o=arguments.length,i=new Array(o>2?o-2:0),s=2;s<o;s++)i[s-2]=arguments[s];var u=2===a?i:[t].concat(i);if(u.length){var c,l=u.length-1,f=u[l];if("function"!=typeof f){if("object"!==w(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 v=this;d.then(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];f.apply(v,t)},function(){c&&"function"==typeof c&&c()})}else if(!d)return void(c&&"function"==typeof c&&c())}}}},{key:"clearEvents",value:function(){this._events.clear(),this._firstevents.clear()}}])}();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("&"),a=0,o=r.length;a<o;a++){var i=r[a]||"";if(i){var s=i.indexOf("="),u="",c="";s<0?c=u=window.decode(i):(u=window.decode(i.substr(0,s)),c=window.decode(i.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 j(e,t){if(!t)return e;var n=[],r=new P(e);for(var a in t)r.get(a)||n.push("".concat(a,"=").concat(t[a]));if(!n.length)return e;var o=n.join("&");return e.indexOf("?")>=0?"".concat(e,"&").concat(o):"".concat(e,"?").concat(o)}String.prototype.equalsIgnoreCase=function(e){return null!=e&&this.toLowerCase()===e.toLowerCase()};var C=["onBeforeRequest","_onAfterRequest"],O=["_onBeforeRequest","onAfterRequest"];var A={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t=e||{},n=t.onBeforeRequest;t._onAfterRequest;var r,a=v(t,C),o=a.method||"GET",i=a.url;try{null!=a&&a.requestHeaders&&(r=a.requestHeaders,a.requestHeaders=void 0,delete a.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options["requestHeaders"] ERR : ',e)}try{a.params&&a.params.requestHeaders&&(r=a.params.requestHeaders,a.params.requestHeaders=void 0,delete a.params.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var s=null;if(o.equalsIgnoreCase("get")||o.equalsIgnoreCase("delete")?i=j(i,a.params):(o.equalsIgnoreCase("post")||o.equalsIgnoreCase("put"))&&(s=JSON.stringify(a.params)),a.jsonp)return this.getJsonp(i,a.callback);var u=this.getXMLHttpRequest();if(u){var c;if(u.open(o,i,!1!==a.async),a.timeout&&(u.timeout=a.timeout,u.setRequestHeader("timeout",a.timeout),u.ontimeout=function(){A.onerror(this,a,"timeout")}),a.contentType){if(u.setRequestHeader("Content-Type",a.contentType),a.contentType.indexOf("x-www-form-urlencoded")>=0)s=null===(c=new URLSearchParams(a.params))||void 0===c?void 0:c.toString()}else a.dateType?s=a.params:u.setRequestHeader("Content-Type","application/json;charset=utf-8");a.domainKey&&u.setRequestHeader("Domain-Key",a.domainKey);try{if(r&&"[object Object]"===Object.prototype.toString.call(r))for(var l in r)u.setRequestHeader(l,r[l])}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}u.withCredentials=null==a||!a.hasOwnProperty("withCredentials")||a.withCredentials;try{u.send(s)}catch(e){return{error:"NetWorkError",options:a}}if(!1===a.async)return null==n||n(a),this.onreadystatechange(u,a);u.onreadystatechange=function(){A.onreadystatechange(this,a)},null==n||n(a)}},beforeReadystatechange:function(e,t,n){null==n||n()},onreadystatechange:function(e,t){var n=t||{};n._onBeforeRequest;var r=n.onAfterRequest,a=v(n,O);if(4===e.readyState){if(null==r||r(),200===e.status){var o;try{if("blob"===a.responseType){var i=function(e){var t=e.xhr.getAllResponseHeaders(),n={};return t.split("\r\n").map(function(e){var t=g(e.split(": "),2),r=t[0],a=t[1];n[r]=a}),n}({xhr:e});o={code:e.status,data:{data:e.response,headers:i}}}else o=JSON.parse(e.responseText)}catch(t){A.onerror(e,a,e.responseText)}if(!1===a.async)return e.isBusy=!1,a.precallback&&a.precallback(o),A.processAjaxResult(o,!1,null,null,a,e);A.processAjaxResult(o,a.async,a.callback,a.context,a,e),a.precallback&&a.precallback(o)}else if(0===e.status)A.onerror(e,a,"网络连接已断开,请检查设备网络状态后重试");else if(502===e.status||504===e.status)A.onerror(e,a,"服务出错了,请稍后再试");else{if(401!==e.status){var s={};try{s=JSON.parse(e.responseText)}catch(t){s={code:e.status,message:e.responseText}}return A.onerror(e,a,s)}A.onerror(e,a,"登录信息失效,请重新登录或联系技术人员")}e.isBusy=!1}},onerror:function(e,t,n){var r="[ajax]: [onerror]: 接口返回错误 \n [状态码]: ".concat(e.status," \n [错误信息]: ").concat(("object"===w(n)?JSON.stringify(n):n)||"空"," \n [请求地址]: ").concat(t.url," \n [浏览器Token]: ").concat(document.cookie);console.log("Error.E01000",r);var a="object"===w(n)?n:{code:500,message:n};t.precallback&&t.precallback(a)},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++,a=document.createElement("script");this._jsonps[r]=function(e){try{t(e)}finally{document.body.removeChild(a)}},n+=-1===n.indexOf("?")?"?":"&callback=cb.rest.AjaxRequestManager._jsonps."+r,a.src=n,document.body.appendChild(a)},processAjaxResult:function(e,t,n,r,a,o){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 E(e,t){this.init&&this.init(e),this.queryParams=t}E.create=function(e,t){return new E(e,t)},E.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)},E.prototype.Do=function(e,t,n,r,a){var o,i,s;if(this.config&&this.config[e]&&this.config[e].url){var u=this.config[e],c=u.url;this.queryParams||(this.queryParams={}),null!==(o=u.options)&&void 0!==o&&o.proxyServiceCode&&(this.queryParams.serviceCode=u.options.proxyServiceCode),null!==(i=u.options)&&void 0!==i&&i.billnum&&(this.queryParams.billnum=u.options.billnum),null!==(s=this.queryParams)&&void 0!==s&&s.serviceCode&&(c=j(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=a||f.context||this):f.params=t,n&&(f.callback=n,f.context=a||f.context||this),!1===r&&(f.async=!1),this.ajax(l,f)}},E.prototype.ajax=function(e,t){return function(e,t){return t.url=e,A.doRequest(t)}(e,t)};var q=function(){return i(function e(t){a(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 x,this._data.events=new S}},{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 S}}},{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,a=this._get_data("components")||[];if(!a.length)return a;var o=[];if(n){var i=a.find(function(e){return e.ctrlName===n});i&&!this.notifyComponent(i,e,t)&&o.push(i)}else a.forEach(function(n){r.notifyComponent(n,e,t)||o.push(n)});return o.length?o: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 a="set".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),o=this.doPropertyChange(a,t,n);if(o){var i={};i[e]=t,o.forEach(function(e){r.notifyComponent(e,"setState",i)})}}},{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,a=this.getValue();if(e!==a){var o={value:e,oldValue:a},i=this._get_data("forceFireEvent");t||i?this.promiseExecute("beforeValueChange",o,[function(){r._set_data("value",e,!0),r._applyState("value",e,n),r.execute("afterValueChange",o)},function(){r._set_data("value",a,!0),r._applyState("value",a,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),a=1;a<n;a++)r[a-1]=arguments[a];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,a=new Array(r>2?r-2:0),o=2;o<r;o++)a[o-2]=arguments[o];(n=this._get_data("events")).promiseExecute.apply(n,[e,t].concat(a))}},{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 E)){var t,n=this._get_data("__requestHeaders__");for(var r in e){var a,o,i;if(n&&(null===(a=e[r])||void 0===a||null===(a=a.options)||void 0===a||!a.requestHeaders))null!==(i=e[r])&&void 0!==i&&i.options||(e[r].options={}),e[r].options.requestHeaders=n;null!==(o=this.getProxy())&&void 0!==o&&o[r]&&console.warn("[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",E.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")}}])}(),D=function(){function e(){var t;a(this,e);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return s(t=r(this,e,[].concat(o)),"modelType","SimpleModel"),t}return c(e,q),i(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)}}])}(),M=Array.isArray;function R(e,t,n){var r=this;this.promiseExecute("beforeQuery",{proxyConfig:e,queryParams:t},function(){var a=r,o=r.setProxy({queryData:e}),i=r._get_data("innerUsedAttrs").pageIndex,u={page:s(s({},r._get_data("innerUsedAttrs").pageSize,r.getPageSize()),i,r.getPageIndex())},c=Object.assign(t,u);r.setCache("proxyCache",{proxyConfig:e,params:c,callback:n}),r.getRootParent();if(!1!==r.execute("beforeQueryData",c)){var l=_.cloneDeep(c);o.queryData(l,function(e,t,r,a){if(!e){this._set_data("dataSourceMode","remote");var o=function(e){if(!e)return[];if(M(e))return e;if(M(e.data))return e.data;if(M(e.records))return e.records;if(M(e.list))return e.list;if(M(e.rows))return e.rows;var t=e.data&&"object"===w(e.data)?e.data:e.result;return M(t)?t:t&&"object"===w(t)&&(t.records||t.list||t.rows||t.data)||[]}(t=Object.assign({},t));this.execute("afterQueryData",t),null==n||n.call(this,o)}},a)}})}function I(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 T=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var o,i=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({},(o={id:"_id",selected:"_selected",status:"_status",pageIndex:"pageNo",pageSize:"pageSize",pageCount:"total"}).pageIndex,1),o.pageSize,20),o.pageCount,0),innerUsedAttrs:o,multiRowModel:!1,editRowModels:{},loading:!1,params:{},originalKeyMap:{},defaultRowDatas:new Map}),n);M(i.dataSource)||(i.dataSource=[]),M(i.rows)||(i.rows=[]);var u=function(){return d({},(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).proxyConfig||{})}(n);return i.proxyConfig=u,i.dataSourceMode=n.dataSourceMode||i.dataSourceMode,s(t=r(this,e,[i]),"modelType","GridModel"),t.initColumns(i.columns),t.initPageInfo(n.cPage||n.page),t.afterInit(),t}return c(e,q),i(e,[{key:"afterInit",value:function(){this.execute("afterInit")}},{key:"initColumns",value:function(e){var t=function(e){var t={};return(M(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")||"id"}},{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(){return this._get_data("innerUsedAttrs")}},{key:"get",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")){I(cb.utils.isArray(e)?e:[])}else{if(!this.execute("beforeProxyLoad",n))return;this.setPageIndex(1),R.call(this,e,n,function(e){I.call(t,e),null==r||r.call(t)})}}},{key:"reload",value:function(){var e=this,t=this.getCache("proxyCache");if(t){var n=t.proxyConfig,r=t.params,a=t.callback;R.call(this,n,r,function(t){null==a||a.call(e,t)})}else console.log("[GridModel] proxyConfig is null")}},{key:"getDataSource",value:function(){return this._get_data("dataSource")||[]}},{key:"getData",value:function(e,t){return e||t?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")||createDefaults().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.reload()}},{key:"setPageIndex",value:function(e){if("number"==typeof e){var t=this._get_data("innerUsedAttrs").pageIndex;this._get_data("innerUsedAttrs").pageSize,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}}])}(),N=function(){function e(){var t;a(this,e);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return s(t=r(this,e,[].concat(o)),"modelType","ViewModel"),t}return c(e,q),i(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,a=e.get(t);a instanceof q&&!1!==a._get_data("needCollect")&&(n[t]=null===(r=a.getData)||void 0===r?void 0:r.call(a))}),n}},{key:"getAllData",value:function(e){var t=this,n=this._get_data("propertyNames")||[],r={};return n.forEach(function(n){var a,o=t.get(n);if(o instanceof q&&!1!==o._get_data("needCollect")&&(!e||!o._get_data("isGrid"))){var i=null===(a=o.getData)||void 0===a?void 0:a.call(o);void 0!==i&&(r[n]=i)}}),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,a=t.get(n);a instanceof q&&!1!==a._get_data("needClear")&&(null===(r=a.clear)||void 0===r||r.call(a,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 a=this._get_data("propertyNames"),o=0,i=a.length;o<i;o++){if((n=this.get(a[o]))instanceof T||"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 a=this.get(e[n]);(a instanceof T||"GridModel"==a.modelType)&&t.push(a)}return t}},{key:"getGridFilterModel",value:function(e){return this.getGridModel(e).getCache("FilterViewModel")}}])}();function U(e,t,n,r,a){var o,i=t,s=n,u=r,c=a;Array.isArray(t)&&"function"==typeof n&&(i=void 0,s=t,u=n,c=r);var l,f,d=(null===(o=c)||void 0===o?void 0:o.vm)||this,v={code:0,message:""},h=(s=Array.isArray(s)?s:[]).join(",");return"function"!=typeof e?(v.code=-1,v.message="requirejs.js 未加载,跳过扩展脚本:".concat(h),void(null===(l=u)||void 0===l||l(v))):s.length?void e(i,s,function(){for(var e,t=0,n=arguments.length;t<n;t++){var r=t<0||arguments.length<=t?void 0:arguments[t];if(!r||!r.doAction){v.code=-3,v.message="".concat(h,"文件加载失败 或 未注册拓展脚本");break}try{r.doAction("init",d)}catch(e){v.code=-2,v.message="".concat(h,"拓展脚本异常"),v.error=e;break}}null===(e=u)||void 0===e||e(v)},function(e){var t;v.code=-4,v.message="未找到扩展脚本:".concat(h),v.error=e,null===(t=u)||void 0===t||t(v)}):(v.code=404,v.message="扩展脚本为空",void(null===(f=u)||void 0===f||f(v)))}function H(e){var t=this;window.devfab&&window.devfab.__debugger_initExtendJs;var n=e.requirejs,r=e.extendScriptParams||{},a=r.enableJs,o=void 0===a||a,i=r.filepath,s=r.scriptUrl;if(!o)return window.devfab.debug&&console.info("[devfab][extendjs] 未启用扩展脚本"),void t.execute("extendReady",t);if(!s)return window.devfab.debug&&console.info("[devfab][extendjs] 扩展脚本未定义"),void t.execute("extendReady",t);var u=i,c=[s];t.getEnv&&t.getEnv("everyCommonExtend")&&c.push(t.getEnv("everyCommonExtend")),U.call(t,n.require,u,c,function(e){0!=(null==e?void 0:e.code)&&window.devfab.debug&&(e.error?console.error("[devfab][extendjs] ".concat(e.message," 错误信息:"),e.error):console.warn("[devfab][extendjs] ".concat(e.message))),t.execute("extendReady",t)})}var V=function(){var e=n(h().m(function e(t,r,a){var o,i,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=a.requirejs,u=a.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][exturls] 未启用客开扩展脚本"),e.a(2,Promise.resolve(!0));case 1:if(t){e.n=2;break}return window.devfab.debug&&console.info("[devfab][exturls] 元数据不能为空"),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("localDynamicScripts")||[]).concat(p)).concat(window.__devfab__EXT_BILL_SCRIPTS__||[]),null!==(o=r.getParams())&&void 0!==o&&o.initVMExtUrls&&(p=p.concat([r.getParams().initVMExtUrls])),null===(i=p)||void 0===i||!i.length){e.n=4;break}return p=m(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){U.call(r,s.require,p,function(t){0!=(null==t?void 0:t.code)&&window.devfab.debug&&(t.error?console.error("[devfab][extjs] ".concat(t.message," 错误信息:"),t.error):console.warn("[devfab][extjs] ".concat(t.message))),e(!0)})}))}},e)}));return function(t,n,r){return e.apply(this,arguments)}}();function G(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.modelNameField,s=void 0===o?"cName":o,u=function(e){function t(){return a(this,t),r(this,t,arguments)}return c(t,e),i(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,a,o=function(e,t){var n=(null==t?void 0:t.SimpleModel)||D,r=e.cControlType||e.component||e.controlType||e.ctrlType;return r=r.toLowerCase(),new n(e)}(e,n),i={model:o,meta:e,childModel:!0,modelName:e[s]};null==n||null===(t=n.onBeforeInitModel)||void 0===t||t.call(n,i),r[i.modelName]=i.model,null==n||null===(a=n.onAfterInitModel)||void 0===a||a.call(n,i)}),r}},{key:"initData",value:function(){H.call(this,n)}}])}((null==n||null===(t=n.models)||void 0===t?void 0:t.ViewModel)||N);return u.prototype.modelType="ViewModel",u}var F={BaseModel:q,SimpleModel:D,GridModel:T,ViewModel:N,initViewModel:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;null!=t&&t.requirejs||(t.requirejs=window.__devfab);var a=function(e,t){var n,r,a,o=new(G(e,t)),i={model:o,meta:e};return null==t||null===(n=t.onBeforeInitModel)||void 0===n||n.call(t,i),i.model=o,null==o||null===(r=o.init)||void 0===r||r.call(o,e.models,e),null==t||null===(a=t.onAfterInitModel)||void 0===a||a.call(t,i),o}(e,t);return a.on("destroyVM",function(){var e,t;null===(e=a)||void 0===e||null===(t=e.destroyVM)||void 0===t||t.call(e),a=null,window.devfab.debug&&console.info("[devfab][initVM]: destory vm ".concat((new Date).toString()))}),a.on("extendReady",n(h().m(function n(){var o;return h().w(function(n){for(;;)switch(n.n){case 0:return(o=[]).push(V(e,a,t)),n.n=1,Promise.all(o);case 1:window.devfab.debug&&console.info("[devfab][initVM]: after vm init ".concat((new Date).toString())),null==r||r(a,e);case 2:return n.a(2)}},n)}))),a.initData(),a}};export{F as default};
@@ -1 +1,3 @@
1
- "use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);a<t;a++)n[a]=e[a];return n}function t(e,t,a){return t=o(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,u()?Reflect.construct(t,a||[],o(e).constructor):t.apply(e,a))}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,v(n.key),n)}}function i(e,t,a){return t&&n(e.prototype,t),a&&n(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(e,t,a){return(t=v(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function s(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&&h(e,t)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,n)}return a}function c(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?l(Object(a),!0).forEach(function(t){r(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function d(e,t){if(null==e)return{};var a,n,i=function(e,t){if(null==e)return{};var a={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;a[n]=e[n]}return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)a=r[n],-1===t.indexOf(a)&&{}.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function f(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,i,r,o,s=[],u=!0,l=!1;try{if(r=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;u=!1}else for(;!(u=(n=r.call(a)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,i=e}finally{try{if(!u&&null!=a.return&&(o=a.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}(e,t)||p(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)||p(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 v(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 y(e){return y="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},y(e)}function p(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 w=function(){return i(function e(t){a(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]}}])}(),m=function(){return i(function e(t){a(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 i=this.events.get(e),r=this.firstevents.get(e);if(!i&&!r)return!0;var o=!0;return[].concat(g(r||[]),g(i||[])).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),i=null==n?void 0:n.findIndex(function(e){return e.callback===t});-1!==i&&(null==n||n.splice(i,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,i=this,r=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||i,s);else try{a=n.callback.apply(n.context||i,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==r||r(s)):i._asyncExecute(e,l.slice(t+1),{resolve:r,reject:o,args:s})}})):(u=!1!==a&&u,t===l.length-1&&(u?null==r||r(s):null==o||o()))},h=0;h<l.length&&0!==(n=d(h));h++)if(n)return n.v;return u}},{key:"_asyncPromiseExecute",value:function(e,t,a,n){var i=this.events.get(e),r=this.firstevents.get(e);if(!((Array.isArray(i)?i.length:i)||(Array.isArray(r)?r.length:r)))return null==t?void 0:t();var o=[].concat(g(r||[]),g(i||[]));return this._asyncExecute(e,o,{resolve:t,reject:a,args:n})}},{key:"promiseExecute",value:function(e,t){var a=this,n=e,i=1;if("boolean"==typeof e&&(n=t,i=2),n){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];var u=2===i?o:[t].concat(o);if(u.length){var l,c=u.length-1,d=u[c];if("function"!=typeof d){if("object"!==y(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 h=this.execute.apply(this,u);if(h instanceof Promise){var f=this;h.then(function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];d.apply(f,t)},function(){l&&"function"==typeof l&&l()})}else if(!h)return void(l&&"function"==typeof l&&l())}}}},{key:"clearEvents",value:function(){this.events.clear(),this.firstevents.clear()}}])}();function S(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("&"),i=0,r=n.length;i<r;i++){var o=n[i]||"";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 k(e,t){if(!t)return e;var a=[],n=new S(e);for(var i in t)n.get(i)||a.push("".concat(i,"=").concat(t[i]));if(!a.length)return e;var r=a.join("&");return e.indexOf("?")>=0?"".concat(e,"&").concat(r):"".concat(e,"?").concat(r)}String.prototype.equalsIgnoreCase=function(e){return null!=e&&this.toLowerCase()===e.toLowerCase()};var x=["onBeforeRequest","_onAfterRequest"],R=["_onBeforeRequest","onAfterRequest"];var b={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t=e||{},a=t.onBeforeRequest;t._onAfterRequest;var n,i=d(t,x),r=i.method||"GET",o=i.url;try{null!=i&&i.requestHeaders&&(n=i.requestHeaders,i.requestHeaders=void 0,delete i.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options["requestHeaders"] ERR : ',e)}try{i.params&&i.params.requestHeaders&&(n=i.params.requestHeaders,i.params.requestHeaders=void 0,delete i.params.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var s=null;if(r.equalsIgnoreCase("get")||r.equalsIgnoreCase("delete")?o=k(o,i.params):(r.equalsIgnoreCase("post")||r.equalsIgnoreCase("put"))&&(s=JSON.stringify(i.params)),i.jsonp)return this.getJsonp(o,i.callback);var u=this.getXMLHttpRequest();if(u){var l;if(u.open(r,o,!1!==i.async),i.timeout&&(u.timeout=i.timeout,u.setRequestHeader("timeout",i.timeout),u.ontimeout=function(){b.onerror(this,i,"timeout")}),i.contentType){if(u.setRequestHeader("Content-Type",i.contentType),i.contentType.indexOf("x-www-form-urlencoded")>=0)s=null===(l=new URLSearchParams(i.params))||void 0===l?void 0:l.toString()}else i.dateType?s=i.params:u.setRequestHeader("Content-Type","application/json;charset=utf-8");i.domainKey&&u.setRequestHeader("Domain-Key",i.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==i||!i.hasOwnProperty("withCredentials")||i.withCredentials;try{u.send(s)}catch(e){return{error:"NetWorkError",options:i}}if(!1===i.async)return null==a||a(i),this.onreadystatechange(u,i);u.onreadystatechange=function(){b.onreadystatechange(this,i)},null==a||a(i)}},beforeReadystatechange:function(e,t,a){null==a||a()},onreadystatechange:function(e,t){var a=t||{};a._onBeforeRequest;var n=a.onAfterRequest,i=d(a,R);if(4===e.readyState){if(null==n||n(),200===e.status){var r;try{if("blob"===i.responseType){var o=function(e){var t=e.xhr.getAllResponseHeaders(),a={};return t.split("\r\n").map(function(e){var t=f(e.split(": "),2),n=t[0],i=t[1];a[n]=i}),a}({xhr:e});r={code:e.status,data:{data:e.response,headers:o}}}else r=JSON.parse(e.responseText)}catch(t){b.onerror(e,i,e.responseText)}if(!1===i.async)return e.isBusy=!1,i.precallback&&i.precallback(r),b.processAjaxResult(r,!1,null,null,i,e);b.processAjaxResult(r,i.async,i.callback,i.context,i,e),i.precallback&&i.precallback(r)}else if(0===e.status)b.onerror(e,i,"网络连接已断开,请检查设备网络状态后重试");else if(502===e.status||504===e.status)b.onerror(e,i,"服务出错了,请稍后再试");else{if(401!==e.status){var s={};try{s=JSON.parse(e.responseText)}catch(t){s={code:e.status,message:e.responseText}}return b.onerror(e,i,s)}b.onerror(e,i,"登录信息失效,请重新登录或联系技术人员")}e.isBusy=!1}},onerror:function(e,t,a){var n="[ajax]: [onerror]: 接口返回错误 \n [状态码]: ".concat(e.status," \n [错误信息]: ").concat(("object"===y(a)?JSON.stringify(a):a)||"空"," \n [请求地址]: ").concat(t.url," \n [浏览器Token]: ").concat(document.cookie);console.log("Error.E01000",n);var i="object"===y(a)?a:{code:500,message:a};t.precallback&&t.precallback(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 a=e,n="callback"+this._jsonps.index++,i=document.createElement("script");this._jsonps[n]=function(e){try{t(e)}finally{document.body.removeChild(i)}},a+=-1===a.indexOf("?")?"?":"&callback=cb.rest.AjaxRequestManager._jsonps."+n,i.src=a,document.body.appendChild(i)},processAjaxResult:function(e,t,a,n,i,r){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 C(e,t){this.init&&this.init(e),this.queryParams=t}C.create=function(e,t){return new C(e,t)},C.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)},C.prototype.Do=function(e,t,a,n,i){var r,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!==(r=u.options)&&void 0!==r&&r.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=k(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=i||d.context||this):d.params=t,a&&(d.callback=a,d.context=i||d.context||this),!1===n&&(d.async=!1),this.ajax(c,d)}},C.prototype.ajax=function(e,t){return function(e,t){return t.url=e,b.doRequest(t)}(e,t)};var I=function(){return i(function e(t){a(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 w,this._data.events=new m}},{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 w,events:new m}}},{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,i=this._get_data("components")||[];if(!i.length)return i;var r=[];if(a){var o=i.find(function(e){return e.ctrlName===a});o&&!this.notifyComponent(o,e,t)&&r.push(o)}else i.forEach(function(a){n.notifyComponent(a,e,t)||r.push(a)});return r.length?r: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 i="set".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),r=this.doPropertyChange(i,t,a);if(r){var o={};o[e]=t,r.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,i=this.getValue();if(e!==i){var r={value:e,oldValue:i},o=this._get_data("forceFireEvent");t||o?this.promiseExecute("beforeValueChange",r,[function(){n._set_data("value",e,!0),n._applyState("value",e,a),n.execute("afterValueChange",r)},function(){n._set_data("value",i,!0),n._applyState("value",i,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),i=1;i<a;i++)n[i-1]=arguments[i];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,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];(a=this._get_data("events")).promiseExecute.apply(a,[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").clear(e)}},{key:"setProxy",value:function(e){if(!(e instanceof C)){var t,a=this._get_data("__requestHeaders__");for(var n in e){var i,r,o;if(a&&(null===(i=e[n])||void 0===i||null===(i=i.options)||void 0===i||!i.requestHeaders))null!==(o=e[n])&&void 0!==o&&o.options||(e[n].options={}),e[n].options.requestHeaders=a;null!==(r=this.getProxy())&&void 0!==r&&r[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",C.create(c(c({},(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")}}])}(),P=function(){function e(){return a(this,e),t(this,e,arguments)}return s(e,I),i(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)}}])}(),D=function(){function e(n){return a(this,e),t(this,e,[n])}return s(e,I),i(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)}}])}(),E="",O="Insert",q="Update",j="Delete",M=Array.isArray,A=function(e){return null==e||""===e},F=function(e){return!e||0===Object.keys(e).length};function N(e){if(M(e))return e.map(N);if(e instanceof Date)return new Date(e.getTime());if(e&&"object"===y(e)){var t={};for(var a in e)t[a]=N(e[a]);return t}return e}function K(e){var t={};return(M(e)?e:Object.keys(e||{}).map(function(t){var a;return c(c({},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]=c(c({},e),{},{field:n,fieldName:e.fieldName||n,cCaption:e.cCaption||n,index:void 0===e.index?a:e.index})}}),t}function V(){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 i=e[a];null!=i&&""!==i?e[t]=String(i):(n+=1,e[t]="rowId_".concat(n))}}),this._set_data("rowIdSeq",n),e}var T=function(e,t,a,n,i,r,o){var s=this;this.promiseExecute("beforeBatchModifyPull",function(){var r=s.setProxy({queryData:e}),o={page:{pageSize:s.getPageSize(),pageIndex:s.getPageIndex()}};o.page.pageSize||(s.setPageSize(10),o.page.pageSize=10);var u=s._get_data("bLoadPagination");u||i||(o.page.totalCount=1);var l=s._get_data("delayLoadPageInfo");u&&l&&(n&&s.setState("showDelayPagination",!0),o.page.totalCount=1);var c=Object.assign(o,t);s.setCache("proxyCache",{proxyConfig:e,params:c});var d=0,h={},f=s.getRootParent(),g=s,v=(new Date).valueOf();c.queryId=v;if(!1!==f.execute("beforeQueryData",c)){g.setCache("lastGridFilterCondition",JSON.stringify(null==c?void 0:c.condition));var y=_.cloneDeep(c);if(r.queryData(y,function(e,t,r,o){var s,c;if(setTimeout(function(){g.clearCache("isGridInLoading")},0),null==f||f.clearCache("lazySearch"),e)return this.setState("showDelayPagination",!1),void this.clearCache("setPageIndexFromBack");t=t||{},this._set_data("dataSourceMode","remote"),n&&u&&l&&(d++,t=Object.assign(h,t));var v=Array.isArray(t.recordList)?t.recordList:[];if(u&&l&&2!==d||!a||a.call(this,t,r,o),this.getCache("setPageIndexFromBack"),this.clearCache("setPageIndexFromBack"),this.execute("beforeSetDataSource",v)){var y=this._get_data("rowKeyField"),p={};v.forEach(function(e){p[e[y]]=e}),this._set_data("keyMap",p),n||!1!==this._get_data("override")?(this._set_data("dataSource",v,!0),this.doPropertyChange("resetCellStatus"),this._set_data("cellState",{},!0),this._set_data("rowState",{},!0)):this._set_data("dataSource",this._get_data("dataSource").concat(v),!0),this.setCache("currentGridData",v),v.length&&V.call(this,v),this.initRowState(),setCachePaginationRowData.call(this,v),this._get_data("sortParams");var _=this._get_data("colFilterParams");this.showRows(null,!cb.utils.isEmptyObject(_));var w=this._get_data("pageInfo");u&&!l&&(this._get_data("bLoadPagination")||i)?(w={pageSize:t.pageSize,pageIndex:t.pageIndex,pageCount:t.pageCount,recordCount:t.recordCount},this.setPageInfo(w)):(w.pageIndex=t.pageIndex,w.from="showPageInner",this.setPageInfo(w)),resetSelected.call(this),"splitview"!==(null===(s=this.getParent)||void 0===s||null===(s=s.call(this))||void 0===s||null===(c=s.getParams)||void 0===c||null===(c=c.call(s))||void 0===c?void 0:c.templateType)&&this._set_data("focusedRowIndex",-1);for(var m=arguments.length,S=new Array(m>4?m-4:0),k=4;k<m;k++)S[k-4]=arguments[k];this.execute("afterSetDataSource",v,t.viewmodel,null==S?void 0:S[1])}},s),n&&u&&l){var p=JSON.parse(JSON.stringify(e));p.options||(p.options={}),p.options.mask=!1;B.call(s,p,c,function(e){!function(e){d++,Object.assign(h,e),2===d&&a&&a.call(s,h)}(e)})}}})};function B(e,t,a){this.setCache("queryPageCountLoading",!0);var n=this.setProxy({queryPageCount:c({},e)}),i=Object.assign(!0,t,{page:{totalCount:-1}});this.__queryPageCountRequestId||(this.__queryPageCountRequestId=0),this.__queryPageCountRequestId++;n.queryPageCount(i,function(e,t,n){if(this.__queryPageCountRequestId===e)if(this.setCache("queryPageCountLoading",!1),this.setState("showDelayPagination",!1),t){var i=this._get_data("pageInfo");i&&this.setPageInfo(i)}else{var r={beginPageIndex:(n=n||{}).beginPageIndex,endPageIndex:n.endPageIndex,pageSize:n.pageSize,pageIndex:n.pageIndex,pageCount:n.pageCount,recordCount:n.recordCount};a&&a.call(this,r),this.setPageInfo(r),this.execute("afterQueryPageInfo",n)}}.bind(this,this.__queryPageCountRequestId),this)}var H=function(){function e(){var n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var r=c(c({},{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}),i);M(r.dataSource)||(r.dataSource=[]),M(r.rows)||(r.rows=[]);var o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=c({},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}(i);r.proxyConfig=o,r.dataSourceMode=i.dataSourceMode||(o.load?"remote":"local");var s=i.cData||(M(i.data)?i.data:null);return(n=t(this,e,[r])).initPageInfo(i.cPage||i.page),n.initColumns(r.columns),n.initRowState(),n.afterInit(),s&&n.setDataSource(s),n}return s(e,I),i(e,[{key:"afterInit",value:function(){"single"===this._get_data("parentRelation")&&this._set_data("defaultSelectedRowIndexes",!0)}},{key:"initColumns",value:function(e){var t=K(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=c({},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",(M(t)?t:[]).map(function(t){return(null==t?void 0:t[e.getStatusFlag()])||E}),!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 c(c({},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?M(e)?e:[e]:Object.getOwnPropertyNames(t)).forEach(function(e){t[e]&&(a[e]=c(c({},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?c(c({},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",K(e))}},{key:"setColumnMode",value:function(e){this._set_data("columnMode","remote"===e?"remote":"local",!0)}},{key:"addColumns",value:function(e){var t=K(e);this._applyState("columns",c(c({},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,i=this.getRowKey(e);return i?((null===(n=this._get_data("cellState"))||void 0===n||null===(n=n[i])||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 c(c({},e),{},{cellName:e.cellName||e.columnName})}))}},{key:"setColumnValue",value:function(e,t,a){var n=this._get_data("columns")||{};n[e]&&this._applyState("columns",c(c({},n),{},r({},e,c(c({},n[e]),{},r({},t,a)))))}},{key:"load",value:function(e,t,a){this.setProxy({load:e}).load(t,function(e,t){e?cb.utils.alert(e,"error"):(t.schema&&(this._set_data("columnMode","remote"),this.setColumns(t.schema)),this.setDataSource(t.data),a&&a.call(this))},this)}},{key:"refresh",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.hasEvent("refresh")?this.execute("refresh",e):this.fetch({body:e})}},{key:"loadData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.refresh(e)}},{key:"queryData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.refresh(e)}},{key:"getDataSource",value:function(){var e=this._get_data("dataSource")||[];if(!this.hasDeletedRow())return e;var t=this._get_data("rowsDataState")||[];return e.filter(function(e,a){return t[a]!==j})}},{key:"getRealData",value:function(){return this.getDataSource()}},{key:"getRealRows",value:function(){return this._get_data("rows")||[]}},{key:"getRowsCount",value:function(){return(this._get_data("rows")||[]).length}},{key:"getDataSourceCount",value:function(){return(this._get_data("dataSource")||[]).length}},{key:"hasDeletedRow",value:function(){return(this._get_data("rowsDataState")||[]).some(function(e){return e===j})}},{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]!==j}),!1)}},{key:"getRows",value:function(e){var t=this._get_data("rows")||[];return!1===e?t:t.map(function(e){return N(e)})}},{key:"collectRows",value:function(e,t){var a=this._get_data("columns")||{},n=this.getStatusFlag(),i=this.getSelectedFlag();return(e||[]).map(function(e){var r={};for(var o in e){var s;t&&o===n||(t||o!==i)&&!1!==(null===(s=a[o])||void 0===s?void 0:s.needCollect)&&(r[o]=e[o])}return r})}},{key:"getShowRows",value:function(e){return(e||this._get_data("rows")||[]).map(function(e){return c({},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:N(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():M(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(M(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 i=n[t];if(i!==a){var r={rowIndex:e,rowId:n[this.getIdFlag()],cellName:t,value:a,oldValue:i};this.execute("beforeCellValueChange",r)&&(n[t]=r.value,this.markRowState(e,q),this.execute("afterCellValueChange",r),this.doPropertyChange("setCellValue",r))}}}},{key:"setCellValues",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];M(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,i=this.getRowKey(e),r=i?null===(n=this._get_data("cellState"))||void 0===n||null===(n=n[i])||void 0===n?void 0:n[t]:null;if(r)return r[a]}},{key:"setCellState",value:function(e,t,a,n){var i,o=null===(i=this._get_data("rows"))||void 0===i||null===(i=i[e])||void 0===i?void 0:i[this.getIdFlag()],s=o||e;if(!A(s)){var u=this.getCellState(e,t,a);if(u!==n){var l={rowIndex:e,rowId:o,cellName:t,propertyName:a,value:n,oldValue:u};if(this.execute("beforeCellStateChange",l)){var d=c({},this._get_data("cellState")||{});d[s]=c({},d[s]||{}),d[s][t]=c(c({},d[s][t]||{}),{},r({},a,n)),this._applyState("cellState",d),this.execute("afterCellStateChange",l)}}}}},{key:"setCellStates",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];M(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")||[],i=n.indexOf(a);return i>-1?i: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=g(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!==O&&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,q)}},{key:"getRowState",value:function(e,t){var a,n=this.getRowKey(e),i=n?null===(a=this._get_data("rowState"))||void 0===a?void 0:a[n]:null;if(i&&t)return i[t]}},{key:"setRowState",value:function(e,t,a){var n,i=null===(n=this._get_data("rows"))||void 0===n?void 0:n[e];if(i&&t){var o=this.getRowKey(e),s=this.getRowState(e,t);if(s!==a){var u={rowIndex:e,rowId:i[this.getIdFlag()],propertyName:t,value:a,oldValue:s};if(this.execute("beforeRowStateChange",u)){var l=c({},this._get_data("rowState")||{});l[o]=c(c({},l[o]||{}),{},r({},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]:[];M(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")||[],i=[];return a.forEach(function(e,a){var r=n[a];if(r){var o=N(e);o[t.getStatusFlag()]=r,i.push(o)}}),i.length?i: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:N(this._get_data("dataSource")||[]),rowsDataState:g(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",g(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")||[],i=Math.min(n.length,Math.max(0,void 0===e?n.length:e)),r={index:i,row:c({},t),isCopy:a};if(this.execute("beforeInsertRow",r)){var o=r.row;delete o[this.getIdFlag()],V.call(this,[o]);var s=this._get_data("dataSource")||[],u=i<n.length?this.getDataSourceIndexByRow(i):s.length;s.splice(u<0?s.length:u,0,o);var l=g(this._get_data("rowsDataState")||[]);return l.splice(u<0?l.length:u,0,O),n.splice(i,0,o),this._set_data("rowsDataState",l,!0),this.setRows(n),this.execute("afterInsertRow",c(c({},r),{},{rowIndex:i})),o}}},{key:"insertRows",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[];return(M(a)?a:[a]).forEach(function(a,i){n.push(t.insertRow(e+i,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,q),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=(M(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 i=this._get_data("dataSource")||[],r=g(this._get_data("rowsDataState")||[]),o=new Set,s=new Set;n.forEach(function(e){var a=i.indexOf(e);if(!(a<0)){var n=e[t.getIdFlag()];o.add(n),r[a]===O&&s.add(n)}});var u=[],l=[];i.forEach(function(e,a){var n=e[t.getIdFlag()];if(!o.has(n))return u.push(e),void l.push(r[a]);s.has(n)||(u.push(e),l.push(j))}),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(c(c({},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}):M(e)?e:[e];n=n.filter(function(e){return e>=0&&e<a.getRowsCount()});var i=this._get_data("rows")||[],r=this.getSelectedFlag(),o=n.filter(function(e){return!i[e][r]});if(o.length){var s={rowIndexes:o,rows:o.map(function(e){return i[e]})};this.execute("beforeSelect",s)&&(o.forEach(function(e){i[e][r]=!0,a.cacheSelectedRow(i[e],!0)}),this.flushSelection())}else!0===t&&this.flushSelection()}}},{key:"unselect",value:function(e){var t=this;if(null!=e){var a=M(e)?e:[e],n=this._get_data("rows")||[],i=this.getSelectedFlag(),r=a.filter(function(e){var t;return null===(t=n[e])||void 0===t?void 0:t[i]});r.length&&this.execute("beforeUnselect",r)&&(r.forEach(function(e){n[e][i]=!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=M(t)?t:[],n=this.getRowKeyField(),i=new Set(a.map(function(e){var t;return String(null!==(t=null==e?void 0:e[n])&&void 0!==t?t:e)})),r=this._get_data("rows")||[],o=this.getSelectedFlag();r.forEach(function(t){var a=i.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(M(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=M(e)?e:[e],i=this._get_data("rows")||[],r=[];n.forEach(function(e){var t=i.findIndex(function(t){return String(t[a])===String(e)});t>-1&&r.push(t)}),r.length&&(t?this.select(r):this.unselect(r))}},{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}),i=c({},this._get_data("selectedRowsMap")||{});t&&n.push(a),t?i[a]=e:delete i[a],this._set_data("selectedKeys",n,!0),this._set_data("selectedRowsMap",i,!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(c(c({},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(c(c({},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(c(c({},this.getPageInfo()),{},{pageSize:Math.max(-1,e),pageIndex:1}),{refresh:t})}},{key:"setRecordCount",value:function(e){this.applyPageInfo(c(c({},this.getPageInfo()),{},{recordCount:e||0}))}},{key:"applyPageInfo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=c({},e||{}),n=-1===a.pageSize?-1:a.pageSize||20,i=a.recordCount||0,r=i>0;return a.pageSize=n,a.recordCount=i,a.pageCount=n>0?Math.max(1,Math.ceil(i/n)):1,a.pageIndex=n>0?Math.max(1,r?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,i):i,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,i=(a-1)*n;this.setRows(e.slice(i,i+n))}else this.setRows(e)}},{key:"setDataSource",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;if("local"===this._get_data("dataSourceMode")){var n=cb.utils.isArray(e)?e:[];if(!this.execute("beforeSetDataSource",n))return;var i=this._get_data("rowKeyField"),r={};n.forEach(function(e){r[e[i]]=e}),this._set_data("keyMap",r),this._set_data("dataSource",n,!0),this.getCache("grandson"),n.length&&V.call(this,n),this.initRowState(),setCachePaginationRowData.call(this,n),this.doPropertyChange("resetCellStatus"),this._set_data("rowState",{},!0),this.doPropertyChange("setDataSource",this.getShowRows()),this._set_data("delayInsertRows",[]),this._get_data("isSorting")&&this._set_data("isSorting",!1),this.execute("afterSetDataSource",n)}else{if(!this.execute("beforeProxyLoad",t))return;this._get_data("pageInfo").pageIndex=1;this._set_data("proxyConfig",e),this._set_data("queryParams",t),this._set_data("callback",a),T.call(this,e,t,a,!0,!0)}}},{key:"setRows",value:function(e){var t=M(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")||{},i=t?this.getRowsByIndexes(t):this.getRows(),r=[];i.forEach(function(e,t){for(var i in n){var o=n[i];if(a.isRequiredColumn(o)){var s=e[i];if(A(s)||M(s)&&!s.length||F(s)){var u=o.cShowCaption||o.cCaption||o.cCaption||o.title||i;r.push({rowIndex:t,rowId:e[a.getIdFlag()],cellName:i,message:"".concat(u,"不能为空")}),a.setCellState(t,i,"msg","不能为空")}}}}),this._set_data("validateErrors",r);var o=r.length?r[0].message:"";return this.doPropertyChange("validate",{type:r.length?"error":"",message:o,errors:r}),this.execute("afterValidate",{valid:!r.length,errors:r}),!r.length}}])}(),z=function(){function e(){return a(this,e),t(this,e,arguments)}return s(e,I),i(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 I&&(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,i=e.get(t);i instanceof I&&!1!==i._get_data("needCollect")&&(a[t]=null===(n=i.getData)||void 0===n?void 0:n.call(i))}),a}},{key:"getAllData",value:function(e){var t=this,a=this._get_data("propertyNames")||[],n={};return a.forEach(function(a){var i,r=t.get(a);if(r instanceof I&&!1!==r._get_data("needCollect")&&(!e||!r._get_data("isGrid"))){var o=null===(i=r.getData)||void 0===i?void 0:i.call(r);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,i=t.get(a);i instanceof I&&!1!==i._get_data("needClear")&&(null===(n=i.clear)||void 0===n||n.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 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 i=this._get_data("propertyNames"),r=0,o=i.length;r<o;r++){if((a=this.get(i[r]))instanceof H)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 i=this.get(e[a]);i instanceof H&&t.push(i)}return t}}])}();function L(e,n){var r,o=null===(r=window.__devfab)||void 0===r?void 0:r.require,u=n||{},l=u.domainKeyField,c=void 0===l?"domainKey":l,d=u.billNoField,h=void 0===d?"billNo":d,f=u.modelNameField,g=void 0===f?"modelName":f,v=u.enableExtendjs,y=void 0===v||v;null!=n&&n.require&&(o=null==n?void 0:n.require);var p=e[c]||"",_=e[h],w=function(){function e(){return a(this,e),t(this,e,arguments)}return s(e,z),i(e,[{key:"init",value:function(e,t){var a=this.createModels(e,t);this.setData(a),this.setDirty(!1)}},{key:"createModels",value:function(e,t){var a={};return(Array.isArray(e)?e:[]).forEach(function(e){var i,r,o=null==n||null===(i=n.createModelFactory)||void 0===i?void 0:i.call(n,e);o||(o=function(e){var t;"input"===e.cControlType.toLowerCase()&&(t=new D(e));return t}(e));var s={model:o,field:e,meta:t};null==n||null===(r=n.onBeforeCreateModel)||void 0===r||r.call(n,s),a[e[g]]=s.model}),a}},{key:"initData",value:function(){this.initExtendJs()}},{key:"initExtendJs",value:function(){window&&window.__debugger_initExtendJs;var e=this;if(y){var t="".concat(_,"_VM.Extend.js"),a=[t];if("function"!=typeof o)return console.warn("requirejs.js 未加载,跳过扩展脚本:".concat(t)),void e.execute("extendReady",e);o(p,a,function(a,n){if(a&&a.doAction)try{a.doAction("init",e),n&&n.doAction("init",e)}catch(e){console.error("扩展脚本异常:",e)}else console.error("".concat(t,"扩展文件extend.*.min.js文件加载失败 或 未注册扩展脚本"));e.execute("extendReady",e)},function(a){console.warn("未找到扩展脚本:".concat(t,"错误信息:"),a),e.execute("extendReady",e)})}else e.execute("extendReady",e)}}])}();return w.prototype.modelType="ViewModel",w}function U(e,t){var a=new(L(e,t));return a.init(e.models,e),a}var J={BaseModel:I,FilterModel:P,SimpleModel:D,GridModel:H,ViewModel:z,createViewModel:L,initViewModel:U};exports.BaseModel=I,exports.FilterModel=P,exports.GridModel=H,exports.SimpleModel=D,exports.ViewModel=z,exports.createViewModel=L,exports.default=J,exports.initViewModel=U;
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,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,a)}function n(e){return function(){var n=this,r=arguments;return new Promise(function(a,o){var i=e.apply(n,r);function s(e){t(i,a,o,s,u,"next",e)}function u(e){t(i,a,o,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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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,b(r.key),r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,n){return(t=b(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&&p(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 v(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function h(){
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,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var u=r&&r.prototype instanceof s?r:s,c=Object.create(u.prototype);return y(c,"_invoke",function(n,r,a){var o,s,u,c=0,l=a||[],f=!1,d={p:0,n:0,v:e,a:v,f:v.bind(e,4),d:function(t,n){return o=t,s=0,u=e,d.n=n,i}};function v(n,r){for(s=n,u=r,t=0;!f&&c&&!a&&t<l.length;t++){var a,o=l[t],v=d.p,h=o[2];n>3?(a=h===r)&&(u=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=v&&((a=n<2&&v<o[1])?(s=0,d.v=r,d.n=o[1]):v<h&&(a=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,d.n=h,s=0))}if(a||n>1)return i;throw f=!0,r}return function(a,l,h){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&v(l,h),s=l,u=h;(t=s<2?e:u)||!f;){o||(s?s<3?(s>1&&(d.n=-1),v(s,u)):d.n=u:d.v=u);try{if(c=2,o){if(s||(a="next"),t=o[a]){if(!(t=t.call(o,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=o.return)&&t.call(o),s<2&&(u=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==i)break}catch(t){o=e,s=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,a,o),!0),c}var i={};function s(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(y(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,y(e,a,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,y(f,"constructor",c),y(c,"constructor",u),u.displayName="GeneratorFunction",y(c,a,"GeneratorFunction"),y(f),y(f,a,"Generator"),y(f,r,function(){return this}),y(f,"toString",function(){return"[object Generator]"}),(h=function(){return{w:o,m:d}})()}function y(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}y=function(e,t,n,r){function o(t,n){y(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},y(e,t,n,r)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function g(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,a,o,i,s=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}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 m(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 b(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 w(e){return w="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},w(e)}function k(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 x=function(){return i(function e(t){a(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:"clear",value:function(e){delete this._data[e]}}])}(),S=function(){return i(function e(t){a(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 a=this._events.get(e),o=this._firstevents.get(e);if(!a&&!o)return!0;var i=!0;return[].concat(m(o||[]),m(a||[])).forEach(function(e){if(!1!==i){var t=e.callback.apply(e.context||void 0,n);i=!1!==t&&i}}),i}},{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),a=null==r?void 0:r.findIndex(function(e){return e.callback===t});-1!==a&&(null==r||r.splice(a,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,a=this,o=n.resolve,i=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||a,s);else try{n=r.callback.apply(r.context||a,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==i||i())},resolve:function(n){t===c.length-1?(s.length>1&&(s[0]=n),null==o||o(s)):a._asyncExecute(e,c.slice(t+1),{resolve:o,reject:i,args:s})}})):(u=!1!==n&&u,t===c.length-1&&(u?null==o||o(s):null==i||i()))},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 a=this._events.get(e),o=this._firstevents.get(e);if(!((Array.isArray(a)?a.length:a)||(Array.isArray(o)?o.length:o)))return null==t?void 0:t();var i=[].concat(m(o||[]),m(a||[]));return this._asyncExecute(e,i,{resolve:t,reject:n,args:r})}},{key:"promiseExecute",value:function(e,t){var n=this,r=e,a=1;if("boolean"==typeof e&&(r=t,a=2),r){for(var o=arguments.length,i=new Array(o>2?o-2:0),s=2;s<o;s++)i[s-2]=arguments[s];var u=2===a?i:[t].concat(i);if(u.length){var c,l=u.length-1,f=u[l];if("function"!=typeof f){if("object"!==w(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 v=this;d.then(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];f.apply(v,t)},function(){c&&"function"==typeof c&&c()})}else if(!d)return void(c&&"function"==typeof c&&c())}}}},{key:"clearEvents",value:function(){this._events.clear(),this._firstevents.clear()}}])}();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("&"),a=0,o=r.length;a<o;a++){var i=r[a]||"";if(i){var s=i.indexOf("="),u="",c="";s<0?c=u=window.decode(i):(u=window.decode(i.substr(0,s)),c=window.decode(i.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 j(e,t){if(!t)return e;var n=[],r=new P(e);for(var a in t)r.get(a)||n.push("".concat(a,"=").concat(t[a]));if(!n.length)return e;var o=n.join("&");return e.indexOf("?")>=0?"".concat(e,"&").concat(o):"".concat(e,"?").concat(o)}String.prototype.equalsIgnoreCase=function(e){return null!=e&&this.toLowerCase()===e.toLowerCase()};var C=["onBeforeRequest","_onAfterRequest"],O=["_onBeforeRequest","onAfterRequest"];var A={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t=e||{},n=t.onBeforeRequest;t._onAfterRequest;var r,a=v(t,C),o=a.method||"GET",i=a.url;try{null!=a&&a.requestHeaders&&(r=a.requestHeaders,a.requestHeaders=void 0,delete a.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options["requestHeaders"] ERR : ',e)}try{a.params&&a.params.requestHeaders&&(r=a.params.requestHeaders,a.params.requestHeaders=void 0,delete a.params.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var s=null;if(o.equalsIgnoreCase("get")||o.equalsIgnoreCase("delete")?i=j(i,a.params):(o.equalsIgnoreCase("post")||o.equalsIgnoreCase("put"))&&(s=JSON.stringify(a.params)),a.jsonp)return this.getJsonp(i,a.callback);var u=this.getXMLHttpRequest();if(u){var c;if(u.open(o,i,!1!==a.async),a.timeout&&(u.timeout=a.timeout,u.setRequestHeader("timeout",a.timeout),u.ontimeout=function(){A.onerror(this,a,"timeout")}),a.contentType){if(u.setRequestHeader("Content-Type",a.contentType),a.contentType.indexOf("x-www-form-urlencoded")>=0)s=null===(c=new URLSearchParams(a.params))||void 0===c?void 0:c.toString()}else a.dateType?s=a.params:u.setRequestHeader("Content-Type","application/json;charset=utf-8");a.domainKey&&u.setRequestHeader("Domain-Key",a.domainKey);try{if(r&&"[object Object]"===Object.prototype.toString.call(r))for(var l in r)u.setRequestHeader(l,r[l])}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}u.withCredentials=null==a||!a.hasOwnProperty("withCredentials")||a.withCredentials;try{u.send(s)}catch(e){return{error:"NetWorkError",options:a}}if(!1===a.async)return null==n||n(a),this.onreadystatechange(u,a);u.onreadystatechange=function(){A.onreadystatechange(this,a)},null==n||n(a)}},beforeReadystatechange:function(e,t,n){null==n||n()},onreadystatechange:function(e,t){var n=t||{};n._onBeforeRequest;var r=n.onAfterRequest,a=v(n,O);if(4===e.readyState){if(null==r||r(),200===e.status){var o;try{if("blob"===a.responseType){var i=function(e){var t=e.xhr.getAllResponseHeaders(),n={};return t.split("\r\n").map(function(e){var t=g(e.split(": "),2),r=t[0],a=t[1];n[r]=a}),n}({xhr:e});o={code:e.status,data:{data:e.response,headers:i}}}else o=JSON.parse(e.responseText)}catch(t){A.onerror(e,a,e.responseText)}if(!1===a.async)return e.isBusy=!1,a.precallback&&a.precallback(o),A.processAjaxResult(o,!1,null,null,a,e);A.processAjaxResult(o,a.async,a.callback,a.context,a,e),a.precallback&&a.precallback(o)}else if(0===e.status)A.onerror(e,a,"网络连接已断开,请检查设备网络状态后重试");else if(502===e.status||504===e.status)A.onerror(e,a,"服务出错了,请稍后再试");else{if(401!==e.status){var s={};try{s=JSON.parse(e.responseText)}catch(t){s={code:e.status,message:e.responseText}}return A.onerror(e,a,s)}A.onerror(e,a,"登录信息失效,请重新登录或联系技术人员")}e.isBusy=!1}},onerror:function(e,t,n){var r="[ajax]: [onerror]: 接口返回错误 \n [状态码]: ".concat(e.status," \n [错误信息]: ").concat(("object"===w(n)?JSON.stringify(n):n)||"空"," \n [请求地址]: ").concat(t.url," \n [浏览器Token]: ").concat(document.cookie);console.log("Error.E01000",r);var a="object"===w(n)?n:{code:500,message:n};t.precallback&&t.precallback(a)},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++,a=document.createElement("script");this._jsonps[r]=function(e){try{t(e)}finally{document.body.removeChild(a)}},n+=-1===n.indexOf("?")?"?":"&callback=cb.rest.AjaxRequestManager._jsonps."+r,a.src=n,document.body.appendChild(a)},processAjaxResult:function(e,t,n,r,a,o){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 E(e,t){this.init&&this.init(e),this.queryParams=t}E.create=function(e,t){return new E(e,t)},E.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)},E.prototype.Do=function(e,t,n,r,a){var o,i,s;if(this.config&&this.config[e]&&this.config[e].url){var u=this.config[e],c=u.url;this.queryParams||(this.queryParams={}),null!==(o=u.options)&&void 0!==o&&o.proxyServiceCode&&(this.queryParams.serviceCode=u.options.proxyServiceCode),null!==(i=u.options)&&void 0!==i&&i.billnum&&(this.queryParams.billnum=u.options.billnum),null!==(s=this.queryParams)&&void 0!==s&&s.serviceCode&&(c=j(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=a||f.context||this):f.params=t,n&&(f.callback=n,f.context=a||f.context||this),!1===r&&(f.async=!1),this.ajax(l,f)}},E.prototype.ajax=function(e,t){return function(e,t){return t.url=e,A.doRequest(t)}(e,t)};var q=function(){return i(function e(t){a(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 x,this._data.events=new S}},{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 S}}},{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,a=this._get_data("components")||[];if(!a.length)return a;var o=[];if(n){var i=a.find(function(e){return e.ctrlName===n});i&&!this.notifyComponent(i,e,t)&&o.push(i)}else a.forEach(function(n){r.notifyComponent(n,e,t)||o.push(n)});return o.length?o: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 a="set".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),o=this.doPropertyChange(a,t,n);if(o){var i={};i[e]=t,o.forEach(function(e){r.notifyComponent(e,"setState",i)})}}},{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,a=this.getValue();if(e!==a){var o={value:e,oldValue:a},i=this._get_data("forceFireEvent");t||i?this.promiseExecute("beforeValueChange",o,[function(){r._set_data("value",e,!0),r._applyState("value",e,n),r.execute("afterValueChange",o)},function(){r._set_data("value",a,!0),r._applyState("value",a,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),a=1;a<n;a++)r[a-1]=arguments[a];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,a=new Array(r>2?r-2:0),o=2;o<r;o++)a[o-2]=arguments[o];(n=this._get_data("events")).promiseExecute.apply(n,[e,t].concat(a))}},{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 E)){var t,n=this._get_data("__requestHeaders__");for(var r in e){var a,o,i;if(n&&(null===(a=e[r])||void 0===a||null===(a=a.options)||void 0===a||!a.requestHeaders))null!==(i=e[r])&&void 0!==i&&i.options||(e[r].options={}),e[r].options.requestHeaders=n;null!==(o=this.getProxy())&&void 0!==o&&o[r]&&console.warn("[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",E.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")}}])}(),M=function(){function e(){var t;a(this,e);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return s(t=r(this,e,[].concat(o)),"modelType","SimpleModel"),t}return c(e,q),i(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)}}])}(),D=Array.isArray;function R(e,t,n){var r=this;this.promiseExecute("beforeQuery",{proxyConfig:e,queryParams:t},function(){var a=r,o=r.setProxy({queryData:e}),i=r._get_data("innerUsedAttrs").pageIndex,u={page:s(s({},r._get_data("innerUsedAttrs").pageSize,r.getPageSize()),i,r.getPageIndex())},c=Object.assign(t,u);r.setCache("proxyCache",{proxyConfig:e,params:c,callback:n}),r.getRootParent();if(!1!==r.execute("beforeQueryData",c)){var l=_.cloneDeep(c);o.queryData(l,function(e,t,r,a){if(!e){this._set_data("dataSourceMode","remote");var o=function(e){if(!e)return[];if(D(e))return e;if(D(e.data))return e.data;if(D(e.records))return e.records;if(D(e.list))return e.list;if(D(e.rows))return e.rows;var t=e.data&&"object"===w(e.data)?e.data:e.result;return D(t)?t:t&&"object"===w(t)&&(t.records||t.list||t.rows||t.data)||[]}(t=Object.assign({},t));this.execute("afterQueryData",t),null==n||n.call(this,o)}},a)}})}function I(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 T=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var o,i=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({},(o={id:"_id",selected:"_selected",status:"_status",pageIndex:"pageNo",pageSize:"pageSize",pageCount:"total"}).pageIndex,1),o.pageSize,20),o.pageCount,0),innerUsedAttrs:o,multiRowModel:!1,editRowModels:{},loading:!1,params:{},originalKeyMap:{},defaultRowDatas:new Map}),n);D(i.dataSource)||(i.dataSource=[]),D(i.rows)||(i.rows=[]);var u=function(){return d({},(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).proxyConfig||{})}(n);return i.proxyConfig=u,i.dataSourceMode=n.dataSourceMode||i.dataSourceMode,s(t=r(this,e,[i]),"modelType","GridModel"),t.initColumns(i.columns),t.initPageInfo(n.cPage||n.page),t.afterInit(),t}return c(e,q),i(e,[{key:"afterInit",value:function(){this.execute("afterInit")}},{key:"initColumns",value:function(e){var t=function(e){var t={};return(D(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")||"id"}},{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(){return this._get_data("innerUsedAttrs")}},{key:"get",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")){I(cb.utils.isArray(e)?e:[])}else{if(!this.execute("beforeProxyLoad",n))return;this.setPageIndex(1),R.call(this,e,n,function(e){I.call(t,e),null==r||r.call(t)})}}},{key:"reload",value:function(){var e=this,t=this.getCache("proxyCache");if(t){var n=t.proxyConfig,r=t.params,a=t.callback;R.call(this,n,r,function(t){null==a||a.call(e,t)})}else console.log("[GridModel] proxyConfig is null")}},{key:"getDataSource",value:function(){return this._get_data("dataSource")||[]}},{key:"getData",value:function(e,t){return e||t?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")||createDefaults().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.reload()}},{key:"setPageIndex",value:function(e){if("number"==typeof e){var t=this._get_data("innerUsedAttrs").pageIndex;this._get_data("innerUsedAttrs").pageSize,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}}])}(),N=function(){function e(){var t;a(this,e);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return s(t=r(this,e,[].concat(o)),"modelType","ViewModel"),t}return c(e,q),i(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,a=e.get(t);a instanceof q&&!1!==a._get_data("needCollect")&&(n[t]=null===(r=a.getData)||void 0===r?void 0:r.call(a))}),n}},{key:"getAllData",value:function(e){var t=this,n=this._get_data("propertyNames")||[],r={};return n.forEach(function(n){var a,o=t.get(n);if(o instanceof q&&!1!==o._get_data("needCollect")&&(!e||!o._get_data("isGrid"))){var i=null===(a=o.getData)||void 0===a?void 0:a.call(o);void 0!==i&&(r[n]=i)}}),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,a=t.get(n);a instanceof q&&!1!==a._get_data("needClear")&&(null===(r=a.clear)||void 0===r||r.call(a,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 a=this._get_data("propertyNames"),o=0,i=a.length;o<i;o++){if((n=this.get(a[o]))instanceof T||"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 a=this.get(e[n]);(a instanceof T||"GridModel"==a.modelType)&&t.push(a)}return t}},{key:"getGridFilterModel",value:function(e){return this.getGridModel(e).getCache("FilterViewModel")}}])}();function U(e,t,n,r,a){var o,i=t,s=n,u=r,c=a;Array.isArray(t)&&"function"==typeof n&&(i=void 0,s=t,u=n,c=r);var l,f,d=(null===(o=c)||void 0===o?void 0:o.vm)||this,v={code:0,message:""},h=(s=Array.isArray(s)?s:[]).join(",");return"function"!=typeof e?(v.code=-1,v.message="requirejs.js 未加载,跳过扩展脚本:".concat(h),void(null===(l=u)||void 0===l||l(v))):s.length?void e(i,s,function(){for(var e,t=0,n=arguments.length;t<n;t++){var r=t<0||arguments.length<=t?void 0:arguments[t];if(!r||!r.doAction){v.code=-3,v.message="".concat(h,"文件加载失败 或 未注册拓展脚本");break}try{r.doAction("init",d)}catch(e){v.code=-2,v.message="".concat(h,"拓展脚本异常"),v.error=e;break}}null===(e=u)||void 0===e||e(v)},function(e){var t;v.code=-4,v.message="未找到扩展脚本:".concat(h),v.error=e,null===(t=u)||void 0===t||t(v)}):(v.code=404,v.message="扩展脚本为空",void(null===(f=u)||void 0===f||f(v)))}function H(e){var t=this;window.devfab&&window.devfab.__debugger_initExtendJs;var n=e.requirejs,r=e.extendScriptParams||{},a=r.enableJs,o=void 0===a||a,i=r.filepath,s=r.scriptUrl;if(!o)return window.devfab.debug&&console.info("[devfab][extendjs] 未启用扩展脚本"),void t.execute("extendReady",t);if(!s)return window.devfab.debug&&console.info("[devfab][extendjs] 扩展脚本未定义"),void t.execute("extendReady",t);var u=i,c=[s];t.getEnv&&t.getEnv("everyCommonExtend")&&c.push(t.getEnv("everyCommonExtend")),U.call(t,n.require,u,c,function(e){0!=(null==e?void 0:e.code)&&window.devfab.debug&&(e.error?console.error("[devfab][extendjs] ".concat(e.message," 错误信息:"),e.error):console.warn("[devfab][extendjs] ".concat(e.message))),t.execute("extendReady",t)})}var V=function(){var e=n(h().m(function e(t,r,a){var o,i,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=a.requirejs,u=a.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][exturls] 未启用客开扩展脚本"),e.a(2,Promise.resolve(!0));case 1:if(t){e.n=2;break}return window.devfab.debug&&console.info("[devfab][exturls] 元数据不能为空"),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("localDynamicScripts")||[]).concat(p)).concat(window.__devfab__EXT_BILL_SCRIPTS__||[]),null!==(o=r.getParams())&&void 0!==o&&o.initVMExtUrls&&(p=p.concat([r.getParams().initVMExtUrls])),null===(i=p)||void 0===i||!i.length){e.n=4;break}return p=m(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){U.call(r,s.require,p,function(t){0!=(null==t?void 0:t.code)&&window.devfab.debug&&(t.error?console.error("[devfab][extjs] ".concat(t.message," 错误信息:"),t.error):console.warn("[devfab][extjs] ".concat(t.message))),e(!0)})}))}},e)}));return function(t,n,r){return e.apply(this,arguments)}}();function G(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.modelNameField,s=void 0===o?"cName":o,u=function(e){function t(){return a(this,t),r(this,t,arguments)}return c(t,e),i(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,a,o=function(e,t){var n=(null==t?void 0:t.SimpleModel)||M,r=e.cControlType||e.component||e.controlType||e.ctrlType;return r=r.toLowerCase(),new n(e)}(e,n),i={model:o,meta:e,childModel:!0,modelName:e[s]};null==n||null===(t=n.onBeforeInitModel)||void 0===t||t.call(n,i),r[i.modelName]=i.model,null==n||null===(a=n.onAfterInitModel)||void 0===a||a.call(n,i)}),r}},{key:"initData",value:function(){H.call(this,n)}}])}((null==n||null===(t=n.models)||void 0===t?void 0:t.ViewModel)||N);return u.prototype.modelType="ViewModel",u}var F={BaseModel:q,SimpleModel:M,GridModel:T,ViewModel:N,initViewModel:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;null!=t&&t.requirejs||(t.requirejs=window.__devfab);var a=function(e,t){var n,r,a,o=new(G(e,t)),i={model:o,meta:e};return null==t||null===(n=t.onBeforeInitModel)||void 0===n||n.call(t,i),i.model=o,null==o||null===(r=o.init)||void 0===r||r.call(o,e.models,e),null==t||null===(a=t.onAfterInitModel)||void 0===a||a.call(t,i),o}(e,t);return a.on("destroyVM",function(){var e,t;null===(e=a)||void 0===e||null===(t=e.destroyVM)||void 0===t||t.call(e),a=null,window.devfab.debug&&console.info("[devfab][initVM]: destory vm ".concat((new Date).toString()))}),a.on("extendReady",n(h().m(function n(){var o;return h().w(function(n){for(;;)switch(n.n){case 0:return(o=[]).push(V(e,a,t)),n.n=1,Promise.all(o);case 1:window.devfab.debug&&console.info("[devfab][initVM]: after vm init ".concat((new Date).toString())),null==r||r(a,e);case 2:return n.a(2)}},n)}))),a.initData(),a}};exports.default=F;
@@ -1 +1 @@
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){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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,c(r.key),r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(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 a(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function s(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,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||f(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 u(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)||f(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 c(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 l(e){return l="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},l(e)}function f(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 p=["component","children","render"],y=!1,h={},v=null;function d(e){return h[e]}function g(e,t){if(Array.isArray(e)){var n=[];return e.forEach(function(e,r){var o=e.component,i=e.children,s=e.render,u=a(e,p),c=d(o);c||"function"==typeof s||console.log("[warning] Component ".concat(o," is not registered!"));var l={component:c,children:g(i,t)};u.index=r;var f=Object.assign({},null==t?void 0:t.props,u);"function"==typeof s?n.push(s({node:l,props:f})):"function"==typeof v?n.push(v({node:l,props:f})):(Object.assign(l,f),n.push(l))}),n}}var m=function(){return r(function e(){t(this,e)},[{key:"init",value:function(e){y||("function"==typeof e&&e(),y=!0)}},{key:"initComponent",value:function(e,t){!function(e,t){if(e)"string"==typeof e?h[e]?console.log("[warning] Component ".concat(e," is exist!")):h[e]=t:Object.assign(h,e)}(e,t)}},{key:"getComponents",value:function(){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},h)}},{key:"getComponent",value:function(e){return d(e)}},{key:"hasComponent",value:function(e){return!!d(e)}},{key:"initRenderFactory",value:function(e){!function(e){v=e}(e)}},{key:"initRequest",value:function(){}},{key:"render",value:function(e,t){return g(e,t)}},{key:"clear",value:function(){h={},v=null,y=!1}}])}();function b(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("&"),o=0,i=r.length;o<i;o++){var a=r[o]||"";if(a){var s=a.indexOf("="),u="",c="";s<0?c=u=window.decode(a):(u=window.decode(a.substr(0,s)),c=window.decode(a.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 j(e,t){if(!t)return e;var n=[],r=new b(e);for(var o in t)r.get(o)||n.push("".concat(o,"=").concat(t[o]));if(!n.length)return e;var i=n.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 q=["onBeforeRequest","_onAfterRequest"],x=["_onBeforeRequest","onAfterRequest"];var w={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t=e||{},n=t.onBeforeRequest;t._onAfterRequest;var r,o=a(t,q),i=o.method||"GET",s=o.url;try{null!=o&&o.requestHeaders&&(r=o.requestHeaders,o.requestHeaders=void 0,delete o.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options["requestHeaders"] ERR : ',e)}try{o.params&&o.params.requestHeaders&&(r=o.params.requestHeaders,o.params.requestHeaders=void 0,delete o.params.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var u=null;if(i.equalsIgnoreCase("get")||i.equalsIgnoreCase("delete")?s=j(s,o.params):(i.equalsIgnoreCase("post")||i.equalsIgnoreCase("put"))&&(u=JSON.stringify(o.params)),o.jsonp)return this.getJsonp(s,o.callback);var c=this.getXMLHttpRequest();if(c){var l;if(c.open(i,s,!1!==o.async),o.timeout&&(c.timeout=o.timeout,c.setRequestHeader("timeout",o.timeout),c.ontimeout=function(){w.onerror(this,o,"timeout")}),o.contentType){if(c.setRequestHeader("Content-Type",o.contentType),o.contentType.indexOf("x-www-form-urlencoded")>=0)u=null===(l=new URLSearchParams(o.params))||void 0===l?void 0:l.toString()}else o.dateType?u=o.params:c.setRequestHeader("Content-Type","application/json;charset=utf-8");o.domainKey&&c.setRequestHeader("Domain-Key",o.domainKey);try{if(r&&"[object Object]"===Object.prototype.toString.call(r))for(var f in r)c.setRequestHeader(f,r[f])}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}c.withCredentials=null==o||!o.hasOwnProperty("withCredentials")||o.withCredentials;try{c.send(u)}catch(e){return{error:"NetWorkError",options:o}}if(!1===o.async)return null==n||n(o),this.onreadystatechange(c,o);c.onreadystatechange=function(){w.onreadystatechange(this,o)},null==n||n(o)}},beforeReadystatechange:function(e,t,n){null==n||n()},onreadystatechange:function(e,t){var n=t||{};n._onBeforeRequest;var r=n.onAfterRequest,o=a(n,x);if(4===e.readyState){if(null==r||r(),200===e.status){var i;try{if("blob"===o.responseType){var u=function(e){var t=e.xhr.getAllResponseHeaders(),n={};return t.split("\r\n").map(function(e){var t=s(e.split(": "),2),r=t[0],o=t[1];n[r]=o}),n}({xhr:e});i={code:e.status,data:{data:e.response,headers:u}}}else i=JSON.parse(e.responseText)}catch(t){w.onerror(e,o,e.responseText)}if(!1===o.async)return e.isBusy=!1,o.precallback&&o.precallback(i),w.processAjaxResult(i,!1,null,null,o,e);w.processAjaxResult(i,o.async,o.callback,o.context,o,e),o.precallback&&o.precallback(i)}else if(0===e.status)w.onerror(e,o,"网络连接已断开,请检查设备网络状态后重试");else if(502===e.status||504===e.status)w.onerror(e,o,"服务出错了,请稍后再试");else{if(401!==e.status){var c={};try{c=JSON.parse(e.responseText)}catch(t){c={code:e.status,message:e.responseText}}return w.onerror(e,o,c)}w.onerror(e,o,"登录信息失效,请重新登录或联系技术人员")}e.isBusy=!1}},onerror:function(e,t,n){var r="[ajax]: [onerror]: 接口返回错误 \n [状态码]: ".concat(e.status," \n [错误信息]: ").concat(("object"===l(n)?JSON.stringify(n):n)||"空"," \n [请求地址]: ").concat(t.url," \n [浏览器Token]: ").concat(document.cookie);console.log("Error.E01000",r);var o="object"===l(n)?n:{code:500,message:n};t.precallback&&t.precallback(o)},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++,o=document.createElement("script");this._jsonps[r]=function(e){try{t(e)}finally{document.body.removeChild(o)}},n+=-1===n.indexOf("?")?"?":"&callback=cb.rest.AjaxRequestManager._jsonps."+r,o.src=n,document.body.appendChild(o)},processAjaxResult:function(e,t,n,r,o,i){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 k(e,t){this.init&&this.init(e),this.queryParams=t}k.create=function(e,t){return new k(e,t)},k.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)},k.prototype.Do=function(e,t,n,r,o){var i,a,s;if(this.config&&this.config[e]&&this.config[e].url){var u=this.config[e],c=u.url;this.queryParams||(this.queryParams={}),null!==(i=u.options)&&void 0!==i&&i.proxyServiceCode&&(this.queryParams.serviceCode=u.options.proxyServiceCode),null!==(a=u.options)&&void 0!==a&&a.billnum&&(this.queryParams.billnum=u.options.billnum),null!==(s=this.queryParams)&&void 0!==s&&s.serviceCode&&(c=j(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=o||f.context||this):f.params=t,n&&(f.callback=n,f.context=o||f.context||this),!1===r&&(f.async=!1),this.ajax(l,f)}},k.prototype.ajax=function(e,t){return function(e,t){return t.url=e,w.doRequest(t)}(e,t)};var O=function(){return r(function e(n){t(this,e),this._init(n)},[{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 o=this.events.get(e),i=this.firstevents.get(e);if(!o&&!i)return!0;var a=!0;return[].concat(u(i||[]),u(o||[])).forEach(function(e){if(!1!==a){var t=e.callback.apply(e.context||void 0,n);a=!1!==t&&a}}),a}},{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),o=null==r?void 0:r.findIndex(function(e){return e.callback===t});-1!==o&&(null==r||r.splice(o,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,o=this,i=n.resolve,a=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||o,s);else try{n=r.callback.apply(r.context||o,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==a||a())},resolve:function(n){t===c.length-1?(s.length>1&&(s[0]=n),null==i||i(s)):o._asyncExecute(e,c.slice(t+1),{resolve:i,reject:a,args:s})}})):(u=!1!==n&&u,t===c.length-1&&(u?null==i||i(s):null==a||a()))},p=0;p<c.length&&0!==(r=f(p));p++)if(r)return r.v;return u}},{key:"_asyncPromiseExecute",value:function(e,t,n,r){var o=this.events.get(e),i=this.firstevents.get(e);if(!((Array.isArray(o)?o.length:o)||(Array.isArray(i)?i.length:i)))return null==t?void 0:t();var a=[].concat(u(i||[]),u(o||[]));return this._asyncExecute(e,a,{resolve:t,reject:n,args:r})}},{key:"promiseExecute",value:function(e,t){var n=this,r=e,o=1;if("boolean"==typeof e&&(r=t,o=2),r){for(var i=arguments.length,a=new Array(i>2?i-2:0),s=2;s<i;s++)a[s-2]=arguments[s];var u=2===o?a:[t].concat(a);if(u.length){var c,f=u.length-1,p=u[f];if("function"!=typeof p){if("object"!==l(p)||!p[0]||"function"!=typeof p[0]||!p[1]||"function"!=typeof p[1])return;c=p[1],p=p[0]}if(this.__ASYNC_EXECUTE__)return this._asyncPromiseExecute(r,function(e){p.apply(n,e)},function(){c&&"function"==typeof c&&c()},u);u.splice(f,1),u.unshift(r);var y=this.execute.apply(this,u);if(y instanceof Promise){var h=this;y.then(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];p.apply(h,t)},function(){c&&"function"==typeof c&&c()})}else if(!y)return void(c&&"function"==typeof c&&c())}}}},{key:"clearEvents",value:function(){this.events.clear(),this.firstevents.clear()}}])}(),E=function(){return r(function e(n){t(this,e),this._init(n)},[{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]}}])}(),R={Builder:m,CacheUtil:E,EventUtil:O,DynamicProxy:k};export{m as Builder,E as CacheUtil,k as DynamicProxy,O as EventUtil,R as default};
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){return t=a(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,s()?Reflect.construct(t,n||[],a(e).constructor):t.apply(e,n))}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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,h(r.key),r)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t,n){return(t=h(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function c(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 u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(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,o,i,a,s=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(e,t)||v(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 y(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)||v(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 h(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 d(e){return d="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},d(e)}function v(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}}function m(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("&"),o=0,i=r.length;o<i;o++){var a=r[o]||"";if(a){var s=a.indexOf("="),c="",u="";s<0?u=c=window.decode(a):(c=window.decode(a.substr(0,s)),u=window.decode(a.substr(s+1))),this.query[c]=u}}}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 g(e,t){if(!t)return e;var n=[],r=new m(e);for(var o in t)r.get(o)||n.push("".concat(o,"=").concat(t[o]));if(!n.length)return e;var i=n.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 b=function(e){return null!=e&&""!==e};var _=["children","render"],j=function(){return o(function e(){n(this,e),i(this,"_config",{componentField:["component"]}),i(this,"_components",{}),i(this,"_renderFactory",null)},[{key:"init",value:function(e,t,n){this._initConfig(e),this._initComponent(t),this._initRenderFactory(n)}},{key:"_initConfig",value:function(e){this._config=Object.assign(this._config,e)}},{key:"_initComponent",value:function(e,t){if(e)if("string"==typeof e){if(this._components[e])return void console.log("[warning] Component ".concat(e," is exist!"));this._components[e]=t}else"function"==typeof e?Object.assign(this._components,null==e?void 0:e()):"object"===d(e)&&Object.assign(this._components,e)}},{key:"_getComponent",value:function(e){return this._components[e]}},{key:"_clearComponents",value:function(){this._components={}}},{key:"_initRenderFactory",value:function(e){this._renderFactory=e}},{key:"_renderComponent",value:function(e,t){var n=this;if(Array.isArray(e)){var r=[];return e.forEach(function(e,o){var a=u({},e),s=function(e,t,n){if(e){var r=n;"string"==typeof t&&Array.isArray(r)&&(r=i({},t,n));var o=r&&r[t];if(!o)return b(e[t])?e[t]:void 0;for(var a=0;a<o.length;a++){var s=e[o[a]];if(b(s))return s}}}(a,"component",n._config.componentField),c=a.children,f=a.render,p=l(a,_),y=n._getComponent(s);y||"function"==typeof f||console.log("[warning] Component ".concat(s," is not registered!"));var h={component:y,children:n._renderComponent(c,t)};p.index=o;var d=Object.assign({},null==t?void 0:t.props,{meta:p});"function"==typeof f?r.push(f({node:h,props:d})):"function"==typeof n._renderFactory?r.push(n._renderFactory({node:h,props:d})):(Object.assign(h,d),r.push(h))}),r}}},{key:"clear",value:function(){this._clearComponents(),this._renderFactory=null}}])}(),O=function(){function e(){return n(this,e),t(this,e,arguments)}return function(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&&f(e,t)}(e,j),o(e,[{key:"initComponent",value:function(e,t){this._initComponent(e,t)}},{key:"getComponents",value:function(){return u({},this._components)}},{key:"getComponent",value:function(e){return this._getComponent(e)}},{key:"hasComponent",value:function(e){return!!this._getComponent(e)}},{key:"initRenderFactory",value:function(e){this._initRenderFactory(e)}},{key:"render",value:function(e,t){return this._renderComponent(e,t)}}])}();O.create=function(e){return new O(e)};var w=["onBeforeRequest","_onAfterRequest"],x=["_onBeforeRequest","onAfterRequest"];var k={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t=e||{},n=t.onBeforeRequest;t._onAfterRequest;var r,o=l(t,w),i=o.method||"GET",a=o.url;try{null!=o&&o.requestHeaders&&(r=o.requestHeaders,o.requestHeaders=void 0,delete o.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options["requestHeaders"] ERR : ',e)}try{o.params&&o.params.requestHeaders&&(r=o.params.requestHeaders,o.params.requestHeaders=void 0,delete o.params.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var s=null;if(i.equalsIgnoreCase("get")||i.equalsIgnoreCase("delete")?a=g(a,o.params):(i.equalsIgnoreCase("post")||i.equalsIgnoreCase("put"))&&(s=JSON.stringify(o.params)),o.jsonp)return this.getJsonp(a,o.callback);var c=this.getXMLHttpRequest();if(c){var u;if(c.open(i,a,!1!==o.async),o.timeout&&(c.timeout=o.timeout,c.setRequestHeader("timeout",o.timeout),c.ontimeout=function(){k.onerror(this,o,"timeout")}),o.contentType){if(c.setRequestHeader("Content-Type",o.contentType),o.contentType.indexOf("x-www-form-urlencoded")>=0)s=null===(u=new URLSearchParams(o.params))||void 0===u?void 0:u.toString()}else o.dateType?s=o.params:c.setRequestHeader("Content-Type","application/json;charset=utf-8");o.domainKey&&c.setRequestHeader("Domain-Key",o.domainKey);try{if(r&&"[object Object]"===Object.prototype.toString.call(r))for(var f in r)c.setRequestHeader(f,r[f])}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}c.withCredentials=null==o||!o.hasOwnProperty("withCredentials")||o.withCredentials;try{c.send(s)}catch(e){return{error:"NetWorkError",options:o}}if(!1===o.async)return null==n||n(o),this.onreadystatechange(c,o);c.onreadystatechange=function(){k.onreadystatechange(this,o)},null==n||n(o)}},beforeReadystatechange:function(e,t,n){null==n||n()},onreadystatechange:function(e,t){var n=t||{};n._onBeforeRequest;var r=n.onAfterRequest,o=l(n,x);if(4===e.readyState){if(null==r||r(),200===e.status){var i;try{if("blob"===o.responseType){var a=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],o=t[1];n[r]=o}),n}({xhr:e});i={code:e.status,data:{data:e.response,headers:a}}}else i=JSON.parse(e.responseText)}catch(t){k.onerror(e,o,e.responseText)}if(!1===o.async)return e.isBusy=!1,o.precallback&&o.precallback(i),k.processAjaxResult(i,!1,null,null,o,e);k.processAjaxResult(i,o.async,o.callback,o.context,o,e),o.precallback&&o.precallback(i)}else if(0===e.status)k.onerror(e,o,"网络连接已断开,请检查设备网络状态后重试");else if(502===e.status||504===e.status)k.onerror(e,o,"服务出错了,请稍后再试");else{if(401!==e.status){var s={};try{s=JSON.parse(e.responseText)}catch(t){s={code:e.status,message:e.responseText}}return k.onerror(e,o,s)}k.onerror(e,o,"登录信息失效,请重新登录或联系技术人员")}e.isBusy=!1}},onerror:function(e,t,n){var r="[ajax]: [onerror]: 接口返回错误 \n [状态码]: ".concat(e.status," \n [错误信息]: ").concat(("object"===d(n)?JSON.stringify(n):n)||"空"," \n [请求地址]: ").concat(t.url," \n [浏览器Token]: ").concat(document.cookie);console.log("Error.E01000",r);var o="object"===d(n)?n:{code:500,message:n};t.precallback&&t.precallback(o)},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++,o=document.createElement("script");this._jsonps[r]=function(e){try{t(e)}finally{document.body.removeChild(o)}},n+=-1===n.indexOf("?")?"?":"&callback=cb.rest.AjaxRequestManager._jsonps."+r,o.src=n,document.body.appendChild(o)},processAjaxResult:function(e,t,n,r,o,i){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 q(e,t){this.init&&this.init(e),this.queryParams=t}q.create=function(e,t){return new q(e,t)},q.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)},q.prototype.Do=function(e,t,n,r,o){var i,a,s;if(this.config&&this.config[e]&&this.config[e].url){var c=this.config[e],u=c.url;this.queryParams||(this.queryParams={}),null!==(i=c.options)&&void 0!==i&&i.proxyServiceCode&&(this.queryParams.serviceCode=c.options.proxyServiceCode),null!==(a=c.options)&&void 0!==a&&a.billnum&&(this.queryParams.billnum=c.options.billnum),null!==(s=this.queryParams)&&void 0!==s&&s.serviceCode&&(u=g(u,this.queryParams));var l=u,f=Object.assign({},c.options);return f.method=c.method||"GET","function"==typeof t?(f.callback=t,f.context=o||f.context||this):f.params=t,n&&(f.callback=n,f.context=o||f.context||this),!1===r&&(f.async=!1),this.ajax(l,f)}},q.prototype.ajax=function(e,t){return function(e,t){return t.url=e,k.doRequest(t)}(e,t)};var C=function(){return o(function e(t){n(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 o=this._events.get(e),i=this._firstevents.get(e);if(!o&&!i)return!0;var a=!0;return[].concat(y(i||[]),y(o||[])).forEach(function(e){if(!1!==a){var t=e.callback.apply(e.context||void 0,n);a=!1!==t&&a}}),a}},{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),o=null==r?void 0:r.findIndex(function(e){return e.callback===t});-1!==o&&(null==r||r.splice(o,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,o=this,i=n.resolve,a=n.reject,s=n.args,c=!0,u=t||[],l=!1,f=function(t){var n,r=u[t];if(!1===c)return 0;if(l)return{v:void 0};if("development"===process.env.nodeEnv)n=r.callback.apply(r.context||o,s);else try{n=r.callback.apply(r.context||o,s)}catch(e){throw e.isAddedMsg||(e.message="(领域扩展事件执行失败,请打开控制台查看详细错误信息并修复):".concat(e.message)),e.isAddedMsg=!0,e}n instanceof Promise?(l=!0,(c=n).callbacks&&c.callbacks.push({reject:function(){c.reject(),t===u.length-1&&(null==a||a())},resolve:function(n){t===u.length-1?(s.length>1&&(s[0]=n),null==i||i(s)):o._asyncExecute(e,u.slice(t+1),{resolve:i,reject:a,args:s})}})):(c=!1!==n&&c,t===u.length-1&&(c?null==i||i(s):null==a||a()))},p=0;p<u.length&&0!==(r=f(p));p++)if(r)return r.v;return c}},{key:"_asyncPromiseExecute",value:function(e,t,n,r){var o=this._events.get(e),i=this._firstevents.get(e);if(!((Array.isArray(o)?o.length:o)||(Array.isArray(i)?i.length:i)))return null==t?void 0:t();var a=[].concat(y(i||[]),y(o||[]));return this._asyncExecute(e,a,{resolve:t,reject:n,args:r})}},{key:"promiseExecute",value:function(e,t){var n=this,r=e,o=1;if("boolean"==typeof e&&(r=t,o=2),r){for(var i=arguments.length,a=new Array(i>2?i-2:0),s=2;s<i;s++)a[s-2]=arguments[s];var c=2===o?a:[t].concat(a);if(c.length){var u,l=c.length-1,f=c[l];if("function"!=typeof f){if("object"!==d(f)||!f[0]||"function"!=typeof f[0]||!f[1]||"function"!=typeof f[1])return;u=f[1],f=f[0]}if(this.__ASYNC_EXECUTE__)return this._asyncPromiseExecute(r,function(e){f.apply(n,e)},function(){u&&"function"==typeof u&&u()},c);c.splice(l,1),c.unshift(r);var p=this.execute.apply(this,c);if(p instanceof Promise){var y=this;p.then(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];f.apply(y,t)},function(){u&&"function"==typeof u&&u()})}else if(!p)return void(u&&"function"==typeof u&&u())}}}},{key:"clearEvents",value:function(){this._events.clear(),this._firstevents.clear()}}])}(),A=function(){return o(function e(t){n(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:"clear",value:function(e){delete this._data[e]}}])}();function R(e,t,n,r,o){var i,a=t,s=n,c=r,u=o;Array.isArray(t)&&"function"==typeof n&&(a=void 0,s=t,c=n,u=r);var l,f,p=(null===(i=u)||void 0===i?void 0:i.vm)||this,y={code:0,message:""},h=(s=Array.isArray(s)?s:[]).join(",");return"function"!=typeof e?(y.code=-1,y.message="requirejs.js 未加载,跳过扩展脚本:".concat(h),void(null===(l=c)||void 0===l||l(y))):s.length?void e(a,s,function(){for(var e,t=0,n=arguments.length;t<n;t++){var r=t<0||arguments.length<=t?void 0:arguments[t];if(!r||!r.doAction){y.code=-3,y.message="".concat(h,"文件加载失败 或 未注册拓展脚本");break}try{r.doAction("init",p)}catch(e){y.code=-2,y.message="".concat(h,"拓展脚本异常"),y.error=e;break}}null===(e=c)||void 0===e||e(y)},function(e){var t;y.code=-4,y.message="未找到扩展脚本:".concat(h),y.error=e,null===(t=c)||void 0===t||t(y)}):(y.code=404,y.message="扩展脚本为空",void(null===(f=c)||void 0===f||f(y)))}var E={Builder:O,CacheUtil:A,EventUtil:C,DynamicProxy:q};export{O as Builder,A as CacheUtil,q as DynamicProxy,C as EventUtil,E as default,R as loadScripts};