@farris/bef
Advanced tools
Comparing version 0.0.12-20210828171001-dev to 0.0.12-20210914160505-dev
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@ecp-caf/caf-common"),require("date-fns"),require("rxjs"),require("rxjs/operators"),require("rxjs/operators/map"),require("@angular/core"),require("@farris/devkit"),require("@angular/common/http")):"function"==typeof define&&define.amd?define("@farris/bef",["exports","@ecp-caf/caf-common","date-fns","rxjs","rxjs/operators","rxjs/operators/map","@angular/core","@farris/devkit","@angular/common/http"],t):t((e.farris=e.farris||{},e.farris.bef={}),e.cafCommon,e.dateFns,e.rxjs,e.rxjs.operators,e.rxjs["operators/map"],e.ng.core,e.devkit,e.ng.common.http)}(this,function(e,t,n,b,d,s,i,I,a){"use strict";var S=(r.Added="Added",r.Modify="Modify",r.Deleted="Deleted",r);function r(){}var p=new i.InjectionToken("@farris/be BE_SERVER_URL"),u=new i.InjectionToken("@farris/be BE_SESSION_HANDLING_STRATEGY_TOKEN"),C=(o.getPropInfo=function(e,t){var r,n,o,i=I.FieldMetadataUtil.getNgFields(e);Object.keys(i).forEach(function(e){e===t&&(r="NgField",n=null,o=i[e])});var a=I.FieldMetadataUtil.getNgObjects(e);Object.keys(a).forEach(function(e){e===t&&(r="NgObject",n=a[e].type,o=a[e])});var s=I.FieldMetadataUtil.getNgList(e);Object.keys(s).forEach(function(e){e===t&&(r="NgList",n=s[e].type,o=s[e])});var p=I.FieldMetadataUtil.getNgDynamic(e);return Object.keys(p).forEach(function(e){e===t&&(r="NgDynamic",n=p[e].type,o=p[e])}),{propType:r,propEntityType:n,propMetadata:o}},o.getPrimaryKey=function(e){var t=I.FieldMetadataUtil.getPrimaryFieldMetadata(e);return t?t.dataField:""},o.isObjectProp=function(e,t){var r=!1,n=I.FieldMetadataUtil.getNgObjects(e);return Object.keys(n).forEach(function(e){e===t&&(r=!0)}),r},o.isDynamicProp=function(e,t){var r=!1,n=I.FieldMetadataUtil.getNgDynamic(e);return Object.keys(n).forEach(function(e){e===t&&(r=!0)}),r},o.appendInitialData=function(e,t){var r=Object.assign({},t);delete r.id,delete r.parentID,e.initialData=r},o);function o(){}var c=(h.prototype.build=function(e){var t=this;return this.changeDetail={ChangeType:S.Modify,ChangeInfo:{DataId:""}},e.forEach(function(e){t.buildChangeDetail(e)}),this.changeDetail},h.prototype.buildChangeDetail=function(l){var d=l.path.concat();this.changeDetail.ChangeInfo.DataId||(this.changeDetail.ChangeInfo.DataId=d[0].split(":")[1]);for(var f=this.changeDetail,g=this.entityType,e=function(e){var t=v.getChangeInfo(f),r=d[e],n=C.getPropInfo(g,r),o=n.propType,i=n.propEntityType,a=n.propMetadata.dataField||r;if("NgField"===o){if(r===C.getPrimaryKey(g))return"continue";if(l.type!==I.ModifyType.ValueChange)throw Error("简单类型的属性上不支持ValueChange类型之外的变更");t[a]=l.value,f=null}else if("NgObject"===o)if(d[e+1].split(":")[1],d[e+1].split(":")[0]){var s=t[a],p=d.slice(0,e+1);s=(y=v.entityCollection.getEntityByPath(p))?y.toJSON(!0):{},t[a]=s,g=f=null}else c=(c=t[a])||{ChangeType:S.Modify,ChangeInfo:{}},t[a]=c,f=c,g=i;else if("NgList"===o){f.ChangeInfo[a]||(f.ChangeInfo[a]=[]);var u=f.ChangeInfo[a];if(e!==d.length-1){var c,h=d[e+1].split(":")[1];return(c=u.find(function(e){return e.ChangeInfo.DataId===h}))||(c=v.createEmptyChangeDetail(S.Modify,h),u.push(c)),f=c,g=i,"continue"}l.type===I.ModifyType.Add||l.type===I.ModifyType.Insert||(l.type,I.ModifyType.Remove),g=f=null}else if("NgDynamic"===o){p=d.slice(0,e+1);var y=v.entityCollection.getEntityByPath(p);t[a]={ChangeType:S.Modify,ChangeInfo:y?y.toJSON(!0):{}},g=f=null}},v=this,t=1;t<d.length&&f;t+=2)e(t)},h.prototype.getChangeInfo=function(e){return e.hasOwnProperty("ChangeInfo")?e.ChangeInfo:e},h.prototype.createEmptyChangeDetail=function(e,t){return{ChangeType:e,ChangeInfo:{DataId:t}}},h);function h(e,t){this.entityType=e,this.entityCollection=t}var y=(l.prototype.handle=function(e,t,r){this.handleChangeDetails(e,t,r)},l.prototype.handleChangeDetails=function(n,o,e){var i=this;e&&e.forEach(function(e){var t=e.ChangeInfo.dataId||e.ChangeInfo.DataId,r=i.getEntityById(o,t);r&&i.handleChangeDetail(n,r,e)})},l.prototype.handleChangeDetail=function(u,c,e){var h=this;if(e&&c&&e.ChangeType===S.Modify){var y=e.ChangeInfo;Object.keys(y).forEach(function(e){var t=C.getPropInfo(u,e),r=t.propType,n=t.propEntityType;if("NgField"===r)c[e]=y[e];else if("NgObject"===r){var o=c[e];if(o.primaryKey){var i=y[e];o.load(i)}else{var a=y[e];h.handleChangeDetail(n,o,a)}}else if("NgList"===r){var s=c[e],p=y[e];h.handleChangeDetails(n,s,p)}})}},l.prototype.getEntityById=function(e,t){return(e instanceof I.EntityCollection?e.getEntityById(t):e.get(t))||null},l);function l(){}var f=(g.prototype.getUserSessionId=function(){return this.sessionService.getUserSessionId()},g.prototype.getCurrentSessionId=function(e){var t;if(this.sessionService)if(e&&e.hasOwnProperty("tabId")){var r=e.tabId;t=this.sessionService.getCurrentSeesionId(r)}else t=this.sessionService.getCurrentSeesionId();return t=t||this.getUserSessionId()},g.decorators=[{type:i.Injectable}],g.ctorParameters=function(){return[{type:t.SessionService,decorators:[{type:i.Optional}]}]},g);function g(e){this.sessionService=e}var v=(m.prototype.getItem=function(e){return this.getAllBeSessions()[e]},m.prototype.setItem=function(e,t){var r=this.getAllBeSessions();r[e]=t,this.setAllBeSessions(r)},m.prototype.removeItem=function(e){var t=this.getAllBeSessions();t[e]&&delete t[e],this.setAllBeSessions(t)},m.prototype.clear=function(e,t){!0===this.isInFramework()?this.removeItemsByFrmSessionId(e):this.removeItem(t)},m.prototype.removeItemsByFrmSessionId=function(t){var r=this.getAllBeSessions();Object.keys(r).forEach(function(e){!0===e.startsWith(t)&&delete r[e]}),this.setAllBeSessions(r)},m.prototype.getAllBeSessions=function(){var e=window.sessionStorage.getItem(this.sessionStorageKey);return e?JSON.parse(e):{}},m.prototype.setAllBeSessions=function(e){var t=JSON.stringify(e);window.sessionStorage.setItem(this.sessionStorageKey,t)},m.prototype.isInFramework=function(){var e=window.location.hash;return!!e&&-1!==e.indexOf("tabId=")},m);function m(){this.sessionStorageKey="BE_SESSION_ID"}var E=function(e,t){return(E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function x(e,t){function r(){this.constructor=e}E(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var B=function(){return(B=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function P(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function R(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)a.push(n.value)}catch(s){o={error:s}}finally{try{n&&!n.done&&(r=i["return"])&&r.call(i)}finally{if(o)throw o.error}}return a}function D(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(R(arguments[t]));return e}var q=(O.convertToHeaders=function(t){if(1==(t=t||new a.HttpHeaders)instanceof a.HttpHeaders)return t;if(0<Object.keys(t).length){var r=new a.HttpHeaders;Object.keys(t).forEach(function(e){r=r.append(e,t[e])}),t=r}else t=new a.HttpHeaders;return t},O.appendSessionId=function(e,t){return e.append("SessionId",t)},O.appendCafRuntimeCommonVariable=function(e,t){return e.append("X-CAF-Runtime-CommonVariable",t)},O.appendCafRuntimeContext=function(e,t){return e.append("X-CAF-Runtime-Context",t)},O.appendContextType=function(e,t){return t=t||"application/json",e.append("Content-Type",t)},O.appendRequireMessage=function(e,t){return void 0===t&&(t=!0),e.append("Bff-Require-Message",t.toString())},O.appendFuncInstId=function(e,t){return e.append("Func-Inst-Id",t)},O.toJson=function(r){if(!(r instanceof a.HttpHeaders))return null;var n={};return r.keys().forEach(function(e){var t=r.getAll(e);1<t.length?n[e]=t:n[e]=t[0]||""}),n},O);function O(){}var w=(M.buildParams=function(e){var t=new a.HttpParams;for(var r in e)if(e.hasOwnProperty(r)){var n=e[r].toString();t=t.append(r,n)}return t},M);function M(){}var T=(j.hasRequestInfo=function(e){if(!e||!e.body)return!1;var t=e.body;return!(!t.requestInfo||!t.requestInfo.dataChange)||!!t.dataChange},j.hasRequestInfoWithR=function(e){if(!e||!e.body)return!1;var t=e.body;return!(!t.RequestInfo||!t.RequestInfo.dataChange)||!!t.dataChange},j.buildRequestInfo=function(e){return{dataChange:e.entityManager.buildAllEntityChangeDetails(),variableChange:e.variableManager.buildChangeDetail()}},j.buildBodyWithRequestInfo=function(e,t){if(e.RequestInfo||e.requestInfo)return e;var r=this.buildRequestInfo(t);return Object.assign({},e,{requestInfo:r})},j);function j(){}var A=(U.unWrapResponseInfo=function(e){if(!e)return e;if(!1===e.hasOwnProperty("returnValue"))return e.hasOwnProperty("result")&&e.hasOwnProperty("pagination")?e.result:e;var t=e.returnValue;return t&&t.hasOwnProperty("result")&&t.hasOwnProperty("pagination")?t.result:e.returnValue},U.isReported401Error=function(e){return 401===e.status},U.parseBackEndMessage=function(e){return e&&e.message&&Array.isArray(e.message)&&0<e.message.length?e.message:null},U.parseBackEndError=function(e){var t=e&&e.error;return t&&t.hasOwnProperty("extensionMessage")&&t.extensionMessage&&t.extensionMessage.hasOwnProperty("UIMsg")&&t.extensionMessage.UIMsg&&0<t.extensionMessage.UIMsg.length?JSON.parse(t.extensionMessage.UIMsg):null},U);function U(){}var H=(V.prototype.getService=function(){for(var e=window;!e.gspframeworkService&&e!==window.top&&this.isSameOrigin(e);)e=window.parent;return e.gspframeworkService&&e.gspframeworkService.rtf||{}},V.prototype.isSameOrigin=function(e){var t=window.location.host;try{if(e&&e.location&&"undefined"!=typeof e.location.host)return e.location.host===t}catch(r){return!1}return!1},Object.defineProperty(V.prototype,"params",{get:function(){return this.rtf&&this.rtf.hasOwnProperty("session")&&"function"==typeof this.rtf.session.getCommonVariable?this.rtf.session.getCommonVariable():null},enumerable:!0,configurable:!0}),Object.defineProperty(V.prototype,"httpService",{get:function(){return this.rtf&&this.rtf.hasOwnProperty("http")&&"function"==typeof this.rtf.http.request?this.rtf.http:null},enumerable:!0,configurable:!0}),V.prototype.request=function(e,t,r){return void 0===r&&(r={}),this.defaultHttpClient.request(e,t,r)},V.decorators=[{type:i.Injectable}],V.ctorParameters=function(){return[{type:a.HttpClient}]},V);function V(e){this.defaultHttpClient=e,this.httpClient=e,this.rtf=this.getService()}var k=(F.prototype.getFrmSessionId=function(e){return this.frmSessionService.getCurrentSessionId(e)},Object.defineProperty(F.prototype,"frmSessionId",{get:function(){return this.frmSessionService.getCurrentSessionId()},enumerable:!0,configurable:!0}),F.prototype.getFrameworkSessionId=function(e){return this.getFrmSessionId(e)},F.prototype.getSessionIdFromStorage=function(e){var t=this.getSessionStorageKey(e);return this.storageStrategy.getItem(t)},F);function F(e,t){this.storageStrategy=e,this.frmSessionService=t}var N,_=(x(L,N=k),L.prototype.getSessionId=function(){var e=this.getSessionIdFromStorage();return e?b.of(e):this.createSession()},L.prototype.setSessionId=function(e){var t=this.getSessionStorageKey();this.storageStrategy.setItem(t,e)},L.prototype.clearSessionId=function(){var e=this.getSessionStorageKey();this.storageStrategy.clear(this.frmSessionId,e)},L.prototype.extendRequestHeaders=function(e,t){var r=this.getFrameworkSessionId(t),n=this.getSessionIdFromStorage(t);return e=q.appendCafRuntimeCommonVariable(e,r),n&&(e=q.appendCafRuntimeContext(e,n),e=q.appendSessionId(e,n)),e=q.appendFuncInstId(e,this.beSessionUri)},L.prototype.handleReponseHeaders=function(e){console.log(e)},L.prototype.createSession=function(){var t=this,e={responseType:"text"};return this.frmSessionId&&(this.injector.get(I.AppContext,null),e.headers=new a.HttpHeaders({SessionId:this.frmSessionId}),e.headers=e.headers.append("X-CAF-Runtime-CommonVariable",this.frmSessionId),e.headers=e.headers.append("Func-Inst-Id",this.beSessionUri),e.headers=q.toJson(e.headers)),this.httpService.request("POST",this.beSessionUri,e).pipe(d.tap(function(e){t.setSessionId(e)}))},L.prototype.extendHttpHeader=function(){},L.prototype.getSessionStorageKey=function(e){return(e?this.getFrameworkSessionId(e):this.frmSessionId)+"_"+this.beSessionUri},L);function L(e,t,r,n,o){var i=N.call(this,e,t)||this;return i.beSessionUri=n,i.httpClient=r,i.httpService=new H(i.httpClient),i.injector=o,i}var K,G=(x(J,K=k),J.prototype.getSessionId=function(){var e=this.getSessionStorageKey(),t=this.storageStrategy.getItem(e);return b.of(t)},J.prototype.setSessionId=function(e){var t=this.getSessionStorageKey();this.storageStrategy.setItem(t,e)},J.prototype.clearSessionId=function(){var e=this.getSessionStorageKey();this.storageStrategy.removeItem(e)},J.prototype.extendRequestHeaders=function(e,t){var r=this.getFrameworkSessionId(t),n=this.getSessionIdFromStorage(t),o=this.injector.get(I.AppContext,null);if(o){var i=o.Token;e=q.appendFuncInstId(e,i)}return e=q.appendCafRuntimeCommonVariable(e,r),n&&(e=q.appendCafRuntimeContext(e,n)),e},J.prototype.handleReponseHeaders=function(e){console.log(e)},J.prototype.getSessionStorageKey=function(e){return(e?this.getFrameworkSessionId(e):this.frmSessionId)+"_"+this.beSessionUri},J);function J(e,t,r,n){var o=K.call(this,e,t)||this;return o.beSessionUri=r,o.injector=n,o}var W=(z.prototype.create=function(e,t,r,n,o){var i=this.createStorageStrategy(),a=this.createBeSessionUri(r);return"UnifiedSession"===e?new G(i,t,a,o):new _(i,t,n,a,o)},z.prototype.createStorageStrategy=function(){return new v},z.prototype.createBeSessionUri=function(e){return e+"/service/createsession"},z.decorators=[{type:i.Injectable}],z);function z(){}var Q=(Object.defineProperty(Y.prototype,"token",{get:function(){return this.handlingStrategy.getFrameworkSessionId()},enumerable:!0,configurable:!0}),Y.prototype.getBeSessionId=function(){return this.handlingStrategy.getSessionId()},Y.prototype.setBeSessionId=function(e){this.handlingStrategy.setSessionId(e),this.setSessionId(e)},Y.prototype.clearBeSessionId=function(){this.handlingStrategy.clearSessionId()},Y.prototype.extendRequestHeaders=function(e,t){return this.handlingStrategy.extendRequestHeaders(e,t)},Y.prototype.handleResponseHeaders=function(e){return this.handlingStrategy.handleReponseHeaders(e)},Y.prototype.createBeSession=function(){return this.handlingStrategy.createSession()},Y.prototype.setSessionId=function(e){var t=this.injector.get(I.AppContext,null,i.InjectFlags.Optional);t&&e&&t.params.set("sessionId",e)},Y.prototype.createHandlingStrategy=function(e,t,r,n){var o;return o=(o=e?e.get(u,null,i.InjectFlags.Optional):"SeparatedSession")||"SeparatedSession",(new W).create(o,r,n,t,e)},Y.decorators=[{type:i.Injectable}],Y.ctorParameters=function(){return[{type:a.HttpClient},{type:String},{type:f},{type:i.Injector}]},Y);function Y(e,t,r,n){this.beBaseUri=t,this.injector=n,this.handlingStrategy=this.createHandlingStrategy(n,e,r,t)}var X,Z="@farris/bef NG_VARIABLE",$=I.makePropDecorator(Z,function(e){return e}),ee=(x(te,X=I.Repository),Object.defineProperty(te.prototype,"restService",{get:function(){return this.dataService.restService},enumerable:!0,configurable:!0}),Object.defineProperty(te.prototype,"changeBuilder",{get:function(){return this.entityManager.changeBuilder},enumerable:!0,configurable:!0}),Object.defineProperty(te.prototype,"changeHandler",{get:function(){return this.entityManager.changeHandler},enumerable:!0,configurable:!0}),te.prototype.getList=function(){return this.dataService.getList(null,null,null,null)},te.prototype.getById=function(e){return this.dataService.getById(e)},te.prototype.updateById=function(e){return this.dataService.updateById(e)},te.prototype.create=function(e){return this.dataService.create(e)},te.prototype.append=function(e){return this.dataService.append(e)},te.prototype.appendByPath=function(e){return this.dataService.appendByPath(e)},te.prototype.removeById=function(e,t){return this.dataService.removeById(e,t)},te.prototype.removeByIds=function(e,t){return this.dataService.removeByIds(e,t)},te.prototype.removeByPath=function(e,t){return this.dataService.removeByPath(e,t)},te.prototype.updateChangesById=function(e){return this.dataService.updateChangesById(e)},te.prototype.updateChangesByPath=function(e,t){throw new Error("Not Implement")},te.prototype.updateAllChanges=function(){return this.dataService.updateAllChanges()},te.prototype.applyChanges=function(){return this.dataService.applyChanges()},te.prototype.updateDataAndVariableChanges=function(){var e={FilterConditions:[],SortConditions:[],IsUsePagination:!0,Pagination:{PageIndex:1,PageSize:1,PageCount:0,TotalCount:0}},t=JSON.stringify(e),r=this.restService.buildRequestInfo();if(this.isEmptyRequestInfo(r))return b.of(null);var n=this.restService.baseUri+"/extension/query?entityFilter="+t,o={body:r};return this.restService.invoke(n,"PUT",null,o,!1,!0,!0)},te.prototype.applyChangesById=function(e){return this.dataService.applyChangesById(e)},te.prototype.cancelChanges=function(e){return this.dataService.cancelChanges(e)},te.prototype.clearAllEntityChanges=function(){return this.entityManager.clearAllEntityChanges()},te.prototype.getDataChangeDetails=function(){return this.entityManager.buildAllEntityChangeDetails()},te.prototype.handleDataChangeDetails=function(e){return this.entityManager.handleDataChangeDetails(e)},te.prototype.getVariableChangeDetail=function(){return this.variableManager.buildChangeDetail()},te.prototype.handleVariableChangeDetail=function(e){this.variableManager.handleChangeDetail(e)},te.prototype.isEmptyRequestInfo=function(e){return!e||(!e.dataChange||e.dataChange.length<1)&&(!e.variableChange||Object.keys(e.variableChange).length<1)},te.decorators=[{type:i.Injectable}],te.ctorParameters=function(){return[]},te);function te(){return X.call(this)||this}var re,ne=(x(oe,re=I.EntityManager),oe.prototype.buildAllEntityChangeDetails=function(){var r=this,n=[];return this.entityCollection.getAllEntities().forEach(function(e){if(0!==e.changes.length){var t=r.changeBuilder.build(e.changes);t&&t.ChangeInfo&&t.ChangeInfo.DataId&&n.push(t)}}),n},oe.prototype.buildEntityChangeDetailById=function(e){var t=this.entityCollection.getEntityById(e);return 0===t.changes.length?null:this.changeBuilder.build(t.changes)},oe.prototype.handleDataChangeDetails=function(e){this.changeHandler.handle(this.entityType,this.entityCollection,e)},oe.prototype.reset=function(){this.entityCollection.clear()},oe);function oe(e){var t=re.call(this,e)||this;return t.changeBuilder=new c(t.entityCollection.entityType,t.entityCollection),t.changeHandler=new y,t}var ie=(ae.createEmpty=function(e,t){var r={ChangeType:e,ChangeInfo:{}};return t&&(r.ChangeInfo.DataId=t),r},ae.getChangeInfo=function(e){return!0===this.isChangeDetail(e)?e.ChangeInfo:e},ae.isChangeDetail=function(e){var t=Object.keys(e);return 2===t.length&&-1<t.indexOf("ChangeType")&&-1<t.indexOf("ChangeInfo")},ae);function ae(){}var se=(pe.prototype.handleChangeDetail=function(e){var o=this,i=e.ChangeInfo;Object.keys(i).forEach(function(e){var t=o.ngVariableMap.get(e);if(t){var r=t.mapping,n=i[e];o.innerValueMap.get(e)!==n&&(o.setValueToUIState(r,n),o.innerValueMap.set(e,n))}})},pe.prototype.buildChangeDetail=function(){var i=this,a=ie.createEmpty(S.Modify);return this.ngVariableMap.forEach(function(e,t){var r=e.mapping,n=i.getValueFromUIState(r),o=i.innerValueMap.get(t);!1===i.isValueEqual(n,o)&&(i.innerValueMap.set(t,n),i.appendToChangeInfo(a,t,n))}),0===Object.keys(a.ChangeInfo).length?null:a},pe.prototype.reset=function(){this.innerValueMap.clear()},pe.prototype.appendToChangeInfo=function(e,t,r){if(!0===this.isUdtVariable(r)){var n=ie.createEmpty(S.Modify);n.ChangeInfo=r,e.ChangeInfo[t]=n}else e.ChangeInfo[t]=r},pe.prototype.getValueFromUIState=function(e){var t=this.getRootUIState(),r=e.split(".").reduce(function(e,t){return e?e[t]:null},t);return r instanceof Date?n.format(r,"yyyy-MM-dd HH:mm:ss"):r},pe.prototype.getRootUIState=function(){var e=this.appContext.frameContextManager.getRootFrameContext();if(this.injector){var t=this.injector.get(I.FrameContext,null);t&&(e=t.getVirtualRootFrameContext()||e)}if(e)return e.uiState},pe.prototype.isValueEqual=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},pe.prototype.isUdtVariable=function(e){return e&&e.constructor&&"[object Object]"===e.toString()&&e.constructor.prototype.hasOwnProperty("isPrototypeOf")},pe.prototype.setValueToUIState=function(e,t){this.getRootUIState()[e]=t},pe.ctorParameters=function(){return[{type:I.AppContext},{type:undefined},{type:i.Injector,decorators:[{type:i.Optional}]}]},pe);function pe(e,t,r){var n=this;this.appContext=e,this.ngVariables=t,this.injector=r,this.ngVariableMap=new Map,this.innerValueMap=new Map,Object.keys(t).forEach(function(e){n.ngVariableMap.set(e,t[e])})}var ue=(ce.buildRequestInfo=function(e){return{dataChange:e.entityManager.buildAllEntityChangeDetails(),variableChange:e.variableManager.buildChangeDetail()}},ce);function ce(){}var he=(ye.convertToPathArray=function(e,t){var n=this,r=I.BindingPathConverter.toBindingPathArray(e),o=[],i=t.list.currentItem;return o.push(i.primaryKeyValue),r.forEach(function(e){var t=I.PropertyUtil.getPropertyByName(i.properties,e);if(t.type!==I.BindingPropertyType.List)throw new Error(t.name+"不是子表对应的属性");var r=i[e];i=r.currentItem,o.push(n.trimTrailingS(e)),o.push(i.primaryKeyValue)}),o},ye.convertToPathUrl=function(e,t){var r=this.convertToPathArray(e,t);return r.pop(),"/"+r.join("/")},ye.convertToObjectCodes=function(e,t){for(var r=this.convertToPathArray(e,t),n=r.length,o=[],i=1;i<n;i+=2)o.push(r[i]);return o},ye.convertToDataIdsForUpdate=function(e,t){for(var r=this.convertToPathArray(e,t),n=r.length,o=[],i=0;i<n;i+=2)o.push(r[i]);return o},ye.convertToDataIdsForAdd=function(e,t){var r=this.convertToDataIdsForUpdate(e,t);return r.pop(),r},ye.convertPathToUrl=function(e){for(var t=e.split("/"),r=t.length-1;0<r;r--)t[r]&&t[r].endsWith("s")&&(t[r]=t[r].substr(0,t[r].length-1).toLowerCase());return t.join("/")},ye.trimTrailingS=function(e){return e.substr(0,e.length-1)},ye.convertPathsToNodeCodes=function(e){var t=[];return!e||e.length<1||e.filter(function(e){return!!e&&-1===e.indexOf(":")}).forEach(function(e){t.push(e)}),t},ye.convertPathsToIds=function(e){var t=[];return!e||e.length<1||e.filter(function(e){return!!e&&-1!==e.indexOf(":")}).forEach(function(e){t.push(e.split(":")[1])}),t},ye);function ye(){}var le=(Object.defineProperty(de.prototype,"restProxy",{get:function(){return this.repository.restService.proxy},enumerable:!0,configurable:!0}),de.prototype.getList=function(e,t,r,n){var p=this;0!==r&&(r=r||this.repository.entityCollection.pageSize,n=n||this.repository.entityCollection.pageIndex);var o=this.buildEntityFilter(e,t,r,n),i=this.restService.buildRequestInfo();return this.restProxy.extendQuery(o,i).pipe(d.map(function(e){var t=e.returnValue,r=t.result,n=[];r.forEach(function(e){var t=p.repository.buildEntity(e);C.appendInitialData(t,e),n.push(t)});var o=t.pagination;if(o&&0<Object.keys(o).length){var i=o.pageSize,a=o.pageIndex,s=o.totalCount;p.repository.entityCollection.updatePaginationInfoByPath("/",{pageIndex:a,pageSize:i,totalCount:s})}else p.repository.entityCollection.updatePaginationInfoByPath("/",{pageIndex:1,pageSize:0,totalCount:n.length});return p.repository.entityCollection.loadEntities(n),n}))},de.prototype.filter=function(e,t,r,n){var p=this;0!==r&&(r=r||this.repository.entityCollection.pageSize,n=n||this.repository.entityCollection.pageIndex);var o=this.buildEntityFilter(e,t,r,n),i=this.restService.buildRequestInfo();return this.restProxy.filter(o,i).pipe(d.map(function(e){var t=e.returnValue,r=t.result,n=[];r.forEach(function(e){var t=p.repository.buildEntity(e);C.appendInitialData(t,e),n.push(t)});var o=t.pagination;if(o&&0<Object.keys(o).length){var i=o.pageSize,a=o.pageIndex,s=o.totalCount;p.repository.entityCollection.updatePaginationInfoByPath("/",{pageIndex:a,pageSize:i,totalCount:s})}else p.repository.entityCollection.updatePaginationInfoByPath("/",{pageIndex:1,pageSize:0,totalCount:n.length});return p.repository.entityCollection.loadEntities(n),n}))},de.prototype.buildEntityFilter=function(e,t,r,n){return e||t||r||n?(e&&0<e.length&&(e[e.length-1].Relation=0),{FilterConditions:e,SortConditions:t,IsUsePagination:0!==r,Pagination:{PageIndex:n,PageSize:r,PageCount:0,TotalCount:0}}):null},de.prototype.getById=function(e){var n=this,t=this.restService.buildRequestInfo();return this.restService.extendRetrieve(e,t).pipe(d.map(function(e){var t=e.returnValue,r=n.repository.buildEntity(t);return n.repository.entityCollection.loadEntities([r]),r}))},de.prototype.getPagedById=function(o){var i=this,e=this.restService.buildRequestInfo(),t=this.repository.entityCollection.getPaginationConfigByPath("/"),r=this.buildChildPagination(t),n=this.buildRetrieveParam(r);return this.restService.serviceRetrieve(o,n,e).pipe(d.map(function(e){var t=e.dataResult,r=e.paginations;i.updatePagination(r);var n=i.repository.entityCollection.getEntityById(o);return i.reloadEntityData(n,t),n}))},de.prototype.queryChild=function(s,e,t,r,n){var p=this,o=this.restService.buildRequestInfo(),u=he.convertPathsToNodeCodes(s),i=u.map(function(e){return e.substring(0,e.length-1)}),a=he.convertPathsToIds(s),c=B({nodeCodes:i,ids:a,pagination:{pageIndex:e,pageSize:t}},o),h=u[u.length-1];return h=h.substring(0,h.length-1),this.restService.queryChild(c).pipe(d.map(function(e){console.log(e);var t=e.returnValue;if(!t)return null;var r=t.result,n=void 0===r?[]:r,o=t.pagination,i=void 0===o?{}:o,a=[];n.forEach(function(e){var t=new(I.FieldMetadataUtil.getNgList(p.repository.entityType)[u[u.length-1]].type)(e);C.appendInitialData(t,e),a.push(t)}),u=u.map(function(e){return e.charAt(0).toLocaleLowerCase()+e.substr(1)}),p.repository.entityCollection.resetEntities(s,a),p.repository.entityCollection.setPaginationConfigByPath("/"+h,i)}))},de.prototype.buildChildPagination=function(r){var n={};return Object.keys(r).forEach(function(e){var t=r[e];"object"==typeof t&&(n[e]=t)}),n},de.prototype.updatePagination=function(t){var r=this;t&&Object.keys(t).forEach(function(e){r.repository.entityCollection.setPaginationConfigByPath("/"+e,t[e])})},de.prototype.buildRetrieveParam=function(n){var e={};if(n&&0<Object.keys(n).length){var o=[];Object.keys(n).forEach(function(e){var t=n[e],r={};r[e]={pagination:{pageSize:t.pageSize||0,pageIndex:1}},o.push(r)}),e.filters=o}return e},de.prototype.editById=function(n){var o=this;if(!this.repository.entityCollection.getEntityById(n))return b.of(null);var e=ue.buildRequestInfo(this.repository);return this.restProxy.edit(n,e).pipe(d.map(function(e){var t=e.returnValue.data,r=o.repository.entityCollection.getEntityById(n);return r&&t&&o.reloadEntityData(r,t),r}))},de.prototype.updateById=function(n){var o=this;if(!this.repository.entityCollection.getEntityById(n))return b.of(null);var e=this.restService.buildRequestInfo();return this.restService.extendRetrieve(n,e).pipe(d.map(function(e){var t=e.returnValue,r=o.repository.entityCollection.getEntityById(n);return o.reloadEntityData(r,t),r}))},de.prototype.reloadEntityData=function(e,t){e&&(this.appContext.changeDetectionController.detach(),this.repository.entityCollection.updateEntity(e,t),e.changes.splice(0,e.changes.length),this.appContext.changeDetectionController.reattach())},de.prototype.create=function(e){var n=this,t=this.restService.buildRequestInfo();return this.restService.create(e,t).pipe(d.map(function(e){var t=e.returnValue,r=n.repository.buildEntity(t);return C.appendInitialData(r,t),n.repository.entityCollection.loadEntities([r]),r}))},de.prototype.append=function(e){var n=this,t=this.restService.buildRequestInfo();return this.restService.create(e,t).pipe(d.map(function(e){var t=e.returnValue,r=n.repository.buildEntity(t);return n.repository.entityCollection.addEntity(r),r}))},de.prototype.insert=function(n,e){var o=this,t=this.buildRequestInfo();return this.restProxy.create(e,t).pipe(d.map(function(e){var t=e.returnValue,r=o.repository.buildEntity(t);return o.repository.entityCollection.insertEntity(r,n),r}))},de.prototype.appendByPath=function(r){var n=this,e=this.restService.buildRequestInfo();return this.restService.createByPath(r,e).pipe(d.map(function(e){var t=e.returnValue;return n.repository.entityManager.appendEntityByPath(r,t,t)}))},de.prototype.insertByPath=function(r,n){var o=this,e=this.buildRequestInfo();return this.restProxy.createByPath(r,e).pipe(d.map(function(e){var t=e.returnValue;return o.repository.entityManager.insertEntityByPath(r,t,t,n)}))},de.prototype.removeById=function(e,t){var r=this;t=t===undefined||t;var n=ue.buildRequestInfo(this.repository);return t?this.restProxy.deleteAndSave(e,n).pipe(d.switchMap(function(){return r.repository.entityCollection.removeEntityById(e),b.of(!0)})):this.restService.extendDelete(e,n).pipe(d.switchMap(function(){return r.repository.entityCollection.removeEntityById(e),r.repository.dataChangeHistory.addChange({dataId:e,changeType:I.DataChangeType.Delete}),b.of(!0)}))},de.prototype.removeAndSaveById=function(e){var t=this,r=ue.buildRequestInfo(this.repository);return this.restProxy.deleteAndSave(e,r).pipe(d.switchMap(function(){return t.repository.entityCollection.removeEntityById(e),b.of(!0)}))},de.prototype.removeByIds=function(r,e){var n=this;e=e===undefined||e;var t=this.restService.buildRequestInfo();return this.restService.extendBatchDelete(r,t).pipe(d.switchMap(function(){if(e)return n.applyChangesByIdArray(r).pipe(d.tap(function(e){e&&n.repository.entityCollection.removeEntities(function(e){return n.checkEntityValueExists(e,r)})}));if(n.repository.entityCollection.removeEntities(function(e){return n.checkEntityValueExists(e,r)}),r&&0<r.length){var t=[];r.forEach(function(e){t.push({dataId:e,changeType:I.DataChangeType.Delete})}),n.repository.dataChangeHistory.addChanges(t)}return b.of(!0)}))},de.prototype.checkEntityValueExists=function(e,t){for(var r=!1,n=0;n<t.length;n++)if(e.primaryValue===t[n]){r=!0;break}return r},de.prototype.removeByPath=function(e,t){var r=this,n=this.restService.buildRequestInfo();return this.restService.extendDeletByPath(e,t,n).pipe(d.map(function(){return r.repository.entityManager.removeEntityByPath(e,t),r.repository.dataChangeHistory.addChange({fpath:e,dataId:t,changeType:I.DataChangeType.Delete}),!0}))},de.prototype.batchRemoveByPath=function(t,r){var n=this,e=this.restService.buildRequestInfo();return this.restService.batchDeleteByPath(t,r,e).pipe(d.map(function(){var e=r.split(",");return 0<e.length&&e.forEach(function(e){n.repository.entityManager.removeEntityByPath(t,e),n.repository.dataChangeHistory.addChange({fPath:t,dataId:e,changeType:I.DataChangeType.Delete})}),!0}))},de.prototype.updateChangesById=function(e){var t=this,r=this.repository.entityCollection.getEntityById(e);if(!r.changes)return b.of(!0);if(0===r.changes.length)return b.of(!0);var n=this.repository.entityManager.buildEntityChangeDetailById(e),o=this.restService.buildRequestInfo();return this.restService.update(n,o).pipe(d.tap(function(){t.repository.entityManager.clearEntityChangesById(e)}),d.map(function(){return!0}))},de.prototype.updateChangesByPath=function(e,t){throw new Error("Not Implement")},de.prototype.updateAllChanges=function(){var r=this,n=[],e=this.repository.entityCollection.toArray();return 0===e.length?b.of(!0):(e.forEach(function(e){var t=r.updateChangesById(e.primaryValue);n.push(t)}),b.zip.apply(void 0,D(n)).pipe(d.map(function(){return!0})))},de.prototype.applyChanges=function(){var e=this,t=this.restService.buildRequestInfo();return this.restService.save(t).pipe(d.tap(function(){e.repository.entityManager.clearAllEntityChanges(),e.repository.dataChangeHistory.clear()}),d.map(function(){return!0}))},de.prototype.applyChangesByIdArray=function(e){var t=this,r=this.restService.buildRequestInfo();return this.restService.save(r).pipe(d.tap(function(){t.repository.entityManager.clearEntityChangesByArray(e),t.repository.dataChangeHistory.clearByIds(e)}),d.map(function(){return!0}))},de.prototype.applyChangesById=function(e){var t=this,r=this.restService.buildRequestInfo();return this.restService.save(r).pipe(d.tap(function(){t.repository.entityManager.clearEntityChangesById(e),t.repository.dataChangeHistory.clearByIds([e])}),d.map(function(){return!0}))},de.prototype.cancelChanges=function(e){var t=this;return this.restService.cancel(e).pipe(d.tap(function(){t.repository.entityManager.clearAllEntityChanges(),t.repository.dataChangeHistory.clear()}),d.map(function(){return!0}))},de.prototype.batchAppendByPath=function(o,e){var i=this,t=this.buildRequestInfo();return this.restProxy.batchAppendByPath(o,e,t).pipe(d.map(function(e){var t=e.returnValue,r=i.repository.entityManager.createEntitiesByPath(o,t),n=o.split("/").filter(function(e){return e});return i.repository.entityManager.appendEntitiesByPath(n,r),r}))},de.prototype.batchAppend=function(e){var n=this,t=this.buildRequestInfo();return this.restProxy.batchAppend(e,t).pipe(d.map(function(e){var t=e.returnValue,r=n.repository.buildEntities(t);return n.repository.entityCollection.addEntities(r),r}))},de.prototype.buildRequestInfo=function(){return{dataChange:this.repository.entityManager.buildAllEntityChangeDetails(),variableChange:this.repository.variableManager.buildChangeDetail()}},de);function de(e,t){this.injector=e,this.repository=t;var r=e.get(f),n=e.get(a.HttpClient),o=e.get(p)+"/"+this.repository.apiUri,i=e.get(I.EventBus);this.restService=new we(n,o,r,this.repository,i),this.appContext=e.get(I.AppContext)}var fe=(ge.handleMessage=function(e,t,r){var n={ns:t.get(I.NAMESPACE,null),appContext:t.get(I.AppContext,null)},o=this.buildBackEndMessages(e),i=new I.BackEndMessage.Message(o,n),a=t.get(I.BACK_END_MESSAGE_HANDLER_TOKEN,null);a&&a.handle(i,r)},ge.isBackEndMessageHandlerExist=function(e){return!!e.get(I.BACK_END_MESSAGE_HANDLER_TOKEN,null)},ge.getFormlessMessages=function(e){return(this.buildBackEndMessages(e)||[]).filter(function(e){return!e.location||!e.location.columns||e.location.columns.length<1||!e.location.nodeCode})},ge.buildBackEndMessages=function(e){if(!e||e.length<1||!Array.isArray(e))return null;var r=[];return e.forEach(function(e){var t={level:e.level,message:e.message};e.hasOwnProperty("location")&&e.location&&(t.location={nodeCode:e.location.nodeCode,rows:e.location.dataIds,columns:e.location.columnNames}),r.push(t)}),r},ge);function ge(){}var ve=(Ie.getSessionId=function(e,t){var r=e.ApplicationId+"_"+t.beBaseUri;return this.createSessionHistory.includes(r)?b.of(null):(this.createSessionHistory.push(r),t.getBeSessionId())},Ie.createSessionHistory=[],Ie.decorators=[{type:i.Injectable}],Ie);function Ie(){}var Se=(be.prototype.onResponse=function(e,t){e&&e.innerDataChange&&!0!==t&&this.context.handleDataChangeDetails(e.innerDataChange),e&&e.innerVariableChange&&this.context.handleVariableChangeDetail(e.innerVariableChange);var r=A.parseBackEndMessage(e);return fe.handleMessage(r,this.context.getInjector()),this.context.clearAllEntityChanges(),e&&e.hasOwnProperty("returnValue")?e.returnValue:e},be.prototype.onError=function(e,t,r){var n,o,i=this.context.appContext.getFormAppContext(),a=i.ApplicationId,s=window.DEVKIT_LOADING_SERVICE,p=A.parseBackEndError(e);if(fe.handleMessage(p,this.context.getInjector()),s&&s instanceof Array&&0<s.length)try{for(var u=P(s),c=u.next();!c.done;c=u.next()){var h=c.value;"function"==typeof h.clearAll&&h.clearAll()}}catch(S){n={error:S}}finally{try{c&&!c.done&&(o=u["return"])&&o.call(u)}finally{if(n)throw n.error}}if(t)return b.throwError(e);var y=this.context.restService.eventBus,l=!!(window[a]||{}).isExceptionHandlerExist,d=A.parseBackEndError(e),f=fe.getFormlessMessages(d),g=f&&0<f.length||!1,v=!(e&&e.error&&e.error.extensionMessage&&fe.isBackEndMessageHandlerExist(this.context.getInjector())&&!g),I=!!y&&l&&v;return fe.handleMessage(d,this.context.getInjector(),{hasThrowError:I,isException:!0,eventBus:y,error:e,formAppContext:i}),y&&l&&!A.isReported401Error(e)?(v&&y.post("Exception","","onException",e,i),r?b.of(null):b.EMPTY):b.throwError(e)},be.prototype.extendHeaders=function(t,r){var n=this,e=this.context.appContext.getFormAppContext();return ve.getSessionId(e,this.context.restService.sessionService).pipe(d.switchMap(function(e){return t=n.context.restService.sessionService.extendRequestHeaders(t,r),b.of(t)}))},be.prototype.extendUrl=function(e,t){if(!t)return e;for(var r in t)if(t.hasOwnProperty(r)){var n=JSON.stringify(t[r]);e=-1===e.indexOf("?")?e+"?"+r+"="+n:e+"&"+r+"="+n}return e},be.prototype.extendBody=function(t){var r=this;return!t||"object"!=typeof t||Object.keys(t).length<1||(Object.keys(t).forEach(function(e){"requestInfo"===e&&(t.requestInfo=r.context.restService.buildRequestInfo())}),1===Object.keys(t).length&&(t=Object.values(t)[0])),t},be.prototype.parseHeaders=function(e){var t="BEFSessionID";e.headers&&e.headers.has(t)&&this.context.restService.sessionService.setBeSessionId(e.headers.get(t))},be);function be(e){this.context=e}var Ce,me=(x(Ee,Ce=ee),Object.defineProperty(Ee.prototype,"proxy",{get:function(){return this.befProxy},set:function(e){this.befProxy=e,this.befProxy.setProxyExtend(new Se(this))},enumerable:!0,configurable:!0}),Ee.prototype.getEntities=function(e,t,r,n){return this.dataService.getList(e,t,r,n)},Ee.prototype.filter=function(e,t,r,n){return void 0===e&&(e=[]),void 0===t&&(t=[]),this.dataService.filter(e,t,r,n)},Ee.prototype.getPagedById=function(e){return this.dataService.getPagedById(e)},Ee.prototype.queryChild=function(e,t,r,n,o){return this.dataService.queryChild(e,t,r,n,o)},Ee.prototype.getEntityById=function(e){return this.dataService.getById(e)},Ee.prototype.updateEntityById=function(e){return this.dataService.updateById(e)},Ee.prototype.editEntityById=function(e){return this.dataService.editById(e)},Ee.prototype.createEntity=function(e){return this.dataService.create(e)},Ee.prototype.appendEntity=function(e){return this.dataService.append(e)},Ee.prototype.insert=function(e,t){return this.dataService.insert(e,t)},Ee.prototype.insertByPath=function(e,t){return this.dataService.insertByPath(e,t)},Ee.prototype.appendEntityByPath=function(e){return this.dataService.appendByPath(e)},Ee.prototype.removeEntityById=function(e,t){return this.dataService.removeById(e,t)},Ee.prototype.removeEntityAndSaveById=function(e){return this.dataService.removeAndSaveById(e)},Ee.prototype.removeEntityByPath=function(e,t){return this.dataService.removeByPath(e,t)},Ee.prototype.batchRemoveByPath=function(e,t){return this.dataService.batchRemoveByPath(e,t)},Ee.prototype.saveEntityById=function(e){return this.dataService.applyChangesById(e)},Ee.prototype.saveEntities=function(){return this.dataService.applyChanges()},Ee.prototype.cancelEntityChanges=function(){return this.dataService.cancelChanges()},Ee.prototype.batchAppendByPath=function(e,t){return this.dataService.batchAppendByPath(e,t)},Ee.prototype.batchAppend=function(e){return this.dataService.batchAppend(e)},Ee.prototype.reset=function(){this.entityManager.reset(),this.variableManager.reset(),this.restService.sessionService.clearBeSessionId()},Ee.prototype.getInjector=function(){return this.injector},Ee.decorators=[{type:i.Injectable}],Ee.ctorParameters=function(){return[{type:i.Injector}]},Ee);function Ee(e){var t=Ce.call(this)||this;t.injector=e,t.entityManager=new ne(t.entityCollection),t.appContext=t.injector.get(I.AppContext);var r=I.MetadataUtil.getPropsMetadatasByName(t.constructor,Z);return t.variableManager=new se(t.appContext,r,t.injector),t.dataService=new le(t.injector,t),t.serverUri=e.get(p),t}var xe=(Be.prototype.extendUri=function(e){return this.serverUri+"/"+e},Be.decorators=[{type:i.Injectable}],Be.ctorParameters=function(){return[{type:String,decorators:[{type:i.Inject,args:[p]}]}]},Be);function Be(e){this.serverUri=e}var Pe="DELETE",Re="PUT",De="POST",qe=(Oe.prototype.setBaseUri=function(e){this.baseUri=e},Oe.prototype.setProxyExtend=function(e){this.proxyExtend=e},Oe.prototype.query=function(e){var t=this.baseUri;return e&&(t=t+"?entityFilter="+JSON.stringify(e)),this.request(t,"GET")},Oe.prototype.extendQuery=function(e,t){var r=this.baseUri+"/extension/query";if(e){var n=JSON.stringify(e);r=r+"?entityFilter="+(n=I.encodeUrl(n))}var o=t,i=this.addBodyToOptions({},o);return this.request(r,Re,null,i,!1)},Oe.prototype.filter=function(e,t){var r=this.baseUri+"/extension/filter",n={requestInfo:t};e&&(n={entityFilter:e,requestInfo:t});var o=this.addBodyToOptions({},n);return this.request(r,De,null,o,!1)},Oe.prototype.retrieve=function(e){var t=this.baseUri+"/"+e;return this.request(t,"GET")},Oe.prototype.serviceRetrieve=function(e,t,r){var n=this.baseUri+"/service/retrieve/"+e,o={body:{retrieveParam:t,requestInfo:r}};return this.request(n,Re,null,o)},Oe.prototype.queryChild=function(e){var t=this.baseUri+"/service/querychild",r={body:e};return this.request(t,Re,null,r)},Oe.prototype.extendRetrieve=function(e,t){var r=this.baseUri+"/extension/retrieve/"+e,n=t,o=this.addBodyToOptions({},n);return this.request(r,Re,null,o)},Oe.prototype.edit=function(e,t){var r=this.baseUri+"/service/edit/"+e,n=t,o=this.addBodyToOptions({},n);return this.request(r,Re,null,o)},Oe.prototype.create=function(e,t){var r={defaultValue:e,requestInfo:t},n=this.addBodyToOptions({},r);return this.request(this.baseUri,De,null,n)},Oe.prototype.createByPath=function(e,t){var r=he.convertPathToUrl(e),n=""+this.baseUri+r,o=t,i=this.addBodyToOptions({},o);return this.request(n,De,null,i)},Oe.prototype.update=function(e,t){var r={changeDetail:e,requestInfo:t},n=this.addBodyToOptions({},r);return this.request(this.baseUri,"PATCH",null,n)},Oe.prototype.save=function(e){var t=e,r=this.addBodyToOptions({},t);return this.request(this.baseUri,Re,null,r)},Oe.prototype["delete"]=function(e){var t=this.baseUri+"/"+e;return this.request(t,Pe)},Oe.prototype.deleteAndSave=function(e,t){var r=this.baseUri+"/service/delete/"+e,n=t,o=this.addBodyToOptions({},n);return this.request(r,Re,null,o)},Oe.prototype.extendDelete=function(e,t){var r=this.baseUri+"/extension/delete/"+e,n=t,o=this.addBodyToOptions({},n);return this.request(r,Re,null,o)},Oe.prototype.deletByPath=function(e,t){var r=he.convertPathToUrl(e),n=""+this.baseUri+r+"/"+t;return this.request(n,Pe)},Oe.prototype.extendDeletByPath=function(e,t,r){var n=he.convertPathToUrl(e),o=this.baseUri+"/extension"+n+"/"+t,i=r,a=this.addBodyToOptions({},i);return this.request(o,Re,null,a)},Oe.prototype.batchDeleteByPath=function(e,t,r){var n=he.convertPathToUrl(e);if(n.split("/").length<3)throw Error("根据path删除实体数据出错了。传入的path["+e+"]格式不对");var o=this.baseUri+"/extension"+n+"/batch",i={ids:t.split(","),requestInfo:r},a=this.addBodyToOptions({},i);return this.request(o,Re,null,a)},Oe.prototype.batchDelete=function(e){var t={ids:e.join(",")};return this.request(this.baseUri,Pe,t)},Oe.prototype.extendBatchDelete=function(e,t){var r=this.baseUri+"/extension/batchdelete",n={ids:e.join(",")},o=t,i=this.addBodyToOptions({},o);return this.request(r,Re,n,i)},Oe.prototype.cancel=function(e){var t=this.baseUri+"/service/cancel";return this.request(t,De,null,null,!1,!1,!1,e)},Oe.prototype.batchAppendByPath=function(e,t,r){var n=he.convertPathToUrl(e),o=""+this.baseUri+n+"/batch",i={requestInfo:r,retrieveDefaultParam:{defaultValues:t}},a=this.addBodyToOptions({},i);return this.request(o,De,null,a)},Oe.prototype.batchAppend=function(e,t){var r=this.baseUri+"/batch",n={requestInfo:t,retrieveDefaultParam:{defaultValues:e}},o=this.addBodyToOptions({},n);return this.request(r,De,null,o)},Oe.prototype.request=function(t,r,e,n,o,i,a,s){var p=this;n=n||{},void 0!==o&&"boolean"==typeof o||(o=!1),void 0!==i&&"boolean"==typeof i||(i=!1),e&&(n.params=e),n.headers=q.convertToHeaders(n.headers);var u=this.hasRequestInfo(n);return n&&n.body&&n.body.hasOwnProperty("RequestInfo")&&(n.body.requestInfo=n.body.RequestInfo,delete n.body.RequestInfo),this.proxyExtend.extendHeaders(n.headers,s).pipe(d.switchMap(function(e){return n.headers=q.toJson(e),n.observe="response",p.httpService.request(r,t,n)}),d.tap(function(e){return p.proxyExtend.parseHeaders(e)}),d.map(function(e){return e.body}),d.map(function(e){return u?(p.proxyExtend.onResponse(e,a),e):p.unWrapResponseInfo(e)}),d.catchError(function(e){return p.proxyExtend.onError(e,o,i)}))},Oe.prototype.invoke=function(t,r,n){var o=this;return n.params&&(t=this.proxyExtend.extendUrl(t,n.params),n.params=null),n.body&&(n.body=this.proxyExtend.extendBody(n.body)),n.headers=q.convertToHeaders(n.headers),this.proxyExtend.extendHeaders(n.headers).pipe(d.switchMap(function(e){return n.headers=q.toJson(e),n.observe="response",o.httpService.request(r,t,n).pipe(d.tap(function(e){return o.proxyExtend.parseHeaders(e)}),d.map(function(e){return e.body}),d.map(function(e){return o.proxyExtend.onResponse(e)}),d.catchError(function(e){return o.proxyExtend.onError(e,!1,!1)}))}))},Oe.prototype.addBodyToOptions=function(e,t){return e=e||{},Object.assign(e,{body:t})},Oe.prototype.buildParams=function(e){return w.buildParams(e)},Oe.prototype.hasRequestInfo=function(e){return T.hasRequestInfo(e)||T.hasRequestInfoWithR(e)},Oe.prototype.unWrapResponseInfo=function(e){return A.unWrapResponseInfo(e)},Oe.decorators=[{type:i.Injectable}],Oe.ctorParameters=function(){return[{type:a.HttpClient},{type:xe}]},Oe);function Oe(e,t){this.httpClient=e,this.uriService=t,this.httpService=new H(this.httpClient)}var we=(Object.defineProperty(Me.prototype,"proxy",{get:function(){return this.repository.proxy?this.repository.proxy:this.createBefProxy()},enumerable:!0,configurable:!0}),Me.prototype.createBefProxy=function(){var e=this.repository.serverUri,t=new xe(e),r=new qe(this.httpClient,t);r.setBaseUri(this.baseUri);var n=new Se(this.repository);return r.setProxyExtend(n),r},Me.prototype.query=function(e){return this.proxy.query(e)},Me.prototype.extendQuery=function(e,t){return this.proxy.extendQuery(e,t)},Me.prototype.serviceRetrieve=function(e,t,r){return this.proxy.serviceRetrieve(e,t,r)},Me.prototype.queryChild=function(e){return this.proxy.queryChild(e)},Me.prototype.retrieve=function(e){return this.proxy.retrieve(e)},Me.prototype.extendRetrieve=function(e,t){return this.proxy.extendRetrieve(e,t)},Me.prototype.create=function(e,t){return this.proxy.create(e,t)},Me.prototype.createByPath=function(e,t){return this.proxy.createByPath(e,t)},Me.prototype.update=function(e,t){return this.proxy.update(e,t)},Me.prototype.save=function(e){return this.proxy.save(e)},Me.prototype["delete"]=function(e){return this.proxy["delete"](e)},Me.prototype.extendDelete=function(e,t){return this.proxy.extendDelete(e,t)},Me.prototype.deletByPath=function(e,t){return this.proxy.deletByPath(e,t)},Me.prototype.extendDeletByPath=function(e,t,r){return this.proxy.extendDeletByPath(e,t,r)},Me.prototype.batchDeleteByPath=function(e,t,r){return this.proxy.batchDeleteByPath(e,t,r)},Me.prototype.batchDelete=function(e){return this.proxy.batchDelete(e)},Me.prototype.extendBatchDelete=function(e,t){return this.proxy.extendBatchDelete(e,t)},Me.prototype.cancel=function(e){return this.proxy.cancel(e)},Me.prototype.request=function(e,t,r,n,o,i,a){return this.innerRequest(e,t,r,n,o,i,a,!1)},Me.prototype.invoke=function(e,t,r,n,o,i,a){if(n&&n.body&&n.body.RequestInfo)throw new Error("请使用requestInfo提交变更");return this.innerRequest(e,t,r,n,o,i,a,!0)},Me.prototype.innerRequest=function(t,r,e,n,o,i,a,s){var p=this;n=n||{};var u="BEFSessionID";void 0!==o&&"boolean"==typeof o||(o=!1),void 0!==i&&"boolean"==typeof i||(i=!1),void 0!==s&&"boolean"==typeof s||(s=!1);var c=s?this.existRequestInfo:this.hasRequestInfo;e&&(n.params=e);var h=c(n),y=q.convertToHeaders(n.headers),l=this.repository.appContext.getFormAppContext();return ve.getSessionId(l,this.sessionService).pipe(d.switchMap(function(e){return y=p.sessionService.extendRequestHeaders(y),n.headers=q.toJson(y),n.observe="response",p.httpService.request(r,t,n)}),d.tap(function(e){e.headers&&e.headers.has(u)&&p.sessionService.setBeSessionId(e.headers.get(u))}),d.map(function(e){return e.body}),d.map(function(e){var t=A.parseBackEndMessage(e);return fe.handleMessage(t,p.repository.getInjector()),p.handleReponseInfo(e,h,a)}),d.catchError(function(e){return p.handleErrors(e,o,i)}))},Me.prototype.handleReponseInfo=function(e,t,r){return t?(e&&e.innerDataChange&&!0!==r&&this.repository.handleDataChangeDetails(e.innerDataChange),e&&e.innerVariableChange&&this.repository.handleVariableChangeDetail(e.innerVariableChange),this.repository.clearAllEntityChanges(),e):this.unWrapResponseInfo(e)},Me.prototype.handleErrors=function(e,t,r){if(this.clearLoading(),t)return b.throwError(e);var n=this.repository.appContext.getFormAppContext(),o=n.ApplicationId,i=window[o]||{},a=A.parseBackEndError(e),s=fe.getFormlessMessages(a),p=!!i.isExceptionHandlerExist,u=s&&0<s.length||!1,c=!(e&&e.error&&e.error.extensionMessage&&fe.isBackEndMessageHandlerExist(this.repository.getInjector())&&!u),h=!!this.eventBus&&p&&c;return fe.handleMessage(a,this.repository.getInjector(),{hasThrowError:h,isException:!0,eventBus:this.eventBus,error:e,formAppContext:n}),this.eventBus&&p&&!A.isReported401Error(e)?(c&&this.eventBus.post("Exception","","onException",e,n),r?b.of(null):b.EMPTY):b.throwError(e)},Me.prototype.clearLoading=function(){var e,t;if(!1!==(window.DEVKIT_LOADING_SERVICE&&window.DEVKIT_LOADING_SERVICE instanceof Array&&0<window.DEVKIT_LOADING_SERVICE.length||!1)){var r=window.DEVKIT_LOADING_SERVICE;try{for(var n=P(r),o=n.next();!o.done;o=n.next()){var i=o.value;"function"==typeof i.clearAll&&i.clearAll()}}catch(a){e={error:a}}finally{try{o&&!o.done&&(t=n["return"])&&t.call(n)}finally{if(e)throw e.error}}}},Me.prototype.unWrapResponseInfo=function(e){return A.unWrapResponseInfo(e)},Me.prototype.hasRequestInfo=function(e){return T.hasRequestInfoWithR(e)},Me.prototype.existRequestInfo=function(e){return T.hasRequestInfo(e)},Me.prototype.buildParams=function(e){return w.buildParams(e)},Me.prototype.buildBodyWithRequestInfo=function(e){return T.buildBodyWithRequestInfo(e,this.repository)},Me.prototype.buildRequestInfo=function(){return T.buildRequestInfo(this.repository)},Me.decorators=[{type:i.Injectable}],Me.ctorParameters=function(){return[{type:a.HttpClient},{type:String},{type:f},{type:me},{type:I.EventBus}]},Me);function Me(e,t,r,n,o){this.httpClient=e,this.httpService=new H(this.httpClient),this.baseUri=t;var i=n.getInjector();this.sessionService=new Q(e,t,r,i),this.repository=n,this.eventBus=o}var Te=(je.prototype.getData=function(e,t){var r=e.split(".")[0],n=e.split(".")[1];return t=t||{},!0===this.ifEnableExtendLoadMethod(e)?this.extendGetHelpData(n,r,t):this.getHelpData(n,r,t)},je.prototype.saveUserSettings=function(e){return this.befRepository.restService.invoke("/api/runtime/bcc/v1.0/datagrid/settings","POST",null,{body:e},!1)},je.prototype.getUserSettings=function(e){var t="/api/runtime/bcc/v1.0/datagrid/settings/"+e;return this.befRepository.restService.invoke(t,"GET",null,null,!1)},je.prototype.ifEnableExtendLoadMethod=function(e){if(this.context&&this.context.hasOwnProperty("enableExtendLoadMethod"))return this.context.enableExtendLoadMethod;var t=!1;if(this.frameContext){var r=e+"@"+this.frameContext.repository.apiUri;t=this.frameContext.getParam(r)}return t},je.prototype.getHelpData=function(e,t,r){var n=this,o=this.befRepository.restService.baseUri+"/elementhelps/"+e;return this.befRepository.updateDataAndVariableChanges().pipe(d.switchMap(function(){return n.befRepository.restService.invoke(o,"GET",{nodeCode:t,queryParam:JSON.stringify(r)},null,!1)}))},je.prototype.extendGetHelpData=function(e,t,r){var n=this.befRepository.restService.baseUri+"/extension/elementhelps",o={body:{labelId:e,nodeCode:t,queryParam:r,requestInfo:this.befRepository.restService.buildRequestInfo()}};return this.befRepository.restService.invoke(n,"PUT",null,o,!1,!0,!0).pipe(d.map(function(e){return e&&e.returnValue||null}))},je.prototype.convert2TreeDataWithPathCode=function(n,t,r){var o=this;void 0===t&&(t=1),void 0===r&&(r="01");var e=n.filter(function(e){return e.layer===t&&e.pathcode===r});if(1<t&&(e=n.filter(function(e){return e.layer===t&&e.pathcode.substr(0,2*(t-1))===r})),e.length){var i=e.map(function(e){return{data:e,children:[]}});return i.forEach(function(e){var t,r=o.convert2TreeDataWithPathCode(n,e.data.layer+1,e.data.pathcode);(t=e.children).push.apply(t,D(r))}),i}},je.decorators=[{type:i.Injectable}],je.ctorParameters=function(){return[{type:I.Repository},{type:I.FrameContext,decorators:[{type:i.Optional}]}]},je);function je(e,t){this.frameContext=t,this.befRepository=e}var Ae=(Ue.prototype.createSession=function(e){var t=this.sessionService.getUserSessionId();return t?this.befRepository.restService.invoke(e,"POST",null,{headers:new a.HttpHeaders({SessionId:t}),responseType:"text"},!1).pipe(d.switchMap(function(e){return b.of({status:!0,payload:e})})):b.of({status:!1,payload:"用户登录信息已过期,请重新登录"})},Ue.prototype.getData=function(e,t){var r=this,n={};t.condition&&(n=t.condition),"/"===e[e.length-1]&&(e=e.substr(0,e.length-1));var o=e+"/extension/query",i=e+"/service/createsession";if(n){var a=JSON.stringify(n);o=o+"?entityFilter="+a}return this.createSession(i).pipe(d.switchMap(function(e){if(e.status)return e.payload,r.befRepository.restService.invoke(o,"PUT",null,{},!1);throw new Error(e.payload)}),s.map(function(e){var t=e.returnValue,r={items:t.result};return t.pagination?Object.assign({},r,{total:t.pagination.totalCount,pageInfo:{pageSize:t.pagination.pageSize,pageIndex:t.pagination.pageIndex,enablePager:!0}}):r}))},Ue.decorators=[{type:i.Injectable}],Ue.ctorParameters=function(){return[{type:I.Repository},{type:f}]},Ue);function Ue(e,t){this.sessionService=t,this.befRepository=e}var He=(Ve.isExistUnsaveData=function(e){var t=!1;if(!e||!e.entityCollection)throw"Current Object is null or it's entityCollection is null.";var r=e.entityCollection.toArray();if(e.dataChangeHistory.isChanged())return!0;for(var n=0;n<r.length;n++)if(0<r[n].changes.length){t=!0;break}return t},Ve);function Ve(){}var ke=(Fe.prototype.toString=function(){return this.url},Fe);function Fe(e,t){void 0===t&&(t=null);var r=this;this.url=e,this.paths=t,this.paths&&Object.keys(t).forEach(function(e){-1!==r.url.indexOf("{"+e+"}")&&(r.url=r.url.replace("{"+e+"}",""+t[e]))})}var Ne=(_e.prototype.getData=function(e,t,r){void 0===t&&(t={}),void 0===r&&(r="GET");var n=new a.HttpHeaders({"content-type":"application/json"});return"get"!==r.toLowerCase()?this.befRest.restService.invoke(e,r,null,{headers:n,body:t}):this.befRest.restService.invoke(e,r,t,{headers:n})},_e.decorators=[{type:i.Injectable}],_e.ctorParameters=function(){return[{type:I.Repository}]},_e);function _e(e){this.befRest=e}var Le=(Ke.prototype.getData=function(e,t,r){void 0===t&&(t={}),void 0===r&&(r="GET");var n=new a.HttpHeaders({"content-type":"application/json"});return this.befRest.restService.invoke(e,r,t,{headers:n})},Ke.decorators=[{type:i.Injectable}],Ke.ctorParameters=function(){return[{type:I.Repository}]},Ke);function Ke(e){this.befRest=e}e.VERSION="ver.",e.ChangeDetailType=S,e.BE_SERVER_URI_TOKEN=p,e.BE_SESSION_HANDLING_STRATEGY_TOKEN=u,e.BefChangeBuilder=c,e.BefChangeHandler=y,e.BefSessionService=Q,e.BefRestService=we,e.BefProxy=qe,e.BefLookupRestService=Te,e.BefLookupDefaultService=Ae,e.BefRepository=me,e.FrameworkSessionService=f,e.NG_VARIABLE=Z,e.NgVariable=$,e.BefRepositoryUtil=He,e.BefDataPathUtil=he,e.UriService=xe,e.Uri=ke,e.DefaultComboHttpService=Ne,e.DefaultDynamiControlGroupHttpService=Le,e.ɵa=ee,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@ecp-caf/caf-common"),require("date-fns"),require("rxjs"),require("rxjs/operators"),require("rxjs/operators/map"),require("@angular/core"),require("@farris/devkit"),require("@angular/common/http")):"function"==typeof define&&define.amd?define("@farris/bef",["exports","@ecp-caf/caf-common","date-fns","rxjs","rxjs/operators","rxjs/operators/map","@angular/core","@farris/devkit","@angular/common/http"],t):t((e.farris=e.farris||{},e.farris.bef={}),e.cafCommon,e.dateFns,e.rxjs,e.rxjs.operators,e.rxjs["operators/map"],e.ng.core,e.devkit,e.ng.common.http)}(this,function(e,t,n,b,d,s,i,I,a){"use strict";var S=(r.Added="Added",r.Modify="Modify",r.Deleted="Deleted",r);function r(){}var p=new i.InjectionToken("@farris/be BE_SERVER_URL"),u=new i.InjectionToken("@farris/be BE_SESSION_HANDLING_STRATEGY_TOKEN"),C=(o.getPropInfo=function(e,t){var r,n,o,i=I.FieldMetadataUtil.getNgFields(e);Object.keys(i).forEach(function(e){e===t&&(r="NgField",n=null,o=i[e])});var a=I.FieldMetadataUtil.getNgObjects(e);Object.keys(a).forEach(function(e){e===t&&(r="NgObject",n=a[e].type,o=a[e])});var s=I.FieldMetadataUtil.getNgList(e);Object.keys(s).forEach(function(e){e===t&&(r="NgList",n=s[e].type,o=s[e])});var p=I.FieldMetadataUtil.getNgDynamic(e);return Object.keys(p).forEach(function(e){e===t&&(r="NgDynamic",n=p[e].type,o=p[e])}),{propType:r,propEntityType:n,propMetadata:o}},o.getPrimaryKey=function(e){var t=I.FieldMetadataUtil.getPrimaryFieldMetadata(e);return t?t.dataField:""},o.isObjectProp=function(e,t){var r=!1,n=I.FieldMetadataUtil.getNgObjects(e);return Object.keys(n).forEach(function(e){e===t&&(r=!0)}),r},o.isDynamicProp=function(e,t){var r=!1,n=I.FieldMetadataUtil.getNgDynamic(e);return Object.keys(n).forEach(function(e){e===t&&(r=!0)}),r},o.appendInitialData=function(e,t){var r=Object.assign({},t);delete r.id,delete r.parentID,e.initialData=r},o);function o(){}var c=(h.prototype.build=function(e){var t=this;return this.changeDetail={ChangeType:S.Modify,ChangeInfo:{DataId:""}},e.forEach(function(e){t.buildChangeDetail(e)}),this.changeDetail},h.prototype.buildChangeDetail=function(l){var d=l.path.concat();this.changeDetail.ChangeInfo.DataId||(this.changeDetail.ChangeInfo.DataId=d[0].split(":")[1]);for(var f=this.changeDetail,g=this.entityType,e=function(e){var t=v.getChangeInfo(f),r=d[e],n=C.getPropInfo(g,r),o=n.propType,i=n.propEntityType,a=n.propMetadata.dataField||r;if("NgField"===o){if(r===C.getPrimaryKey(g))return"continue";if(l.type!==I.ModifyType.ValueChange)throw Error("简单类型的属性上不支持ValueChange类型之外的变更");t[a]=l.value,f=null}else if("NgObject"===o)if(d[e+1].split(":")[1],d[e+1].split(":")[0]){var s=t[a],p=d.slice(0,e+1);s=(y=v.entityCollection.getEntityByPath(p))?y.toJSON(!0):{},t[a]=s,g=f=null}else c=(c=t[a])||{ChangeType:S.Modify,ChangeInfo:{}},t[a]=c,f=c,g=i;else if("NgList"===o){f.ChangeInfo[a]||(f.ChangeInfo[a]=[]);var u=f.ChangeInfo[a];if(e!==d.length-1){var c,h=d[e+1].split(":")[1];return(c=u.find(function(e){return e.ChangeInfo.DataId===h}))||(c=v.createEmptyChangeDetail(S.Modify,h),u.push(c)),f=c,g=i,"continue"}l.type===I.ModifyType.Add||l.type===I.ModifyType.Insert||(l.type,I.ModifyType.Remove),g=f=null}else if("NgDynamic"===o){p=d.slice(0,e+1);var y=v.entityCollection.getEntityByPath(p);t[a]={ChangeType:S.Modify,ChangeInfo:y?y.toJSON(!0):{}},g=f=null}},v=this,t=1;t<d.length&&f;t+=2)e(t)},h.prototype.getChangeInfo=function(e){return e.hasOwnProperty("ChangeInfo")?e.ChangeInfo:e},h.prototype.createEmptyChangeDetail=function(e,t){return{ChangeType:e,ChangeInfo:{DataId:t}}},h);function h(e,t){this.entityType=e,this.entityCollection=t}var y=(l.prototype.handle=function(e,t,r){this.handleChangeDetails(e,t,r)},l.prototype.handleChangeDetails=function(n,o,e){var i=this;e&&e.forEach(function(e){var t=e.ChangeInfo.dataId||e.ChangeInfo.DataId,r=i.getEntityById(o,t);r&&i.handleChangeDetail(n,r,e)})},l.prototype.handleChangeDetail=function(u,c,e){var h=this;if(e&&c&&e.ChangeType===S.Modify){var y=e.ChangeInfo;Object.keys(y).forEach(function(e){var t=C.getPropInfo(u,e),r=t.propType,n=t.propEntityType;if("NgField"===r)c[e]=y[e];else if("NgObject"===r){var o=c[e];if(o.primaryKey){var i=y[e];o.load(i)}else{var a=y[e];h.handleChangeDetail(n,o,a)}}else if("NgList"===r){var s=c[e],p=y[e];h.handleChangeDetails(n,s,p)}})}},l.prototype.getEntityById=function(e,t){return(e instanceof I.EntityCollection?e.getEntityById(t):e.get(t))||null},l);function l(){}var f=(g.prototype.getUserSessionId=function(){return this.sessionService.getUserSessionId()},g.prototype.getCurrentSessionId=function(e){var t;if(this.sessionService)if(e&&e.hasOwnProperty("tabId")){var r=e.tabId;t=this.sessionService.getCurrentSeesionId(r)}else t=this.sessionService.getCurrentSeesionId();return t=t||this.getUserSessionId()},g.decorators=[{type:i.Injectable}],g.ctorParameters=function(){return[{type:t.SessionService,decorators:[{type:i.Optional}]}]},g);function g(e){this.sessionService=e}var v=(m.prototype.getItem=function(e){return this.getAllBeSessions()[e]},m.prototype.setItem=function(e,t){var r=this.getAllBeSessions();r[e]=t,this.setAllBeSessions(r)},m.prototype.removeItem=function(e){var t=this.getAllBeSessions();t[e]&&delete t[e],this.setAllBeSessions(t)},m.prototype.clear=function(e,t){!0===this.isInFramework()?this.removeItemsByFrmSessionId(e):this.removeItem(t)},m.prototype.removeItemsByFrmSessionId=function(t){var r=this.getAllBeSessions();Object.keys(r).forEach(function(e){!0===e.startsWith(t)&&delete r[e]}),this.setAllBeSessions(r)},m.prototype.getAllBeSessions=function(){var e=window.sessionStorage.getItem(this.sessionStorageKey);return e?JSON.parse(e):{}},m.prototype.setAllBeSessions=function(e){var t=JSON.stringify(e);window.sessionStorage.setItem(this.sessionStorageKey,t)},m.prototype.isInFramework=function(){var e=window.location.hash;return!!e&&-1!==e.indexOf("tabId=")},m);function m(){this.sessionStorageKey="BE_SESSION_ID"}var E=function(e,t){return(E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function x(e,t){function r(){this.constructor=e}E(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var B=function(){return(B=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function P(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function R(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)a.push(n.value)}catch(s){o={error:s}}finally{try{n&&!n.done&&(r=i["return"])&&r.call(i)}finally{if(o)throw o.error}}return a}function D(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(R(arguments[t]));return e}var q=(O.convertToHeaders=function(t){if(1==(t=t||new a.HttpHeaders)instanceof a.HttpHeaders)return t;if(0<Object.keys(t).length){var r=new a.HttpHeaders;Object.keys(t).forEach(function(e){r=r.append(e,t[e])}),t=r}else t=new a.HttpHeaders;return t},O.appendSessionId=function(e,t){return e.append("SessionId",t)},O.appendCafRuntimeCommonVariable=function(e,t){return e.append("X-CAF-Runtime-CommonVariable",t)},O.appendCafRuntimeContext=function(e,t){return e.append("X-CAF-Runtime-Context",t)},O.appendContextType=function(e,t){return t=t||"application/json",e.append("Content-Type",t)},O.appendRequireMessage=function(e,t){return void 0===t&&(t=!0),e.append("Bff-Require-Message",t.toString())},O.appendFuncInstId=function(e,t){return e.append("Func-Inst-Id",t)},O.toJson=function(r){if(!(r instanceof a.HttpHeaders))return null;var n={};return r.keys().forEach(function(e){var t=r.getAll(e);1<t.length?n[e]=t:n[e]=t[0]||""}),n},O);function O(){}var w=(M.buildParams=function(e){var t=new a.HttpParams;for(var r in e)if(e.hasOwnProperty(r)){var n=e[r].toString();t=t.append(r,n)}return t},M);function M(){}var T=(j.hasRequestInfo=function(e){if(!e||!e.body)return!1;var t=e.body;return!(!t.requestInfo||!t.requestInfo.dataChange)||!!t.dataChange},j.hasRequestInfoWithR=function(e){if(!e||!e.body)return!1;var t=e.body;return!(!t.RequestInfo||!t.RequestInfo.dataChange)||!!t.dataChange},j.buildRequestInfo=function(e){return{dataChange:e.entityManager.buildAllEntityChangeDetails(),variableChange:e.variableManager.buildChangeDetail()}},j.buildBodyWithRequestInfo=function(e,t){if(e.RequestInfo||e.requestInfo)return e;var r=this.buildRequestInfo(t);return Object.assign({},e,{requestInfo:r})},j);function j(){}var A=(U.unWrapResponseInfo=function(e){if(!e)return e;if(!1===e.hasOwnProperty("returnValue"))return e.hasOwnProperty("result")&&e.hasOwnProperty("pagination")?e.result:e;var t=e.returnValue;return t&&t.hasOwnProperty("result")&&t.hasOwnProperty("pagination")?t.result:e.returnValue},U.isReported401Error=function(e){return 401===e.status},U.parseBackEndMessage=function(e){return e&&e.message&&Array.isArray(e.message)&&0<e.message.length?e.message:null},U.parseBackEndError=function(e){var t=e&&e.error;return t&&t.hasOwnProperty("extensionMessage")&&t.extensionMessage&&t.extensionMessage.hasOwnProperty("UIMsg")&&t.extensionMessage.UIMsg&&0<t.extensionMessage.UIMsg.length?JSON.parse(t.extensionMessage.UIMsg):null},U);function U(){}var H=(V.prototype.getService=function(){for(var e=window;!e.gspframeworkService&&e!==window.top&&this.isSameOrigin(e);)e=window.parent;return e.gspframeworkService&&e.gspframeworkService.rtf||{}},V.prototype.isSameOrigin=function(e){var t=window.location.host;try{if(e&&e.location&&"undefined"!=typeof e.location.host)return e.location.host===t}catch(r){return!1}return!1},Object.defineProperty(V.prototype,"params",{get:function(){return this.rtf&&this.rtf.hasOwnProperty("session")&&"function"==typeof this.rtf.session.getCommonVariable?this.rtf.session.getCommonVariable():null},enumerable:!0,configurable:!0}),Object.defineProperty(V.prototype,"httpService",{get:function(){return this.rtf&&this.rtf.hasOwnProperty("http")&&"function"==typeof this.rtf.http.request?this.rtf.http:null},enumerable:!0,configurable:!0}),V.prototype.request=function(e,t,r){return void 0===r&&(r={}),this.defaultHttpClient.request(e,t,r)},V.decorators=[{type:i.Injectable}],V.ctorParameters=function(){return[{type:a.HttpClient}]},V);function V(e){this.defaultHttpClient=e,this.httpClient=e,this.rtf=this.getService()}var k=(F.prototype.getFrmSessionId=function(e){return this.frmSessionService.getCurrentSessionId(e)},Object.defineProperty(F.prototype,"frmSessionId",{get:function(){return this.frmSessionService.getCurrentSessionId()},enumerable:!0,configurable:!0}),F.prototype.getFrameworkSessionId=function(e){return this.getFrmSessionId(e)},F.prototype.getSessionIdFromStorage=function(e){var t=this.getSessionStorageKey(e);return this.storageStrategy.getItem(t)},F);function F(e,t){this.storageStrategy=e,this.frmSessionService=t}var N,_=(x(L,N=k),L.prototype.getSessionId=function(){var e=this.getSessionIdFromStorage();return e?b.of(e):this.createSession()},L.prototype.setSessionId=function(e){var t=this.getSessionStorageKey();this.storageStrategy.setItem(t,e)},L.prototype.clearSessionId=function(){var e=this.getSessionStorageKey();this.storageStrategy.clear(this.frmSessionId,e)},L.prototype.extendRequestHeaders=function(e,t){var r=this.getFrameworkSessionId(t),n=this.getSessionIdFromStorage(t);return e=q.appendCafRuntimeCommonVariable(e,r),n&&(e=q.appendCafRuntimeContext(e,n),e=q.appendSessionId(e,n)),e=q.appendFuncInstId(e,this.beSessionUri)},L.prototype.handleReponseHeaders=function(e){console.log(e)},L.prototype.createSession=function(){var t=this,e={responseType:"text"};return this.frmSessionId&&(this.injector.get(I.AppContext,null),e.headers=new a.HttpHeaders({SessionId:this.frmSessionId}),e.headers=e.headers.append("X-CAF-Runtime-CommonVariable",this.frmSessionId),e.headers=e.headers.append("Func-Inst-Id",this.beSessionUri),e.headers=q.toJson(e.headers)),this.httpService.request("POST",this.beSessionUri,e).pipe(d.tap(function(e){t.setSessionId(e)}))},L.prototype.extendHttpHeader=function(){},L.prototype.getSessionStorageKey=function(e){return(e?this.getFrameworkSessionId(e):this.frmSessionId)+"_"+this.beSessionUri},L);function L(e,t,r,n,o){var i=N.call(this,e,t)||this;return i.beSessionUri=n,i.httpClient=r,i.httpService=new H(i.httpClient),i.injector=o,i}var K,G=(x(J,K=k),J.prototype.getSessionId=function(){var e=this.getSessionStorageKey(),t=this.storageStrategy.getItem(e);return b.of(t)},J.prototype.setSessionId=function(e){var t=this.getSessionStorageKey();this.storageStrategy.setItem(t,e)},J.prototype.clearSessionId=function(){var e=this.getSessionStorageKey();this.storageStrategy.removeItem(e)},J.prototype.extendRequestHeaders=function(e,t){var r=this.getFrameworkSessionId(t),n=this.getSessionIdFromStorage(t),o=this.injector.get(I.AppContext,null);if(o){var i=o.Token;e=q.appendFuncInstId(e,i)}return e=q.appendCafRuntimeCommonVariable(e,r),n&&(e=q.appendCafRuntimeContext(e,n)),e},J.prototype.handleReponseHeaders=function(e){console.log(e)},J.prototype.getSessionStorageKey=function(e){return(e?this.getFrameworkSessionId(e):this.frmSessionId)+"_"+this.beSessionUri},J);function J(e,t,r,n){var o=K.call(this,e,t)||this;return o.beSessionUri=r,o.injector=n,o}var W=(z.prototype.create=function(e,t,r,n,o){var i=this.createStorageStrategy(),a=this.createBeSessionUri(r);return"UnifiedSession"===e?new G(i,t,a,o):new _(i,t,n,a,o)},z.prototype.createStorageStrategy=function(){return new v},z.prototype.createBeSessionUri=function(e){return e+"/service/createsession"},z.decorators=[{type:i.Injectable}],z);function z(){}var Q=(Object.defineProperty(Y.prototype,"token",{get:function(){return this.handlingStrategy.getFrameworkSessionId()},enumerable:!0,configurable:!0}),Y.prototype.getBeSessionId=function(){return this.handlingStrategy.getSessionId()},Y.prototype.setBeSessionId=function(e){this.handlingStrategy.setSessionId(e),this.setSessionId(e)},Y.prototype.clearBeSessionId=function(){this.handlingStrategy.clearSessionId()},Y.prototype.extendRequestHeaders=function(e,t){return this.handlingStrategy.extendRequestHeaders(e,t)},Y.prototype.handleResponseHeaders=function(e){return this.handlingStrategy.handleReponseHeaders(e)},Y.prototype.createBeSession=function(){return this.handlingStrategy.createSession()},Y.prototype.setSessionId=function(e){var t=this.injector.get(I.AppContext,null,i.InjectFlags.Optional);t&&e&&t.params.set("sessionId",e)},Y.prototype.createHandlingStrategy=function(e,t,r,n){var o;return o=(o=e?e.get(u,null,i.InjectFlags.Optional):"SeparatedSession")||"SeparatedSession",(new W).create(o,r,n,t,e)},Y.decorators=[{type:i.Injectable}],Y.ctorParameters=function(){return[{type:a.HttpClient},{type:String},{type:f},{type:i.Injector}]},Y);function Y(e,t,r,n){this.beBaseUri=t,this.injector=n,this.handlingStrategy=this.createHandlingStrategy(n,e,r,t)}var X,Z="@farris/bef NG_VARIABLE",$=I.makePropDecorator(Z,function(e){return e}),ee=(x(te,X=I.Repository),Object.defineProperty(te.prototype,"restService",{get:function(){return this.dataService.restService},enumerable:!0,configurable:!0}),Object.defineProperty(te.prototype,"changeBuilder",{get:function(){return this.entityManager.changeBuilder},enumerable:!0,configurable:!0}),Object.defineProperty(te.prototype,"changeHandler",{get:function(){return this.entityManager.changeHandler},enumerable:!0,configurable:!0}),te.prototype.getList=function(){return this.dataService.getList(null,null,null,null)},te.prototype.getById=function(e){return this.dataService.getById(e)},te.prototype.updateById=function(e){return this.dataService.updateById(e)},te.prototype.create=function(e){return this.dataService.create(e)},te.prototype.append=function(e){return this.dataService.append(e)},te.prototype.appendByPath=function(e){return this.dataService.appendByPath(e)},te.prototype.removeById=function(e,t){return this.dataService.removeById(e,t)},te.prototype.removeByIds=function(e,t){return this.dataService.removeByIds(e,t)},te.prototype.removeByPath=function(e,t){return this.dataService.removeByPath(e,t)},te.prototype.updateChangesById=function(e){return this.dataService.updateChangesById(e)},te.prototype.updateChangesByPath=function(e,t){throw new Error("Not Implement")},te.prototype.updateAllChanges=function(){return this.dataService.updateAllChanges()},te.prototype.applyChanges=function(){return this.dataService.applyChanges()},te.prototype.updateDataAndVariableChanges=function(){var e={FilterConditions:[],SortConditions:[],IsUsePagination:!0,Pagination:{PageIndex:1,PageSize:1,PageCount:0,TotalCount:0}},t=JSON.stringify(e),r=this.restService.buildRequestInfo();if(this.isEmptyRequestInfo(r))return b.of(null);var n=this.restService.baseUri+"/extension/query?entityFilter="+t,o={body:r};return this.restService.invoke(n,"PUT",null,o,!1,!0,!0)},te.prototype.applyChangesById=function(e){return this.dataService.applyChangesById(e)},te.prototype.cancelChanges=function(e){return this.dataService.cancelChanges(e)},te.prototype.clearAllEntityChanges=function(){return this.entityManager.clearAllEntityChanges()},te.prototype.getDataChangeDetails=function(){return this.entityManager.buildAllEntityChangeDetails()},te.prototype.handleDataChangeDetails=function(e){return this.entityManager.handleDataChangeDetails(e)},te.prototype.getVariableChangeDetail=function(){return this.variableManager.buildChangeDetail()},te.prototype.handleVariableChangeDetail=function(e){this.variableManager.handleChangeDetail(e)},te.prototype.isEmptyRequestInfo=function(e){return!e||(!e.dataChange||e.dataChange.length<1)&&(!e.variableChange||Object.keys(e.variableChange).length<1)},te.decorators=[{type:i.Injectable}],te.ctorParameters=function(){return[]},te);function te(){return X.call(this)||this}var re,ne=(x(oe,re=I.EntityManager),oe.prototype.buildAllEntityChangeDetails=function(){var r=this,n=[];return this.entityCollection.getAllEntities().forEach(function(e){if(0!==e.changes.length){var t=r.changeBuilder.build(e.changes);t&&t.ChangeInfo&&t.ChangeInfo.DataId&&n.push(t)}}),n},oe.prototype.buildEntityChangeDetailById=function(e){var t=this.entityCollection.getEntityById(e);return 0===t.changes.length?null:this.changeBuilder.build(t.changes)},oe.prototype.handleDataChangeDetails=function(e){this.changeHandler.handle(this.entityType,this.entityCollection,e)},oe.prototype.reset=function(){this.entityCollection.clear()},oe);function oe(e){var t=re.call(this,e)||this;return t.changeBuilder=new c(t.entityCollection.entityType,t.entityCollection),t.changeHandler=new y,t}var ie=(ae.createEmpty=function(e,t){var r={ChangeType:e,ChangeInfo:{}};return t&&(r.ChangeInfo.DataId=t),r},ae.getChangeInfo=function(e){return!0===this.isChangeDetail(e)?e.ChangeInfo:e},ae.isChangeDetail=function(e){var t=Object.keys(e);return 2===t.length&&-1<t.indexOf("ChangeType")&&-1<t.indexOf("ChangeInfo")},ae);function ae(){}var se=(pe.prototype.handleChangeDetail=function(e){var o=this,i=e.ChangeInfo;Object.keys(i).forEach(function(e){var t=o.ngVariableMap.get(e);if(t){var r=t.mapping,n=i[e];o.innerValueMap.get(e)!==n&&(o.setValueToUIState(r,n),o.innerValueMap.set(e,n))}})},pe.prototype.buildChangeDetail=function(){var i=this,a=ie.createEmpty(S.Modify);return this.ngVariableMap.forEach(function(e,t){var r=e.mapping,n=i.getValueFromUIState(r),o=i.innerValueMap.get(t);!1===i.isValueEqual(n,o)&&(i.innerValueMap.set(t,n),i.appendToChangeInfo(a,t,n))}),0===Object.keys(a.ChangeInfo).length?null:a},pe.prototype.reset=function(){this.innerValueMap.clear()},pe.prototype.appendToChangeInfo=function(e,t,r){if(!0===this.isUdtVariable(r)){var n=ie.createEmpty(S.Modify);n.ChangeInfo=r,e.ChangeInfo[t]=n}else e.ChangeInfo[t]=r},pe.prototype.getValueFromUIState=function(e){var t=this.getRootUIState(),r=e.split(".").reduce(function(e,t){return e?e[t]:null},t);return r instanceof Date?n.format(r,"yyyy-MM-dd HH:mm:ss"):r},pe.prototype.getRootUIState=function(){var e=this.appContext.frameContextManager.getRootFrameContext();if(this.injector){var t=this.injector.get(I.FrameContext,null);t&&(e=t.getVirtualRootFrameContext()||e)}if(e)return e.uiState},pe.prototype.isValueEqual=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},pe.prototype.isUdtVariable=function(e){return e&&e.constructor&&"[object Object]"===e.toString()&&e.constructor.prototype.hasOwnProperty("isPrototypeOf")},pe.prototype.setValueToUIState=function(e,t){this.getRootUIState()[e]=t},pe.ctorParameters=function(){return[{type:I.AppContext},{type:undefined},{type:i.Injector,decorators:[{type:i.Optional}]}]},pe);function pe(e,t,r){var n=this;this.appContext=e,this.ngVariables=t,this.injector=r,this.ngVariableMap=new Map,this.innerValueMap=new Map,Object.keys(t).forEach(function(e){n.ngVariableMap.set(e,t[e])})}var ue=(ce.buildRequestInfo=function(e){return{dataChange:e.entityManager.buildAllEntityChangeDetails(),variableChange:e.variableManager.buildChangeDetail()}},ce);function ce(){}var he=(ye.convertToPathArray=function(e,t){var n=this,r=I.BindingPathConverter.toBindingPathArray(e),o=[],i=t.list.currentItem;return o.push(i.primaryKeyValue),r.forEach(function(e){var t=I.PropertyUtil.getPropertyByName(i.properties,e);if(t.type!==I.BindingPropertyType.List)throw new Error(t.name+"不是子表对应的属性");var r=i[e];i=r.currentItem,o.push(n.trimTrailingS(e)),o.push(i.primaryKeyValue)}),o},ye.convertToPathUrl=function(e,t){var r=this.convertToPathArray(e,t);return r.pop(),"/"+r.join("/")},ye.convertToObjectCodes=function(e,t){for(var r=this.convertToPathArray(e,t),n=r.length,o=[],i=1;i<n;i+=2)o.push(r[i]);return o},ye.convertToDataIdsForUpdate=function(e,t){for(var r=this.convertToPathArray(e,t),n=r.length,o=[],i=0;i<n;i+=2)o.push(r[i]);return o},ye.convertToDataIdsForAdd=function(e,t){var r=this.convertToDataIdsForUpdate(e,t);return r.pop(),r},ye.convertPathToUrl=function(e){for(var t=e.split("/"),r=t.length-1;0<r;r--)t[r]&&t[r].endsWith("s")&&(t[r]=t[r].substr(0,t[r].length-1).toLowerCase());return t.join("/")},ye.trimTrailingS=function(e){return e.substr(0,e.length-1)},ye.convertPathsToNodeCodes=function(e){var t=[];return!e||e.length<1||e.filter(function(e){return!!e&&-1===e.indexOf(":")}).forEach(function(e){t.push(e)}),t},ye.convertPathsToIds=function(e){var t=[];return!e||e.length<1||e.filter(function(e){return!!e&&-1!==e.indexOf(":")}).forEach(function(e){t.push(e.split(":")[1])}),t},ye);function ye(){}var le=(Object.defineProperty(de.prototype,"restProxy",{get:function(){return this.repository.restService.proxy},enumerable:!0,configurable:!0}),de.prototype.getList=function(e,t,r,n){var p=this;0!==r&&(r=r||this.repository.entityCollection.pageSize,n=n||this.repository.entityCollection.pageIndex);var o=this.buildEntityFilter(e,t,r,n),i=this.restService.buildRequestInfo();return this.restProxy.extendQuery(o,i).pipe(d.map(function(e){var t=e.returnValue,r=t.result,n=[];r.forEach(function(e){var t=p.repository.buildEntity(e);C.appendInitialData(t,e),n.push(t)});var o=t.pagination;if(o&&0<Object.keys(o).length){var i=o.pageSize,a=o.pageIndex,s=o.totalCount;p.repository.entityCollection.updatePaginationInfoByPath("/",{pageIndex:a,pageSize:i,totalCount:s})}else p.repository.entityCollection.updatePaginationInfoByPath("/",{pageIndex:1,pageSize:0,totalCount:n.length});return p.repository.entityCollection.loadEntities(n),n}))},de.prototype.filter=function(e,t,r,n){var p=this;0!==r&&(r=r||this.repository.entityCollection.pageSize,n=n||this.repository.entityCollection.pageIndex);var o=this.buildEntityFilter(e,t,r,n),i=this.restService.buildRequestInfo();return this.restProxy.filter(o,i).pipe(d.map(function(e){var t=e.returnValue,r=t.result,n=[];r.forEach(function(e){var t=p.repository.buildEntity(e);C.appendInitialData(t,e),n.push(t)});var o=t.pagination;if(o&&0<Object.keys(o).length){var i=o.pageSize,a=o.pageIndex,s=o.totalCount;p.repository.entityCollection.updatePaginationInfoByPath("/",{pageIndex:a,pageSize:i,totalCount:s})}else p.repository.entityCollection.updatePaginationInfoByPath("/",{pageIndex:1,pageSize:0,totalCount:n.length});return p.repository.entityCollection.loadEntities(n),n}))},de.prototype.buildEntityFilter=function(e,t,r,n){return e||t||r||n?(e&&0<e.length&&(e[e.length-1].Relation=0),{FilterConditions:e,SortConditions:t,IsUsePagination:0!==r,Pagination:{PageIndex:n,PageSize:r,PageCount:0,TotalCount:0}}):null},de.prototype.getById=function(e){var n=this,t=this.restService.buildRequestInfo();return this.restService.extendRetrieve(e,t).pipe(d.map(function(e){var t=e.returnValue,r=n.repository.buildEntity(t);return n.repository.entityCollection.loadEntities([r]),r}))},de.prototype.getPagedById=function(o){var i=this,e=this.restService.buildRequestInfo(),t=this.repository.entityCollection.getPaginationConfigByPath("/"),r=this.buildChildPagination(t),n=this.buildRetrieveParam(r);return this.restService.serviceRetrieve(o,n,e).pipe(d.map(function(e){var t=e.dataResult,r=e.paginations;i.updatePagination(r);var n=i.repository.entityCollection.getEntityById(o);return i.reloadEntityData(n,t),n}))},de.prototype.queryChild=function(s,e,t,r,n){var p=this,o=this.restService.buildRequestInfo(),u=he.convertPathsToNodeCodes(s),i=u.map(function(e){return e.substring(0,e.length-1)}),a=he.convertPathsToIds(s),c=B({nodeCodes:i,ids:a,pagination:{pageIndex:e,pageSize:t}},o),h=u[u.length-1];return h=h.substring(0,h.length-1),this.restService.queryChild(c).pipe(d.map(function(e){console.log(e);var t=e.returnValue;if(!t)return null;var r=t.result,n=void 0===r?[]:r,o=t.pagination,i=void 0===o?{}:o,a=[];n.forEach(function(e){var t=new(I.FieldMetadataUtil.getNgList(p.repository.entityType)[u[u.length-1]].type)(e);C.appendInitialData(t,e),a.push(t)}),u=u.map(function(e){return e.charAt(0).toLocaleLowerCase()+e.substr(1)}),p.repository.entityCollection.resetEntities(s,a),p.repository.entityCollection.setPaginationConfigByPath("/"+h,i)}))},de.prototype.buildChildPagination=function(r){var n={};return Object.keys(r).forEach(function(e){var t=r[e];"object"==typeof t&&(n[e]=t)}),n},de.prototype.updatePagination=function(t){var r=this;t&&Object.keys(t).forEach(function(e){r.repository.entityCollection.setPaginationConfigByPath("/"+e,t[e])})},de.prototype.buildRetrieveParam=function(n){var e={};if(n&&0<Object.keys(n).length){var o=[];Object.keys(n).forEach(function(e){var t=n[e],r={};r[e]={pagination:{pageSize:t.pageSize||0,pageIndex:1}},o.push(r)}),e.filters=o}return e},de.prototype.editById=function(n){var o=this;if(!this.repository.entityCollection.getEntityById(n))return b.of(null);var e=ue.buildRequestInfo(this.repository);return this.restProxy.edit(n,e).pipe(d.map(function(e){var t=e.returnValue.data,r=o.repository.entityCollection.getEntityById(n);return r&&t&&o.reloadEntityData(r,t),r}))},de.prototype.updateById=function(n){var o=this;if(!this.repository.entityCollection.getEntityById(n))return b.of(null);var e=this.restService.buildRequestInfo();return this.restService.extendRetrieve(n,e).pipe(d.map(function(e){var t=e.returnValue,r=o.repository.entityCollection.getEntityById(n);return o.reloadEntityData(r,t),r}))},de.prototype.reloadEntityData=function(e,t){e&&(this.appContext.changeDetectionController.detach(),e.load(t),e.changes.splice(0,e.changes.length),this.appContext.changeDetectionController.reattach())},de.prototype.create=function(e){var n=this,t=this.restService.buildRequestInfo();return this.restService.create(e,t).pipe(d.map(function(e){var t=e.returnValue,r=n.repository.buildEntity(t);return C.appendInitialData(r,t),n.repository.entityCollection.loadEntities([r]),r}))},de.prototype.append=function(e){var n=this,t=this.restService.buildRequestInfo();return this.restService.create(e,t).pipe(d.map(function(e){var t=e.returnValue,r=n.repository.buildEntity(t);return n.repository.entityCollection.addEntity(r),r}))},de.prototype.insert=function(n,e){var o=this,t=this.buildRequestInfo();return this.restProxy.create(e,t).pipe(d.map(function(e){var t=e.returnValue,r=o.repository.buildEntity(t);return o.repository.entityCollection.insertEntity(r,n),r}))},de.prototype.appendByPath=function(r){var n=this,e=this.restService.buildRequestInfo();return this.restService.createByPath(r,e).pipe(d.map(function(e){var t=e.returnValue;return n.repository.entityManager.appendEntityByPath(r,t,t)}))},de.prototype.insertByPath=function(r,n){var o=this,e=this.buildRequestInfo();return this.restProxy.createByPath(r,e).pipe(d.map(function(e){var t=e.returnValue;return o.repository.entityManager.insertEntityByPath(r,t,t,n)}))},de.prototype.removeById=function(e,t){var r=this;t=t===undefined||t;var n=ue.buildRequestInfo(this.repository);return t?this.restProxy.deleteAndSave(e,n).pipe(d.switchMap(function(){return r.repository.entityCollection.removeEntityById(e),b.of(!0)})):this.restService.extendDelete(e,n).pipe(d.switchMap(function(){return r.repository.entityCollection.removeEntityById(e),r.repository.dataChangeHistory.addChange({dataId:e,changeType:I.DataChangeType.Delete}),b.of(!0)}))},de.prototype.removeAndSaveById=function(e){var t=this,r=ue.buildRequestInfo(this.repository);return this.restProxy.deleteAndSave(e,r).pipe(d.switchMap(function(){return t.repository.entityCollection.removeEntityById(e),b.of(!0)}))},de.prototype.removeByIds=function(r,e){var n=this;e=e===undefined||e;var t=this.restService.buildRequestInfo();return this.restService.extendBatchDelete(r,t).pipe(d.switchMap(function(){if(e)return n.applyChangesByIdArray(r).pipe(d.tap(function(e){e&&n.repository.entityCollection.removeEntities(function(e){return n.checkEntityValueExists(e,r)})}));if(n.repository.entityCollection.removeEntities(function(e){return n.checkEntityValueExists(e,r)}),r&&0<r.length){var t=[];r.forEach(function(e){t.push({dataId:e,changeType:I.DataChangeType.Delete})}),n.repository.dataChangeHistory.addChanges(t)}return b.of(!0)}))},de.prototype.checkEntityValueExists=function(e,t){for(var r=!1,n=0;n<t.length;n++)if(e.primaryValue===t[n]){r=!0;break}return r},de.prototype.removeByPath=function(e,t){var r=this,n=this.restService.buildRequestInfo();return this.restService.extendDeletByPath(e,t,n).pipe(d.map(function(){return r.repository.entityManager.removeEntityByPath(e,t),r.repository.dataChangeHistory.addChange({fpath:e,dataId:t,changeType:I.DataChangeType.Delete}),!0}))},de.prototype.batchRemoveByPath=function(t,r){var n=this,e=this.restService.buildRequestInfo();return this.restService.batchDeleteByPath(t,r,e).pipe(d.map(function(){var e=r.split(",");return 0<e.length&&e.forEach(function(e){n.repository.entityManager.removeEntityByPath(t,e),n.repository.dataChangeHistory.addChange({fPath:t,dataId:e,changeType:I.DataChangeType.Delete})}),!0}))},de.prototype.updateChangesById=function(e){var t=this,r=this.repository.entityCollection.getEntityById(e);if(!r.changes)return b.of(!0);if(0===r.changes.length)return b.of(!0);var n=this.repository.entityManager.buildEntityChangeDetailById(e),o=this.restService.buildRequestInfo();return this.restService.update(n,o).pipe(d.tap(function(){t.repository.entityManager.clearEntityChangesById(e)}),d.map(function(){return!0}))},de.prototype.updateChangesByPath=function(e,t){throw new Error("Not Implement")},de.prototype.updateAllChanges=function(){var r=this,n=[],e=this.repository.entityCollection.toArray();return 0===e.length?b.of(!0):(e.forEach(function(e){var t=r.updateChangesById(e.primaryValue);n.push(t)}),b.zip.apply(void 0,D(n)).pipe(d.map(function(){return!0})))},de.prototype.applyChanges=function(){var e=this,t=this.restService.buildRequestInfo();return this.restService.save(t).pipe(d.tap(function(){e.repository.entityManager.clearAllEntityChanges(),e.repository.dataChangeHistory.clear()}),d.map(function(){return!0}))},de.prototype.applyChangesByIdArray=function(e){var t=this,r=this.restService.buildRequestInfo();return this.restService.save(r).pipe(d.tap(function(){t.repository.entityManager.clearEntityChangesByArray(e),t.repository.dataChangeHistory.clearByIds(e)}),d.map(function(){return!0}))},de.prototype.applyChangesById=function(e){var t=this,r=this.restService.buildRequestInfo();return this.restService.save(r).pipe(d.tap(function(){t.repository.entityManager.clearEntityChangesById(e),t.repository.dataChangeHistory.clearByIds([e])}),d.map(function(){return!0}))},de.prototype.cancelChanges=function(e){var t=this;return this.restService.cancel(e).pipe(d.tap(function(){t.repository.entityManager.clearAllEntityChanges(),t.repository.dataChangeHistory.clear()}),d.map(function(){return!0}))},de.prototype.batchAppendByPath=function(o,e){var i=this,t=this.buildRequestInfo();return this.restProxy.batchAppendByPath(o,e,t).pipe(d.map(function(e){var t=e.returnValue,r=i.repository.entityManager.createEntitiesByPath(o,t),n=o.split("/").filter(function(e){return e});return i.repository.entityManager.appendEntitiesByPath(n,r),r}))},de.prototype.batchAppend=function(e){var n=this,t=this.buildRequestInfo();return this.restProxy.batchAppend(e,t).pipe(d.map(function(e){var t=e.returnValue,r=n.repository.buildEntities(t);return n.repository.entityCollection.addEntities(r),r}))},de.prototype.buildRequestInfo=function(){return{dataChange:this.repository.entityManager.buildAllEntityChangeDetails(),variableChange:this.repository.variableManager.buildChangeDetail()}},de);function de(e,t){this.injector=e,this.repository=t;var r=e.get(f),n=e.get(a.HttpClient),o=e.get(p)+"/"+this.repository.apiUri,i=e.get(I.EventBus);this.restService=new we(n,o,r,this.repository,i),this.appContext=e.get(I.AppContext)}var fe=(ge.handleMessage=function(e,t,r){var n={ns:t.get(I.NAMESPACE,null),appContext:t.get(I.AppContext,null)},o=this.buildBackEndMessages(e),i=new I.BackEndMessage.Message(o,n),a=t.get(I.BACK_END_MESSAGE_HANDLER_TOKEN,null);a&&a.handle(i,r)},ge.isBackEndMessageHandlerExist=function(e){return!!e.get(I.BACK_END_MESSAGE_HANDLER_TOKEN,null)},ge.getFormlessMessages=function(e){return(this.buildBackEndMessages(e)||[]).filter(function(e){return!e.location||!e.location.columns||e.location.columns.length<1||!e.location.nodeCode})},ge.buildBackEndMessages=function(e){if(!e||e.length<1||!Array.isArray(e))return null;var r=[];return e.forEach(function(e){var t={level:e.level,message:e.message};e.hasOwnProperty("location")&&e.location&&(t.location={nodeCode:e.location.nodeCode,rows:e.location.dataIds,columns:e.location.columnNames}),r.push(t)}),r},ge);function ge(){}var ve=(Ie.getSessionId=function(e,t){var r=e.ApplicationId+"_"+t.beBaseUri;return this.createSessionHistory.includes(r)?b.of(null):(this.createSessionHistory.push(r),t.getBeSessionId())},Ie.createSessionHistory=[],Ie.decorators=[{type:i.Injectable}],Ie);function Ie(){}var Se=(be.prototype.onResponse=function(e,t){e&&e.innerDataChange&&!0!==t&&this.context.handleDataChangeDetails(e.innerDataChange),e&&e.innerVariableChange&&this.context.handleVariableChangeDetail(e.innerVariableChange);var r=A.parseBackEndMessage(e);return fe.handleMessage(r,this.context.getInjector()),this.context.clearAllEntityChanges(),e&&e.hasOwnProperty("returnValue")?e.returnValue:e},be.prototype.onError=function(e,t,r){var n,o,i=this.context.appContext.getFormAppContext(),a=i.ApplicationId,s=window.DEVKIT_LOADING_SERVICE,p=A.parseBackEndError(e);if(fe.handleMessage(p,this.context.getInjector()),s&&s instanceof Array&&0<s.length)try{for(var u=P(s),c=u.next();!c.done;c=u.next()){var h=c.value;"function"==typeof h.clearAll&&h.clearAll()}}catch(S){n={error:S}}finally{try{c&&!c.done&&(o=u["return"])&&o.call(u)}finally{if(n)throw n.error}}if(t)return b.throwError(e);var y=this.context.restService.eventBus,l=!!(window[a]||{}).isExceptionHandlerExist,d=A.parseBackEndError(e),f=fe.getFormlessMessages(d),g=f&&0<f.length||!1,v=!(e&&e.error&&e.error.extensionMessage&&fe.isBackEndMessageHandlerExist(this.context.getInjector())&&!g),I=!!y&&l&&v;return fe.handleMessage(d,this.context.getInjector(),{hasThrowError:I,isException:!0,eventBus:y,error:e,formAppContext:i}),y&&l&&!A.isReported401Error(e)?(v&&y.post("Exception","","onException",e,i),r?b.of(null):b.EMPTY):b.throwError(e)},be.prototype.extendHeaders=function(t,r){var n=this,e=this.context.appContext.getFormAppContext();return ve.getSessionId(e,this.context.restService.sessionService).pipe(d.switchMap(function(e){return t=n.context.restService.sessionService.extendRequestHeaders(t,r),b.of(t)}))},be.prototype.extendUrl=function(e,t){if(!t)return e;for(var r in t)if(t.hasOwnProperty(r)){var n=JSON.stringify(t[r]);e=-1===e.indexOf("?")?e+"?"+r+"="+n:e+"&"+r+"="+n}return e},be.prototype.extendBody=function(t){var r=this;return!t||"object"!=typeof t||Object.keys(t).length<1||(Object.keys(t).forEach(function(e){"requestInfo"===e&&(t.requestInfo=r.context.restService.buildRequestInfo())}),1===Object.keys(t).length&&(t=Object.values(t)[0])),t},be.prototype.parseHeaders=function(e){var t="BEFSessionID";e.headers&&e.headers.has(t)&&this.context.restService.sessionService.setBeSessionId(e.headers.get(t))},be);function be(e){this.context=e}var Ce,me=(x(Ee,Ce=ee),Object.defineProperty(Ee.prototype,"proxy",{get:function(){return this.befProxy},set:function(e){this.befProxy=e,this.befProxy.setProxyExtend(new Se(this))},enumerable:!0,configurable:!0}),Ee.prototype.getEntities=function(e,t,r,n){return this.dataService.getList(e,t,r,n)},Ee.prototype.filter=function(e,t,r,n){return void 0===e&&(e=[]),void 0===t&&(t=[]),this.dataService.filter(e,t,r,n)},Ee.prototype.getPagedById=function(e){return this.dataService.getPagedById(e)},Ee.prototype.queryChild=function(e,t,r,n,o){return this.dataService.queryChild(e,t,r,n,o)},Ee.prototype.getEntityById=function(e){return this.dataService.getById(e)},Ee.prototype.updateEntityById=function(e){return this.dataService.updateById(e)},Ee.prototype.editEntityById=function(e){return this.dataService.editById(e)},Ee.prototype.createEntity=function(e){return this.dataService.create(e)},Ee.prototype.appendEntity=function(e){return this.dataService.append(e)},Ee.prototype.insert=function(e,t){return this.dataService.insert(e,t)},Ee.prototype.insertByPath=function(e,t){return this.dataService.insertByPath(e,t)},Ee.prototype.appendEntityByPath=function(e){return this.dataService.appendByPath(e)},Ee.prototype.removeEntityById=function(e,t){return this.dataService.removeById(e,t)},Ee.prototype.removeEntityAndSaveById=function(e){return this.dataService.removeAndSaveById(e)},Ee.prototype.removeEntityByPath=function(e,t){return this.dataService.removeByPath(e,t)},Ee.prototype.batchRemoveByPath=function(e,t){return this.dataService.batchRemoveByPath(e,t)},Ee.prototype.saveEntityById=function(e){return this.dataService.applyChangesById(e)},Ee.prototype.saveEntities=function(){return this.dataService.applyChanges()},Ee.prototype.cancelEntityChanges=function(){return this.dataService.cancelChanges()},Ee.prototype.batchAppendByPath=function(e,t){return this.dataService.batchAppendByPath(e,t)},Ee.prototype.batchAppend=function(e){return this.dataService.batchAppend(e)},Ee.prototype.reset=function(){this.entityManager.reset(),this.variableManager.reset(),this.restService.sessionService.clearBeSessionId()},Ee.prototype.getInjector=function(){return this.injector},Ee.decorators=[{type:i.Injectable}],Ee.ctorParameters=function(){return[{type:i.Injector}]},Ee);function Ee(e){var t=Ce.call(this)||this;t.injector=e,t.entityManager=new ne(t.entityCollection),t.appContext=t.injector.get(I.AppContext);var r=I.MetadataUtil.getPropsMetadatasByName(t.constructor,Z);return t.variableManager=new se(t.appContext,r,t.injector),t.dataService=new le(t.injector,t),t.serverUri=e.get(p),t}var xe=(Be.prototype.extendUri=function(e){return this.serverUri+"/"+e},Be.decorators=[{type:i.Injectable}],Be.ctorParameters=function(){return[{type:String,decorators:[{type:i.Inject,args:[p]}]}]},Be);function Be(e){this.serverUri=e}var Pe="DELETE",Re="PUT",De="POST",qe=(Oe.prototype.setBaseUri=function(e){this.baseUri=e},Oe.prototype.setProxyExtend=function(e){this.proxyExtend=e},Oe.prototype.query=function(e){var t=this.baseUri;return e&&(t=t+"?entityFilter="+JSON.stringify(e)),this.request(t,"GET")},Oe.prototype.extendQuery=function(e,t){var r=this.baseUri+"/extension/query";if(e){var n=JSON.stringify(e);r=r+"?entityFilter="+(n=I.encodeUrl(n))}var o=t,i=this.addBodyToOptions({},o);return this.request(r,Re,null,i,!1)},Oe.prototype.filter=function(e,t){var r=this.baseUri+"/extension/filter",n={requestInfo:t};e&&(n={entityFilter:e,requestInfo:t});var o=this.addBodyToOptions({},n);return this.request(r,De,null,o,!1)},Oe.prototype.retrieve=function(e){var t=this.baseUri+"/"+e;return this.request(t,"GET")},Oe.prototype.serviceRetrieve=function(e,t,r){var n=this.baseUri+"/service/retrieve/"+e,o={body:{retrieveParam:t,requestInfo:r}};return this.request(n,Re,null,o)},Oe.prototype.queryChild=function(e){var t=this.baseUri+"/service/querychild",r={body:e};return this.request(t,Re,null,r)},Oe.prototype.extendRetrieve=function(e,t){var r=this.baseUri+"/extension/retrieve/"+e,n=t,o=this.addBodyToOptions({},n);return this.request(r,Re,null,o)},Oe.prototype.edit=function(e,t){var r=this.baseUri+"/service/edit/"+e,n=t,o=this.addBodyToOptions({},n);return this.request(r,Re,null,o)},Oe.prototype.create=function(e,t){var r={defaultValue:e,requestInfo:t},n=this.addBodyToOptions({},r);return this.request(this.baseUri,De,null,n)},Oe.prototype.createByPath=function(e,t){var r=he.convertPathToUrl(e),n=""+this.baseUri+r,o=t,i=this.addBodyToOptions({},o);return this.request(n,De,null,i)},Oe.prototype.update=function(e,t){var r={changeDetail:e,requestInfo:t},n=this.addBodyToOptions({},r);return this.request(this.baseUri,"PATCH",null,n)},Oe.prototype.save=function(e){var t=e,r=this.addBodyToOptions({},t);return this.request(this.baseUri,Re,null,r)},Oe.prototype["delete"]=function(e){var t=this.baseUri+"/"+e;return this.request(t,Pe)},Oe.prototype.deleteAndSave=function(e,t){var r=this.baseUri+"/service/delete/"+e,n=t,o=this.addBodyToOptions({},n);return this.request(r,Re,null,o)},Oe.prototype.extendDelete=function(e,t){var r=this.baseUri+"/extension/delete/"+e,n=t,o=this.addBodyToOptions({},n);return this.request(r,Re,null,o)},Oe.prototype.deletByPath=function(e,t){var r=he.convertPathToUrl(e),n=""+this.baseUri+r+"/"+t;return this.request(n,Pe)},Oe.prototype.extendDeletByPath=function(e,t,r){var n=he.convertPathToUrl(e),o=this.baseUri+"/extension"+n+"/"+t,i=r,a=this.addBodyToOptions({},i);return this.request(o,Re,null,a)},Oe.prototype.batchDeleteByPath=function(e,t,r){var n=he.convertPathToUrl(e);if(n.split("/").length<3)throw Error("根据path删除实体数据出错了。传入的path["+e+"]格式不对");var o=this.baseUri+"/extension"+n+"/batch",i={ids:t.split(","),requestInfo:r},a=this.addBodyToOptions({},i);return this.request(o,Re,null,a)},Oe.prototype.batchDelete=function(e){var t={ids:e.join(",")};return this.request(this.baseUri,Pe,t)},Oe.prototype.extendBatchDelete=function(e,t){var r=this.baseUri+"/extension/batchdelete",n={ids:e.join(",")},o=t,i=this.addBodyToOptions({},o);return this.request(r,Re,n,i)},Oe.prototype.cancel=function(e){var t=this.baseUri+"/service/cancel";return this.request(t,De,null,null,!1,!1,!1,e)},Oe.prototype.batchAppendByPath=function(e,t,r){var n=he.convertPathToUrl(e),o=""+this.baseUri+n+"/batch",i={requestInfo:r,retrieveDefaultParam:{defaultValues:t}},a=this.addBodyToOptions({},i);return this.request(o,De,null,a)},Oe.prototype.batchAppend=function(e,t){var r=this.baseUri+"/batch",n={requestInfo:t,retrieveDefaultParam:{defaultValues:e}},o=this.addBodyToOptions({},n);return this.request(r,De,null,o)},Oe.prototype.request=function(t,r,e,n,o,i,a,s){var p=this;n=n||{},void 0!==o&&"boolean"==typeof o||(o=!1),void 0!==i&&"boolean"==typeof i||(i=!1),e&&(n.params=e),n.headers=q.convertToHeaders(n.headers);var u=this.hasRequestInfo(n);return n&&n.body&&n.body.hasOwnProperty("RequestInfo")&&(n.body.requestInfo=n.body.RequestInfo,delete n.body.RequestInfo),this.proxyExtend.extendHeaders(n.headers,s).pipe(d.switchMap(function(e){return n.headers=q.toJson(e),n.observe="response",p.httpService.request(r,t,n)}),d.tap(function(e){return p.proxyExtend.parseHeaders(e)}),d.map(function(e){return e.body}),d.map(function(e){return u?(p.proxyExtend.onResponse(e,a),e):p.unWrapResponseInfo(e)}),d.catchError(function(e){return p.proxyExtend.onError(e,o,i)}))},Oe.prototype.invoke=function(t,r,n){var o=this;return n.params&&(t=this.proxyExtend.extendUrl(t,n.params),n.params=null),n.body&&(n.body=this.proxyExtend.extendBody(n.body)),n.headers=q.convertToHeaders(n.headers),this.proxyExtend.extendHeaders(n.headers).pipe(d.switchMap(function(e){return n.headers=q.toJson(e),n.observe="response",o.httpService.request(r,t,n).pipe(d.tap(function(e){return o.proxyExtend.parseHeaders(e)}),d.map(function(e){return e.body}),d.map(function(e){return o.proxyExtend.onResponse(e)}),d.catchError(function(e){return o.proxyExtend.onError(e,!1,!1)}))}))},Oe.prototype.addBodyToOptions=function(e,t){return e=e||{},Object.assign(e,{body:t})},Oe.prototype.buildParams=function(e){return w.buildParams(e)},Oe.prototype.hasRequestInfo=function(e){return T.hasRequestInfo(e)||T.hasRequestInfoWithR(e)},Oe.prototype.unWrapResponseInfo=function(e){return A.unWrapResponseInfo(e)},Oe.decorators=[{type:i.Injectable}],Oe.ctorParameters=function(){return[{type:a.HttpClient},{type:xe}]},Oe);function Oe(e,t){this.httpClient=e,this.uriService=t,this.httpService=new H(this.httpClient)}var we=(Object.defineProperty(Me.prototype,"proxy",{get:function(){return this.repository.proxy?this.repository.proxy:this.createBefProxy()},enumerable:!0,configurable:!0}),Me.prototype.createBefProxy=function(){var e=this.repository.serverUri,t=new xe(e),r=new qe(this.httpClient,t);r.setBaseUri(this.baseUri);var n=new Se(this.repository);return r.setProxyExtend(n),r},Me.prototype.query=function(e){return this.proxy.query(e)},Me.prototype.extendQuery=function(e,t){return this.proxy.extendQuery(e,t)},Me.prototype.serviceRetrieve=function(e,t,r){return this.proxy.serviceRetrieve(e,t,r)},Me.prototype.queryChild=function(e){return this.proxy.queryChild(e)},Me.prototype.retrieve=function(e){return this.proxy.retrieve(e)},Me.prototype.extendRetrieve=function(e,t){return this.proxy.extendRetrieve(e,t)},Me.prototype.create=function(e,t){return this.proxy.create(e,t)},Me.prototype.createByPath=function(e,t){return this.proxy.createByPath(e,t)},Me.prototype.update=function(e,t){return this.proxy.update(e,t)},Me.prototype.save=function(e){return this.proxy.save(e)},Me.prototype["delete"]=function(e){return this.proxy["delete"](e)},Me.prototype.extendDelete=function(e,t){return this.proxy.extendDelete(e,t)},Me.prototype.deletByPath=function(e,t){return this.proxy.deletByPath(e,t)},Me.prototype.extendDeletByPath=function(e,t,r){return this.proxy.extendDeletByPath(e,t,r)},Me.prototype.batchDeleteByPath=function(e,t,r){return this.proxy.batchDeleteByPath(e,t,r)},Me.prototype.batchDelete=function(e){return this.proxy.batchDelete(e)},Me.prototype.extendBatchDelete=function(e,t){return this.proxy.extendBatchDelete(e,t)},Me.prototype.cancel=function(e){return this.proxy.cancel(e)},Me.prototype.request=function(e,t,r,n,o,i,a){return this.innerRequest(e,t,r,n,o,i,a,!1)},Me.prototype.invoke=function(e,t,r,n,o,i,a){if(n&&n.body&&n.body.RequestInfo)throw new Error("请使用requestInfo提交变更");return this.innerRequest(e,t,r,n,o,i,a,!0)},Me.prototype.innerRequest=function(t,r,e,n,o,i,a,s){var p=this;n=n||{};var u="BEFSessionID";void 0!==o&&"boolean"==typeof o||(o=!1),void 0!==i&&"boolean"==typeof i||(i=!1),void 0!==s&&"boolean"==typeof s||(s=!1);var c=s?this.existRequestInfo:this.hasRequestInfo;e&&(n.params=e);var h=c(n),y=q.convertToHeaders(n.headers),l=this.repository.appContext.getFormAppContext();return ve.getSessionId(l,this.sessionService).pipe(d.switchMap(function(e){return y=p.sessionService.extendRequestHeaders(y),n.headers=q.toJson(y),n.observe="response",p.httpService.request(r,t,n)}),d.tap(function(e){e.headers&&e.headers.has(u)&&p.sessionService.setBeSessionId(e.headers.get(u))}),d.map(function(e){return e.body}),d.map(function(e){var t=A.parseBackEndMessage(e);return fe.handleMessage(t,p.repository.getInjector()),p.handleReponseInfo(e,h,a)}),d.catchError(function(e){return p.handleErrors(e,o,i)}))},Me.prototype.handleReponseInfo=function(e,t,r){return t?(e&&e.innerDataChange&&!0!==r&&this.repository.handleDataChangeDetails(e.innerDataChange),e&&e.innerVariableChange&&this.repository.handleVariableChangeDetail(e.innerVariableChange),this.repository.clearAllEntityChanges(),e):this.unWrapResponseInfo(e)},Me.prototype.handleErrors=function(e,t,r){if(this.clearLoading(),t)return b.throwError(e);var n=this.repository.appContext.getFormAppContext(),o=n.ApplicationId,i=window[o]||{},a=A.parseBackEndError(e),s=fe.getFormlessMessages(a),p=!!i.isExceptionHandlerExist,u=s&&0<s.length||!1,c=!(e&&e.error&&e.error.extensionMessage&&fe.isBackEndMessageHandlerExist(this.repository.getInjector())&&!u),h=!!this.eventBus&&p&&c;return fe.handleMessage(a,this.repository.getInjector(),{hasThrowError:h,isException:!0,eventBus:this.eventBus,error:e,formAppContext:n}),this.eventBus&&p&&!A.isReported401Error(e)?(c&&this.eventBus.post("Exception","","onException",e,n),r?b.of(null):b.EMPTY):b.throwError(e)},Me.prototype.clearLoading=function(){var e,t;if(!1!==(window.DEVKIT_LOADING_SERVICE&&window.DEVKIT_LOADING_SERVICE instanceof Array&&0<window.DEVKIT_LOADING_SERVICE.length||!1)){var r=window.DEVKIT_LOADING_SERVICE;try{for(var n=P(r),o=n.next();!o.done;o=n.next()){var i=o.value;"function"==typeof i.clearAll&&i.clearAll()}}catch(a){e={error:a}}finally{try{o&&!o.done&&(t=n["return"])&&t.call(n)}finally{if(e)throw e.error}}}},Me.prototype.unWrapResponseInfo=function(e){return A.unWrapResponseInfo(e)},Me.prototype.hasRequestInfo=function(e){return T.hasRequestInfoWithR(e)},Me.prototype.existRequestInfo=function(e){return T.hasRequestInfo(e)},Me.prototype.buildParams=function(e){return w.buildParams(e)},Me.prototype.buildBodyWithRequestInfo=function(e){return T.buildBodyWithRequestInfo(e,this.repository)},Me.prototype.buildRequestInfo=function(){return T.buildRequestInfo(this.repository)},Me.decorators=[{type:i.Injectable}],Me.ctorParameters=function(){return[{type:a.HttpClient},{type:String},{type:f},{type:me},{type:I.EventBus}]},Me);function Me(e,t,r,n,o){this.httpClient=e,this.httpService=new H(this.httpClient),this.baseUri=t;var i=n.getInjector();this.sessionService=new Q(e,t,r,i),this.repository=n,this.eventBus=o}var Te=(je.prototype.getData=function(e,t){var r=e.split(".")[0],n=e.split(".")[1];return t=t||{},!0===this.ifEnableExtendLoadMethod(e)?this.extendGetHelpData(n,r,t):this.getHelpData(n,r,t)},je.prototype.saveUserSettings=function(e){return this.befRepository.restService.invoke("/api/runtime/bcc/v1.0/datagrid/settings","POST",null,{body:e},!1)},je.prototype.getUserSettings=function(e){var t="/api/runtime/bcc/v1.0/datagrid/settings/"+e;return this.befRepository.restService.invoke(t,"GET",null,null,!1)},je.prototype.ifEnableExtendLoadMethod=function(e){if(this.context&&this.context.hasOwnProperty("enableExtendLoadMethod"))return this.context.enableExtendLoadMethod;var t=!1;if(this.frameContext){var r=e+"@"+this.frameContext.repository.apiUri;t=this.frameContext.getParam(r)}return t},je.prototype.getHelpData=function(e,t,r){var n=this,o=this.befRepository.restService.baseUri+"/elementhelps/"+e;return this.befRepository.updateDataAndVariableChanges().pipe(d.switchMap(function(){return n.befRepository.restService.invoke(o,"GET",{nodeCode:t,queryParam:JSON.stringify(r)},null,!1)}))},je.prototype.extendGetHelpData=function(e,t,r){var n=this.befRepository.restService.baseUri+"/extension/elementhelps",o={body:{labelId:e,nodeCode:t,queryParam:r,requestInfo:this.befRepository.restService.buildRequestInfo()}};return this.befRepository.restService.invoke(n,"PUT",null,o,!1,!0,!0).pipe(d.map(function(e){return e&&e.returnValue||null}))},je.prototype.convert2TreeDataWithPathCode=function(n,t,r){var o=this;void 0===t&&(t=1),void 0===r&&(r="01");var e=n.filter(function(e){return e.layer===t&&e.pathcode===r});if(1<t&&(e=n.filter(function(e){return e.layer===t&&e.pathcode.substr(0,2*(t-1))===r})),e.length){var i=e.map(function(e){return{data:e,children:[]}});return i.forEach(function(e){var t,r=o.convert2TreeDataWithPathCode(n,e.data.layer+1,e.data.pathcode);(t=e.children).push.apply(t,D(r))}),i}},je.decorators=[{type:i.Injectable}],je.ctorParameters=function(){return[{type:I.Repository},{type:I.FrameContext,decorators:[{type:i.Optional}]}]},je);function je(e,t){this.frameContext=t,this.befRepository=e}var Ae=(Ue.prototype.createSession=function(e){var t=this.sessionService.getUserSessionId();return t?this.befRepository.restService.invoke(e,"POST",null,{headers:new a.HttpHeaders({SessionId:t}),responseType:"text"},!1).pipe(d.switchMap(function(e){return b.of({status:!0,payload:e})})):b.of({status:!1,payload:"用户登录信息已过期,请重新登录"})},Ue.prototype.getData=function(e,t){var r=this,n={};t.condition&&(n=t.condition),"/"===e[e.length-1]&&(e=e.substr(0,e.length-1));var o=e+"/extension/query",i=e+"/service/createsession";if(n){var a=JSON.stringify(n);o=o+"?entityFilter="+a}return this.createSession(i).pipe(d.switchMap(function(e){if(e.status)return e.payload,r.befRepository.restService.invoke(o,"PUT",null,{},!1);throw new Error(e.payload)}),s.map(function(e){var t=e.returnValue,r={items:t.result};return t.pagination?Object.assign({},r,{total:t.pagination.totalCount,pageInfo:{pageSize:t.pagination.pageSize,pageIndex:t.pagination.pageIndex,enablePager:!0}}):r}))},Ue.decorators=[{type:i.Injectable}],Ue.ctorParameters=function(){return[{type:I.Repository},{type:f}]},Ue);function Ue(e,t){this.sessionService=t,this.befRepository=e}var He=(Ve.isExistUnsaveData=function(e){var t=!1;if(!e||!e.entityCollection)throw"Current Object is null or it's entityCollection is null.";var r=e.entityCollection.toArray();if(e.dataChangeHistory.isChanged())return!0;for(var n=0;n<r.length;n++)if(0<r[n].changes.length){t=!0;break}return t},Ve);function Ve(){}var ke=(Fe.prototype.toString=function(){return this.url},Fe);function Fe(e,t){void 0===t&&(t=null);var r=this;this.url=e,this.paths=t,this.paths&&Object.keys(t).forEach(function(e){-1!==r.url.indexOf("{"+e+"}")&&(r.url=r.url.replace("{"+e+"}",""+t[e]))})}var Ne=(_e.prototype.getData=function(e,t,r){void 0===t&&(t={}),void 0===r&&(r="GET");var n=new a.HttpHeaders({"content-type":"application/json"});return"get"!==r.toLowerCase()?this.befRest.restService.invoke(e,r,null,{headers:n,body:t}):this.befRest.restService.invoke(e,r,t,{headers:n})},_e.decorators=[{type:i.Injectable}],_e.ctorParameters=function(){return[{type:I.Repository}]},_e);function _e(e){this.befRest=e}var Le=(Ke.prototype.getData=function(e,t,r){void 0===t&&(t={}),void 0===r&&(r="GET");var n=new a.HttpHeaders({"content-type":"application/json"});return this.befRest.restService.invoke(e,r,t,{headers:n})},Ke.decorators=[{type:i.Injectable}],Ke.ctorParameters=function(){return[{type:I.Repository}]},Ke);function Ke(e){this.befRest=e}e.VERSION="ver.",e.ChangeDetailType=S,e.BE_SERVER_URI_TOKEN=p,e.BE_SESSION_HANDLING_STRATEGY_TOKEN=u,e.BefChangeBuilder=c,e.BefChangeHandler=y,e.BefSessionService=Q,e.BefRestService=we,e.BefProxy=qe,e.BefLookupRestService=Te,e.BefLookupDefaultService=Ae,e.BefRepository=me,e.FrameworkSessionService=f,e.NG_VARIABLE=Z,e.NgVariable=$,e.BefRepositoryUtil=He,e.BefDataPathUtil=he,e.UriService=xe,e.Uri=ke,e.DefaultComboHttpService=Ne,e.DefaultDynamiControlGroupHttpService=Le,e.ɵa=ee,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=farris-bef.umd.min.js.map |
{ | ||
"name": "@farris/bef", | ||
"version": "0.0.12-20210828171001-dev", | ||
"version": "0.0.12-20210914160505-dev", | ||
"peerDependencies": { | ||
@@ -5,0 +5,0 @@ "@angular/common": "^7.2.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
3267323