ui5-lib-guard-router 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ui5/build-manifest.json +2 -2
- package/CHANGELOG.md +7 -0
- package/README.md +8 -8
- package/dist/index.d.ts +3 -3
- package/dist/resources/ui5/guard/router/.library +1 -1
- package/dist/resources/ui5/guard/router/GuardPipeline-dbg.js +3 -1
- package/dist/resources/ui5/guard/router/GuardPipeline-dbg.js.map +1 -1
- package/dist/resources/ui5/guard/router/GuardPipeline.d.ts.map +1 -1
- package/dist/resources/ui5/guard/router/GuardPipeline.js +1 -1
- package/dist/resources/ui5/guard/router/GuardPipeline.js.map +1 -1
- package/dist/resources/ui5/guard/router/Router-dbg.js +20 -15
- package/dist/resources/ui5/guard/router/Router-dbg.js.map +1 -1
- package/dist/resources/ui5/guard/router/Router.d.ts +2 -1
- package/dist/resources/ui5/guard/router/Router.d.ts.map +1 -1
- package/dist/resources/ui5/guard/router/Router.js +1 -1
- package/dist/resources/ui5/guard/router/Router.js.map +1 -1
- package/dist/resources/ui5/guard/router/library-dbg.js +1 -1
- package/dist/resources/ui5/guard/router/library-dbg.js.map +1 -1
- package/dist/resources/ui5/guard/router/library-preload.js +4 -4
- package/dist/resources/ui5/guard/router/library-preload.js.map +1 -1
- package/dist/resources/ui5/guard/router/library.js +1 -1
- package/dist/resources/ui5/guard/router/library.js.map +1 -1
- package/dist/resources/ui5/guard/router/manifest.json +1 -1
- package/package.json +1 -1
- package/src/GuardPipeline.ts +3 -1
- package/src/Router.ts +19 -18
- package/src/manifest.json +1 -1
|
@@ -426,7 +426,8 @@ declare module "ui5/guard/router/Router" {
|
|
|
426
426
|
* Fires synchronously after every guard pipeline settlement with
|
|
427
427
|
* a {@link NavigationResult} payload. Unlike the one-shot
|
|
428
428
|
* `navigationSettled()` Promise, this event fires for every
|
|
429
|
-
* navigation outcome without re-registration.
|
|
429
|
+
* navigation outcome without re-registration. It does not fire for the
|
|
430
|
+
* navigation that `destroy()` cancels.
|
|
430
431
|
*
|
|
431
432
|
* @param oData - Application-specific payload passed to the handler as second argument.
|
|
432
433
|
* @param fnFunction - The function to be called when the event occurs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.d.ts","sourceRoot":"../../../../..","sources":["src/Router.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,yBAAyB,CAAC;IACzC,OAAO,YAAY,MAAM,sBAAsB,CAAC;IAIhD,OAAO,OAAO,MAAM,6BAA6B,CAAC;IAElD,OAAO,KAAK,EAAE,yBAAyB,EAAa,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;IACjH,OAAO,KAAK,KAAK,MAAM,2BAA2B,CAAC;IACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;IAChE,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;IACvD,OAAO,KAAK,EACX,OAAO,EAEP,iBAAiB,EAEjB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,6BAA6B,EAC7B,gBAAgB,EAChB,MAAM,wBAAwB,CAAC;IAGhC,OAAO,EAAE,KAAK,eAAe,EAAqE,MAAM,8BAA8B,CAAC;IAKvI,MAAM,gBAAgB,KAAuC,CAAC;IAC9D,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;IAErD;;;;OAIG;IACH,SAAS,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CASlD;IAED,SAAS,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,GAAG,KAAK,IAAI,gBAAgB,CAExF;IAED,sGAAsG;IACtG,UAAU,WAAW;QACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KACtB;IAED,wGAAwG;IACxG,IAAI,QAAQ,EAAE,WAAW,GAAG,IAAW,CAA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AAC,kBAAkB;QAa1B;;;;;;;;WAQG;QACH,OAAO,CAAC,iBAAiB;QAwBzB;;;;;;;;;;WAUG;QACH,OAAO,CAAC,iBAAiB;QAYzB;;;;;;;;;;;;WAYG;QACH,OAAO,CAAC,SAAS;QAgEjB;;;;;;;;;;;;WAYG;QACH,OAAO,CAAC,sBAAsB;QA2E9B,yHAAyH;QACzH,OAAO,CAAC,WAAW;QAKnB;;;WAGG;QACH,OAAO,CAAC,cAAc;QAItB;;;WAGG;QACH,OAAO,CAAC,eAAe;QAQvB;;;WAGG;QACH,OAAO,CAAC,mBAAmB;QAqB3B;;;;;WAKG;QACH,OAAO,CAAC,mBAAmB;QAuB3B;;;;WAIG;QACH,OAAO,CAAC,gBAAgB;QASxB;;;;WAIG;QACH,OAAO,CAAC,gBAAgB;QASxB;;;;;;WAMG;QACH,OAAO,CAAC,kBAAkB;QAe1B;;;;WAIG;QACH,OAAO,CAAC,aAAa;QAerB;;;;;;;;;;;;;;;;WAgBG;QACH,OAAO,CAAC,eAAe;QAyBvB;;;WAGG;QACH,OAAO,CAAC,gBAAgB;QAKxB;;;WAGG;QACH,OAAO,CAAC,cAAc;QAQtB;;;;;;;;;;WAUG;QACH,OAAO,CAAC,YAAY;QAQpB;;;WAGG;QACH,OAAO,CAAC,qBAAqB;QAS7B;;;;;WAKG;QACH,OAAO,CAAC,sBAAsB;QAmB9B,2GAA2G;QAC3G,OAAO,CAAC,mBAAmB;QAM3B;;;;;WAKG;QACM,OAAO,IAAI,IAAI;KAcxB;CAEA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["sap/m/routing/Router","sap/base/Log","sap/ui/core/library","sap/ui/core/routing/HashChanger","sap/ui/core/routing/History","./NavigationOutcome","./GuardPipeline","./GuardConfig","./GuardModules","./PatternTree","./RouteMeta"],function(t,e,s,i,n,r,a,o,h,u,c){"use strict";function d(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const l=d(r);const _=d(a);const f=a["isPromiseLike"];const p=a["isPromiseResolver"];const g=a["LOG_COMPONENT"];const m=o["isRecord"];const H=o["parseGuardRouterConfig"];const v=h["createLazyGuards"];const R=h["loadGuardModules"];const y=u["byRouteDepth"];const k=u["expandForNewRoute"];const w=u["expandToDescendants"];const b=d(c);const G=c["EMPTY_META"];const N=s.routing.HistoryDirection;function C(t){const e=t=>t==="guardRouter";return new Proxy(t,{get:(t,s,i)=>e(s)?undefined:Reflect.get(t,s,i),has:(t,s)=>!e(s)&&Reflect.has(t,s),ownKeys:t=>Reflect.ownKeys(t).filter(t=>!e(t)),getOwnPropertyDescriptor:(t,s)=>e(s)?undefined:Reflect.getOwnPropertyDescriptor(t,s)})}function L(t){return typeof t==="object"&&t!==null}let M=null;let P=null;window.navigation?.addEventListener("currententrychange",t=>{const e=window.location.href;if(P!==e)P=null;const s=window.navigation.currentEntry;if(s&&t.navigationType==="traverse"){M={offset:s.index-t.from.index,href:e}}else if(M?.href!==e){M=null}});const D={kind:"idle"};const E=10;const T=t.extend("ui5.guard.router.Router",{constructor:function e(s,i,n,...r){const a=m(i);const o=a?i.guardRouter:undefined;t.prototype.constructor.apply(this,[s,a?C(i):i,n,...r]);this._pipeline=new _;this._currentRoute="";this._currentHash=null;this._phase=D;this._parseGeneration=0;this._suppressedHash=null;this._undo=null;this._reportedHash=null;this._lastReport=null;this._reportOutdated=false;this._rootHashChanger=null;this._stoppedRoute="";this._settlementResolvers=[];this._lastSettlement=null;this._sourceDescriptors=[];this._manifestGuards=[];this._destroyed=false;this._nativeMatching=false;this._matchWaiters=[];this._blockLoad=null;this._ownerComponent=n;this._routeNames??=[];this._greedyRouteNames??=[];this._mirrorMatchingProcess();let h="";const u=n?.getManifestEntry("sap.app");if(m(u)&&typeof u.id==="string"){h=u.id}const c=H(o,h);this._options=c.options;this._meta=new b(c.routeMeta,this._options.inheritance==="pattern-tree"?()=>this._collectRoutePatterns():null);this._pendingGuardDescriptors=c.guards;if(this._options.guardLoading==="lazy"){const t=[...new Set(this._pendingGuardDescriptors.map(t=>t.modulePath))];sap.ui.require(t,undefined,()=>{})}},_mirrorMatchingProcess:function t(){Object.defineProperty(this,"_bMatchingProcessStarted",{get:()=>this._isMatching(),set:t=>{this._nativeMatching=t}})},_isMatching:function t(){return this._nativeMatching||this._phase.kind==="evaluating"&&this._phase.postponed===true},attachRouteMatched:function e(s,i,n){if(p(s)&&(!this.isInitialized()||this._isMatching())){this._matchWaiters.push(s)}return t.prototype.attachRouteMatched.call(this,s,i,n)},_settleMatchWaiters:function t(){if(this._phase.kind==="evaluating"&&this._phase.postponed)return;const e=this._matchWaiters;this._matchWaiters=[];if(this._nativeMatching)return;for(const t of e)t()},initialize:function t(e){if(this._blockLoad){if(!this._blockLoad.start){this._blockLoad.start=true;this._blockLoad.ignoreInitialHash=e}return this}if(this._pendingGuardDescriptors.length===0){return this._start(e)}const s=this._pendingGuardDescriptors.map(t=>({...t,source:t}));this._pendingGuardDescriptors=[];this._sourceDescriptors=s;const i=this._options.inheritance==="pattern-tree"?w(s,this._collectRoutePatterns()):s;if(this._options.guardLoading==="lazy"){this._registerLazyGuards(i);return this._start(e)}const n={start:true,ignoreInitialHash:e};this._blockLoad=n;void R(i).then(t=>{this._blockLoad=null;if(this._destroyed)return;for(const{descriptor:e,guards:s}of t){for(const t of s)this._registerManifestGuard(e,t)}if(n.start)this._start(n.ignoreInitialHash)});return this},_start:function e(s){const n=!this.isInitialized();if(n){this.getHashChanger().attachEvent("hashChanged",this._onHashReported,this);this._rootHashChanger=i.getInstance();this._rootHashChanger.attachEvent("hashChanged",this._onRootHashChanged,this)}t.prototype.initialize.call(this,s);if(n&&s){const t=this.getHashChanger().getHash();this._currentRoute=this._stoppedRoute;this._currentHash=t??null}return this},_onHashReported:function t(e){const s=e.getParameter("newHash");const i=this.getHashChanger().getHash();this._reportedHash=s;this._reportOutdated=i!==s&&i===this._lastReport;if(!this._reportOutdated)this._lastReport=s},_onRootHashChanged:function t(e){const s=e.getParameter("newHash");const n=e.getParameter("oldHash")??"";const r=i.getInstance();if(r===this._rootHashChanger){this._completeUndo(s,n);return}r.detachEvent("hashChanged",this._onRootHashChanged,this);r.attachEvent("hashChanged",this._onRootHashChanged,this);this._rootHashChanger=r;queueMicrotask(()=>this._completeUndo(s,n))},_completeUndo:function t(e,s){const i=this._undo;if(!i||i.first!==e)return;i.fullHash??=s;if(this._phase.kind==="restoring"&&this._phase.awaitsReport)this._replaceFullHash(i.fullHash)},addRoute:function e(s,i){t.prototype.addRoute.call(this,s,i);const n=s.name;this._routeNames??=[];this._greedyRouteNames??=[];if(this._routeNames.includes(n))return;this._routeNames.push(n);if(s.greedy)this._greedyRouteNames.push(n);if(!this._meta)return;this._meta.invalidate();if(this._options.inheritance!=="pattern-tree")return;const r=this._collectRoutePatterns();const a=y(this._sourceDescriptors,new Map(r.map(t=>[t.name,t.pattern])));const o=t=>a.findIndex(e=>e.source===t.source);for(const t of k(this._sourceDescriptors,n,r)){const e=o(t);const s=this._manifestGuards.filter(s=>s.descriptor.route===t.route&&s.descriptor.type===t.type&&o(s.descriptor)>e).toSorted((t,e)=>o(t.descriptor)-o(e.descriptor))[0];for(const e of v(t))this._registerManifestGuard(t,e,s?.fn)}},addGuard:function t(e){if(!this._isFn(e,"addGuard"))return this;this._pipeline.addGlobalGuard(e);return this},removeGuard:function t(e){if(!this._isFn(e,"removeGuard"))return this;this._pipeline.removeGlobalGuard(e);return this},addRouteGuard:function t(s,i){if(L(i)){this._handleUnknownRouteRegistration(s,"addRouteGuard");let t=false;if(i.beforeEnter!==undefined){t=true;if(this._isFn(i.beforeEnter,"addRouteGuard",s)){this._pipeline.addEnterGuard(s,i.beforeEnter)}}if(i.beforeLeave!==undefined){t=true;if(this._isFn(i.beforeLeave,"addRouteGuard",s)){this._pipeline.addLeaveGuard(s,i.beforeLeave)}}if(!t){e.info("addRouteGuard: config has no beforeEnter or beforeLeave",s,g)}return this}if(!this._isFn(i,"addRouteGuard",s))return this;this._handleUnknownRouteRegistration(s,"addRouteGuard");this._pipeline.addEnterGuard(s,i);return this},removeRouteGuard:function t(e,s){if(L(s)){if(typeof s.beforeEnter==="function"){this.removeRouteGuard(e,s.beforeEnter)}if(typeof s.beforeLeave==="function"){this.removeLeaveGuard(e,s.beforeLeave)}return this}if(!this._isFn(s,"removeRouteGuard",e))return this;this._pipeline.removeEnterGuard(e,s);return this},addLeaveGuard:function t(e,s){if(!this._isFn(s,"addLeaveGuard",e))return this;this._handleUnknownRouteRegistration(e,"addLeaveGuard");this._pipeline.addLeaveGuard(e,s);return this},_resolveNavToArgs:function t(e,s,i){if(typeof e==="boolean"){return{replace:e,guardOptions:typeof s==="object"?s:undefined}}return{componentTargetInfo:e,replace:typeof s==="boolean"?s:undefined,guardOptions:typeof s==="object"?s:i}},_isFn:function t(s,i,n){if(typeof s==="function")return true;e.warning(`${i}: not a function, ignoring`,n,g);return false},_handleUnknownRouteRegistration:function t(s,i,n="guard registered"){if(this.getRoute(s))return;switch(this._options.unknownRouteRegistration){case"ignore":return;case"throw":throw new Error(`${i} called for unknown route "${s}". `+`Set guardRouter.unknownRouteRegistration to "warn" or "ignore" to allow this.`);case"warn":e.warning(`${i}: unknown route, ${n} anyway`,s,g)}},removeLeaveGuard:function t(e,s){if(!this._isFn(s,"removeLeaveGuard",e))return this;this._pipeline.removeLeaveGuard(e,s);return this},getRouteMeta:function t(s){if(s!==""&&!this.getRoute(s)){e.warning("getRouteMeta: unknown route, returning empty metadata",s,g);return G}return this._meta.get(s)},setRouteMeta:function t(s,i){if(!m(i)){e.warning("setRouteMeta: expected object, ignoring",s,g);return this}if(s!=="")this._handleUnknownRouteRegistration(s,"setRouteMeta","metadata stored");this._meta.set(s,i);return this},navigationSettled:function t(){if(this._phase.kind==="idle"||this._phase.kind==="committing"){return Promise.resolve(this._lastSettlement??{status:l.Committed,route:this._currentRoute,hash:this._currentHash??""})}return new Promise(t=>{this._settlementResolvers.push(t)})},attachNavigationSettled:function t(e,s,i){return this.attachEvent("navigationSettled",e,s,i)},detachNavigationSettled:function t(e,s){this.detachEvent("navigationSettled",e,s);return this},_flushSettlement:function t(s){this._lastSettlement=s;e.debug(`Navigation settled: ${s.status}`,s.hash,g);queueMicrotask(()=>this._settleMatchWaiters());const i=this._settlementResolvers;this._settlementResolvers=[];for(const t of i){t(s)}try{this.fireEvent("navigationSettled",s)}catch(t){e.error("A navigationSettled handler threw",String(t),g)}},navTo:function s(i,n,r,a,o){const{componentTargetInfo:h,replace:u,guardOptions:c}=this._resolveNavToArgs(r,a,o);if(this._phase.kind==="committing"&&this._phase.origin==="redirect"){t.prototype.navTo.call(this,i,n,h,u);return this}if(!this.isInitialized()){t.prototype.navTo.call(this,i,n,h,u);return this}const d=this.getRoute(i);if(!d){this._cancelPendingNavigation(true);t.prototype.navTo.call(this,i,n,h,u);return this}const l=d.getURL(n??{});const _=this._matchRoute(l);const p=_.name;if(l===this._currentHash){this._cancelPendingNavigation(true);const e=this.getHashChanger().getHash();if(e===undefined||e===l){t.prototype.navTo.call(this,i,n,h,u)}return this}const m=c?.skipGuards===true||this._options.navToPreflight==="bypass";if(!m&&this._phase.kind==="evaluating"&&l===this._phase.attempt.hash){return this}if(!m&&this._options.navToPreflight==="off"){t.prototype.navTo.call(this,i,n,h,u);return this}const H=this._pendingRestoresHash();this._cancelPendingNavigation();if(m){this._navigateAllowed(i,n,h,u,l,p,H);return this}const v=this._startAttempt(l,H);const{generation:R}=v;const y=this._createGuardContext(_,l,v.controller.signal);const k=this._evaluateGuards(y);if(f(k)){this._applyWhenDecided(k,t=>{if(R!==this._parseGeneration){e.debug("Async preflight result discarded (superseded by newer navigation)",l,g);return}this._applyPreflightDecision(t,i,n,h,u,l,p,y.bag,v)},l,H);return this}this._applyPreflightDecision(k,i,n,h,u,l,p,y.bag,v);return this},_navigateAllowed:function e(s,n,r,a,o,h,u){this._phase={kind:"committing",route:h,hash:o,origin:"preflight",restoreHash:u,writtenOver:i.getInstance().getHash()};try{t.prototype.navTo.call(this,s,n,r,a);if(!this._commitAfterNavTo(r)){this._blockNavigation(o,u)}}finally{if(this._phase.kind==="committing"){this._phase=D}}},_applyPreflightDecision:function t(e,s,i,n,r,a,o,h,u){if(u.generation!==this._parseGeneration)return;switch(e.action){case"allow":this._navigateAllowed(s,i,n,r,a,o,u.restoreHash);break;case"block":this._blockNavigation(a,u.restoreHash);break;case"redirect":this._startRedirectChain(e.target,a,h,u,r);break;case"error":this._errorNavigation(e.error,a,u.restoreHash);break}},parse:function s(r){if(this._destroyed){t.prototype.parse.call(this,r);return}const a=this._reportedHash===r;this._reportedHash=null;if(a&&this._reportOutdated)return;if(r===this._suppressedHash)return;const o=this._undo;if(o?.started&&o.fullHash===i.getInstance().getHash()){this._undo=null;this._currentHash=r;this._finishRestore(r);return}const h=this._phase;const u=h.kind==="awaitingHash"?h.commit:h.kind==="committing"?h:null;if(u?.hash===r){this._phase=u;this._commitNavigation(r,u.route);return}const c=this._currentHash;if(r===c){if(this._pendingRestoresHash()){if(this._phase.kind==="evaluating")this._cancelPendingNavigation();else this._undo=null}else{t.prototype.parse.call(this,r)}return}const d=this._matchRoute(r);const l=d.name;const _=this._pendingRestoresHash()?o:null;const p=this._phase.kind==="restoring";this._cancelPendingNavigation();if(this._currentHash!==c)return;this._undo=p?null:this._describeUndo(_,a);if(this._undo&&u===h&&!u.restoreHash)this._undo.fullHash=u.writtenOver;const m=a?n.getInstance().getDirection():undefined;const H=this._startAttempt(r,true,m);const{generation:v}=H;const R=this._createGuardContext(d,r,H.controller.signal);const y=this._evaluateGuards(R);if(f(y)){this._applyWhenDecided(y,t=>{if(v!==this._parseGeneration){e.debug("Async guard result discarded (superseded by newer navigation)",r,g);return}this._applyDecision(t,r,l,R.bag,H)},r,true);return}this._applyDecision(y,r,l,R.bag,H)},stop:function e(){if(this._blockLoad)this._blockLoad.start=false;this._cancelPendingNavigation();this._undo=null;if(this._currentHash!==null)this._stoppedRoute=this._currentRoute;this._currentRoute="";this._currentHash=null;this._lastSettlement=null;this._detachHashListeners();t.prototype.stop.call(this);return this},_detachHashListeners:function t(){this.getHashChanger().detachEvent("hashChanged",this._onHashReported,this);i.getInstance().detachEvent("hashChanged",this._onRootHashChanged,this);this._rootHashChanger=null},_cancelPendingNavigation:function t(e=false){++this._parseGeneration;const s=this._phase;const i=this._pendingRestoresHash();this._phase=D;if(s.kind==="idle"||s.kind==="committing")return;if(s.kind==="restoring"){this._flushSettlement(s.result);return}if(s.kind==="evaluating")s.attempt.controller.abort();this._settleUncommitted({status:l.Cancelled,route:this._currentRoute,hash:this._currentHash??""},s.kind==="evaluating"?s.attempt.hash:s.commit.hash,e&&i)},_pendingRestoresHash:function t(){const e=this._phase;if(e.kind==="evaluating")return e.attempt.restoreHash;if(e.kind==="committing")return e.restoreHash;return e.kind==="awaitingHash"&&e.commit.restoreHash},_startAttempt:function t(e,s,i){if(this._phase.kind==="evaluating")this._phase.attempt.controller.abort();const n={hash:e,controller:new AbortController,generation:++this._parseGeneration,restoreHash:s,direction:i};this._phase={kind:"evaluating",attempt:n};return n},_applyWhenDecided:function t(s,i,n,r){if(this._phase.kind==="evaluating")this._phase={...this._phase,postponed:true};s.then(t=>{const s=this._lastSettlement;try{i(t)}catch(t){e.error("Navigation failed after its guards had settled",t instanceof Error?t:String(t),g);if(this._lastSettlement===s){this._errorNavigation(t,n,r)}}})},_applyDecision:function t(e,s,i,n,r){if(r.generation!==this._parseGeneration)return;switch(e.action){case"allow":this._phase={kind:"committing",route:i,hash:s,origin:"parse",restoreHash:false};this._commitNavigation(s,i);break;case"block":this._blockNavigation(s);break;case"redirect":this._startRedirectChain(e.target,s,n,r,true);break;case"error":this._errorNavigation(e.error,s);break}},_alignTitleHistory:function t(e){if(e===N.NewEntry||e===N.Forwards){Reflect.set(this,"_bLastHashReplaced",false)}else if(e===N.Backwards){const t=this.getTitleHistory();const e=t.at(-1);const s=t.at(-2);if(m(e)&&m(s)&&!e.isHome&&e.title!==s.title){t.splice(-2,1)}}},_commitNavigation:function e(s,i){const n=this._phase.kind==="committing"&&this._phase.origin==="redirect";if(this._phase.kind==="committing")this._alignTitleHistory(this._phase.direction);this._undo=null;this._currentHash=s;this._currentRoute=i;this._phase=D;this._flushSettlement({status:n?l.Redirected:this._currentRoute===""?l.Bypassed:l.Committed,route:this._currentRoute,hash:s});if(this._currentHash!==s)return;t.prototype.parse.call(this,s)},_commitAfterNavTo:function t(e){const s=this._phase;if(s.kind!=="committing")return true;if(this.getHashChanger().getHash()===s.hash){this._commitNavigation(s.hash,s.route);return true}if(!e||Object.keys(e).length===0)return false;this._phase={kind:"awaitingHash",commit:s};return true},_redirect:function t(s,i){const n=typeof s==="string"?s:s.route;const r=this.getRoute(n);if(!r){e.warning(`Guard redirect target "${n}" is not a known route, treating as blocked`,undefined,g);this._blockNavigation(i.attemptedHash,i.restoreHash);return}let a;try{a=r.getURL(typeof s==="string"?{}:s.parameters??{})}catch(t){e.error(`Guard redirect target "${n}" has no valid hash, navigation failed`,String(t),g);this._errorNavigation(t,i.attemptedHash,i.restoreHash);return}if(i.visited.has(a)){e.error(`Guard redirect loop detected: ${[...i.visited,a].join(" -> ")}`,undefined,g);this._blockNavigation(i.attemptedHash,i.restoreHash);return}if(i.visited.size>E){e.error(`Guard redirect chain exceeded maximum depth (${E}): ${[...i.visited].join(" -> ")}`,undefined,g);this._blockNavigation(i.attemptedHash,i.restoreHash);return}i.visited.add(a);const o=this._matchRoute(a);const h=o.name;const u=this._createGuardContext(o,a,i.signal,i);const c=this._evaluateGuards(u,true);if(f(c)){this._applyWhenDecided(c,t=>this._applyRedirectDecision(t,s,a,h,i),i.attemptedHash,i.restoreHash);return}this._applyRedirectDecision(c,s,a,h,i)},_applyRedirectDecision:function e(s,n,r,a,o){if(o.generation!==this._parseGeneration)return;switch(s.action){case"allow":{const e=typeof n==="string"?undefined:n.componentTargetInfo;if(r===this._currentHash){this._phase=D;this._settleUncommitted({status:l.Redirected,route:this._currentRoute,hash:r},o.attemptedHash,o.restoreHash,typeof n!=="string"&&e?()=>{if(this.getHashChanger().getHash()!==r)return;t.prototype.navTo.call(this,n.route,n.parameters??{},e,o.replace)}:undefined);break}this._phase={kind:"committing",route:a,hash:r,origin:"redirect",direction:o.direction,restoreHash:o.restoreHash,writtenOver:i.getInstance().getHash()};try{const t=this.getHashChanger().getHash()===r;if(typeof n==="string"){if(!t)this.navTo(n,{},{},o.replace)}else if(!t||e){this.navTo(n.route,n.parameters??{},e,o.replace)}if(!this._commitAfterNavTo(e)){this._blockNavigation(o.attemptedHash,o.restoreHash)}}finally{if(this._phase.kind==="committing"){this._phase=D}}break}case"block":this._blockNavigation(o.attemptedHash,o.restoreHash);break;case"redirect":this._redirect(s.target,o);break;case"error":this._errorNavigation(s.error,o.attemptedHash,o.restoreHash);break}},_matchRoute:function t(e){const s=this.getRouteInfoByHash(e);return{name:s?.name??"",arguments:s?.arguments??{}}},_greedyMatches:function t(e,s){return this._greedyRouteNames.filter(t=>t!==s&&this.getRoute(t)?.match(e))},_evaluateGuards:function t(e,s=false){return this._pipeline.evaluate(e,{skipLeaveGuards:s,alsoLeaving:this._greedyMatches(e.fromHash,e.fromRoute),alsoEntering:this._greedyMatches(e.toHash,e.toRoute)})},_createGuardContext:function t(e,s,i,n){const r=n?n.fromRoute:this._currentRoute;return{toRoute:e.name,toHash:s,toArguments:e.arguments,fromRoute:r,fromHash:n?n.fromHash:this._currentHash??"",signal:i,bag:n?n.bag:new Map,toMeta:this.getRouteMeta(e.name),fromMeta:this.getRouteMeta(r),ownerComponent:this._ownerComponent}},_startRedirectChain:function t(e,s,i,n,r){const a=new Set;a.add(s);this._redirect(e,{visited:a,attemptedHash:s,restoreHash:n.restoreHash,replace:r,direction:n.direction,fromRoute:this._currentRoute,fromHash:this._currentHash??"",signal:n.controller.signal,generation:n.generation,bag:i})},_blockNavigation:function t(e,s=true){this._phase=D;this._settleUncommitted({status:l.Blocked,route:this._currentRoute,hash:this._currentHash??""},e,s)},_errorNavigation:function t(e,s,i=true){this._phase=D;this._settleUncommitted({status:l.Error,route:this._currentRoute,hash:this._currentHash??"",error:e},s,i)},_settleUncommitted:function t(e,s,i,n){const r=i&&this._currentHash===null&&!!s;if(i&&!r&&!this._undoHashChange(e,n))return;this._flushSettlement(e);n?.();if(r&&this._currentHash===null)this._restoreHash("",false)},_describeUndo:function t(e,s){if(!s)return e;const n=i.getInstance().getHash();const r=M;if(!e)return{first:n,fullHash:undefined,shown:n,step:r,started:false};const a=e.step&&r?e.step.offset+r.offset:0;return{first:e.first,fullHash:e.fullHash,shown:n,step:r&&a?{offset:a,href:r.href}:null,started:false}},_undoHashChange:function t(e,s){const n=this._undo;const r=this._currentHash;const a=i.getInstance().getHash();if(n===null||r===null||n.shown!==a||n.fullHash===a){this._restoreHash(r??"");return true}const o=window.location.href;n.started=true;this._phase={kind:"restoring",result:e,whenBack:s};if(P===o){}else if(n.step){P=o;window.history.go(-n.step.offset)}else if(n.fullHash===undefined){this._phase={...this._phase,awaitsReport:true}}else{this._replaceFullHash(n.fullHash)}return false},_replaceFullHash:function t(e){i.getInstance().replaceHash(e,N.Unknown);this._finishRestore()},_finishRestore:function t(e){const s=this._phase;if(s.kind!=="restoring")return;this._phase=D;this._flushSettlement(e===undefined?s.result:{...s.result,hash:e});s.whenBack?.()},_restoreHash:function t(e,s=true){const i=this.getHashChanger();if(i.getHash()===e)return;this._suppressedHash=s?e:null;void i.replaceHash(e,N.Unknown);this._suppressedHash=null},_collectRoutePatterns:function t(){const e=[];for(const t of this._routeNames){const s=this.getRoute(t)?.getPattern();if(s!==undefined)e.push({name:t,pattern:s})}return e},_registerManifestGuard:function t(s,i,n){try{if(s.route==="*"){this.addGuard(i);return}if(s.type==="leave"){this._handleUnknownRouteRegistration(s.route,"addLeaveGuard");this._pipeline.addLeaveGuard(s.route,i,n)}else{this._handleUnknownRouteRegistration(s.route,"addRouteGuard");this._pipeline.addEnterGuard(s.route,i,n)}this._manifestGuards.push({descriptor:s,fn:i})}catch(t){e.error(`guardRouter.guards: failed to register "${s.modulePath}"`,String(t),g)}},_registerLazyGuards:function t(e){for(const t of e){for(const e of v(t))this._registerManifestGuard(t,e)}},destroy:function e(){if(this._destroyed)return this;this._destroyed=true;this._pipeline.clear();this._pendingGuardDescriptors=[];this._sourceDescriptors=[];this._manifestGuards=[];this._cancelPendingNavigation();this._lastSettlement=null;this._detachHashListeners();this._meta.clear();t.prototype.destroy.call(this);return this}});return T});
|
|
1
|
+
sap.ui.define(["sap/m/routing/Router","sap/base/Log","sap/ui/core/library","sap/ui/core/routing/HashChanger","sap/ui/core/routing/History","./NavigationOutcome","./GuardPipeline","./GuardConfig","./GuardModules","./PatternTree","./RouteMeta"],function(t,e,s,i,n,r,a,o,h,u,c){"use strict";function d(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const l=d(r);const _=d(a);const f=a["isPromiseLike"];const p=a["isPromiseResolver"];const g=a["LOG_COMPONENT"];const m=o["isRecord"];const H=o["parseGuardRouterConfig"];const v=h["createLazyGuards"];const R=h["loadGuardModules"];const y=u["byRouteDepth"];const k=u["expandForNewRoute"];const w=u["expandToDescendants"];const G=d(c);const b=c["EMPTY_META"];const N=s.routing.HistoryDirection;function C(t){const e=t=>t==="guardRouter";return new Proxy(t,{get:(t,s,i)=>e(s)?undefined:Reflect.get(t,s,i),has:(t,s)=>!e(s)&&Reflect.has(t,s),ownKeys:t=>Reflect.ownKeys(t).filter(t=>!e(t)),getOwnPropertyDescriptor:(t,s)=>e(s)?undefined:Reflect.getOwnPropertyDescriptor(t,s)})}function M(t){return typeof t==="object"&&t!==null}let L=null;let P=null;window.navigation?.addEventListener("currententrychange",t=>{const e=window.location.href;if(P!==e)P=null;const s=window.navigation.currentEntry;if(s&&t.navigationType==="traverse"){L={offset:s.index-t.from.index,href:e}}else if(L?.href!==e){L=null}});const D={kind:"idle"};const T=10;const E=t.extend("ui5.guard.router.Router",{constructor:function e(s,i,n,...r){const a=m(i);const o=a?i.guardRouter:undefined;t.prototype.constructor.apply(this,[s,a?C(i):i,n,...r]);this._pipeline=new _;this._currentRoute="";this._currentHash=null;this._phase=D;this._parseGeneration=0;this._suppressedHash=null;this._undo=null;this._reportedHash=null;this._lastReport=null;this._reportOutdated=false;this._rootHashChanger=null;this._stoppedRoute="";this._settlementResolvers=[];this._lastSettlement=null;this._sourceDescriptors=[];this._manifestGuards=[];this._destroyed=false;this._nativeMatching=false;this._matchWaiters=[];this._blockLoad=null;this._ownerComponent=n;this._routeNames??=[];this._greedyRouteNames??=[];this._mirrorMatchingProcess();let h="";const u=n?.getManifestEntry("sap.app");if(m(u)&&typeof u.id==="string"){h=u.id}const c=H(o,h);this._options=c.options;this._meta=new G(c.routeMeta,this._options.inheritance==="pattern-tree"?()=>this._collectRoutePatterns():null);this._pendingGuardDescriptors=c.guards;if(this._options.guardLoading==="lazy"){const t=[...new Set(this._pendingGuardDescriptors.map(t=>t.modulePath))];sap.ui.require(t,undefined,()=>{})}},_mirrorMatchingProcess:function t(){Object.defineProperty(this,"_bMatchingProcessStarted",{get:()=>this._isMatching(),set:t=>{this._nativeMatching=t}})},_isMatching:function t(){return this._nativeMatching||this._phase.kind==="evaluating"&&this._phase.postponed===true},attachRouteMatched:function e(s,i,n){if(p(s)&&(!this.isInitialized()||this._isMatching())){this._matchWaiters.push(s)}return t.prototype.attachRouteMatched.call(this,s,i,n)},_settleMatchWaiters:function t(){if(this._phase.kind==="evaluating"&&this._phase.postponed)return;const e=this._matchWaiters;this._matchWaiters=[];if(this._nativeMatching)return;for(const t of e)t()},initialize:function t(e){if(this._blockLoad){if(!this._blockLoad.start){this._blockLoad.start=true;this._blockLoad.ignoreInitialHash=e}return this}if(this._pendingGuardDescriptors.length===0){return this._start(e)}const s=this._pendingGuardDescriptors.map(t=>({...t,source:t}));this._pendingGuardDescriptors=[];this._sourceDescriptors=s;const i=this._options.inheritance==="pattern-tree"?w(s,this._collectRoutePatterns()):s;if(this._options.guardLoading==="lazy"){this._registerLazyGuards(i);return this._start(e)}const n={start:true,ignoreInitialHash:e};this._blockLoad=n;void R(i).then(t=>{this._blockLoad=null;if(this._destroyed)return;for(const{descriptor:e,guards:s}of t){for(const t of s)this._registerManifestGuard(e,t)}if(n.start)this._start(n.ignoreInitialHash)});return this},_start:function e(s){const n=!this.isInitialized();if(n){this.getHashChanger().attachEvent("hashChanged",this._onHashReported,this);this._rootHashChanger=i.getInstance();this._rootHashChanger.attachEvent("hashChanged",this._onRootHashChanged,this)}t.prototype.initialize.call(this,s);if(n&&s){const t=this.getHashChanger().getHash();this._currentRoute=this._stoppedRoute;this._currentHash=t??null}return this},_onHashReported:function t(e){const s=e.getParameter("newHash");const i=this.getHashChanger().getHash();this._reportedHash=s;this._reportOutdated=i!==s&&i===this._lastReport;if(!this._reportOutdated)this._lastReport=s},_onRootHashChanged:function t(e){const s=e.getParameter("newHash");const n=e.getParameter("oldHash")??"";const r=i.getInstance();if(r===this._rootHashChanger){this._completeUndo(s,n);return}r.detachEvent("hashChanged",this._onRootHashChanged,this);r.attachEvent("hashChanged",this._onRootHashChanged,this);this._rootHashChanger=r;queueMicrotask(()=>this._completeUndo(s,n))},_completeUndo:function t(e,s){const i=this._undo;if(!i||i.first!==e)return;i.fullHash??=s;if(this._phase.kind==="restoring"&&this._phase.awaitsReport)this._replaceFullHash(i.fullHash)},addRoute:function e(s,i){t.prototype.addRoute.call(this,s,i);const n=s.name;this._routeNames??=[];this._greedyRouteNames??=[];if(this._routeNames.includes(n))return;this._routeNames.push(n);if(s.greedy)this._greedyRouteNames.push(n);if(!this._meta)return;this._meta.invalidate();if(this._options.inheritance!=="pattern-tree")return;const r=this._collectRoutePatterns();const a=y(this._sourceDescriptors,new Map(r.map(t=>[t.name,t.pattern])));const o=t=>a.findIndex(e=>e.source===t.source);for(const t of k(this._sourceDescriptors,n,r)){const e=o(t);const s=this._manifestGuards.filter(s=>s.descriptor.route===t.route&&s.descriptor.type===t.type&&o(s.descriptor)>e).toSorted((t,e)=>o(t.descriptor)-o(e.descriptor))[0];for(const e of v(t))this._registerManifestGuard(t,e,s?.fn)}},addGuard:function t(e){if(!this._isFn(e,"addGuard"))return this;this._pipeline.addGlobalGuard(e);return this},removeGuard:function t(e){if(!this._isFn(e,"removeGuard"))return this;this._pipeline.removeGlobalGuard(e);return this},addRouteGuard:function t(s,i){if(M(i)){const{beforeEnter:t,beforeLeave:n}=i;if(t===undefined&&n===undefined){e.info("addRouteGuard: config has no beforeEnter or beforeLeave",s,g);return this}const r=t!==undefined&&this._isFn(t,"addRouteGuard",s);const a=n!==undefined&&this._isFn(n,"addRouteGuard",s);if(!r&&!a)return this;this._handleUnknownRouteRegistration(s,"addRouteGuard");if(r)this._pipeline.addEnterGuard(s,t);if(a)this._pipeline.addLeaveGuard(s,n);return this}if(!this._isFn(i,"addRouteGuard",s))return this;this._handleUnknownRouteRegistration(s,"addRouteGuard");this._pipeline.addEnterGuard(s,i);return this},removeRouteGuard:function t(e,s){if(M(s)){if(typeof s.beforeEnter==="function"){this.removeRouteGuard(e,s.beforeEnter)}if(typeof s.beforeLeave==="function"){this.removeLeaveGuard(e,s.beforeLeave)}return this}if(!this._isFn(s,"removeRouteGuard",e))return this;this._pipeline.removeEnterGuard(e,s);return this},addLeaveGuard:function t(e,s){if(!this._isFn(s,"addLeaveGuard",e))return this;this._handleUnknownRouteRegistration(e,"addLeaveGuard");this._pipeline.addLeaveGuard(e,s);return this},_resolveNavToArgs:function t(e,s,i){if(typeof e==="boolean"){return{replace:e,guardOptions:typeof s==="object"?s:undefined}}return{componentTargetInfo:e,replace:typeof s==="boolean"?s:undefined,guardOptions:typeof s==="object"?s:i}},_isFn:function t(s,i,n){if(typeof s==="function")return true;e.warning(`${i}: not a function, ignoring`,n,g);return false},_handleUnknownRouteRegistration:function t(s,i,n="guard registered"){if(this.getRoute(s))return;switch(this._options.unknownRouteRegistration){case"ignore":return;case"throw":throw new Error(`${i} called for unknown route "${s}". `+`Set guardRouter.unknownRouteRegistration to "warn" or "ignore" to allow this.`);case"warn":e.warning(`${i}: unknown route, ${n} anyway`,s,g)}},removeLeaveGuard:function t(e,s){if(!this._isFn(s,"removeLeaveGuard",e))return this;this._pipeline.removeLeaveGuard(e,s);return this},getRouteMeta:function t(s){if(s!==""&&!this.getRoute(s)){e.warning("getRouteMeta: unknown route, returning empty metadata",s,g);return b}return this._meta.get(s)},setRouteMeta:function t(s,i){if(!m(i)){e.warning("setRouteMeta: expected object, ignoring",s,g);return this}if(s!=="")this._handleUnknownRouteRegistration(s,"setRouteMeta","metadata stored");this._meta.set(s,i);return this},navigationSettled:function t(){if(this._phase.kind==="idle"||this._phase.kind==="committing"){return Promise.resolve(this._lastSettlement??{status:l.Committed,route:this._currentRoute,hash:this._currentHash??""})}return new Promise(t=>{this._settlementResolvers.push(t)})},attachNavigationSettled:function t(e,s,i){return this.attachEvent("navigationSettled",e,s,i)},detachNavigationSettled:function t(e,s){this.detachEvent("navigationSettled",e,s);return this},_flushSettlement:function t(s){this._lastSettlement=s;e.debug(`Navigation settled: ${s.status}`,s.hash,g);queueMicrotask(()=>this._settleMatchWaiters());const i=this._settlementResolvers;this._settlementResolvers=[];for(const t of i){t(s)}if(this._destroyed)return;try{this.fireEvent("navigationSettled",s)}catch(t){e.error("A navigationSettled handler threw",String(t),g)}},navTo:function s(i,n,r,a,o){if(this._destroyed){e.warning("navTo: router is destroyed, ignoring",i,g);return this}const{componentTargetInfo:h,replace:u,guardOptions:c}=this._resolveNavToArgs(r,a,o);if(this._phase.kind==="committing"&&this._phase.origin==="redirect"){t.prototype.navTo.call(this,i,n,h,u);return this}if(!this.isInitialized()){t.prototype.navTo.call(this,i,n,h,u);return this}const d=this.getRoute(i);if(!d){this._cancelPendingNavigation(true);t.prototype.navTo.call(this,i,n,h,u);return this}const l=d.getURL(n??{});const _=this._matchRoute(l);const p=_.name;if(l===this._currentHash){this._cancelPendingNavigation(true);const e=this.getHashChanger().getHash();if(e===undefined||e===l){t.prototype.navTo.call(this,i,n,h,u)}return this}const m=c?.skipGuards===true||this._options.navToPreflight==="bypass";if(!m&&this._phase.kind==="evaluating"&&l===this._phase.attempt.hash){return this}if(!m&&this._options.navToPreflight==="off"){t.prototype.navTo.call(this,i,n,h,u);return this}const H=this._pendingRestoresHash();this._cancelPendingNavigation();if(m){this._navigateAllowed(i,n,h,u,l,p,H);return this}const v=this._startAttempt(l,H);const{generation:R}=v;const y=this._createGuardContext(_,l,v.controller.signal);const k=this._evaluateGuards(y);if(f(k)){this._applyWhenDecided(k,t=>{if(R!==this._parseGeneration){e.debug("Async preflight result discarded (superseded by newer navigation)",l,g);return}this._applyPreflightDecision(t,i,n,h,u,l,p,y.bag,v)},l,H);return this}this._applyPreflightDecision(k,i,n,h,u,l,p,y.bag,v);return this},_navigateAllowed:function e(s,n,r,a,o,h,u){this._phase={kind:"committing",route:h,hash:o,origin:"preflight",restoreHash:u,writtenOver:i.getInstance().getHash()};try{t.prototype.navTo.call(this,s,n,r,a);if(!this._commitAfterNavTo(r)){this._blockNavigation(o,u)}}finally{if(this._phase.kind==="committing"){this._phase=D}}},_applyPreflightDecision:function t(e,s,i,n,r,a,o,h,u){if(u.generation!==this._parseGeneration)return;switch(e.action){case"allow":this._navigateAllowed(s,i,n,r,a,o,u.restoreHash);break;case"block":this._blockNavigation(a,u.restoreHash);break;case"redirect":this._startRedirectChain(e.target,a,h,u,r);break;case"error":this._errorNavigation(e.error,a,u.restoreHash);break}},parse:function s(r){if(this._destroyed){t.prototype.parse.call(this,r);return}const a=this._reportedHash===r;this._reportedHash=null;if(a&&this._reportOutdated)return;if(r===this._suppressedHash)return;const o=this._undo;if(o?.started&&o.fullHash===i.getInstance().getHash()){this._undo=null;this._currentHash=r;this._finishRestore(r);return}const h=this._phase;const u=h.kind==="awaitingHash"?h.commit:h.kind==="committing"?h:null;if(u?.hash===r){this._phase=u;this._commitNavigation(r,u.route);return}const c=this._currentHash;if(r===c){if(this._pendingRestoresHash()){if(this._phase.kind==="evaluating")this._cancelPendingNavigation();else this._undo=null}else{t.prototype.parse.call(this,r)}return}const d=this._matchRoute(r);const l=d.name;const _=this._pendingRestoresHash()?o:null;const p=this._phase.kind==="restoring";this._cancelPendingNavigation();if(this._currentHash!==c)return;this._undo=p?null:this._describeUndo(_,a);if(this._undo&&u===h&&!u.restoreHash)this._undo.fullHash=u.writtenOver;const m=a?n.getInstance().getDirection():undefined;const H=this._startAttempt(r,true,m);const{generation:v}=H;const R=this._createGuardContext(d,r,H.controller.signal);const y=this._evaluateGuards(R);if(f(y)){this._applyWhenDecided(y,t=>{if(v!==this._parseGeneration){e.debug("Async guard result discarded (superseded by newer navigation)",r,g);return}this._applyDecision(t,r,l,R.bag,H)},r,true);return}this._applyDecision(y,r,l,R.bag,H)},stop:function e(){if(this._blockLoad)this._blockLoad.start=false;this._cancelPendingNavigation();this._undo=null;if(this._currentHash!==null)this._stoppedRoute=this._currentRoute;this._currentRoute="";this._currentHash=null;this._lastSettlement=null;this._detachHashListeners();t.prototype.stop.call(this);return this},_detachHashListeners:function t(){this.getHashChanger().detachEvent("hashChanged",this._onHashReported,this);i.getInstance().detachEvent("hashChanged",this._onRootHashChanged,this);this._rootHashChanger=null},_cancelPendingNavigation:function t(e=false){++this._parseGeneration;const s=this._phase;const i=this._pendingRestoresHash();this._phase=D;if(s.kind==="idle"||s.kind==="committing")return;if(s.kind==="restoring"){this._flushSettlement(s.result);return}if(s.kind==="evaluating")s.attempt.controller.abort();this._settleUncommitted({status:l.Cancelled,route:this._currentRoute,hash:this._currentHash??""},s.kind==="evaluating"?s.attempt.hash:s.commit.hash,e&&i)},_pendingRestoresHash:function t(){const e=this._phase;if(e.kind==="evaluating")return e.attempt.restoreHash;if(e.kind==="committing")return e.restoreHash;return e.kind==="awaitingHash"&&e.commit.restoreHash},_startAttempt:function t(e,s,i){if(this._phase.kind==="evaluating")this._phase.attempt.controller.abort();const n={hash:e,controller:new AbortController,generation:++this._parseGeneration,restoreHash:s,direction:i};this._phase={kind:"evaluating",attempt:n};return n},_applyWhenDecided:function t(s,i,n,r){if(this._phase.kind==="evaluating")this._phase={...this._phase,postponed:true};s.then(t=>{const s=this._lastSettlement;try{i(t)}catch(t){e.error("Navigation failed after its guards had settled",t instanceof Error?t:String(t),g);if(this._lastSettlement===s){this._errorNavigation(t,n,r)}}})},_applyDecision:function t(e,s,i,n,r){if(r.generation!==this._parseGeneration)return;switch(e.action){case"allow":this._phase={kind:"committing",route:i,hash:s,origin:"parse",restoreHash:false};this._commitNavigation(s,i);break;case"block":this._blockNavigation(s);break;case"redirect":this._startRedirectChain(e.target,s,n,r,true);break;case"error":this._errorNavigation(e.error,s);break}},_alignTitleHistory:function t(e){if(e===N.NewEntry||e===N.Forwards){Reflect.set(this,"_bLastHashReplaced",false)}else if(e===N.Backwards){const t=this.getTitleHistory();const e=t.at(-1);const s=t.at(-2);if(m(e)&&m(s)&&!e.isHome&&e.title!==s.title){t.splice(-2,1)}}},_commitNavigation:function e(s,i){const n=this._phase.kind==="committing"&&this._phase.origin==="redirect";if(this._phase.kind==="committing")this._alignTitleHistory(this._phase.direction);this._undo=null;this._currentHash=s;this._currentRoute=i;this._phase=D;this._flushSettlement({status:n?l.Redirected:this._currentRoute===""?l.Bypassed:l.Committed,route:this._currentRoute,hash:s});if(this._currentHash!==s)return;t.prototype.parse.call(this,s)},_commitAfterNavTo:function t(e){const s=this._phase;if(s.kind!=="committing")return true;if(this.getHashChanger().getHash()===s.hash){this._commitNavigation(s.hash,s.route);return true}if(!e||Object.keys(e).length===0)return false;this._phase={kind:"awaitingHash",commit:s};return true},_redirect:function t(s,i){const n=typeof s==="string"?s:s.route;const r=this.getRoute(n);if(!r){e.warning(`Guard redirect target "${n}" is not a known route, treating as blocked`,undefined,g);this._blockNavigation(i.attemptedHash,i.restoreHash);return}let a;try{a=r.getURL(typeof s==="string"?{}:s.parameters??{})}catch(t){e.error(`Guard redirect target "${n}" has no valid hash, navigation failed`,String(t),g);this._errorNavigation(t,i.attemptedHash,i.restoreHash);return}if(i.visited.has(a)){e.error(`Guard redirect loop detected: ${[...i.visited,a].join(" -> ")}`,undefined,g);this._blockNavigation(i.attemptedHash,i.restoreHash);return}if(i.visited.size>T){e.error(`Guard redirect chain exceeded maximum depth (${T}): ${[...i.visited].join(" -> ")}`,undefined,g);this._blockNavigation(i.attemptedHash,i.restoreHash);return}i.visited.add(a);const o=this._matchRoute(a);const h=o.name;const u=this._createGuardContext(o,a,i.signal,i);const c=this._evaluateGuards(u,true);if(f(c)){this._applyWhenDecided(c,t=>this._applyRedirectDecision(t,s,a,h,i),i.attemptedHash,i.restoreHash);return}this._applyRedirectDecision(c,s,a,h,i)},_applyRedirectDecision:function e(s,n,r,a,o){if(o.generation!==this._parseGeneration)return;switch(s.action){case"allow":{const e=typeof n==="string"?undefined:n.componentTargetInfo;if(r===this._currentHash){this._phase=D;this._settleUncommitted({status:l.Redirected,route:this._currentRoute,hash:r},o.attemptedHash,o.restoreHash,typeof n!=="string"&&e?()=>{if(this.getHashChanger().getHash()!==r)return;t.prototype.navTo.call(this,n.route,n.parameters??{},e,o.replace)}:undefined);break}this._phase={kind:"committing",route:a,hash:r,origin:"redirect",direction:o.direction,restoreHash:o.restoreHash,writtenOver:i.getInstance().getHash()};try{const t=this.getHashChanger().getHash()===r;if(typeof n==="string"){if(!t)this.navTo(n,{},{},o.replace)}else if(!t||e){this.navTo(n.route,n.parameters??{},e,o.replace)}if(!this._commitAfterNavTo(e)){this._blockNavigation(o.attemptedHash,o.restoreHash)}}finally{if(this._phase.kind==="committing"){this._phase=D}}break}case"block":this._blockNavigation(o.attemptedHash,o.restoreHash);break;case"redirect":this._redirect(s.target,o);break;case"error":this._errorNavigation(s.error,o.attemptedHash,o.restoreHash);break}},_matchRoute:function t(e){const s=this.getRouteInfoByHash(e);return{name:s?.name??"",arguments:s?.arguments??{}}},_greedyMatches:function t(e,s){return this._greedyRouteNames.filter(t=>t!==s&&this.getRoute(t)?.match(e))},_evaluateGuards:function t(e,s=false){return this._pipeline.evaluate(e,{skipLeaveGuards:s,alsoLeaving:this._greedyMatches(e.fromHash,e.fromRoute),alsoEntering:this._greedyMatches(e.toHash,e.toRoute)})},_createGuardContext:function t(e,s,i,n){const r=n?n.fromRoute:this._currentRoute;return{toRoute:e.name,toHash:s,toArguments:e.arguments,fromRoute:r,fromHash:n?n.fromHash:this._currentHash??"",signal:i,bag:n?n.bag:new Map,toMeta:this.getRouteMeta(e.name),fromMeta:this.getRouteMeta(r),ownerComponent:this._ownerComponent}},_startRedirectChain:function t(e,s,i,n,r){const a=new Set;a.add(s);this._redirect(e,{visited:a,attemptedHash:s,restoreHash:n.restoreHash,replace:r,direction:n.direction,fromRoute:this._currentRoute,fromHash:this._currentHash??"",signal:n.controller.signal,generation:n.generation,bag:i})},_blockNavigation:function t(e,s=true){this._phase=D;this._settleUncommitted({status:l.Blocked,route:this._currentRoute,hash:this._currentHash??""},e,s)},_errorNavigation:function t(e,s,i=true){this._phase=D;this._settleUncommitted({status:l.Error,route:this._currentRoute,hash:this._currentHash??"",error:e},s,i)},_settleUncommitted:function t(e,s,i,n){const r=i&&this._currentHash===null&&!!s;if(i&&!r&&!this._undoHashChange(e,n))return;this._flushSettlement(e);n?.();if(r&&this._currentHash===null)this._restoreHash("",false)},_describeUndo:function t(e,s){if(!s)return e;const n=i.getInstance().getHash();const r=L;if(!e)return{first:n,fullHash:undefined,shown:n,step:r,started:false};const a=e.step&&r?e.step.offset+r.offset:0;return{first:e.first,fullHash:e.fullHash,shown:n,step:r&&a?{offset:a,href:r.href}:null,started:false}},_undoHashChange:function t(e,s){const n=this._undo;const r=this._currentHash;const a=i.getInstance().getHash();if(n===null||r===null||n.shown!==a||n.fullHash===a){this._restoreHash(r??"");return true}const o=window.location.href;n.started=true;this._phase={kind:"restoring",result:e,whenBack:s};if(P===o){}else if(n.step){P=o;window.history.go(-n.step.offset)}else if(n.fullHash===undefined){this._phase={...this._phase,awaitsReport:true}}else{this._replaceFullHash(n.fullHash)}return false},_replaceFullHash:function t(e){i.getInstance().replaceHash(e,N.Unknown);this._finishRestore()},_finishRestore:function t(e){const s=this._phase;if(s.kind!=="restoring")return;this._phase=D;this._flushSettlement(e===undefined?s.result:{...s.result,hash:e});s.whenBack?.()},_restoreHash:function t(e,s=true){const i=this.getHashChanger();if(i.getHash()===e)return;this._suppressedHash=s?e:null;void i.replaceHash(e,N.Unknown);this._suppressedHash=null},_collectRoutePatterns:function t(){const e=[];for(const t of this._routeNames){const s=this.getRoute(t)?.getPattern();if(s!==undefined)e.push({name:t,pattern:s})}return e},_registerManifestGuard:function t(s,i,n){try{if(s.route==="*"){this.addGuard(i);return}if(s.type==="leave"){this._handleUnknownRouteRegistration(s.route,"addLeaveGuard");this._pipeline.addLeaveGuard(s.route,i,n)}else{this._handleUnknownRouteRegistration(s.route,"addRouteGuard");this._pipeline.addEnterGuard(s.route,i,n)}this._manifestGuards.push({descriptor:s,fn:i})}catch(t){e.error(`guardRouter.guards: failed to register "${s.modulePath}"`,String(t),g)}},_registerLazyGuards:function t(e){for(const t of e){for(const e of v(t))this._registerManifestGuard(t,e)}},destroy:function e(){if(this._destroyed)return this;this._destroyed=true;this._pipeline.clear();this._pendingGuardDescriptors=[];this._sourceDescriptors=[];this._manifestGuards=[];this._cancelPendingNavigation();this._lastSettlement=null;this._detachHashListeners();this._meta.clear();t.prototype.destroy.call(this);return this}});return E});
|
|
2
2
|
//# sourceMappingURL=Router.js.map
|