@frui.ts/screens
Advanced tools
Comparing version 1.0.0-alpha.7 to 1.0.0-alpha.8
@@ -154,2 +154,5 @@ "use strict"; | ||
_d.sent(); | ||
if ((0, findChildResult_1.isChildFoundResult)(childResult) && childResult.attachToParent !== false) { | ||
this.connectChild(childResult.newChild); | ||
} | ||
(0, mobx_1.runInAction)(function () { return (_this.activeChildValue = childResult.newChild); }); | ||
@@ -159,7 +162,4 @@ _d.label = 8; | ||
if (!(0, findChildResult_1.isChildFoundResult)(childResult)) return [3, 10]; | ||
if (childResult.attachToParent !== false) { | ||
this.connectChild(childResult.newChild); | ||
} | ||
newChildNavigator = (0, screenBase_1.getNavigator)(childResult.newChild); | ||
return [4, (newChildNavigator === null || newChildNavigator === void 0 ? void 0 : newChildNavigator.navigate((_c = childResult.pathForChild) !== null && _c !== void 0 ? _c : path.slice(1)))]; | ||
return [4, (newChildNavigator === null || newChildNavigator === void 0 ? void 0 : newChildNavigator.navigate((_c = childResult.pathForChild) !== null && _c !== void 0 ? _c : path.slice(this.getNavigationStateLength())))]; | ||
case 9: | ||
@@ -166,0 +166,0 @@ _d.sent(); |
@@ -5,5 +5,5 @@ import LifecycleScreenNavigatorBase from "../lifecycleScreenNavigatorBase"; | ||
readonly children: TChild[]; | ||
constructor(screen?: TScreen, eventHub?: ScreenLifecycleEventHub<TScreen>); | ||
constructor(screen?: TScreen, navigationPrefix?: string, eventHub?: ScreenLifecycleEventHub<TScreen>); | ||
private handleChildrenChanged; | ||
connectChild(child: TChild): void; | ||
} |
@@ -37,4 +37,4 @@ "use strict"; | ||
__extends(AllChildrenActiveConductor, _super); | ||
function AllChildrenActiveConductor(screen, eventHub) { | ||
var _this = _super.call(this, screen, eventHub) || this; | ||
function AllChildrenActiveConductor(screen, navigationPrefix, eventHub) { | ||
var _this = _super.call(this, screen, navigationPrefix, eventHub) || this; | ||
_this.handleChildrenChanged = function (change) { | ||
@@ -41,0 +41,0 @@ var e_1, _a; |
@@ -8,3 +8,3 @@ import type { FindChildResult } from "../../models/findChildResult"; | ||
preserveActiveChild: boolean; | ||
constructor(screen?: TScreen, eventHub?: ScreenLifecycleEventHub<TScreen>); | ||
constructor(screen?: TScreen, navigationPrefix?: string, eventHub?: ScreenLifecycleEventHub<TScreen>); | ||
canChangeActiveChild: (context: NavigationContext<TScreen>, currentChild: TChild | undefined) => Promise<boolean>; | ||
@@ -11,0 +11,0 @@ findNavigationChild: (context: NavigationContext<TScreen>, currentChild: TChild | undefined) => FindChildResult<TChild>; |
@@ -73,10 +73,11 @@ "use strict"; | ||
__extends(OneOfListActiveConductor, _super); | ||
function OneOfListActiveConductor(screen, eventHub) { | ||
var _this = _super.call(this, screen, eventHub) || this; | ||
function OneOfListActiveConductor(screen, navigationPrefix, eventHub) { | ||
var _this = _super.call(this, screen, navigationPrefix, eventHub) || this; | ||
_this.preserveActiveChild = false; | ||
_this.canChangeActiveChild = function (context, currentChild) { return __awaiter(_this, void 0, void 0, function () { | ||
var newNavigationName, activeChildNavigator; | ||
var pathElementsToSkip, newNavigationName, activeChildNavigator; | ||
var _a; | ||
return __generator(this, function (_b) { | ||
newNavigationName = (_a = context.path[1]) === null || _a === void 0 ? void 0 : _a.name; | ||
pathElementsToSkip = this.getNavigationStateLength(); | ||
newNavigationName = (_a = context.path[pathElementsToSkip]) === null || _a === void 0 ? void 0 : _a.name; | ||
activeChildNavigator = (0, screenBase_1.getNavigator)(this.activeChild); | ||
@@ -91,3 +92,4 @@ if (!activeChildNavigator || activeChildNavigator.navigationName === newNavigationName) { | ||
var _a; | ||
var searchedNavigationName = (_a = context.path[1]) === null || _a === void 0 ? void 0 : _a.name; | ||
var pathElementsToSkip = _this.getNavigationStateLength(); | ||
var searchedNavigationName = (_a = context.path[pathElementsToSkip]) === null || _a === void 0 ? void 0 : _a.name; | ||
var newChild = _this.findChild(searchedNavigationName); | ||
@@ -94,0 +96,0 @@ return { newChild: newChild, closePrevious: false }; |
@@ -16,7 +16,8 @@ import type { NavigationContext } from "../models/navigationContext"; | ||
parent: ScreenNavigator | undefined; | ||
constructor(screen?: TScreen, eventHub?: ScreenLifecycleEventHub<TScreen>); | ||
constructor(screen?: TScreen, navigationPrefix?: string, eventHub?: ScreenLifecycleEventHub<TScreen>); | ||
canNavigate(path: PathElement[]): Promise<boolean>; | ||
getNavigationParams?: () => TNavigationParams | undefined; | ||
getNavigationState: () => PathElement[]; | ||
createDefaultNavigationState(): { | ||
getNavigationStateLength: () => number; | ||
protected createDefaultNavigationState(): { | ||
name: string; | ||
@@ -23,0 +24,0 @@ params: TNavigationParams | undefined; |
@@ -86,6 +86,7 @@ "use strict"; | ||
var LifecycleScreenNavigatorBase = (function () { | ||
function LifecycleScreenNavigatorBase(screen, eventHub) { | ||
function LifecycleScreenNavigatorBase(screen, navigationPrefix, eventHub) { | ||
var _this = this; | ||
this.parent = undefined; | ||
this.getNavigationState = function () { return [_this.createDefaultNavigationState()]; }; | ||
this.getNavigationStateLength = function () { return 1; }; | ||
this.isInitializedValue = false; | ||
@@ -98,2 +99,6 @@ this.clearInitializePromise = function () { return (_this.initializePromise = undefined); }; | ||
this.eventHub = eventHub !== null && eventHub !== void 0 ? eventHub : screen === null || screen === void 0 ? void 0 : screen.events; | ||
if (navigationPrefix) { | ||
this.getNavigationState = function () { return [{ name: navigationPrefix }, _this.createDefaultNavigationState()]; }; | ||
this.getNavigationStateLength = function () { return 2; }; | ||
} | ||
} | ||
@@ -100,0 +105,0 @@ Object.defineProperty(LifecycleScreenNavigatorBase.prototype, "navigationName", { |
@@ -25,7 +25,3 @@ "use strict"; | ||
function SimpleScreenNavigator(screen, navigationPrefix, eventHub) { | ||
var _this = _super.call(this, screen, eventHub) || this; | ||
if (navigationPrefix) { | ||
_this.getNavigationState = function () { return [{ name: navigationPrefix }, _this.createDefaultNavigationState()]; }; | ||
} | ||
return _this; | ||
return _super.call(this, screen, navigationPrefix, eventHub) || this; | ||
} | ||
@@ -32,0 +28,0 @@ return SimpleScreenNavigator; |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "1.0.0-alpha.7", | ||
"version": "1.0.0-alpha.8", | ||
"description": "Frui.ts core classes for application structure and navigation", | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@frui.ts/helpers": "^1.0.0-alpha.7", | ||
"@frui.ts/helpers": "^1.0.0-alpha.8", | ||
"route-parser": "^0.0.5" | ||
@@ -50,3 +50,3 @@ }, | ||
}, | ||
"gitHead": "bb4530b43df3c9e63cfd03ee46eb49745a1dd6aa" | ||
"gitHead": "e774efd68e7bd49b83461fdcae0d110c2b69da90" | ||
} |
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 not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
155538
1816